]> git.openstreetmap.org Git - rails.git/blob - vendor/assets/iD/iD.js
Update to iD v2.27.0
[rails.git] / vendor / assets / iD / iD.js
1 (() => {
2   var __create = Object.create;
3   var __defProp = Object.defineProperty;
4   var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5   var __getOwnPropNames = Object.getOwnPropertyNames;
6   var __getProtoOf = Object.getPrototypeOf;
7   var __hasOwnProp = Object.prototype.hasOwnProperty;
8   var __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.0",
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.3.0",
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.27",
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     function stickyCursor(func) {
25873       const supportedTypes = ["text", "search", "url", "tel", "password"];
25874       if (!supportedTypes.includes(selection2.node()?.type)) {
25875         return func;
25876       }
25877       return function() {
25878         const cursor = { start: this.selectionStart, end: this.selectionEnd };
25879         func.apply(this, arguments);
25880         this.setSelectionRange(cursor.start, cursor.end);
25881       };
25882     }
25883     if (arguments.length === 1) {
25884       return selection2.property("value");
25885     }
25886     if (shouldUpdate === void 0) {
25887       shouldUpdate = (a2, b2) => a2 !== b2;
25888     }
25889     return selection2.each(stickyCursor(setValue(value, shouldUpdate)));
25890   }
25891
25892   // modules/util/keybinding.js
25893   function utilKeybinding(namespace) {
25894     var _keybindings = {};
25895     function testBindings(d3_event, isCapturing) {
25896       var didMatch = false;
25897       var bindings = Object.keys(_keybindings).map(function(id2) {
25898         return _keybindings[id2];
25899       });
25900       var i3, binding;
25901       for (i3 = 0; i3 < bindings.length; i3++) {
25902         binding = bindings[i3];
25903         if (!binding.event.modifiers.shiftKey)
25904           continue;
25905         if (!!binding.capture !== isCapturing)
25906           continue;
25907         if (matches(d3_event, binding, true)) {
25908           binding.callback(d3_event);
25909           didMatch = true;
25910           break;
25911         }
25912       }
25913       if (didMatch)
25914         return;
25915       for (i3 = 0; i3 < bindings.length; i3++) {
25916         binding = bindings[i3];
25917         if (binding.event.modifiers.shiftKey)
25918           continue;
25919         if (!!binding.capture !== isCapturing)
25920           continue;
25921         if (matches(d3_event, binding, false)) {
25922           binding.callback(d3_event);
25923           break;
25924         }
25925       }
25926       function matches(d3_event2, binding2, testShift) {
25927         var event = d3_event2;
25928         var isMatch = false;
25929         var tryKeyCode = true;
25930         if (event.key !== void 0) {
25931           tryKeyCode = event.key.charCodeAt(0) > 127;
25932           isMatch = true;
25933           if (binding2.event.key === void 0) {
25934             isMatch = false;
25935           } else if (Array.isArray(binding2.event.key)) {
25936             if (binding2.event.key.map(function(s2) {
25937               return s2.toLowerCase();
25938             }).indexOf(event.key.toLowerCase()) === -1) {
25939               isMatch = false;
25940             }
25941           } else {
25942             if (event.key.toLowerCase() !== binding2.event.key.toLowerCase()) {
25943               isMatch = false;
25944             }
25945           }
25946         }
25947         if (!isMatch && (tryKeyCode || binding2.event.modifiers.altKey)) {
25948           isMatch = event.keyCode === binding2.event.keyCode;
25949         }
25950         if (!isMatch)
25951           return false;
25952         if (!(event.ctrlKey && event.altKey)) {
25953           if (event.ctrlKey !== binding2.event.modifiers.ctrlKey)
25954             return false;
25955           if (event.altKey !== binding2.event.modifiers.altKey)
25956             return false;
25957         }
25958         if (event.metaKey !== binding2.event.modifiers.metaKey)
25959           return false;
25960         if (testShift && event.shiftKey !== binding2.event.modifiers.shiftKey)
25961           return false;
25962         return true;
25963       }
25964     }
25965     function capture(d3_event) {
25966       testBindings(d3_event, true);
25967     }
25968     function bubble(d3_event) {
25969       var tagName = select_default2(d3_event.target).node().tagName;
25970       if (tagName === "INPUT" || tagName === "SELECT" || tagName === "TEXTAREA") {
25971         return;
25972       }
25973       testBindings(d3_event, false);
25974     }
25975     function keybinding(selection2) {
25976       selection2 = selection2 || select_default2(document);
25977       selection2.on("keydown.capture." + namespace, capture, true);
25978       selection2.on("keydown.bubble." + namespace, bubble, false);
25979       return keybinding;
25980     }
25981     keybinding.unbind = function(selection2) {
25982       _keybindings = [];
25983       selection2 = selection2 || select_default2(document);
25984       selection2.on("keydown.capture." + namespace, null);
25985       selection2.on("keydown.bubble." + namespace, null);
25986       return keybinding;
25987     };
25988     keybinding.clear = function() {
25989       _keybindings = {};
25990       return keybinding;
25991     };
25992     keybinding.off = function(codes, capture2) {
25993       var arr = utilArrayUniq([].concat(codes));
25994       for (var i3 = 0; i3 < arr.length; i3++) {
25995         var id2 = arr[i3] + (capture2 ? "-capture" : "-bubble");
25996         delete _keybindings[id2];
25997       }
25998       return keybinding;
25999     };
26000     keybinding.on = function(codes, callback, capture2) {
26001       if (typeof callback !== "function") {
26002         return keybinding.off(codes, capture2);
26003       }
26004       var arr = utilArrayUniq([].concat(codes));
26005       for (var i3 = 0; i3 < arr.length; i3++) {
26006         var id2 = arr[i3] + (capture2 ? "-capture" : "-bubble");
26007         var binding = {
26008           id: id2,
26009           capture: capture2,
26010           callback,
26011           event: {
26012             key: void 0,
26013             // preferred
26014             keyCode: 0,
26015             // fallback
26016             modifiers: {
26017               shiftKey: false,
26018               ctrlKey: false,
26019               altKey: false,
26020               metaKey: false
26021             }
26022           }
26023         };
26024         if (_keybindings[id2]) {
26025           console.warn('warning: duplicate keybinding for "' + id2 + '"');
26026         }
26027         _keybindings[id2] = binding;
26028         var matches = arr[i3].toLowerCase().match(/(?:(?:[^+⇧⌃⌥⌘])+|[⇧⌃⌥⌘]|\+\+|^\+$)/g);
26029         for (var j3 = 0; j3 < matches.length; j3++) {
26030           if (matches[j3] === "++")
26031             matches[j3] = "+";
26032           if (matches[j3] in utilKeybinding.modifierCodes) {
26033             var prop = utilKeybinding.modifierProperties[utilKeybinding.modifierCodes[matches[j3]]];
26034             binding.event.modifiers[prop] = true;
26035           } else {
26036             binding.event.key = utilKeybinding.keys[matches[j3]] || matches[j3];
26037             if (matches[j3] in utilKeybinding.keyCodes) {
26038               binding.event.keyCode = utilKeybinding.keyCodes[matches[j3]];
26039             }
26040           }
26041         }
26042       }
26043       return keybinding;
26044     };
26045     return keybinding;
26046   }
26047   utilKeybinding.modifierCodes = {
26048     // Shift key, ⇧
26049     "\u21E7": 16,
26050     shift: 16,
26051     // CTRL key, on Mac: ⌃
26052     "\u2303": 17,
26053     ctrl: 17,
26054     // ALT key, on Mac: ⌥ (Alt)
26055     "\u2325": 18,
26056     alt: 18,
26057     option: 18,
26058     // META, on Mac: ⌘ (CMD), on Windows (Win), on Linux (Super)
26059     "\u2318": 91,
26060     meta: 91,
26061     cmd: 91,
26062     "super": 91,
26063     win: 91
26064   };
26065   utilKeybinding.modifierProperties = {
26066     16: "shiftKey",
26067     17: "ctrlKey",
26068     18: "altKey",
26069     91: "metaKey"
26070   };
26071   utilKeybinding.plusKeys = ["plus", "ffplus", "=", "ffequals", "\u2260", "\xB1"];
26072   utilKeybinding.minusKeys = ["_", "-", "ffminus", "dash", "\u2013", "\u2014"];
26073   utilKeybinding.keys = {
26074     // Backspace key, on Mac: ⌫ (Backspace)
26075     "\u232B": "Backspace",
26076     backspace: "Backspace",
26077     // Tab Key, on Mac: ⇥ (Tab), on Windows ⇥⇥
26078     "\u21E5": "Tab",
26079     "\u21C6": "Tab",
26080     tab: "Tab",
26081     // Return key, ↩
26082     "\u21A9": "Enter",
26083     "\u21B5": "Enter",
26084     "\u23CE": "Enter",
26085     "return": "Enter",
26086     enter: "Enter",
26087     "\u2305": "Enter",
26088     // Pause/Break key
26089     "pause": "Pause",
26090     "pause-break": "Pause",
26091     // Caps Lock key, ⇪
26092     "\u21EA": "CapsLock",
26093     caps: "CapsLock",
26094     "caps-lock": "CapsLock",
26095     // Escape key, on Mac: ⎋, on Windows: Esc
26096     "\u238B": ["Escape", "Esc"],
26097     escape: ["Escape", "Esc"],
26098     esc: ["Escape", "Esc"],
26099     // Space key
26100     space: [" ", "Spacebar"],
26101     // Page-Up key, or pgup, on Mac: ↖
26102     "\u2196": "PageUp",
26103     pgup: "PageUp",
26104     "page-up": "PageUp",
26105     // Page-Down key, or pgdown, on Mac: ↘
26106     "\u2198": "PageDown",
26107     pgdown: "PageDown",
26108     "page-down": "PageDown",
26109     // END key, on Mac: ⇟
26110     "\u21DF": "End",
26111     end: "End",
26112     // HOME key, on Mac: ⇞
26113     "\u21DE": "Home",
26114     home: "Home",
26115     // Insert key, or ins
26116     ins: "Insert",
26117     insert: "Insert",
26118     // Delete key, on Mac: ⌦ (Delete)
26119     "\u2326": ["Delete", "Del"],
26120     del: ["Delete", "Del"],
26121     "delete": ["Delete", "Del"],
26122     // Left Arrow Key, or ←
26123     "\u2190": ["ArrowLeft", "Left"],
26124     left: ["ArrowLeft", "Left"],
26125     "arrow-left": ["ArrowLeft", "Left"],
26126     // Up Arrow Key, or ↑
26127     "\u2191": ["ArrowUp", "Up"],
26128     up: ["ArrowUp", "Up"],
26129     "arrow-up": ["ArrowUp", "Up"],
26130     // Right Arrow Key, or →
26131     "\u2192": ["ArrowRight", "Right"],
26132     right: ["ArrowRight", "Right"],
26133     "arrow-right": ["ArrowRight", "Right"],
26134     // Up Arrow Key, or ↓
26135     "\u2193": ["ArrowDown", "Down"],
26136     down: ["ArrowDown", "Down"],
26137     "arrow-down": ["ArrowDown", "Down"],
26138     // odities, stuff for backward compatibility (browsers and code):
26139     // Num-Multiply, or *
26140     "*": ["*", "Multiply"],
26141     star: ["*", "Multiply"],
26142     asterisk: ["*", "Multiply"],
26143     multiply: ["*", "Multiply"],
26144     // Num-Plus or +
26145     "+": ["+", "Add"],
26146     "plus": ["+", "Add"],
26147     // Num-Subtract, or -
26148     "-": ["-", "Subtract"],
26149     subtract: ["-", "Subtract"],
26150     "dash": ["-", "Subtract"],
26151     // Semicolon
26152     semicolon: ";",
26153     // = or equals
26154     equals: "=",
26155     // Comma, or ,
26156     comma: ",",
26157     // Period, or ., or full-stop
26158     period: ".",
26159     "full-stop": ".",
26160     // Slash, or /, or forward-slash
26161     slash: "/",
26162     "forward-slash": "/",
26163     // Tick, or `, or back-quote
26164     tick: "`",
26165     "back-quote": "`",
26166     // Open bracket, or [
26167     "open-bracket": "[",
26168     // Back slash, or \
26169     "back-slash": "\\",
26170     // Close backet, or ]
26171     "close-bracket": "]",
26172     // Apostrophe, or Quote, or '
26173     quote: "'",
26174     apostrophe: "'",
26175     // NUMPAD 0-9
26176     "num-0": "0",
26177     "num-1": "1",
26178     "num-2": "2",
26179     "num-3": "3",
26180     "num-4": "4",
26181     "num-5": "5",
26182     "num-6": "6",
26183     "num-7": "7",
26184     "num-8": "8",
26185     "num-9": "9",
26186     // F1-F25
26187     f1: "F1",
26188     f2: "F2",
26189     f3: "F3",
26190     f4: "F4",
26191     f5: "F5",
26192     f6: "F6",
26193     f7: "F7",
26194     f8: "F8",
26195     f9: "F9",
26196     f10: "F10",
26197     f11: "F11",
26198     f12: "F12",
26199     f13: "F13",
26200     f14: "F14",
26201     f15: "F15",
26202     f16: "F16",
26203     f17: "F17",
26204     f18: "F18",
26205     f19: "F19",
26206     f20: "F20",
26207     f21: "F21",
26208     f22: "F22",
26209     f23: "F23",
26210     f24: "F24",
26211     f25: "F25"
26212   };
26213   utilKeybinding.keyCodes = {
26214     // Backspace key, on Mac: ⌫ (Backspace)
26215     "\u232B": 8,
26216     backspace: 8,
26217     // Tab Key, on Mac: ⇥ (Tab), on Windows ⇥⇥
26218     "\u21E5": 9,
26219     "\u21C6": 9,
26220     tab: 9,
26221     // Return key, ↩
26222     "\u21A9": 13,
26223     "\u21B5": 13,
26224     "\u23CE": 13,
26225     "return": 13,
26226     enter: 13,
26227     "\u2305": 13,
26228     // Pause/Break key
26229     "pause": 19,
26230     "pause-break": 19,
26231     // Caps Lock key, ⇪
26232     "\u21EA": 20,
26233     caps: 20,
26234     "caps-lock": 20,
26235     // Escape key, on Mac: ⎋, on Windows: Esc
26236     "\u238B": 27,
26237     escape: 27,
26238     esc: 27,
26239     // Space key
26240     space: 32,
26241     // Page-Up key, or pgup, on Mac: ↖
26242     "\u2196": 33,
26243     pgup: 33,
26244     "page-up": 33,
26245     // Page-Down key, or pgdown, on Mac: ↘
26246     "\u2198": 34,
26247     pgdown: 34,
26248     "page-down": 34,
26249     // END key, on Mac: ⇟
26250     "\u21DF": 35,
26251     end: 35,
26252     // HOME key, on Mac: ⇞
26253     "\u21DE": 36,
26254     home: 36,
26255     // Insert key, or ins
26256     ins: 45,
26257     insert: 45,
26258     // Delete key, on Mac: ⌦ (Delete)
26259     "\u2326": 46,
26260     del: 46,
26261     "delete": 46,
26262     // Left Arrow Key, or ←
26263     "\u2190": 37,
26264     left: 37,
26265     "arrow-left": 37,
26266     // Up Arrow Key, or ↑
26267     "\u2191": 38,
26268     up: 38,
26269     "arrow-up": 38,
26270     // Right Arrow Key, or →
26271     "\u2192": 39,
26272     right: 39,
26273     "arrow-right": 39,
26274     // Up Arrow Key, or ↓
26275     "\u2193": 40,
26276     down: 40,
26277     "arrow-down": 40,
26278     // odities, printing characters that come out wrong:
26279     // Firefox Equals
26280     "ffequals": 61,
26281     // Num-Multiply, or *
26282     "*": 106,
26283     star: 106,
26284     asterisk: 106,
26285     multiply: 106,
26286     // Num-Plus or +
26287     "+": 107,
26288     "plus": 107,
26289     // Num-Subtract, or -
26290     "-": 109,
26291     subtract: 109,
26292     // Vertical Bar / Pipe
26293     "|": 124,
26294     // Firefox Plus
26295     "ffplus": 171,
26296     // Firefox Minus
26297     "ffminus": 173,
26298     // Semicolon
26299     ";": 186,
26300     semicolon: 186,
26301     // = or equals
26302     "=": 187,
26303     "equals": 187,
26304     // Comma, or ,
26305     ",": 188,
26306     comma: 188,
26307     // Dash / Underscore key
26308     "dash": 189,
26309     // Period, or ., or full-stop
26310     ".": 190,
26311     period: 190,
26312     "full-stop": 190,
26313     // Slash, or /, or forward-slash
26314     "/": 191,
26315     slash: 191,
26316     "forward-slash": 191,
26317     // Tick, or `, or back-quote
26318     "`": 192,
26319     tick: 192,
26320     "back-quote": 192,
26321     // Open bracket, or [
26322     "[": 219,
26323     "open-bracket": 219,
26324     // Back slash, or \
26325     "\\": 220,
26326     "back-slash": 220,
26327     // Close backet, or ]
26328     "]": 221,
26329     "close-bracket": 221,
26330     // Apostrophe, or Quote, or '
26331     "'": 222,
26332     quote: 222,
26333     apostrophe: 222
26334   };
26335   var i = 95;
26336   var n = 0;
26337   while (++i < 106) {
26338     utilKeybinding.keyCodes["num-" + n] = i;
26339     ++n;
26340   }
26341   i = 47;
26342   n = 0;
26343   while (++i < 58) {
26344     utilKeybinding.keyCodes[n] = i;
26345     ++n;
26346   }
26347   i = 111;
26348   n = 1;
26349   while (++i < 136) {
26350     utilKeybinding.keyCodes["f" + n] = i;
26351     ++n;
26352   }
26353   i = 64;
26354   while (++i < 91) {
26355     utilKeybinding.keyCodes[String.fromCharCode(i).toLowerCase()] = i;
26356   }
26357
26358   // modules/util/object.js
26359   function utilObjectOmit(obj, omitKeys) {
26360     return Object.keys(obj).reduce(function(result, key) {
26361       if (omitKeys.indexOf(key) === -1) {
26362         result[key] = obj[key];
26363       }
26364       return result;
26365     }, {});
26366   }
26367
26368   // modules/util/rebind.js
26369   function utilRebind(target, source) {
26370     var i3 = 1, n3 = arguments.length, method;
26371     while (++i3 < n3) {
26372       target[method = arguments[i3]] = d3_rebind(target, source, source[method]);
26373     }
26374     return target;
26375   }
26376   function d3_rebind(target, source, method) {
26377     return function() {
26378       var value = method.apply(source, arguments);
26379       return value === source ? target : value;
26380     };
26381   }
26382
26383   // modules/util/session_mutex.js
26384   function utilSessionMutex(name) {
26385     var mutex = {};
26386     var intervalID;
26387     function renew() {
26388       var expires = /* @__PURE__ */ new Date();
26389       expires.setSeconds(expires.getSeconds() + 5);
26390       document.cookie = name + "=1; expires=" + expires.toUTCString() + "; sameSite=strict";
26391     }
26392     mutex.lock = function() {
26393       if (intervalID)
26394         return true;
26395       var cookie = document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + name + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1");
26396       if (cookie)
26397         return false;
26398       renew();
26399       intervalID = window.setInterval(renew, 4e3);
26400       return true;
26401     };
26402     mutex.unlock = function() {
26403       if (!intervalID)
26404         return;
26405       document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; sameSite=strict";
26406       clearInterval(intervalID);
26407       intervalID = null;
26408     };
26409     mutex.locked = function() {
26410       return !!intervalID;
26411     };
26412     return mutex;
26413   }
26414
26415   // modules/util/tiler.js
26416   function utilTiler() {
26417     var _size = [256, 256];
26418     var _scale = 256;
26419     var _tileSize = 256;
26420     var _zoomExtent = [0, 20];
26421     var _translate = [_size[0] / 2, _size[1] / 2];
26422     var _margin = 0;
26423     var _skipNullIsland = false;
26424     function clamp3(num, min3, max3) {
26425       return Math.max(min3, Math.min(num, max3));
26426     }
26427     function nearNullIsland(tile) {
26428       var x2 = tile[0];
26429       var y2 = tile[1];
26430       var z2 = tile[2];
26431       if (z2 >= 7) {
26432         var center = Math.pow(2, z2 - 1);
26433         var width = Math.pow(2, z2 - 6);
26434         var min3 = center - width / 2;
26435         var max3 = center + width / 2 - 1;
26436         return x2 >= min3 && x2 <= max3 && y2 >= min3 && y2 <= max3;
26437       }
26438       return false;
26439     }
26440     function tiler9() {
26441       var z2 = geoScaleToZoom(_scale / (2 * Math.PI), _tileSize);
26442       var z0 = clamp3(Math.round(z2), _zoomExtent[0], _zoomExtent[1]);
26443       var tileMin = 0;
26444       var tileMax = Math.pow(2, z0) - 1;
26445       var log2ts = Math.log(_tileSize) * Math.LOG2E;
26446       var k2 = Math.pow(2, z2 - z0 + log2ts);
26447       var origin = [
26448         (_translate[0] - _scale / 2) / k2,
26449         (_translate[1] - _scale / 2) / k2
26450       ];
26451       var cols = range(
26452         clamp3(Math.floor(-origin[0]) - _margin, tileMin, tileMax + 1),
26453         clamp3(Math.ceil(_size[0] / k2 - origin[0]) + _margin, tileMin, tileMax + 1)
26454       );
26455       var rows = range(
26456         clamp3(Math.floor(-origin[1]) - _margin, tileMin, tileMax + 1),
26457         clamp3(Math.ceil(_size[1] / k2 - origin[1]) + _margin, tileMin, tileMax + 1)
26458       );
26459       var tiles = [];
26460       for (var i3 = 0; i3 < rows.length; i3++) {
26461         var y2 = rows[i3];
26462         for (var j3 = 0; j3 < cols.length; j3++) {
26463           var x2 = cols[j3];
26464           if (i3 >= _margin && i3 <= rows.length - _margin && j3 >= _margin && j3 <= cols.length - _margin) {
26465             tiles.unshift([x2, y2, z0]);
26466           } else {
26467             tiles.push([x2, y2, z0]);
26468           }
26469         }
26470       }
26471       tiles.translate = origin;
26472       tiles.scale = k2;
26473       return tiles;
26474     }
26475     tiler9.getTiles = function(projection2) {
26476       var origin = [
26477         projection2.scale() * Math.PI - projection2.translate()[0],
26478         projection2.scale() * Math.PI - projection2.translate()[1]
26479       ];
26480       this.size(projection2.clipExtent()[1]).scale(projection2.scale() * 2 * Math.PI).translate(projection2.translate());
26481       var tiles = tiler9();
26482       var ts = tiles.scale;
26483       return tiles.map(function(tile) {
26484         if (_skipNullIsland && nearNullIsland(tile)) {
26485           return false;
26486         }
26487         var x2 = tile[0] * ts - origin[0];
26488         var y2 = tile[1] * ts - origin[1];
26489         return {
26490           id: tile.toString(),
26491           xyz: tile,
26492           extent: geoExtent(
26493             projection2.invert([x2, y2 + ts]),
26494             projection2.invert([x2 + ts, y2])
26495           )
26496         };
26497       }).filter(Boolean);
26498     };
26499     tiler9.getGeoJSON = function(projection2) {
26500       var features = tiler9.getTiles(projection2).map(function(tile) {
26501         return {
26502           type: "Feature",
26503           properties: {
26504             id: tile.id,
26505             name: tile.id
26506           },
26507           geometry: {
26508             type: "Polygon",
26509             coordinates: [tile.extent.polygon()]
26510           }
26511         };
26512       });
26513       return {
26514         type: "FeatureCollection",
26515         features
26516       };
26517     };
26518     tiler9.tileSize = function(val) {
26519       if (!arguments.length)
26520         return _tileSize;
26521       _tileSize = val;
26522       return tiler9;
26523     };
26524     tiler9.zoomExtent = function(val) {
26525       if (!arguments.length)
26526         return _zoomExtent;
26527       _zoomExtent = val;
26528       return tiler9;
26529     };
26530     tiler9.size = function(val) {
26531       if (!arguments.length)
26532         return _size;
26533       _size = val;
26534       return tiler9;
26535     };
26536     tiler9.scale = function(val) {
26537       if (!arguments.length)
26538         return _scale;
26539       _scale = val;
26540       return tiler9;
26541     };
26542     tiler9.translate = function(val) {
26543       if (!arguments.length)
26544         return _translate;
26545       _translate = val;
26546       return tiler9;
26547     };
26548     tiler9.margin = function(val) {
26549       if (!arguments.length)
26550         return _margin;
26551       _margin = +val;
26552       return tiler9;
26553     };
26554     tiler9.skipNullIsland = function(val) {
26555       if (!arguments.length)
26556         return _skipNullIsland;
26557       _skipNullIsland = val;
26558       return tiler9;
26559     };
26560     return tiler9;
26561   }
26562
26563   // modules/util/trigger_event.js
26564   function utilTriggerEvent(target, type2, eventProperties) {
26565     target.each(function() {
26566       var evt = document.createEvent("HTMLEvents");
26567       evt.initEvent(type2, true, true);
26568       for (var prop in eventProperties) {
26569         evt[prop] = eventProperties[prop];
26570       }
26571       this.dispatchEvent(evt);
26572     });
26573   }
26574
26575   // modules/core/localizer.js
26576   var _mainLocalizer = coreLocalizer();
26577   var _t = _mainLocalizer.t;
26578   function coreLocalizer() {
26579     let localizer = {};
26580     let _dataLanguages = {};
26581     let _dataLocales = {};
26582     let _localeStrings = {};
26583     let _localeCode = "en-US";
26584     let _localeCodes = ["en-US", "en"];
26585     let _languageCode = "en";
26586     let _textDirection = "ltr";
26587     let _usesMetric = false;
26588     let _languageNames = {};
26589     let _scriptNames = {};
26590     localizer.localeCode = () => _localeCode;
26591     localizer.localeCodes = () => _localeCodes;
26592     localizer.languageCode = () => _languageCode;
26593     localizer.textDirection = () => _textDirection;
26594     localizer.usesMetric = () => _usesMetric;
26595     localizer.languageNames = () => _languageNames;
26596     localizer.scriptNames = () => _scriptNames;
26597     let _preferredLocaleCodes = [];
26598     localizer.preferredLocaleCodes = function(codes) {
26599       if (!arguments.length)
26600         return _preferredLocaleCodes;
26601       if (typeof codes === "string") {
26602         _preferredLocaleCodes = codes.split(/,|;| /gi).filter(Boolean);
26603       } else {
26604         _preferredLocaleCodes = codes;
26605       }
26606       return localizer;
26607     };
26608     var _loadPromise;
26609     localizer.ensureLoaded = () => {
26610       if (_loadPromise)
26611         return _loadPromise;
26612       let filesToFetch = [
26613         "languages",
26614         // load the list of languages
26615         "locales"
26616         // load the list of supported locales
26617       ];
26618       const localeDirs = {
26619         general: "locales",
26620         tagging: presetsCdnUrl + "dist/translations"
26621       };
26622       let fileMap = _mainFileFetcher.fileMap();
26623       for (let scopeId in localeDirs) {
26624         const key = `locales_index_${scopeId}`;
26625         if (!fileMap[key]) {
26626           fileMap[key] = localeDirs[scopeId] + "/index.min.json";
26627         }
26628         filesToFetch.push(key);
26629       }
26630       return _loadPromise = Promise.all(filesToFetch.map((key) => _mainFileFetcher.get(key))).then((results) => {
26631         _dataLanguages = results[0];
26632         _dataLocales = results[1];
26633         let indexes = results.slice(2);
26634         let requestedLocales = (_preferredLocaleCodes || []).concat(utilDetect().browserLocales).concat(["en"]);
26635         _localeCodes = localesToUseFrom(requestedLocales);
26636         _localeCode = _localeCodes[0];
26637         let loadStringsPromises = [];
26638         indexes.forEach((index, i3) => {
26639           const fullCoverageIndex = _localeCodes.findIndex(function(locale2) {
26640             return index[locale2] && index[locale2].pct === 1;
26641           });
26642           _localeCodes.slice(0, fullCoverageIndex + 1).forEach(function(code) {
26643             let scopeId = Object.keys(localeDirs)[i3];
26644             let directory = Object.values(localeDirs)[i3];
26645             if (index[code])
26646               loadStringsPromises.push(localizer.loadLocale(code, scopeId, directory));
26647           });
26648         });
26649         return Promise.all(loadStringsPromises);
26650       }).then(() => {
26651         updateForCurrentLocale();
26652       }).catch((err) => console.error(err));
26653     };
26654     function localesToUseFrom(requestedLocales) {
26655       let supportedLocales = _dataLocales;
26656       let toUse = [];
26657       for (let i3 in requestedLocales) {
26658         let locale2 = requestedLocales[i3];
26659         if (supportedLocales[locale2])
26660           toUse.push(locale2);
26661         if (locale2.includes("-")) {
26662           let langPart = locale2.split("-")[0];
26663           if (supportedLocales[langPart])
26664             toUse.push(langPart);
26665         }
26666       }
26667       return utilArrayUniq(toUse);
26668     }
26669     function updateForCurrentLocale() {
26670       if (!_localeCode)
26671         return;
26672       _languageCode = _localeCode.split("-")[0];
26673       const currentData = _dataLocales[_localeCode] || _dataLocales[_languageCode];
26674       const hash = utilStringQs(window.location.hash);
26675       if (hash.rtl === "true") {
26676         _textDirection = "rtl";
26677       } else if (hash.rtl === "false") {
26678         _textDirection = "ltr";
26679       } else {
26680         _textDirection = currentData && currentData.rtl ? "rtl" : "ltr";
26681       }
26682       let locale2 = _localeCode;
26683       if (locale2.toLowerCase() === "en-us")
26684         locale2 = "en";
26685       _languageNames = _localeStrings.general[locale2].languageNames || _localeStrings.general[_languageCode].languageNames;
26686       _scriptNames = _localeStrings.general[locale2].scriptNames || _localeStrings.general[_languageCode].scriptNames;
26687       _usesMetric = _localeCode.slice(-3).toLowerCase() !== "-us";
26688     }
26689     localizer.loadLocale = (locale2, scopeId, directory) => {
26690       if (locale2.toLowerCase() === "en-us")
26691         locale2 = "en";
26692       if (_localeStrings[scopeId] && _localeStrings[scopeId][locale2]) {
26693         return Promise.resolve(locale2);
26694       }
26695       let fileMap = _mainFileFetcher.fileMap();
26696       const key = `locale_${scopeId}_${locale2}`;
26697       if (!fileMap[key]) {
26698         fileMap[key] = `${directory}/${locale2}.min.json`;
26699       }
26700       return _mainFileFetcher.get(key).then((d2) => {
26701         if (!_localeStrings[scopeId])
26702           _localeStrings[scopeId] = {};
26703         _localeStrings[scopeId][locale2] = d2[locale2];
26704         return locale2;
26705       });
26706     };
26707     localizer.pluralRule = function(number3) {
26708       return pluralRule(number3, _localeCode);
26709     };
26710     function pluralRule(number3, localeCode) {
26711       const rules = "Intl" in window && Intl.PluralRules && new Intl.PluralRules(localeCode);
26712       if (rules) {
26713         return rules.select(number3);
26714       }
26715       if (number3 === 1)
26716         return "one";
26717       return "other";
26718     }
26719     localizer.tInfo = function(origStringId, replacements, locale2) {
26720       let stringId = origStringId.trim();
26721       let scopeId = "general";
26722       if (stringId[0] === "_") {
26723         let split = stringId.split(".");
26724         scopeId = split[0].slice(1);
26725         stringId = split.slice(1).join(".");
26726       }
26727       locale2 = locale2 || _localeCode;
26728       let path = stringId.split(".").map((s2) => s2.replace(/<TX_DOT>/g, ".")).reverse();
26729       let stringsKey = locale2;
26730       if (stringsKey.toLowerCase() === "en-us")
26731         stringsKey = "en";
26732       let result = _localeStrings && _localeStrings[scopeId] && _localeStrings[scopeId][stringsKey];
26733       while (result !== void 0 && path.length) {
26734         result = result[path.pop()];
26735       }
26736       if (result !== void 0) {
26737         if (replacements) {
26738           if (typeof result === "object" && Object.keys(result).length) {
26739             const number3 = Object.values(replacements).find(function(value) {
26740               return typeof value === "number";
26741             });
26742             if (number3 !== void 0) {
26743               const rule = pluralRule(number3, locale2);
26744               if (result[rule]) {
26745                 result = result[rule];
26746               } else {
26747                 result = Object.values(result)[0];
26748               }
26749             }
26750           }
26751           if (typeof result === "string") {
26752             for (let key in replacements) {
26753               let value = replacements[key];
26754               if (typeof value === "number") {
26755                 if (value.toLocaleString) {
26756                   value = value.toLocaleString(locale2, {
26757                     style: "decimal",
26758                     useGrouping: true,
26759                     minimumFractionDigits: 0
26760                   });
26761                 } else {
26762                   value = value.toString();
26763                 }
26764               }
26765               const token = `{${key}}`;
26766               const regex = new RegExp(token, "g");
26767               result = result.replace(regex, value);
26768             }
26769           }
26770         }
26771         if (typeof result === "string") {
26772           return {
26773             text: result,
26774             locale: locale2
26775           };
26776         }
26777       }
26778       let index = _localeCodes.indexOf(locale2);
26779       if (index >= 0 && index < _localeCodes.length - 1) {
26780         let fallback = _localeCodes[index + 1];
26781         return localizer.tInfo(origStringId, replacements, fallback);
26782       }
26783       if (replacements && "default" in replacements) {
26784         return {
26785           text: replacements.default,
26786           locale: null
26787         };
26788       }
26789       const missing = `Missing ${locale2} translation: ${origStringId}`;
26790       if (typeof console !== "undefined")
26791         console.error(missing);
26792       return {
26793         text: missing,
26794         locale: "en"
26795       };
26796     };
26797     localizer.hasTextForStringId = function(stringId) {
26798       return !!localizer.tInfo(stringId, { default: "nothing found" }).locale;
26799     };
26800     localizer.t = function(stringId, replacements, locale2) {
26801       return localizer.tInfo(stringId, replacements, locale2).text;
26802     };
26803     localizer.t.html = function(stringId, replacements, locale2) {
26804       replacements = Object.assign({}, replacements);
26805       for (var k2 in replacements) {
26806         if (typeof replacements[k2] === "string") {
26807           replacements[k2] = escape_default(replacements[k2]);
26808         }
26809         if (typeof replacements[k2] === "object" && typeof replacements[k2].html === "string") {
26810           replacements[k2] = replacements[k2].html;
26811         }
26812       }
26813       const info = localizer.tInfo(stringId, replacements, locale2);
26814       if (info.text) {
26815         return `<span class="localized-text" lang="${info.locale || "und"}">${info.text}</span>`;
26816       } else {
26817         return "";
26818       }
26819     };
26820     localizer.t.append = function(stringId, replacements, locale2) {
26821       const ret = function(selection2) {
26822         const info = localizer.tInfo(stringId, replacements, locale2);
26823         return selection2.append("span").attr("class", "localized-text").attr("lang", info.locale || "und").text((replacements && replacements.prefix || "") + info.text + (replacements && replacements.suffix || ""));
26824       };
26825       ret.stringId = stringId;
26826       return ret;
26827     };
26828     localizer.languageName = (code, options2) => {
26829       if (_languageNames && _languageNames[code]) {
26830         return _languageNames[code];
26831       }
26832       if (options2 && options2.localOnly)
26833         return null;
26834       const langInfo = _dataLanguages[code];
26835       if (langInfo) {
26836         if (langInfo.nativeName) {
26837           return localizer.t("translate.language_and_code", { language: langInfo.nativeName, code });
26838         } else if (langInfo.base && langInfo.script) {
26839           const base = langInfo.base;
26840           if (_languageNames && _languageNames[base]) {
26841             const scriptCode = langInfo.script;
26842             const script = _scriptNames && _scriptNames[scriptCode] || scriptCode;
26843             return localizer.t("translate.language_and_code", { language: _languageNames[base], code: script });
26844           } else if (_dataLanguages[base] && _dataLanguages[base].nativeName) {
26845             return localizer.t("translate.language_and_code", { language: _dataLanguages[base].nativeName, code });
26846           }
26847         }
26848       }
26849       return code;
26850     };
26851     localizer.floatFormatter = (locale2) => {
26852       if (!("Intl" in window && "NumberFormat" in Intl && "formatToParts" in Intl.NumberFormat.prototype)) {
26853         return (number3, fractionDigits) => {
26854           return fractionDigits === void 0 ? number3.toString() : number3.toFixed(fractionDigits);
26855         };
26856       } else {
26857         return (number3, fractionDigits) => number3.toLocaleString(locale2, {
26858           minimumFractionDigits: fractionDigits,
26859           maximumFractionDigits: fractionDigits === void 0 ? 20 : fractionDigits
26860         });
26861       }
26862     };
26863     localizer.floatParser = (locale2) => {
26864       const polyfill = (string) => +string.trim();
26865       if (!("Intl" in window && "NumberFormat" in Intl))
26866         return polyfill;
26867       const format2 = new Intl.NumberFormat(locale2, { maximumFractionDigits: 20 });
26868       if (!("formatToParts" in format2))
26869         return polyfill;
26870       const parts = format2.formatToParts(-12345.6);
26871       const numerals = Array.from({ length: 10 }).map((_2, i3) => format2.format(i3));
26872       const index = new Map(numerals.map((d2, i3) => [d2, i3]));
26873       const literalPart = parts.find((d2) => d2.type === "literal");
26874       const literal = literalPart && new RegExp(`[${literalPart.value}]`, "g");
26875       const groupPart = parts.find((d2) => d2.type === "group");
26876       const group = groupPart && new RegExp(`[${groupPart.value}]`, "g");
26877       const decimalPart = parts.find((d2) => d2.type === "decimal");
26878       const decimal = decimalPart && new RegExp(`[${decimalPart.value}]`);
26879       const numeral = new RegExp(`[${numerals.join("")}]`, "g");
26880       const getIndex = (d2) => index.get(d2);
26881       return (string) => {
26882         string = string.trim();
26883         if (literal)
26884           string = string.replace(literal, "");
26885         if (group)
26886           string = string.replace(group, "");
26887         if (decimal)
26888           string = string.replace(decimal, ".");
26889         string = string.replace(numeral, getIndex);
26890         return string ? +string : NaN;
26891       };
26892     };
26893     localizer.decimalPlaceCounter = (locale2) => {
26894       var literal, group, decimal;
26895       if ("Intl" in window && "NumberFormat" in Intl) {
26896         const format2 = new Intl.NumberFormat(locale2, { maximumFractionDigits: 20 });
26897         if ("formatToParts" in format2) {
26898           const parts = format2.formatToParts(-12345.6);
26899           const literalPart = parts.find((d2) => d2.type === "literal");
26900           literal = literalPart && new RegExp(`[${literalPart.value}]`, "g");
26901           const groupPart = parts.find((d2) => d2.type === "group");
26902           group = groupPart && new RegExp(`[${groupPart.value}]`, "g");
26903           const decimalPart = parts.find((d2) => d2.type === "decimal");
26904           decimal = decimalPart && new RegExp(`[${decimalPart.value}]`);
26905         }
26906       }
26907       return (string) => {
26908         string = string.trim();
26909         if (literal)
26910           string = string.replace(literal, "");
26911         if (group)
26912           string = string.replace(group, "");
26913         const parts = string.split(decimal || ".");
26914         return parts && parts[1] && parts[1].length || 0;
26915       };
26916     };
26917     return localizer;
26918   }
26919
26920   // modules/presets/collection.js
26921   function presetCollection(collection) {
26922     const MAXRESULTS = 50;
26923     let _this = {};
26924     let _memo = {};
26925     _this.collection = collection;
26926     _this.item = (id2) => {
26927       if (_memo[id2])
26928         return _memo[id2];
26929       const found = _this.collection.find((d2) => d2.id === id2);
26930       if (found)
26931         _memo[id2] = found;
26932       return found;
26933     };
26934     _this.index = (id2) => _this.collection.findIndex((d2) => d2.id === id2);
26935     _this.matchGeometry = (geometry) => {
26936       return presetCollection(
26937         _this.collection.filter((d2) => d2.matchGeometry(geometry))
26938       );
26939     };
26940     _this.matchAllGeometry = (geometries) => {
26941       return presetCollection(
26942         _this.collection.filter((d2) => d2 && d2.matchAllGeometry(geometries))
26943       );
26944     };
26945     _this.matchAnyGeometry = (geometries) => {
26946       return presetCollection(
26947         _this.collection.filter((d2) => geometries.some((geom) => d2.matchGeometry(geom)))
26948       );
26949     };
26950     _this.fallback = (geometry) => {
26951       let id2 = geometry;
26952       if (id2 === "vertex")
26953         id2 = "point";
26954       return _this.item(id2);
26955     };
26956     _this.search = (value, geometry, loc) => {
26957       if (!value)
26958         return _this;
26959       value = value.toLowerCase().trim();
26960       function leading(a2) {
26961         const index = a2.indexOf(value);
26962         return index === 0 || a2[index - 1] === " ";
26963       }
26964       function leadingStrict(a2) {
26965         const index = a2.indexOf(value);
26966         return index === 0;
26967       }
26968       function sortPresets(nameProp, aliasesProp) {
26969         return function sortNames(a2, b2) {
26970           let aCompare = a2[nameProp]();
26971           let bCompare = b2[nameProp]();
26972           if (aliasesProp) {
26973             const findMatchingAlias = (strings) => {
26974               if (strings.some((s2) => s2 === value)) {
26975                 return strings.find((s2) => s2 === value);
26976               } else {
26977                 return strings.filter((s2) => s2.includes(value)).sort((a3, b3) => a3.length - b3.length)[0];
26978               }
26979             };
26980             aCompare = findMatchingAlias([aCompare].concat(a2[aliasesProp]()));
26981             bCompare = findMatchingAlias([bCompare].concat(b2[aliasesProp]()));
26982           }
26983           if (value === aCompare)
26984             return -1;
26985           if (value === bCompare)
26986             return 1;
26987           let i3 = b2.originalScore - a2.originalScore;
26988           if (i3 !== 0)
26989             return i3;
26990           i3 = aCompare.indexOf(value) - bCompare.indexOf(value);
26991           if (i3 !== 0)
26992             return i3;
26993           return aCompare.length - bCompare.length;
26994         };
26995       }
26996       let pool = _this.collection;
26997       if (Array.isArray(loc)) {
26998         const validHere = _sharedLocationManager.locationSetsAt(loc);
26999         pool = pool.filter((a2) => !a2.locationSetID || validHere[a2.locationSetID]);
27000       }
27001       const searchable = pool.filter((a2) => a2.searchable !== false && a2.suggestion !== true);
27002       const suggestions = pool.filter((a2) => a2.suggestion === true);
27003       const leadingNames = searchable.filter((a2) => leading(a2.searchName()) || a2.searchAliases().some(leading)).sort(sortPresets("searchName", "searchAliases"));
27004       const leadingSuggestions = suggestions.filter((a2) => leadingStrict(a2.searchName())).sort(sortPresets("searchName"));
27005       const leadingNamesStripped = searchable.filter((a2) => leading(a2.searchNameStripped()) || a2.searchAliasesStripped().some(leading)).sort(sortPresets("searchNameStripped", "searchAliasesStripped"));
27006       const leadingSuggestionsStripped = suggestions.filter((a2) => leadingStrict(a2.searchNameStripped())).sort(sortPresets("searchNameStripped"));
27007       const leadingTerms = searchable.filter((a2) => (a2.terms() || []).some(leading));
27008       const leadingSuggestionTerms = suggestions.filter((a2) => (a2.terms() || []).some(leading));
27009       const leadingTagValues = searchable.filter((a2) => Object.values(a2.tags || {}).filter((val) => val !== "*").some(leading));
27010       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);
27011       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);
27012       const similarTerms = searchable.filter((a2) => {
27013         return (a2.terms() || []).some((b2) => {
27014           return utilEditDistance(value, b2) + Math.min(value.length - b2.length, 0) < 3;
27015         });
27016       });
27017       let leadingTagKeyValues = [];
27018       if (value.includes("=")) {
27019         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]))));
27020       }
27021       let results = leadingNames.concat(
27022         leadingSuggestions,
27023         leadingNamesStripped,
27024         leadingSuggestionsStripped,
27025         leadingTerms,
27026         leadingSuggestionTerms,
27027         leadingTagValues,
27028         similarName,
27029         similarSuggestions,
27030         similarTerms,
27031         leadingTagKeyValues
27032       ).slice(0, MAXRESULTS - 1);
27033       if (geometry) {
27034         if (typeof geometry === "string") {
27035           results.push(_this.fallback(geometry));
27036         } else {
27037           geometry.forEach((geom) => results.push(_this.fallback(geom)));
27038         }
27039       }
27040       return presetCollection(utilArrayUniq(results));
27041     };
27042     return _this;
27043   }
27044
27045   // modules/presets/category.js
27046   function presetCategory(categoryID, category, allPresets) {
27047     let _this = Object.assign({}, category);
27048     let _searchName;
27049     let _searchNameStripped;
27050     _this.id = categoryID;
27051     _this.members = presetCollection(
27052       (category.members || []).map((presetID) => allPresets[presetID]).filter(Boolean)
27053     );
27054     _this.geometry = _this.members.collection.reduce((acc, preset) => {
27055       for (let i3 in preset.geometry) {
27056         const geometry = preset.geometry[i3];
27057         if (acc.indexOf(geometry) === -1) {
27058           acc.push(geometry);
27059         }
27060       }
27061       return acc;
27062     }, []);
27063     _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0;
27064     _this.matchAllGeometry = (geometries) => _this.members.collection.some((preset) => preset.matchAllGeometry(geometries));
27065     _this.matchScore = () => -1;
27066     _this.name = () => _t(`_tagging.presets.categories.${categoryID}.name`, { "default": categoryID });
27067     _this.nameLabel = () => _t.append(`_tagging.presets.categories.${categoryID}.name`, { "default": categoryID });
27068     _this.terms = () => [];
27069     _this.searchName = () => {
27070       if (!_searchName) {
27071         _searchName = (_this.suggestion ? _this.originalName : _this.name()).toLowerCase();
27072       }
27073       return _searchName;
27074     };
27075     _this.searchNameStripped = () => {
27076       if (!_searchNameStripped) {
27077         _searchNameStripped = _this.searchName();
27078         if (_searchNameStripped.normalize)
27079           _searchNameStripped = _searchNameStripped.normalize("NFD");
27080         _searchNameStripped = _searchNameStripped.replace(/[\u0300-\u036f]/g, "");
27081       }
27082       return _searchNameStripped;
27083     };
27084     _this.searchAliases = () => [];
27085     _this.searchAliasesStripped = () => [];
27086     return _this;
27087   }
27088
27089   // modules/presets/field.js
27090   function presetField(fieldID, field, allFields) {
27091     allFields = allFields || {};
27092     let _this = Object.assign({}, field);
27093     _this.id = fieldID;
27094     _this.safeid = utilSafeClassName(fieldID);
27095     _this.matchGeometry = (geom) => !_this.geometry || _this.geometry.indexOf(geom) !== -1;
27096     _this.matchAllGeometry = (geometries) => {
27097       return !_this.geometry || geometries.every((geom) => _this.geometry.indexOf(geom) !== -1);
27098     };
27099     _this.t = (scope, options2) => _t(`_tagging.presets.fields.${fieldID}.${scope}`, options2);
27100     _this.t.html = (scope, options2) => _t.html(`_tagging.presets.fields.${fieldID}.${scope}`, options2);
27101     _this.t.append = (scope, options2) => _t.append(`_tagging.presets.fields.${fieldID}.${scope}`, options2);
27102     _this.hasTextForStringId = (scope) => _mainLocalizer.hasTextForStringId(`_tagging.presets.fields.${fieldID}.${scope}`);
27103     _this.resolveReference = (which) => {
27104       const referenceRegex = /^\{(.*)\}$/;
27105       const match = (field[which] || "").match(referenceRegex);
27106       if (match) {
27107         const field2 = allFields[match[1]];
27108         if (field2) {
27109           return field2;
27110         }
27111         console.error(`Unable to resolve referenced field: ${match[1]}`);
27112       }
27113       return _this;
27114     };
27115     _this.title = () => _this.overrideLabel || _this.resolveReference("label").t("label", { "default": fieldID });
27116     _this.label = () => _this.overrideLabel ? (selection2) => selection2.text(_this.overrideLabel) : _this.resolveReference("label").t.append("label", { "default": fieldID });
27117     _this.placeholder = () => _this.resolveReference("placeholder").t("placeholder", { "default": "" });
27118     _this.originalTerms = (_this.terms || []).join();
27119     _this.terms = () => _this.resolveReference("label").t("terms", { "default": _this.originalTerms }).toLowerCase().trim().split(/\s*,+\s*/);
27120     _this.increment = _this.type === "number" ? _this.increment || 1 : void 0;
27121     return _this;
27122   }
27123
27124   // modules/presets/preset.js
27125   var import_lodash = __toESM(require_lodash());
27126   function presetPreset(presetID, preset, addable, allFields, allPresets) {
27127     allFields = allFields || {};
27128     allPresets = allPresets || {};
27129     let _this = Object.assign({}, preset);
27130     let _addable = addable || false;
27131     let _searchName;
27132     let _searchNameStripped;
27133     let _searchAliases;
27134     let _searchAliasesStripped;
27135     const referenceRegex = /^\{(.*)\}$/;
27136     _this.id = presetID;
27137     _this.safeid = utilSafeClassName(presetID);
27138     _this.originalTerms = (_this.terms || []).join();
27139     _this.originalName = _this.name || "";
27140     _this.originalAliases = (_this.aliases || []).join("\n");
27141     _this.originalScore = _this.matchScore || 1;
27142     _this.originalReference = _this.reference || {};
27143     _this.originalFields = _this.fields || [];
27144     _this.originalMoreFields = _this.moreFields || [];
27145     _this.fields = (loc) => resolveFields("fields", loc);
27146     _this.moreFields = (loc) => resolveFields("moreFields", loc);
27147     _this.tags = _this.tags || {};
27148     _this.addTags = _this.addTags || _this.tags;
27149     _this.removeTags = _this.removeTags || _this.addTags;
27150     _this.geometry = _this.geometry || [];
27151     _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0;
27152     _this.matchAllGeometry = (geoms) => geoms.every(_this.matchGeometry);
27153     _this.matchScore = (entityTags) => {
27154       const tags = _this.tags;
27155       let seen = {};
27156       let score = 0;
27157       for (let k2 in tags) {
27158         seen[k2] = true;
27159         if (entityTags[k2] === tags[k2]) {
27160           score += _this.originalScore;
27161         } else if (tags[k2] === "*" && k2 in entityTags) {
27162           score += _this.originalScore / 2;
27163         } else {
27164           return -1;
27165         }
27166       }
27167       const addTags = _this.addTags;
27168       for (let k2 in addTags) {
27169         if (!seen[k2] && entityTags[k2] === addTags[k2]) {
27170           score += _this.originalScore;
27171         }
27172       }
27173       if (_this.searchable === false) {
27174         score *= 0.999;
27175       }
27176       return score;
27177     };
27178     _this.t = (scope, options2) => {
27179       const textID = `_tagging.presets.presets.${presetID}.${scope}`;
27180       return _t(textID, options2);
27181     };
27182     _this.t.append = (scope, options2) => {
27183       const textID = `_tagging.presets.presets.${presetID}.${scope}`;
27184       return _t.append(textID, options2);
27185     };
27186     function resolveReference(which) {
27187       const match = (_this[which] || "").match(referenceRegex);
27188       if (match) {
27189         const preset2 = allPresets[match[1]];
27190         if (preset2) {
27191           return preset2;
27192         }
27193         console.error(`Unable to resolve referenced preset: ${match[1]}`);
27194       }
27195       return _this;
27196     }
27197     _this.name = () => {
27198       return resolveReference("originalName").t("name", { "default": _this.originalName || presetID });
27199     };
27200     _this.nameLabel = () => {
27201       return resolveReference("originalName").t.append("name", { "default": _this.originalName || presetID });
27202     };
27203     _this.subtitle = () => {
27204       if (_this.suggestion) {
27205         let path = presetID.split("/");
27206         path.pop();
27207         return _t("_tagging.presets.presets." + path.join("/") + ".name");
27208       }
27209       return null;
27210     };
27211     _this.subtitleLabel = () => {
27212       if (_this.suggestion) {
27213         let path = presetID.split("/");
27214         path.pop();
27215         return _t.append("_tagging.presets.presets." + path.join("/") + ".name");
27216       }
27217       return null;
27218     };
27219     _this.aliases = () => {
27220       return resolveReference("originalName").t("aliases", { "default": _this.originalAliases }).trim().split(/\s*[\r\n]+\s*/);
27221     };
27222     _this.terms = () => {
27223       return resolveReference("originalName").t("terms", { "default": _this.originalTerms }).toLowerCase().trim().split(/\s*,+\s*/);
27224     };
27225     _this.searchName = () => {
27226       if (!_searchName) {
27227         _searchName = (_this.suggestion ? _this.originalName : _this.name()).toLowerCase();
27228       }
27229       return _searchName;
27230     };
27231     _this.searchNameStripped = () => {
27232       if (!_searchNameStripped) {
27233         _searchNameStripped = stripDiacritics(_this.searchName());
27234       }
27235       return _searchNameStripped;
27236     };
27237     _this.searchAliases = () => {
27238       if (!_searchAliases) {
27239         _searchAliases = _this.aliases().map((alias) => alias.toLowerCase());
27240       }
27241       return _searchAliases;
27242     };
27243     _this.searchAliasesStripped = () => {
27244       if (!_searchAliasesStripped) {
27245         _searchAliasesStripped = _this.searchAliases();
27246         _searchAliasesStripped = _searchAliasesStripped.map(stripDiacritics);
27247       }
27248       return _searchAliasesStripped;
27249     };
27250     _this.isFallback = () => {
27251       const tagCount = Object.keys(_this.tags).length;
27252       return tagCount === 0 || tagCount === 1 && _this.tags.hasOwnProperty("area");
27253     };
27254     _this.addable = function(val) {
27255       if (!arguments.length)
27256         return _addable;
27257       _addable = val;
27258       return _this;
27259     };
27260     _this.reference = () => {
27261       const qid = _this.tags.wikidata || _this.tags["flag:wikidata"] || _this.tags["brand:wikidata"] || _this.tags["network:wikidata"] || _this.tags["operator:wikidata"];
27262       if (qid) {
27263         return { qid };
27264       }
27265       let key = _this.originalReference.key || Object.keys(utilObjectOmit(_this.tags, "name"))[0];
27266       let value = _this.originalReference.value || _this.tags[key];
27267       if (value === "*") {
27268         return { key };
27269       } else {
27270         return { key, value };
27271       }
27272     };
27273     _this.unsetTags = (tags, geometry, ignoringKeys, skipFieldDefaults, loc) => {
27274       let removeTags = ignoringKeys ? utilObjectOmit(_this.removeTags, ignoringKeys) : _this.removeTags;
27275       tags = utilObjectOmit(tags, Object.keys(removeTags));
27276       if (geometry && !skipFieldDefaults) {
27277         _this.fields(loc).forEach((field) => {
27278           if (field.matchGeometry(geometry) && field.key && field.default === tags[field.key] && (!ignoringKeys || ignoringKeys.indexOf(field.key) === -1)) {
27279             delete tags[field.key];
27280           }
27281         });
27282       }
27283       delete tags.area;
27284       return tags;
27285     };
27286     _this.setTags = (tags, geometry, skipFieldDefaults, loc) => {
27287       const addTags = _this.addTags;
27288       tags = Object.assign({}, tags);
27289       for (let k2 in addTags) {
27290         if (addTags[k2] === "*") {
27291           if (_this.tags[k2] || !tags[k2]) {
27292             tags[k2] = "yes";
27293           }
27294         } else {
27295           tags[k2] = addTags[k2];
27296         }
27297       }
27298       if (!addTags.hasOwnProperty("area")) {
27299         delete tags.area;
27300         if (geometry === "area") {
27301           let needsAreaTag = true;
27302           for (let k2 in addTags) {
27303             if (_this.geometry.indexOf("line") === -1 && k2 in osmAreaKeys || k2 in osmAreaKeysExceptions && addTags[k2] in osmAreaKeysExceptions[k2]) {
27304               needsAreaTag = false;
27305               break;
27306             }
27307           }
27308           if (needsAreaTag) {
27309             tags.area = "yes";
27310           }
27311         }
27312       }
27313       if (geometry && !skipFieldDefaults) {
27314         _this.fields(loc).forEach((field) => {
27315           if (field.matchGeometry(geometry) && field.key && !tags[field.key] && field.default) {
27316             tags[field.key] = field.default;
27317           }
27318         });
27319       }
27320       return tags;
27321     };
27322     function resolveFields(which, loc) {
27323       const fieldIDs = which === "fields" ? _this.originalFields : _this.originalMoreFields;
27324       let resolved = [];
27325       fieldIDs.forEach((fieldID) => {
27326         const match = fieldID.match(referenceRegex);
27327         if (match !== null) {
27328           resolved = resolved.concat(inheritFields(allPresets[match[1]], which));
27329         } else if (allFields[fieldID]) {
27330           resolved.push(allFields[fieldID]);
27331         } else {
27332           console.log(`Cannot resolve "${fieldID}" found in ${_this.id}.${which}`);
27333         }
27334       });
27335       if (!resolved.length) {
27336         const endIndex = _this.id.lastIndexOf("/");
27337         const parentID = endIndex && _this.id.substring(0, endIndex);
27338         if (parentID) {
27339           let parent = allPresets[parentID];
27340           if (loc) {
27341             const validHere = _sharedLocationManager.locationSetsAt(loc);
27342             if (parent?.locationSetID && !validHere[parent.locationSetID]) {
27343               const candidateIDs = Object.keys(allPresets).filter((k2) => k2.startsWith(parentID));
27344               parent = allPresets[candidateIDs.find((candidateID) => {
27345                 const candidate = allPresets[candidateID];
27346                 return validHere[candidate.locationSetID] && (0, import_lodash.isEqual)(candidate.tags, parent.tags);
27347               })];
27348             }
27349           }
27350           resolved = inheritFields(parent, which);
27351         }
27352       }
27353       return utilArrayUniq(resolved);
27354       function inheritFields(parent, which2) {
27355         if (!parent)
27356           return [];
27357         if (which2 === "fields") {
27358           return parent.fields().filter(shouldInherit);
27359         } else if (which2 === "moreFields") {
27360           return parent.moreFields();
27361         } else {
27362           return [];
27363         }
27364       }
27365       function shouldInherit(f3) {
27366         if (f3.key && _this.tags[f3.key] !== void 0 && // inherit anyway if multiple values are allowed or just a checkbox
27367         f3.type !== "multiCombo" && f3.type !== "semiCombo" && f3.type !== "manyCombo" && f3.type !== "check")
27368           return false;
27369         return true;
27370       }
27371     }
27372     function stripDiacritics(s2) {
27373       if (s2.normalize)
27374         s2 = s2.normalize("NFD");
27375       s2 = s2.replace(/[\u0300-\u036f]/g, "");
27376       return s2;
27377     }
27378     return _this;
27379   }
27380
27381   // modules/presets/index.js
27382   var _mainPresetIndex = presetIndex();
27383   function presetIndex() {
27384     const dispatch14 = dispatch_default("favoritePreset", "recentsChange");
27385     const MAXRECENTS = 30;
27386     const POINT = presetPreset("point", { name: "Point", tags: {}, geometry: ["point", "vertex"], matchScore: 0.1 });
27387     const LINE = presetPreset("line", { name: "Line", tags: {}, geometry: ["line"], matchScore: 0.1 });
27388     const AREA = presetPreset("area", { name: "Area", tags: { area: "yes" }, geometry: ["area"], matchScore: 0.1 });
27389     const RELATION = presetPreset("relation", { name: "Relation", tags: {}, geometry: ["relation"], matchScore: 0.1 });
27390     let _this = presetCollection([POINT, LINE, AREA, RELATION]);
27391     let _presets = { point: POINT, line: LINE, area: AREA, relation: RELATION };
27392     let _defaults2 = {
27393       point: presetCollection([POINT]),
27394       vertex: presetCollection([POINT]),
27395       line: presetCollection([LINE]),
27396       area: presetCollection([AREA]),
27397       relation: presetCollection([RELATION])
27398     };
27399     let _fields = {};
27400     let _categories = {};
27401     let _universal = [];
27402     let _addablePresetIDs = null;
27403     let _recents;
27404     let _favorites;
27405     let _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} };
27406     let _loadPromise;
27407     _this.ensureLoaded = () => {
27408       if (_loadPromise)
27409         return _loadPromise;
27410       return _loadPromise = Promise.all([
27411         _mainFileFetcher.get("preset_categories"),
27412         _mainFileFetcher.get("preset_defaults"),
27413         _mainFileFetcher.get("preset_presets"),
27414         _mainFileFetcher.get("preset_fields")
27415       ]).then((vals) => {
27416         _this.merge({
27417           categories: vals[0],
27418           defaults: vals[1],
27419           presets: vals[2],
27420           fields: vals[3]
27421         });
27422         osmSetAreaKeys(_this.areaKeys());
27423         osmSetLineTags(_this.lineTags());
27424         osmSetPointTags(_this.pointTags());
27425         osmSetVertexTags(_this.vertexTags());
27426       });
27427     };
27428     _this.merge = (d2) => {
27429       let newLocationSets = [];
27430       if (d2.fields) {
27431         Object.keys(d2.fields).forEach((fieldID) => {
27432           let f3 = d2.fields[fieldID];
27433           if (f3) {
27434             f3 = presetField(fieldID, f3, _fields);
27435             if (f3.locationSet)
27436               newLocationSets.push(f3);
27437             _fields[fieldID] = f3;
27438           } else {
27439             delete _fields[fieldID];
27440           }
27441         });
27442       }
27443       if (d2.presets) {
27444         Object.keys(d2.presets).forEach((presetID) => {
27445           let p2 = d2.presets[presetID];
27446           if (p2) {
27447             const isAddable = !_addablePresetIDs || _addablePresetIDs.has(presetID);
27448             p2 = presetPreset(presetID, p2, isAddable, _fields, _presets);
27449             if (p2.locationSet)
27450               newLocationSets.push(p2);
27451             _presets[presetID] = p2;
27452           } else {
27453             const existing = _presets[presetID];
27454             if (existing && !existing.isFallback()) {
27455               delete _presets[presetID];
27456             }
27457           }
27458         });
27459       }
27460       if (d2.categories) {
27461         Object.keys(d2.categories).forEach((categoryID) => {
27462           let c2 = d2.categories[categoryID];
27463           if (c2) {
27464             c2 = presetCategory(categoryID, c2, _presets);
27465             if (c2.locationSet)
27466               newLocationSets.push(c2);
27467             _categories[categoryID] = c2;
27468           } else {
27469             delete _categories[categoryID];
27470           }
27471         });
27472       }
27473       _this.collection = Object.values(_presets).concat(Object.values(_categories));
27474       if (d2.defaults) {
27475         Object.keys(d2.defaults).forEach((geometry) => {
27476           const def = d2.defaults[geometry];
27477           if (Array.isArray(def)) {
27478             _defaults2[geometry] = presetCollection(
27479               def.map((id2) => _presets[id2] || _categories[id2]).filter(Boolean)
27480             );
27481           } else {
27482             delete _defaults2[geometry];
27483           }
27484         });
27485       }
27486       _universal = Object.values(_fields).filter((field) => field.universal);
27487       _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} };
27488       _this.collection.forEach((preset) => {
27489         (preset.geometry || []).forEach((geometry) => {
27490           let g3 = _geometryIndex[geometry];
27491           for (let key in preset.tags) {
27492             g3[key] = g3[key] || {};
27493             let value = preset.tags[key];
27494             (g3[key][value] = g3[key][value] || []).push(preset);
27495           }
27496         });
27497       });
27498       if (d2.featureCollection && Array.isArray(d2.featureCollection.features)) {
27499         _sharedLocationManager.mergeCustomGeoJSON(d2.featureCollection);
27500       }
27501       if (newLocationSets.length) {
27502         _sharedLocationManager.mergeLocationSets(newLocationSets);
27503       }
27504       return _this;
27505     };
27506     _this.match = (entity, resolver) => {
27507       return resolver.transient(entity, "presetMatch", () => {
27508         let geometry = entity.geometry(resolver);
27509         if (geometry === "vertex" && entity.isOnAddressLine(resolver)) {
27510           geometry = "point";
27511         }
27512         const entityExtent = entity.extent(resolver);
27513         return _this.matchTags(entity.tags, geometry, entityExtent.center());
27514       });
27515     };
27516     _this.matchTags = (tags, geometry, loc) => {
27517       const keyIndex = _geometryIndex[geometry];
27518       let bestScore = -1;
27519       let bestMatch;
27520       let matchCandidates = [];
27521       for (let k2 in tags) {
27522         let indexMatches = [];
27523         let valueIndex = keyIndex[k2];
27524         if (!valueIndex)
27525           continue;
27526         let keyValueMatches = valueIndex[tags[k2]];
27527         if (keyValueMatches)
27528           indexMatches.push(...keyValueMatches);
27529         let keyStarMatches = valueIndex["*"];
27530         if (keyStarMatches)
27531           indexMatches.push(...keyStarMatches);
27532         if (indexMatches.length === 0)
27533           continue;
27534         for (let i3 = 0; i3 < indexMatches.length; i3++) {
27535           const candidate = indexMatches[i3];
27536           const score = candidate.matchScore(tags);
27537           if (score === -1) {
27538             continue;
27539           }
27540           matchCandidates.push({ score, candidate });
27541           if (score > bestScore) {
27542             bestScore = score;
27543             bestMatch = candidate;
27544           }
27545         }
27546       }
27547       if (bestMatch && bestMatch.locationSetID && bestMatch.locationSetID !== "+[Q2]" && Array.isArray(loc)) {
27548         const validHere = _sharedLocationManager.locationSetsAt(loc);
27549         if (!validHere[bestMatch.locationSetID]) {
27550           matchCandidates.sort((a2, b2) => a2.score < b2.score ? 1 : -1);
27551           for (let i3 = 0; i3 < matchCandidates.length; i3++) {
27552             const candidateScore = matchCandidates[i3];
27553             if (!candidateScore.candidate.locationSetID || validHere[candidateScore.candidate.locationSetID]) {
27554               bestMatch = candidateScore.candidate;
27555               bestScore = candidateScore.score;
27556               break;
27557             }
27558           }
27559         }
27560       }
27561       if (!bestMatch || bestMatch.isFallback()) {
27562         for (let k2 in tags) {
27563           if (/^addr:/.test(k2) && keyIndex["addr:*"] && keyIndex["addr:*"]["*"]) {
27564             bestMatch = keyIndex["addr:*"]["*"][0];
27565             break;
27566           }
27567         }
27568       }
27569       return bestMatch || _this.fallback(geometry);
27570     };
27571     _this.allowsVertex = (entity, resolver) => {
27572       if (entity.type !== "node")
27573         return false;
27574       if (Object.keys(entity.tags).length === 0)
27575         return true;
27576       return resolver.transient(entity, "vertexMatch", () => {
27577         if (entity.isOnAddressLine(resolver))
27578           return true;
27579         const geometries = osmNodeGeometriesForTags(entity.tags);
27580         if (geometries.vertex)
27581           return true;
27582         if (geometries.point)
27583           return false;
27584         return true;
27585       });
27586     };
27587     _this.areaKeys = () => {
27588       const ignore = {
27589         barrier: true,
27590         highway: true,
27591         footway: true,
27592         railway: true,
27593         junction: true,
27594         traffic_calming: true,
27595         type: true
27596       };
27597       let areaKeys = {};
27598       const presets = _this.collection.filter((p2) => !p2.suggestion && !p2.replacement);
27599       presets.forEach((p2) => {
27600         const keys2 = p2.tags && Object.keys(p2.tags);
27601         const key = keys2 && keys2.length && keys2[0];
27602         if (!key)
27603           return;
27604         if (ignore[key])
27605           return;
27606         if (p2.geometry.indexOf("area") !== -1) {
27607           areaKeys[key] = areaKeys[key] || {};
27608         }
27609       });
27610       presets.forEach((p2) => {
27611         let key;
27612         for (key in p2.addTags) {
27613           const value = p2.addTags[key];
27614           if (key in areaKeys && // probably an area...
27615           p2.geometry.indexOf("line") !== -1 && // but sometimes a line
27616           value !== "*") {
27617             areaKeys[key][value] = true;
27618           }
27619         }
27620       });
27621       return areaKeys;
27622     };
27623     _this.lineTags = () => {
27624       return _this.collection.filter((lineTags, d2) => {
27625         if (d2.suggestion || d2.replacement || d2.searchable === false)
27626           return lineTags;
27627         const keys2 = d2.tags && Object.keys(d2.tags);
27628         const key = keys2 && keys2.length && keys2[0];
27629         if (!key)
27630           return lineTags;
27631         if (d2.geometry.indexOf("line") !== -1) {
27632           lineTags[key] = lineTags[key] || [];
27633           lineTags[key].push(d2.tags);
27634         }
27635         return lineTags;
27636       }, {});
27637     };
27638     _this.pointTags = () => {
27639       return _this.collection.reduce((pointTags, d2) => {
27640         if (d2.suggestion || d2.replacement || d2.searchable === false)
27641           return pointTags;
27642         const keys2 = d2.tags && Object.keys(d2.tags);
27643         const key = keys2 && keys2.length && keys2[0];
27644         if (!key)
27645           return pointTags;
27646         if (d2.geometry.indexOf("point") !== -1) {
27647           pointTags[key] = pointTags[key] || {};
27648           pointTags[key][d2.tags[key]] = true;
27649         }
27650         return pointTags;
27651       }, {});
27652     };
27653     _this.vertexTags = () => {
27654       return _this.collection.reduce((vertexTags, d2) => {
27655         if (d2.suggestion || d2.replacement || d2.searchable === false)
27656           return vertexTags;
27657         const keys2 = d2.tags && Object.keys(d2.tags);
27658         const key = keys2 && keys2.length && keys2[0];
27659         if (!key)
27660           return vertexTags;
27661         if (d2.geometry.indexOf("vertex") !== -1) {
27662           vertexTags[key] = vertexTags[key] || {};
27663           vertexTags[key][d2.tags[key]] = true;
27664         }
27665         return vertexTags;
27666       }, {});
27667     };
27668     _this.field = (id2) => _fields[id2];
27669     _this.universal = () => _universal;
27670     _this.defaults = (geometry, n3, startWithRecents, loc, extraPresets) => {
27671       let recents = [];
27672       if (startWithRecents) {
27673         recents = _this.recent().matchGeometry(geometry).collection.slice(0, 4);
27674       }
27675       let defaults;
27676       if (_addablePresetIDs) {
27677         defaults = Array.from(_addablePresetIDs).map(function(id2) {
27678           var preset = _this.item(id2);
27679           if (preset && preset.matchGeometry(geometry))
27680             return preset;
27681           return null;
27682         }).filter(Boolean);
27683       } else {
27684         defaults = _defaults2[geometry].collection.concat(_this.fallback(geometry));
27685       }
27686       let result = presetCollection(
27687         utilArrayUniq(recents.concat(defaults).concat(extraPresets || [])).slice(0, n3 - 1)
27688       );
27689       if (Array.isArray(loc)) {
27690         const validHere = _sharedLocationManager.locationSetsAt(loc);
27691         result.collection = result.collection.filter((a2) => !a2.locationSetID || validHere[a2.locationSetID]);
27692       }
27693       return result;
27694     };
27695     _this.addablePresetIDs = function(val) {
27696       if (!arguments.length)
27697         return _addablePresetIDs;
27698       if (Array.isArray(val))
27699         val = new Set(val);
27700       _addablePresetIDs = val;
27701       if (_addablePresetIDs) {
27702         _this.collection.forEach((p2) => {
27703           if (p2.addable)
27704             p2.addable(_addablePresetIDs.has(p2.id));
27705         });
27706       } else {
27707         _this.collection.forEach((p2) => {
27708           if (p2.addable)
27709             p2.addable(true);
27710         });
27711       }
27712       return _this;
27713     };
27714     _this.recent = () => {
27715       return presetCollection(
27716         utilArrayUniq(_this.getRecents().map((d2) => d2.preset).filter((d2) => d2.searchable !== false))
27717       );
27718     };
27719     function RibbonItem(preset, source) {
27720       let item = {};
27721       item.preset = preset;
27722       item.source = source;
27723       item.isFavorite = () => item.source === "favorite";
27724       item.isRecent = () => item.source === "recent";
27725       item.matches = (preset2) => item.preset.id === preset2.id;
27726       item.minified = () => ({ pID: item.preset.id });
27727       return item;
27728     }
27729     function ribbonItemForMinified(d2, source) {
27730       if (d2 && d2.pID) {
27731         const preset = _this.item(d2.pID);
27732         if (!preset)
27733           return null;
27734         return RibbonItem(preset, source);
27735       }
27736       return null;
27737     }
27738     _this.getGenericRibbonItems = () => {
27739       return ["point", "line", "area"].map((id2) => RibbonItem(_this.item(id2), "generic"));
27740     };
27741     _this.getAddable = () => {
27742       if (!_addablePresetIDs)
27743         return [];
27744       return _addablePresetIDs.map((id2) => {
27745         const preset = _this.item(id2);
27746         if (preset)
27747           return RibbonItem(preset, "addable");
27748         return null;
27749       }).filter(Boolean);
27750     };
27751     function setRecents(items) {
27752       _recents = items;
27753       const minifiedItems = items.map((d2) => d2.minified());
27754       corePreferences("preset_recents", JSON.stringify(minifiedItems));
27755       dispatch14.call("recentsChange");
27756     }
27757     _this.getRecents = () => {
27758       if (!_recents) {
27759         _recents = (JSON.parse(corePreferences("preset_recents")) || []).reduce((acc, d2) => {
27760           let item = ribbonItemForMinified(d2, "recent");
27761           if (item && item.preset.addable())
27762             acc.push(item);
27763           return acc;
27764         }, []);
27765       }
27766       return _recents;
27767     };
27768     _this.addRecent = (preset, besidePreset, after) => {
27769       const recents = _this.getRecents();
27770       const beforeItem = _this.recentMatching(besidePreset);
27771       let toIndex = recents.indexOf(beforeItem);
27772       if (after)
27773         toIndex += 1;
27774       const newItem = RibbonItem(preset, "recent");
27775       recents.splice(toIndex, 0, newItem);
27776       setRecents(recents);
27777     };
27778     _this.removeRecent = (preset) => {
27779       const item = _this.recentMatching(preset);
27780       if (item) {
27781         let items = _this.getRecents();
27782         items.splice(items.indexOf(item), 1);
27783         setRecents(items);
27784       }
27785     };
27786     _this.recentMatching = (preset) => {
27787       const items = _this.getRecents();
27788       for (let i3 in items) {
27789         if (items[i3].matches(preset)) {
27790           return items[i3];
27791         }
27792       }
27793       return null;
27794     };
27795     _this.moveItem = (items, fromIndex, toIndex) => {
27796       if (fromIndex === toIndex || fromIndex < 0 || toIndex < 0 || fromIndex >= items.length || toIndex >= items.length)
27797         return null;
27798       items.splice(toIndex, 0, items.splice(fromIndex, 1)[0]);
27799       return items;
27800     };
27801     _this.moveRecent = (item, beforeItem) => {
27802       const recents = _this.getRecents();
27803       const fromIndex = recents.indexOf(item);
27804       const toIndex = recents.indexOf(beforeItem);
27805       const items = _this.moveItem(recents, fromIndex, toIndex);
27806       if (items)
27807         setRecents(items);
27808     };
27809     _this.setMostRecent = (preset) => {
27810       if (preset.searchable === false)
27811         return;
27812       let items = _this.getRecents();
27813       let item = _this.recentMatching(preset);
27814       if (item) {
27815         items.splice(items.indexOf(item), 1);
27816       } else {
27817         item = RibbonItem(preset, "recent");
27818       }
27819       while (items.length >= MAXRECENTS) {
27820         items.pop();
27821       }
27822       items.unshift(item);
27823       setRecents(items);
27824     };
27825     function setFavorites(items) {
27826       _favorites = items;
27827       const minifiedItems = items.map((d2) => d2.minified());
27828       corePreferences("preset_favorites", JSON.stringify(minifiedItems));
27829       dispatch14.call("favoritePreset");
27830     }
27831     _this.addFavorite = (preset, besidePreset, after) => {
27832       const favorites = _this.getFavorites();
27833       const beforeItem = _this.favoriteMatching(besidePreset);
27834       let toIndex = favorites.indexOf(beforeItem);
27835       if (after)
27836         toIndex += 1;
27837       const newItem = RibbonItem(preset, "favorite");
27838       favorites.splice(toIndex, 0, newItem);
27839       setFavorites(favorites);
27840     };
27841     _this.toggleFavorite = (preset) => {
27842       const favs = _this.getFavorites();
27843       const favorite = _this.favoriteMatching(preset);
27844       if (favorite) {
27845         favs.splice(favs.indexOf(favorite), 1);
27846       } else {
27847         if (favs.length === 10) {
27848           favs.pop();
27849         }
27850         favs.push(RibbonItem(preset, "favorite"));
27851       }
27852       setFavorites(favs);
27853     };
27854     _this.removeFavorite = (preset) => {
27855       const item = _this.favoriteMatching(preset);
27856       if (item) {
27857         const items = _this.getFavorites();
27858         items.splice(items.indexOf(item), 1);
27859         setFavorites(items);
27860       }
27861     };
27862     _this.getFavorites = () => {
27863       if (!_favorites) {
27864         let rawFavorites = JSON.parse(corePreferences("preset_favorites"));
27865         if (!rawFavorites) {
27866           rawFavorites = [];
27867           corePreferences("preset_favorites", JSON.stringify(rawFavorites));
27868         }
27869         _favorites = rawFavorites.reduce((output, d2) => {
27870           const item = ribbonItemForMinified(d2, "favorite");
27871           if (item && item.preset.addable())
27872             output.push(item);
27873           return output;
27874         }, []);
27875       }
27876       return _favorites;
27877     };
27878     _this.favoriteMatching = (preset) => {
27879       const favs = _this.getFavorites();
27880       for (let index in favs) {
27881         if (favs[index].matches(preset)) {
27882           return favs[index];
27883         }
27884       }
27885       return null;
27886     };
27887     return utilRebind(_this, dispatch14, "on");
27888   }
27889
27890   // modules/util/util.js
27891   function utilTagText(entity) {
27892     var obj = entity && entity.tags || {};
27893     return Object.keys(obj).map(function(k2) {
27894       return k2 + "=" + obj[k2];
27895     }).join(", ");
27896   }
27897   function utilTotalExtent(array2, graph) {
27898     var extent = geoExtent();
27899     var val, entity;
27900     for (var i3 = 0; i3 < array2.length; i3++) {
27901       val = array2[i3];
27902       entity = typeof val === "string" ? graph.hasEntity(val) : val;
27903       if (entity) {
27904         extent._extend(entity.extent(graph));
27905       }
27906     }
27907     return extent;
27908   }
27909   function utilTagDiff(oldTags, newTags) {
27910     var tagDiff = [];
27911     var keys2 = utilArrayUnion(Object.keys(oldTags), Object.keys(newTags)).sort();
27912     keys2.forEach(function(k2) {
27913       var oldVal = oldTags[k2];
27914       var newVal = newTags[k2];
27915       if ((oldVal || oldVal === "") && (newVal === void 0 || newVal !== oldVal)) {
27916         tagDiff.push({
27917           type: "-",
27918           key: k2,
27919           oldVal,
27920           newVal,
27921           display: "- " + k2 + "=" + oldVal
27922         });
27923       }
27924       if ((newVal || newVal === "") && (oldVal === void 0 || newVal !== oldVal)) {
27925         tagDiff.push({
27926           type: "+",
27927           key: k2,
27928           oldVal,
27929           newVal,
27930           display: "+ " + k2 + "=" + newVal
27931         });
27932       }
27933     });
27934     return tagDiff;
27935   }
27936   function utilEntitySelector(ids) {
27937     return ids.length ? "." + ids.join(",.") : "nothing";
27938   }
27939   function utilEntityOrMemberSelector(ids, graph) {
27940     var seen = new Set(ids);
27941     ids.forEach(collectShallowDescendants);
27942     return utilEntitySelector(Array.from(seen));
27943     function collectShallowDescendants(id2) {
27944       var entity = graph.hasEntity(id2);
27945       if (!entity || entity.type !== "relation")
27946         return;
27947       entity.members.map(function(member) {
27948         return member.id;
27949       }).forEach(function(id3) {
27950         seen.add(id3);
27951       });
27952     }
27953   }
27954   function utilEntityOrDeepMemberSelector(ids, graph) {
27955     return utilEntitySelector(utilEntityAndDeepMemberIDs(ids, graph));
27956   }
27957   function utilEntityAndDeepMemberIDs(ids, graph) {
27958     var seen = /* @__PURE__ */ new Set();
27959     ids.forEach(collectDeepDescendants);
27960     return Array.from(seen);
27961     function collectDeepDescendants(id2) {
27962       if (seen.has(id2))
27963         return;
27964       seen.add(id2);
27965       var entity = graph.hasEntity(id2);
27966       if (!entity || entity.type !== "relation")
27967         return;
27968       entity.members.map(function(member) {
27969         return member.id;
27970       }).forEach(collectDeepDescendants);
27971     }
27972   }
27973   function utilDeepMemberSelector(ids, graph, skipMultipolgonMembers) {
27974     var idsSet = new Set(ids);
27975     var seen = /* @__PURE__ */ new Set();
27976     var returners = /* @__PURE__ */ new Set();
27977     ids.forEach(collectDeepDescendants);
27978     return utilEntitySelector(Array.from(returners));
27979     function collectDeepDescendants(id2) {
27980       if (seen.has(id2))
27981         return;
27982       seen.add(id2);
27983       if (!idsSet.has(id2)) {
27984         returners.add(id2);
27985       }
27986       var entity = graph.hasEntity(id2);
27987       if (!entity || entity.type !== "relation")
27988         return;
27989       if (skipMultipolgonMembers && entity.isMultipolygon())
27990         return;
27991       entity.members.map(function(member) {
27992         return member.id;
27993       }).forEach(collectDeepDescendants);
27994     }
27995   }
27996   function utilHighlightEntities(ids, highlighted, context) {
27997     context.surface().selectAll(utilEntityOrDeepMemberSelector(ids, context.graph())).classed("highlighted", highlighted);
27998   }
27999   function utilGetAllNodes(ids, graph) {
28000     var seen = /* @__PURE__ */ new Set();
28001     var nodes = /* @__PURE__ */ new Set();
28002     ids.forEach(collectNodes);
28003     return Array.from(nodes);
28004     function collectNodes(id2) {
28005       if (seen.has(id2))
28006         return;
28007       seen.add(id2);
28008       var entity = graph.hasEntity(id2);
28009       if (!entity)
28010         return;
28011       if (entity.type === "node") {
28012         nodes.add(entity);
28013       } else if (entity.type === "way") {
28014         entity.nodes.forEach(collectNodes);
28015       } else {
28016         entity.members.map(function(member) {
28017           return member.id;
28018         }).forEach(collectNodes);
28019       }
28020     }
28021   }
28022   function utilDisplayName(entity) {
28023     var localizedNameKey = "name:" + _mainLocalizer.languageCode().toLowerCase();
28024     var name = entity.tags[localizedNameKey] || entity.tags.name || "";
28025     if (name)
28026       return name;
28027     var tags = {
28028       direction: entity.tags.direction,
28029       from: entity.tags.from,
28030       network: entity.tags.cycle_network || entity.tags.network,
28031       ref: entity.tags.ref,
28032       to: entity.tags.to,
28033       via: entity.tags.via
28034     };
28035     var keyComponents = [];
28036     if (tags.network) {
28037       keyComponents.push("network");
28038     }
28039     if (tags.ref) {
28040       keyComponents.push("ref");
28041     }
28042     if (entity.tags.route) {
28043       if (tags.direction) {
28044         keyComponents.push("direction");
28045       } else if (tags.from && tags.to) {
28046         keyComponents.push("from");
28047         keyComponents.push("to");
28048         if (tags.via) {
28049           keyComponents.push("via");
28050         }
28051       }
28052     }
28053     if (keyComponents.length) {
28054       name = _t("inspector.display_name." + keyComponents.join("_"), tags);
28055     }
28056     return name;
28057   }
28058   function utilDisplayNameForPath(entity) {
28059     var name = utilDisplayName(entity);
28060     var isFirefox = utilDetect().browser.toLowerCase().indexOf("firefox") > -1;
28061     var isNewChromium = Number(utilDetect().version.split(".")[0]) >= 96;
28062     if (!isFirefox && !isNewChromium && name && rtlRegex.test(name)) {
28063       name = fixRTLTextForSvg(name);
28064     }
28065     return name;
28066   }
28067   function utilDisplayType(id2) {
28068     return {
28069       n: _t("inspector.node"),
28070       w: _t("inspector.way"),
28071       r: _t("inspector.relation")
28072     }[id2.charAt(0)];
28073   }
28074   function utilDisplayLabel(entity, graphOrGeometry, verbose) {
28075     var result;
28076     var displayName = utilDisplayName(entity);
28077     var preset = typeof graphOrGeometry === "string" ? _mainPresetIndex.matchTags(entity.tags, graphOrGeometry) : _mainPresetIndex.match(entity, graphOrGeometry);
28078     var presetName = preset && (preset.suggestion ? preset.subtitle() : preset.name());
28079     if (verbose) {
28080       result = [presetName, displayName].filter(Boolean).join(" ");
28081     } else {
28082       result = displayName || presetName;
28083     }
28084     return result || utilDisplayType(entity.id);
28085   }
28086   function utilEntityRoot(entityType) {
28087     return {
28088       node: "n",
28089       way: "w",
28090       relation: "r"
28091     }[entityType];
28092   }
28093   function utilCombinedTags(entityIDs, graph) {
28094     var tags = {};
28095     var tagCounts = {};
28096     var allKeys = /* @__PURE__ */ new Set();
28097     var entities = entityIDs.map(function(entityID) {
28098       return graph.hasEntity(entityID);
28099     }).filter(Boolean);
28100     entities.forEach(function(entity) {
28101       var keys2 = Object.keys(entity.tags).filter(Boolean);
28102       keys2.forEach(function(key2) {
28103         allKeys.add(key2);
28104       });
28105     });
28106     entities.forEach(function(entity) {
28107       allKeys.forEach(function(key2) {
28108         var value = entity.tags[key2];
28109         if (!tags.hasOwnProperty(key2)) {
28110           tags[key2] = value;
28111         } else {
28112           if (!Array.isArray(tags[key2])) {
28113             if (tags[key2] !== value) {
28114               tags[key2] = [tags[key2], value];
28115             }
28116           } else {
28117             if (tags[key2].indexOf(value) === -1) {
28118               tags[key2].push(value);
28119             }
28120           }
28121         }
28122         var tagHash = key2 + "=" + value;
28123         if (!tagCounts[tagHash])
28124           tagCounts[tagHash] = 0;
28125         tagCounts[tagHash] += 1;
28126       });
28127     });
28128     for (var key in tags) {
28129       if (!Array.isArray(tags[key]))
28130         continue;
28131       tags[key] = tags[key].sort(function(val12, val2) {
28132         var key2 = key2;
28133         var count2 = tagCounts[key2 + "=" + val2];
28134         var count1 = tagCounts[key2 + "=" + val12];
28135         if (count2 !== count1) {
28136           return count2 - count1;
28137         }
28138         if (val2 && val12) {
28139           return val12.localeCompare(val2);
28140         }
28141         return val12 ? 1 : -1;
28142       });
28143     }
28144     return tags;
28145   }
28146   function utilStringQs(str2) {
28147     var i3 = 0;
28148     while (i3 < str2.length && (str2[i3] === "?" || str2[i3] === "#"))
28149       i3++;
28150     str2 = str2.slice(i3);
28151     return str2.split("&").reduce(function(obj, pair3) {
28152       var parts = pair3.split("=");
28153       if (parts.length === 2) {
28154         obj[parts[0]] = null === parts[1] ? "" : decodeURIComponent(parts[1]);
28155       }
28156       return obj;
28157     }, {});
28158   }
28159   function utilQsString(obj, noencode) {
28160     function softEncode(s2) {
28161       return encodeURIComponent(s2).replace(/(%2F|%3A|%2C|%7B|%7D)/g, decodeURIComponent);
28162     }
28163     return Object.keys(obj).sort().map(function(key) {
28164       return encodeURIComponent(key) + "=" + (noencode ? softEncode(obj[key]) : encodeURIComponent(obj[key]));
28165     }).join("&");
28166   }
28167   function utilPrefixDOMProperty(property) {
28168     var prefixes2 = ["webkit", "ms", "moz", "o"];
28169     var i3 = -1;
28170     var n3 = prefixes2.length;
28171     var s2 = document.body;
28172     if (property in s2)
28173       return property;
28174     property = property.slice(0, 1).toUpperCase() + property.slice(1);
28175     while (++i3 < n3) {
28176       if (prefixes2[i3] + property in s2) {
28177         return prefixes2[i3] + property;
28178       }
28179     }
28180     return false;
28181   }
28182   function utilPrefixCSSProperty(property) {
28183     var prefixes2 = ["webkit", "ms", "Moz", "O"];
28184     var i3 = -1;
28185     var n3 = prefixes2.length;
28186     var s2 = document.body.style;
28187     if (property.toLowerCase() in s2) {
28188       return property.toLowerCase();
28189     }
28190     while (++i3 < n3) {
28191       if (prefixes2[i3] + property in s2) {
28192         return "-" + prefixes2[i3].toLowerCase() + property.replace(/([A-Z])/g, "-$1").toLowerCase();
28193       }
28194     }
28195     return false;
28196   }
28197   var transformProperty;
28198   function utilSetTransform(el, x2, y2, scale) {
28199     var prop = transformProperty = transformProperty || utilPrefixCSSProperty("Transform");
28200     var translate = utilDetect().opera ? "translate(" + x2 + "px," + y2 + "px)" : "translate3d(" + x2 + "px," + y2 + "px,0)";
28201     return el.style(prop, translate + (scale ? " scale(" + scale + ")" : ""));
28202   }
28203   function utilEditDistance(a2, b2) {
28204     a2 = (0, import_diacritics.remove)(a2.toLowerCase());
28205     b2 = (0, import_diacritics.remove)(b2.toLowerCase());
28206     if (a2.length === 0)
28207       return b2.length;
28208     if (b2.length === 0)
28209       return a2.length;
28210     var matrix = [];
28211     var i3, j3;
28212     for (i3 = 0; i3 <= b2.length; i3++) {
28213       matrix[i3] = [i3];
28214     }
28215     for (j3 = 0; j3 <= a2.length; j3++) {
28216       matrix[0][j3] = j3;
28217     }
28218     for (i3 = 1; i3 <= b2.length; i3++) {
28219       for (j3 = 1; j3 <= a2.length; j3++) {
28220         if (b2.charAt(i3 - 1) === a2.charAt(j3 - 1)) {
28221           matrix[i3][j3] = matrix[i3 - 1][j3 - 1];
28222         } else {
28223           matrix[i3][j3] = Math.min(
28224             matrix[i3 - 1][j3 - 1] + 1,
28225             // substitution
28226             Math.min(
28227               matrix[i3][j3 - 1] + 1,
28228               // insertion
28229               matrix[i3 - 1][j3] + 1
28230             )
28231           );
28232         }
28233       }
28234     }
28235     return matrix[b2.length][a2.length];
28236   }
28237   function utilFastMouse(container) {
28238     var rect = container.getBoundingClientRect();
28239     var rectLeft = rect.left;
28240     var rectTop = rect.top;
28241     var clientLeft = +container.clientLeft;
28242     var clientTop = +container.clientTop;
28243     return function(e3) {
28244       return [
28245         e3.clientX - rectLeft - clientLeft,
28246         e3.clientY - rectTop - clientTop
28247       ];
28248     };
28249   }
28250   function utilAsyncMap(inputs, func, callback) {
28251     var remaining = inputs.length;
28252     var results = [];
28253     var errors = [];
28254     inputs.forEach(function(d2, i3) {
28255       func(d2, function done(err, data) {
28256         errors[i3] = err;
28257         results[i3] = data;
28258         remaining--;
28259         if (!remaining)
28260           callback(errors, results);
28261       });
28262     });
28263   }
28264   function utilWrap(index, length) {
28265     if (index < 0) {
28266       index += Math.ceil(-index / length) * length;
28267     }
28268     return index % length;
28269   }
28270   function utilFunctor(value) {
28271     if (typeof value === "function")
28272       return value;
28273     return function() {
28274       return value;
28275     };
28276   }
28277   function utilNoAuto(selection2) {
28278     var isText = selection2.size() && selection2.node().tagName.toLowerCase() === "textarea";
28279     return selection2.attr("autocomplete", "new-password").attr("autocorrect", "off").attr("autocapitalize", "off").attr("spellcheck", isText ? "true" : "false");
28280   }
28281   function utilHashcode(str2) {
28282     var hash = 0;
28283     if (str2.length === 0) {
28284       return hash;
28285     }
28286     for (var i3 = 0; i3 < str2.length; i3++) {
28287       var char = str2.charCodeAt(i3);
28288       hash = (hash << 5) - hash + char;
28289       hash = hash & hash;
28290     }
28291     return hash;
28292   }
28293   function utilSafeClassName(str2) {
28294     return str2.toLowerCase().replace(/[^a-z0-9]+/g, "_");
28295   }
28296   function utilUniqueDomId(val) {
28297     return "ideditor-" + utilSafeClassName(val.toString()) + "-" + (/* @__PURE__ */ new Date()).getTime().toString();
28298   }
28299   function utilUnicodeCharsCount(str2) {
28300     return Array.from(str2).length;
28301   }
28302   function utilUnicodeCharsTruncated(str2, limit) {
28303     return Array.from(str2).slice(0, limit).join("");
28304   }
28305   function toNumericID(id2) {
28306     var match = id2.match(/^[cnwr](-?\d+)$/);
28307     if (match) {
28308       return parseInt(match[1], 10);
28309     }
28310     return NaN;
28311   }
28312   function compareNumericIDs(left, right) {
28313     if (isNaN(left) && isNaN(right))
28314       return -1;
28315     if (isNaN(left))
28316       return 1;
28317     if (isNaN(right))
28318       return -1;
28319     if (Math.sign(left) !== Math.sign(right))
28320       return -Math.sign(left);
28321     if (Math.sign(left) < 0)
28322       return Math.sign(right - left);
28323     return Math.sign(left - right);
28324   }
28325   function utilCompareIDs(left, right) {
28326     return compareNumericIDs(toNumericID(left), toNumericID(right));
28327   }
28328   function utilOldestID(ids) {
28329     if (ids.length === 0) {
28330       return void 0;
28331     }
28332     var oldestIDIndex = 0;
28333     var oldestID = toNumericID(ids[0]);
28334     for (var i3 = 1; i3 < ids.length; i3++) {
28335       var num = toNumericID(ids[i3]);
28336       if (compareNumericIDs(oldestID, num) === 1) {
28337         oldestIDIndex = i3;
28338         oldestID = num;
28339       }
28340     }
28341     return ids[oldestIDIndex];
28342   }
28343   function utilCleanOsmString(val, maxChars) {
28344     if (val === void 0 || val === null) {
28345       val = "";
28346     } else {
28347       val = val.toString();
28348     }
28349     val = val.trim();
28350     if (val.normalize)
28351       val = val.normalize("NFC");
28352     return utilUnicodeCharsTruncated(val, maxChars);
28353   }
28354
28355   // modules/osm/entity.js
28356   function osmEntity(attrs) {
28357     if (this instanceof osmEntity)
28358       return;
28359     if (attrs && attrs.type) {
28360       return osmEntity[attrs.type].apply(this, arguments);
28361     } else if (attrs && attrs.id) {
28362       return osmEntity[osmEntity.id.type(attrs.id)].apply(this, arguments);
28363     }
28364     return new osmEntity().initialize(arguments);
28365   }
28366   osmEntity.id = function(type2) {
28367     return osmEntity.id.fromOSM(type2, osmEntity.id.next[type2]--);
28368   };
28369   osmEntity.id.next = {
28370     changeset: -1,
28371     node: -1,
28372     way: -1,
28373     relation: -1
28374   };
28375   osmEntity.id.fromOSM = function(type2, id2) {
28376     return type2[0] + id2;
28377   };
28378   osmEntity.id.toOSM = function(id2) {
28379     var match = id2.match(/^[cnwr](-?\d+)$/);
28380     if (match) {
28381       return match[1];
28382     }
28383     return "";
28384   };
28385   osmEntity.id.type = function(id2) {
28386     return { "c": "changeset", "n": "node", "w": "way", "r": "relation" }[id2[0]];
28387   };
28388   osmEntity.key = function(entity) {
28389     return entity.id + "v" + (entity.v || 0);
28390   };
28391   var _deprecatedTagValuesByKey;
28392   osmEntity.deprecatedTagValuesByKey = function(dataDeprecated) {
28393     if (!_deprecatedTagValuesByKey) {
28394       _deprecatedTagValuesByKey = {};
28395       dataDeprecated.forEach(function(d2) {
28396         var oldKeys = Object.keys(d2.old);
28397         if (oldKeys.length === 1) {
28398           var oldKey = oldKeys[0];
28399           var oldValue = d2.old[oldKey];
28400           if (oldValue !== "*") {
28401             if (!_deprecatedTagValuesByKey[oldKey]) {
28402               _deprecatedTagValuesByKey[oldKey] = [oldValue];
28403             } else {
28404               _deprecatedTagValuesByKey[oldKey].push(oldValue);
28405             }
28406           }
28407         }
28408       });
28409     }
28410     return _deprecatedTagValuesByKey;
28411   };
28412   osmEntity.prototype = {
28413     tags: {},
28414     initialize: function(sources) {
28415       for (var i3 = 0; i3 < sources.length; ++i3) {
28416         var source = sources[i3];
28417         for (var prop in source) {
28418           if (Object.prototype.hasOwnProperty.call(source, prop)) {
28419             if (source[prop] === void 0) {
28420               delete this[prop];
28421             } else {
28422               this[prop] = source[prop];
28423             }
28424           }
28425         }
28426       }
28427       if (!this.id && this.type) {
28428         this.id = osmEntity.id(this.type);
28429       }
28430       if (!this.hasOwnProperty("visible")) {
28431         this.visible = true;
28432       }
28433       if (debug) {
28434         Object.freeze(this);
28435         Object.freeze(this.tags);
28436         if (this.loc)
28437           Object.freeze(this.loc);
28438         if (this.nodes)
28439           Object.freeze(this.nodes);
28440         if (this.members)
28441           Object.freeze(this.members);
28442       }
28443       return this;
28444     },
28445     copy: function(resolver, copies) {
28446       if (copies[this.id])
28447         return copies[this.id];
28448       var copy2 = osmEntity(this, { id: void 0, user: void 0, version: void 0 });
28449       copies[this.id] = copy2;
28450       return copy2;
28451     },
28452     osmId: function() {
28453       return osmEntity.id.toOSM(this.id);
28454     },
28455     isNew: function() {
28456       var osmId = osmEntity.id.toOSM(this.id);
28457       return osmId.length === 0 || osmId[0] === "-";
28458     },
28459     update: function(attrs) {
28460       return osmEntity(this, attrs, { v: 1 + (this.v || 0) });
28461     },
28462     mergeTags: function(tags) {
28463       var merged = Object.assign({}, this.tags);
28464       var changed = false;
28465       for (var k2 in tags) {
28466         var t1 = merged[k2];
28467         var t2 = tags[k2];
28468         if (!t1) {
28469           changed = true;
28470           merged[k2] = t2;
28471         } else if (t1 !== t2) {
28472           changed = true;
28473           merged[k2] = utilUnicodeCharsTruncated(
28474             utilArrayUnion(t1.split(/;\s*/), t2.split(/;\s*/)).join(";"),
28475             255
28476             // avoid exceeding character limit; see also context.maxCharsForTagValue()
28477           );
28478         }
28479       }
28480       return changed ? this.update({ tags: merged }) : this;
28481     },
28482     intersects: function(extent, resolver) {
28483       return this.extent(resolver).intersects(extent);
28484     },
28485     hasNonGeometryTags: function() {
28486       return Object.keys(this.tags).some(function(k2) {
28487         return k2 !== "area";
28488       });
28489     },
28490     hasParentRelations: function(resolver) {
28491       return resolver.parentRelations(this).length > 0;
28492     },
28493     hasInterestingTags: function() {
28494       return Object.keys(this.tags).some(osmIsInterestingTag);
28495     },
28496     isHighwayIntersection: function() {
28497       return false;
28498     },
28499     isDegenerate: function() {
28500       return true;
28501     },
28502     deprecatedTags: function(dataDeprecated) {
28503       var tags = this.tags;
28504       if (Object.keys(tags).length === 0)
28505         return [];
28506       var deprecated = [];
28507       dataDeprecated.forEach(function(d2) {
28508         var oldKeys = Object.keys(d2.old);
28509         if (d2.replace) {
28510           var hasExistingValues = Object.keys(d2.replace).some(function(replaceKey) {
28511             if (!tags[replaceKey] || d2.old[replaceKey])
28512               return false;
28513             var replaceValue = d2.replace[replaceKey];
28514             if (replaceValue === "*")
28515               return false;
28516             if (replaceValue === tags[replaceKey])
28517               return false;
28518             return true;
28519           });
28520           if (hasExistingValues)
28521             return;
28522         }
28523         var matchesDeprecatedTags = oldKeys.every(function(oldKey) {
28524           if (!tags[oldKey])
28525             return false;
28526           if (d2.old[oldKey] === "*")
28527             return true;
28528           if (d2.old[oldKey] === tags[oldKey])
28529             return true;
28530           var vals = tags[oldKey].split(";").filter(Boolean);
28531           if (vals.length === 0) {
28532             return false;
28533           } else if (vals.length > 1) {
28534             return vals.indexOf(d2.old[oldKey]) !== -1;
28535           } else {
28536             if (tags[oldKey] === d2.old[oldKey]) {
28537               if (d2.replace && d2.old[oldKey] === d2.replace[oldKey]) {
28538                 var replaceKeys = Object.keys(d2.replace);
28539                 return !replaceKeys.every(function(replaceKey) {
28540                   return tags[replaceKey] === d2.replace[replaceKey];
28541                 });
28542               } else {
28543                 return true;
28544               }
28545             }
28546           }
28547           return false;
28548         });
28549         if (matchesDeprecatedTags) {
28550           deprecated.push(d2);
28551         }
28552       });
28553       return deprecated;
28554     }
28555   };
28556
28557   // modules/osm/lanes.js
28558   function osmLanes(entity) {
28559     if (entity.type !== "way")
28560       return null;
28561     if (!entity.tags.highway)
28562       return null;
28563     var tags = entity.tags;
28564     var isOneWay = entity.isOneWay();
28565     var laneCount = getLaneCount(tags, isOneWay);
28566     var maxspeed = parseMaxspeed(tags);
28567     var laneDirections = parseLaneDirections(tags, isOneWay, laneCount);
28568     var forward = laneDirections.forward;
28569     var backward = laneDirections.backward;
28570     var bothways = laneDirections.bothways;
28571     var turnLanes = {};
28572     turnLanes.unspecified = parseTurnLanes(tags["turn:lanes"]);
28573     turnLanes.forward = parseTurnLanes(tags["turn:lanes:forward"]);
28574     turnLanes.backward = parseTurnLanes(tags["turn:lanes:backward"]);
28575     var maxspeedLanes = {};
28576     maxspeedLanes.unspecified = parseMaxspeedLanes(tags["maxspeed:lanes"], maxspeed);
28577     maxspeedLanes.forward = parseMaxspeedLanes(tags["maxspeed:lanes:forward"], maxspeed);
28578     maxspeedLanes.backward = parseMaxspeedLanes(tags["maxspeed:lanes:backward"], maxspeed);
28579     var psvLanes = {};
28580     psvLanes.unspecified = parseMiscLanes(tags["psv:lanes"]);
28581     psvLanes.forward = parseMiscLanes(tags["psv:lanes:forward"]);
28582     psvLanes.backward = parseMiscLanes(tags["psv:lanes:backward"]);
28583     var busLanes = {};
28584     busLanes.unspecified = parseMiscLanes(tags["bus:lanes"]);
28585     busLanes.forward = parseMiscLanes(tags["bus:lanes:forward"]);
28586     busLanes.backward = parseMiscLanes(tags["bus:lanes:backward"]);
28587     var taxiLanes = {};
28588     taxiLanes.unspecified = parseMiscLanes(tags["taxi:lanes"]);
28589     taxiLanes.forward = parseMiscLanes(tags["taxi:lanes:forward"]);
28590     taxiLanes.backward = parseMiscLanes(tags["taxi:lanes:backward"]);
28591     var hovLanes = {};
28592     hovLanes.unspecified = parseMiscLanes(tags["hov:lanes"]);
28593     hovLanes.forward = parseMiscLanes(tags["hov:lanes:forward"]);
28594     hovLanes.backward = parseMiscLanes(tags["hov:lanes:backward"]);
28595     var hgvLanes = {};
28596     hgvLanes.unspecified = parseMiscLanes(tags["hgv:lanes"]);
28597     hgvLanes.forward = parseMiscLanes(tags["hgv:lanes:forward"]);
28598     hgvLanes.backward = parseMiscLanes(tags["hgv:lanes:backward"]);
28599     var bicyclewayLanes = {};
28600     bicyclewayLanes.unspecified = parseBicycleWay(tags["bicycleway:lanes"]);
28601     bicyclewayLanes.forward = parseBicycleWay(tags["bicycleway:lanes:forward"]);
28602     bicyclewayLanes.backward = parseBicycleWay(tags["bicycleway:lanes:backward"]);
28603     var lanesObj = {
28604       forward: [],
28605       backward: [],
28606       unspecified: []
28607     };
28608     mapToLanesObj(lanesObj, turnLanes, "turnLane");
28609     mapToLanesObj(lanesObj, maxspeedLanes, "maxspeed");
28610     mapToLanesObj(lanesObj, psvLanes, "psv");
28611     mapToLanesObj(lanesObj, busLanes, "bus");
28612     mapToLanesObj(lanesObj, taxiLanes, "taxi");
28613     mapToLanesObj(lanesObj, hovLanes, "hov");
28614     mapToLanesObj(lanesObj, hgvLanes, "hgv");
28615     mapToLanesObj(lanesObj, bicyclewayLanes, "bicycleway");
28616     return {
28617       metadata: {
28618         count: laneCount,
28619         oneway: isOneWay,
28620         forward,
28621         backward,
28622         bothways,
28623         turnLanes,
28624         maxspeed,
28625         maxspeedLanes,
28626         psvLanes,
28627         busLanes,
28628         taxiLanes,
28629         hovLanes,
28630         hgvLanes,
28631         bicyclewayLanes
28632       },
28633       lanes: lanesObj
28634     };
28635   }
28636   function getLaneCount(tags, isOneWay) {
28637     var count;
28638     if (tags.lanes) {
28639       count = parseInt(tags.lanes, 10);
28640       if (count > 0) {
28641         return count;
28642       }
28643     }
28644     switch (tags.highway) {
28645       case "trunk":
28646       case "motorway":
28647         count = isOneWay ? 2 : 4;
28648         break;
28649       default:
28650         count = isOneWay ? 1 : 2;
28651         break;
28652     }
28653     return count;
28654   }
28655   function parseMaxspeed(tags) {
28656     var maxspeed = tags.maxspeed;
28657     if (!maxspeed)
28658       return;
28659     var maxspeedRegex = /^([0-9][\.0-9]+?)(?:[ ]?(?:km\/h|kmh|kph|mph|knots))?$/;
28660     if (!maxspeedRegex.test(maxspeed))
28661       return;
28662     return parseInt(maxspeed, 10);
28663   }
28664   function parseLaneDirections(tags, isOneWay, laneCount) {
28665     var forward = parseInt(tags["lanes:forward"], 10);
28666     var backward = parseInt(tags["lanes:backward"], 10);
28667     var bothways = parseInt(tags["lanes:both_ways"], 10) > 0 ? 1 : 0;
28668     if (parseInt(tags.oneway, 10) === -1) {
28669       forward = 0;
28670       bothways = 0;
28671       backward = laneCount;
28672     } else if (isOneWay) {
28673       forward = laneCount;
28674       bothways = 0;
28675       backward = 0;
28676     } else if (isNaN(forward) && isNaN(backward)) {
28677       backward = Math.floor((laneCount - bothways) / 2);
28678       forward = laneCount - bothways - backward;
28679     } else if (isNaN(forward)) {
28680       if (backward > laneCount - bothways) {
28681         backward = laneCount - bothways;
28682       }
28683       forward = laneCount - bothways - backward;
28684     } else if (isNaN(backward)) {
28685       if (forward > laneCount - bothways) {
28686         forward = laneCount - bothways;
28687       }
28688       backward = laneCount - bothways - forward;
28689     }
28690     return {
28691       forward,
28692       backward,
28693       bothways
28694     };
28695   }
28696   function parseTurnLanes(tag) {
28697     if (!tag)
28698       return;
28699     var validValues = [
28700       "left",
28701       "slight_left",
28702       "sharp_left",
28703       "through",
28704       "right",
28705       "slight_right",
28706       "sharp_right",
28707       "reverse",
28708       "merge_to_left",
28709       "merge_to_right",
28710       "none"
28711     ];
28712     return tag.split("|").map(function(s2) {
28713       if (s2 === "")
28714         s2 = "none";
28715       return s2.split(";").map(function(d2) {
28716         return validValues.indexOf(d2) === -1 ? "unknown" : d2;
28717       });
28718     });
28719   }
28720   function parseMaxspeedLanes(tag, maxspeed) {
28721     if (!tag)
28722       return;
28723     return tag.split("|").map(function(s2) {
28724       if (s2 === "none")
28725         return s2;
28726       var m2 = parseInt(s2, 10);
28727       if (s2 === "" || m2 === maxspeed)
28728         return null;
28729       return isNaN(m2) ? "unknown" : m2;
28730     });
28731   }
28732   function parseMiscLanes(tag) {
28733     if (!tag)
28734       return;
28735     var validValues = [
28736       "yes",
28737       "no",
28738       "designated"
28739     ];
28740     return tag.split("|").map(function(s2) {
28741       if (s2 === "")
28742         s2 = "no";
28743       return validValues.indexOf(s2) === -1 ? "unknown" : s2;
28744     });
28745   }
28746   function parseBicycleWay(tag) {
28747     if (!tag)
28748       return;
28749     var validValues = [
28750       "yes",
28751       "no",
28752       "designated",
28753       "lane"
28754     ];
28755     return tag.split("|").map(function(s2) {
28756       if (s2 === "")
28757         s2 = "no";
28758       return validValues.indexOf(s2) === -1 ? "unknown" : s2;
28759     });
28760   }
28761   function mapToLanesObj(lanesObj, data, key) {
28762     if (data.forward) {
28763       data.forward.forEach(function(l2, i3) {
28764         if (!lanesObj.forward[i3])
28765           lanesObj.forward[i3] = {};
28766         lanesObj.forward[i3][key] = l2;
28767       });
28768     }
28769     if (data.backward) {
28770       data.backward.forEach(function(l2, i3) {
28771         if (!lanesObj.backward[i3])
28772           lanesObj.backward[i3] = {};
28773         lanesObj.backward[i3][key] = l2;
28774       });
28775     }
28776     if (data.unspecified) {
28777       data.unspecified.forEach(function(l2, i3) {
28778         if (!lanesObj.unspecified[i3])
28779           lanesObj.unspecified[i3] = {};
28780         lanesObj.unspecified[i3][key] = l2;
28781       });
28782     }
28783   }
28784
28785   // modules/osm/way.js
28786   function osmWay() {
28787     if (!(this instanceof osmWay)) {
28788       return new osmWay().initialize(arguments);
28789     } else if (arguments.length) {
28790       this.initialize(arguments);
28791     }
28792   }
28793   osmEntity.way = osmWay;
28794   osmWay.prototype = Object.create(osmEntity.prototype);
28795   Object.assign(osmWay.prototype, {
28796     type: "way",
28797     nodes: [],
28798     copy: function(resolver, copies) {
28799       if (copies[this.id])
28800         return copies[this.id];
28801       var copy2 = osmEntity.prototype.copy.call(this, resolver, copies);
28802       var nodes = this.nodes.map(function(id2) {
28803         return resolver.entity(id2).copy(resolver, copies).id;
28804       });
28805       copy2 = copy2.update({ nodes });
28806       copies[this.id] = copy2;
28807       return copy2;
28808     },
28809     extent: function(resolver) {
28810       return resolver.transient(this, "extent", function() {
28811         var extent = geoExtent();
28812         for (var i3 = 0; i3 < this.nodes.length; i3++) {
28813           var node = resolver.hasEntity(this.nodes[i3]);
28814           if (node) {
28815             extent._extend(node.extent());
28816           }
28817         }
28818         return extent;
28819       });
28820     },
28821     first: function() {
28822       return this.nodes[0];
28823     },
28824     last: function() {
28825       return this.nodes[this.nodes.length - 1];
28826     },
28827     contains: function(node) {
28828       return this.nodes.indexOf(node) >= 0;
28829     },
28830     affix: function(node) {
28831       if (this.nodes[0] === node)
28832         return "prefix";
28833       if (this.nodes[this.nodes.length - 1] === node)
28834         return "suffix";
28835     },
28836     layer: function() {
28837       if (isFinite(this.tags.layer)) {
28838         return Math.max(-10, Math.min(+this.tags.layer, 10));
28839       }
28840       if (this.tags.covered === "yes")
28841         return -1;
28842       if (this.tags.location === "overground")
28843         return 1;
28844       if (this.tags.location === "underground")
28845         return -1;
28846       if (this.tags.location === "underwater")
28847         return -10;
28848       if (this.tags.power === "line")
28849         return 10;
28850       if (this.tags.power === "minor_line")
28851         return 10;
28852       if (this.tags.aerialway)
28853         return 10;
28854       if (this.tags.bridge)
28855         return 1;
28856       if (this.tags.cutting)
28857         return -1;
28858       if (this.tags.tunnel)
28859         return -1;
28860       if (this.tags.waterway)
28861         return -1;
28862       if (this.tags.man_made === "pipeline")
28863         return -10;
28864       if (this.tags.boundary)
28865         return -10;
28866       return 0;
28867     },
28868     // the approximate width of the line based on its tags except its `width` tag
28869     impliedLineWidthMeters: function() {
28870       var averageWidths = {
28871         highway: {
28872           // width is for single lane
28873           motorway: 5,
28874           motorway_link: 5,
28875           trunk: 4.5,
28876           trunk_link: 4.5,
28877           primary: 4,
28878           secondary: 4,
28879           tertiary: 4,
28880           primary_link: 4,
28881           secondary_link: 4,
28882           tertiary_link: 4,
28883           unclassified: 4,
28884           road: 4,
28885           living_street: 4,
28886           bus_guideway: 4,
28887           pedestrian: 4,
28888           residential: 3.5,
28889           service: 3.5,
28890           track: 3,
28891           cycleway: 2.5,
28892           bridleway: 2,
28893           corridor: 2,
28894           steps: 2,
28895           path: 1.5,
28896           footway: 1.5
28897         },
28898         railway: {
28899           // width includes ties and rail bed, not just track gauge
28900           rail: 2.5,
28901           light_rail: 2.5,
28902           tram: 2.5,
28903           subway: 2.5,
28904           monorail: 2.5,
28905           funicular: 2.5,
28906           disused: 2.5,
28907           preserved: 2.5,
28908           miniature: 1.5,
28909           narrow_gauge: 1.5
28910         },
28911         waterway: {
28912           river: 50,
28913           canal: 25,
28914           stream: 5,
28915           tidal_channel: 5,
28916           fish_pass: 2.5,
28917           drain: 2.5,
28918           ditch: 1.5
28919         }
28920       };
28921       for (var key in averageWidths) {
28922         if (this.tags[key] && averageWidths[key][this.tags[key]]) {
28923           var width = averageWidths[key][this.tags[key]];
28924           if (key === "highway") {
28925             var laneCount = this.tags.lanes && parseInt(this.tags.lanes, 10);
28926             if (!laneCount)
28927               laneCount = this.isOneWay() ? 1 : 2;
28928             return width * laneCount;
28929           }
28930           return width;
28931         }
28932       }
28933       return null;
28934     },
28935     isOneWay: function() {
28936       var values = {
28937         "yes": true,
28938         "1": true,
28939         "-1": true,
28940         "reversible": true,
28941         "alternating": true,
28942         "no": false,
28943         "0": false
28944       };
28945       if (values[this.tags.oneway] !== void 0) {
28946         return values[this.tags.oneway];
28947       }
28948       for (var key in this.tags) {
28949         if (key in osmOneWayTags && this.tags[key] in osmOneWayTags[key]) {
28950           return true;
28951         }
28952       }
28953       return false;
28954     },
28955     // Some identifier for tag that implies that this way is "sided",
28956     // i.e. the right side is the 'inside' (e.g. the right side of a
28957     // natural=cliff is lower).
28958     sidednessIdentifier: function() {
28959       for (const realKey in this.tags) {
28960         const value = this.tags[realKey];
28961         const key = osmRemoveLifecyclePrefix(realKey);
28962         if (key in osmRightSideIsInsideTags && value in osmRightSideIsInsideTags[key]) {
28963           if (osmRightSideIsInsideTags[key][value] === true) {
28964             return key;
28965           } else {
28966             return osmRightSideIsInsideTags[key][value];
28967           }
28968         }
28969       }
28970       return null;
28971     },
28972     isSided: function() {
28973       if (this.tags.two_sided === "yes") {
28974         return false;
28975       }
28976       return this.sidednessIdentifier() !== null;
28977     },
28978     lanes: function() {
28979       return osmLanes(this);
28980     },
28981     isClosed: function() {
28982       return this.nodes.length > 1 && this.first() === this.last();
28983     },
28984     isConvex: function(resolver) {
28985       if (!this.isClosed() || this.isDegenerate())
28986         return null;
28987       var nodes = utilArrayUniq(resolver.childNodes(this));
28988       var coords = nodes.map(function(n3) {
28989         return n3.loc;
28990       });
28991       var curr = 0;
28992       var prev = 0;
28993       for (var i3 = 0; i3 < coords.length; i3++) {
28994         var o2 = coords[(i3 + 1) % coords.length];
28995         var a2 = coords[i3];
28996         var b2 = coords[(i3 + 2) % coords.length];
28997         var res = geoVecCross(a2, b2, o2);
28998         curr = res > 0 ? 1 : res < 0 ? -1 : 0;
28999         if (curr === 0) {
29000           continue;
29001         } else if (prev && curr !== prev) {
29002           return false;
29003         }
29004         prev = curr;
29005       }
29006       return true;
29007     },
29008     // returns an object with the tag that implies this is an area, if any
29009     tagSuggestingArea: function() {
29010       return osmTagSuggestingArea(this.tags);
29011     },
29012     isArea: function() {
29013       if (this.tags.area === "yes")
29014         return true;
29015       if (!this.isClosed() || this.tags.area === "no")
29016         return false;
29017       return this.tagSuggestingArea() !== null;
29018     },
29019     isDegenerate: function() {
29020       return new Set(this.nodes).size < (this.isArea() ? 3 : 2);
29021     },
29022     areAdjacent: function(n1, n22) {
29023       for (var i3 = 0; i3 < this.nodes.length; i3++) {
29024         if (this.nodes[i3] === n1) {
29025           if (this.nodes[i3 - 1] === n22)
29026             return true;
29027           if (this.nodes[i3 + 1] === n22)
29028             return true;
29029         }
29030       }
29031       return false;
29032     },
29033     geometry: function(graph) {
29034       return graph.transient(this, "geometry", function() {
29035         return this.isArea() ? "area" : "line";
29036       });
29037     },
29038     // returns an array of objects representing the segments between the nodes in this way
29039     segments: function(graph) {
29040       function segmentExtent(graph2) {
29041         var n1 = graph2.hasEntity(this.nodes[0]);
29042         var n22 = graph2.hasEntity(this.nodes[1]);
29043         return n1 && n22 && geoExtent([
29044           [
29045             Math.min(n1.loc[0], n22.loc[0]),
29046             Math.min(n1.loc[1], n22.loc[1])
29047           ],
29048           [
29049             Math.max(n1.loc[0], n22.loc[0]),
29050             Math.max(n1.loc[1], n22.loc[1])
29051           ]
29052         ]);
29053       }
29054       return graph.transient(this, "segments", function() {
29055         var segments = [];
29056         for (var i3 = 0; i3 < this.nodes.length - 1; i3++) {
29057           segments.push({
29058             id: this.id + "-" + i3,
29059             wayId: this.id,
29060             index: i3,
29061             nodes: [this.nodes[i3], this.nodes[i3 + 1]],
29062             extent: segmentExtent
29063           });
29064         }
29065         return segments;
29066       });
29067     },
29068     // If this way is not closed, append the beginning node to the end of the nodelist to close it.
29069     close: function() {
29070       if (this.isClosed() || !this.nodes.length)
29071         return this;
29072       var nodes = this.nodes.slice();
29073       nodes = nodes.filter(noRepeatNodes);
29074       nodes.push(nodes[0]);
29075       return this.update({ nodes });
29076     },
29077     // If this way is closed, remove any connector nodes from the end of the nodelist to unclose it.
29078     unclose: function() {
29079       if (!this.isClosed())
29080         return this;
29081       var nodes = this.nodes.slice();
29082       var connector = this.first();
29083       var i3 = nodes.length - 1;
29084       while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
29085         nodes.splice(i3, 1);
29086         i3 = nodes.length - 1;
29087       }
29088       nodes = nodes.filter(noRepeatNodes);
29089       return this.update({ nodes });
29090     },
29091     // Adds a node (id) in front of the node which is currently at position index.
29092     // If index is undefined, the node will be added to the end of the way for linear ways,
29093     //   or just before the final connecting node for circular ways.
29094     // Consecutive duplicates are eliminated including existing ones.
29095     // Circularity is always preserved when adding a node.
29096     addNode: function(id2, index) {
29097       var nodes = this.nodes.slice();
29098       var isClosed = this.isClosed();
29099       var max3 = isClosed ? nodes.length - 1 : nodes.length;
29100       if (index === void 0) {
29101         index = max3;
29102       }
29103       if (index < 0 || index > max3) {
29104         throw new RangeError("index " + index + " out of range 0.." + max3);
29105       }
29106       if (isClosed) {
29107         var connector = this.first();
29108         var i3 = 1;
29109         while (i3 < nodes.length && nodes.length > 2 && nodes[i3] === connector) {
29110           nodes.splice(i3, 1);
29111           if (index > i3)
29112             index--;
29113         }
29114         i3 = nodes.length - 1;
29115         while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
29116           nodes.splice(i3, 1);
29117           if (index > i3)
29118             index--;
29119           i3 = nodes.length - 1;
29120         }
29121       }
29122       nodes.splice(index, 0, id2);
29123       nodes = nodes.filter(noRepeatNodes);
29124       if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
29125         nodes.push(nodes[0]);
29126       }
29127       return this.update({ nodes });
29128     },
29129     // Replaces the node which is currently at position index with the given node (id).
29130     // Consecutive duplicates are eliminated including existing ones.
29131     // Circularity is preserved when updating a node.
29132     updateNode: function(id2, index) {
29133       var nodes = this.nodes.slice();
29134       var isClosed = this.isClosed();
29135       var max3 = nodes.length - 1;
29136       if (index === void 0 || index < 0 || index > max3) {
29137         throw new RangeError("index " + index + " out of range 0.." + max3);
29138       }
29139       if (isClosed) {
29140         var connector = this.first();
29141         var i3 = 1;
29142         while (i3 < nodes.length && nodes.length > 2 && nodes[i3] === connector) {
29143           nodes.splice(i3, 1);
29144           if (index > i3)
29145             index--;
29146         }
29147         i3 = nodes.length - 1;
29148         while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
29149           nodes.splice(i3, 1);
29150           if (index === i3)
29151             index = 0;
29152           i3 = nodes.length - 1;
29153         }
29154       }
29155       nodes.splice(index, 1, id2);
29156       nodes = nodes.filter(noRepeatNodes);
29157       if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
29158         nodes.push(nodes[0]);
29159       }
29160       return this.update({ nodes });
29161     },
29162     // Replaces each occurrence of node id needle with replacement.
29163     // Consecutive duplicates are eliminated including existing ones.
29164     // Circularity is preserved.
29165     replaceNode: function(needleID, replacementID) {
29166       var nodes = this.nodes.slice();
29167       var isClosed = this.isClosed();
29168       for (var i3 = 0; i3 < nodes.length; i3++) {
29169         if (nodes[i3] === needleID) {
29170           nodes[i3] = replacementID;
29171         }
29172       }
29173       nodes = nodes.filter(noRepeatNodes);
29174       if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
29175         nodes.push(nodes[0]);
29176       }
29177       return this.update({ nodes });
29178     },
29179     // Removes each occurrence of node id.
29180     // Consecutive duplicates are eliminated including existing ones.
29181     // Circularity is preserved.
29182     removeNode: function(id2) {
29183       var nodes = this.nodes.slice();
29184       var isClosed = this.isClosed();
29185       nodes = nodes.filter(function(node) {
29186         return node !== id2;
29187       }).filter(noRepeatNodes);
29188       if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
29189         nodes.push(nodes[0]);
29190       }
29191       return this.update({ nodes });
29192     },
29193     asJXON: function(changeset_id) {
29194       var r2 = {
29195         way: {
29196           "@id": this.osmId(),
29197           "@version": this.version || 0,
29198           nd: this.nodes.map(function(id2) {
29199             return { keyAttributes: { ref: osmEntity.id.toOSM(id2) } };
29200           }, this),
29201           tag: Object.keys(this.tags).map(function(k2) {
29202             return { keyAttributes: { k: k2, v: this.tags[k2] } };
29203           }, this)
29204         }
29205       };
29206       if (changeset_id) {
29207         r2.way["@changeset"] = changeset_id;
29208       }
29209       return r2;
29210     },
29211     asGeoJSON: function(resolver) {
29212       return resolver.transient(this, "GeoJSON", function() {
29213         var coordinates = resolver.childNodes(this).map(function(n3) {
29214           return n3.loc;
29215         });
29216         if (this.isArea() && this.isClosed()) {
29217           return {
29218             type: "Polygon",
29219             coordinates: [coordinates]
29220           };
29221         } else {
29222           return {
29223             type: "LineString",
29224             coordinates
29225           };
29226         }
29227       });
29228     },
29229     area: function(resolver) {
29230       return resolver.transient(this, "area", function() {
29231         var nodes = resolver.childNodes(this);
29232         var json = {
29233           type: "Polygon",
29234           coordinates: [nodes.map(function(n3) {
29235             return n3.loc;
29236           })]
29237         };
29238         if (!this.isClosed() && nodes.length) {
29239           json.coordinates[0].push(nodes[0].loc);
29240         }
29241         var area = area_default(json);
29242         if (area > 2 * Math.PI) {
29243           json.coordinates[0] = json.coordinates[0].reverse();
29244           area = area_default(json);
29245         }
29246         return isNaN(area) ? 0 : area;
29247       });
29248     }
29249   });
29250   function noRepeatNodes(node, i3, arr) {
29251     return i3 === 0 || node !== arr[i3 - 1];
29252   }
29253
29254   // modules/osm/multipolygon.js
29255   function osmOldMultipolygonOuterMemberOfRelation(entity, graph) {
29256     if (entity.type !== "relation" || !entity.isMultipolygon() || Object.keys(entity.tags).filter(osmIsInterestingTag).length > 1) {
29257       return false;
29258     }
29259     var outerMember;
29260     for (var memberIndex in entity.members) {
29261       var member = entity.members[memberIndex];
29262       if (!member.role || member.role === "outer") {
29263         if (outerMember)
29264           return false;
29265         if (member.type !== "way")
29266           return false;
29267         if (!graph.hasEntity(member.id))
29268           return false;
29269         outerMember = graph.entity(member.id);
29270         if (Object.keys(outerMember.tags).filter(osmIsInterestingTag).length === 0) {
29271           return false;
29272         }
29273       }
29274     }
29275     return outerMember;
29276   }
29277   function osmIsOldMultipolygonOuterMember(entity, graph) {
29278     if (entity.type !== "way" || Object.keys(entity.tags).filter(osmIsInterestingTag).length === 0) {
29279       return false;
29280     }
29281     var parents = graph.parentRelations(entity);
29282     if (parents.length !== 1)
29283       return false;
29284     var parent = parents[0];
29285     if (!parent.isMultipolygon() || Object.keys(parent.tags).filter(osmIsInterestingTag).length > 1) {
29286       return false;
29287     }
29288     var members = parent.members, member;
29289     for (var i3 = 0; i3 < members.length; i3++) {
29290       member = members[i3];
29291       if (member.id === entity.id && member.role && member.role !== "outer") {
29292         return false;
29293       }
29294       if (member.id !== entity.id && (!member.role || member.role === "outer")) {
29295         return false;
29296       }
29297     }
29298     return parent;
29299   }
29300   function osmOldMultipolygonOuterMember(entity, graph) {
29301     if (entity.type !== "way")
29302       return false;
29303     var parents = graph.parentRelations(entity);
29304     if (parents.length !== 1)
29305       return false;
29306     var parent = parents[0];
29307     if (!parent.isMultipolygon() || Object.keys(parent.tags).filter(osmIsInterestingTag).length > 1) {
29308       return false;
29309     }
29310     var members = parent.members, member, outerMember;
29311     for (var i3 = 0; i3 < members.length; i3++) {
29312       member = members[i3];
29313       if (!member.role || member.role === "outer") {
29314         if (outerMember)
29315           return false;
29316         outerMember = member;
29317       }
29318     }
29319     if (!outerMember)
29320       return false;
29321     var outerEntity = graph.hasEntity(outerMember.id);
29322     if (!outerEntity || !Object.keys(outerEntity.tags).filter(osmIsInterestingTag).length) {
29323       return false;
29324     }
29325     return outerEntity;
29326   }
29327   function osmJoinWays(toJoin, graph) {
29328     function resolve(member) {
29329       return graph.childNodes(graph.entity(member.id));
29330     }
29331     function reverse(item2) {
29332       var action = actionReverse(item2.id, { reverseOneway: true });
29333       sequences.actions.push(action);
29334       return item2 instanceof osmWay ? action(graph).entity(item2.id) : item2;
29335     }
29336     toJoin = toJoin.filter(function(member) {
29337       return member.type === "way" && graph.hasEntity(member.id);
29338     });
29339     var i3;
29340     var joinAsMembers = true;
29341     for (i3 = 0; i3 < toJoin.length; i3++) {
29342       if (toJoin[i3] instanceof osmWay) {
29343         joinAsMembers = false;
29344         break;
29345       }
29346     }
29347     var sequences = [];
29348     sequences.actions = [];
29349     while (toJoin.length) {
29350       var item = toJoin.shift();
29351       var currWays = [item];
29352       var currNodes = resolve(item).slice();
29353       while (toJoin.length) {
29354         var start2 = currNodes[0];
29355         var end = currNodes[currNodes.length - 1];
29356         var fn = null;
29357         var nodes = null;
29358         for (i3 = 0; i3 < toJoin.length; i3++) {
29359           item = toJoin[i3];
29360           nodes = resolve(item);
29361           if (joinAsMembers && currWays.length === 1 && nodes[0] !== end && nodes[nodes.length - 1] !== end && (nodes[nodes.length - 1] === start2 || nodes[0] === start2)) {
29362             currWays[0] = reverse(currWays[0]);
29363             currNodes.reverse();
29364             start2 = currNodes[0];
29365             end = currNodes[currNodes.length - 1];
29366           }
29367           if (nodes[0] === end) {
29368             fn = currNodes.push;
29369             nodes = nodes.slice(1);
29370             break;
29371           } else if (nodes[nodes.length - 1] === end) {
29372             fn = currNodes.push;
29373             nodes = nodes.slice(0, -1).reverse();
29374             item = reverse(item);
29375             break;
29376           } else if (nodes[nodes.length - 1] === start2) {
29377             fn = currNodes.unshift;
29378             nodes = nodes.slice(0, -1);
29379             break;
29380           } else if (nodes[0] === start2) {
29381             fn = currNodes.unshift;
29382             nodes = nodes.slice(1).reverse();
29383             item = reverse(item);
29384             break;
29385           } else {
29386             fn = nodes = null;
29387           }
29388         }
29389         if (!nodes) {
29390           break;
29391         }
29392         fn.apply(currWays, [item]);
29393         fn.apply(currNodes, nodes);
29394         toJoin.splice(i3, 1);
29395       }
29396       currWays.nodes = currNodes;
29397       sequences.push(currWays);
29398     }
29399     return sequences;
29400   }
29401
29402   // modules/actions/add_member.js
29403   function actionAddMember(relationId, member, memberIndex, insertPair) {
29404     return function action(graph) {
29405       var relation = graph.entity(relationId);
29406       var isPTv2 = /stop|platform/.test(member.role);
29407       if ((isNaN(memberIndex) || insertPair) && member.type === "way" && !isPTv2) {
29408         graph = addWayMember(relation, graph);
29409       } else {
29410         if (isPTv2 && isNaN(memberIndex)) {
29411           memberIndex = 0;
29412         }
29413         graph = graph.replace(relation.addMember(member, memberIndex));
29414       }
29415       return graph;
29416     };
29417     function addWayMember(relation, graph) {
29418       var groups, tempWay, insertPairIsReversed, item, i3, j3, k2;
29419       var PTv2members = [];
29420       var members = [];
29421       for (i3 = 0; i3 < relation.members.length; i3++) {
29422         var m2 = relation.members[i3];
29423         if (/stop|platform/.test(m2.role)) {
29424           PTv2members.push(m2);
29425         } else {
29426           members.push(m2);
29427         }
29428       }
29429       relation = relation.update({ members });
29430       if (insertPair) {
29431         tempWay = osmWay({ id: "wTemp", nodes: insertPair.nodes });
29432         graph = graph.replace(tempWay);
29433         var tempMember = { id: tempWay.id, type: "way", role: member.role };
29434         var tempRelation = relation.replaceMember({ id: insertPair.originalID }, tempMember, true);
29435         groups = utilArrayGroupBy(tempRelation.members, "type");
29436         groups.way = groups.way || [];
29437         var originalWay = graph.entity(insertPair.originalID);
29438         var insertedWay = graph.entity(insertPair.insertedID);
29439         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];
29440       } else {
29441         groups = utilArrayGroupBy(relation.members, "type");
29442         groups.way = groups.way || [];
29443         groups.way.push(member);
29444       }
29445       members = withIndex(groups.way);
29446       var joined = osmJoinWays(members, graph);
29447       for (i3 = 0; i3 < joined.length; i3++) {
29448         var segment = joined[i3];
29449         var nodes = segment.nodes.slice();
29450         var startIndex = segment[0].index;
29451         for (j3 = 0; j3 < members.length; j3++) {
29452           if (members[j3].index === startIndex) {
29453             break;
29454           }
29455         }
29456         for (k2 = 0; k2 < segment.length; k2++) {
29457           item = segment[k2];
29458           var way = graph.entity(item.id);
29459           if (tempWay && item.id === tempWay.id) {
29460             var reverse = nodes[0].id !== insertPair.nodes[0] ^ insertPairIsReversed;
29461             if (reverse) {
29462               item.pair = [
29463                 { id: insertPair.insertedID, type: "way", role: item.role },
29464                 { id: insertPair.originalID, type: "way", role: item.role }
29465               ];
29466             } else {
29467               item.pair = [
29468                 { id: insertPair.originalID, type: "way", role: item.role },
29469                 { id: insertPair.insertedID, type: "way", role: item.role }
29470               ];
29471             }
29472           }
29473           if (k2 > 0) {
29474             if (j3 + k2 >= members.length || item.index !== members[j3 + k2].index) {
29475               moveMember(members, item.index, j3 + k2);
29476             }
29477           }
29478           nodes.splice(0, way.nodes.length - 1);
29479         }
29480       }
29481       if (tempWay) {
29482         graph = graph.remove(tempWay);
29483       }
29484       var wayMembers = [];
29485       for (i3 = 0; i3 < members.length; i3++) {
29486         item = members[i3];
29487         if (item.index === -1)
29488           continue;
29489         if (item.pair) {
29490           wayMembers.push(item.pair[0]);
29491           wayMembers.push(item.pair[1]);
29492         } else {
29493           wayMembers.push(utilObjectOmit(item, ["index"]));
29494         }
29495       }
29496       var newMembers = PTv2members.concat(groups.node || [], wayMembers, groups.relation || []);
29497       return graph.replace(relation.update({ members: newMembers }));
29498       function moveMember(arr, findIndex, toIndex) {
29499         var i4;
29500         for (i4 = 0; i4 < arr.length; i4++) {
29501           if (arr[i4].index === findIndex) {
29502             break;
29503           }
29504         }
29505         var item2 = Object.assign({}, arr[i4]);
29506         arr[i4].index = -1;
29507         item2.index = toIndex;
29508         arr.splice(toIndex, 0, item2);
29509       }
29510       function withIndex(arr) {
29511         var result = new Array(arr.length);
29512         for (var i4 = 0; i4 < arr.length; i4++) {
29513           result[i4] = Object.assign({}, arr[i4]);
29514           result[i4].index = i4;
29515         }
29516         return result;
29517       }
29518     }
29519   }
29520
29521   // modules/actions/add_midpoint.js
29522   function actionAddMidpoint(midpoint, node) {
29523     return function(graph) {
29524       graph = graph.replace(node.move(midpoint.loc));
29525       var parents = utilArrayIntersection(
29526         graph.parentWays(graph.entity(midpoint.edge[0])),
29527         graph.parentWays(graph.entity(midpoint.edge[1]))
29528       );
29529       parents.forEach(function(way) {
29530         for (var i3 = 0; i3 < way.nodes.length - 1; i3++) {
29531           if (geoEdgeEqual([way.nodes[i3], way.nodes[i3 + 1]], midpoint.edge)) {
29532             graph = graph.replace(graph.entity(way.id).addNode(node.id, i3 + 1));
29533             return;
29534           }
29535         }
29536       });
29537       return graph;
29538     };
29539   }
29540
29541   // modules/actions/add_vertex.js
29542   function actionAddVertex(wayId, nodeId, index) {
29543     return function(graph) {
29544       return graph.replace(graph.entity(wayId).addNode(nodeId, index));
29545     };
29546   }
29547
29548   // modules/actions/change_member.js
29549   function actionChangeMember(relationId, member, memberIndex) {
29550     return function(graph) {
29551       return graph.replace(graph.entity(relationId).updateMember(member, memberIndex));
29552     };
29553   }
29554
29555   // modules/actions/change_preset.js
29556   function actionChangePreset(entityID, oldPreset, newPreset, skipFieldDefaults) {
29557     return function action(graph) {
29558       var entity = graph.entity(entityID);
29559       var geometry = entity.geometry(graph);
29560       var tags = entity.tags;
29561       const loc = entity.extent(graph).center();
29562       var preserveKeys;
29563       if (newPreset) {
29564         preserveKeys = [];
29565         if (newPreset.addTags) {
29566           preserveKeys = preserveKeys.concat(Object.keys(newPreset.addTags));
29567         }
29568         if (oldPreset && !oldPreset.id.startsWith(newPreset.id)) {
29569           newPreset.fields(loc).concat(newPreset.moreFields(loc)).filter((f3) => f3.matchGeometry(geometry)).map((f3) => f3.key).filter(Boolean).forEach((key) => preserveKeys.push(key));
29570         }
29571       }
29572       if (oldPreset)
29573         tags = oldPreset.unsetTags(tags, geometry, preserveKeys, false, loc);
29574       if (newPreset)
29575         tags = newPreset.setTags(tags, geometry, skipFieldDefaults, loc);
29576       return graph.replace(entity.update({ tags }));
29577     };
29578   }
29579
29580   // modules/actions/change_tags.js
29581   function actionChangeTags(entityId, tags) {
29582     return function(graph) {
29583       var entity = graph.entity(entityId);
29584       return graph.replace(entity.update({ tags }));
29585     };
29586   }
29587
29588   // modules/osm/node.js
29589   var cardinal = {
29590     north: 0,
29591     n: 0,
29592     northnortheast: 22,
29593     nne: 22,
29594     northeast: 45,
29595     ne: 45,
29596     eastnortheast: 67,
29597     ene: 67,
29598     east: 90,
29599     e: 90,
29600     eastsoutheast: 112,
29601     ese: 112,
29602     southeast: 135,
29603     se: 135,
29604     southsoutheast: 157,
29605     sse: 157,
29606     south: 180,
29607     s: 180,
29608     southsouthwest: 202,
29609     ssw: 202,
29610     southwest: 225,
29611     sw: 225,
29612     westsouthwest: 247,
29613     wsw: 247,
29614     west: 270,
29615     w: 270,
29616     westnorthwest: 292,
29617     wnw: 292,
29618     northwest: 315,
29619     nw: 315,
29620     northnorthwest: 337,
29621     nnw: 337
29622   };
29623   function osmNode() {
29624     if (!(this instanceof osmNode)) {
29625       return new osmNode().initialize(arguments);
29626     } else if (arguments.length) {
29627       this.initialize(arguments);
29628     }
29629   }
29630   osmEntity.node = osmNode;
29631   osmNode.prototype = Object.create(osmEntity.prototype);
29632   Object.assign(osmNode.prototype, {
29633     type: "node",
29634     loc: [9999, 9999],
29635     extent: function() {
29636       return new geoExtent(this.loc);
29637     },
29638     geometry: function(graph) {
29639       return graph.transient(this, "geometry", function() {
29640         return graph.isPoi(this) ? "point" : "vertex";
29641       });
29642     },
29643     move: function(loc) {
29644       return this.update({ loc });
29645     },
29646     isDegenerate: function() {
29647       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);
29648     },
29649     // Inspect tags and geometry to determine which direction(s) this node/vertex points
29650     directions: function(resolver, projection2) {
29651       var val;
29652       var i3;
29653       if (this.isHighwayIntersection(resolver) && (this.tags.stop || "").toLowerCase() === "all") {
29654         val = "all";
29655       } else {
29656         val = (this.tags.direction || "").toLowerCase();
29657         var re3 = /:direction$/i;
29658         var keys2 = Object.keys(this.tags);
29659         for (i3 = 0; i3 < keys2.length; i3++) {
29660           if (re3.test(keys2[i3])) {
29661             val = this.tags[keys2[i3]].toLowerCase();
29662             break;
29663           }
29664         }
29665       }
29666       if (val === "")
29667         return [];
29668       var values = val.split(";");
29669       var results = [];
29670       values.forEach(function(v2) {
29671         if (cardinal[v2] !== void 0) {
29672           v2 = cardinal[v2];
29673         }
29674         if (v2 !== "" && !isNaN(+v2)) {
29675           results.push(+v2);
29676           return;
29677         }
29678         var lookBackward = this.tags["traffic_sign:backward"] || v2 === "backward" || v2 === "both" || v2 === "all";
29679         var lookForward = this.tags["traffic_sign:forward"] || v2 === "forward" || v2 === "both" || v2 === "all";
29680         if (!lookForward && !lookBackward)
29681           return;
29682         var nodeIds = {};
29683         resolver.parentWays(this).forEach(function(parent) {
29684           var nodes = parent.nodes;
29685           for (i3 = 0; i3 < nodes.length; i3++) {
29686             if (nodes[i3] === this.id) {
29687               if (lookForward && i3 > 0) {
29688                 nodeIds[nodes[i3 - 1]] = true;
29689               }
29690               if (lookBackward && i3 < nodes.length - 1) {
29691                 nodeIds[nodes[i3 + 1]] = true;
29692               }
29693             }
29694           }
29695         }, this);
29696         Object.keys(nodeIds).forEach(function(nodeId) {
29697           results.push(
29698             geoAngle(this, resolver.entity(nodeId), projection2) * (180 / Math.PI) + 90
29699           );
29700         }, this);
29701       }, this);
29702       return utilArrayUniq(results);
29703     },
29704     isCrossing: function() {
29705       return this.tags.highway === "crossing" || this.tags.railway && this.tags.railway.indexOf("crossing") !== -1;
29706     },
29707     isEndpoint: function(resolver) {
29708       return resolver.transient(this, "isEndpoint", function() {
29709         var id2 = this.id;
29710         return resolver.parentWays(this).filter(function(parent) {
29711           return !parent.isClosed() && !!parent.affix(id2);
29712         }).length > 0;
29713       });
29714     },
29715     isConnected: function(resolver) {
29716       return resolver.transient(this, "isConnected", function() {
29717         var parents = resolver.parentWays(this);
29718         if (parents.length > 1) {
29719           for (var i3 in parents) {
29720             if (parents[i3].geometry(resolver) === "line" && parents[i3].hasInterestingTags())
29721               return true;
29722           }
29723         } else if (parents.length === 1) {
29724           var way = parents[0];
29725           var nodes = way.nodes.slice();
29726           if (way.isClosed()) {
29727             nodes.pop();
29728           }
29729           return nodes.indexOf(this.id) !== nodes.lastIndexOf(this.id);
29730         }
29731         return false;
29732       });
29733     },
29734     parentIntersectionWays: function(resolver) {
29735       return resolver.transient(this, "parentIntersectionWays", function() {
29736         return resolver.parentWays(this).filter(function(parent) {
29737           return (parent.tags.highway || parent.tags.waterway || parent.tags.railway || parent.tags.aeroway) && parent.geometry(resolver) === "line";
29738         });
29739       });
29740     },
29741     isIntersection: function(resolver) {
29742       return this.parentIntersectionWays(resolver).length > 1;
29743     },
29744     isHighwayIntersection: function(resolver) {
29745       return resolver.transient(this, "isHighwayIntersection", function() {
29746         return resolver.parentWays(this).filter(function(parent) {
29747           return parent.tags.highway && parent.geometry(resolver) === "line";
29748         }).length > 1;
29749       });
29750     },
29751     isOnAddressLine: function(resolver) {
29752       return resolver.transient(this, "isOnAddressLine", function() {
29753         return resolver.parentWays(this).filter(function(parent) {
29754           return parent.tags.hasOwnProperty("addr:interpolation") && parent.geometry(resolver) === "line";
29755         }).length > 0;
29756       });
29757     },
29758     asJXON: function(changeset_id) {
29759       var r2 = {
29760         node: {
29761           "@id": this.osmId(),
29762           "@lon": this.loc[0],
29763           "@lat": this.loc[1],
29764           "@version": this.version || 0,
29765           tag: Object.keys(this.tags).map(function(k2) {
29766             return { keyAttributes: { k: k2, v: this.tags[k2] } };
29767           }, this)
29768         }
29769       };
29770       if (changeset_id)
29771         r2.node["@changeset"] = changeset_id;
29772       return r2;
29773     },
29774     asGeoJSON: function() {
29775       return {
29776         type: "Point",
29777         coordinates: this.loc
29778       };
29779     }
29780   });
29781
29782   // modules/actions/circularize.js
29783   function actionCircularize(wayId, projection2, maxAngle) {
29784     maxAngle = (maxAngle || 20) * Math.PI / 180;
29785     var action = function(graph, t2) {
29786       if (t2 === null || !isFinite(t2))
29787         t2 = 1;
29788       t2 = Math.min(Math.max(+t2, 0), 1);
29789       var way = graph.entity(wayId);
29790       var origNodes = {};
29791       graph.childNodes(way).forEach(function(node2) {
29792         if (!origNodes[node2.id])
29793           origNodes[node2.id] = node2;
29794       });
29795       if (!way.isConvex(graph)) {
29796         graph = action.makeConvex(graph);
29797       }
29798       var nodes = utilArrayUniq(graph.childNodes(way));
29799       var keyNodes = nodes.filter(function(n3) {
29800         return graph.parentWays(n3).length !== 1;
29801       });
29802       var points = nodes.map(function(n3) {
29803         return projection2(n3.loc);
29804       });
29805       var keyPoints = keyNodes.map(function(n3) {
29806         return projection2(n3.loc);
29807       });
29808       var centroid = points.length === 2 ? geoVecInterp(points[0], points[1], 0.5) : centroid_default2(points);
29809       var radius = median(points, function(p2) {
29810         return geoVecLength(centroid, p2);
29811       });
29812       var sign2 = area_default3(points) > 0 ? 1 : -1;
29813       var ids, i3, j3, k2;
29814       if (!keyNodes.length) {
29815         keyNodes = [nodes[0]];
29816         keyPoints = [points[0]];
29817       }
29818       if (keyNodes.length === 1) {
29819         var index = nodes.indexOf(keyNodes[0]);
29820         var oppositeIndex = Math.floor((index + nodes.length / 2) % nodes.length);
29821         keyNodes.push(nodes[oppositeIndex]);
29822         keyPoints.push(points[oppositeIndex]);
29823       }
29824       for (i3 = 0; i3 < keyPoints.length; i3++) {
29825         var nextKeyNodeIndex = (i3 + 1) % keyNodes.length;
29826         var startNode = keyNodes[i3];
29827         var endNode = keyNodes[nextKeyNodeIndex];
29828         var startNodeIndex = nodes.indexOf(startNode);
29829         var endNodeIndex = nodes.indexOf(endNode);
29830         var numberNewPoints = -1;
29831         var indexRange = endNodeIndex - startNodeIndex;
29832         var nearNodes = {};
29833         var inBetweenNodes = [];
29834         var startAngle, endAngle, totalAngle, eachAngle;
29835         var angle2, loc, node, origNode;
29836         if (indexRange < 0) {
29837           indexRange += nodes.length;
29838         }
29839         var distance = geoVecLength(centroid, keyPoints[i3]) || 1e-4;
29840         keyPoints[i3] = [
29841           centroid[0] + (keyPoints[i3][0] - centroid[0]) / distance * radius,
29842           centroid[1] + (keyPoints[i3][1] - centroid[1]) / distance * radius
29843         ];
29844         loc = projection2.invert(keyPoints[i3]);
29845         node = keyNodes[i3];
29846         origNode = origNodes[node.id];
29847         node = node.move(geoVecInterp(origNode.loc, loc, t2));
29848         graph = graph.replace(node);
29849         startAngle = Math.atan2(keyPoints[i3][1] - centroid[1], keyPoints[i3][0] - centroid[0]);
29850         endAngle = Math.atan2(keyPoints[nextKeyNodeIndex][1] - centroid[1], keyPoints[nextKeyNodeIndex][0] - centroid[0]);
29851         totalAngle = endAngle - startAngle;
29852         if (totalAngle * sign2 > 0) {
29853           totalAngle = -sign2 * (2 * Math.PI - Math.abs(totalAngle));
29854         }
29855         do {
29856           numberNewPoints++;
29857           eachAngle = totalAngle / (indexRange + numberNewPoints);
29858         } while (Math.abs(eachAngle) > maxAngle);
29859         for (j3 = 1; j3 < indexRange; j3++) {
29860           angle2 = startAngle + j3 * eachAngle;
29861           loc = projection2.invert([
29862             centroid[0] + Math.cos(angle2) * radius,
29863             centroid[1] + Math.sin(angle2) * radius
29864           ]);
29865           node = nodes[(j3 + startNodeIndex) % nodes.length];
29866           origNode = origNodes[node.id];
29867           nearNodes[node.id] = angle2;
29868           node = node.move(geoVecInterp(origNode.loc, loc, t2));
29869           graph = graph.replace(node);
29870         }
29871         for (j3 = 0; j3 < numberNewPoints; j3++) {
29872           angle2 = startAngle + (indexRange + j3) * eachAngle;
29873           loc = projection2.invert([
29874             centroid[0] + Math.cos(angle2) * radius,
29875             centroid[1] + Math.sin(angle2) * radius
29876           ]);
29877           var min3 = Infinity;
29878           for (var nodeId in nearNodes) {
29879             var nearAngle = nearNodes[nodeId];
29880             var dist = Math.abs(nearAngle - angle2);
29881             if (dist < min3) {
29882               min3 = dist;
29883               origNode = origNodes[nodeId];
29884             }
29885           }
29886           node = osmNode({ loc: geoVecInterp(origNode.loc, loc, t2) });
29887           graph = graph.replace(node);
29888           nodes.splice(endNodeIndex + j3, 0, node);
29889           inBetweenNodes.push(node.id);
29890         }
29891         if (indexRange === 1 && inBetweenNodes.length) {
29892           var startIndex1 = way.nodes.lastIndexOf(startNode.id);
29893           var endIndex1 = way.nodes.lastIndexOf(endNode.id);
29894           var wayDirection1 = endIndex1 - startIndex1;
29895           if (wayDirection1 < -1) {
29896             wayDirection1 = 1;
29897           }
29898           var parentWays = graph.parentWays(keyNodes[i3]);
29899           for (j3 = 0; j3 < parentWays.length; j3++) {
29900             var sharedWay = parentWays[j3];
29901             if (sharedWay === way)
29902               continue;
29903             if (sharedWay.areAdjacent(startNode.id, endNode.id)) {
29904               var startIndex2 = sharedWay.nodes.lastIndexOf(startNode.id);
29905               var endIndex2 = sharedWay.nodes.lastIndexOf(endNode.id);
29906               var wayDirection2 = endIndex2 - startIndex2;
29907               var insertAt = endIndex2;
29908               if (wayDirection2 < -1) {
29909                 wayDirection2 = 1;
29910               }
29911               if (wayDirection1 !== wayDirection2) {
29912                 inBetweenNodes.reverse();
29913                 insertAt = startIndex2;
29914               }
29915               for (k2 = 0; k2 < inBetweenNodes.length; k2++) {
29916                 sharedWay = sharedWay.addNode(inBetweenNodes[k2], insertAt + k2);
29917               }
29918               graph = graph.replace(sharedWay);
29919             }
29920           }
29921         }
29922       }
29923       ids = nodes.map(function(n3) {
29924         return n3.id;
29925       });
29926       ids.push(ids[0]);
29927       way = way.update({ nodes: ids });
29928       graph = graph.replace(way);
29929       return graph;
29930     };
29931     action.makeConvex = function(graph) {
29932       var way = graph.entity(wayId);
29933       var nodes = utilArrayUniq(graph.childNodes(way));
29934       var points = nodes.map(function(n3) {
29935         return projection2(n3.loc);
29936       });
29937       var sign2 = area_default3(points) > 0 ? 1 : -1;
29938       var hull = hull_default(points);
29939       var i3, j3;
29940       if (sign2 === -1) {
29941         nodes.reverse();
29942         points.reverse();
29943       }
29944       for (i3 = 0; i3 < hull.length - 1; i3++) {
29945         var startIndex = points.indexOf(hull[i3]);
29946         var endIndex = points.indexOf(hull[i3 + 1]);
29947         var indexRange = endIndex - startIndex;
29948         if (indexRange < 0) {
29949           indexRange += nodes.length;
29950         }
29951         for (j3 = 1; j3 < indexRange; j3++) {
29952           var point2 = geoVecInterp(hull[i3], hull[i3 + 1], j3 / indexRange);
29953           var node = nodes[(j3 + startIndex) % nodes.length].move(projection2.invert(point2));
29954           graph = graph.replace(node);
29955         }
29956       }
29957       return graph;
29958     };
29959     action.disabled = function(graph) {
29960       if (!graph.entity(wayId).isClosed()) {
29961         return "not_closed";
29962       }
29963       var way = graph.entity(wayId);
29964       var nodes = utilArrayUniq(graph.childNodes(way));
29965       var points = nodes.map(function(n3) {
29966         return projection2(n3.loc);
29967       });
29968       var hull = hull_default(points);
29969       var epsilonAngle = Math.PI / 180;
29970       if (hull.length !== points.length || hull.length < 3) {
29971         return false;
29972       }
29973       var centroid = centroid_default2(points);
29974       var radius = geoVecLengthSquare(centroid, points[0]);
29975       var i3, actualPoint;
29976       for (i3 = 0; i3 < hull.length; i3++) {
29977         actualPoint = hull[i3];
29978         var actualDist = geoVecLengthSquare(actualPoint, centroid);
29979         var diff = Math.abs(actualDist - radius);
29980         if (diff > 0.05 * radius) {
29981           return false;
29982         }
29983       }
29984       for (i3 = 0; i3 < hull.length; i3++) {
29985         actualPoint = hull[i3];
29986         var nextPoint = hull[(i3 + 1) % hull.length];
29987         var startAngle = Math.atan2(actualPoint[1] - centroid[1], actualPoint[0] - centroid[0]);
29988         var endAngle = Math.atan2(nextPoint[1] - centroid[1], nextPoint[0] - centroid[0]);
29989         var angle2 = endAngle - startAngle;
29990         if (angle2 < 0) {
29991           angle2 = -angle2;
29992         }
29993         if (angle2 > Math.PI) {
29994           angle2 = 2 * Math.PI - angle2;
29995         }
29996         if (angle2 > maxAngle + epsilonAngle) {
29997           return false;
29998         }
29999       }
30000       return "already_circular";
30001     };
30002     action.transitionable = true;
30003     return action;
30004   }
30005
30006   // modules/actions/delete_way.js
30007   function actionDeleteWay(wayID) {
30008     function canDeleteNode(node, graph) {
30009       if (graph.parentWays(node).length || graph.parentRelations(node).length)
30010         return false;
30011       var geometries = osmNodeGeometriesForTags(node.tags);
30012       if (geometries.point)
30013         return false;
30014       if (geometries.vertex)
30015         return true;
30016       return !node.hasInterestingTags();
30017     }
30018     var action = function(graph) {
30019       var way = graph.entity(wayID);
30020       graph.parentRelations(way).forEach(function(parent) {
30021         parent = parent.removeMembersWithID(wayID);
30022         graph = graph.replace(parent);
30023         if (parent.isDegenerate()) {
30024           graph = actionDeleteRelation(parent.id)(graph);
30025         }
30026       });
30027       new Set(way.nodes).forEach(function(nodeID) {
30028         graph = graph.replace(way.removeNode(nodeID));
30029         var node = graph.entity(nodeID);
30030         if (canDeleteNode(node, graph)) {
30031           graph = graph.remove(node);
30032         }
30033       });
30034       return graph.remove(way);
30035     };
30036     return action;
30037   }
30038
30039   // modules/actions/delete_multiple.js
30040   function actionDeleteMultiple(ids) {
30041     var actions = {
30042       way: actionDeleteWay,
30043       node: actionDeleteNode,
30044       relation: actionDeleteRelation
30045     };
30046     var action = function(graph) {
30047       ids.forEach(function(id2) {
30048         if (graph.hasEntity(id2)) {
30049           graph = actions[graph.entity(id2).type](id2)(graph);
30050         }
30051       });
30052       return graph;
30053     };
30054     return action;
30055   }
30056
30057   // modules/actions/delete_relation.js
30058   function actionDeleteRelation(relationID, allowUntaggedMembers) {
30059     function canDeleteEntity(entity, graph) {
30060       return !graph.parentWays(entity).length && !graph.parentRelations(entity).length && (!entity.hasInterestingTags() && !allowUntaggedMembers);
30061     }
30062     var action = function(graph) {
30063       var relation = graph.entity(relationID);
30064       graph.parentRelations(relation).forEach(function(parent) {
30065         parent = parent.removeMembersWithID(relationID);
30066         graph = graph.replace(parent);
30067         if (parent.isDegenerate()) {
30068           graph = actionDeleteRelation(parent.id)(graph);
30069         }
30070       });
30071       var memberIDs = utilArrayUniq(relation.members.map(function(m2) {
30072         return m2.id;
30073       }));
30074       memberIDs.forEach(function(memberID) {
30075         graph = graph.replace(relation.removeMembersWithID(memberID));
30076         var entity = graph.entity(memberID);
30077         if (canDeleteEntity(entity, graph)) {
30078           graph = actionDeleteMultiple([memberID])(graph);
30079         }
30080       });
30081       return graph.remove(relation);
30082     };
30083     return action;
30084   }
30085
30086   // modules/actions/delete_node.js
30087   function actionDeleteNode(nodeId) {
30088     var action = function(graph) {
30089       var node = graph.entity(nodeId);
30090       graph.parentWays(node).forEach(function(parent) {
30091         parent = parent.removeNode(nodeId);
30092         graph = graph.replace(parent);
30093         if (parent.isDegenerate()) {
30094           graph = actionDeleteWay(parent.id)(graph);
30095         }
30096       });
30097       graph.parentRelations(node).forEach(function(parent) {
30098         parent = parent.removeMembersWithID(nodeId);
30099         graph = graph.replace(parent);
30100         if (parent.isDegenerate()) {
30101           graph = actionDeleteRelation(parent.id)(graph);
30102         }
30103       });
30104       return graph.remove(node);
30105     };
30106     return action;
30107   }
30108
30109   // modules/actions/connect.js
30110   function actionConnect(nodeIDs) {
30111     var action = function(graph) {
30112       var survivor;
30113       var node;
30114       var parents;
30115       var i3, j3;
30116       nodeIDs.reverse();
30117       var interestingIDs = [];
30118       for (i3 = 0; i3 < nodeIDs.length; i3++) {
30119         node = graph.entity(nodeIDs[i3]);
30120         if (node.hasInterestingTags()) {
30121           if (!node.isNew()) {
30122             interestingIDs.push(node.id);
30123           }
30124         }
30125       }
30126       survivor = graph.entity(utilOldestID(interestingIDs.length > 0 ? interestingIDs : nodeIDs));
30127       for (i3 = 0; i3 < nodeIDs.length; i3++) {
30128         node = graph.entity(nodeIDs[i3]);
30129         if (node.id === survivor.id)
30130           continue;
30131         parents = graph.parentWays(node);
30132         for (j3 = 0; j3 < parents.length; j3++) {
30133           graph = graph.replace(parents[j3].replaceNode(node.id, survivor.id));
30134         }
30135         parents = graph.parentRelations(node);
30136         for (j3 = 0; j3 < parents.length; j3++) {
30137           graph = graph.replace(parents[j3].replaceMember(node, survivor));
30138         }
30139         survivor = survivor.mergeTags(node.tags);
30140         graph = actionDeleteNode(node.id)(graph);
30141       }
30142       graph = graph.replace(survivor);
30143       parents = graph.parentWays(survivor);
30144       for (i3 = 0; i3 < parents.length; i3++) {
30145         if (parents[i3].isDegenerate()) {
30146           graph = actionDeleteWay(parents[i3].id)(graph);
30147         }
30148       }
30149       return graph;
30150     };
30151     action.disabled = function(graph) {
30152       var seen = {};
30153       var restrictionIDs = [];
30154       var survivor;
30155       var node, way;
30156       var relations, relation, role;
30157       var i3, j3, k2;
30158       survivor = graph.entity(utilOldestID(nodeIDs));
30159       for (i3 = 0; i3 < nodeIDs.length; i3++) {
30160         node = graph.entity(nodeIDs[i3]);
30161         relations = graph.parentRelations(node);
30162         for (j3 = 0; j3 < relations.length; j3++) {
30163           relation = relations[j3];
30164           role = relation.memberById(node.id).role || "";
30165           if (relation.hasFromViaTo()) {
30166             restrictionIDs.push(relation.id);
30167           }
30168           if (seen[relation.id] !== void 0 && seen[relation.id] !== role) {
30169             return "relation";
30170           } else {
30171             seen[relation.id] = role;
30172           }
30173         }
30174       }
30175       for (i3 = 0; i3 < nodeIDs.length; i3++) {
30176         node = graph.entity(nodeIDs[i3]);
30177         var parents = graph.parentWays(node);
30178         for (j3 = 0; j3 < parents.length; j3++) {
30179           var parent = parents[j3];
30180           relations = graph.parentRelations(parent);
30181           for (k2 = 0; k2 < relations.length; k2++) {
30182             relation = relations[k2];
30183             if (relation.hasFromViaTo()) {
30184               restrictionIDs.push(relation.id);
30185             }
30186           }
30187         }
30188       }
30189       restrictionIDs = utilArrayUniq(restrictionIDs);
30190       for (i3 = 0; i3 < restrictionIDs.length; i3++) {
30191         relation = graph.entity(restrictionIDs[i3]);
30192         if (!relation.isComplete(graph))
30193           continue;
30194         var memberWays = relation.members.filter(function(m2) {
30195           return m2.type === "way";
30196         }).map(function(m2) {
30197           return graph.entity(m2.id);
30198         });
30199         memberWays = utilArrayUniq(memberWays);
30200         var f3 = relation.memberByRole("from");
30201         var t2 = relation.memberByRole("to");
30202         var isUturn = f3.id === t2.id;
30203         var nodes = { from: [], via: [], to: [], keyfrom: [], keyto: [] };
30204         for (j3 = 0; j3 < relation.members.length; j3++) {
30205           collectNodes(relation.members[j3], nodes);
30206         }
30207         nodes.keyfrom = utilArrayUniq(nodes.keyfrom.filter(hasDuplicates));
30208         nodes.keyto = utilArrayUniq(nodes.keyto.filter(hasDuplicates));
30209         var filter2 = keyNodeFilter(nodes.keyfrom, nodes.keyto);
30210         nodes.from = nodes.from.filter(filter2);
30211         nodes.via = nodes.via.filter(filter2);
30212         nodes.to = nodes.to.filter(filter2);
30213         var connectFrom = false;
30214         var connectVia = false;
30215         var connectTo = false;
30216         var connectKeyFrom = false;
30217         var connectKeyTo = false;
30218         for (j3 = 0; j3 < nodeIDs.length; j3++) {
30219           var n3 = nodeIDs[j3];
30220           if (nodes.from.indexOf(n3) !== -1) {
30221             connectFrom = true;
30222           }
30223           if (nodes.via.indexOf(n3) !== -1) {
30224             connectVia = true;
30225           }
30226           if (nodes.to.indexOf(n3) !== -1) {
30227             connectTo = true;
30228           }
30229           if (nodes.keyfrom.indexOf(n3) !== -1) {
30230             connectKeyFrom = true;
30231           }
30232           if (nodes.keyto.indexOf(n3) !== -1) {
30233             connectKeyTo = true;
30234           }
30235         }
30236         if (connectFrom && connectTo && !isUturn) {
30237           return "restriction";
30238         }
30239         if (connectFrom && connectVia) {
30240           return "restriction";
30241         }
30242         if (connectTo && connectVia) {
30243           return "restriction";
30244         }
30245         if (connectKeyFrom || connectKeyTo) {
30246           if (nodeIDs.length !== 2) {
30247             return "restriction";
30248           }
30249           var n0 = null;
30250           var n1 = null;
30251           for (j3 = 0; j3 < memberWays.length; j3++) {
30252             way = memberWays[j3];
30253             if (way.contains(nodeIDs[0])) {
30254               n0 = nodeIDs[0];
30255             }
30256             if (way.contains(nodeIDs[1])) {
30257               n1 = nodeIDs[1];
30258             }
30259           }
30260           if (n0 && n1) {
30261             var ok = false;
30262             for (j3 = 0; j3 < memberWays.length; j3++) {
30263               way = memberWays[j3];
30264               if (way.areAdjacent(n0, n1)) {
30265                 ok = true;
30266                 break;
30267               }
30268             }
30269             if (!ok) {
30270               return "restriction";
30271             }
30272           }
30273         }
30274         for (j3 = 0; j3 < memberWays.length; j3++) {
30275           way = memberWays[j3].update({});
30276           for (k2 = 0; k2 < nodeIDs.length; k2++) {
30277             if (nodeIDs[k2] === survivor.id)
30278               continue;
30279             if (way.areAdjacent(nodeIDs[k2], survivor.id)) {
30280               way = way.removeNode(nodeIDs[k2]);
30281             } else {
30282               way = way.replaceNode(nodeIDs[k2], survivor.id);
30283             }
30284           }
30285           if (way.isDegenerate()) {
30286             return "restriction";
30287           }
30288         }
30289       }
30290       return false;
30291       function hasDuplicates(n4, i4, arr) {
30292         return arr.indexOf(n4) !== arr.lastIndexOf(n4);
30293       }
30294       function keyNodeFilter(froms, tos) {
30295         return function(n4) {
30296           return froms.indexOf(n4) === -1 && tos.indexOf(n4) === -1;
30297         };
30298       }
30299       function collectNodes(member, collection) {
30300         var entity = graph.hasEntity(member.id);
30301         if (!entity)
30302           return;
30303         var role2 = member.role || "";
30304         if (!collection[role2]) {
30305           collection[role2] = [];
30306         }
30307         if (member.type === "node") {
30308           collection[role2].push(member.id);
30309           if (role2 === "via") {
30310             collection.keyfrom.push(member.id);
30311             collection.keyto.push(member.id);
30312           }
30313         } else if (member.type === "way") {
30314           collection[role2].push.apply(collection[role2], entity.nodes);
30315           if (role2 === "from" || role2 === "via") {
30316             collection.keyfrom.push(entity.first());
30317             collection.keyfrom.push(entity.last());
30318           }
30319           if (role2 === "to" || role2 === "via") {
30320             collection.keyto.push(entity.first());
30321             collection.keyto.push(entity.last());
30322           }
30323         }
30324       }
30325     };
30326     return action;
30327   }
30328
30329   // modules/actions/copy_entities.js
30330   function actionCopyEntities(ids, fromGraph) {
30331     var _copies = {};
30332     var action = function(graph) {
30333       ids.forEach(function(id3) {
30334         fromGraph.entity(id3).copy(fromGraph, _copies);
30335       });
30336       for (var id2 in _copies) {
30337         graph = graph.replace(_copies[id2]);
30338       }
30339       return graph;
30340     };
30341     action.copies = function() {
30342       return _copies;
30343     };
30344     return action;
30345   }
30346
30347   // modules/actions/delete_member.js
30348   function actionDeleteMember(relationId, memberIndex) {
30349     return function(graph) {
30350       var relation = graph.entity(relationId).removeMember(memberIndex);
30351       graph = graph.replace(relation);
30352       if (relation.isDegenerate()) {
30353         graph = actionDeleteRelation(relation.id)(graph);
30354       }
30355       return graph;
30356     };
30357   }
30358
30359   // modules/actions/discard_tags.js
30360   function actionDiscardTags(difference, discardTags) {
30361     discardTags = discardTags || {};
30362     return (graph) => {
30363       difference.modified().forEach(checkTags);
30364       difference.created().forEach(checkTags);
30365       return graph;
30366       function checkTags(entity) {
30367         const keys2 = Object.keys(entity.tags);
30368         let didDiscard = false;
30369         let tags = {};
30370         for (let i3 = 0; i3 < keys2.length; i3++) {
30371           const k2 = keys2[i3];
30372           if (discardTags[k2] || !entity.tags[k2]) {
30373             didDiscard = true;
30374           } else {
30375             tags[k2] = entity.tags[k2];
30376           }
30377         }
30378         if (didDiscard) {
30379           graph = graph.replace(entity.update({ tags }));
30380         }
30381       }
30382     };
30383   }
30384
30385   // modules/actions/disconnect.js
30386   function actionDisconnect(nodeId, newNodeId) {
30387     var wayIds;
30388     var disconnectableRelationTypes = {
30389       "associatedStreet": true,
30390       "enforcement": true,
30391       "site": true
30392     };
30393     var action = function(graph) {
30394       var node = graph.entity(nodeId);
30395       var connections = action.connections(graph);
30396       connections.forEach(function(connection) {
30397         var way = graph.entity(connection.wayID);
30398         var newNode = osmNode({ id: newNodeId, loc: node.loc, tags: node.tags });
30399         graph = graph.replace(newNode);
30400         if (connection.index === 0 && way.isArea()) {
30401           graph = graph.replace(way.replaceNode(way.nodes[0], newNode.id));
30402         } else if (way.isClosed() && connection.index === way.nodes.length - 1) {
30403           graph = graph.replace(way.unclose().addNode(newNode.id));
30404         } else {
30405           graph = graph.replace(way.updateNode(newNode.id, connection.index));
30406         }
30407       });
30408       return graph;
30409     };
30410     action.connections = function(graph) {
30411       var candidates = [];
30412       var keeping = false;
30413       var parentWays = graph.parentWays(graph.entity(nodeId));
30414       var way, waynode;
30415       for (var i3 = 0; i3 < parentWays.length; i3++) {
30416         way = parentWays[i3];
30417         if (wayIds && wayIds.indexOf(way.id) === -1) {
30418           keeping = true;
30419           continue;
30420         }
30421         if (way.isArea() && way.nodes[0] === nodeId) {
30422           candidates.push({ wayID: way.id, index: 0 });
30423         } else {
30424           for (var j3 = 0; j3 < way.nodes.length; j3++) {
30425             waynode = way.nodes[j3];
30426             if (waynode === nodeId) {
30427               if (way.isClosed() && parentWays.length > 1 && wayIds && wayIds.indexOf(way.id) !== -1 && j3 === way.nodes.length - 1) {
30428                 continue;
30429               }
30430               candidates.push({ wayID: way.id, index: j3 });
30431             }
30432           }
30433         }
30434       }
30435       return keeping ? candidates : candidates.slice(1);
30436     };
30437     action.disabled = function(graph) {
30438       var connections = action.connections(graph);
30439       if (connections.length === 0)
30440         return "not_connected";
30441       var parentWays = graph.parentWays(graph.entity(nodeId));
30442       var seenRelationIds = {};
30443       var sharedRelation;
30444       parentWays.forEach(function(way) {
30445         var relations = graph.parentRelations(way);
30446         relations.filter((relation) => !disconnectableRelationTypes[relation.tags.type]).forEach(function(relation) {
30447           if (relation.id in seenRelationIds) {
30448             if (wayIds) {
30449               if (wayIds.indexOf(way.id) !== -1 || wayIds.indexOf(seenRelationIds[relation.id]) !== -1) {
30450                 sharedRelation = relation;
30451               }
30452             } else {
30453               sharedRelation = relation;
30454             }
30455           } else {
30456             seenRelationIds[relation.id] = way.id;
30457           }
30458         });
30459       });
30460       if (sharedRelation)
30461         return "relation";
30462     };
30463     action.limitWays = function(val) {
30464       if (!arguments.length)
30465         return wayIds;
30466       wayIds = val;
30467       return action;
30468     };
30469     return action;
30470   }
30471
30472   // modules/actions/extract.js
30473   function actionExtract(entityID, projection2) {
30474     var extractedNodeID;
30475     var action = function(graph) {
30476       var entity = graph.entity(entityID);
30477       if (entity.type === "node") {
30478         return extractFromNode(entity, graph);
30479       }
30480       return extractFromWayOrRelation(entity, graph);
30481     };
30482     function extractFromNode(node, graph) {
30483       extractedNodeID = node.id;
30484       var replacement = osmNode({ loc: node.loc });
30485       graph = graph.replace(replacement);
30486       graph = graph.parentWays(node).reduce(function(accGraph, parentWay) {
30487         return accGraph.replace(parentWay.replaceNode(entityID, replacement.id));
30488       }, graph);
30489       return graph.parentRelations(node).reduce(function(accGraph, parentRel) {
30490         return accGraph.replace(parentRel.replaceMember(node, replacement));
30491       }, graph);
30492     }
30493     function extractFromWayOrRelation(entity, graph) {
30494       var fromGeometry = entity.geometry(graph);
30495       var keysToCopyAndRetain = ["source", "wheelchair"];
30496       var keysToRetain = ["area"];
30497       var buildingKeysToRetain = ["architect", "building", "height", "layer"];
30498       var extractedLoc = path_default(projection2).centroid(entity.asGeoJSON(graph));
30499       extractedLoc = extractedLoc && projection2.invert(extractedLoc);
30500       if (!extractedLoc || !isFinite(extractedLoc[0]) || !isFinite(extractedLoc[1])) {
30501         extractedLoc = entity.extent(graph).center();
30502       }
30503       var indoorAreaValues = {
30504         area: true,
30505         corridor: true,
30506         elevator: true,
30507         level: true,
30508         room: true
30509       };
30510       var isBuilding = entity.tags.building && entity.tags.building !== "no" || entity.tags["building:part"] && entity.tags["building:part"] !== "no";
30511       var isIndoorArea = fromGeometry === "area" && entity.tags.indoor && indoorAreaValues[entity.tags.indoor];
30512       var entityTags = Object.assign({}, entity.tags);
30513       var pointTags = {};
30514       for (var key in entityTags) {
30515         if (entity.type === "relation" && key === "type") {
30516           continue;
30517         }
30518         if (keysToRetain.indexOf(key) !== -1) {
30519           continue;
30520         }
30521         if (isBuilding) {
30522           if (buildingKeysToRetain.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/))
30523             continue;
30524         }
30525         if (isIndoorArea && key === "indoor") {
30526           continue;
30527         }
30528         pointTags[key] = entityTags[key];
30529         if (keysToCopyAndRetain.indexOf(key) !== -1 || key.match(/^addr:.{1,}/)) {
30530           continue;
30531         } else if (isIndoorArea && key === "level") {
30532           continue;
30533         }
30534         delete entityTags[key];
30535       }
30536       if (!isBuilding && !isIndoorArea && fromGeometry === "area") {
30537         entityTags.area = "yes";
30538       }
30539       var replacement = osmNode({ loc: extractedLoc, tags: pointTags });
30540       graph = graph.replace(replacement);
30541       extractedNodeID = replacement.id;
30542       return graph.replace(entity.update({ tags: entityTags }));
30543     }
30544     action.getExtractedNodeID = function() {
30545       return extractedNodeID;
30546     };
30547     return action;
30548   }
30549
30550   // modules/actions/join.js
30551   function actionJoin(ids) {
30552     function groupEntitiesByGeometry(graph) {
30553       var entities = ids.map(function(id2) {
30554         return graph.entity(id2);
30555       });
30556       return Object.assign(
30557         { line: [] },
30558         utilArrayGroupBy(entities, function(entity) {
30559           return entity.geometry(graph);
30560         })
30561       );
30562     }
30563     var action = function(graph) {
30564       var ways = ids.map(graph.entity, graph);
30565       var survivorID = utilOldestID(ways.map((way) => way.id));
30566       ways.sort(function(a2, b2) {
30567         var aSided = a2.isSided();
30568         var bSided = b2.isSided();
30569         return aSided && !bSided ? -1 : bSided && !aSided ? 1 : 0;
30570       });
30571       var sequences = osmJoinWays(ways, graph);
30572       var joined = sequences[0];
30573       graph = sequences.actions.reduce(function(g3, action2) {
30574         return action2(g3);
30575       }, graph);
30576       var survivor = graph.entity(survivorID);
30577       survivor = survivor.update({ nodes: joined.nodes.map(function(n3) {
30578         return n3.id;
30579       }) });
30580       graph = graph.replace(survivor);
30581       joined.forEach(function(way) {
30582         if (way.id === survivorID)
30583           return;
30584         graph.parentRelations(way).forEach(function(parent) {
30585           graph = graph.replace(parent.replaceMember(way, survivor));
30586         });
30587         survivor = survivor.mergeTags(way.tags);
30588         graph = graph.replace(survivor);
30589         graph = actionDeleteWay(way.id)(graph);
30590       });
30591       function checkForSimpleMultipolygon() {
30592         if (!survivor.isClosed())
30593           return;
30594         var multipolygons = graph.parentMultipolygons(survivor).filter(function(multipolygon2) {
30595           return multipolygon2.members.length === 1;
30596         });
30597         if (multipolygons.length !== 1)
30598           return;
30599         var multipolygon = multipolygons[0];
30600         for (var key in survivor.tags) {
30601           if (multipolygon.tags[key] && // don't collapse if tags cannot be cleanly merged
30602           multipolygon.tags[key] !== survivor.tags[key])
30603             return;
30604         }
30605         survivor = survivor.mergeTags(multipolygon.tags);
30606         graph = graph.replace(survivor);
30607         graph = actionDeleteRelation(
30608           multipolygon.id,
30609           true
30610           /* allow untagged members */
30611         )(graph);
30612         var tags = Object.assign({}, survivor.tags);
30613         if (survivor.geometry(graph) !== "area") {
30614           tags.area = "yes";
30615         }
30616         delete tags.type;
30617         survivor = survivor.update({ tags });
30618         graph = graph.replace(survivor);
30619       }
30620       checkForSimpleMultipolygon();
30621       return graph;
30622     };
30623     action.resultingWayNodesLength = function(graph) {
30624       return ids.reduce(function(count, id2) {
30625         return count + graph.entity(id2).nodes.length;
30626       }, 0) - ids.length - 1;
30627     };
30628     action.disabled = function(graph) {
30629       var geometries = groupEntitiesByGeometry(graph);
30630       if (ids.length < 2 || ids.length !== geometries.line.length) {
30631         return "not_eligible";
30632       }
30633       var joined = osmJoinWays(ids.map(graph.entity, graph), graph);
30634       if (joined.length > 1) {
30635         return "not_adjacent";
30636       }
30637       var i3;
30638       var sortedParentRelations = function(id2) {
30639         return graph.parentRelations(graph.entity(id2)).filter((rel) => !rel.isRestriction() && !rel.isConnectivity()).sort((a2, b2) => a2.id - b2.id);
30640       };
30641       var relsA = sortedParentRelations(ids[0]);
30642       for (i3 = 1; i3 < ids.length; i3++) {
30643         var relsB = sortedParentRelations(ids[i3]);
30644         if (!utilArrayIdentical(relsA, relsB)) {
30645           return "conflicting_relations";
30646         }
30647       }
30648       for (i3 = 0; i3 < ids.length - 1; i3++) {
30649         for (var j3 = i3 + 1; j3 < ids.length; j3++) {
30650           var path1 = graph.childNodes(graph.entity(ids[i3])).map(function(e3) {
30651             return e3.loc;
30652           });
30653           var path2 = graph.childNodes(graph.entity(ids[j3])).map(function(e3) {
30654             return e3.loc;
30655           });
30656           var intersections = geoPathIntersections(path1, path2);
30657           var common = utilArrayIntersection(
30658             joined[0].nodes.map(function(n3) {
30659               return n3.loc.toString();
30660             }),
30661             intersections.map(function(n3) {
30662               return n3.toString();
30663             })
30664           );
30665           if (common.length !== intersections.length) {
30666             return "paths_intersect";
30667           }
30668         }
30669       }
30670       var nodeIds = joined[0].nodes.map(function(n3) {
30671         return n3.id;
30672       }).slice(1, -1);
30673       var relation;
30674       var tags = {};
30675       var conflicting = false;
30676       joined[0].forEach(function(way) {
30677         var parents = graph.parentRelations(way);
30678         parents.forEach(function(parent) {
30679           if ((parent.isRestriction() || parent.isConnectivity()) && parent.members.some(function(m2) {
30680             return nodeIds.indexOf(m2.id) >= 0;
30681           })) {
30682             relation = parent;
30683           }
30684         });
30685         for (var k2 in way.tags) {
30686           if (!(k2 in tags)) {
30687             tags[k2] = way.tags[k2];
30688           } else if (tags[k2] && osmIsInterestingTag(k2) && tags[k2] !== way.tags[k2]) {
30689             conflicting = true;
30690           }
30691         }
30692       });
30693       if (relation) {
30694         return relation.isRestriction() ? "restriction" : "connectivity";
30695       }
30696       if (conflicting) {
30697         return "conflicting_tags";
30698       }
30699     };
30700     return action;
30701   }
30702
30703   // modules/actions/merge.js
30704   function actionMerge(ids) {
30705     function groupEntitiesByGeometry(graph) {
30706       var entities = ids.map(function(id2) {
30707         return graph.entity(id2);
30708       });
30709       return Object.assign(
30710         { point: [], area: [], line: [], relation: [] },
30711         utilArrayGroupBy(entities, function(entity) {
30712           return entity.geometry(graph);
30713         })
30714       );
30715     }
30716     var action = function(graph) {
30717       var geometries = groupEntitiesByGeometry(graph);
30718       var target = geometries.area[0] || geometries.line[0];
30719       var points = geometries.point;
30720       points.forEach(function(point2) {
30721         target = target.mergeTags(point2.tags);
30722         graph = graph.replace(target);
30723         graph.parentRelations(point2).forEach(function(parent) {
30724           graph = graph.replace(parent.replaceMember(point2, target));
30725         });
30726         var nodes = utilArrayUniq(graph.childNodes(target));
30727         var removeNode = point2;
30728         if (!point2.isNew()) {
30729           var inserted = false;
30730           var canBeReplaced = function(node2) {
30731             return !(graph.parentWays(node2).length > 1 || graph.parentRelations(node2).length);
30732           };
30733           var replaceNode = function(node2) {
30734             graph = graph.replace(point2.update({ tags: node2.tags, loc: node2.loc }));
30735             target = target.replaceNode(node2.id, point2.id);
30736             graph = graph.replace(target);
30737             removeNode = node2;
30738             inserted = true;
30739           };
30740           var i3;
30741           var node;
30742           for (i3 = 0; i3 < nodes.length; i3++) {
30743             node = nodes[i3];
30744             if (canBeReplaced(node) && node.isNew()) {
30745               replaceNode(node);
30746               break;
30747             }
30748           }
30749           if (!inserted && point2.hasInterestingTags()) {
30750             for (i3 = 0; i3 < nodes.length; i3++) {
30751               node = nodes[i3];
30752               if (canBeReplaced(node) && !node.hasInterestingTags()) {
30753                 replaceNode(node);
30754                 break;
30755               }
30756             }
30757             if (!inserted) {
30758               for (i3 = 0; i3 < nodes.length; i3++) {
30759                 node = nodes[i3];
30760                 if (canBeReplaced(node) && utilCompareIDs(point2.id, node.id) < 0) {
30761                   replaceNode(node);
30762                   break;
30763                 }
30764               }
30765             }
30766           }
30767         }
30768         graph = graph.remove(removeNode);
30769       });
30770       if (target.tags.area === "yes") {
30771         var tags = Object.assign({}, target.tags);
30772         delete tags.area;
30773         if (osmTagSuggestingArea(tags)) {
30774           target = target.update({ tags });
30775           graph = graph.replace(target);
30776         }
30777       }
30778       return graph;
30779     };
30780     action.disabled = function(graph) {
30781       var geometries = groupEntitiesByGeometry(graph);
30782       if (geometries.point.length === 0 || geometries.area.length + geometries.line.length !== 1 || geometries.relation.length !== 0) {
30783         return "not_eligible";
30784       }
30785     };
30786     return action;
30787   }
30788
30789   // modules/actions/merge_nodes.js
30790   function actionMergeNodes(nodeIDs, loc) {
30791     function chooseLoc(graph) {
30792       if (!nodeIDs.length)
30793         return null;
30794       var sum = [0, 0];
30795       var interestingCount = 0;
30796       var interestingLoc;
30797       for (var i3 = 0; i3 < nodeIDs.length; i3++) {
30798         var node = graph.entity(nodeIDs[i3]);
30799         if (node.hasInterestingTags()) {
30800           interestingLoc = ++interestingCount === 1 ? node.loc : null;
30801         }
30802         sum = geoVecAdd(sum, node.loc);
30803       }
30804       return interestingLoc || geoVecScale(sum, 1 / nodeIDs.length);
30805     }
30806     var action = function(graph) {
30807       if (nodeIDs.length < 2)
30808         return graph;
30809       var toLoc = loc;
30810       if (!toLoc) {
30811         toLoc = chooseLoc(graph);
30812       }
30813       for (var i3 = 0; i3 < nodeIDs.length; i3++) {
30814         var node = graph.entity(nodeIDs[i3]);
30815         if (node.loc !== toLoc) {
30816           graph = graph.replace(node.move(toLoc));
30817         }
30818       }
30819       return actionConnect(nodeIDs)(graph);
30820     };
30821     action.disabled = function(graph) {
30822       if (nodeIDs.length < 2)
30823         return "not_eligible";
30824       for (var i3 = 0; i3 < nodeIDs.length; i3++) {
30825         var entity = graph.entity(nodeIDs[i3]);
30826         if (entity.type !== "node")
30827           return "not_eligible";
30828       }
30829       return actionConnect(nodeIDs).disabled(graph);
30830     };
30831     return action;
30832   }
30833
30834   // modules/osm/changeset.js
30835   function osmChangeset() {
30836     if (!(this instanceof osmChangeset)) {
30837       return new osmChangeset().initialize(arguments);
30838     } else if (arguments.length) {
30839       this.initialize(arguments);
30840     }
30841   }
30842   osmEntity.changeset = osmChangeset;
30843   osmChangeset.prototype = Object.create(osmEntity.prototype);
30844   Object.assign(osmChangeset.prototype, {
30845     type: "changeset",
30846     extent: function() {
30847       return new geoExtent();
30848     },
30849     geometry: function() {
30850       return "changeset";
30851     },
30852     asJXON: function() {
30853       return {
30854         osm: {
30855           changeset: {
30856             tag: Object.keys(this.tags).map(function(k2) {
30857               return { "@k": k2, "@v": this.tags[k2] };
30858             }, this),
30859             "@version": 0.6,
30860             "@generator": "iD"
30861           }
30862         }
30863       };
30864     },
30865     // Generate [osmChange](http://wiki.openstreetmap.org/wiki/OsmChange)
30866     // XML. Returns a string.
30867     osmChangeJXON: function(changes) {
30868       var changeset_id = this.id;
30869       function nest(x2, order) {
30870         var groups = {};
30871         for (var i3 = 0; i3 < x2.length; i3++) {
30872           var tagName = Object.keys(x2[i3])[0];
30873           if (!groups[tagName])
30874             groups[tagName] = [];
30875           groups[tagName].push(x2[i3][tagName]);
30876         }
30877         var ordered = {};
30878         order.forEach(function(o2) {
30879           if (groups[o2])
30880             ordered[o2] = groups[o2];
30881         });
30882         return ordered;
30883       }
30884       function sort(changes2) {
30885         function resolve(item) {
30886           return relations.find(function(relation2) {
30887             return item.keyAttributes.type === "relation" && item.keyAttributes.ref === relation2["@id"];
30888           });
30889         }
30890         function isNew(item) {
30891           return !sorted[item["@id"]] && !processing.find(function(proc) {
30892             return proc["@id"] === item["@id"];
30893           });
30894         }
30895         var processing = [];
30896         var sorted = {};
30897         var relations = changes2.relation;
30898         if (!relations)
30899           return changes2;
30900         for (var i3 = 0; i3 < relations.length; i3++) {
30901           var relation = relations[i3];
30902           if (!sorted[relation["@id"]]) {
30903             processing.push(relation);
30904           }
30905           while (processing.length > 0) {
30906             var next = processing[0], deps = next.member.map(resolve).filter(Boolean).filter(isNew);
30907             if (deps.length === 0) {
30908               sorted[next["@id"]] = next;
30909               processing.shift();
30910             } else {
30911               processing = deps.concat(processing);
30912             }
30913           }
30914         }
30915         changes2.relation = Object.values(sorted);
30916         return changes2;
30917       }
30918       function rep2(entity) {
30919         return entity.asJXON(changeset_id);
30920       }
30921       return {
30922         osmChange: {
30923           "@version": 0.6,
30924           "@generator": "iD",
30925           "create": sort(nest(changes.created.map(rep2), ["node", "way", "relation"])),
30926           "modify": nest(changes.modified.map(rep2), ["node", "way", "relation"]),
30927           "delete": Object.assign(nest(changes.deleted.map(rep2), ["relation", "way", "node"]), { "@if-unused": true })
30928         }
30929       };
30930     },
30931     asGeoJSON: function() {
30932       return {};
30933     }
30934   });
30935
30936   // modules/osm/note.js
30937   function osmNote() {
30938     if (!(this instanceof osmNote)) {
30939       return new osmNote().initialize(arguments);
30940     } else if (arguments.length) {
30941       this.initialize(arguments);
30942     }
30943   }
30944   osmNote.id = function() {
30945     return osmNote.id.next--;
30946   };
30947   osmNote.id.next = -1;
30948   Object.assign(osmNote.prototype, {
30949     type: "note",
30950     initialize: function(sources) {
30951       for (var i3 = 0; i3 < sources.length; ++i3) {
30952         var source = sources[i3];
30953         for (var prop in source) {
30954           if (Object.prototype.hasOwnProperty.call(source, prop)) {
30955             if (source[prop] === void 0) {
30956               delete this[prop];
30957             } else {
30958               this[prop] = source[prop];
30959             }
30960           }
30961         }
30962       }
30963       if (!this.id) {
30964         this.id = osmNote.id().toString();
30965       }
30966       return this;
30967     },
30968     extent: function() {
30969       return new geoExtent(this.loc);
30970     },
30971     update: function(attrs) {
30972       return osmNote(this, attrs);
30973     },
30974     isNew: function() {
30975       return this.id < 0;
30976     },
30977     move: function(loc) {
30978       return this.update({ loc });
30979     }
30980   });
30981
30982   // modules/osm/relation.js
30983   function osmRelation() {
30984     if (!(this instanceof osmRelation)) {
30985       return new osmRelation().initialize(arguments);
30986     } else if (arguments.length) {
30987       this.initialize(arguments);
30988     }
30989   }
30990   osmEntity.relation = osmRelation;
30991   osmRelation.prototype = Object.create(osmEntity.prototype);
30992   osmRelation.creationOrder = function(a2, b2) {
30993     var aId = parseInt(osmEntity.id.toOSM(a2.id), 10);
30994     var bId = parseInt(osmEntity.id.toOSM(b2.id), 10);
30995     if (aId < 0 || bId < 0)
30996       return aId - bId;
30997     return bId - aId;
30998   };
30999   Object.assign(osmRelation.prototype, {
31000     type: "relation",
31001     members: [],
31002     copy: function(resolver, copies) {
31003       if (copies[this.id])
31004         return copies[this.id];
31005       var copy2 = osmEntity.prototype.copy.call(this, resolver, copies);
31006       var members = this.members.map(function(member) {
31007         return Object.assign({}, member, { id: resolver.entity(member.id).copy(resolver, copies).id });
31008       });
31009       copy2 = copy2.update({ members });
31010       copies[this.id] = copy2;
31011       return copy2;
31012     },
31013     extent: function(resolver, memo) {
31014       return resolver.transient(this, "extent", function() {
31015         if (memo && memo[this.id])
31016           return geoExtent();
31017         memo = memo || {};
31018         memo[this.id] = true;
31019         var extent = geoExtent();
31020         for (var i3 = 0; i3 < this.members.length; i3++) {
31021           var member = resolver.hasEntity(this.members[i3].id);
31022           if (member) {
31023             extent._extend(member.extent(resolver, memo));
31024           }
31025         }
31026         return extent;
31027       });
31028     },
31029     geometry: function(graph) {
31030       return graph.transient(this, "geometry", function() {
31031         return this.isMultipolygon() ? "area" : "relation";
31032       });
31033     },
31034     isDegenerate: function() {
31035       return this.members.length === 0;
31036     },
31037     // Return an array of members, each extended with an 'index' property whose value
31038     // is the member index.
31039     indexedMembers: function() {
31040       var result = new Array(this.members.length);
31041       for (var i3 = 0; i3 < this.members.length; i3++) {
31042         result[i3] = Object.assign({}, this.members[i3], { index: i3 });
31043       }
31044       return result;
31045     },
31046     // Return the first member with the given role. A copy of the member object
31047     // is returned, extended with an 'index' property whose value is the member index.
31048     memberByRole: function(role) {
31049       for (var i3 = 0; i3 < this.members.length; i3++) {
31050         if (this.members[i3].role === role) {
31051           return Object.assign({}, this.members[i3], { index: i3 });
31052         }
31053       }
31054     },
31055     // Same as memberByRole, but returns all members with the given role
31056     membersByRole: function(role) {
31057       var result = [];
31058       for (var i3 = 0; i3 < this.members.length; i3++) {
31059         if (this.members[i3].role === role) {
31060           result.push(Object.assign({}, this.members[i3], { index: i3 }));
31061         }
31062       }
31063       return result;
31064     },
31065     // Return the first member with the given id. A copy of the member object
31066     // is returned, extended with an 'index' property whose value is the member index.
31067     memberById: function(id2) {
31068       for (var i3 = 0; i3 < this.members.length; i3++) {
31069         if (this.members[i3].id === id2) {
31070           return Object.assign({}, this.members[i3], { index: i3 });
31071         }
31072       }
31073     },
31074     // Return the first member with the given id and role. A copy of the member object
31075     // is returned, extended with an 'index' property whose value is the member index.
31076     memberByIdAndRole: function(id2, role) {
31077       for (var i3 = 0; i3 < this.members.length; i3++) {
31078         if (this.members[i3].id === id2 && this.members[i3].role === role) {
31079           return Object.assign({}, this.members[i3], { index: i3 });
31080         }
31081       }
31082     },
31083     addMember: function(member, index) {
31084       var members = this.members.slice();
31085       members.splice(index === void 0 ? members.length : index, 0, member);
31086       return this.update({ members });
31087     },
31088     updateMember: function(member, index) {
31089       var members = this.members.slice();
31090       members.splice(index, 1, Object.assign({}, members[index], member));
31091       return this.update({ members });
31092     },
31093     removeMember: function(index) {
31094       var members = this.members.slice();
31095       members.splice(index, 1);
31096       return this.update({ members });
31097     },
31098     removeMembersWithID: function(id2) {
31099       var members = this.members.filter(function(m2) {
31100         return m2.id !== id2;
31101       });
31102       return this.update({ members });
31103     },
31104     moveMember: function(fromIndex, toIndex) {
31105       var members = this.members.slice();
31106       members.splice(toIndex, 0, members.splice(fromIndex, 1)[0]);
31107       return this.update({ members });
31108     },
31109     // Wherever a member appears with id `needle.id`, replace it with a member
31110     // with id `replacement.id`, type `replacement.type`, and the original role,
31111     // By default, adding a duplicate member (by id and role) is prevented.
31112     // Return an updated relation.
31113     replaceMember: function(needle, replacement, keepDuplicates) {
31114       if (!this.memberById(needle.id))
31115         return this;
31116       var members = [];
31117       for (var i3 = 0; i3 < this.members.length; i3++) {
31118         var member = this.members[i3];
31119         if (member.id !== needle.id) {
31120           members.push(member);
31121         } else if (keepDuplicates || !this.memberByIdAndRole(replacement.id, member.role)) {
31122           members.push({ id: replacement.id, type: replacement.type, role: member.role });
31123         }
31124       }
31125       return this.update({ members });
31126     },
31127     asJXON: function(changeset_id) {
31128       var r2 = {
31129         relation: {
31130           "@id": this.osmId(),
31131           "@version": this.version || 0,
31132           member: this.members.map(function(member) {
31133             return {
31134               keyAttributes: {
31135                 type: member.type,
31136                 role: member.role,
31137                 ref: osmEntity.id.toOSM(member.id)
31138               }
31139             };
31140           }, this),
31141           tag: Object.keys(this.tags).map(function(k2) {
31142             return { keyAttributes: { k: k2, v: this.tags[k2] } };
31143           }, this)
31144         }
31145       };
31146       if (changeset_id) {
31147         r2.relation["@changeset"] = changeset_id;
31148       }
31149       return r2;
31150     },
31151     asGeoJSON: function(resolver) {
31152       return resolver.transient(this, "GeoJSON", function() {
31153         if (this.isMultipolygon()) {
31154           return {
31155             type: "MultiPolygon",
31156             coordinates: this.multipolygon(resolver)
31157           };
31158         } else {
31159           return {
31160             type: "FeatureCollection",
31161             properties: this.tags,
31162             features: this.members.map(function(member) {
31163               return Object.assign({ role: member.role }, resolver.entity(member.id).asGeoJSON(resolver));
31164             })
31165           };
31166         }
31167       });
31168     },
31169     area: function(resolver) {
31170       return resolver.transient(this, "area", function() {
31171         return area_default(this.asGeoJSON(resolver));
31172       });
31173     },
31174     isMultipolygon: function() {
31175       return this.tags.type === "multipolygon";
31176     },
31177     isComplete: function(resolver) {
31178       for (var i3 = 0; i3 < this.members.length; i3++) {
31179         if (!resolver.hasEntity(this.members[i3].id)) {
31180           return false;
31181         }
31182       }
31183       return true;
31184     },
31185     hasFromViaTo: function() {
31186       return this.members.some(function(m2) {
31187         return m2.role === "from";
31188       }) && this.members.some(function(m2) {
31189         return m2.role === "via";
31190       }) && this.members.some(function(m2) {
31191         return m2.role === "to";
31192       });
31193     },
31194     isRestriction: function() {
31195       return !!(this.tags.type && this.tags.type.match(/^restriction:?/));
31196     },
31197     isValidRestriction: function() {
31198       if (!this.isRestriction())
31199         return false;
31200       var froms = this.members.filter(function(m2) {
31201         return m2.role === "from";
31202       });
31203       var vias = this.members.filter(function(m2) {
31204         return m2.role === "via";
31205       });
31206       var tos = this.members.filter(function(m2) {
31207         return m2.role === "to";
31208       });
31209       if (froms.length !== 1 && this.tags.restriction !== "no_entry")
31210         return false;
31211       if (froms.some(function(m2) {
31212         return m2.type !== "way";
31213       }))
31214         return false;
31215       if (tos.length !== 1 && this.tags.restriction !== "no_exit")
31216         return false;
31217       if (tos.some(function(m2) {
31218         return m2.type !== "way";
31219       }))
31220         return false;
31221       if (vias.length === 0)
31222         return false;
31223       if (vias.length > 1 && vias.some(function(m2) {
31224         return m2.type !== "way";
31225       }))
31226         return false;
31227       return true;
31228     },
31229     isConnectivity: function() {
31230       return !!(this.tags.type && this.tags.type.match(/^connectivity:?/));
31231     },
31232     // Returns an array [A0, ... An], each Ai being an array of node arrays [Nds0, ... Ndsm],
31233     // where Nds0 is an outer ring and subsequent Ndsi's (if any i > 0) being inner rings.
31234     //
31235     // This corresponds to the structure needed for rendering a multipolygon path using a
31236     // `evenodd` fill rule, as well as the structure of a GeoJSON MultiPolygon geometry.
31237     //
31238     // In the case of invalid geometries, this function will still return a result which
31239     // includes the nodes of all way members, but some Nds may be unclosed and some inner
31240     // rings not matched with the intended outer ring.
31241     //
31242     multipolygon: function(resolver) {
31243       var outers = this.members.filter(function(m2) {
31244         return "outer" === (m2.role || "outer");
31245       });
31246       var inners = this.members.filter(function(m2) {
31247         return "inner" === m2.role;
31248       });
31249       outers = osmJoinWays(outers, resolver);
31250       inners = osmJoinWays(inners, resolver);
31251       var sequenceToLineString = function(sequence) {
31252         if (sequence.nodes.length > 2 && sequence.nodes[0] !== sequence.nodes[sequence.nodes.length - 1]) {
31253           sequence.nodes.push(sequence.nodes[0]);
31254         }
31255         return sequence.nodes.map(function(node) {
31256           return node.loc;
31257         });
31258       };
31259       outers = outers.map(sequenceToLineString);
31260       inners = inners.map(sequenceToLineString);
31261       var result = outers.map(function(o3) {
31262         return [area_default({ type: "Polygon", coordinates: [o3] }) > 2 * Math.PI ? o3.reverse() : o3];
31263       });
31264       function findOuter(inner2) {
31265         var o3, outer;
31266         for (o3 = 0; o3 < outers.length; o3++) {
31267           outer = outers[o3];
31268           if (geoPolygonContainsPolygon(outer, inner2)) {
31269             return o3;
31270           }
31271         }
31272         for (o3 = 0; o3 < outers.length; o3++) {
31273           outer = outers[o3];
31274           if (geoPolygonIntersectsPolygon(outer, inner2, false)) {
31275             return o3;
31276           }
31277         }
31278       }
31279       for (var i3 = 0; i3 < inners.length; i3++) {
31280         var inner = inners[i3];
31281         if (area_default({ type: "Polygon", coordinates: [inner] }) < 2 * Math.PI) {
31282           inner = inner.reverse();
31283         }
31284         var o2 = findOuter(inners[i3]);
31285         if (o2 !== void 0) {
31286           result[o2].push(inners[i3]);
31287         } else {
31288           result.push([inners[i3]]);
31289         }
31290       }
31291       return result;
31292     }
31293   });
31294
31295   // modules/osm/qa_item.js
31296   var QAItem = class _QAItem {
31297     constructor(loc, service, itemType, id2, props) {
31298       this.loc = loc;
31299       this.service = service.title;
31300       this.itemType = itemType;
31301       this.id = id2 ? id2 : `${_QAItem.id()}`;
31302       this.update(props);
31303       if (service && typeof service.getIcon === "function") {
31304         this.icon = service.getIcon(itemType);
31305       }
31306     }
31307     update(props) {
31308       const { loc, service, itemType, id: id2 } = this;
31309       Object.keys(props).forEach((prop) => this[prop] = props[prop]);
31310       this.loc = loc;
31311       this.service = service;
31312       this.itemType = itemType;
31313       this.id = id2;
31314       return this;
31315     }
31316     // Generic handling for newly created QAItems
31317     static id() {
31318       return this.nextId--;
31319     }
31320   };
31321   QAItem.nextId = -1;
31322
31323   // modules/actions/split.js
31324   function actionSplit(nodeIds, newWayIds) {
31325     if (typeof nodeIds === "string")
31326       nodeIds = [nodeIds];
31327     var _wayIDs;
31328     var _keepHistoryOn = "longest";
31329     var _createdWayIDs = [];
31330     function dist(graph, nA, nB) {
31331       var locA = graph.entity(nA).loc;
31332       var locB = graph.entity(nB).loc;
31333       var epsilon3 = 1e-6;
31334       return locA && locB ? geoSphericalDistance(locA, locB) : epsilon3;
31335     }
31336     function splitArea(nodes, idxA, graph) {
31337       var lengths = new Array(nodes.length);
31338       var length;
31339       var i3;
31340       var best = 0;
31341       var idxB;
31342       function wrap2(index) {
31343         return utilWrap(index, nodes.length);
31344       }
31345       length = 0;
31346       for (i3 = wrap2(idxA + 1); i3 !== idxA; i3 = wrap2(i3 + 1)) {
31347         length += dist(graph, nodes[i3], nodes[wrap2(i3 - 1)]);
31348         lengths[i3] = length;
31349       }
31350       length = 0;
31351       for (i3 = wrap2(idxA - 1); i3 !== idxA; i3 = wrap2(i3 - 1)) {
31352         length += dist(graph, nodes[i3], nodes[wrap2(i3 + 1)]);
31353         if (length < lengths[i3]) {
31354           lengths[i3] = length;
31355         }
31356       }
31357       for (i3 = 0; i3 < nodes.length; i3++) {
31358         var cost = lengths[i3] / dist(graph, nodes[idxA], nodes[i3]);
31359         if (cost > best) {
31360           idxB = i3;
31361           best = cost;
31362         }
31363       }
31364       return idxB;
31365     }
31366     function totalLengthBetweenNodes(graph, nodes) {
31367       var totalLength = 0;
31368       for (var i3 = 0; i3 < nodes.length - 1; i3++) {
31369         totalLength += dist(graph, nodes[i3], nodes[i3 + 1]);
31370       }
31371       return totalLength;
31372     }
31373     function split(graph, nodeId, wayA, newWayId) {
31374       var wayB = osmWay({ id: newWayId, tags: wayA.tags });
31375       var origNodes = wayA.nodes.slice();
31376       var nodesA;
31377       var nodesB;
31378       var isArea = wayA.isArea();
31379       var isOuter = osmIsOldMultipolygonOuterMember(wayA, graph);
31380       if (wayA.isClosed()) {
31381         var nodes = wayA.nodes.slice(0, -1);
31382         var idxA = nodes.indexOf(nodeId);
31383         var idxB = splitArea(nodes, idxA, graph);
31384         if (idxB < idxA) {
31385           nodesA = nodes.slice(idxA).concat(nodes.slice(0, idxB + 1));
31386           nodesB = nodes.slice(idxB, idxA + 1);
31387         } else {
31388           nodesA = nodes.slice(idxA, idxB + 1);
31389           nodesB = nodes.slice(idxB).concat(nodes.slice(0, idxA + 1));
31390         }
31391       } else {
31392         var idx = wayA.nodes.indexOf(nodeId, 1);
31393         nodesA = wayA.nodes.slice(0, idx + 1);
31394         nodesB = wayA.nodes.slice(idx);
31395       }
31396       var lengthA = totalLengthBetweenNodes(graph, nodesA);
31397       var lengthB = totalLengthBetweenNodes(graph, nodesB);
31398       if (_keepHistoryOn === "longest" && lengthB > lengthA) {
31399         wayA = wayA.update({ nodes: nodesB });
31400         wayB = wayB.update({ nodes: nodesA });
31401         var temp = lengthA;
31402         lengthA = lengthB;
31403         lengthB = temp;
31404       } else {
31405         wayA = wayA.update({ nodes: nodesA });
31406         wayB = wayB.update({ nodes: nodesB });
31407       }
31408       if (wayA.tags.step_count) {
31409         var stepCount = Number(wayA.tags.step_count);
31410         if (stepCount && // ensure a number
31411         isFinite(stepCount) && // ensure positive
31412         stepCount > 0 && // ensure integer
31413         Math.round(stepCount) === stepCount) {
31414           var tagsA = Object.assign({}, wayA.tags);
31415           var tagsB = Object.assign({}, wayB.tags);
31416           var ratioA = lengthA / (lengthA + lengthB);
31417           var countA = Math.round(stepCount * ratioA);
31418           tagsA.step_count = countA.toString();
31419           tagsB.step_count = (stepCount - countA).toString();
31420           wayA = wayA.update({ tags: tagsA });
31421           wayB = wayB.update({ tags: tagsB });
31422         }
31423       }
31424       graph = graph.replace(wayA);
31425       graph = graph.replace(wayB);
31426       graph.parentRelations(wayA).forEach(function(relation) {
31427         var member;
31428         if (relation.hasFromViaTo()) {
31429           var f3 = relation.memberByRole("from");
31430           var v2 = relation.membersByRole("via");
31431           var t2 = relation.memberByRole("to");
31432           var i3;
31433           if (f3.id === wayA.id || t2.id === wayA.id) {
31434             var keepB = false;
31435             if (v2.length === 1 && v2[0].type === "node") {
31436               keepB = wayB.contains(v2[0].id);
31437             } else {
31438               for (i3 = 0; i3 < v2.length; i3++) {
31439                 if (v2[i3].type === "way") {
31440                   var wayVia = graph.hasEntity(v2[i3].id);
31441                   if (wayVia && utilArrayIntersection(wayB.nodes, wayVia.nodes).length) {
31442                     keepB = true;
31443                     break;
31444                   }
31445                 }
31446               }
31447             }
31448             if (keepB) {
31449               relation = relation.replaceMember(wayA, wayB);
31450               graph = graph.replace(relation);
31451             }
31452           } else {
31453             for (i3 = 0; i3 < v2.length; i3++) {
31454               if (v2[i3].type === "way" && v2[i3].id === wayA.id) {
31455                 member = {
31456                   id: wayB.id,
31457                   type: "way",
31458                   role: "via"
31459                 };
31460                 graph = actionAddMember(relation.id, member, v2[i3].index + 1)(graph);
31461                 break;
31462               }
31463             }
31464           }
31465         } else {
31466           if (relation === isOuter) {
31467             graph = graph.replace(relation.mergeTags(wayA.tags));
31468             graph = graph.replace(wayA.update({ tags: {} }));
31469             graph = graph.replace(wayB.update({ tags: {} }));
31470           }
31471           member = {
31472             id: wayB.id,
31473             type: "way",
31474             role: relation.memberById(wayA.id).role
31475           };
31476           var insertPair = {
31477             originalID: wayA.id,
31478             insertedID: wayB.id,
31479             nodes: origNodes
31480           };
31481           graph = actionAddMember(relation.id, member, void 0, insertPair)(graph);
31482         }
31483       });
31484       if (!isOuter && isArea) {
31485         var multipolygon = osmRelation({
31486           tags: Object.assign({}, wayA.tags, { type: "multipolygon" }),
31487           members: [
31488             { id: wayA.id, role: "outer", type: "way" },
31489             { id: wayB.id, role: "outer", type: "way" }
31490           ]
31491         });
31492         graph = graph.replace(multipolygon);
31493         graph = graph.replace(wayA.update({ tags: {} }));
31494         graph = graph.replace(wayB.update({ tags: {} }));
31495       }
31496       _createdWayIDs.push(wayB.id);
31497       return graph;
31498     }
31499     var action = function(graph) {
31500       _createdWayIDs = [];
31501       var newWayIndex = 0;
31502       for (var i3 = 0; i3 < nodeIds.length; i3++) {
31503         var nodeId = nodeIds[i3];
31504         var candidates = action.waysForNode(nodeId, graph);
31505         for (var j3 = 0; j3 < candidates.length; j3++) {
31506           graph = split(graph, nodeId, candidates[j3], newWayIds && newWayIds[newWayIndex]);
31507           newWayIndex += 1;
31508         }
31509       }
31510       return graph;
31511     };
31512     action.getCreatedWayIDs = function() {
31513       return _createdWayIDs;
31514     };
31515     action.waysForNode = function(nodeId, graph) {
31516       var node = graph.entity(nodeId);
31517       var splittableParents = graph.parentWays(node).filter(isSplittable);
31518       if (!_wayIDs) {
31519         var hasLine = splittableParents.some(function(parent) {
31520           return parent.geometry(graph) === "line";
31521         });
31522         if (hasLine) {
31523           return splittableParents.filter(function(parent) {
31524             return parent.geometry(graph) === "line";
31525           });
31526         }
31527       }
31528       return splittableParents;
31529       function isSplittable(parent) {
31530         if (_wayIDs && _wayIDs.indexOf(parent.id) === -1)
31531           return false;
31532         if (parent.isClosed())
31533           return true;
31534         for (var i3 = 1; i3 < parent.nodes.length - 1; i3++) {
31535           if (parent.nodes[i3] === nodeId)
31536             return true;
31537         }
31538         return false;
31539       }
31540     };
31541     action.ways = function(graph) {
31542       return utilArrayUniq([].concat.apply([], nodeIds.map(function(nodeId) {
31543         return action.waysForNode(nodeId, graph);
31544       })));
31545     };
31546     action.disabled = function(graph) {
31547       for (var i3 = 0; i3 < nodeIds.length; i3++) {
31548         var nodeId = nodeIds[i3];
31549         var candidates = action.waysForNode(nodeId, graph);
31550         if (candidates.length === 0 || _wayIDs && _wayIDs.length !== candidates.length) {
31551           return "not_eligible";
31552         }
31553       }
31554     };
31555     action.limitWays = function(val) {
31556       if (!arguments.length)
31557         return _wayIDs;
31558       _wayIDs = val;
31559       return action;
31560     };
31561     action.keepHistoryOn = function(val) {
31562       if (!arguments.length)
31563         return _keepHistoryOn;
31564       _keepHistoryOn = val;
31565       return action;
31566     };
31567     return action;
31568   }
31569
31570   // modules/core/graph.js
31571   function coreGraph(other, mutable) {
31572     if (!(this instanceof coreGraph))
31573       return new coreGraph(other, mutable);
31574     if (other instanceof coreGraph) {
31575       var base = other.base();
31576       this.entities = Object.assign(Object.create(base.entities), other.entities);
31577       this._parentWays = Object.assign(Object.create(base.parentWays), other._parentWays);
31578       this._parentRels = Object.assign(Object.create(base.parentRels), other._parentRels);
31579     } else {
31580       this.entities = /* @__PURE__ */ Object.create({});
31581       this._parentWays = /* @__PURE__ */ Object.create({});
31582       this._parentRels = /* @__PURE__ */ Object.create({});
31583       this.rebase(other || [], [this]);
31584     }
31585     this.transients = {};
31586     this._childNodes = {};
31587     this.frozen = !mutable;
31588   }
31589   coreGraph.prototype = {
31590     hasEntity: function(id2) {
31591       return this.entities[id2];
31592     },
31593     entity: function(id2) {
31594       var entity = this.entities[id2];
31595       if (!entity) {
31596         entity = this.entities.__proto__[id2];
31597       }
31598       if (!entity) {
31599         throw new Error("entity " + id2 + " not found");
31600       }
31601       return entity;
31602     },
31603     geometry: function(id2) {
31604       return this.entity(id2).geometry(this);
31605     },
31606     transient: function(entity, key, fn) {
31607       var id2 = entity.id;
31608       var transients = this.transients[id2] || (this.transients[id2] = {});
31609       if (transients[key] !== void 0) {
31610         return transients[key];
31611       }
31612       transients[key] = fn.call(entity);
31613       return transients[key];
31614     },
31615     parentWays: function(entity) {
31616       var parents = this._parentWays[entity.id];
31617       var result = [];
31618       if (parents) {
31619         parents.forEach(function(id2) {
31620           result.push(this.entity(id2));
31621         }, this);
31622       }
31623       return result;
31624     },
31625     isPoi: function(entity) {
31626       var parents = this._parentWays[entity.id];
31627       return !parents || parents.size === 0;
31628     },
31629     isShared: function(entity) {
31630       var parents = this._parentWays[entity.id];
31631       return parents && parents.size > 1;
31632     },
31633     parentRelations: function(entity) {
31634       var parents = this._parentRels[entity.id];
31635       var result = [];
31636       if (parents) {
31637         parents.forEach(function(id2) {
31638           result.push(this.entity(id2));
31639         }, this);
31640       }
31641       return result;
31642     },
31643     parentMultipolygons: function(entity) {
31644       return this.parentRelations(entity).filter(function(relation) {
31645         return relation.isMultipolygon();
31646       });
31647     },
31648     childNodes: function(entity) {
31649       if (this._childNodes[entity.id])
31650         return this._childNodes[entity.id];
31651       if (!entity.nodes)
31652         return [];
31653       var nodes = [];
31654       for (var i3 = 0; i3 < entity.nodes.length; i3++) {
31655         nodes[i3] = this.entity(entity.nodes[i3]);
31656       }
31657       if (debug)
31658         Object.freeze(nodes);
31659       this._childNodes[entity.id] = nodes;
31660       return this._childNodes[entity.id];
31661     },
31662     base: function() {
31663       return {
31664         "entities": Object.getPrototypeOf(this.entities),
31665         "parentWays": Object.getPrototypeOf(this._parentWays),
31666         "parentRels": Object.getPrototypeOf(this._parentRels)
31667       };
31668     },
31669     // Unlike other graph methods, rebase mutates in place. This is because it
31670     // is used only during the history operation that merges newly downloaded
31671     // data into each state. To external consumers, it should appear as if the
31672     // graph always contained the newly downloaded data.
31673     rebase: function(entities, stack, force) {
31674       var base = this.base();
31675       var i3, j3, k2, id2;
31676       for (i3 = 0; i3 < entities.length; i3++) {
31677         var entity = entities[i3];
31678         if (!entity.visible || !force && base.entities[entity.id])
31679           continue;
31680         base.entities[entity.id] = entity;
31681         this._updateCalculated(void 0, entity, base.parentWays, base.parentRels);
31682         if (entity.type === "way") {
31683           for (j3 = 0; j3 < entity.nodes.length; j3++) {
31684             id2 = entity.nodes[j3];
31685             for (k2 = 1; k2 < stack.length; k2++) {
31686               var ents = stack[k2].entities;
31687               if (ents.hasOwnProperty(id2) && ents[id2] === void 0) {
31688                 delete ents[id2];
31689               }
31690             }
31691           }
31692         }
31693       }
31694       for (i3 = 0; i3 < stack.length; i3++) {
31695         stack[i3]._updateRebased();
31696       }
31697     },
31698     _updateRebased: function() {
31699       var base = this.base();
31700       Object.keys(this._parentWays).forEach(function(child) {
31701         if (base.parentWays[child]) {
31702           base.parentWays[child].forEach(function(id2) {
31703             if (!this.entities.hasOwnProperty(id2)) {
31704               this._parentWays[child].add(id2);
31705             }
31706           }, this);
31707         }
31708       }, this);
31709       Object.keys(this._parentRels).forEach(function(child) {
31710         if (base.parentRels[child]) {
31711           base.parentRels[child].forEach(function(id2) {
31712             if (!this.entities.hasOwnProperty(id2)) {
31713               this._parentRels[child].add(id2);
31714             }
31715           }, this);
31716         }
31717       }, this);
31718       this.transients = {};
31719     },
31720     // Updates calculated properties (parentWays, parentRels) for the specified change
31721     _updateCalculated: function(oldentity, entity, parentWays, parentRels) {
31722       parentWays = parentWays || this._parentWays;
31723       parentRels = parentRels || this._parentRels;
31724       var type2 = entity && entity.type || oldentity && oldentity.type;
31725       var removed, added, i3;
31726       if (type2 === "way") {
31727         if (oldentity && entity) {
31728           removed = utilArrayDifference(oldentity.nodes, entity.nodes);
31729           added = utilArrayDifference(entity.nodes, oldentity.nodes);
31730         } else if (oldentity) {
31731           removed = oldentity.nodes;
31732           added = [];
31733         } else if (entity) {
31734           removed = [];
31735           added = entity.nodes;
31736         }
31737         for (i3 = 0; i3 < removed.length; i3++) {
31738           parentWays[removed[i3]] = new Set(parentWays[removed[i3]]);
31739           parentWays[removed[i3]].delete(oldentity.id);
31740         }
31741         for (i3 = 0; i3 < added.length; i3++) {
31742           parentWays[added[i3]] = new Set(parentWays[added[i3]]);
31743           parentWays[added[i3]].add(entity.id);
31744         }
31745       } else if (type2 === "relation") {
31746         var oldentityMemberIDs = oldentity ? oldentity.members.map(function(m2) {
31747           return m2.id;
31748         }) : [];
31749         var entityMemberIDs = entity ? entity.members.map(function(m2) {
31750           return m2.id;
31751         }) : [];
31752         if (oldentity && entity) {
31753           removed = utilArrayDifference(oldentityMemberIDs, entityMemberIDs);
31754           added = utilArrayDifference(entityMemberIDs, oldentityMemberIDs);
31755         } else if (oldentity) {
31756           removed = oldentityMemberIDs;
31757           added = [];
31758         } else if (entity) {
31759           removed = [];
31760           added = entityMemberIDs;
31761         }
31762         for (i3 = 0; i3 < removed.length; i3++) {
31763           parentRels[removed[i3]] = new Set(parentRels[removed[i3]]);
31764           parentRels[removed[i3]].delete(oldentity.id);
31765         }
31766         for (i3 = 0; i3 < added.length; i3++) {
31767           parentRels[added[i3]] = new Set(parentRels[added[i3]]);
31768           parentRels[added[i3]].add(entity.id);
31769         }
31770       }
31771     },
31772     replace: function(entity) {
31773       if (this.entities[entity.id] === entity)
31774         return this;
31775       return this.update(function() {
31776         this._updateCalculated(this.entities[entity.id], entity);
31777         this.entities[entity.id] = entity;
31778       });
31779     },
31780     remove: function(entity) {
31781       return this.update(function() {
31782         this._updateCalculated(entity, void 0);
31783         this.entities[entity.id] = void 0;
31784       });
31785     },
31786     revert: function(id2) {
31787       var baseEntity = this.base().entities[id2];
31788       var headEntity = this.entities[id2];
31789       if (headEntity === baseEntity)
31790         return this;
31791       return this.update(function() {
31792         this._updateCalculated(headEntity, baseEntity);
31793         delete this.entities[id2];
31794       });
31795     },
31796     update: function() {
31797       var graph = this.frozen ? coreGraph(this, true) : this;
31798       for (var i3 = 0; i3 < arguments.length; i3++) {
31799         arguments[i3].call(graph, graph);
31800       }
31801       if (this.frozen)
31802         graph.frozen = true;
31803       return graph;
31804     },
31805     // Obliterates any existing entities
31806     load: function(entities) {
31807       var base = this.base();
31808       this.entities = Object.create(base.entities);
31809       for (var i3 in entities) {
31810         this.entities[i3] = entities[i3];
31811         this._updateCalculated(base.entities[i3], this.entities[i3]);
31812       }
31813       return this;
31814     }
31815   };
31816
31817   // modules/osm/intersection.js
31818   function osmTurn(turn) {
31819     if (!(this instanceof osmTurn)) {
31820       return new osmTurn(turn);
31821     }
31822     Object.assign(this, turn);
31823   }
31824   function osmIntersection(graph, startVertexId, maxDistance) {
31825     maxDistance = maxDistance || 30;
31826     var vgraph = coreGraph();
31827     var i3, j3, k2;
31828     function memberOfRestriction(entity) {
31829       return graph.parentRelations(entity).some(function(r2) {
31830         return r2.isRestriction();
31831       });
31832     }
31833     function isRoad(way2) {
31834       if (way2.isArea() || way2.isDegenerate())
31835         return false;
31836       var roads = {
31837         "motorway": true,
31838         "motorway_link": true,
31839         "trunk": true,
31840         "trunk_link": true,
31841         "primary": true,
31842         "primary_link": true,
31843         "secondary": true,
31844         "secondary_link": true,
31845         "tertiary": true,
31846         "tertiary_link": true,
31847         "residential": true,
31848         "unclassified": true,
31849         "living_street": true,
31850         "service": true,
31851         "road": true,
31852         "track": true
31853       };
31854       return roads[way2.tags.highway];
31855     }
31856     var startNode = graph.entity(startVertexId);
31857     var checkVertices = [startNode];
31858     var checkWays;
31859     var vertices = [];
31860     var vertexIds = [];
31861     var vertex;
31862     var ways = [];
31863     var wayIds = [];
31864     var way;
31865     var nodes = [];
31866     var node;
31867     var parents = [];
31868     var parent;
31869     var actions = [];
31870     while (checkVertices.length) {
31871       vertex = checkVertices.pop();
31872       checkWays = graph.parentWays(vertex);
31873       var hasWays = false;
31874       for (i3 = 0; i3 < checkWays.length; i3++) {
31875         way = checkWays[i3];
31876         if (!isRoad(way) && !memberOfRestriction(way))
31877           continue;
31878         ways.push(way);
31879         hasWays = true;
31880         nodes = utilArrayUniq(graph.childNodes(way));
31881         for (j3 = 0; j3 < nodes.length; j3++) {
31882           node = nodes[j3];
31883           if (node === vertex)
31884             continue;
31885           if (vertices.indexOf(node) !== -1)
31886             continue;
31887           if (geoSphericalDistance(node.loc, startNode.loc) > maxDistance)
31888             continue;
31889           var hasParents = false;
31890           parents = graph.parentWays(node);
31891           for (k2 = 0; k2 < parents.length; k2++) {
31892             parent = parents[k2];
31893             if (parent === way)
31894               continue;
31895             if (ways.indexOf(parent) !== -1)
31896               continue;
31897             if (!isRoad(parent))
31898               continue;
31899             hasParents = true;
31900             break;
31901           }
31902           if (hasParents) {
31903             checkVertices.push(node);
31904           }
31905         }
31906       }
31907       if (hasWays) {
31908         vertices.push(vertex);
31909       }
31910     }
31911     vertices = utilArrayUniq(vertices);
31912     ways = utilArrayUniq(ways);
31913     ways.forEach(function(way2) {
31914       graph.childNodes(way2).forEach(function(node2) {
31915         vgraph = vgraph.replace(node2);
31916       });
31917       vgraph = vgraph.replace(way2);
31918       graph.parentRelations(way2).forEach(function(relation) {
31919         if (relation.isRestriction()) {
31920           if (relation.isValidRestriction(graph)) {
31921             vgraph = vgraph.replace(relation);
31922           } else if (relation.isComplete(graph)) {
31923             actions.push(actionDeleteRelation(relation.id));
31924           }
31925         }
31926       });
31927     });
31928     ways.forEach(function(w2) {
31929       var way2 = vgraph.entity(w2.id);
31930       if (way2.tags.oneway === "-1") {
31931         var action = actionReverse(way2.id, { reverseOneway: true });
31932         actions.push(action);
31933         vgraph = action(vgraph);
31934       }
31935     });
31936     var origCount = osmEntity.id.next.way;
31937     vertices.forEach(function(v2) {
31938       var splitAll = actionSplit([v2.id]).keepHistoryOn("first");
31939       if (!splitAll.disabled(vgraph)) {
31940         splitAll.ways(vgraph).forEach(function(way2) {
31941           var splitOne = actionSplit([v2.id]).limitWays([way2.id]).keepHistoryOn("first");
31942           actions.push(splitOne);
31943           vgraph = splitOne(vgraph);
31944         });
31945       }
31946     });
31947     osmEntity.id.next.way = origCount;
31948     vertexIds = vertices.map(function(v2) {
31949       return v2.id;
31950     });
31951     vertices = [];
31952     ways = [];
31953     vertexIds.forEach(function(id2) {
31954       var vertex2 = vgraph.entity(id2);
31955       var parents2 = vgraph.parentWays(vertex2);
31956       vertices.push(vertex2);
31957       ways = ways.concat(parents2);
31958     });
31959     vertices = utilArrayUniq(vertices);
31960     ways = utilArrayUniq(ways);
31961     vertexIds = vertices.map(function(v2) {
31962       return v2.id;
31963     });
31964     wayIds = ways.map(function(w2) {
31965       return w2.id;
31966     });
31967     function withMetadata(way2, vertexIds2) {
31968       var __oneWay = way2.isOneWay();
31969       var __first = vertexIds2.indexOf(way2.first()) !== -1;
31970       var __last = vertexIds2.indexOf(way2.last()) !== -1;
31971       var __via = __first && __last;
31972       var __from = __first && !__oneWay || __last;
31973       var __to = __first || __last && !__oneWay;
31974       return way2.update({
31975         __first,
31976         __last,
31977         __from,
31978         __via,
31979         __to,
31980         __oneWay
31981       });
31982     }
31983     ways = [];
31984     wayIds.forEach(function(id2) {
31985       var way2 = withMetadata(vgraph.entity(id2), vertexIds);
31986       vgraph = vgraph.replace(way2);
31987       ways.push(way2);
31988     });
31989     var keepGoing;
31990     var removeWayIds = [];
31991     var removeVertexIds = [];
31992     do {
31993       keepGoing = false;
31994       checkVertices = vertexIds.slice();
31995       for (i3 = 0; i3 < checkVertices.length; i3++) {
31996         var vertexId = checkVertices[i3];
31997         vertex = vgraph.hasEntity(vertexId);
31998         if (!vertex) {
31999           if (vertexIds.indexOf(vertexId) !== -1) {
32000             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
32001           }
32002           removeVertexIds.push(vertexId);
32003           continue;
32004         }
32005         parents = vgraph.parentWays(vertex);
32006         if (parents.length < 3) {
32007           if (vertexIds.indexOf(vertexId) !== -1) {
32008             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
32009           }
32010         }
32011         if (parents.length === 2) {
32012           var a2 = parents[0];
32013           var b2 = parents[1];
32014           var aIsLeaf = a2 && !a2.__via;
32015           var bIsLeaf = b2 && !b2.__via;
32016           var leaf, survivor;
32017           if (aIsLeaf && !bIsLeaf) {
32018             leaf = a2;
32019             survivor = b2;
32020           } else if (!aIsLeaf && bIsLeaf) {
32021             leaf = b2;
32022             survivor = a2;
32023           }
32024           if (leaf && survivor) {
32025             survivor = withMetadata(survivor, vertexIds);
32026             vgraph = vgraph.replace(survivor).remove(leaf);
32027             removeWayIds.push(leaf.id);
32028             keepGoing = true;
32029           }
32030         }
32031         parents = vgraph.parentWays(vertex);
32032         if (parents.length < 2) {
32033           if (vertexIds.indexOf(vertexId) !== -1) {
32034             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
32035           }
32036           removeVertexIds.push(vertexId);
32037           keepGoing = true;
32038         }
32039         if (parents.length < 1) {
32040           vgraph = vgraph.remove(vertex);
32041         }
32042       }
32043     } while (keepGoing);
32044     vertices = vertices.filter(function(vertex2) {
32045       return removeVertexIds.indexOf(vertex2.id) === -1;
32046     }).map(function(vertex2) {
32047       return vgraph.entity(vertex2.id);
32048     });
32049     ways = ways.filter(function(way2) {
32050       return removeWayIds.indexOf(way2.id) === -1;
32051     }).map(function(way2) {
32052       return vgraph.entity(way2.id);
32053     });
32054     var intersection = {
32055       graph: vgraph,
32056       actions,
32057       vertices,
32058       ways
32059     };
32060     intersection.turns = function(fromWayId, maxViaWay) {
32061       if (!fromWayId)
32062         return [];
32063       if (!maxViaWay)
32064         maxViaWay = 0;
32065       var vgraph2 = intersection.graph;
32066       var keyVertexIds = intersection.vertices.map(function(v2) {
32067         return v2.id;
32068       });
32069       var start2 = vgraph2.entity(fromWayId);
32070       if (!start2 || !(start2.__from || start2.__via))
32071         return [];
32072       var maxPathLength = maxViaWay * 2 + 3;
32073       var turns = [];
32074       step(start2);
32075       return turns;
32076       function step(entity, currPath, currRestrictions, matchedRestriction) {
32077         currPath = (currPath || []).slice();
32078         if (currPath.length >= maxPathLength)
32079           return;
32080         currPath.push(entity.id);
32081         currRestrictions = (currRestrictions || []).slice();
32082         if (entity.type === "node") {
32083           stepNode(entity, currPath, currRestrictions);
32084         } else {
32085           stepWay(entity, currPath, currRestrictions, matchedRestriction);
32086         }
32087       }
32088       function stepNode(entity, currPath, currRestrictions) {
32089         var i4, j4;
32090         var parents2 = vgraph2.parentWays(entity);
32091         var nextWays = [];
32092         for (i4 = 0; i4 < parents2.length; i4++) {
32093           var way2 = parents2[i4];
32094           if (way2.__oneWay && way2.nodes[0] !== entity.id)
32095             continue;
32096           if (currPath.indexOf(way2.id) !== -1 && currPath.length >= 3)
32097             continue;
32098           var restrict = null;
32099           for (j4 = 0; j4 < currRestrictions.length; j4++) {
32100             var restriction = currRestrictions[j4];
32101             var f3 = restriction.memberByRole("from");
32102             var v2 = restriction.membersByRole("via");
32103             var t2 = restriction.memberByRole("to");
32104             var isNo = /^no_/.test(restriction.tags.restriction);
32105             var isOnly = /^only_/.test(restriction.tags.restriction);
32106             if (!(isNo || isOnly)) {
32107               continue;
32108             }
32109             var matchesFrom = f3.id === fromWayId;
32110             var matchesViaTo = false;
32111             var isAlongOnlyPath = false;
32112             if (t2.id === way2.id) {
32113               if (v2.length === 1 && v2[0].type === "node") {
32114                 matchesViaTo = v2[0].id === entity.id && (matchesFrom && currPath.length === 2 || !matchesFrom && currPath.length > 2);
32115               } else {
32116                 var pathVias = [];
32117                 for (k2 = 2; k2 < currPath.length; k2 += 2) {
32118                   pathVias.push(currPath[k2]);
32119                 }
32120                 var restrictionVias = [];
32121                 for (k2 = 0; k2 < v2.length; k2++) {
32122                   if (v2[k2].type === "way") {
32123                     restrictionVias.push(v2[k2].id);
32124                   }
32125                 }
32126                 var diff = utilArrayDifference(pathVias, restrictionVias);
32127                 matchesViaTo = !diff.length;
32128               }
32129             } else if (isOnly) {
32130               for (k2 = 0; k2 < v2.length; k2++) {
32131                 if (v2[k2].type === "way" && v2[k2].id === way2.id) {
32132                   isAlongOnlyPath = true;
32133                   break;
32134                 }
32135               }
32136             }
32137             if (matchesViaTo) {
32138               if (isOnly) {
32139                 restrict = { id: restriction.id, direct: matchesFrom, from: f3.id, only: true, end: true };
32140               } else {
32141                 restrict = { id: restriction.id, direct: matchesFrom, from: f3.id, no: true, end: true };
32142               }
32143             } else {
32144               if (isAlongOnlyPath) {
32145                 restrict = { id: restriction.id, direct: false, from: f3.id, only: true, end: false };
32146               } else if (isOnly) {
32147                 restrict = { id: restriction.id, direct: false, from: f3.id, no: true, end: true };
32148               }
32149             }
32150             if (restrict && restrict.direct)
32151               break;
32152           }
32153           nextWays.push({ way: way2, restrict });
32154         }
32155         nextWays.forEach(function(nextWay) {
32156           step(nextWay.way, currPath, currRestrictions, nextWay.restrict);
32157         });
32158       }
32159       function stepWay(entity, currPath, currRestrictions, matchedRestriction) {
32160         var i4;
32161         if (currPath.length >= 3) {
32162           var turnPath = currPath.slice();
32163           if (matchedRestriction && matchedRestriction.direct === false) {
32164             for (i4 = 0; i4 < turnPath.length; i4++) {
32165               if (turnPath[i4] === matchedRestriction.from) {
32166                 turnPath = turnPath.slice(i4);
32167                 break;
32168               }
32169             }
32170           }
32171           var turn = pathToTurn(turnPath);
32172           if (turn) {
32173             if (matchedRestriction) {
32174               turn.restrictionID = matchedRestriction.id;
32175               turn.no = matchedRestriction.no;
32176               turn.only = matchedRestriction.only;
32177               turn.direct = matchedRestriction.direct;
32178             }
32179             turns.push(osmTurn(turn));
32180           }
32181           if (currPath[0] === currPath[2])
32182             return;
32183         }
32184         if (matchedRestriction && matchedRestriction.end)
32185           return;
32186         var n1 = vgraph2.entity(entity.first());
32187         var n22 = vgraph2.entity(entity.last());
32188         var dist = geoSphericalDistance(n1.loc, n22.loc);
32189         var nextNodes = [];
32190         if (currPath.length > 1) {
32191           if (dist > maxDistance)
32192             return;
32193           if (!entity.__via)
32194             return;
32195         }
32196         if (!entity.__oneWay && // bidirectional..
32197         keyVertexIds.indexOf(n1.id) !== -1 && // key vertex..
32198         currPath.indexOf(n1.id) === -1) {
32199           nextNodes.push(n1);
32200         }
32201         if (keyVertexIds.indexOf(n22.id) !== -1 && // key vertex..
32202         currPath.indexOf(n22.id) === -1) {
32203           nextNodes.push(n22);
32204         }
32205         nextNodes.forEach(function(nextNode) {
32206           var fromRestrictions = vgraph2.parentRelations(entity).filter(function(r2) {
32207             if (!r2.isRestriction())
32208               return false;
32209             var f3 = r2.memberByRole("from");
32210             if (!f3 || f3.id !== entity.id)
32211               return false;
32212             var isOnly = /^only_/.test(r2.tags.restriction);
32213             if (!isOnly)
32214               return true;
32215             var isOnlyVia = false;
32216             var v2 = r2.membersByRole("via");
32217             if (v2.length === 1 && v2[0].type === "node") {
32218               isOnlyVia = v2[0].id === nextNode.id;
32219             } else {
32220               for (var i5 = 0; i5 < v2.length; i5++) {
32221                 if (v2[i5].type !== "way")
32222                   continue;
32223                 var viaWay = vgraph2.entity(v2[i5].id);
32224                 if (viaWay.first() === nextNode.id || viaWay.last() === nextNode.id) {
32225                   isOnlyVia = true;
32226                   break;
32227                 }
32228               }
32229             }
32230             return isOnlyVia;
32231           });
32232           step(nextNode, currPath, currRestrictions.concat(fromRestrictions), false);
32233         });
32234       }
32235       function pathToTurn(path) {
32236         if (path.length < 3)
32237           return;
32238         var fromWayId2, fromNodeId, fromVertexId;
32239         var toWayId, toNodeId, toVertexId;
32240         var viaWayIds, viaNodeId, isUturn;
32241         fromWayId2 = path[0];
32242         toWayId = path[path.length - 1];
32243         if (path.length === 3 && fromWayId2 === toWayId) {
32244           var way2 = vgraph2.entity(fromWayId2);
32245           if (way2.__oneWay)
32246             return null;
32247           isUturn = true;
32248           viaNodeId = fromVertexId = toVertexId = path[1];
32249           fromNodeId = toNodeId = adjacentNode(fromWayId2, viaNodeId);
32250         } else {
32251           isUturn = false;
32252           fromVertexId = path[1];
32253           fromNodeId = adjacentNode(fromWayId2, fromVertexId);
32254           toVertexId = path[path.length - 2];
32255           toNodeId = adjacentNode(toWayId, toVertexId);
32256           if (path.length === 3) {
32257             viaNodeId = path[1];
32258           } else {
32259             viaWayIds = path.filter(function(entityId) {
32260               return entityId[0] === "w";
32261             });
32262             viaWayIds = viaWayIds.slice(1, viaWayIds.length - 1);
32263           }
32264         }
32265         return {
32266           key: path.join("_"),
32267           path,
32268           from: { node: fromNodeId, way: fromWayId2, vertex: fromVertexId },
32269           via: { node: viaNodeId, ways: viaWayIds },
32270           to: { node: toNodeId, way: toWayId, vertex: toVertexId },
32271           u: isUturn
32272         };
32273         function adjacentNode(wayId, affixId) {
32274           var nodes2 = vgraph2.entity(wayId).nodes;
32275           return affixId === nodes2[0] ? nodes2[1] : nodes2[nodes2.length - 2];
32276         }
32277       }
32278     };
32279     return intersection;
32280   }
32281   function osmInferRestriction(graph, turn, projection2) {
32282     var fromWay = graph.entity(turn.from.way);
32283     var fromNode = graph.entity(turn.from.node);
32284     var fromVertex = graph.entity(turn.from.vertex);
32285     var toWay = graph.entity(turn.to.way);
32286     var toNode = graph.entity(turn.to.node);
32287     var toVertex = graph.entity(turn.to.vertex);
32288     var fromOneWay = fromWay.tags.oneway === "yes";
32289     var toOneWay = toWay.tags.oneway === "yes";
32290     var angle2 = (geoAngle(fromVertex, fromNode, projection2) - geoAngle(toVertex, toNode, projection2)) * 180 / Math.PI;
32291     while (angle2 < 0) {
32292       angle2 += 360;
32293     }
32294     if (fromNode === toNode) {
32295       return "no_u_turn";
32296     }
32297     if ((angle2 < 23 || angle2 > 336) && fromOneWay && toOneWay) {
32298       return "no_u_turn";
32299     }
32300     if ((angle2 < 40 || angle2 > 319) && fromOneWay && toOneWay && turn.from.vertex !== turn.to.vertex) {
32301       return "no_u_turn";
32302     }
32303     if (angle2 < 158) {
32304       return "no_right_turn";
32305     }
32306     if (angle2 > 202) {
32307       return "no_left_turn";
32308     }
32309     return "no_straight_on";
32310   }
32311
32312   // modules/actions/merge_polygon.js
32313   function actionMergePolygon(ids, newRelationId) {
32314     function groupEntities(graph) {
32315       var entities = ids.map(function(id2) {
32316         return graph.entity(id2);
32317       });
32318       var geometryGroups = utilArrayGroupBy(entities, function(entity) {
32319         if (entity.type === "way" && entity.isClosed()) {
32320           return "closedWay";
32321         } else if (entity.type === "relation" && entity.isMultipolygon()) {
32322           return "multipolygon";
32323         } else {
32324           return "other";
32325         }
32326       });
32327       return Object.assign(
32328         { closedWay: [], multipolygon: [], other: [] },
32329         geometryGroups
32330       );
32331     }
32332     var action = function(graph) {
32333       var entities = groupEntities(graph);
32334       var polygons = entities.multipolygon.reduce(function(polygons2, m2) {
32335         return polygons2.concat(osmJoinWays(m2.members, graph));
32336       }, []).concat(entities.closedWay.map(function(d2) {
32337         var member = [{ id: d2.id }];
32338         member.nodes = graph.childNodes(d2);
32339         return member;
32340       }));
32341       var contained = polygons.map(function(w2, i3) {
32342         return polygons.map(function(d2, n3) {
32343           if (i3 === n3)
32344             return null;
32345           return geoPolygonContainsPolygon(
32346             d2.nodes.map(function(n4) {
32347               return n4.loc;
32348             }),
32349             w2.nodes.map(function(n4) {
32350               return n4.loc;
32351             })
32352           );
32353         });
32354       });
32355       var members = [];
32356       var outer = true;
32357       while (polygons.length) {
32358         extractUncontained(polygons);
32359         polygons = polygons.filter(isContained);
32360         contained = contained.filter(isContained).map(filterContained);
32361       }
32362       function isContained(d2, i3) {
32363         return contained[i3].some(function(val) {
32364           return val;
32365         });
32366       }
32367       function filterContained(d2) {
32368         return d2.filter(isContained);
32369       }
32370       function extractUncontained(polygons2) {
32371         polygons2.forEach(function(d2, i3) {
32372           if (!isContained(d2, i3)) {
32373             d2.forEach(function(member) {
32374               members.push({
32375                 type: "way",
32376                 id: member.id,
32377                 role: outer ? "outer" : "inner"
32378               });
32379             });
32380           }
32381         });
32382         outer = !outer;
32383       }
32384       var relation;
32385       if (entities.multipolygon.length > 0) {
32386         var oldestID = utilOldestID(entities.multipolygon.map((entity) => entity.id));
32387         relation = entities.multipolygon.find((entity) => entity.id === oldestID);
32388       } else {
32389         relation = osmRelation({ id: newRelationId, tags: { type: "multipolygon" } });
32390       }
32391       entities.multipolygon.forEach(function(m2) {
32392         if (m2.id !== relation.id) {
32393           relation = relation.mergeTags(m2.tags);
32394           graph = graph.remove(m2);
32395         }
32396       });
32397       entities.closedWay.forEach(function(way) {
32398         function isThisOuter(m2) {
32399           return m2.id === way.id && m2.role !== "inner";
32400         }
32401         if (members.some(isThisOuter)) {
32402           relation = relation.mergeTags(way.tags);
32403           graph = graph.replace(way.update({ tags: {} }));
32404         }
32405       });
32406       return graph.replace(relation.update({
32407         members,
32408         tags: utilObjectOmit(relation.tags, ["area"])
32409       }));
32410     };
32411     action.disabled = function(graph) {
32412       var entities = groupEntities(graph);
32413       if (entities.other.length > 0 || entities.closedWay.length + entities.multipolygon.length < 2) {
32414         return "not_eligible";
32415       }
32416       if (!entities.multipolygon.every(function(r2) {
32417         return r2.isComplete(graph);
32418       })) {
32419         return "incomplete_relation";
32420       }
32421       if (!entities.multipolygon.length) {
32422         var sharedMultipolygons = [];
32423         entities.closedWay.forEach(function(way, i3) {
32424           if (i3 === 0) {
32425             sharedMultipolygons = graph.parentMultipolygons(way);
32426           } else {
32427             sharedMultipolygons = utilArrayIntersection(sharedMultipolygons, graph.parentMultipolygons(way));
32428           }
32429         });
32430         sharedMultipolygons = sharedMultipolygons.filter(function(relation) {
32431           return relation.members.length === entities.closedWay.length;
32432         });
32433         if (sharedMultipolygons.length) {
32434           return "not_eligible";
32435         }
32436       } else if (entities.closedWay.some(function(way) {
32437         return utilArrayIntersection(graph.parentMultipolygons(way), entities.multipolygon).length;
32438       })) {
32439         return "not_eligible";
32440       }
32441     };
32442     return action;
32443   }
32444
32445   // modules/actions/merge_remote_changes.js
32446   var import_fast_deep_equal = __toESM(require_fast_deep_equal());
32447
32448   // node_modules/node-diff3/index.mjs
32449   function LCS(buffer1, buffer2) {
32450     let equivalenceClasses = {};
32451     for (let j3 = 0; j3 < buffer2.length; j3++) {
32452       const item = buffer2[j3];
32453       if (equivalenceClasses[item]) {
32454         equivalenceClasses[item].push(j3);
32455       } else {
32456         equivalenceClasses[item] = [j3];
32457       }
32458     }
32459     const NULLRESULT = { buffer1index: -1, buffer2index: -1, chain: null };
32460     let candidates = [NULLRESULT];
32461     for (let i3 = 0; i3 < buffer1.length; i3++) {
32462       const item = buffer1[i3];
32463       const buffer2indices = equivalenceClasses[item] || [];
32464       let r2 = 0;
32465       let c2 = candidates[0];
32466       for (let jx = 0; jx < buffer2indices.length; jx++) {
32467         const j3 = buffer2indices[jx];
32468         let s2;
32469         for (s2 = r2; s2 < candidates.length; s2++) {
32470           if (candidates[s2].buffer2index < j3 && (s2 === candidates.length - 1 || candidates[s2 + 1].buffer2index > j3)) {
32471             break;
32472           }
32473         }
32474         if (s2 < candidates.length) {
32475           const newCandidate = { buffer1index: i3, buffer2index: j3, chain: candidates[s2] };
32476           if (r2 === candidates.length) {
32477             candidates.push(c2);
32478           } else {
32479             candidates[r2] = c2;
32480           }
32481           r2 = s2 + 1;
32482           c2 = newCandidate;
32483           if (r2 === candidates.length) {
32484             break;
32485           }
32486         }
32487       }
32488       candidates[r2] = c2;
32489     }
32490     return candidates[candidates.length - 1];
32491   }
32492   function diffIndices(buffer1, buffer2) {
32493     const lcs = LCS(buffer1, buffer2);
32494     let result = [];
32495     let tail1 = buffer1.length;
32496     let tail2 = buffer2.length;
32497     for (let candidate = lcs; candidate !== null; candidate = candidate.chain) {
32498       const mismatchLength1 = tail1 - candidate.buffer1index - 1;
32499       const mismatchLength2 = tail2 - candidate.buffer2index - 1;
32500       tail1 = candidate.buffer1index;
32501       tail2 = candidate.buffer2index;
32502       if (mismatchLength1 || mismatchLength2) {
32503         result.push({
32504           buffer1: [tail1 + 1, mismatchLength1],
32505           buffer1Content: buffer1.slice(tail1 + 1, tail1 + 1 + mismatchLength1),
32506           buffer2: [tail2 + 1, mismatchLength2],
32507           buffer2Content: buffer2.slice(tail2 + 1, tail2 + 1 + mismatchLength2)
32508         });
32509       }
32510     }
32511     result.reverse();
32512     return result;
32513   }
32514   function diff3MergeRegions(a2, o2, b2) {
32515     let hunks = [];
32516     function addHunk(h2, ab) {
32517       hunks.push({
32518         ab,
32519         oStart: h2.buffer1[0],
32520         oLength: h2.buffer1[1],
32521         // length of o to remove
32522         abStart: h2.buffer2[0],
32523         abLength: h2.buffer2[1]
32524         // length of a/b to insert
32525         // abContent: (ab === 'a' ? a : b).slice(h.buffer2[0], h.buffer2[0] + h.buffer2[1])
32526       });
32527     }
32528     diffIndices(o2, a2).forEach((item) => addHunk(item, "a"));
32529     diffIndices(o2, b2).forEach((item) => addHunk(item, "b"));
32530     hunks.sort((x2, y2) => x2.oStart - y2.oStart);
32531     let results = [];
32532     let currOffset = 0;
32533     function advanceTo(endOffset) {
32534       if (endOffset > currOffset) {
32535         results.push({
32536           stable: true,
32537           buffer: "o",
32538           bufferStart: currOffset,
32539           bufferLength: endOffset - currOffset,
32540           bufferContent: o2.slice(currOffset, endOffset)
32541         });
32542         currOffset = endOffset;
32543       }
32544     }
32545     while (hunks.length) {
32546       let hunk = hunks.shift();
32547       let regionStart = hunk.oStart;
32548       let regionEnd = hunk.oStart + hunk.oLength;
32549       let regionHunks = [hunk];
32550       advanceTo(regionStart);
32551       while (hunks.length) {
32552         const nextHunk = hunks[0];
32553         const nextHunkStart = nextHunk.oStart;
32554         if (nextHunkStart > regionEnd)
32555           break;
32556         regionEnd = Math.max(regionEnd, nextHunkStart + nextHunk.oLength);
32557         regionHunks.push(hunks.shift());
32558       }
32559       if (regionHunks.length === 1) {
32560         if (hunk.abLength > 0) {
32561           const buffer = hunk.ab === "a" ? a2 : b2;
32562           results.push({
32563             stable: true,
32564             buffer: hunk.ab,
32565             bufferStart: hunk.abStart,
32566             bufferLength: hunk.abLength,
32567             bufferContent: buffer.slice(hunk.abStart, hunk.abStart + hunk.abLength)
32568           });
32569         }
32570       } else {
32571         let bounds = {
32572           a: [a2.length, -1, o2.length, -1],
32573           b: [b2.length, -1, o2.length, -1]
32574         };
32575         while (regionHunks.length) {
32576           hunk = regionHunks.shift();
32577           const oStart = hunk.oStart;
32578           const oEnd = oStart + hunk.oLength;
32579           const abStart = hunk.abStart;
32580           const abEnd = abStart + hunk.abLength;
32581           let b3 = bounds[hunk.ab];
32582           b3[0] = Math.min(abStart, b3[0]);
32583           b3[1] = Math.max(abEnd, b3[1]);
32584           b3[2] = Math.min(oStart, b3[2]);
32585           b3[3] = Math.max(oEnd, b3[3]);
32586         }
32587         const aStart = bounds.a[0] + (regionStart - bounds.a[2]);
32588         const aEnd = bounds.a[1] + (regionEnd - bounds.a[3]);
32589         const bStart = bounds.b[0] + (regionStart - bounds.b[2]);
32590         const bEnd = bounds.b[1] + (regionEnd - bounds.b[3]);
32591         let result = {
32592           stable: false,
32593           aStart,
32594           aLength: aEnd - aStart,
32595           aContent: a2.slice(aStart, aEnd),
32596           oStart: regionStart,
32597           oLength: regionEnd - regionStart,
32598           oContent: o2.slice(regionStart, regionEnd),
32599           bStart,
32600           bLength: bEnd - bStart,
32601           bContent: b2.slice(bStart, bEnd)
32602         };
32603         results.push(result);
32604       }
32605       currOffset = regionEnd;
32606     }
32607     advanceTo(o2.length);
32608     return results;
32609   }
32610   function diff3Merge(a2, o2, b2, options2) {
32611     let defaults = {
32612       excludeFalseConflicts: true,
32613       stringSeparator: /\s+/
32614     };
32615     options2 = Object.assign(defaults, options2);
32616     if (typeof a2 === "string")
32617       a2 = a2.split(options2.stringSeparator);
32618     if (typeof o2 === "string")
32619       o2 = o2.split(options2.stringSeparator);
32620     if (typeof b2 === "string")
32621       b2 = b2.split(options2.stringSeparator);
32622     let results = [];
32623     const regions = diff3MergeRegions(a2, o2, b2);
32624     let okBuffer = [];
32625     function flushOk() {
32626       if (okBuffer.length) {
32627         results.push({ ok: okBuffer });
32628       }
32629       okBuffer = [];
32630     }
32631     function isFalseConflict(a3, b3) {
32632       if (a3.length !== b3.length)
32633         return false;
32634       for (let i3 = 0; i3 < a3.length; i3++) {
32635         if (a3[i3] !== b3[i3])
32636           return false;
32637       }
32638       return true;
32639     }
32640     regions.forEach((region) => {
32641       if (region.stable) {
32642         okBuffer.push(...region.bufferContent);
32643       } else {
32644         if (options2.excludeFalseConflicts && isFalseConflict(region.aContent, region.bContent)) {
32645           okBuffer.push(...region.aContent);
32646         } else {
32647           flushOk();
32648           results.push({
32649             conflict: {
32650               a: region.aContent,
32651               aIndex: region.aStart,
32652               o: region.oContent,
32653               oIndex: region.oStart,
32654               b: region.bContent,
32655               bIndex: region.bStart
32656             }
32657           });
32658         }
32659       }
32660     });
32661     flushOk();
32662     return results;
32663   }
32664
32665   // modules/actions/merge_remote_changes.js
32666   var import_lodash2 = __toESM(require_lodash());
32667   function actionMergeRemoteChanges(id2, localGraph, remoteGraph, discardTags, formatUser) {
32668     discardTags = discardTags || {};
32669     var _option = "safe";
32670     var _conflicts = [];
32671     function user(d2) {
32672       return typeof formatUser === "function" ? formatUser(d2) : (0, import_lodash2.escape)(d2);
32673     }
32674     function mergeLocation(remote, target) {
32675       function pointEqual(a2, b2) {
32676         var epsilon3 = 1e-6;
32677         return Math.abs(a2[0] - b2[0]) < epsilon3 && Math.abs(a2[1] - b2[1]) < epsilon3;
32678       }
32679       if (_option === "force_local" || pointEqual(target.loc, remote.loc)) {
32680         return target;
32681       }
32682       if (_option === "force_remote") {
32683         return target.update({ loc: remote.loc });
32684       }
32685       _conflicts.push(_t.html("merge_remote_changes.conflict.location", { user: { html: user(remote.user) } }));
32686       return target;
32687     }
32688     function mergeNodes(base, remote, target) {
32689       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.nodes, remote.nodes)) {
32690         return target;
32691       }
32692       if (_option === "force_remote") {
32693         return target.update({ nodes: remote.nodes });
32694       }
32695       var ccount = _conflicts.length;
32696       var o2 = base.nodes || [];
32697       var a2 = target.nodes || [];
32698       var b2 = remote.nodes || [];
32699       var nodes = [];
32700       var hunks = diff3Merge(a2, o2, b2, { excludeFalseConflicts: true });
32701       for (var i3 = 0; i3 < hunks.length; i3++) {
32702         var hunk = hunks[i3];
32703         if (hunk.ok) {
32704           nodes.push.apply(nodes, hunk.ok);
32705         } else {
32706           var c2 = hunk.conflict;
32707           if ((0, import_fast_deep_equal.default)(c2.o, c2.a)) {
32708             nodes.push.apply(nodes, c2.b);
32709           } else if ((0, import_fast_deep_equal.default)(c2.o, c2.b)) {
32710             nodes.push.apply(nodes, c2.a);
32711           } else {
32712             _conflicts.push(_t.html("merge_remote_changes.conflict.nodelist", { user: { html: user(remote.user) } }));
32713             break;
32714           }
32715         }
32716       }
32717       return _conflicts.length === ccount ? target.update({ nodes }) : target;
32718     }
32719     function mergeChildren(targetWay, children2, updates, graph) {
32720       function isUsed(node2, targetWay2) {
32721         var hasInterestingParent = graph.parentWays(node2).some(function(way) {
32722           return way.id !== targetWay2.id;
32723         });
32724         return node2.hasInterestingTags() || hasInterestingParent || graph.parentRelations(node2).length > 0;
32725       }
32726       var ccount = _conflicts.length;
32727       for (var i3 = 0; i3 < children2.length; i3++) {
32728         var id3 = children2[i3];
32729         var node = graph.hasEntity(id3);
32730         if (targetWay.nodes.indexOf(id3) === -1) {
32731           if (node && !isUsed(node, targetWay)) {
32732             updates.removeIds.push(id3);
32733           }
32734           continue;
32735         }
32736         var local = localGraph.hasEntity(id3);
32737         var remote = remoteGraph.hasEntity(id3);
32738         var target;
32739         if (_option === "force_remote" && remote && remote.visible) {
32740           updates.replacements.push(remote);
32741         } else if (_option === "force_local" && local) {
32742           target = osmEntity(local);
32743           if (remote) {
32744             target = target.update({ version: remote.version });
32745           }
32746           updates.replacements.push(target);
32747         } else if (_option === "safe" && local && remote && local.version !== remote.version) {
32748           target = osmEntity(local, { version: remote.version });
32749           if (remote.visible) {
32750             target = mergeLocation(remote, target);
32751           } else {
32752             _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
32753           }
32754           if (_conflicts.length !== ccount)
32755             break;
32756           updates.replacements.push(target);
32757         }
32758       }
32759       return targetWay;
32760     }
32761     function updateChildren(updates, graph) {
32762       for (var i3 = 0; i3 < updates.replacements.length; i3++) {
32763         graph = graph.replace(updates.replacements[i3]);
32764       }
32765       if (updates.removeIds.length) {
32766         graph = actionDeleteMultiple(updates.removeIds)(graph);
32767       }
32768       return graph;
32769     }
32770     function mergeMembers(remote, target) {
32771       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.members, remote.members)) {
32772         return target;
32773       }
32774       if (_option === "force_remote") {
32775         return target.update({ members: remote.members });
32776       }
32777       _conflicts.push(_t.html("merge_remote_changes.conflict.memberlist", { user: { html: user(remote.user) } }));
32778       return target;
32779     }
32780     function mergeTags(base, remote, target) {
32781       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.tags, remote.tags)) {
32782         return target;
32783       }
32784       if (_option === "force_remote") {
32785         return target.update({ tags: remote.tags });
32786       }
32787       var ccount = _conflicts.length;
32788       var o2 = base.tags || {};
32789       var a2 = target.tags || {};
32790       var b2 = remote.tags || {};
32791       var keys2 = utilArrayUnion(utilArrayUnion(Object.keys(o2), Object.keys(a2)), Object.keys(b2)).filter(function(k3) {
32792         return !discardTags[k3];
32793       });
32794       var tags = Object.assign({}, a2);
32795       var changed = false;
32796       for (var i3 = 0; i3 < keys2.length; i3++) {
32797         var k2 = keys2[i3];
32798         if (o2[k2] !== b2[k2] && a2[k2] !== b2[k2]) {
32799           if (o2[k2] !== a2[k2]) {
32800             _conflicts.push(_t.html(
32801               "merge_remote_changes.conflict.tags",
32802               { tag: k2, local: a2[k2], remote: b2[k2], user: { html: user(remote.user) } }
32803             ));
32804           } else {
32805             if (b2.hasOwnProperty(k2)) {
32806               tags[k2] = b2[k2];
32807             } else {
32808               delete tags[k2];
32809             }
32810             changed = true;
32811           }
32812         }
32813       }
32814       return changed && _conflicts.length === ccount ? target.update({ tags }) : target;
32815     }
32816     var action = function(graph) {
32817       var updates = { replacements: [], removeIds: [] };
32818       var base = graph.base().entities[id2];
32819       var local = localGraph.entity(id2);
32820       var remote = remoteGraph.entity(id2);
32821       var target = osmEntity(local, { version: remote.version });
32822       if (!remote.visible) {
32823         if (_option === "force_remote") {
32824           return actionDeleteMultiple([id2])(graph);
32825         } else if (_option === "force_local") {
32826           if (target.type === "way") {
32827             target = mergeChildren(target, utilArrayUniq(local.nodes), updates, graph);
32828             graph = updateChildren(updates, graph);
32829           }
32830           return graph.replace(target);
32831         } else {
32832           _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
32833           return graph;
32834         }
32835       }
32836       if (target.type === "node") {
32837         target = mergeLocation(remote, target);
32838       } else if (target.type === "way") {
32839         graph.rebase(remoteGraph.childNodes(remote), [graph], false);
32840         target = mergeNodes(base, remote, target);
32841         target = mergeChildren(target, utilArrayUnion(local.nodes, remote.nodes), updates, graph);
32842       } else if (target.type === "relation") {
32843         target = mergeMembers(remote, target);
32844       }
32845       target = mergeTags(base, remote, target);
32846       if (!_conflicts.length) {
32847         graph = updateChildren(updates, graph).replace(target);
32848       }
32849       return graph;
32850     };
32851     action.withOption = function(opt) {
32852       _option = opt;
32853       return action;
32854     };
32855     action.conflicts = function() {
32856       return _conflicts;
32857     };
32858     return action;
32859   }
32860
32861   // modules/actions/move.js
32862   function actionMove(moveIDs, tryDelta, projection2, cache) {
32863     var _delta = tryDelta;
32864     function setupCache(graph) {
32865       function canMove(nodeID) {
32866         if (moveIDs.indexOf(nodeID) !== -1)
32867           return true;
32868         var parents = graph.parentWays(graph.entity(nodeID));
32869         if (parents.length < 3)
32870           return true;
32871         var parentsMoving = parents.every(function(way) {
32872           return cache.moving[way.id];
32873         });
32874         if (!parentsMoving)
32875           delete cache.moving[nodeID];
32876         return parentsMoving;
32877       }
32878       function cacheEntities(ids) {
32879         for (var i3 = 0; i3 < ids.length; i3++) {
32880           var id2 = ids[i3];
32881           if (cache.moving[id2])
32882             continue;
32883           cache.moving[id2] = true;
32884           var entity = graph.hasEntity(id2);
32885           if (!entity)
32886             continue;
32887           if (entity.type === "node") {
32888             cache.nodes.push(id2);
32889             cache.startLoc[id2] = entity.loc;
32890           } else if (entity.type === "way") {
32891             cache.ways.push(id2);
32892             cacheEntities(entity.nodes);
32893           } else {
32894             cacheEntities(entity.members.map(function(member) {
32895               return member.id;
32896             }));
32897           }
32898         }
32899       }
32900       function cacheIntersections(ids) {
32901         function isEndpoint(way2, id3) {
32902           return !way2.isClosed() && !!way2.affix(id3);
32903         }
32904         for (var i3 = 0; i3 < ids.length; i3++) {
32905           var id2 = ids[i3];
32906           var childNodes = graph.childNodes(graph.entity(id2));
32907           for (var j3 = 0; j3 < childNodes.length; j3++) {
32908             var node = childNodes[j3];
32909             var parents = graph.parentWays(node);
32910             if (parents.length !== 2)
32911               continue;
32912             var moved = graph.entity(id2);
32913             var unmoved = null;
32914             for (var k2 = 0; k2 < parents.length; k2++) {
32915               var way = parents[k2];
32916               if (!cache.moving[way.id]) {
32917                 unmoved = way;
32918                 break;
32919               }
32920             }
32921             if (!unmoved)
32922               continue;
32923             if (utilArrayIntersection(moved.nodes, unmoved.nodes).length > 2)
32924               continue;
32925             if (moved.isArea() || unmoved.isArea())
32926               continue;
32927             cache.intersections.push({
32928               nodeId: node.id,
32929               movedId: moved.id,
32930               unmovedId: unmoved.id,
32931               movedIsEP: isEndpoint(moved, node.id),
32932               unmovedIsEP: isEndpoint(unmoved, node.id)
32933             });
32934           }
32935         }
32936       }
32937       if (!cache) {
32938         cache = {};
32939       }
32940       if (!cache.ok) {
32941         cache.moving = {};
32942         cache.intersections = [];
32943         cache.replacedVertex = {};
32944         cache.startLoc = {};
32945         cache.nodes = [];
32946         cache.ways = [];
32947         cacheEntities(moveIDs);
32948         cacheIntersections(cache.ways);
32949         cache.nodes = cache.nodes.filter(canMove);
32950         cache.ok = true;
32951       }
32952     }
32953     function replaceMovedVertex(nodeId, wayId, graph, delta) {
32954       var way = graph.entity(wayId);
32955       var moved = graph.entity(nodeId);
32956       var movedIndex = way.nodes.indexOf(nodeId);
32957       var len, prevIndex, nextIndex;
32958       if (way.isClosed()) {
32959         len = way.nodes.length - 1;
32960         prevIndex = (movedIndex + len - 1) % len;
32961         nextIndex = (movedIndex + len + 1) % len;
32962       } else {
32963         len = way.nodes.length;
32964         prevIndex = movedIndex - 1;
32965         nextIndex = movedIndex + 1;
32966       }
32967       var prev = graph.hasEntity(way.nodes[prevIndex]);
32968       var next = graph.hasEntity(way.nodes[nextIndex]);
32969       if (!prev || !next)
32970         return graph;
32971       var key = wayId + "_" + nodeId;
32972       var orig = cache.replacedVertex[key];
32973       if (!orig) {
32974         orig = osmNode();
32975         cache.replacedVertex[key] = orig;
32976         cache.startLoc[orig.id] = cache.startLoc[nodeId];
32977       }
32978       var start2, end;
32979       if (delta) {
32980         start2 = projection2(cache.startLoc[nodeId]);
32981         end = projection2.invert(geoVecAdd(start2, delta));
32982       } else {
32983         end = cache.startLoc[nodeId];
32984       }
32985       orig = orig.move(end);
32986       var angle2 = Math.abs(geoAngle(orig, prev, projection2) - geoAngle(orig, next, projection2)) * 180 / Math.PI;
32987       if (angle2 > 175 && angle2 < 185)
32988         return graph;
32989       var p1 = [prev.loc, orig.loc, moved.loc, next.loc].map(projection2);
32990       var p2 = [prev.loc, moved.loc, orig.loc, next.loc].map(projection2);
32991       var d1 = geoPathLength(p1);
32992       var d2 = geoPathLength(p2);
32993       var insertAt = d1 <= d2 ? movedIndex : nextIndex;
32994       if (way.isClosed() && insertAt === 0)
32995         insertAt = len;
32996       way = way.addNode(orig.id, insertAt);
32997       return graph.replace(orig).replace(way);
32998     }
32999     function removeDuplicateVertices(wayId, graph) {
33000       var way = graph.entity(wayId);
33001       var epsilon3 = 1e-6;
33002       var prev, curr;
33003       function isInteresting(node, graph2) {
33004         return graph2.parentWays(node).length > 1 || graph2.parentRelations(node).length || node.hasInterestingTags();
33005       }
33006       for (var i3 = 0; i3 < way.nodes.length; i3++) {
33007         curr = graph.entity(way.nodes[i3]);
33008         if (prev && curr && geoVecEqual(prev.loc, curr.loc, epsilon3)) {
33009           if (!isInteresting(prev, graph)) {
33010             way = way.removeNode(prev.id);
33011             graph = graph.replace(way).remove(prev);
33012           } else if (!isInteresting(curr, graph)) {
33013             way = way.removeNode(curr.id);
33014             graph = graph.replace(way).remove(curr);
33015           }
33016         }
33017         prev = curr;
33018       }
33019       return graph;
33020     }
33021     function unZorroIntersection(intersection, graph) {
33022       var vertex = graph.entity(intersection.nodeId);
33023       var way1 = graph.entity(intersection.movedId);
33024       var way2 = graph.entity(intersection.unmovedId);
33025       var isEP1 = intersection.movedIsEP;
33026       var isEP2 = intersection.unmovedIsEP;
33027       if (isEP1 && isEP2)
33028         return graph;
33029       var nodes1 = graph.childNodes(way1).filter(function(n3) {
33030         return n3 !== vertex;
33031       });
33032       var nodes2 = graph.childNodes(way2).filter(function(n3) {
33033         return n3 !== vertex;
33034       });
33035       if (way1.isClosed() && way1.first() === vertex.id)
33036         nodes1.push(nodes1[0]);
33037       if (way2.isClosed() && way2.first() === vertex.id)
33038         nodes2.push(nodes2[0]);
33039       var edge1 = !isEP1 && geoChooseEdge(nodes1, projection2(vertex.loc), projection2);
33040       var edge2 = !isEP2 && geoChooseEdge(nodes2, projection2(vertex.loc), projection2);
33041       var loc;
33042       if (!isEP1 && !isEP2) {
33043         var epsilon3 = 1e-6, maxIter = 10;
33044         for (var i3 = 0; i3 < maxIter; i3++) {
33045           loc = geoVecInterp(edge1.loc, edge2.loc, 0.5);
33046           edge1 = geoChooseEdge(nodes1, projection2(loc), projection2);
33047           edge2 = geoChooseEdge(nodes2, projection2(loc), projection2);
33048           if (Math.abs(edge1.distance - edge2.distance) < epsilon3)
33049             break;
33050         }
33051       } else if (!isEP1) {
33052         loc = edge1.loc;
33053       } else {
33054         loc = edge2.loc;
33055       }
33056       graph = graph.replace(vertex.move(loc));
33057       if (!isEP1 && edge1.index !== way1.nodes.indexOf(vertex.id)) {
33058         way1 = way1.removeNode(vertex.id).addNode(vertex.id, edge1.index);
33059         graph = graph.replace(way1);
33060       }
33061       if (!isEP2 && edge2.index !== way2.nodes.indexOf(vertex.id)) {
33062         way2 = way2.removeNode(vertex.id).addNode(vertex.id, edge2.index);
33063         graph = graph.replace(way2);
33064       }
33065       return graph;
33066     }
33067     function cleanupIntersections(graph) {
33068       for (var i3 = 0; i3 < cache.intersections.length; i3++) {
33069         var obj = cache.intersections[i3];
33070         graph = replaceMovedVertex(obj.nodeId, obj.movedId, graph, _delta);
33071         graph = replaceMovedVertex(obj.nodeId, obj.unmovedId, graph, null);
33072         graph = unZorroIntersection(obj, graph);
33073         graph = removeDuplicateVertices(obj.movedId, graph);
33074         graph = removeDuplicateVertices(obj.unmovedId, graph);
33075       }
33076       return graph;
33077     }
33078     function limitDelta(graph) {
33079       function moveNode(loc) {
33080         return geoVecAdd(projection2(loc), _delta);
33081       }
33082       for (var i3 = 0; i3 < cache.intersections.length; i3++) {
33083         var obj = cache.intersections[i3];
33084         if (obj.movedIsEP && obj.unmovedIsEP)
33085           continue;
33086         if (!obj.movedIsEP)
33087           continue;
33088         var node = graph.entity(obj.nodeId);
33089         var start2 = projection2(node.loc);
33090         var end = geoVecAdd(start2, _delta);
33091         var movedNodes = graph.childNodes(graph.entity(obj.movedId));
33092         var movedPath = movedNodes.map(function(n3) {
33093           return moveNode(n3.loc);
33094         });
33095         var unmovedNodes = graph.childNodes(graph.entity(obj.unmovedId));
33096         var unmovedPath = unmovedNodes.map(function(n3) {
33097           return projection2(n3.loc);
33098         });
33099         var hits = geoPathIntersections(movedPath, unmovedPath);
33100         for (var j3 = 0; i3 < hits.length; i3++) {
33101           if (geoVecEqual(hits[j3], end))
33102             continue;
33103           var edge = geoChooseEdge(unmovedNodes, end, projection2);
33104           _delta = geoVecSubtract(projection2(edge.loc), start2);
33105         }
33106       }
33107     }
33108     var action = function(graph) {
33109       if (_delta[0] === 0 && _delta[1] === 0)
33110         return graph;
33111       setupCache(graph);
33112       if (cache.intersections.length) {
33113         limitDelta(graph);
33114       }
33115       for (var i3 = 0; i3 < cache.nodes.length; i3++) {
33116         var node = graph.entity(cache.nodes[i3]);
33117         var start2 = projection2(node.loc);
33118         var end = geoVecAdd(start2, _delta);
33119         graph = graph.replace(node.move(projection2.invert(end)));
33120       }
33121       if (cache.intersections.length) {
33122         graph = cleanupIntersections(graph);
33123       }
33124       return graph;
33125     };
33126     action.delta = function() {
33127       return _delta;
33128     };
33129     return action;
33130   }
33131
33132   // modules/actions/move_member.js
33133   function actionMoveMember(relationId, fromIndex, toIndex) {
33134     return function(graph) {
33135       return graph.replace(graph.entity(relationId).moveMember(fromIndex, toIndex));
33136     };
33137   }
33138
33139   // modules/actions/move_node.js
33140   function actionMoveNode(nodeID, toLoc) {
33141     var action = function(graph, t2) {
33142       if (t2 === null || !isFinite(t2))
33143         t2 = 1;
33144       t2 = Math.min(Math.max(+t2, 0), 1);
33145       var node = graph.entity(nodeID);
33146       return graph.replace(
33147         node.move(geoVecInterp(node.loc, toLoc, t2))
33148       );
33149     };
33150     action.transitionable = true;
33151     return action;
33152   }
33153
33154   // modules/actions/noop.js
33155   function actionNoop() {
33156     return function(graph) {
33157       return graph;
33158     };
33159   }
33160
33161   // modules/actions/orthogonalize.js
33162   function actionOrthogonalize(wayID, projection2, vertexID, degThresh, ep) {
33163     var epsilon3 = ep || 1e-4;
33164     var threshold = degThresh || 13;
33165     var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
33166     var upperThreshold = Math.cos(threshold * Math.PI / 180);
33167     var action = function(graph, t2) {
33168       if (t2 === null || !isFinite(t2))
33169         t2 = 1;
33170       t2 = Math.min(Math.max(+t2, 0), 1);
33171       var way = graph.entity(wayID);
33172       way = way.removeNode("");
33173       if (way.tags.nonsquare) {
33174         var tags = Object.assign({}, way.tags);
33175         delete tags.nonsquare;
33176         way = way.update({ tags });
33177       }
33178       graph = graph.replace(way);
33179       var isClosed = way.isClosed();
33180       var nodes = graph.childNodes(way).slice();
33181       if (isClosed)
33182         nodes.pop();
33183       if (vertexID !== void 0) {
33184         nodes = nodeSubset(nodes, vertexID, isClosed);
33185         if (nodes.length !== 3)
33186           return graph;
33187       }
33188       var nodeCount = {};
33189       var points = [];
33190       var corner = { i: 0, dotp: 1 };
33191       var node, point2, loc, score, motions, i3, j3;
33192       for (i3 = 0; i3 < nodes.length; i3++) {
33193         node = nodes[i3];
33194         nodeCount[node.id] = (nodeCount[node.id] || 0) + 1;
33195         points.push({ id: node.id, coord: projection2(node.loc) });
33196       }
33197       if (points.length === 3) {
33198         for (i3 = 0; i3 < 1e3; i3++) {
33199           motions = points.map(calcMotion);
33200           points[corner.i].coord = geoVecAdd(points[corner.i].coord, motions[corner.i]);
33201           score = corner.dotp;
33202           if (score < epsilon3) {
33203             break;
33204           }
33205         }
33206         node = graph.entity(nodes[corner.i].id);
33207         loc = projection2.invert(points[corner.i].coord);
33208         graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
33209       } else {
33210         var straights = [];
33211         var simplified = [];
33212         for (i3 = 0; i3 < points.length; i3++) {
33213           point2 = points[i3];
33214           var dotp = 0;
33215           if (isClosed || i3 > 0 && i3 < points.length - 1) {
33216             var a2 = points[(i3 - 1 + points.length) % points.length];
33217             var b2 = points[(i3 + 1) % points.length];
33218             dotp = Math.abs(geoOrthoNormalizedDotProduct(a2.coord, b2.coord, point2.coord));
33219           }
33220           if (dotp > upperThreshold) {
33221             straights.push(point2);
33222           } else {
33223             simplified.push(point2);
33224           }
33225         }
33226         var bestPoints = clonePoints(simplified);
33227         var originalPoints = clonePoints(simplified);
33228         score = Infinity;
33229         for (i3 = 0; i3 < 1e3; i3++) {
33230           motions = simplified.map(calcMotion);
33231           for (j3 = 0; j3 < motions.length; j3++) {
33232             simplified[j3].coord = geoVecAdd(simplified[j3].coord, motions[j3]);
33233           }
33234           var newScore = geoOrthoCalcScore(simplified, isClosed, epsilon3, threshold);
33235           if (newScore < score) {
33236             bestPoints = clonePoints(simplified);
33237             score = newScore;
33238           }
33239           if (score < epsilon3) {
33240             break;
33241           }
33242         }
33243         var bestCoords = bestPoints.map(function(p2) {
33244           return p2.coord;
33245         });
33246         if (isClosed)
33247           bestCoords.push(bestCoords[0]);
33248         for (i3 = 0; i3 < bestPoints.length; i3++) {
33249           point2 = bestPoints[i3];
33250           if (!geoVecEqual(originalPoints[i3].coord, point2.coord)) {
33251             node = graph.entity(point2.id);
33252             loc = projection2.invert(point2.coord);
33253             graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
33254           }
33255         }
33256         for (i3 = 0; i3 < straights.length; i3++) {
33257           point2 = straights[i3];
33258           if (nodeCount[point2.id] > 1)
33259             continue;
33260           node = graph.entity(point2.id);
33261           if (t2 === 1 && graph.parentWays(node).length === 1 && graph.parentRelations(node).length === 0 && !node.hasInterestingTags()) {
33262             graph = actionDeleteNode(node.id)(graph);
33263           } else {
33264             var choice = geoVecProject(point2.coord, bestCoords);
33265             if (choice) {
33266               loc = projection2.invert(choice.target);
33267               graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
33268             }
33269           }
33270         }
33271       }
33272       return graph;
33273       function clonePoints(array2) {
33274         return array2.map(function(p2) {
33275           return { id: p2.id, coord: [p2.coord[0], p2.coord[1]] };
33276         });
33277       }
33278       function calcMotion(point3, i4, array2) {
33279         if (!isClosed && (i4 === 0 || i4 === array2.length - 1))
33280           return [0, 0];
33281         if (nodeCount[array2[i4].id] > 1)
33282           return [0, 0];
33283         var a3 = array2[(i4 - 1 + array2.length) % array2.length].coord;
33284         var origin = point3.coord;
33285         var b3 = array2[(i4 + 1) % array2.length].coord;
33286         var p2 = geoVecSubtract(a3, origin);
33287         var q2 = geoVecSubtract(b3, origin);
33288         var scale = 2 * Math.min(geoVecLength(p2), geoVecLength(q2));
33289         p2 = geoVecNormalize(p2);
33290         q2 = geoVecNormalize(q2);
33291         var dotp2 = p2[0] * q2[0] + p2[1] * q2[1];
33292         var val = Math.abs(dotp2);
33293         if (val < lowerThreshold) {
33294           corner.i = i4;
33295           corner.dotp = val;
33296           var vec = geoVecNormalize(geoVecAdd(p2, q2));
33297           return geoVecScale(vec, 0.1 * dotp2 * scale);
33298         }
33299         return [0, 0];
33300       }
33301     };
33302     function nodeSubset(nodes, vertexID2, isClosed) {
33303       var first = isClosed ? 0 : 1;
33304       var last = isClosed ? nodes.length : nodes.length - 1;
33305       for (var i3 = first; i3 < last; i3++) {
33306         if (nodes[i3].id === vertexID2) {
33307           return [
33308             nodes[(i3 - 1 + nodes.length) % nodes.length],
33309             nodes[i3],
33310             nodes[(i3 + 1) % nodes.length]
33311           ];
33312         }
33313       }
33314       return [];
33315     }
33316     action.disabled = function(graph) {
33317       var way = graph.entity(wayID);
33318       way = way.removeNode("");
33319       graph = graph.replace(way);
33320       var isClosed = way.isClosed();
33321       var nodes = graph.childNodes(way).slice();
33322       if (isClosed)
33323         nodes.pop();
33324       var allowStraightAngles = false;
33325       if (vertexID !== void 0) {
33326         allowStraightAngles = true;
33327         nodes = nodeSubset(nodes, vertexID, isClosed);
33328         if (nodes.length !== 3)
33329           return "end_vertex";
33330       }
33331       var coords = nodes.map(function(n3) {
33332         return projection2(n3.loc);
33333       });
33334       var score = geoOrthoCanOrthogonalize(coords, isClosed, epsilon3, threshold, allowStraightAngles);
33335       if (score === null) {
33336         return "not_squarish";
33337       } else if (score === 0) {
33338         return "square_enough";
33339       } else {
33340         return false;
33341       }
33342     };
33343     action.transitionable = true;
33344     return action;
33345   }
33346
33347   // modules/actions/restrict_turn.js
33348   function actionRestrictTurn(turn, restrictionType, restrictionID) {
33349     return function(graph) {
33350       var fromWay = graph.entity(turn.from.way);
33351       var toWay = graph.entity(turn.to.way);
33352       var viaNode = turn.via.node && graph.entity(turn.via.node);
33353       var viaWays = turn.via.ways && turn.via.ways.map(function(id2) {
33354         return graph.entity(id2);
33355       });
33356       var members = [];
33357       members.push({ id: fromWay.id, type: "way", role: "from" });
33358       if (viaNode) {
33359         members.push({ id: viaNode.id, type: "node", role: "via" });
33360       } else if (viaWays) {
33361         viaWays.forEach(function(viaWay) {
33362           members.push({ id: viaWay.id, type: "way", role: "via" });
33363         });
33364       }
33365       members.push({ id: toWay.id, type: "way", role: "to" });
33366       return graph.replace(osmRelation({
33367         id: restrictionID,
33368         tags: {
33369           type: "restriction",
33370           restriction: restrictionType
33371         },
33372         members
33373       }));
33374     };
33375   }
33376
33377   // modules/actions/revert.js
33378   function actionRevert(id2) {
33379     var action = function(graph) {
33380       var entity = graph.hasEntity(id2), base = graph.base().entities[id2];
33381       if (entity && !base) {
33382         if (entity.type === "node") {
33383           graph.parentWays(entity).forEach(function(parent) {
33384             parent = parent.removeNode(id2);
33385             graph = graph.replace(parent);
33386             if (parent.isDegenerate()) {
33387               graph = actionDeleteWay(parent.id)(graph);
33388             }
33389           });
33390         }
33391         graph.parentRelations(entity).forEach(function(parent) {
33392           parent = parent.removeMembersWithID(id2);
33393           graph = graph.replace(parent);
33394           if (parent.isDegenerate()) {
33395             graph = actionDeleteRelation(parent.id)(graph);
33396           }
33397         });
33398       }
33399       return graph.revert(id2);
33400     };
33401     return action;
33402   }
33403
33404   // modules/actions/rotate.js
33405   function actionRotate(rotateIds, pivot, angle2, projection2) {
33406     var action = function(graph) {
33407       return graph.update(function(graph2) {
33408         utilGetAllNodes(rotateIds, graph2).forEach(function(node) {
33409           var point2 = geoRotate([projection2(node.loc)], angle2, pivot)[0];
33410           graph2 = graph2.replace(node.move(projection2.invert(point2)));
33411         });
33412       });
33413     };
33414     return action;
33415   }
33416
33417   // modules/actions/scale.js
33418   function actionScale(ids, pivotLoc, scaleFactor, projection2) {
33419     return function(graph) {
33420       return graph.update(function(graph2) {
33421         let point2, radial;
33422         utilGetAllNodes(ids, graph2).forEach(function(node) {
33423           point2 = projection2(node.loc);
33424           radial = [
33425             point2[0] - pivotLoc[0],
33426             point2[1] - pivotLoc[1]
33427           ];
33428           point2 = [
33429             pivotLoc[0] + scaleFactor * radial[0],
33430             pivotLoc[1] + scaleFactor * radial[1]
33431           ];
33432           graph2 = graph2.replace(node.move(projection2.invert(point2)));
33433         });
33434       });
33435     };
33436   }
33437
33438   // modules/actions/straighten_nodes.js
33439   function actionStraightenNodes(nodeIDs, projection2) {
33440     function positionAlongWay(a2, o2, b2) {
33441       return geoVecDot(a2, b2, o2) / geoVecDot(b2, b2, o2);
33442     }
33443     function getEndpoints(points) {
33444       var ssr = geoGetSmallestSurroundingRectangle(points);
33445       var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
33446       var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
33447       var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
33448       var q2 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
33449       var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q2);
33450       if (isLong) {
33451         return [p1, q1];
33452       }
33453       return [p2, q2];
33454     }
33455     var action = function(graph, t2) {
33456       if (t2 === null || !isFinite(t2))
33457         t2 = 1;
33458       t2 = Math.min(Math.max(+t2, 0), 1);
33459       var nodes = nodeIDs.map(function(id2) {
33460         return graph.entity(id2);
33461       });
33462       var points = nodes.map(function(n3) {
33463         return projection2(n3.loc);
33464       });
33465       var endpoints = getEndpoints(points);
33466       var startPoint = endpoints[0];
33467       var endPoint = endpoints[1];
33468       for (var i3 = 0; i3 < points.length; i3++) {
33469         var node = nodes[i3];
33470         var point2 = points[i3];
33471         var u2 = positionAlongWay(point2, startPoint, endPoint);
33472         var point22 = geoVecInterp(startPoint, endPoint, u2);
33473         var loc2 = projection2.invert(point22);
33474         graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t2)));
33475       }
33476       return graph;
33477     };
33478     action.disabled = function(graph) {
33479       var nodes = nodeIDs.map(function(id2) {
33480         return graph.entity(id2);
33481       });
33482       var points = nodes.map(function(n3) {
33483         return projection2(n3.loc);
33484       });
33485       var endpoints = getEndpoints(points);
33486       var startPoint = endpoints[0];
33487       var endPoint = endpoints[1];
33488       var maxDistance = 0;
33489       for (var i3 = 0; i3 < points.length; i3++) {
33490         var point2 = points[i3];
33491         var u2 = positionAlongWay(point2, startPoint, endPoint);
33492         var p2 = geoVecInterp(startPoint, endPoint, u2);
33493         var dist = geoVecLength(p2, point2);
33494         if (!isNaN(dist) && dist > maxDistance) {
33495           maxDistance = dist;
33496         }
33497       }
33498       if (maxDistance < 1e-4) {
33499         return "straight_enough";
33500       }
33501     };
33502     action.transitionable = true;
33503     return action;
33504   }
33505
33506   // modules/actions/straighten_way.js
33507   function actionStraightenWay(selectedIDs, projection2) {
33508     function positionAlongWay(a2, o2, b2) {
33509       return geoVecDot(a2, b2, o2) / geoVecDot(b2, b2, o2);
33510     }
33511     function allNodes(graph) {
33512       var nodes = [];
33513       var startNodes = [];
33514       var endNodes = [];
33515       var remainingWays = [];
33516       var selectedWays = selectedIDs.filter(function(w2) {
33517         return graph.entity(w2).type === "way";
33518       });
33519       var selectedNodes = selectedIDs.filter(function(n3) {
33520         return graph.entity(n3).type === "node";
33521       });
33522       for (var i3 = 0; i3 < selectedWays.length; i3++) {
33523         var way = graph.entity(selectedWays[i3]);
33524         nodes = way.nodes.slice(0);
33525         remainingWays.push(nodes);
33526         startNodes.push(nodes[0]);
33527         endNodes.push(nodes[nodes.length - 1]);
33528       }
33529       startNodes = startNodes.filter(function(n3) {
33530         return startNodes.indexOf(n3) === startNodes.lastIndexOf(n3);
33531       });
33532       endNodes = endNodes.filter(function(n3) {
33533         return endNodes.indexOf(n3) === endNodes.lastIndexOf(n3);
33534       });
33535       var currNode = utilArrayDifference(startNodes, endNodes).concat(utilArrayDifference(endNodes, startNodes))[0];
33536       var nextWay = [];
33537       nodes = [];
33538       var getNextWay = function(currNode2, remainingWays2) {
33539         return remainingWays2.filter(function(way2) {
33540           return way2[0] === currNode2 || way2[way2.length - 1] === currNode2;
33541         })[0];
33542       };
33543       while (remainingWays.length) {
33544         nextWay = getNextWay(currNode, remainingWays);
33545         remainingWays = utilArrayDifference(remainingWays, [nextWay]);
33546         if (nextWay[0] !== currNode) {
33547           nextWay.reverse();
33548         }
33549         nodes = nodes.concat(nextWay);
33550         currNode = nodes[nodes.length - 1];
33551       }
33552       if (selectedNodes.length === 2) {
33553         var startNodeIdx = nodes.indexOf(selectedNodes[0]);
33554         var endNodeIdx = nodes.indexOf(selectedNodes[1]);
33555         var sortedStartEnd = [startNodeIdx, endNodeIdx];
33556         sortedStartEnd.sort(function(a2, b2) {
33557           return a2 - b2;
33558         });
33559         nodes = nodes.slice(sortedStartEnd[0], sortedStartEnd[1] + 1);
33560       }
33561       return nodes.map(function(n3) {
33562         return graph.entity(n3);
33563       });
33564     }
33565     function shouldKeepNode(node, graph) {
33566       return graph.parentWays(node).length > 1 || graph.parentRelations(node).length || node.hasInterestingTags();
33567     }
33568     var action = function(graph, t2) {
33569       if (t2 === null || !isFinite(t2))
33570         t2 = 1;
33571       t2 = Math.min(Math.max(+t2, 0), 1);
33572       var nodes = allNodes(graph);
33573       var points = nodes.map(function(n3) {
33574         return projection2(n3.loc);
33575       });
33576       var startPoint = points[0];
33577       var endPoint = points[points.length - 1];
33578       var toDelete = [];
33579       var i3;
33580       for (i3 = 1; i3 < points.length - 1; i3++) {
33581         var node = nodes[i3];
33582         var point2 = points[i3];
33583         if (t2 < 1 || shouldKeepNode(node, graph)) {
33584           var u2 = positionAlongWay(point2, startPoint, endPoint);
33585           var p2 = geoVecInterp(startPoint, endPoint, u2);
33586           var loc2 = projection2.invert(p2);
33587           graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t2)));
33588         } else {
33589           if (toDelete.indexOf(node) === -1) {
33590             toDelete.push(node);
33591           }
33592         }
33593       }
33594       for (i3 = 0; i3 < toDelete.length; i3++) {
33595         graph = actionDeleteNode(toDelete[i3].id)(graph);
33596       }
33597       return graph;
33598     };
33599     action.disabled = function(graph) {
33600       var nodes = allNodes(graph);
33601       var points = nodes.map(function(n3) {
33602         return projection2(n3.loc);
33603       });
33604       var startPoint = points[0];
33605       var endPoint = points[points.length - 1];
33606       var threshold = 0.2 * geoVecLength(startPoint, endPoint);
33607       var i3;
33608       if (threshold === 0) {
33609         return "too_bendy";
33610       }
33611       var maxDistance = 0;
33612       for (i3 = 1; i3 < points.length - 1; i3++) {
33613         var point2 = points[i3];
33614         var u2 = positionAlongWay(point2, startPoint, endPoint);
33615         var p2 = geoVecInterp(startPoint, endPoint, u2);
33616         var dist = geoVecLength(p2, point2);
33617         if (isNaN(dist) || dist > threshold) {
33618           return "too_bendy";
33619         } else if (dist > maxDistance) {
33620           maxDistance = dist;
33621         }
33622       }
33623       var keepingAllNodes = nodes.every(function(node, i4) {
33624         return i4 === 0 || i4 === nodes.length - 1 || shouldKeepNode(node, graph);
33625       });
33626       if (maxDistance < 1e-4 && // Allow straightening even if already straight in order to remove extraneous nodes
33627       keepingAllNodes) {
33628         return "straight_enough";
33629       }
33630     };
33631     action.transitionable = true;
33632     return action;
33633   }
33634
33635   // modules/actions/unrestrict_turn.js
33636   function actionUnrestrictTurn(turn) {
33637     return function(graph) {
33638       return actionDeleteRelation(turn.restrictionID)(graph);
33639     };
33640   }
33641
33642   // modules/actions/reflect.js
33643   function actionReflect(reflectIds, projection2) {
33644     var _useLongAxis = true;
33645     var action = function(graph, t2) {
33646       if (t2 === null || !isFinite(t2))
33647         t2 = 1;
33648       t2 = Math.min(Math.max(+t2, 0), 1);
33649       var nodes = utilGetAllNodes(reflectIds, graph);
33650       var points = nodes.map(function(n3) {
33651         return projection2(n3.loc);
33652       });
33653       var ssr = geoGetSmallestSurroundingRectangle(points);
33654       var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
33655       var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
33656       var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
33657       var q2 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
33658       var p3, q3;
33659       var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q2);
33660       if (_useLongAxis && isLong || !_useLongAxis && !isLong) {
33661         p3 = p1;
33662         q3 = q1;
33663       } else {
33664         p3 = p2;
33665         q3 = q2;
33666       }
33667       var dx = q3[0] - p3[0];
33668       var dy = q3[1] - p3[1];
33669       var a2 = (dx * dx - dy * dy) / (dx * dx + dy * dy);
33670       var b2 = 2 * dx * dy / (dx * dx + dy * dy);
33671       for (var i3 = 0; i3 < nodes.length; i3++) {
33672         var node = nodes[i3];
33673         var c2 = projection2(node.loc);
33674         var c22 = [
33675           a2 * (c2[0] - p3[0]) + b2 * (c2[1] - p3[1]) + p3[0],
33676           b2 * (c2[0] - p3[0]) - a2 * (c2[1] - p3[1]) + p3[1]
33677         ];
33678         var loc2 = projection2.invert(c22);
33679         node = node.move(geoVecInterp(node.loc, loc2, t2));
33680         graph = graph.replace(node);
33681       }
33682       return graph;
33683     };
33684     action.useLongAxis = function(val) {
33685       if (!arguments.length)
33686         return _useLongAxis;
33687       _useLongAxis = val;
33688       return action;
33689     };
33690     action.transitionable = true;
33691     return action;
33692   }
33693
33694   // modules/actions/upgrade_tags.js
33695   function actionUpgradeTags(entityId, oldTags, replaceTags) {
33696     return function(graph) {
33697       var entity = graph.entity(entityId);
33698       var tags = Object.assign({}, entity.tags);
33699       var transferValue;
33700       var semiIndex;
33701       for (var oldTagKey in oldTags) {
33702         if (!(oldTagKey in tags))
33703           continue;
33704         if (oldTags[oldTagKey] === "*") {
33705           transferValue = tags[oldTagKey];
33706           delete tags[oldTagKey];
33707         } else if (oldTags[oldTagKey] === tags[oldTagKey]) {
33708           delete tags[oldTagKey];
33709         } else {
33710           var vals = tags[oldTagKey].split(";").filter(Boolean);
33711           var oldIndex = vals.indexOf(oldTags[oldTagKey]);
33712           if (vals.length === 1 || oldIndex === -1) {
33713             delete tags[oldTagKey];
33714           } else {
33715             if (replaceTags && replaceTags[oldTagKey]) {
33716               semiIndex = oldIndex;
33717             }
33718             vals.splice(oldIndex, 1);
33719             tags[oldTagKey] = vals.join(";");
33720           }
33721         }
33722       }
33723       if (replaceTags) {
33724         for (var replaceKey in replaceTags) {
33725           var replaceValue = replaceTags[replaceKey];
33726           if (replaceValue === "*") {
33727             if (tags[replaceKey] && tags[replaceKey] !== "no") {
33728               continue;
33729             } else {
33730               tags[replaceKey] = "yes";
33731             }
33732           } else if (replaceValue === "$1") {
33733             tags[replaceKey] = transferValue;
33734           } else {
33735             if (tags[replaceKey] && oldTags[replaceKey] && semiIndex !== void 0) {
33736               var existingVals = tags[replaceKey].split(";").filter(Boolean);
33737               if (existingVals.indexOf(replaceValue) === -1) {
33738                 existingVals.splice(semiIndex, 0, replaceValue);
33739                 tags[replaceKey] = existingVals.join(";");
33740               }
33741             } else {
33742               tags[replaceKey] = replaceValue;
33743             }
33744           }
33745         }
33746       }
33747       return graph.replace(entity.update({ tags }));
33748     };
33749   }
33750
33751   // modules/behavior/edit.js
33752   function behaviorEdit(context) {
33753     function behavior() {
33754       context.map().minzoom(context.minEditableZoom());
33755     }
33756     behavior.off = function() {
33757       context.map().minzoom(0);
33758     };
33759     return behavior;
33760   }
33761
33762   // modules/behavior/hover.js
33763   function behaviorHover(context) {
33764     var dispatch14 = dispatch_default("hover");
33765     var _selection = select_default2(null);
33766     var _newNodeId = null;
33767     var _initialNodeID = null;
33768     var _altDisables;
33769     var _ignoreVertex;
33770     var _targets = [];
33771     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
33772     function keydown(d3_event) {
33773       if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
33774         _selection.selectAll(".hover").classed("hover-suppressed", true).classed("hover", false);
33775         _selection.classed("hover-disabled", true);
33776         dispatch14.call("hover", this, null);
33777       }
33778     }
33779     function keyup(d3_event) {
33780       if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
33781         _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false).classed("hover", true);
33782         _selection.classed("hover-disabled", false);
33783         dispatch14.call("hover", this, _targets);
33784       }
33785     }
33786     function behavior(selection2) {
33787       _selection = selection2;
33788       _targets = [];
33789       if (_initialNodeID) {
33790         _newNodeId = _initialNodeID;
33791         _initialNodeID = null;
33792       } else {
33793         _newNodeId = null;
33794       }
33795       _selection.on(_pointerPrefix + "over.hover", pointerover).on(_pointerPrefix + "out.hover", pointerout).on(_pointerPrefix + "down.hover", pointerover);
33796       select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", pointerout, true).on("keydown.hover", keydown).on("keyup.hover", keyup);
33797       function eventTarget(d3_event) {
33798         var datum2 = d3_event.target && d3_event.target.__data__;
33799         if (typeof datum2 !== "object")
33800           return null;
33801         if (!(datum2 instanceof osmEntity) && datum2.properties && datum2.properties.entity instanceof osmEntity) {
33802           return datum2.properties.entity;
33803         }
33804         return datum2;
33805       }
33806       function pointerover(d3_event) {
33807         if (context.mode().id.indexOf("drag") === -1 && (!d3_event.pointerType || d3_event.pointerType === "mouse") && d3_event.buttons)
33808           return;
33809         var target = eventTarget(d3_event);
33810         if (target && _targets.indexOf(target) === -1) {
33811           _targets.push(target);
33812           updateHover(d3_event, _targets);
33813         }
33814       }
33815       function pointerout(d3_event) {
33816         var target = eventTarget(d3_event);
33817         var index = _targets.indexOf(target);
33818         if (index !== -1) {
33819           _targets.splice(index);
33820           updateHover(d3_event, _targets);
33821         }
33822       }
33823       function allowsVertex(d2) {
33824         return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
33825       }
33826       function modeAllowsHover(target) {
33827         var mode = context.mode();
33828         if (mode.id === "add-point") {
33829           return mode.preset.matchGeometry("vertex") || target.type !== "way" && target.geometry(context.graph()) !== "vertex";
33830         }
33831         return true;
33832       }
33833       function updateHover(d3_event, targets) {
33834         _selection.selectAll(".hover").classed("hover", false);
33835         _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false);
33836         var mode = context.mode();
33837         if (!_newNodeId && (mode.id === "draw-line" || mode.id === "draw-area")) {
33838           var node = targets.find(function(target) {
33839             return target instanceof osmEntity && target.type === "node";
33840           });
33841           _newNodeId = node && node.id;
33842         }
33843         targets = targets.filter(function(datum3) {
33844           if (datum3 instanceof osmEntity) {
33845             return datum3.id !== _newNodeId && (datum3.type !== "node" || !_ignoreVertex || allowsVertex(datum3)) && modeAllowsHover(datum3);
33846           }
33847           return true;
33848         });
33849         var selector = "";
33850         for (var i3 in targets) {
33851           var datum2 = targets[i3];
33852           if (datum2.__featurehash__) {
33853             selector += ", .data" + datum2.__featurehash__;
33854           } else if (datum2 instanceof QAItem) {
33855             selector += ", ." + datum2.service + ".itemId-" + datum2.id;
33856           } else if (datum2 instanceof osmNote) {
33857             selector += ", .note-" + datum2.id;
33858           } else if (datum2 instanceof osmEntity) {
33859             selector += ", ." + datum2.id;
33860             if (datum2.type === "relation") {
33861               for (var j3 in datum2.members) {
33862                 selector += ", ." + datum2.members[j3].id;
33863               }
33864             }
33865           }
33866         }
33867         var suppressed = _altDisables && d3_event && d3_event.altKey;
33868         if (selector.trim().length) {
33869           selector = selector.slice(1);
33870           _selection.selectAll(selector).classed(suppressed ? "hover-suppressed" : "hover", true);
33871         }
33872         dispatch14.call("hover", this, !suppressed && targets);
33873       }
33874     }
33875     behavior.off = function(selection2) {
33876       selection2.selectAll(".hover").classed("hover", false);
33877       selection2.selectAll(".hover-suppressed").classed("hover-suppressed", false);
33878       selection2.classed("hover-disabled", false);
33879       selection2.on(_pointerPrefix + "over.hover", null).on(_pointerPrefix + "out.hover", null).on(_pointerPrefix + "down.hover", null);
33880       select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", null, true).on("keydown.hover", null).on("keyup.hover", null);
33881     };
33882     behavior.altDisables = function(val) {
33883       if (!arguments.length)
33884         return _altDisables;
33885       _altDisables = val;
33886       return behavior;
33887     };
33888     behavior.ignoreVertex = function(val) {
33889       if (!arguments.length)
33890         return _ignoreVertex;
33891       _ignoreVertex = val;
33892       return behavior;
33893     };
33894     behavior.initialNodeID = function(nodeId) {
33895       _initialNodeID = nodeId;
33896       return behavior;
33897     };
33898     return utilRebind(behavior, dispatch14, "on");
33899   }
33900
33901   // modules/behavior/draw.js
33902   var _disableSpace = false;
33903   var _lastSpace = null;
33904   function behaviorDraw(context) {
33905     var dispatch14 = dispatch_default(
33906       "move",
33907       "down",
33908       "downcancel",
33909       "click",
33910       "clickWay",
33911       "clickNode",
33912       "undo",
33913       "cancel",
33914       "finish"
33915     );
33916     var keybinding = utilKeybinding("draw");
33917     var _hover = behaviorHover(context).altDisables(true).ignoreVertex(true).on("hover", context.ui().sidebar.hover);
33918     var _edit = behaviorEdit(context);
33919     var _closeTolerance = 4;
33920     var _tolerance = 12;
33921     var _mouseLeave = false;
33922     var _lastMouse = null;
33923     var _lastPointerUpEvent;
33924     var _downPointer;
33925     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
33926     function datum2(d3_event) {
33927       var mode = context.mode();
33928       var isNote = mode && mode.id.indexOf("note") !== -1;
33929       if (d3_event.altKey || isNote)
33930         return {};
33931       var element;
33932       if (d3_event.type === "keydown") {
33933         element = _lastMouse && _lastMouse.target;
33934       } else {
33935         element = d3_event.target;
33936       }
33937       var d2 = element.__data__;
33938       return d2 && d2.properties && d2.properties.target ? d2 : {};
33939     }
33940     function pointerdown(d3_event) {
33941       if (_downPointer)
33942         return;
33943       var pointerLocGetter = utilFastMouse(this);
33944       _downPointer = {
33945         id: d3_event.pointerId || "mouse",
33946         pointerLocGetter,
33947         downTime: +/* @__PURE__ */ new Date(),
33948         downLoc: pointerLocGetter(d3_event)
33949       };
33950       dispatch14.call("down", this, d3_event, datum2(d3_event));
33951     }
33952     function pointerup(d3_event) {
33953       if (!_downPointer || _downPointer.id !== (d3_event.pointerId || "mouse"))
33954         return;
33955       var downPointer = _downPointer;
33956       _downPointer = null;
33957       _lastPointerUpEvent = d3_event;
33958       if (downPointer.isCancelled)
33959         return;
33960       var t2 = +/* @__PURE__ */ new Date();
33961       var p2 = downPointer.pointerLocGetter(d3_event);
33962       var dist = geoVecLength(downPointer.downLoc, p2);
33963       if (dist < _closeTolerance || dist < _tolerance && t2 - downPointer.downTime < 500) {
33964         select_default2(window).on("click.draw-block", function() {
33965           d3_event.stopPropagation();
33966         }, true);
33967         context.map().dblclickZoomEnable(false);
33968         window.setTimeout(function() {
33969           context.map().dblclickZoomEnable(true);
33970           select_default2(window).on("click.draw-block", null);
33971         }, 500);
33972         click(d3_event, p2);
33973       }
33974     }
33975     function pointermove(d3_event) {
33976       if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse") && !_downPointer.isCancelled) {
33977         var p2 = _downPointer.pointerLocGetter(d3_event);
33978         var dist = geoVecLength(_downPointer.downLoc, p2);
33979         if (dist >= _closeTolerance) {
33980           _downPointer.isCancelled = true;
33981           dispatch14.call("downcancel", this);
33982         }
33983       }
33984       if (d3_event.pointerType && d3_event.pointerType !== "mouse" || d3_event.buttons || _downPointer)
33985         return;
33986       if (_lastPointerUpEvent && _lastPointerUpEvent.pointerType !== "mouse" && d3_event.timeStamp - _lastPointerUpEvent.timeStamp < 100)
33987         return;
33988       _lastMouse = d3_event;
33989       dispatch14.call("move", this, d3_event, datum2(d3_event));
33990     }
33991     function pointercancel(d3_event) {
33992       if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse")) {
33993         if (!_downPointer.isCancelled) {
33994           dispatch14.call("downcancel", this);
33995         }
33996         _downPointer = null;
33997       }
33998     }
33999     function mouseenter() {
34000       _mouseLeave = false;
34001     }
34002     function mouseleave() {
34003       _mouseLeave = true;
34004     }
34005     function allowsVertex(d2) {
34006       return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
34007     }
34008     function click(d3_event, loc) {
34009       var d2 = datum2(d3_event);
34010       var target = d2 && d2.properties && d2.properties.entity;
34011       var mode = context.mode();
34012       if (target && target.type === "node" && allowsVertex(target)) {
34013         dispatch14.call("clickNode", this, target, d2);
34014         return;
34015       } else if (target && target.type === "way" && (mode.id !== "add-point" || mode.preset.matchGeometry("vertex"))) {
34016         var choice = geoChooseEdge(
34017           context.graph().childNodes(target),
34018           loc,
34019           context.projection,
34020           context.activeID()
34021         );
34022         if (choice) {
34023           var edge = [target.nodes[choice.index - 1], target.nodes[choice.index]];
34024           dispatch14.call("clickWay", this, choice.loc, edge, d2);
34025           return;
34026         }
34027       } else if (mode.id !== "add-point" || mode.preset.matchGeometry("point")) {
34028         var locLatLng = context.projection.invert(loc);
34029         dispatch14.call("click", this, locLatLng, d2);
34030       }
34031     }
34032     function space(d3_event) {
34033       d3_event.preventDefault();
34034       d3_event.stopPropagation();
34035       var currSpace = context.map().mouse();
34036       if (_disableSpace && _lastSpace) {
34037         var dist = geoVecLength(_lastSpace, currSpace);
34038         if (dist > _tolerance) {
34039           _disableSpace = false;
34040         }
34041       }
34042       if (_disableSpace || _mouseLeave || !_lastMouse)
34043         return;
34044       _lastSpace = currSpace;
34045       _disableSpace = true;
34046       select_default2(window).on("keyup.space-block", function() {
34047         d3_event.preventDefault();
34048         d3_event.stopPropagation();
34049         _disableSpace = false;
34050         select_default2(window).on("keyup.space-block", null);
34051       });
34052       var loc = context.map().mouse() || // or the map center if the mouse has never entered the map
34053       context.projection(context.map().center());
34054       click(d3_event, loc);
34055     }
34056     function backspace(d3_event) {
34057       d3_event.preventDefault();
34058       dispatch14.call("undo");
34059     }
34060     function del(d3_event) {
34061       d3_event.preventDefault();
34062       dispatch14.call("cancel");
34063     }
34064     function ret(d3_event) {
34065       d3_event.preventDefault();
34066       dispatch14.call("finish");
34067     }
34068     function behavior(selection2) {
34069       context.install(_hover);
34070       context.install(_edit);
34071       _downPointer = null;
34072       keybinding.on("\u232B", backspace).on("\u2326", del).on("\u238B", ret).on("\u21A9", ret).on("space", space).on("\u2325space", space);
34073       selection2.on("mouseenter.draw", mouseenter).on("mouseleave.draw", mouseleave).on(_pointerPrefix + "down.draw", pointerdown).on(_pointerPrefix + "move.draw", pointermove);
34074       select_default2(window).on(_pointerPrefix + "up.draw", pointerup, true).on("pointercancel.draw", pointercancel, true);
34075       select_default2(document).call(keybinding);
34076       return behavior;
34077     }
34078     behavior.off = function(selection2) {
34079       context.ui().sidebar.hover.cancel();
34080       context.uninstall(_hover);
34081       context.uninstall(_edit);
34082       selection2.on("mouseenter.draw", null).on("mouseleave.draw", null).on(_pointerPrefix + "down.draw", null).on(_pointerPrefix + "move.draw", null);
34083       select_default2(window).on(_pointerPrefix + "up.draw", null).on("pointercancel.draw", null);
34084       select_default2(document).call(keybinding.unbind);
34085     };
34086     behavior.hover = function() {
34087       return _hover;
34088     };
34089     return utilRebind(behavior, dispatch14, "on");
34090   }
34091
34092   // modules/behavior/breathe.js
34093   var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
34094
34095   // node_modules/d3-scale/src/init.js
34096   function initRange(domain2, range3) {
34097     switch (arguments.length) {
34098       case 0:
34099         break;
34100       case 1:
34101         this.range(domain2);
34102         break;
34103       default:
34104         this.range(range3).domain(domain2);
34105         break;
34106     }
34107     return this;
34108   }
34109
34110   // node_modules/d3-scale/src/constant.js
34111   function constants(x2) {
34112     return function() {
34113       return x2;
34114     };
34115   }
34116
34117   // node_modules/d3-scale/src/number.js
34118   function number2(x2) {
34119     return +x2;
34120   }
34121
34122   // node_modules/d3-scale/src/continuous.js
34123   var unit = [0, 1];
34124   function identity3(x2) {
34125     return x2;
34126   }
34127   function normalize(a2, b2) {
34128     return (b2 -= a2 = +a2) ? function(x2) {
34129       return (x2 - a2) / b2;
34130     } : constants(isNaN(b2) ? NaN : 0.5);
34131   }
34132   function clamper(a2, b2) {
34133     var t2;
34134     if (a2 > b2)
34135       t2 = a2, a2 = b2, b2 = t2;
34136     return function(x2) {
34137       return Math.max(a2, Math.min(b2, x2));
34138     };
34139   }
34140   function bimap(domain2, range3, interpolate) {
34141     var d0 = domain2[0], d1 = domain2[1], r0 = range3[0], r1 = range3[1];
34142     if (d1 < d0)
34143       d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
34144     else
34145       d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
34146     return function(x2) {
34147       return r0(d0(x2));
34148     };
34149   }
34150   function polymap(domain2, range3, interpolate) {
34151     var j3 = Math.min(domain2.length, range3.length) - 1, d2 = new Array(j3), r2 = new Array(j3), i3 = -1;
34152     if (domain2[j3] < domain2[0]) {
34153       domain2 = domain2.slice().reverse();
34154       range3 = range3.slice().reverse();
34155     }
34156     while (++i3 < j3) {
34157       d2[i3] = normalize(domain2[i3], domain2[i3 + 1]);
34158       r2[i3] = interpolate(range3[i3], range3[i3 + 1]);
34159     }
34160     return function(x2) {
34161       var i4 = bisect_default(domain2, x2, 1, j3) - 1;
34162       return r2[i4](d2[i4](x2));
34163     };
34164   }
34165   function copy(source, target) {
34166     return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown());
34167   }
34168   function transformer2() {
34169     var domain2 = unit, range3 = unit, interpolate = value_default, transform2, untransform, unknown, clamp3 = identity3, piecewise, output, input;
34170     function rescale() {
34171       var n3 = Math.min(domain2.length, range3.length);
34172       if (clamp3 !== identity3)
34173         clamp3 = clamper(domain2[0], domain2[n3 - 1]);
34174       piecewise = n3 > 2 ? polymap : bimap;
34175       output = input = null;
34176       return scale;
34177     }
34178     function scale(x2) {
34179       return x2 == null || isNaN(x2 = +x2) ? unknown : (output || (output = piecewise(domain2.map(transform2), range3, interpolate)))(transform2(clamp3(x2)));
34180     }
34181     scale.invert = function(y2) {
34182       return clamp3(untransform((input || (input = piecewise(range3, domain2.map(transform2), number_default)))(y2)));
34183     };
34184     scale.domain = function(_2) {
34185       return arguments.length ? (domain2 = Array.from(_2, number2), rescale()) : domain2.slice();
34186     };
34187     scale.range = function(_2) {
34188       return arguments.length ? (range3 = Array.from(_2), rescale()) : range3.slice();
34189     };
34190     scale.rangeRound = function(_2) {
34191       return range3 = Array.from(_2), interpolate = round_default, rescale();
34192     };
34193     scale.clamp = function(_2) {
34194       return arguments.length ? (clamp3 = _2 ? true : identity3, rescale()) : clamp3 !== identity3;
34195     };
34196     scale.interpolate = function(_2) {
34197       return arguments.length ? (interpolate = _2, rescale()) : interpolate;
34198     };
34199     scale.unknown = function(_2) {
34200       return arguments.length ? (unknown = _2, scale) : unknown;
34201     };
34202     return function(t2, u2) {
34203       transform2 = t2, untransform = u2;
34204       return rescale();
34205     };
34206   }
34207   function continuous() {
34208     return transformer2()(identity3, identity3);
34209   }
34210
34211   // node_modules/d3-format/src/formatDecimal.js
34212   function formatDecimal_default(x2) {
34213     return Math.abs(x2 = Math.round(x2)) >= 1e21 ? x2.toLocaleString("en").replace(/,/g, "") : x2.toString(10);
34214   }
34215   function formatDecimalParts(x2, p2) {
34216     if ((i3 = (x2 = p2 ? x2.toExponential(p2 - 1) : x2.toExponential()).indexOf("e")) < 0)
34217       return null;
34218     var i3, coefficient = x2.slice(0, i3);
34219     return [
34220       coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
34221       +x2.slice(i3 + 1)
34222     ];
34223   }
34224
34225   // node_modules/d3-format/src/exponent.js
34226   function exponent_default(x2) {
34227     return x2 = formatDecimalParts(Math.abs(x2)), x2 ? x2[1] : NaN;
34228   }
34229
34230   // node_modules/d3-format/src/formatGroup.js
34231   function formatGroup_default(grouping, thousands) {
34232     return function(value, width) {
34233       var i3 = value.length, t2 = [], j3 = 0, g3 = grouping[0], length = 0;
34234       while (i3 > 0 && g3 > 0) {
34235         if (length + g3 + 1 > width)
34236           g3 = Math.max(1, width - length);
34237         t2.push(value.substring(i3 -= g3, i3 + g3));
34238         if ((length += g3 + 1) > width)
34239           break;
34240         g3 = grouping[j3 = (j3 + 1) % grouping.length];
34241       }
34242       return t2.reverse().join(thousands);
34243     };
34244   }
34245
34246   // node_modules/d3-format/src/formatNumerals.js
34247   function formatNumerals_default(numerals) {
34248     return function(value) {
34249       return value.replace(/[0-9]/g, function(i3) {
34250         return numerals[+i3];
34251       });
34252     };
34253   }
34254
34255   // node_modules/d3-format/src/formatSpecifier.js
34256   var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
34257   function formatSpecifier(specifier) {
34258     if (!(match = re.exec(specifier)))
34259       throw new Error("invalid format: " + specifier);
34260     var match;
34261     return new FormatSpecifier({
34262       fill: match[1],
34263       align: match[2],
34264       sign: match[3],
34265       symbol: match[4],
34266       zero: match[5],
34267       width: match[6],
34268       comma: match[7],
34269       precision: match[8] && match[8].slice(1),
34270       trim: match[9],
34271       type: match[10]
34272     });
34273   }
34274   formatSpecifier.prototype = FormatSpecifier.prototype;
34275   function FormatSpecifier(specifier) {
34276     this.fill = specifier.fill === void 0 ? " " : specifier.fill + "";
34277     this.align = specifier.align === void 0 ? ">" : specifier.align + "";
34278     this.sign = specifier.sign === void 0 ? "-" : specifier.sign + "";
34279     this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + "";
34280     this.zero = !!specifier.zero;
34281     this.width = specifier.width === void 0 ? void 0 : +specifier.width;
34282     this.comma = !!specifier.comma;
34283     this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision;
34284     this.trim = !!specifier.trim;
34285     this.type = specifier.type === void 0 ? "" : specifier.type + "";
34286   }
34287   FormatSpecifier.prototype.toString = function() {
34288     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;
34289   };
34290
34291   // node_modules/d3-format/src/formatTrim.js
34292   function formatTrim_default(s2) {
34293     out:
34294       for (var n3 = s2.length, i3 = 1, i0 = -1, i1; i3 < n3; ++i3) {
34295         switch (s2[i3]) {
34296           case ".":
34297             i0 = i1 = i3;
34298             break;
34299           case "0":
34300             if (i0 === 0)
34301               i0 = i3;
34302             i1 = i3;
34303             break;
34304           default:
34305             if (!+s2[i3])
34306               break out;
34307             if (i0 > 0)
34308               i0 = 0;
34309             break;
34310         }
34311       }
34312     return i0 > 0 ? s2.slice(0, i0) + s2.slice(i1 + 1) : s2;
34313   }
34314
34315   // node_modules/d3-format/src/formatPrefixAuto.js
34316   var prefixExponent;
34317   function formatPrefixAuto_default(x2, p2) {
34318     var d2 = formatDecimalParts(x2, p2);
34319     if (!d2)
34320       return x2 + "";
34321     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;
34322     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];
34323   }
34324
34325   // node_modules/d3-format/src/formatRounded.js
34326   function formatRounded_default(x2, p2) {
34327     var d2 = formatDecimalParts(x2, p2);
34328     if (!d2)
34329       return x2 + "";
34330     var coefficient = d2[0], exponent = d2[1];
34331     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");
34332   }
34333
34334   // node_modules/d3-format/src/formatTypes.js
34335   var formatTypes_default = {
34336     "%": (x2, p2) => (x2 * 100).toFixed(p2),
34337     "b": (x2) => Math.round(x2).toString(2),
34338     "c": (x2) => x2 + "",
34339     "d": formatDecimal_default,
34340     "e": (x2, p2) => x2.toExponential(p2),
34341     "f": (x2, p2) => x2.toFixed(p2),
34342     "g": (x2, p2) => x2.toPrecision(p2),
34343     "o": (x2) => Math.round(x2).toString(8),
34344     "p": (x2, p2) => formatRounded_default(x2 * 100, p2),
34345     "r": formatRounded_default,
34346     "s": formatPrefixAuto_default,
34347     "X": (x2) => Math.round(x2).toString(16).toUpperCase(),
34348     "x": (x2) => Math.round(x2).toString(16)
34349   };
34350
34351   // node_modules/d3-format/src/identity.js
34352   function identity_default3(x2) {
34353     return x2;
34354   }
34355
34356   // node_modules/d3-format/src/locale.js
34357   var map = Array.prototype.map;
34358   var prefixes = ["y", "z", "a", "f", "p", "n", "\xB5", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
34359   function locale_default(locale2) {
34360     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 + "";
34361     function newFormat(specifier) {
34362       specifier = formatSpecifier(specifier);
34363       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;
34364       if (type2 === "n")
34365         comma = true, type2 = "g";
34366       else if (!formatTypes_default[type2])
34367         precision2 === void 0 && (precision2 = 12), trim = true, type2 = "g";
34368       if (zero3 || fill === "0" && align === "=")
34369         zero3 = true, fill = "0", align = "=";
34370       var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type2) ? "0" + type2.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type2) ? percent : "";
34371       var formatType = formatTypes_default[type2], maybeSuffix = /[defgprs%]/.test(type2);
34372       precision2 = precision2 === void 0 ? 6 : /[gprs]/.test(type2) ? Math.max(1, Math.min(21, precision2)) : Math.max(0, Math.min(20, precision2));
34373       function format2(value) {
34374         var valuePrefix = prefix, valueSuffix = suffix, i3, n3, c2;
34375         if (type2 === "c") {
34376           valueSuffix = formatType(value) + valueSuffix;
34377           value = "";
34378         } else {
34379           value = +value;
34380           var valueNegative = value < 0 || 1 / value < 0;
34381           value = isNaN(value) ? nan : formatType(Math.abs(value), precision2);
34382           if (trim)
34383             value = formatTrim_default(value);
34384           if (valueNegative && +value === 0 && sign2 !== "+")
34385             valueNegative = false;
34386           valuePrefix = (valueNegative ? sign2 === "(" ? sign2 : minus : sign2 === "-" || sign2 === "(" ? "" : sign2) + valuePrefix;
34387           valueSuffix = (type2 === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign2 === "(" ? ")" : "");
34388           if (maybeSuffix) {
34389             i3 = -1, n3 = value.length;
34390             while (++i3 < n3) {
34391               if (c2 = value.charCodeAt(i3), 48 > c2 || c2 > 57) {
34392                 valueSuffix = (c2 === 46 ? decimal + value.slice(i3 + 1) : value.slice(i3)) + valueSuffix;
34393                 value = value.slice(0, i3);
34394                 break;
34395               }
34396             }
34397           }
34398         }
34399         if (comma && !zero3)
34400           value = group(value, Infinity);
34401         var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : "";
34402         if (comma && zero3)
34403           value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
34404         switch (align) {
34405           case "<":
34406             value = valuePrefix + value + valueSuffix + padding;
34407             break;
34408           case "=":
34409             value = valuePrefix + padding + value + valueSuffix;
34410             break;
34411           case "^":
34412             value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length);
34413             break;
34414           default:
34415             value = padding + valuePrefix + value + valueSuffix;
34416             break;
34417         }
34418         return numerals(value);
34419       }
34420       format2.toString = function() {
34421         return specifier + "";
34422       };
34423       return format2;
34424     }
34425     function formatPrefix2(specifier, value) {
34426       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];
34427       return function(value2) {
34428         return f3(k2 * value2) + prefix;
34429       };
34430     }
34431     return {
34432       format: newFormat,
34433       formatPrefix: formatPrefix2
34434     };
34435   }
34436
34437   // node_modules/d3-format/src/defaultLocale.js
34438   var locale;
34439   var format;
34440   var formatPrefix;
34441   defaultLocale({
34442     thousands: ",",
34443     grouping: [3],
34444     currency: ["$", ""]
34445   });
34446   function defaultLocale(definition) {
34447     locale = locale_default(definition);
34448     format = locale.format;
34449     formatPrefix = locale.formatPrefix;
34450     return locale;
34451   }
34452
34453   // node_modules/d3-format/src/precisionFixed.js
34454   function precisionFixed_default(step) {
34455     return Math.max(0, -exponent_default(Math.abs(step)));
34456   }
34457
34458   // node_modules/d3-format/src/precisionPrefix.js
34459   function precisionPrefix_default(step, value) {
34460     return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3 - exponent_default(Math.abs(step)));
34461   }
34462
34463   // node_modules/d3-format/src/precisionRound.js
34464   function precisionRound_default(step, max3) {
34465     step = Math.abs(step), max3 = Math.abs(max3) - step;
34466     return Math.max(0, exponent_default(max3) - exponent_default(step)) + 1;
34467   }
34468
34469   // node_modules/d3-scale/src/tickFormat.js
34470   function tickFormat(start2, stop, count, specifier) {
34471     var step = tickStep(start2, stop, count), precision2;
34472     specifier = formatSpecifier(specifier == null ? ",f" : specifier);
34473     switch (specifier.type) {
34474       case "s": {
34475         var value = Math.max(Math.abs(start2), Math.abs(stop));
34476         if (specifier.precision == null && !isNaN(precision2 = precisionPrefix_default(step, value)))
34477           specifier.precision = precision2;
34478         return formatPrefix(specifier, value);
34479       }
34480       case "":
34481       case "e":
34482       case "g":
34483       case "p":
34484       case "r": {
34485         if (specifier.precision == null && !isNaN(precision2 = precisionRound_default(step, Math.max(Math.abs(start2), Math.abs(stop)))))
34486           specifier.precision = precision2 - (specifier.type === "e");
34487         break;
34488       }
34489       case "f":
34490       case "%": {
34491         if (specifier.precision == null && !isNaN(precision2 = precisionFixed_default(step)))
34492           specifier.precision = precision2 - (specifier.type === "%") * 2;
34493         break;
34494       }
34495     }
34496     return format(specifier);
34497   }
34498
34499   // node_modules/d3-scale/src/linear.js
34500   function linearish(scale) {
34501     var domain2 = scale.domain;
34502     scale.ticks = function(count) {
34503       var d2 = domain2();
34504       return ticks(d2[0], d2[d2.length - 1], count == null ? 10 : count);
34505     };
34506     scale.tickFormat = function(count, specifier) {
34507       var d2 = domain2();
34508       return tickFormat(d2[0], d2[d2.length - 1], count == null ? 10 : count, specifier);
34509     };
34510     scale.nice = function(count) {
34511       if (count == null)
34512         count = 10;
34513       var d2 = domain2();
34514       var i0 = 0;
34515       var i1 = d2.length - 1;
34516       var start2 = d2[i0];
34517       var stop = d2[i1];
34518       var prestep;
34519       var step;
34520       var maxIter = 10;
34521       if (stop < start2) {
34522         step = start2, start2 = stop, stop = step;
34523         step = i0, i0 = i1, i1 = step;
34524       }
34525       while (maxIter-- > 0) {
34526         step = tickIncrement(start2, stop, count);
34527         if (step === prestep) {
34528           d2[i0] = start2;
34529           d2[i1] = stop;
34530           return domain2(d2);
34531         } else if (step > 0) {
34532           start2 = Math.floor(start2 / step) * step;
34533           stop = Math.ceil(stop / step) * step;
34534         } else if (step < 0) {
34535           start2 = Math.ceil(start2 * step) / step;
34536           stop = Math.floor(stop * step) / step;
34537         } else {
34538           break;
34539         }
34540         prestep = step;
34541       }
34542       return scale;
34543     };
34544     return scale;
34545   }
34546   function linear3() {
34547     var scale = continuous();
34548     scale.copy = function() {
34549       return copy(scale, linear3());
34550     };
34551     initRange.apply(scale, arguments);
34552     return linearish(scale);
34553   }
34554
34555   // node_modules/d3-scale/src/quantize.js
34556   function quantize() {
34557     var x05 = 0, x12 = 1, n3 = 1, domain2 = [0.5], range3 = [0, 1], unknown;
34558     function scale(x2) {
34559       return x2 != null && x2 <= x2 ? range3[bisect_default(domain2, x2, 0, n3)] : unknown;
34560     }
34561     function rescale() {
34562       var i3 = -1;
34563       domain2 = new Array(n3);
34564       while (++i3 < n3)
34565         domain2[i3] = ((i3 + 1) * x12 - (i3 - n3) * x05) / (n3 + 1);
34566       return scale;
34567     }
34568     scale.domain = function(_2) {
34569       return arguments.length ? ([x05, x12] = _2, x05 = +x05, x12 = +x12, rescale()) : [x05, x12];
34570     };
34571     scale.range = function(_2) {
34572       return arguments.length ? (n3 = (range3 = Array.from(_2)).length - 1, rescale()) : range3.slice();
34573     };
34574     scale.invertExtent = function(y2) {
34575       var i3 = range3.indexOf(y2);
34576       return i3 < 0 ? [NaN, NaN] : i3 < 1 ? [x05, domain2[0]] : i3 >= n3 ? [domain2[n3 - 1], x12] : [domain2[i3 - 1], domain2[i3]];
34577     };
34578     scale.unknown = function(_2) {
34579       return arguments.length ? (unknown = _2, scale) : scale;
34580     };
34581     scale.thresholds = function() {
34582       return domain2.slice();
34583     };
34584     scale.copy = function() {
34585       return quantize().domain([x05, x12]).range(range3).unknown(unknown);
34586     };
34587     return initRange.apply(linearish(scale), arguments);
34588   }
34589
34590   // modules/behavior/breathe.js
34591   function behaviorBreathe() {
34592     var duration = 800;
34593     var steps = 4;
34594     var selector = ".selected.shadow, .selected .shadow";
34595     var _selected = select_default2(null);
34596     var _classed = "";
34597     var _params = {};
34598     var _done = false;
34599     var _timer;
34600     function ratchetyInterpolator(a2, b2, steps2, units) {
34601       a2 = Number(a2);
34602       b2 = Number(b2);
34603       var sample = quantize().domain([0, 1]).range(quantize_default(number_default(a2, b2), steps2));
34604       return function(t2) {
34605         return String(sample(t2)) + (units || "");
34606       };
34607     }
34608     function reset(selection2) {
34609       selection2.style("stroke-opacity", null).style("stroke-width", null).style("fill-opacity", null).style("r", null);
34610     }
34611     function setAnimationParams(transition2, fromTo) {
34612       var toFrom = fromTo === "from" ? "to" : "from";
34613       transition2.styleTween("stroke-opacity", function(d2) {
34614         return ratchetyInterpolator(
34615           _params[d2.id][toFrom].opacity,
34616           _params[d2.id][fromTo].opacity,
34617           steps
34618         );
34619       }).styleTween("stroke-width", function(d2) {
34620         return ratchetyInterpolator(
34621           _params[d2.id][toFrom].width,
34622           _params[d2.id][fromTo].width,
34623           steps,
34624           "px"
34625         );
34626       }).styleTween("fill-opacity", function(d2) {
34627         return ratchetyInterpolator(
34628           _params[d2.id][toFrom].opacity,
34629           _params[d2.id][fromTo].opacity,
34630           steps
34631         );
34632       }).styleTween("r", function(d2) {
34633         return ratchetyInterpolator(
34634           _params[d2.id][toFrom].width,
34635           _params[d2.id][fromTo].width,
34636           steps,
34637           "px"
34638         );
34639       });
34640     }
34641     function calcAnimationParams(selection2) {
34642       selection2.call(reset).each(function(d2) {
34643         var s2 = select_default2(this);
34644         var tag = s2.node().tagName;
34645         var p2 = { "from": {}, "to": {} };
34646         var opacity;
34647         var width;
34648         if (tag === "circle") {
34649           opacity = Number(s2.style("fill-opacity") || 0.5);
34650           width = Number(s2.style("r") || 15.5);
34651         } else {
34652           opacity = Number(s2.style("stroke-opacity") || 0.7);
34653           width = Number(s2.style("stroke-width") || 10);
34654         }
34655         p2.tag = tag;
34656         p2.from.opacity = opacity * 0.6;
34657         p2.to.opacity = opacity * 1.25;
34658         p2.from.width = width * 0.7;
34659         p2.to.width = width * (tag === "circle" ? 1.5 : 1);
34660         _params[d2.id] = p2;
34661       });
34662     }
34663     function run(surface, fromTo) {
34664       var toFrom = fromTo === "from" ? "to" : "from";
34665       var currSelected = surface.selectAll(selector);
34666       var currClassed = surface.attr("class");
34667       if (_done || currSelected.empty()) {
34668         _selected.call(reset);
34669         _selected = select_default2(null);
34670         return;
34671       }
34672       if (!(0, import_fast_deep_equal2.default)(currSelected.data(), _selected.data()) || currClassed !== _classed) {
34673         _selected.call(reset);
34674         _classed = currClassed;
34675         _selected = currSelected.call(calcAnimationParams);
34676       }
34677       var didCallNextRun = false;
34678       _selected.transition().duration(duration).call(setAnimationParams, fromTo).on("end", function() {
34679         if (!didCallNextRun) {
34680           surface.call(run, toFrom);
34681           didCallNextRun = true;
34682         }
34683         if (!select_default2(this).classed("selected")) {
34684           reset(select_default2(this));
34685         }
34686       });
34687     }
34688     function behavior(surface) {
34689       _done = false;
34690       _timer = timer(function() {
34691         if (surface.selectAll(selector).empty()) {
34692           return false;
34693         }
34694         surface.call(run, "from");
34695         _timer.stop();
34696         return true;
34697       }, 20);
34698     }
34699     behavior.restartIfNeeded = function(surface) {
34700       if (_selected.empty()) {
34701         surface.call(run, "from");
34702         if (_timer) {
34703           _timer.stop();
34704         }
34705       }
34706     };
34707     behavior.off = function() {
34708       _done = true;
34709       if (_timer) {
34710         _timer.stop();
34711       }
34712       _selected.interrupt().call(reset);
34713     };
34714     return behavior;
34715   }
34716
34717   // modules/behavior/operation.js
34718   function behaviorOperation(context) {
34719     var _operation;
34720     function keypress(d3_event) {
34721       if (!context.map().withinEditableZoom())
34722         return;
34723       if (_operation.availableForKeypress && !_operation.availableForKeypress())
34724         return;
34725       d3_event.preventDefault();
34726       var disabled = _operation.disabled();
34727       if (disabled) {
34728         context.ui().flash.duration(4e3).iconName("#iD-operation-" + _operation.id).iconClass("operation disabled").label(_operation.tooltip())();
34729       } else {
34730         context.ui().flash.duration(2e3).iconName("#iD-operation-" + _operation.id).iconClass("operation").label(_operation.annotation() || _operation.title)();
34731         if (_operation.point)
34732           _operation.point(null);
34733         _operation();
34734       }
34735     }
34736     function behavior() {
34737       if (_operation && _operation.available()) {
34738         context.keybinding().on(_operation.keys, keypress);
34739       }
34740       return behavior;
34741     }
34742     behavior.off = function() {
34743       context.keybinding().off(_operation.keys);
34744     };
34745     behavior.which = function(_2) {
34746       if (!arguments.length)
34747         return _operation;
34748       _operation = _2;
34749       return behavior;
34750     };
34751     return behavior;
34752   }
34753
34754   // modules/operations/circularize.js
34755   function operationCircularize(context, selectedIDs) {
34756     var _extent;
34757     var _actions = selectedIDs.map(getAction).filter(Boolean);
34758     var _amount = _actions.length === 1 ? "single" : "multiple";
34759     var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n3) {
34760       return n3.loc;
34761     });
34762     function getAction(entityID) {
34763       var entity = context.entity(entityID);
34764       if (entity.type !== "way" || new Set(entity.nodes).size <= 1)
34765         return null;
34766       if (!_extent) {
34767         _extent = entity.extent(context.graph());
34768       } else {
34769         _extent = _extent.extend(entity.extent(context.graph()));
34770       }
34771       return actionCircularize(entityID, context.projection);
34772     }
34773     var operation = function() {
34774       if (!_actions.length)
34775         return;
34776       var combinedAction = function(graph, t2) {
34777         _actions.forEach(function(action) {
34778           if (!action.disabled(graph)) {
34779             graph = action(graph, t2);
34780           }
34781         });
34782         return graph;
34783       };
34784       combinedAction.transitionable = true;
34785       context.perform(combinedAction, operation.annotation());
34786       window.setTimeout(function() {
34787         context.validator().validate();
34788       }, 300);
34789     };
34790     operation.available = function() {
34791       return _actions.length && selectedIDs.length === _actions.length;
34792     };
34793     operation.disabled = function() {
34794       if (!_actions.length)
34795         return "";
34796       var actionDisableds = _actions.map(function(action) {
34797         return action.disabled(context.graph());
34798       }).filter(Boolean);
34799       if (actionDisableds.length === _actions.length) {
34800         if (new Set(actionDisableds).size > 1) {
34801           return "multiple_blockers";
34802         }
34803         return actionDisableds[0];
34804       } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
34805         return "too_large";
34806       } else if (someMissing()) {
34807         return "not_downloaded";
34808       } else if (selectedIDs.some(context.hasHiddenConnections)) {
34809         return "connected_to_hidden";
34810       }
34811       return false;
34812       function someMissing() {
34813         if (context.inIntro())
34814           return false;
34815         var osm = context.connection();
34816         if (osm) {
34817           var missing = _coords.filter(function(loc) {
34818             return !osm.isDataLoaded(loc);
34819           });
34820           if (missing.length) {
34821             missing.forEach(function(loc) {
34822               context.loadTileAtLoc(loc);
34823             });
34824             return true;
34825           }
34826         }
34827         return false;
34828       }
34829     };
34830     operation.tooltip = function() {
34831       var disable = operation.disabled();
34832       return disable ? _t.append("operations.circularize." + disable + "." + _amount) : _t.append("operations.circularize.description." + _amount);
34833     };
34834     operation.annotation = function() {
34835       return _t("operations.circularize.annotation.feature", { n: _actions.length });
34836     };
34837     operation.id = "circularize";
34838     operation.keys = [_t("operations.circularize.key")];
34839     operation.title = _t.append("operations.circularize.title");
34840     operation.behavior = behaviorOperation(context).which(operation);
34841     return operation;
34842   }
34843
34844   // modules/ui/cmd.js
34845   var uiCmd = function(code) {
34846     var detected = utilDetect();
34847     if (detected.os === "mac") {
34848       return code;
34849     }
34850     if (detected.os === "win") {
34851       if (code === "\u2318\u21E7Z")
34852         return "Ctrl+Y";
34853     }
34854     var result = "", replacements = {
34855       "\u2318": "Ctrl",
34856       "\u21E7": "Shift",
34857       "\u2325": "Alt",
34858       "\u232B": "Backspace",
34859       "\u2326": "Delete"
34860     };
34861     for (var i3 = 0; i3 < code.length; i3++) {
34862       if (code[i3] in replacements) {
34863         result += replacements[code[i3]] + (i3 < code.length - 1 ? "+" : "");
34864       } else {
34865         result += code[i3];
34866       }
34867     }
34868     return result;
34869   };
34870   uiCmd.display = function(code) {
34871     if (code.length !== 1)
34872       return code;
34873     var detected = utilDetect();
34874     var mac = detected.os === "mac";
34875     var replacements = {
34876       "\u2318": mac ? "\u2318 " + _t("shortcuts.key.cmd") : _t("shortcuts.key.ctrl"),
34877       "\u21E7": mac ? "\u21E7 " + _t("shortcuts.key.shift") : _t("shortcuts.key.shift"),
34878       "\u2325": mac ? "\u2325 " + _t("shortcuts.key.option") : _t("shortcuts.key.alt"),
34879       "\u2303": mac ? "\u2303 " + _t("shortcuts.key.ctrl") : _t("shortcuts.key.ctrl"),
34880       "\u232B": mac ? "\u232B " + _t("shortcuts.key.delete") : _t("shortcuts.key.backspace"),
34881       "\u2326": mac ? "\u2326 " + _t("shortcuts.key.del") : _t("shortcuts.key.del"),
34882       "\u2196": mac ? "\u2196 " + _t("shortcuts.key.pgup") : _t("shortcuts.key.pgup"),
34883       "\u2198": mac ? "\u2198 " + _t("shortcuts.key.pgdn") : _t("shortcuts.key.pgdn"),
34884       "\u21DE": mac ? "\u21DE " + _t("shortcuts.key.home") : _t("shortcuts.key.home"),
34885       "\u21DF": mac ? "\u21DF " + _t("shortcuts.key.end") : _t("shortcuts.key.end"),
34886       "\u21B5": mac ? "\u23CE " + _t("shortcuts.key.return") : _t("shortcuts.key.enter"),
34887       "\u238B": mac ? "\u238B " + _t("shortcuts.key.esc") : _t("shortcuts.key.esc"),
34888       "\u2630": mac ? "\u2630 " + _t("shortcuts.key.menu") : _t("shortcuts.key.menu")
34889     };
34890     return replacements[code] || code;
34891   };
34892
34893   // modules/operations/delete.js
34894   function operationDelete(context, selectedIDs) {
34895     var multi = selectedIDs.length === 1 ? "single" : "multiple";
34896     var action = actionDeleteMultiple(selectedIDs);
34897     var nodes = utilGetAllNodes(selectedIDs, context.graph());
34898     var coords = nodes.map(function(n3) {
34899       return n3.loc;
34900     });
34901     var extent = utilTotalExtent(selectedIDs, context.graph());
34902     var operation = function() {
34903       var nextSelectedID;
34904       var nextSelectedLoc;
34905       if (selectedIDs.length === 1) {
34906         var id2 = selectedIDs[0];
34907         var entity = context.entity(id2);
34908         var geometry = entity.geometry(context.graph());
34909         var parents = context.graph().parentWays(entity);
34910         var parent = parents[0];
34911         if (geometry === "vertex") {
34912           var nodes2 = parent.nodes;
34913           var i3 = nodes2.indexOf(id2);
34914           if (i3 === 0) {
34915             i3++;
34916           } else if (i3 === nodes2.length - 1) {
34917             i3--;
34918           } else {
34919             var a2 = geoSphericalDistance(entity.loc, context.entity(nodes2[i3 - 1]).loc);
34920             var b2 = geoSphericalDistance(entity.loc, context.entity(nodes2[i3 + 1]).loc);
34921             i3 = a2 < b2 ? i3 - 1 : i3 + 1;
34922           }
34923           nextSelectedID = nodes2[i3];
34924           nextSelectedLoc = context.entity(nextSelectedID).loc;
34925         }
34926       }
34927       context.perform(action, operation.annotation());
34928       context.validator().validate();
34929       if (nextSelectedID && nextSelectedLoc) {
34930         if (context.hasEntity(nextSelectedID)) {
34931           context.enter(modeSelect(context, [nextSelectedID]).follow(true));
34932         } else {
34933           context.map().centerEase(nextSelectedLoc);
34934           context.enter(modeBrowse(context));
34935         }
34936       } else {
34937         context.enter(modeBrowse(context));
34938       }
34939     };
34940     operation.available = function() {
34941       return true;
34942     };
34943     operation.disabled = function() {
34944       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
34945         return "too_large";
34946       } else if (someMissing()) {
34947         return "not_downloaded";
34948       } else if (selectedIDs.some(context.hasHiddenConnections)) {
34949         return "connected_to_hidden";
34950       } else if (selectedIDs.some(protectedMember)) {
34951         return "part_of_relation";
34952       } else if (selectedIDs.some(incompleteRelation)) {
34953         return "incomplete_relation";
34954       } else if (selectedIDs.some(hasWikidataTag)) {
34955         return "has_wikidata_tag";
34956       }
34957       return false;
34958       function someMissing() {
34959         if (context.inIntro())
34960           return false;
34961         var osm = context.connection();
34962         if (osm) {
34963           var missing = coords.filter(function(loc) {
34964             return !osm.isDataLoaded(loc);
34965           });
34966           if (missing.length) {
34967             missing.forEach(function(loc) {
34968               context.loadTileAtLoc(loc);
34969             });
34970             return true;
34971           }
34972         }
34973         return false;
34974       }
34975       function hasWikidataTag(id2) {
34976         var entity = context.entity(id2);
34977         return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
34978       }
34979       function incompleteRelation(id2) {
34980         var entity = context.entity(id2);
34981         return entity.type === "relation" && !entity.isComplete(context.graph());
34982       }
34983       function protectedMember(id2) {
34984         var entity = context.entity(id2);
34985         if (entity.type !== "way")
34986           return false;
34987         var parents = context.graph().parentRelations(entity);
34988         for (var i3 = 0; i3 < parents.length; i3++) {
34989           var parent = parents[i3];
34990           var type2 = parent.tags.type;
34991           var role = parent.memberById(id2).role || "outer";
34992           if (type2 === "route" || type2 === "boundary" || type2 === "multipolygon" && role === "outer") {
34993             return true;
34994           }
34995         }
34996         return false;
34997       }
34998     };
34999     operation.tooltip = function() {
35000       var disable = operation.disabled();
35001       return disable ? _t.append("operations.delete." + disable + "." + multi) : _t.append("operations.delete.description." + multi);
35002     };
35003     operation.annotation = function() {
35004       return selectedIDs.length === 1 ? _t("operations.delete.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.delete.annotation.feature", { n: selectedIDs.length });
35005     };
35006     operation.id = "delete";
35007     operation.keys = [uiCmd("\u2318\u232B"), uiCmd("\u2318\u2326"), uiCmd("\u2326")];
35008     operation.title = _t.append("operations.delete.title");
35009     operation.behavior = behaviorOperation(context).which(operation);
35010     return operation;
35011   }
35012
35013   // modules/operations/orthogonalize.js
35014   function operationOrthogonalize(context, selectedIDs) {
35015     var _extent;
35016     var _type;
35017     var _actions = selectedIDs.map(chooseAction).filter(Boolean);
35018     var _amount = _actions.length === 1 ? "single" : "multiple";
35019     var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n3) {
35020       return n3.loc;
35021     });
35022     function chooseAction(entityID) {
35023       var entity = context.entity(entityID);
35024       var geometry = entity.geometry(context.graph());
35025       if (!_extent) {
35026         _extent = entity.extent(context.graph());
35027       } else {
35028         _extent = _extent.extend(entity.extent(context.graph()));
35029       }
35030       if (entity.type === "way" && new Set(entity.nodes).size > 2) {
35031         if (_type && _type !== "feature")
35032           return null;
35033         _type = "feature";
35034         return actionOrthogonalize(entityID, context.projection);
35035       } else if (geometry === "vertex") {
35036         if (_type && _type !== "corner")
35037           return null;
35038         _type = "corner";
35039         var graph = context.graph();
35040         var parents = graph.parentWays(entity);
35041         if (parents.length === 1) {
35042           var way = parents[0];
35043           if (way.nodes.indexOf(entityID) !== -1) {
35044             return actionOrthogonalize(way.id, context.projection, entityID);
35045           }
35046         }
35047       }
35048       return null;
35049     }
35050     var operation = function() {
35051       if (!_actions.length)
35052         return;
35053       var combinedAction = function(graph, t2) {
35054         _actions.forEach(function(action) {
35055           if (!action.disabled(graph)) {
35056             graph = action(graph, t2);
35057           }
35058         });
35059         return graph;
35060       };
35061       combinedAction.transitionable = true;
35062       context.perform(combinedAction, operation.annotation());
35063       window.setTimeout(function() {
35064         context.validator().validate();
35065       }, 300);
35066     };
35067     operation.available = function() {
35068       return _actions.length && selectedIDs.length === _actions.length;
35069     };
35070     operation.disabled = function() {
35071       if (!_actions.length)
35072         return "";
35073       var actionDisableds = _actions.map(function(action) {
35074         return action.disabled(context.graph());
35075       }).filter(Boolean);
35076       if (actionDisableds.length === _actions.length) {
35077         if (new Set(actionDisableds).size > 1) {
35078           return "multiple_blockers";
35079         }
35080         return actionDisableds[0];
35081       } else if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
35082         return "too_large";
35083       } else if (someMissing()) {
35084         return "not_downloaded";
35085       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35086         return "connected_to_hidden";
35087       }
35088       return false;
35089       function someMissing() {
35090         if (context.inIntro())
35091           return false;
35092         var osm = context.connection();
35093         if (osm) {
35094           var missing = _coords.filter(function(loc) {
35095             return !osm.isDataLoaded(loc);
35096           });
35097           if (missing.length) {
35098             missing.forEach(function(loc) {
35099               context.loadTileAtLoc(loc);
35100             });
35101             return true;
35102           }
35103         }
35104         return false;
35105       }
35106     };
35107     operation.tooltip = function() {
35108       var disable = operation.disabled();
35109       return disable ? _t.append("operations.orthogonalize." + disable + "." + _amount) : _t.append("operations.orthogonalize.description." + _type + "." + _amount);
35110     };
35111     operation.annotation = function() {
35112       return _t("operations.orthogonalize.annotation." + _type, { n: _actions.length });
35113     };
35114     operation.id = "orthogonalize";
35115     operation.keys = [_t("operations.orthogonalize.key")];
35116     operation.title = _t.append("operations.orthogonalize.title");
35117     operation.behavior = behaviorOperation(context).which(operation);
35118     return operation;
35119   }
35120
35121   // modules/operations/reflect.js
35122   function operationReflectShort(context, selectedIDs) {
35123     return operationReflect(context, selectedIDs, "short");
35124   }
35125   function operationReflectLong(context, selectedIDs) {
35126     return operationReflect(context, selectedIDs, "long");
35127   }
35128   function operationReflect(context, selectedIDs, axis) {
35129     axis = axis || "long";
35130     var multi = selectedIDs.length === 1 ? "single" : "multiple";
35131     var nodes = utilGetAllNodes(selectedIDs, context.graph());
35132     var coords = nodes.map(function(n3) {
35133       return n3.loc;
35134     });
35135     var extent = utilTotalExtent(selectedIDs, context.graph());
35136     var operation = function() {
35137       var action = actionReflect(selectedIDs, context.projection).useLongAxis(Boolean(axis === "long"));
35138       context.perform(action, operation.annotation());
35139       window.setTimeout(function() {
35140         context.validator().validate();
35141       }, 300);
35142     };
35143     operation.available = function() {
35144       return nodes.length >= 3;
35145     };
35146     operation.disabled = function() {
35147       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
35148         return "too_large";
35149       } else if (someMissing()) {
35150         return "not_downloaded";
35151       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35152         return "connected_to_hidden";
35153       } else if (selectedIDs.some(incompleteRelation)) {
35154         return "incomplete_relation";
35155       }
35156       return false;
35157       function someMissing() {
35158         if (context.inIntro())
35159           return false;
35160         var osm = context.connection();
35161         if (osm) {
35162           var missing = coords.filter(function(loc) {
35163             return !osm.isDataLoaded(loc);
35164           });
35165           if (missing.length) {
35166             missing.forEach(function(loc) {
35167               context.loadTileAtLoc(loc);
35168             });
35169             return true;
35170           }
35171         }
35172         return false;
35173       }
35174       function incompleteRelation(id2) {
35175         var entity = context.entity(id2);
35176         return entity.type === "relation" && !entity.isComplete(context.graph());
35177       }
35178     };
35179     operation.tooltip = function() {
35180       var disable = operation.disabled();
35181       return disable ? _t.append("operations.reflect." + disable + "." + multi) : _t.append("operations.reflect.description." + axis + "." + multi);
35182     };
35183     operation.annotation = function() {
35184       return _t("operations.reflect.annotation." + axis + ".feature", { n: selectedIDs.length });
35185     };
35186     operation.id = "reflect-" + axis;
35187     operation.keys = [_t("operations.reflect.key." + axis)];
35188     operation.title = _t.append("operations.reflect.title." + axis);
35189     operation.behavior = behaviorOperation(context).which(operation);
35190     return operation;
35191   }
35192
35193   // modules/operations/move.js
35194   function operationMove(context, selectedIDs) {
35195     var multi = selectedIDs.length === 1 ? "single" : "multiple";
35196     var nodes = utilGetAllNodes(selectedIDs, context.graph());
35197     var coords = nodes.map(function(n3) {
35198       return n3.loc;
35199     });
35200     var extent = utilTotalExtent(selectedIDs, context.graph());
35201     var operation = function() {
35202       context.enter(modeMove(context, selectedIDs));
35203     };
35204     operation.available = function() {
35205       return selectedIDs.length > 0;
35206     };
35207     operation.disabled = function() {
35208       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
35209         return "too_large";
35210       } else if (someMissing()) {
35211         return "not_downloaded";
35212       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35213         return "connected_to_hidden";
35214       } else if (selectedIDs.some(incompleteRelation)) {
35215         return "incomplete_relation";
35216       }
35217       return false;
35218       function someMissing() {
35219         if (context.inIntro())
35220           return false;
35221         var osm = context.connection();
35222         if (osm) {
35223           var missing = coords.filter(function(loc) {
35224             return !osm.isDataLoaded(loc);
35225           });
35226           if (missing.length) {
35227             missing.forEach(function(loc) {
35228               context.loadTileAtLoc(loc);
35229             });
35230             return true;
35231           }
35232         }
35233         return false;
35234       }
35235       function incompleteRelation(id2) {
35236         var entity = context.entity(id2);
35237         return entity.type === "relation" && !entity.isComplete(context.graph());
35238       }
35239     };
35240     operation.tooltip = function() {
35241       var disable = operation.disabled();
35242       return disable ? _t.append("operations.move." + disable + "." + multi) : _t.append("operations.move.description." + multi);
35243     };
35244     operation.annotation = function() {
35245       return selectedIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.move.annotation.feature", { n: selectedIDs.length });
35246     };
35247     operation.id = "move";
35248     operation.keys = [_t("operations.move.key")];
35249     operation.title = _t.append("operations.move.title");
35250     operation.behavior = behaviorOperation(context).which(operation);
35251     operation.mouseOnly = true;
35252     return operation;
35253   }
35254
35255   // modules/modes/rotate.js
35256   function modeRotate(context, entityIDs) {
35257     var _tolerancePx = 4;
35258     var mode = {
35259       id: "rotate",
35260       button: "browse"
35261     };
35262     var keybinding = utilKeybinding("rotate");
35263     var behaviors = [
35264       behaviorEdit(context),
35265       operationCircularize(context, entityIDs).behavior,
35266       operationDelete(context, entityIDs).behavior,
35267       operationMove(context, entityIDs).behavior,
35268       operationOrthogonalize(context, entityIDs).behavior,
35269       operationReflectLong(context, entityIDs).behavior,
35270       operationReflectShort(context, entityIDs).behavior
35271     ];
35272     var annotation = entityIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.rotate.annotation.feature", { n: entityIDs.length });
35273     var _prevGraph;
35274     var _prevAngle;
35275     var _prevTransform;
35276     var _pivot;
35277     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
35278     function doRotate(d3_event) {
35279       var fn;
35280       if (context.graph() !== _prevGraph) {
35281         fn = context.perform;
35282       } else {
35283         fn = context.replace;
35284       }
35285       var projection2 = context.projection;
35286       var currTransform = projection2.transform();
35287       if (!_prevTransform || currTransform.k !== _prevTransform.k || currTransform.x !== _prevTransform.x || currTransform.y !== _prevTransform.y) {
35288         var nodes = utilGetAllNodes(entityIDs, context.graph());
35289         var points = nodes.map(function(n3) {
35290           return projection2(n3.loc);
35291         });
35292         _pivot = getPivot(points);
35293         _prevAngle = void 0;
35294       }
35295       var currMouse = context.map().mouse(d3_event);
35296       var currAngle = Math.atan2(currMouse[1] - _pivot[1], currMouse[0] - _pivot[0]);
35297       if (typeof _prevAngle === "undefined")
35298         _prevAngle = currAngle;
35299       var delta = currAngle - _prevAngle;
35300       fn(actionRotate(entityIDs, _pivot, delta, projection2));
35301       _prevTransform = currTransform;
35302       _prevAngle = currAngle;
35303       _prevGraph = context.graph();
35304     }
35305     function getPivot(points) {
35306       var _pivot2;
35307       if (points.length === 1) {
35308         _pivot2 = points[0];
35309       } else if (points.length === 2) {
35310         _pivot2 = geoVecInterp(points[0], points[1], 0.5);
35311       } else {
35312         var polygonHull = hull_default(points);
35313         if (polygonHull.length === 2) {
35314           _pivot2 = geoVecInterp(points[0], points[1], 0.5);
35315         } else {
35316           _pivot2 = centroid_default2(hull_default(points));
35317         }
35318       }
35319       return _pivot2;
35320     }
35321     function finish(d3_event) {
35322       d3_event.stopPropagation();
35323       context.replace(actionNoop(), annotation);
35324       context.enter(modeSelect(context, entityIDs));
35325     }
35326     function cancel() {
35327       if (_prevGraph)
35328         context.pop();
35329       context.enter(modeSelect(context, entityIDs));
35330     }
35331     function undone() {
35332       context.enter(modeBrowse(context));
35333     }
35334     mode.enter = function() {
35335       _prevGraph = null;
35336       context.features().forceVisible(entityIDs);
35337       behaviors.forEach(context.install);
35338       var downEvent;
35339       context.surface().on(_pointerPrefix + "down.modeRotate", function(d3_event) {
35340         downEvent = d3_event;
35341       });
35342       select_default2(window).on(_pointerPrefix + "move.modeRotate", doRotate, true).on(_pointerPrefix + "up.modeRotate", function(d3_event) {
35343         if (!downEvent)
35344           return;
35345         var mapNode = context.container().select(".main-map").node();
35346         var pointGetter = utilFastMouse(mapNode);
35347         var p1 = pointGetter(downEvent);
35348         var p2 = pointGetter(d3_event);
35349         var dist = geoVecLength(p1, p2);
35350         if (dist <= _tolerancePx)
35351           finish(d3_event);
35352         downEvent = null;
35353       }, true);
35354       context.history().on("undone.modeRotate", undone);
35355       keybinding.on("\u238B", cancel).on("\u21A9", finish);
35356       select_default2(document).call(keybinding);
35357     };
35358     mode.exit = function() {
35359       behaviors.forEach(context.uninstall);
35360       context.surface().on(_pointerPrefix + "down.modeRotate", null);
35361       select_default2(window).on(_pointerPrefix + "move.modeRotate", null, true).on(_pointerPrefix + "up.modeRotate", null, true);
35362       context.history().on("undone.modeRotate", null);
35363       select_default2(document).call(keybinding.unbind);
35364       context.features().forceVisible([]);
35365     };
35366     mode.selectedIDs = function() {
35367       if (!arguments.length)
35368         return entityIDs;
35369       return mode;
35370     };
35371     return mode;
35372   }
35373
35374   // modules/operations/rotate.js
35375   function operationRotate(context, selectedIDs) {
35376     var multi = selectedIDs.length === 1 ? "single" : "multiple";
35377     var nodes = utilGetAllNodes(selectedIDs, context.graph());
35378     var coords = nodes.map(function(n3) {
35379       return n3.loc;
35380     });
35381     var extent = utilTotalExtent(selectedIDs, context.graph());
35382     var operation = function() {
35383       context.enter(modeRotate(context, selectedIDs));
35384     };
35385     operation.available = function() {
35386       return nodes.length >= 2;
35387     };
35388     operation.disabled = function() {
35389       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
35390         return "too_large";
35391       } else if (someMissing()) {
35392         return "not_downloaded";
35393       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35394         return "connected_to_hidden";
35395       } else if (selectedIDs.some(incompleteRelation)) {
35396         return "incomplete_relation";
35397       }
35398       return false;
35399       function someMissing() {
35400         if (context.inIntro())
35401           return false;
35402         var osm = context.connection();
35403         if (osm) {
35404           var missing = coords.filter(function(loc) {
35405             return !osm.isDataLoaded(loc);
35406           });
35407           if (missing.length) {
35408             missing.forEach(function(loc) {
35409               context.loadTileAtLoc(loc);
35410             });
35411             return true;
35412           }
35413         }
35414         return false;
35415       }
35416       function incompleteRelation(id2) {
35417         var entity = context.entity(id2);
35418         return entity.type === "relation" && !entity.isComplete(context.graph());
35419       }
35420     };
35421     operation.tooltip = function() {
35422       var disable = operation.disabled();
35423       return disable ? _t.append("operations.rotate." + disable + "." + multi) : _t.append("operations.rotate.description." + multi);
35424     };
35425     operation.annotation = function() {
35426       return selectedIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.rotate.annotation.feature", { n: selectedIDs.length });
35427     };
35428     operation.id = "rotate";
35429     operation.keys = [_t("operations.rotate.key")];
35430     operation.title = _t.append("operations.rotate.title");
35431     operation.behavior = behaviorOperation(context).which(operation);
35432     operation.mouseOnly = true;
35433     return operation;
35434   }
35435
35436   // modules/modes/move.js
35437   function modeMove(context, entityIDs, baseGraph) {
35438     var _tolerancePx = 4;
35439     var mode = {
35440       id: "move",
35441       button: "browse"
35442     };
35443     var keybinding = utilKeybinding("move");
35444     var behaviors = [
35445       behaviorEdit(context),
35446       operationCircularize(context, entityIDs).behavior,
35447       operationDelete(context, entityIDs).behavior,
35448       operationOrthogonalize(context, entityIDs).behavior,
35449       operationReflectLong(context, entityIDs).behavior,
35450       operationReflectShort(context, entityIDs).behavior,
35451       operationRotate(context, entityIDs).behavior
35452     ];
35453     var annotation = entityIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.move.annotation.feature", { n: entityIDs.length });
35454     var _prevGraph;
35455     var _cache4;
35456     var _origin;
35457     var _nudgeInterval;
35458     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
35459     function doMove(nudge) {
35460       nudge = nudge || [0, 0];
35461       var fn;
35462       if (_prevGraph !== context.graph()) {
35463         _cache4 = {};
35464         _origin = context.map().mouseCoordinates();
35465         fn = context.perform;
35466       } else {
35467         fn = context.overwrite;
35468       }
35469       var currMouse = context.map().mouse();
35470       var origMouse = context.projection(_origin);
35471       var delta = geoVecSubtract(geoVecSubtract(currMouse, origMouse), nudge);
35472       fn(actionMove(entityIDs, delta, context.projection, _cache4));
35473       _prevGraph = context.graph();
35474     }
35475     function startNudge(nudge) {
35476       if (_nudgeInterval)
35477         window.clearInterval(_nudgeInterval);
35478       _nudgeInterval = window.setInterval(function() {
35479         context.map().pan(nudge);
35480         doMove(nudge);
35481       }, 50);
35482     }
35483     function stopNudge() {
35484       if (_nudgeInterval) {
35485         window.clearInterval(_nudgeInterval);
35486         _nudgeInterval = null;
35487       }
35488     }
35489     function move() {
35490       doMove();
35491       var nudge = geoViewportEdge(context.map().mouse(), context.map().dimensions());
35492       if (nudge) {
35493         startNudge(nudge);
35494       } else {
35495         stopNudge();
35496       }
35497     }
35498     function finish(d3_event) {
35499       d3_event.stopPropagation();
35500       context.replace(actionNoop(), annotation);
35501       context.enter(modeSelect(context, entityIDs));
35502       stopNudge();
35503     }
35504     function cancel() {
35505       if (baseGraph) {
35506         while (context.graph() !== baseGraph)
35507           context.pop();
35508         context.enter(modeBrowse(context));
35509       } else {
35510         if (_prevGraph)
35511           context.pop();
35512         context.enter(modeSelect(context, entityIDs));
35513       }
35514       stopNudge();
35515     }
35516     function undone() {
35517       context.enter(modeBrowse(context));
35518     }
35519     mode.enter = function() {
35520       _origin = context.map().mouseCoordinates();
35521       _prevGraph = null;
35522       _cache4 = {};
35523       context.features().forceVisible(entityIDs);
35524       behaviors.forEach(context.install);
35525       var downEvent;
35526       context.surface().on(_pointerPrefix + "down.modeMove", function(d3_event) {
35527         downEvent = d3_event;
35528       });
35529       select_default2(window).on(_pointerPrefix + "move.modeMove", move, true).on(_pointerPrefix + "up.modeMove", function(d3_event) {
35530         if (!downEvent)
35531           return;
35532         var mapNode = context.container().select(".main-map").node();
35533         var pointGetter = utilFastMouse(mapNode);
35534         var p1 = pointGetter(downEvent);
35535         var p2 = pointGetter(d3_event);
35536         var dist = geoVecLength(p1, p2);
35537         if (dist <= _tolerancePx)
35538           finish(d3_event);
35539         downEvent = null;
35540       }, true);
35541       context.history().on("undone.modeMove", undone);
35542       keybinding.on("\u238B", cancel).on("\u21A9", finish);
35543       select_default2(document).call(keybinding);
35544     };
35545     mode.exit = function() {
35546       stopNudge();
35547       behaviors.forEach(function(behavior) {
35548         context.uninstall(behavior);
35549       });
35550       context.surface().on(_pointerPrefix + "down.modeMove", null);
35551       select_default2(window).on(_pointerPrefix + "move.modeMove", null, true).on(_pointerPrefix + "up.modeMove", null, true);
35552       context.history().on("undone.modeMove", null);
35553       select_default2(document).call(keybinding.unbind);
35554       context.features().forceVisible([]);
35555     };
35556     mode.selectedIDs = function() {
35557       if (!arguments.length)
35558         return entityIDs;
35559       return mode;
35560     };
35561     return mode;
35562   }
35563
35564   // modules/behavior/paste.js
35565   function behaviorPaste(context) {
35566     function doPaste(d3_event) {
35567       if (!context.map().withinEditableZoom())
35568         return;
35569       d3_event.preventDefault();
35570       var baseGraph = context.graph();
35571       var mouse = context.map().mouse();
35572       var projection2 = context.projection;
35573       var viewport = geoExtent(projection2.clipExtent()).polygon();
35574       if (!geoPointInPolygon(mouse, viewport))
35575         return;
35576       var oldIDs = context.copyIDs();
35577       if (!oldIDs.length)
35578         return;
35579       var extent = geoExtent();
35580       var oldGraph = context.copyGraph();
35581       var newIDs = [];
35582       var action = actionCopyEntities(oldIDs, oldGraph);
35583       context.perform(action);
35584       var copies = action.copies();
35585       var originals = /* @__PURE__ */ new Set();
35586       Object.values(copies).forEach(function(entity) {
35587         originals.add(entity.id);
35588       });
35589       for (var id2 in copies) {
35590         var oldEntity = oldGraph.entity(id2);
35591         var newEntity = copies[id2];
35592         extent._extend(oldEntity.extent(oldGraph));
35593         var parents = context.graph().parentWays(newEntity);
35594         var parentCopied = parents.some(function(parent) {
35595           return originals.has(parent.id);
35596         });
35597         if (!parentCopied) {
35598           newIDs.push(newEntity.id);
35599         }
35600       }
35601       var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
35602       var delta = geoVecSubtract(mouse, copyPoint);
35603       context.perform(actionMove(newIDs, delta, projection2));
35604       context.enter(modeMove(context, newIDs, baseGraph));
35605     }
35606     function behavior() {
35607       context.keybinding().on(uiCmd("\u2318V"), doPaste);
35608       return behavior;
35609     }
35610     behavior.off = function() {
35611       context.keybinding().off(uiCmd("\u2318V"));
35612     };
35613     return behavior;
35614   }
35615
35616   // modules/behavior/drag.js
35617   function behaviorDrag() {
35618     var dispatch14 = dispatch_default("start", "move", "end");
35619     var _tolerancePx = 1;
35620     var _penTolerancePx = 4;
35621     var _origin = null;
35622     var _selector = "";
35623     var _targetNode;
35624     var _targetEntity;
35625     var _surface;
35626     var _pointerId;
35627     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
35628     var d3_event_userSelectProperty = utilPrefixCSSProperty("UserSelect");
35629     var d3_event_userSelectSuppress = function() {
35630       var selection2 = selection_default();
35631       var select = selection2.style(d3_event_userSelectProperty);
35632       selection2.style(d3_event_userSelectProperty, "none");
35633       return function() {
35634         selection2.style(d3_event_userSelectProperty, select);
35635       };
35636     };
35637     function pointerdown(d3_event) {
35638       if (_pointerId)
35639         return;
35640       _pointerId = d3_event.pointerId || "mouse";
35641       _targetNode = this;
35642       var pointerLocGetter = utilFastMouse(_surface || _targetNode.parentNode);
35643       var offset;
35644       var startOrigin = pointerLocGetter(d3_event);
35645       var started = false;
35646       var selectEnable = d3_event_userSelectSuppress();
35647       select_default2(window).on(_pointerPrefix + "move.drag", pointermove).on(_pointerPrefix + "up.drag pointercancel.drag", pointerup, true);
35648       if (_origin) {
35649         offset = _origin.call(_targetNode, _targetEntity);
35650         offset = [offset[0] - startOrigin[0], offset[1] - startOrigin[1]];
35651       } else {
35652         offset = [0, 0];
35653       }
35654       d3_event.stopPropagation();
35655       function pointermove(d3_event2) {
35656         if (_pointerId !== (d3_event2.pointerId || "mouse"))
35657           return;
35658         var p2 = pointerLocGetter(d3_event2);
35659         if (!started) {
35660           var dist = geoVecLength(startOrigin, p2);
35661           var tolerance = d3_event2.pointerType === "pen" ? _penTolerancePx : _tolerancePx;
35662           if (dist < tolerance)
35663             return;
35664           started = true;
35665           dispatch14.call("start", this, d3_event2, _targetEntity);
35666         } else {
35667           startOrigin = p2;
35668           d3_event2.stopPropagation();
35669           d3_event2.preventDefault();
35670           var dx = p2[0] - startOrigin[0];
35671           var dy = p2[1] - startOrigin[1];
35672           dispatch14.call("move", this, d3_event2, _targetEntity, [p2[0] + offset[0], p2[1] + offset[1]], [dx, dy]);
35673         }
35674       }
35675       function pointerup(d3_event2) {
35676         if (_pointerId !== (d3_event2.pointerId || "mouse"))
35677           return;
35678         _pointerId = null;
35679         if (started) {
35680           dispatch14.call("end", this, d3_event2, _targetEntity);
35681           d3_event2.preventDefault();
35682         }
35683         select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
35684         selectEnable();
35685       }
35686     }
35687     function behavior(selection2) {
35688       var matchesSelector = utilPrefixDOMProperty("matchesSelector");
35689       var delegate = pointerdown;
35690       if (_selector) {
35691         delegate = function(d3_event) {
35692           var root3 = this;
35693           var target = d3_event.target;
35694           for (; target && target !== root3; target = target.parentNode) {
35695             var datum2 = target.__data__;
35696             _targetEntity = datum2 instanceof osmNote ? datum2 : datum2 && datum2.properties && datum2.properties.entity;
35697             if (_targetEntity && target[matchesSelector](_selector)) {
35698               return pointerdown.call(target, d3_event);
35699             }
35700           }
35701         };
35702       }
35703       selection2.on(_pointerPrefix + "down.drag" + _selector, delegate);
35704     }
35705     behavior.off = function(selection2) {
35706       selection2.on(_pointerPrefix + "down.drag" + _selector, null);
35707     };
35708     behavior.selector = function(_2) {
35709       if (!arguments.length)
35710         return _selector;
35711       _selector = _2;
35712       return behavior;
35713     };
35714     behavior.origin = function(_2) {
35715       if (!arguments.length)
35716         return _origin;
35717       _origin = _2;
35718       return behavior;
35719     };
35720     behavior.cancel = function() {
35721       select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
35722       return behavior;
35723     };
35724     behavior.targetNode = function(_2) {
35725       if (!arguments.length)
35726         return _targetNode;
35727       _targetNode = _2;
35728       return behavior;
35729     };
35730     behavior.targetEntity = function(_2) {
35731       if (!arguments.length)
35732         return _targetEntity;
35733       _targetEntity = _2;
35734       return behavior;
35735     };
35736     behavior.surface = function(_2) {
35737       if (!arguments.length)
35738         return _surface;
35739       _surface = _2;
35740       return behavior;
35741     };
35742     return utilRebind(behavior, dispatch14, "on");
35743   }
35744
35745   // modules/modes/drag_node.js
35746   function modeDragNode(context) {
35747     var mode = {
35748       id: "drag-node",
35749       button: "browse"
35750     };
35751     var hover = behaviorHover(context).altDisables(true).on("hover", context.ui().sidebar.hover);
35752     var edit2 = behaviorEdit(context);
35753     var _nudgeInterval;
35754     var _restoreSelectedIDs = [];
35755     var _wasMidpoint = false;
35756     var _isCancelled = false;
35757     var _activeEntity;
35758     var _startLoc;
35759     var _lastLoc;
35760     function startNudge(d3_event, entity, nudge) {
35761       if (_nudgeInterval)
35762         window.clearInterval(_nudgeInterval);
35763       _nudgeInterval = window.setInterval(function() {
35764         context.map().pan(nudge);
35765         doMove(d3_event, entity, nudge);
35766       }, 50);
35767     }
35768     function stopNudge() {
35769       if (_nudgeInterval) {
35770         window.clearInterval(_nudgeInterval);
35771         _nudgeInterval = null;
35772       }
35773     }
35774     function moveAnnotation(entity) {
35775       return _t("operations.move.annotation." + entity.geometry(context.graph()));
35776     }
35777     function connectAnnotation(nodeEntity, targetEntity) {
35778       var nodeGeometry = nodeEntity.geometry(context.graph());
35779       var targetGeometry = targetEntity.geometry(context.graph());
35780       if (nodeGeometry === "vertex" && targetGeometry === "vertex") {
35781         var nodeParentWayIDs = context.graph().parentWays(nodeEntity);
35782         var targetParentWayIDs = context.graph().parentWays(targetEntity);
35783         var sharedParentWays = utilArrayIntersection(nodeParentWayIDs, targetParentWayIDs);
35784         if (sharedParentWays.length !== 0) {
35785           if (sharedParentWays[0].areAdjacent(nodeEntity.id, targetEntity.id)) {
35786             return _t("operations.connect.annotation.from_vertex.to_adjacent_vertex");
35787           }
35788           return _t("operations.connect.annotation.from_vertex.to_sibling_vertex");
35789         }
35790       }
35791       return _t("operations.connect.annotation.from_" + nodeGeometry + ".to_" + targetGeometry);
35792     }
35793     function shouldSnapToNode(target) {
35794       if (!_activeEntity)
35795         return false;
35796       return _activeEntity.geometry(context.graph()) !== "vertex" || (target.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(target, context.graph()));
35797     }
35798     function origin(entity) {
35799       return context.projection(entity.loc);
35800     }
35801     function keydown(d3_event) {
35802       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
35803         if (context.surface().classed("nope")) {
35804           context.surface().classed("nope-suppressed", true);
35805         }
35806         context.surface().classed("nope", false).classed("nope-disabled", true);
35807       }
35808     }
35809     function keyup(d3_event) {
35810       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
35811         if (context.surface().classed("nope-suppressed")) {
35812           context.surface().classed("nope", true);
35813         }
35814         context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
35815       }
35816     }
35817     function start2(d3_event, entity) {
35818       _wasMidpoint = entity.type === "midpoint";
35819       var hasHidden = context.features().hasHiddenConnections(entity, context.graph());
35820       _isCancelled = !context.editable() || d3_event.shiftKey || hasHidden;
35821       if (_isCancelled) {
35822         if (hasHidden) {
35823           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("modes.drag_node.connected_to_hidden"))();
35824         }
35825         return drag.cancel();
35826       }
35827       if (_wasMidpoint) {
35828         var midpoint = entity;
35829         entity = osmNode();
35830         context.perform(actionAddMidpoint(midpoint, entity));
35831         entity = context.entity(entity.id);
35832         var vertex = context.surface().selectAll("." + entity.id);
35833         drag.targetNode(vertex.node()).targetEntity(entity);
35834       } else {
35835         context.perform(actionNoop());
35836       }
35837       _activeEntity = entity;
35838       _startLoc = entity.loc;
35839       hover.ignoreVertex(entity.geometry(context.graph()) === "vertex");
35840       context.surface().selectAll("." + _activeEntity.id).classed("active", true);
35841       context.enter(mode);
35842     }
35843     function datum2(d3_event) {
35844       if (!d3_event || d3_event.altKey) {
35845         return {};
35846       } else {
35847         var d2 = d3_event.target.__data__;
35848         return d2 && d2.properties && d2.properties.target ? d2 : {};
35849       }
35850     }
35851     function doMove(d3_event, entity, nudge) {
35852       nudge = nudge || [0, 0];
35853       var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
35854       var currMouse = geoVecSubtract(currPoint, nudge);
35855       var loc = context.projection.invert(currMouse);
35856       var target, edge;
35857       if (!_nudgeInterval) {
35858         var d2 = datum2(d3_event);
35859         target = d2 && d2.properties && d2.properties.entity;
35860         var targetLoc = target && target.loc;
35861         var targetNodes = d2 && d2.properties && d2.properties.nodes;
35862         if (targetLoc) {
35863           if (shouldSnapToNode(target)) {
35864             loc = targetLoc;
35865           }
35866         } else if (targetNodes) {
35867           edge = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, end.id);
35868           if (edge) {
35869             loc = edge.loc;
35870           }
35871         }
35872       }
35873       context.replace(
35874         actionMoveNode(entity.id, loc)
35875       );
35876       var isInvalid = false;
35877       if (target) {
35878         isInvalid = hasRelationConflict(entity, target, edge, context.graph());
35879       }
35880       if (!isInvalid) {
35881         isInvalid = hasInvalidGeometry(entity, context.graph());
35882       }
35883       var nope = context.surface().classed("nope");
35884       if (isInvalid === "relation" || isInvalid === "restriction") {
35885         if (!nope) {
35886           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(
35887             "operations.connect." + isInvalid,
35888             { relation: _mainPresetIndex.item("type/restriction").name() }
35889           ))();
35890         }
35891       } else if (isInvalid) {
35892         var errorID = isInvalid === "line" ? "lines" : "areas";
35893         context.ui().flash.duration(3e3).iconName("#iD-icon-no").label(_t.append("self_intersection.error." + errorID))();
35894       } else {
35895         if (nope) {
35896           context.ui().flash.duration(1).label("")();
35897         }
35898       }
35899       var nopeDisabled = context.surface().classed("nope-disabled");
35900       if (nopeDisabled) {
35901         context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
35902       } else {
35903         context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
35904       }
35905       _lastLoc = loc;
35906     }
35907     function hasRelationConflict(entity, target, edge, graph) {
35908       var testGraph = graph.update();
35909       if (edge) {
35910         var midpoint = osmNode();
35911         var action = actionAddMidpoint({
35912           loc: edge.loc,
35913           edge: [target.nodes[edge.index - 1], target.nodes[edge.index]]
35914         }, midpoint);
35915         testGraph = action(testGraph);
35916         target = midpoint;
35917       }
35918       var ids = [entity.id, target.id];
35919       return actionConnect(ids).disabled(testGraph);
35920     }
35921     function hasInvalidGeometry(entity, graph) {
35922       var parents = graph.parentWays(entity);
35923       var i3, j3, k2;
35924       for (i3 = 0; i3 < parents.length; i3++) {
35925         var parent = parents[i3];
35926         var nodes = [];
35927         var activeIndex = null;
35928         var relations = graph.parentRelations(parent);
35929         for (j3 = 0; j3 < relations.length; j3++) {
35930           if (!relations[j3].isMultipolygon())
35931             continue;
35932           var rings = osmJoinWays(relations[j3].members, graph);
35933           for (k2 = 0; k2 < rings.length; k2++) {
35934             nodes = rings[k2].nodes;
35935             if (nodes.find(function(n3) {
35936               return n3.id === entity.id;
35937             })) {
35938               activeIndex = k2;
35939               if (geoHasSelfIntersections(nodes, entity.id)) {
35940                 return "multipolygonMember";
35941               }
35942             }
35943             rings[k2].coords = nodes.map(function(n3) {
35944               return n3.loc;
35945             });
35946           }
35947           for (k2 = 0; k2 < rings.length; k2++) {
35948             if (k2 === activeIndex)
35949               continue;
35950             if (geoHasLineIntersections(rings[activeIndex].nodes, rings[k2].nodes, entity.id)) {
35951               return "multipolygonRing";
35952             }
35953           }
35954         }
35955         if (activeIndex === null) {
35956           nodes = parent.nodes.map(function(nodeID) {
35957             return graph.entity(nodeID);
35958           });
35959           if (nodes.length && geoHasSelfIntersections(nodes, entity.id)) {
35960             return parent.geometry(graph);
35961           }
35962         }
35963       }
35964       return false;
35965     }
35966     function move(d3_event, entity, point2) {
35967       if (_isCancelled)
35968         return;
35969       d3_event.stopPropagation();
35970       context.surface().classed("nope-disabled", d3_event.altKey);
35971       _lastLoc = context.projection.invert(point2);
35972       doMove(d3_event, entity);
35973       var nudge = geoViewportEdge(point2, context.map().dimensions());
35974       if (nudge) {
35975         startNudge(d3_event, entity, nudge);
35976       } else {
35977         stopNudge();
35978       }
35979     }
35980     function end(d3_event, entity) {
35981       if (_isCancelled)
35982         return;
35983       var wasPoint = entity.geometry(context.graph()) === "point";
35984       var d2 = datum2(d3_event);
35985       var nope = d2 && d2.properties && d2.properties.nope || context.surface().classed("nope");
35986       var target = d2 && d2.properties && d2.properties.entity;
35987       if (nope) {
35988         context.perform(
35989           _actionBounceBack(entity.id, _startLoc)
35990         );
35991       } else if (target && target.type === "way") {
35992         var choice = geoChooseEdge(context.graph().childNodes(target), context.map().mouse(), context.projection, entity.id);
35993         context.replace(
35994           actionAddMidpoint({
35995             loc: choice.loc,
35996             edge: [target.nodes[choice.index - 1], target.nodes[choice.index]]
35997           }, entity),
35998           connectAnnotation(entity, target)
35999         );
36000       } else if (target && target.type === "node" && shouldSnapToNode(target)) {
36001         context.replace(
36002           actionConnect([target.id, entity.id]),
36003           connectAnnotation(entity, target)
36004         );
36005       } else if (_wasMidpoint) {
36006         context.replace(
36007           actionNoop(),
36008           _t("operations.add.annotation.vertex")
36009         );
36010       } else {
36011         context.replace(
36012           actionNoop(),
36013           moveAnnotation(entity)
36014         );
36015       }
36016       if (wasPoint) {
36017         context.enter(modeSelect(context, [entity.id]));
36018       } else {
36019         var reselection = _restoreSelectedIDs.filter(function(id2) {
36020           return context.graph().hasEntity(id2);
36021         });
36022         if (reselection.length) {
36023           context.enter(modeSelect(context, reselection));
36024         } else {
36025           context.enter(modeBrowse(context));
36026         }
36027       }
36028     }
36029     function _actionBounceBack(nodeID, toLoc) {
36030       var moveNode = actionMoveNode(nodeID, toLoc);
36031       var action = function(graph, t2) {
36032         if (t2 === 1)
36033           context.pop();
36034         return moveNode(graph, t2);
36035       };
36036       action.transitionable = true;
36037       return action;
36038     }
36039     function cancel() {
36040       drag.cancel();
36041       context.enter(modeBrowse(context));
36042     }
36043     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);
36044     mode.enter = function() {
36045       context.install(hover);
36046       context.install(edit2);
36047       select_default2(window).on("keydown.dragNode", keydown).on("keyup.dragNode", keyup);
36048       context.history().on("undone.drag-node", cancel);
36049     };
36050     mode.exit = function() {
36051       context.ui().sidebar.hover.cancel();
36052       context.uninstall(hover);
36053       context.uninstall(edit2);
36054       select_default2(window).on("keydown.dragNode", null).on("keyup.dragNode", null);
36055       context.history().on("undone.drag-node", null);
36056       _activeEntity = null;
36057       context.surface().classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false).selectAll(".active").classed("active", false);
36058       stopNudge();
36059     };
36060     mode.selectedIDs = function() {
36061       if (!arguments.length)
36062         return _activeEntity ? [_activeEntity.id] : [];
36063       return mode;
36064     };
36065     mode.activeID = function() {
36066       if (!arguments.length)
36067         return _activeEntity && _activeEntity.id;
36068       return mode;
36069     };
36070     mode.restoreSelectedIDs = function(_2) {
36071       if (!arguments.length)
36072         return _restoreSelectedIDs;
36073       _restoreSelectedIDs = _2;
36074       return mode;
36075     };
36076     mode.behavior = drag;
36077     return mode;
36078   }
36079
36080   // modules/services/keepRight.js
36081   var import_rbush = __toESM(require_rbush_min());
36082
36083   // node_modules/d3-fetch/src/text.js
36084   function responseText(response) {
36085     if (!response.ok)
36086       throw new Error(response.status + " " + response.statusText);
36087     return response.text();
36088   }
36089   function text_default3(input, init2) {
36090     return fetch(input, init2).then(responseText);
36091   }
36092
36093   // node_modules/d3-fetch/src/json.js
36094   function responseJson(response) {
36095     if (!response.ok)
36096       throw new Error(response.status + " " + response.statusText);
36097     if (response.status === 204 || response.status === 205)
36098       return;
36099     return response.json();
36100   }
36101   function json_default(input, init2) {
36102     return fetch(input, init2).then(responseJson);
36103   }
36104
36105   // node_modules/d3-fetch/src/xml.js
36106   function parser(type2) {
36107     return (input, init2) => text_default3(input, init2).then((text2) => new DOMParser().parseFromString(text2, type2));
36108   }
36109   var xml_default = parser("application/xml");
36110   var html = parser("text/html");
36111   var svg = parser("image/svg+xml");
36112
36113   // modules/services/keepRight.js
36114   var tiler = utilTiler();
36115   var dispatch2 = dispatch_default("loaded");
36116   var _tileZoom = 14;
36117   var _krUrlRoot = "https://www.keepright.at";
36118   var _krData = { errorTypes: {}, localizeStrings: {} };
36119   var _cache;
36120   var _krRuleset = [
36121     // no 20 - multiple node on same spot - these are mostly boundaries overlapping roads
36122     30,
36123     40,
36124     50,
36125     60,
36126     70,
36127     90,
36128     100,
36129     110,
36130     120,
36131     130,
36132     150,
36133     160,
36134     170,
36135     180,
36136     190,
36137     191,
36138     192,
36139     193,
36140     194,
36141     195,
36142     196,
36143     197,
36144     198,
36145     200,
36146     201,
36147     202,
36148     203,
36149     204,
36150     205,
36151     206,
36152     207,
36153     208,
36154     210,
36155     220,
36156     230,
36157     231,
36158     232,
36159     270,
36160     280,
36161     281,
36162     282,
36163     283,
36164     284,
36165     285,
36166     290,
36167     291,
36168     292,
36169     293,
36170     294,
36171     295,
36172     296,
36173     297,
36174     298,
36175     300,
36176     310,
36177     311,
36178     312,
36179     313,
36180     320,
36181     350,
36182     360,
36183     370,
36184     380,
36185     390,
36186     400,
36187     401,
36188     402,
36189     410,
36190     411,
36191     412,
36192     413
36193   ];
36194   function abortRequest(controller) {
36195     if (controller) {
36196       controller.abort();
36197     }
36198   }
36199   function abortUnwantedRequests(cache, tiles) {
36200     Object.keys(cache.inflightTile).forEach((k2) => {
36201       const wanted = tiles.find((tile) => k2 === tile.id);
36202       if (!wanted) {
36203         abortRequest(cache.inflightTile[k2]);
36204         delete cache.inflightTile[k2];
36205       }
36206     });
36207   }
36208   function encodeIssueRtree(d2) {
36209     return { minX: d2.loc[0], minY: d2.loc[1], maxX: d2.loc[0], maxY: d2.loc[1], data: d2 };
36210   }
36211   function updateRtree(item, replace) {
36212     _cache.rtree.remove(item, (a2, b2) => a2.data.id === b2.data.id);
36213     if (replace) {
36214       _cache.rtree.insert(item);
36215     }
36216   }
36217   function tokenReplacements(d2) {
36218     if (!(d2 instanceof QAItem))
36219       return;
36220     const replacements = {};
36221     const issueTemplate = _krData.errorTypes[d2.whichType];
36222     if (!issueTemplate) {
36223       console.log("No Template: ", d2.whichType);
36224       console.log("  ", d2.description);
36225       return;
36226     }
36227     if (!issueTemplate.regex)
36228       return;
36229     const errorRegex = new RegExp(issueTemplate.regex, "i");
36230     const errorMatch = errorRegex.exec(d2.description);
36231     if (!errorMatch) {
36232       console.log("Unmatched: ", d2.whichType);
36233       console.log("  ", d2.description);
36234       console.log("  ", errorRegex);
36235       return;
36236     }
36237     for (let i3 = 1; i3 < errorMatch.length; i3++) {
36238       let capture = errorMatch[i3];
36239       let idType;
36240       idType = "IDs" in issueTemplate ? issueTemplate.IDs[i3 - 1] : "";
36241       if (idType && capture) {
36242         capture = parseError(capture, idType);
36243       } else {
36244         const compare = capture.toLowerCase();
36245         if (_krData.localizeStrings[compare]) {
36246           capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare]);
36247         } else {
36248           capture = unescape_default(capture);
36249         }
36250       }
36251       replacements["var" + i3] = capture;
36252     }
36253     return replacements;
36254   }
36255   function parseError(capture, idType) {
36256     const compare = capture.toLowerCase();
36257     if (_krData.localizeStrings[compare]) {
36258       capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare]);
36259     }
36260     switch (idType) {
36261       case "this":
36262         capture = linkErrorObject2(capture);
36263         break;
36264       case "url":
36265         capture = linkURL(capture);
36266         break;
36267       case "n":
36268       case "w":
36269       case "r":
36270         capture = linkEntity2(idType + capture);
36271         break;
36272       case "20":
36273         capture = parse20(capture);
36274         break;
36275       case "211":
36276         capture = parse211(capture);
36277         break;
36278       case "231":
36279         capture = parse231(capture);
36280         break;
36281       case "294":
36282         capture = parse294(capture);
36283         break;
36284       case "370":
36285         capture = parse370(capture);
36286         break;
36287     }
36288     return capture;
36289     function linkErrorObject2(d2) {
36290       return { html: `<a class="error_object_link">${d2}</a>` };
36291     }
36292     function linkEntity2(d2) {
36293       return { html: `<a class="error_entity_link">${d2}</a>` };
36294     }
36295     function linkURL(d2) {
36296       return { html: `<a class="kr_external_link" target="_blank" href="${d2}">${d2}</a>` };
36297     }
36298     function parse211(capture2) {
36299       let newList = [];
36300       const items = capture2.split(", ");
36301       items.forEach((item) => {
36302         let id2 = linkEntity2("n" + item.slice(1));
36303         newList.push(id2);
36304       });
36305       return newList.join(", ");
36306     }
36307     function parse231(capture2) {
36308       let newList = [];
36309       const items = capture2.split("),");
36310       items.forEach((item) => {
36311         const match = item.match(/\#(\d+)\((.+)\)?/);
36312         if (match !== null && match.length > 2) {
36313           newList.push(
36314             linkEntity2("w" + match[1]) + " " + _t("QA.keepRight.errorTypes.231.layer", { layer: match[2] })
36315           );
36316         }
36317       });
36318       return newList.join(", ");
36319     }
36320     function parse294(capture2) {
36321       let newList = [];
36322       const items = capture2.split(",");
36323       items.forEach((item) => {
36324         item = item.split(" ");
36325         const role = `"${item[0]}"`;
36326         const idType2 = item[1].slice(0, 1);
36327         let id2 = item[2].slice(1);
36328         id2 = linkEntity2(idType2 + id2);
36329         newList.push(`${role} ${item[1]} ${id2}`);
36330       });
36331       return newList.join(", ");
36332     }
36333     function parse370(capture2) {
36334       if (!capture2)
36335         return "";
36336       const match = capture2.match(/\(including the name (\'.+\')\)/);
36337       if (match && match.length) {
36338         return _t("QA.keepRight.errorTypes.370.including_the_name", { name: match[1] });
36339       }
36340       return "";
36341     }
36342     function parse20(capture2) {
36343       let newList = [];
36344       const items = capture2.split(",");
36345       items.forEach((item) => {
36346         const id2 = linkEntity2("n" + item.slice(1));
36347         newList.push(id2);
36348       });
36349       return newList.join(", ");
36350     }
36351   }
36352   var keepRight_default = {
36353     title: "keepRight",
36354     init() {
36355       _mainFileFetcher.get("keepRight").then((d2) => _krData = d2);
36356       if (!_cache) {
36357         this.reset();
36358       }
36359       this.event = utilRebind(this, dispatch2, "on");
36360     },
36361     reset() {
36362       if (_cache) {
36363         Object.values(_cache.inflightTile).forEach(abortRequest);
36364       }
36365       _cache = {
36366         data: {},
36367         loadedTile: {},
36368         inflightTile: {},
36369         inflightPost: {},
36370         closed: {},
36371         rtree: new import_rbush.default()
36372       };
36373     },
36374     // KeepRight API:  http://osm.mueschelsoft.de/keepright/interfacing.php
36375     loadIssues(projection2) {
36376       const options2 = {
36377         format: "geojson",
36378         ch: _krRuleset
36379       };
36380       const tiles = tiler.zoomExtent([_tileZoom, _tileZoom]).getTiles(projection2);
36381       abortUnwantedRequests(_cache, tiles);
36382       tiles.forEach((tile) => {
36383         if (_cache.loadedTile[tile.id] || _cache.inflightTile[tile.id])
36384           return;
36385         const [left, top, right, bottom] = tile.extent.rectangle();
36386         const params = Object.assign({}, options2, { left, bottom, right, top });
36387         const url = `${_krUrlRoot}/export.php?` + utilQsString(params);
36388         const controller = new AbortController();
36389         _cache.inflightTile[tile.id] = controller;
36390         json_default(url, { signal: controller.signal }).then((data) => {
36391           delete _cache.inflightTile[tile.id];
36392           _cache.loadedTile[tile.id] = true;
36393           if (!data || !data.features || !data.features.length) {
36394             throw new Error("No Data");
36395           }
36396           data.features.forEach((feature3) => {
36397             const {
36398               properties: {
36399                 error_type: itemType,
36400                 error_id: id2,
36401                 comment = null,
36402                 object_id: objectId,
36403                 object_type: objectType,
36404                 schema,
36405                 title
36406               }
36407             } = feature3;
36408             let {
36409               geometry: { coordinates: loc },
36410               properties: { description = "" }
36411             } = feature3;
36412             const issueTemplate = _krData.errorTypes[itemType];
36413             const parentIssueType = (Math.floor(itemType / 10) * 10).toString();
36414             const whichType = issueTemplate ? itemType : parentIssueType;
36415             const whichTemplate = _krData.errorTypes[whichType];
36416             switch (whichType) {
36417               case "170":
36418                 description = `This feature has a FIXME tag: ${description}`;
36419                 break;
36420               case "292":
36421               case "293":
36422                 description = description.replace("A turn-", "This turn-");
36423                 break;
36424               case "294":
36425               case "295":
36426               case "296":
36427               case "297":
36428               case "298":
36429                 description = `This turn-restriction~${description}`;
36430                 break;
36431               case "300":
36432                 description = "This highway is missing a maxspeed tag";
36433                 break;
36434               case "411":
36435               case "412":
36436               case "413":
36437                 description = `This feature~${description}`;
36438                 break;
36439             }
36440             let coincident = false;
36441             do {
36442               let delta = coincident ? [1e-5, 0] : [0, 1e-5];
36443               loc = geoVecAdd(loc, delta);
36444               let bbox2 = geoExtent(loc).bbox();
36445               coincident = _cache.rtree.search(bbox2).length;
36446             } while (coincident);
36447             let d2 = new QAItem(loc, this, itemType, id2, {
36448               comment,
36449               description,
36450               whichType,
36451               parentIssueType,
36452               severity: whichTemplate.severity || "error",
36453               objectId,
36454               objectType,
36455               schema,
36456               title
36457             });
36458             d2.replacements = tokenReplacements(d2);
36459             _cache.data[id2] = d2;
36460             _cache.rtree.insert(encodeIssueRtree(d2));
36461           });
36462           dispatch2.call("loaded");
36463         }).catch(() => {
36464           delete _cache.inflightTile[tile.id];
36465           _cache.loadedTile[tile.id] = true;
36466         });
36467       });
36468     },
36469     postUpdate(d2, callback) {
36470       if (_cache.inflightPost[d2.id]) {
36471         return callback({ message: "Error update already inflight", status: -2 }, d2);
36472       }
36473       const params = { schema: d2.schema, id: d2.id };
36474       if (d2.newStatus) {
36475         params.st = d2.newStatus;
36476       }
36477       if (d2.newComment !== void 0) {
36478         params.co = d2.newComment;
36479       }
36480       const url = `${_krUrlRoot}/comment.php?` + utilQsString(params);
36481       const controller = new AbortController();
36482       _cache.inflightPost[d2.id] = controller;
36483       json_default(url, { signal: controller.signal }).finally(() => {
36484         delete _cache.inflightPost[d2.id];
36485         if (d2.newStatus === "ignore") {
36486           this.removeItem(d2);
36487         } else if (d2.newStatus === "ignore_t") {
36488           this.removeItem(d2);
36489           _cache.closed[`${d2.schema}:${d2.id}`] = true;
36490         } else {
36491           d2 = this.replaceItem(d2.update({
36492             comment: d2.newComment,
36493             newComment: void 0,
36494             newState: void 0
36495           }));
36496         }
36497         if (callback)
36498           callback(null, d2);
36499       });
36500     },
36501     // Get all cached QAItems covering the viewport
36502     getItems(projection2) {
36503       const viewport = projection2.clipExtent();
36504       const min3 = [viewport[0][0], viewport[1][1]];
36505       const max3 = [viewport[1][0], viewport[0][1]];
36506       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
36507       return _cache.rtree.search(bbox2).map((d2) => d2.data);
36508     },
36509     // Get a QAItem from cache
36510     // NOTE: Don't change method name until UI v3 is merged
36511     getError(id2) {
36512       return _cache.data[id2];
36513     },
36514     // Replace a single QAItem in the cache
36515     replaceItem(item) {
36516       if (!(item instanceof QAItem) || !item.id)
36517         return;
36518       _cache.data[item.id] = item;
36519       updateRtree(encodeIssueRtree(item), true);
36520       return item;
36521     },
36522     // Remove a single QAItem from the cache
36523     removeItem(item) {
36524       if (!(item instanceof QAItem) || !item.id)
36525         return;
36526       delete _cache.data[item.id];
36527       updateRtree(encodeIssueRtree(item), false);
36528     },
36529     issueURL(item) {
36530       return `${_krUrlRoot}/report_map.php?schema=${item.schema}&error=${item.id}`;
36531     },
36532     // Get an array of issues closed during this session.
36533     // Used to populate `closed:keepright` changeset tag
36534     getClosedIDs() {
36535       return Object.keys(_cache.closed).sort();
36536     }
36537   };
36538
36539   // modules/services/improveOSM.js
36540   var import_rbush2 = __toESM(require_rbush_min());
36541   var tiler2 = utilTiler();
36542   var dispatch3 = dispatch_default("loaded");
36543   var _tileZoom2 = 14;
36544   var _impOsmUrls = {
36545     ow: "https://grab.community.improve-osm.org/directionOfFlowService",
36546     mr: "https://grab.community.improve-osm.org/missingGeoService",
36547     tr: "https://grab.community.improve-osm.org/turnRestrictionService"
36548   };
36549   var _impOsmData = { icons: {} };
36550   var _cache2;
36551   function abortRequest2(i3) {
36552     Object.values(i3).forEach((controller) => {
36553       if (controller) {
36554         controller.abort();
36555       }
36556     });
36557   }
36558   function abortUnwantedRequests2(cache, tiles) {
36559     Object.keys(cache.inflightTile).forEach((k2) => {
36560       const wanted = tiles.find((tile) => k2 === tile.id);
36561       if (!wanted) {
36562         abortRequest2(cache.inflightTile[k2]);
36563         delete cache.inflightTile[k2];
36564       }
36565     });
36566   }
36567   function encodeIssueRtree2(d2) {
36568     return { minX: d2.loc[0], minY: d2.loc[1], maxX: d2.loc[0], maxY: d2.loc[1], data: d2 };
36569   }
36570   function updateRtree2(item, replace) {
36571     _cache2.rtree.remove(item, (a2, b2) => a2.data.id === b2.data.id);
36572     if (replace) {
36573       _cache2.rtree.insert(item);
36574     }
36575   }
36576   function linkErrorObject(d2) {
36577     return { html: `<a class="error_object_link">${d2}</a>` };
36578   }
36579   function linkEntity(d2) {
36580     return { html: `<a class="error_entity_link">${d2}</a>` };
36581   }
36582   function pointAverage(points) {
36583     if (points.length) {
36584       const sum = points.reduce(
36585         (acc, point2) => geoVecAdd(acc, [point2.lon, point2.lat]),
36586         [0, 0]
36587       );
36588       return geoVecScale(sum, 1 / points.length);
36589     } else {
36590       return [0, 0];
36591     }
36592   }
36593   function relativeBearing(p1, p2) {
36594     let angle2 = Math.atan2(p2.lon - p1.lon, p2.lat - p1.lat);
36595     if (angle2 < 0) {
36596       angle2 += 2 * Math.PI;
36597     }
36598     return angle2 * 180 / Math.PI;
36599   }
36600   function cardinalDirection(bearing) {
36601     const dir = 45 * Math.round(bearing / 45);
36602     const compass = {
36603       0: "north",
36604       45: "northeast",
36605       90: "east",
36606       135: "southeast",
36607       180: "south",
36608       225: "southwest",
36609       270: "west",
36610       315: "northwest",
36611       360: "north"
36612     };
36613     return _t(`QA.improveOSM.directions.${compass[dir]}`);
36614   }
36615   function preventCoincident(loc, bumpUp) {
36616     let coincident = false;
36617     do {
36618       let delta = coincident ? [1e-5, 0] : bumpUp ? [0, 1e-5] : [0, 0];
36619       loc = geoVecAdd(loc, delta);
36620       let bbox2 = geoExtent(loc).bbox();
36621       coincident = _cache2.rtree.search(bbox2).length;
36622     } while (coincident);
36623     return loc;
36624   }
36625   var improveOSM_default = {
36626     title: "improveOSM",
36627     init() {
36628       _mainFileFetcher.get("qa_data").then((d2) => _impOsmData = d2.improveOSM);
36629       if (!_cache2) {
36630         this.reset();
36631       }
36632       this.event = utilRebind(this, dispatch3, "on");
36633     },
36634     reset() {
36635       if (_cache2) {
36636         Object.values(_cache2.inflightTile).forEach(abortRequest2);
36637       }
36638       _cache2 = {
36639         data: {},
36640         loadedTile: {},
36641         inflightTile: {},
36642         inflightPost: {},
36643         closed: {},
36644         rtree: new import_rbush2.default()
36645       };
36646     },
36647     loadIssues(projection2) {
36648       const options2 = {
36649         client: "iD",
36650         status: "OPEN",
36651         zoom: "19"
36652         // Use a high zoom so that clusters aren't returned
36653       };
36654       const tiles = tiler2.zoomExtent([_tileZoom2, _tileZoom2]).getTiles(projection2);
36655       abortUnwantedRequests2(_cache2, tiles);
36656       tiles.forEach((tile) => {
36657         if (_cache2.loadedTile[tile.id] || _cache2.inflightTile[tile.id])
36658           return;
36659         const [east, north, west, south] = tile.extent.rectangle();
36660         const params = Object.assign({}, options2, { east, south, west, north });
36661         const requests = {};
36662         Object.keys(_impOsmUrls).forEach((k2) => {
36663           const kParams = Object.assign(
36664             {},
36665             params,
36666             k2 === "mr" ? { type: "PARKING,ROAD,BOTH,PATH" } : { confidenceLevel: "C1" }
36667           );
36668           const url = `${_impOsmUrls[k2]}/search?` + utilQsString(kParams);
36669           const controller = new AbortController();
36670           requests[k2] = controller;
36671           json_default(url, { signal: controller.signal }).then((data) => {
36672             delete _cache2.inflightTile[tile.id][k2];
36673             if (!Object.keys(_cache2.inflightTile[tile.id]).length) {
36674               delete _cache2.inflightTile[tile.id];
36675               _cache2.loadedTile[tile.id] = true;
36676             }
36677             if (data.roadSegments) {
36678               data.roadSegments.forEach((feature3) => {
36679                 const { points, wayId, fromNodeId, toNodeId } = feature3;
36680                 const itemId = `${wayId}${fromNodeId}${toNodeId}`;
36681                 let mid = points.length / 2;
36682                 let loc;
36683                 if (mid % 1 === 0) {
36684                   loc = pointAverage([points[mid - 1], points[mid]]);
36685                 } else {
36686                   mid = points[Math.floor(mid)];
36687                   loc = [mid.lon, mid.lat];
36688                 }
36689                 loc = preventCoincident(loc, false);
36690                 let d2 = new QAItem(loc, this, k2, itemId, {
36691                   issueKey: k2,
36692                   // used as a category
36693                   identifier: {
36694                     // used to post changes
36695                     wayId,
36696                     fromNodeId,
36697                     toNodeId
36698                   },
36699                   objectId: wayId,
36700                   objectType: "way"
36701                 });
36702                 d2.replacements = {
36703                   percentage: feature3.percentOfTrips,
36704                   num_trips: feature3.numberOfTrips,
36705                   highway: linkErrorObject(_t("QA.keepRight.error_parts.highway")),
36706                   from_node: linkEntity("n" + feature3.fromNodeId),
36707                   to_node: linkEntity("n" + feature3.toNodeId)
36708                 };
36709                 _cache2.data[d2.id] = d2;
36710                 _cache2.rtree.insert(encodeIssueRtree2(d2));
36711               });
36712             }
36713             if (data.tiles) {
36714               data.tiles.forEach((feature3) => {
36715                 const { type: type2, x: x2, y: y2, numberOfTrips } = feature3;
36716                 const geoType = type2.toLowerCase();
36717                 const itemId = `${geoType}${x2}${y2}${numberOfTrips}`;
36718                 let loc = pointAverage(feature3.points);
36719                 loc = preventCoincident(loc, false);
36720                 let d2 = new QAItem(loc, this, `${k2}-${geoType}`, itemId, {
36721                   issueKey: k2,
36722                   identifier: { x: x2, y: y2 }
36723                 });
36724                 d2.replacements = {
36725                   num_trips: numberOfTrips,
36726                   geometry_type: _t(`QA.improveOSM.geometry_types.${geoType}`)
36727                 };
36728                 if (numberOfTrips === -1) {
36729                   d2.desc = _t("QA.improveOSM.error_types.mr.description_alt", d2.replacements);
36730                 }
36731                 _cache2.data[d2.id] = d2;
36732                 _cache2.rtree.insert(encodeIssueRtree2(d2));
36733               });
36734             }
36735             if (data.entities) {
36736               data.entities.forEach((feature3) => {
36737                 const { point: point2, id: id2, segments, numberOfPasses, turnType } = feature3;
36738                 const itemId = `${id2.replace(/[,:+#]/g, "_")}`;
36739                 const loc = preventCoincident([point2.lon, point2.lat], true);
36740                 const ids = id2.split(",");
36741                 const from_way = ids[0];
36742                 const via_node = ids[3];
36743                 const to_way = ids[2].split(":")[1];
36744                 let d2 = new QAItem(loc, this, k2, itemId, {
36745                   issueKey: k2,
36746                   identifier: id2,
36747                   objectId: via_node,
36748                   objectType: "node"
36749                 });
36750                 const [p1, p2] = segments[0].points;
36751                 const dir_of_travel = cardinalDirection(relativeBearing(p1, p2));
36752                 d2.replacements = {
36753                   num_passed: numberOfPasses,
36754                   num_trips: segments[0].numberOfTrips,
36755                   turn_restriction: turnType.toLowerCase(),
36756                   from_way: linkEntity("w" + from_way),
36757                   to_way: linkEntity("w" + to_way),
36758                   travel_direction: dir_of_travel,
36759                   junction: linkErrorObject(_t("QA.keepRight.error_parts.this_node"))
36760                 };
36761                 _cache2.data[d2.id] = d2;
36762                 _cache2.rtree.insert(encodeIssueRtree2(d2));
36763                 dispatch3.call("loaded");
36764               });
36765             }
36766           }).catch(() => {
36767             delete _cache2.inflightTile[tile.id][k2];
36768             if (!Object.keys(_cache2.inflightTile[tile.id]).length) {
36769               delete _cache2.inflightTile[tile.id];
36770               _cache2.loadedTile[tile.id] = true;
36771             }
36772           });
36773         });
36774         _cache2.inflightTile[tile.id] = requests;
36775       });
36776     },
36777     getComments(item) {
36778       if (item.comments) {
36779         return Promise.resolve(item);
36780       }
36781       const key = item.issueKey;
36782       let qParams = {};
36783       if (key === "ow") {
36784         qParams = item.identifier;
36785       } else if (key === "mr") {
36786         qParams.tileX = item.identifier.x;
36787         qParams.tileY = item.identifier.y;
36788       } else if (key === "tr") {
36789         qParams.targetId = item.identifier;
36790       }
36791       const url = `${_impOsmUrls[key]}/retrieveComments?` + utilQsString(qParams);
36792       const cacheComments = (data) => {
36793         item.comments = data.comments ? data.comments.reverse() : [];
36794         this.replaceItem(item);
36795       };
36796       return json_default(url).then(cacheComments).then(() => item);
36797     },
36798     postUpdate(d2, callback) {
36799       if (!osm_default.authenticated()) {
36800         return callback({ message: "Not Authenticated", status: -3 }, d2);
36801       }
36802       if (_cache2.inflightPost[d2.id]) {
36803         return callback({ message: "Error update already inflight", status: -2 }, d2);
36804       }
36805       osm_default.userDetails(sendPayload.bind(this));
36806       function sendPayload(err, user) {
36807         if (err) {
36808           return callback(err, d2);
36809         }
36810         const key = d2.issueKey;
36811         const url = `${_impOsmUrls[key]}/comment`;
36812         const payload = {
36813           username: user.display_name,
36814           targetIds: [d2.identifier]
36815         };
36816         if (d2.newStatus) {
36817           payload.status = d2.newStatus;
36818           payload.text = "status changed";
36819         }
36820         if (d2.newComment) {
36821           payload.text = d2.newComment;
36822         }
36823         const controller = new AbortController();
36824         _cache2.inflightPost[d2.id] = controller;
36825         const options2 = {
36826           method: "POST",
36827           signal: controller.signal,
36828           body: JSON.stringify(payload)
36829         };
36830         json_default(url, options2).then(() => {
36831           delete _cache2.inflightPost[d2.id];
36832           if (!d2.newStatus) {
36833             const now3 = /* @__PURE__ */ new Date();
36834             let comments = d2.comments ? d2.comments : [];
36835             comments.push({
36836               username: payload.username,
36837               text: payload.text,
36838               timestamp: now3.getTime() / 1e3
36839             });
36840             this.replaceItem(d2.update({
36841               comments,
36842               newComment: void 0
36843             }));
36844           } else {
36845             this.removeItem(d2);
36846             if (d2.newStatus === "SOLVED") {
36847               if (!(d2.issueKey in _cache2.closed)) {
36848                 _cache2.closed[d2.issueKey] = 0;
36849               }
36850               _cache2.closed[d2.issueKey] += 1;
36851             }
36852           }
36853           if (callback)
36854             callback(null, d2);
36855         }).catch((err2) => {
36856           delete _cache2.inflightPost[d2.id];
36857           if (callback)
36858             callback(err2.message);
36859         });
36860       }
36861     },
36862     // Get all cached QAItems covering the viewport
36863     getItems(projection2) {
36864       const viewport = projection2.clipExtent();
36865       const min3 = [viewport[0][0], viewport[1][1]];
36866       const max3 = [viewport[1][0], viewport[0][1]];
36867       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
36868       return _cache2.rtree.search(bbox2).map((d2) => d2.data);
36869     },
36870     // Get a QAItem from cache
36871     // NOTE: Don't change method name until UI v3 is merged
36872     getError(id2) {
36873       return _cache2.data[id2];
36874     },
36875     // get the name of the icon to display for this item
36876     getIcon(itemType) {
36877       return _impOsmData.icons[itemType];
36878     },
36879     // Replace a single QAItem in the cache
36880     replaceItem(issue) {
36881       if (!(issue instanceof QAItem) || !issue.id)
36882         return;
36883       _cache2.data[issue.id] = issue;
36884       updateRtree2(encodeIssueRtree2(issue), true);
36885       return issue;
36886     },
36887     // Remove a single QAItem from the cache
36888     removeItem(issue) {
36889       if (!(issue instanceof QAItem) || !issue.id)
36890         return;
36891       delete _cache2.data[issue.id];
36892       updateRtree2(encodeIssueRtree2(issue), false);
36893     },
36894     // Used to populate `closed:improveosm:*` changeset tags
36895     getClosedCounts() {
36896       return _cache2.closed;
36897     }
36898   };
36899
36900   // modules/services/osmose.js
36901   var import_rbush3 = __toESM(require_rbush_min());
36902
36903   // node_modules/marked/lib/marked.esm.js
36904   function _getDefaults() {
36905     return {
36906       async: false,
36907       baseUrl: null,
36908       breaks: false,
36909       extensions: null,
36910       gfm: true,
36911       headerIds: false,
36912       headerPrefix: "",
36913       highlight: null,
36914       hooks: null,
36915       langPrefix: "language-",
36916       mangle: false,
36917       pedantic: false,
36918       renderer: null,
36919       sanitize: false,
36920       sanitizer: null,
36921       silent: false,
36922       smartypants: false,
36923       tokenizer: null,
36924       walkTokens: null,
36925       xhtml: false
36926     };
36927   }
36928   var _defaults = _getDefaults();
36929   function changeDefaults(newDefaults) {
36930     _defaults = newDefaults;
36931   }
36932   var escapeTest = /[&<>"']/;
36933   var escapeReplace = new RegExp(escapeTest.source, "g");
36934   var escapeTestNoEncode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/;
36935   var escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, "g");
36936   var escapeReplacements = {
36937     "&": "&amp;",
36938     "<": "&lt;",
36939     ">": "&gt;",
36940     '"': "&quot;",
36941     "'": "&#39;"
36942   };
36943   var getEscapeReplacement = (ch) => escapeReplacements[ch];
36944   function escape4(html2, encode) {
36945     if (encode) {
36946       if (escapeTest.test(html2)) {
36947         return html2.replace(escapeReplace, getEscapeReplacement);
36948       }
36949     } else {
36950       if (escapeTestNoEncode.test(html2)) {
36951         return html2.replace(escapeReplaceNoEncode, getEscapeReplacement);
36952       }
36953     }
36954     return html2;
36955   }
36956   var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
36957   function unescape3(html2) {
36958     return html2.replace(unescapeTest, (_2, n3) => {
36959       n3 = n3.toLowerCase();
36960       if (n3 === "colon")
36961         return ":";
36962       if (n3.charAt(0) === "#") {
36963         return n3.charAt(1) === "x" ? String.fromCharCode(parseInt(n3.substring(2), 16)) : String.fromCharCode(+n3.substring(1));
36964       }
36965       return "";
36966     });
36967   }
36968   var caret = /(^|[^\[])\^/g;
36969   function edit(regex, opt) {
36970     regex = typeof regex === "string" ? regex : regex.source;
36971     opt = opt || "";
36972     const obj = {
36973       replace: (name, val) => {
36974         val = typeof val === "object" && "source" in val ? val.source : val;
36975         val = val.replace(caret, "$1");
36976         regex = regex.replace(name, val);
36977         return obj;
36978       },
36979       getRegex: () => {
36980         return new RegExp(regex, opt);
36981       }
36982     };
36983     return obj;
36984   }
36985   var nonWordAndColonTest = /[^\w:]/g;
36986   var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
36987   function cleanUrl(sanitize, base, href) {
36988     if (sanitize) {
36989       let prot;
36990       try {
36991         prot = decodeURIComponent(unescape3(href)).replace(nonWordAndColonTest, "").toLowerCase();
36992       } catch (e3) {
36993         return null;
36994       }
36995       if (prot.indexOf("javascript:") === 0 || prot.indexOf("vbscript:") === 0 || prot.indexOf("data:") === 0) {
36996         return null;
36997       }
36998     }
36999     if (base && !originIndependentUrl.test(href)) {
37000       href = resolveUrl(base, href);
37001     }
37002     try {
37003       href = encodeURI(href).replace(/%25/g, "%");
37004     } catch (e3) {
37005       return null;
37006     }
37007     return href;
37008   }
37009   var baseUrls = {};
37010   var justDomain = /^[^:]+:\/*[^/]*$/;
37011   var protocol = /^([^:]+:)[\s\S]*$/;
37012   var domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;
37013   function resolveUrl(base, href) {
37014     if (!baseUrls[" " + base]) {
37015       if (justDomain.test(base)) {
37016         baseUrls[" " + base] = base + "/";
37017       } else {
37018         baseUrls[" " + base] = rtrim(base, "/", true);
37019       }
37020     }
37021     base = baseUrls[" " + base];
37022     const relativeBase = base.indexOf(":") === -1;
37023     if (href.substring(0, 2) === "//") {
37024       if (relativeBase) {
37025         return href;
37026       }
37027       return base.replace(protocol, "$1") + href;
37028     } else if (href.charAt(0) === "/") {
37029       if (relativeBase) {
37030         return href;
37031       }
37032       return base.replace(domain, "$1") + href;
37033     } else {
37034       return base + href;
37035     }
37036   }
37037   var noopTest = { exec: () => null };
37038   function splitCells(tableRow, count) {
37039     const row = tableRow.replace(/\|/g, (match, offset, str2) => {
37040       let escaped = false, curr = offset;
37041       while (--curr >= 0 && str2[curr] === "\\")
37042         escaped = !escaped;
37043       if (escaped) {
37044         return "|";
37045       } else {
37046         return " |";
37047       }
37048     }), cells = row.split(/ \|/);
37049     let i3 = 0;
37050     if (!cells[0].trim()) {
37051       cells.shift();
37052     }
37053     if (cells.length > 0 && !cells[cells.length - 1].trim()) {
37054       cells.pop();
37055     }
37056     if (count) {
37057       if (cells.length > count) {
37058         cells.splice(count);
37059       } else {
37060         while (cells.length < count)
37061           cells.push("");
37062       }
37063     }
37064     for (; i3 < cells.length; i3++) {
37065       cells[i3] = cells[i3].trim().replace(/\\\|/g, "|");
37066     }
37067     return cells;
37068   }
37069   function rtrim(str2, c2, invert) {
37070     const l2 = str2.length;
37071     if (l2 === 0) {
37072       return "";
37073     }
37074     let suffLen = 0;
37075     while (suffLen < l2) {
37076       const currChar = str2.charAt(l2 - suffLen - 1);
37077       if (currChar === c2 && !invert) {
37078         suffLen++;
37079       } else if (currChar !== c2 && invert) {
37080         suffLen++;
37081       } else {
37082         break;
37083       }
37084     }
37085     return str2.slice(0, l2 - suffLen);
37086   }
37087   function findClosingBracket(str2, b2) {
37088     if (str2.indexOf(b2[1]) === -1) {
37089       return -1;
37090     }
37091     const l2 = str2.length;
37092     let level = 0, i3 = 0;
37093     for (; i3 < l2; i3++) {
37094       if (str2[i3] === "\\") {
37095         i3++;
37096       } else if (str2[i3] === b2[0]) {
37097         level++;
37098       } else if (str2[i3] === b2[1]) {
37099         level--;
37100         if (level < 0) {
37101           return i3;
37102         }
37103       }
37104     }
37105     return -1;
37106   }
37107   function checkDeprecations(opt, callback) {
37108     if (!opt || opt.silent) {
37109       return;
37110     }
37111     if (callback) {
37112       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");
37113     }
37114     if (opt.sanitize || opt.sanitizer) {
37115       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");
37116     }
37117     if (opt.highlight || opt.langPrefix !== "language-") {
37118       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.");
37119     }
37120     if (opt.mangle) {
37121       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}`.");
37122     }
37123     if (opt.baseUrl) {
37124       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.");
37125     }
37126     if (opt.smartypants) {
37127       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.");
37128     }
37129     if (opt.xhtml) {
37130       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.");
37131     }
37132     if (opt.headerIds || opt.headerPrefix) {
37133       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}`.");
37134     }
37135   }
37136   function outputLink(cap, link2, raw, lexer2) {
37137     const href = link2.href;
37138     const title = link2.title ? escape4(link2.title) : null;
37139     const text2 = cap[1].replace(/\\([\[\]])/g, "$1");
37140     if (cap[0].charAt(0) !== "!") {
37141       lexer2.state.inLink = true;
37142       const token = {
37143         type: "link",
37144         raw,
37145         href,
37146         title,
37147         text: text2,
37148         tokens: lexer2.inlineTokens(text2)
37149       };
37150       lexer2.state.inLink = false;
37151       return token;
37152     }
37153     return {
37154       type: "image",
37155       raw,
37156       href,
37157       title,
37158       text: escape4(text2)
37159     };
37160   }
37161   function indentCodeCompensation(raw, text2) {
37162     const matchIndentToCode = raw.match(/^(\s+)(?:```)/);
37163     if (matchIndentToCode === null) {
37164       return text2;
37165     }
37166     const indentToCode = matchIndentToCode[1];
37167     return text2.split("\n").map((node) => {
37168       const matchIndentInNode = node.match(/^\s+/);
37169       if (matchIndentInNode === null) {
37170         return node;
37171       }
37172       const [indentInNode] = matchIndentInNode;
37173       if (indentInNode.length >= indentToCode.length) {
37174         return node.slice(indentToCode.length);
37175       }
37176       return node;
37177     }).join("\n");
37178   }
37179   var _Tokenizer = class {
37180     options;
37181     rules;
37182     lexer;
37183     constructor(options2) {
37184       this.options = options2 || _defaults;
37185     }
37186     space(src) {
37187       const cap = this.rules.block.newline.exec(src);
37188       if (cap && cap[0].length > 0) {
37189         return {
37190           type: "space",
37191           raw: cap[0]
37192         };
37193       }
37194     }
37195     code(src) {
37196       const cap = this.rules.block.code.exec(src);
37197       if (cap) {
37198         const text2 = cap[0].replace(/^ {1,4}/gm, "");
37199         return {
37200           type: "code",
37201           raw: cap[0],
37202           codeBlockStyle: "indented",
37203           text: !this.options.pedantic ? rtrim(text2, "\n") : text2
37204         };
37205       }
37206     }
37207     fences(src) {
37208       const cap = this.rules.block.fences.exec(src);
37209       if (cap) {
37210         const raw = cap[0];
37211         const text2 = indentCodeCompensation(raw, cap[3] || "");
37212         return {
37213           type: "code",
37214           raw,
37215           lang: cap[2] ? cap[2].trim().replace(this.rules.inline._escapes, "$1") : cap[2],
37216           text: text2
37217         };
37218       }
37219     }
37220     heading(src) {
37221       const cap = this.rules.block.heading.exec(src);
37222       if (cap) {
37223         let text2 = cap[2].trim();
37224         if (/#$/.test(text2)) {
37225           const trimmed = rtrim(text2, "#");
37226           if (this.options.pedantic) {
37227             text2 = trimmed.trim();
37228           } else if (!trimmed || / $/.test(trimmed)) {
37229             text2 = trimmed.trim();
37230           }
37231         }
37232         return {
37233           type: "heading",
37234           raw: cap[0],
37235           depth: cap[1].length,
37236           text: text2,
37237           tokens: this.lexer.inline(text2)
37238         };
37239       }
37240     }
37241     hr(src) {
37242       const cap = this.rules.block.hr.exec(src);
37243       if (cap) {
37244         return {
37245           type: "hr",
37246           raw: cap[0]
37247         };
37248       }
37249     }
37250     blockquote(src) {
37251       const cap = this.rules.block.blockquote.exec(src);
37252       if (cap) {
37253         const text2 = cap[0].replace(/^ *>[ \t]?/gm, "");
37254         const top = this.lexer.state.top;
37255         this.lexer.state.top = true;
37256         const tokens = this.lexer.blockTokens(text2);
37257         this.lexer.state.top = top;
37258         return {
37259           type: "blockquote",
37260           raw: cap[0],
37261           tokens,
37262           text: text2
37263         };
37264       }
37265     }
37266     list(src) {
37267       let cap = this.rules.block.list.exec(src);
37268       if (cap) {
37269         let raw, istask, ischecked, indent2, i3, blankLine, endsWithBlankLine, line, nextLine, rawLine, itemContents, endEarly;
37270         let bull = cap[1].trim();
37271         const isordered = bull.length > 1;
37272         const list = {
37273           type: "list",
37274           raw: "",
37275           ordered: isordered,
37276           start: isordered ? +bull.slice(0, -1) : "",
37277           loose: false,
37278           items: []
37279         };
37280         bull = isordered ? `\\d{1,9}\\${bull.slice(-1)}` : `\\${bull}`;
37281         if (this.options.pedantic) {
37282           bull = isordered ? bull : "[*+-]";
37283         }
37284         const itemRegex = new RegExp(`^( {0,3}${bull})((?:[      ][^\\n]*)?(?:\\n|$))`);
37285         while (src) {
37286           endEarly = false;
37287           if (!(cap = itemRegex.exec(src))) {
37288             break;
37289           }
37290           if (this.rules.block.hr.test(src)) {
37291             break;
37292           }
37293           raw = cap[0];
37294           src = src.substring(raw.length);
37295           line = cap[2].split("\n", 1)[0].replace(/^\t+/, (t2) => " ".repeat(3 * t2.length));
37296           nextLine = src.split("\n", 1)[0];
37297           if (this.options.pedantic) {
37298             indent2 = 2;
37299             itemContents = line.trimLeft();
37300           } else {
37301             indent2 = cap[2].search(/[^ ]/);
37302             indent2 = indent2 > 4 ? 1 : indent2;
37303             itemContents = line.slice(indent2);
37304             indent2 += cap[1].length;
37305           }
37306           blankLine = false;
37307           if (!line && /^ *$/.test(nextLine)) {
37308             raw += nextLine + "\n";
37309             src = src.substring(nextLine.length + 1);
37310             endEarly = true;
37311           }
37312           if (!endEarly) {
37313             const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[    ][^\\n]*)?(?:\\n|$))`);
37314             const hrRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`);
37315             const fencesBeginRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}(?:\`\`\`|~~~)`);
37316             const headingBeginRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}#`);
37317             while (src) {
37318               rawLine = src.split("\n", 1)[0];
37319               nextLine = rawLine;
37320               if (this.options.pedantic) {
37321                 nextLine = nextLine.replace(/^ {1,4}(?=( {4})*[^ ])/g, "  ");
37322               }
37323               if (fencesBeginRegex.test(nextLine)) {
37324                 break;
37325               }
37326               if (headingBeginRegex.test(nextLine)) {
37327                 break;
37328               }
37329               if (nextBulletRegex.test(nextLine)) {
37330                 break;
37331               }
37332               if (hrRegex.test(src)) {
37333                 break;
37334               }
37335               if (nextLine.search(/[^ ]/) >= indent2 || !nextLine.trim()) {
37336                 itemContents += "\n" + nextLine.slice(indent2);
37337               } else {
37338                 if (blankLine) {
37339                   break;
37340                 }
37341                 if (line.search(/[^ ]/) >= 4) {
37342                   break;
37343                 }
37344                 if (fencesBeginRegex.test(line)) {
37345                   break;
37346                 }
37347                 if (headingBeginRegex.test(line)) {
37348                   break;
37349                 }
37350                 if (hrRegex.test(line)) {
37351                   break;
37352                 }
37353                 itemContents += "\n" + nextLine;
37354               }
37355               if (!blankLine && !nextLine.trim()) {
37356                 blankLine = true;
37357               }
37358               raw += rawLine + "\n";
37359               src = src.substring(rawLine.length + 1);
37360               line = nextLine.slice(indent2);
37361             }
37362           }
37363           if (!list.loose) {
37364             if (endsWithBlankLine) {
37365               list.loose = true;
37366             } else if (/\n *\n *$/.test(raw)) {
37367               endsWithBlankLine = true;
37368             }
37369           }
37370           if (this.options.gfm) {
37371             istask = /^\[[ xX]\] /.exec(itemContents);
37372             if (istask) {
37373               ischecked = istask[0] !== "[ ] ";
37374               itemContents = itemContents.replace(/^\[[ xX]\] +/, "");
37375             }
37376           }
37377           list.items.push({
37378             type: "list_item",
37379             raw,
37380             task: !!istask,
37381             checked: ischecked,
37382             loose: false,
37383             text: itemContents
37384           });
37385           list.raw += raw;
37386         }
37387         list.items[list.items.length - 1].raw = raw.trimRight();
37388         list.items[list.items.length - 1].text = itemContents.trimRight();
37389         list.raw = list.raw.trimRight();
37390         const l2 = list.items.length;
37391         for (i3 = 0; i3 < l2; i3++) {
37392           this.lexer.state.top = false;
37393           list.items[i3].tokens = this.lexer.blockTokens(list.items[i3].text, []);
37394           if (!list.loose) {
37395             const spacers = list.items[i3].tokens.filter((t2) => t2.type === "space");
37396             const hasMultipleLineBreaks = spacers.length > 0 && spacers.some((t2) => /\n.*\n/.test(t2.raw));
37397             list.loose = hasMultipleLineBreaks;
37398           }
37399         }
37400         if (list.loose) {
37401           for (i3 = 0; i3 < l2; i3++) {
37402             list.items[i3].loose = true;
37403           }
37404         }
37405         return list;
37406       }
37407     }
37408     html(src) {
37409       const cap = this.rules.block.html.exec(src);
37410       if (cap) {
37411         const token = {
37412           type: "html",
37413           block: true,
37414           raw: cap[0],
37415           pre: !this.options.sanitizer && (cap[1] === "pre" || cap[1] === "script" || cap[1] === "style"),
37416           text: cap[0]
37417         };
37418         if (this.options.sanitize) {
37419           const text2 = this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape4(cap[0]);
37420           const paragraph = token;
37421           paragraph.type = "paragraph";
37422           paragraph.text = text2;
37423           paragraph.tokens = this.lexer.inline(text2);
37424         }
37425         return token;
37426       }
37427     }
37428     def(src) {
37429       const cap = this.rules.block.def.exec(src);
37430       if (cap) {
37431         const tag = cap[1].toLowerCase().replace(/\s+/g, " ");
37432         const href = cap[2] ? cap[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline._escapes, "$1") : "";
37433         const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline._escapes, "$1") : cap[3];
37434         return {
37435           type: "def",
37436           tag,
37437           raw: cap[0],
37438           href,
37439           title
37440         };
37441       }
37442     }
37443     table(src) {
37444       const cap = this.rules.block.table.exec(src);
37445       if (cap) {
37446         const item = {
37447           type: "table",
37448           raw: cap[0],
37449           header: splitCells(cap[1]).map((c2) => {
37450             return { text: c2 };
37451           }),
37452           align: cap[2].replace(/^ *|\| *$/g, "").split(/ *\| */),
37453           rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, "").split("\n") : []
37454         };
37455         if (item.header.length === item.align.length) {
37456           let l2 = item.align.length;
37457           let i3, j3, k2, row;
37458           for (i3 = 0; i3 < l2; i3++) {
37459             if (/^ *-+: *$/.test(item.align[i3])) {
37460               item.align[i3] = "right";
37461             } else if (/^ *:-+: *$/.test(item.align[i3])) {
37462               item.align[i3] = "center";
37463             } else if (/^ *:-+ *$/.test(item.align[i3])) {
37464               item.align[i3] = "left";
37465             } else {
37466               item.align[i3] = null;
37467             }
37468           }
37469           l2 = item.rows.length;
37470           for (i3 = 0; i3 < l2; i3++) {
37471             item.rows[i3] = splitCells(item.rows[i3], item.header.length).map((c2) => {
37472               return { text: c2 };
37473             });
37474           }
37475           l2 = item.header.length;
37476           for (j3 = 0; j3 < l2; j3++) {
37477             item.header[j3].tokens = this.lexer.inline(item.header[j3].text);
37478           }
37479           l2 = item.rows.length;
37480           for (j3 = 0; j3 < l2; j3++) {
37481             row = item.rows[j3];
37482             for (k2 = 0; k2 < row.length; k2++) {
37483               row[k2].tokens = this.lexer.inline(row[k2].text);
37484             }
37485           }
37486           return item;
37487         }
37488       }
37489     }
37490     lheading(src) {
37491       const cap = this.rules.block.lheading.exec(src);
37492       if (cap) {
37493         return {
37494           type: "heading",
37495           raw: cap[0],
37496           depth: cap[2].charAt(0) === "=" ? 1 : 2,
37497           text: cap[1],
37498           tokens: this.lexer.inline(cap[1])
37499         };
37500       }
37501     }
37502     paragraph(src) {
37503       const cap = this.rules.block.paragraph.exec(src);
37504       if (cap) {
37505         const text2 = cap[1].charAt(cap[1].length - 1) === "\n" ? cap[1].slice(0, -1) : cap[1];
37506         return {
37507           type: "paragraph",
37508           raw: cap[0],
37509           text: text2,
37510           tokens: this.lexer.inline(text2)
37511         };
37512       }
37513     }
37514     text(src) {
37515       const cap = this.rules.block.text.exec(src);
37516       if (cap) {
37517         return {
37518           type: "text",
37519           raw: cap[0],
37520           text: cap[0],
37521           tokens: this.lexer.inline(cap[0])
37522         };
37523       }
37524     }
37525     escape(src) {
37526       const cap = this.rules.inline.escape.exec(src);
37527       if (cap) {
37528         return {
37529           type: "escape",
37530           raw: cap[0],
37531           text: escape4(cap[1])
37532         };
37533       }
37534     }
37535     tag(src) {
37536       const cap = this.rules.inline.tag.exec(src);
37537       if (cap) {
37538         if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {
37539           this.lexer.state.inLink = true;
37540         } else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) {
37541           this.lexer.state.inLink = false;
37542         }
37543         if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
37544           this.lexer.state.inRawBlock = true;
37545         } else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
37546           this.lexer.state.inRawBlock = false;
37547         }
37548         return {
37549           type: this.options.sanitize ? "text" : "html",
37550           raw: cap[0],
37551           inLink: this.lexer.state.inLink,
37552           inRawBlock: this.lexer.state.inRawBlock,
37553           block: false,
37554           text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape4(cap[0]) : cap[0]
37555         };
37556       }
37557     }
37558     link(src) {
37559       const cap = this.rules.inline.link.exec(src);
37560       if (cap) {
37561         const trimmedUrl = cap[2].trim();
37562         if (!this.options.pedantic && /^</.test(trimmedUrl)) {
37563           if (!/>$/.test(trimmedUrl)) {
37564             return;
37565           }
37566           const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), "\\");
37567           if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
37568             return;
37569           }
37570         } else {
37571           const lastParenIndex = findClosingBracket(cap[2], "()");
37572           if (lastParenIndex > -1) {
37573             const start2 = cap[0].indexOf("!") === 0 ? 5 : 4;
37574             const linkLen = start2 + cap[1].length + lastParenIndex;
37575             cap[2] = cap[2].substring(0, lastParenIndex);
37576             cap[0] = cap[0].substring(0, linkLen).trim();
37577             cap[3] = "";
37578           }
37579         }
37580         let href = cap[2];
37581         let title = "";
37582         if (this.options.pedantic) {
37583           const link2 = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
37584           if (link2) {
37585             href = link2[1];
37586             title = link2[3];
37587           }
37588         } else {
37589           title = cap[3] ? cap[3].slice(1, -1) : "";
37590         }
37591         href = href.trim();
37592         if (/^</.test(href)) {
37593           if (this.options.pedantic && !/>$/.test(trimmedUrl)) {
37594             href = href.slice(1);
37595           } else {
37596             href = href.slice(1, -1);
37597           }
37598         }
37599         return outputLink(cap, {
37600           href: href ? href.replace(this.rules.inline._escapes, "$1") : href,
37601           title: title ? title.replace(this.rules.inline._escapes, "$1") : title
37602         }, cap[0], this.lexer);
37603       }
37604     }
37605     reflink(src, links) {
37606       let cap;
37607       if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
37608         let link2 = (cap[2] || cap[1]).replace(/\s+/g, " ");
37609         link2 = links[link2.toLowerCase()];
37610         if (!link2) {
37611           const text2 = cap[0].charAt(0);
37612           return {
37613             type: "text",
37614             raw: text2,
37615             text: text2
37616           };
37617         }
37618         return outputLink(cap, link2, cap[0], this.lexer);
37619       }
37620     }
37621     emStrong(src, maskedSrc, prevChar = "") {
37622       let match = this.rules.inline.emStrong.lDelim.exec(src);
37623       if (!match)
37624         return;
37625       if (match[3] && prevChar.match(/[\p{L}\p{N}]/u))
37626         return;
37627       const nextChar = match[1] || match[2] || "";
37628       if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) {
37629         const lLength = [...match[0]].length - 1;
37630         let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;
37631         const endReg = match[0][0] === "*" ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
37632         endReg.lastIndex = 0;
37633         maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
37634         while ((match = endReg.exec(maskedSrc)) != null) {
37635           rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
37636           if (!rDelim)
37637             continue;
37638           rLength = [...rDelim].length;
37639           if (match[3] || match[4]) {
37640             delimTotal += rLength;
37641             continue;
37642           } else if (match[5] || match[6]) {
37643             if (lLength % 3 && !((lLength + rLength) % 3)) {
37644               midDelimTotal += rLength;
37645               continue;
37646             }
37647           }
37648           delimTotal -= rLength;
37649           if (delimTotal > 0)
37650             continue;
37651           rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
37652           const raw = [...src].slice(0, lLength + match.index + rLength + 1).join("");
37653           if (Math.min(lLength, rLength) % 2) {
37654             const text3 = raw.slice(1, -1);
37655             return {
37656               type: "em",
37657               raw,
37658               text: text3,
37659               tokens: this.lexer.inlineTokens(text3)
37660             };
37661           }
37662           const text2 = raw.slice(2, -2);
37663           return {
37664             type: "strong",
37665             raw,
37666             text: text2,
37667             tokens: this.lexer.inlineTokens(text2)
37668           };
37669         }
37670       }
37671     }
37672     codespan(src) {
37673       const cap = this.rules.inline.code.exec(src);
37674       if (cap) {
37675         let text2 = cap[2].replace(/\n/g, " ");
37676         const hasNonSpaceChars = /[^ ]/.test(text2);
37677         const hasSpaceCharsOnBothEnds = /^ /.test(text2) && / $/.test(text2);
37678         if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
37679           text2 = text2.substring(1, text2.length - 1);
37680         }
37681         text2 = escape4(text2, true);
37682         return {
37683           type: "codespan",
37684           raw: cap[0],
37685           text: text2
37686         };
37687       }
37688     }
37689     br(src) {
37690       const cap = this.rules.inline.br.exec(src);
37691       if (cap) {
37692         return {
37693           type: "br",
37694           raw: cap[0]
37695         };
37696       }
37697     }
37698     del(src) {
37699       const cap = this.rules.inline.del.exec(src);
37700       if (cap) {
37701         return {
37702           type: "del",
37703           raw: cap[0],
37704           text: cap[2],
37705           tokens: this.lexer.inlineTokens(cap[2])
37706         };
37707       }
37708     }
37709     autolink(src, mangle2) {
37710       const cap = this.rules.inline.autolink.exec(src);
37711       if (cap) {
37712         let text2, href;
37713         if (cap[2] === "@") {
37714           text2 = escape4(this.options.mangle ? mangle2(cap[1]) : cap[1]);
37715           href = "mailto:" + text2;
37716         } else {
37717           text2 = escape4(cap[1]);
37718           href = text2;
37719         }
37720         return {
37721           type: "link",
37722           raw: cap[0],
37723           text: text2,
37724           href,
37725           tokens: [
37726             {
37727               type: "text",
37728               raw: text2,
37729               text: text2
37730             }
37731           ]
37732         };
37733       }
37734     }
37735     url(src, mangle2) {
37736       let cap;
37737       if (cap = this.rules.inline.url.exec(src)) {
37738         let text2, href;
37739         if (cap[2] === "@") {
37740           text2 = escape4(this.options.mangle ? mangle2(cap[0]) : cap[0]);
37741           href = "mailto:" + text2;
37742         } else {
37743           let prevCapZero;
37744           do {
37745             prevCapZero = cap[0];
37746             cap[0] = this.rules.inline._backpedal.exec(cap[0])[0];
37747           } while (prevCapZero !== cap[0]);
37748           text2 = escape4(cap[0]);
37749           if (cap[1] === "www.") {
37750             href = "http://" + cap[0];
37751           } else {
37752             href = cap[0];
37753           }
37754         }
37755         return {
37756           type: "link",
37757           raw: cap[0],
37758           text: text2,
37759           href,
37760           tokens: [
37761             {
37762               type: "text",
37763               raw: text2,
37764               text: text2
37765             }
37766           ]
37767         };
37768       }
37769     }
37770     inlineText(src, smartypants2) {
37771       const cap = this.rules.inline.text.exec(src);
37772       if (cap) {
37773         let text2;
37774         if (this.lexer.state.inRawBlock) {
37775           text2 = this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape4(cap[0]) : cap[0];
37776         } else {
37777           text2 = escape4(this.options.smartypants ? smartypants2(cap[0]) : cap[0]);
37778         }
37779         return {
37780           type: "text",
37781           raw: cap[0],
37782           text: text2
37783         };
37784       }
37785     }
37786   };
37787   var block = {
37788     newline: /^(?: *(?:\n|$))+/,
37789     code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
37790     fences: /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
37791     hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
37792     heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
37793     blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
37794     list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,
37795     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|$))",
37796     def: /^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
37797     table: noopTest,
37798     lheading: /^((?:(?!^bull ).|\n(?!\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
37799     // regex template, placeholders will be replaced according to different paragraph
37800     // interruption rules of commonmark and the original markdown spec:
37801     _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
37802     text: /^[^\n]+/
37803   };
37804   block._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
37805   block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
37806   block.def = edit(block.def).replace("label", block._label).replace("title", block._title).getRegex();
37807   block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
37808   block.listItemStart = edit(/^( *)(bull) */).replace("bull", block.bullet).getRegex();
37809   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();
37810   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";
37811   block._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
37812   block.html = edit(block.html, "i").replace("comment", block._comment).replace("tag", block._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
37813   block.lheading = edit(block.lheading).replace(/bull/g, block.bullet).getRegex();
37814   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();
37815   block.blockquote = edit(block.blockquote).replace("paragraph", block.paragraph).getRegex();
37816   block.normal = { ...block };
37817   block.gfm = {
37818     ...block.normal,
37819     table: "^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
37820     // Cells
37821   };
37822   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();
37823   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();
37824   block.pedantic = {
37825     ...block.normal,
37826     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(),
37827     def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
37828     heading: /^(#{1,6})(.*)(?:\n+|$)/,
37829     fences: noopTest,
37830     lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
37831     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()
37832   };
37833   var inline = {
37834     escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
37835     autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
37836     url: noopTest,
37837     tag: "^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",
37838     link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
37839     reflink: /^!?\[(label)\]\[(ref)\]/,
37840     nolink: /^!?\[(ref)\](?:\[\])?/,
37841     reflinkSearch: "reflink|nolink(?!\\()",
37842     emStrong: {
37843       lDelim: /^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,
37844       //         (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.
37845       //         | Skip orphan inside strong      | Consume to delim | (1) #***              | (2) a***#, a***                    | (3) #***a, ***a                  | (4) ***#                 | (5) #***#                         | (6) a***a
37846       rDelimAst: /^[^_*]*?__[^_*]*?\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\*)[punct](\*+)(?=[\s]|$)|[^punct\s](\*+)(?!\*)(?=[punct\s]|$)|(?!\*)[punct\s](\*+)(?=[^punct\s])|[\s](\*+)(?!\*)(?=[punct])|(?!\*)[punct](\*+)(?!\*)(?=[punct])|[^punct\s](\*+)(?=[^punct\s])/,
37847       rDelimUnd: /^[^_*]*?\*\*[^_*]*?_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\s]|$)|[^punct\s](_+)(?!_)(?=[punct\s]|$)|(?!_)[punct\s](_+)(?=[^punct\s])|[\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])/
37848       // ^- Not allowed for _
37849     },
37850     code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
37851     br: /^( {2,}|\\)\n(?!\s*$)/,
37852     del: noopTest,
37853     text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
37854     punctuation: /^((?![*_])[\spunctuation])/
37855   };
37856   inline._punctuation = "\\p{P}$+<=>`^|~";
37857   inline.punctuation = edit(inline.punctuation, "u").replace(/punctuation/g, inline._punctuation).getRegex();
37858   inline.blockSkip = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g;
37859   inline.anyPunctuation = /\\[punct]/g;
37860   inline._escapes = /\\([punct])/g;
37861   inline._comment = edit(block._comment).replace("(?:-->|$)", "-->").getRegex();
37862   inline.emStrong.lDelim = edit(inline.emStrong.lDelim, "u").replace(/punct/g, inline._punctuation).getRegex();
37863   inline.emStrong.rDelimAst = edit(inline.emStrong.rDelimAst, "gu").replace(/punct/g, inline._punctuation).getRegex();
37864   inline.emStrong.rDelimUnd = edit(inline.emStrong.rDelimUnd, "gu").replace(/punct/g, inline._punctuation).getRegex();
37865   inline.anyPunctuation = edit(inline.anyPunctuation, "gu").replace(/punct/g, inline._punctuation).getRegex();
37866   inline._escapes = edit(inline._escapes, "gu").replace(/punct/g, inline._punctuation).getRegex();
37867   inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
37868   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])?)+(?![-_])/;
37869   inline.autolink = edit(inline.autolink).replace("scheme", inline._scheme).replace("email", inline._email).getRegex();
37870   inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
37871   inline.tag = edit(inline.tag).replace("comment", inline._comment).replace("attribute", inline._attribute).getRegex();
37872   inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
37873   inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
37874   inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
37875   inline.link = edit(inline.link).replace("label", inline._label).replace("href", inline._href).replace("title", inline._title).getRegex();
37876   inline.reflink = edit(inline.reflink).replace("label", inline._label).replace("ref", block._label).getRegex();
37877   inline.nolink = edit(inline.nolink).replace("ref", block._label).getRegex();
37878   inline.reflinkSearch = edit(inline.reflinkSearch, "g").replace("reflink", inline.reflink).replace("nolink", inline.nolink).getRegex();
37879   inline.normal = { ...inline };
37880   inline.pedantic = {
37881     ...inline.normal,
37882     strong: {
37883       start: /^__|\*\*/,
37884       middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
37885       endAst: /\*\*(?!\*)/g,
37886       endUnd: /__(?!_)/g
37887     },
37888     em: {
37889       start: /^_|\*/,
37890       middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
37891       endAst: /\*(?!\*)/g,
37892       endUnd: /_(?!_)/g
37893     },
37894     link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", inline._label).getRegex(),
37895     reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", inline._label).getRegex()
37896   };
37897   inline.gfm = {
37898     ...inline.normal,
37899     escape: edit(inline.escape).replace("])", "~|])").getRegex(),
37900     _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
37901     url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
37902     _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
37903     del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
37904     text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
37905   };
37906   inline.gfm.url = edit(inline.gfm.url, "i").replace("email", inline.gfm._extended_email).getRegex();
37907   inline.breaks = {
37908     ...inline.gfm,
37909     br: edit(inline.br).replace("{2,}", "*").getRegex(),
37910     text: edit(inline.gfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
37911   };
37912   function smartypants(text2) {
37913     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");
37914   }
37915   function mangle(text2) {
37916     let out = "", i3, ch;
37917     const l2 = text2.length;
37918     for (i3 = 0; i3 < l2; i3++) {
37919       ch = text2.charCodeAt(i3);
37920       if (Math.random() > 0.5) {
37921         ch = "x" + ch.toString(16);
37922       }
37923       out += "&#" + ch + ";";
37924     }
37925     return out;
37926   }
37927   var _Lexer = class __Lexer {
37928     tokens;
37929     options;
37930     state;
37931     tokenizer;
37932     inlineQueue;
37933     constructor(options2) {
37934       this.tokens = [];
37935       this.tokens.links = /* @__PURE__ */ Object.create(null);
37936       this.options = options2 || _defaults;
37937       this.options.tokenizer = this.options.tokenizer || new _Tokenizer();
37938       this.tokenizer = this.options.tokenizer;
37939       this.tokenizer.options = this.options;
37940       this.tokenizer.lexer = this;
37941       this.inlineQueue = [];
37942       this.state = {
37943         inLink: false,
37944         inRawBlock: false,
37945         top: true
37946       };
37947       const rules = {
37948         block: block.normal,
37949         inline: inline.normal
37950       };
37951       if (this.options.pedantic) {
37952         rules.block = block.pedantic;
37953         rules.inline = inline.pedantic;
37954       } else if (this.options.gfm) {
37955         rules.block = block.gfm;
37956         if (this.options.breaks) {
37957           rules.inline = inline.breaks;
37958         } else {
37959           rules.inline = inline.gfm;
37960         }
37961       }
37962       this.tokenizer.rules = rules;
37963     }
37964     /**
37965      * Expose Rules
37966      */
37967     static get rules() {
37968       return {
37969         block,
37970         inline
37971       };
37972     }
37973     /**
37974      * Static Lex Method
37975      */
37976     static lex(src, options2) {
37977       const lexer2 = new __Lexer(options2);
37978       return lexer2.lex(src);
37979     }
37980     /**
37981      * Static Lex Inline Method
37982      */
37983     static lexInline(src, options2) {
37984       const lexer2 = new __Lexer(options2);
37985       return lexer2.inlineTokens(src);
37986     }
37987     /**
37988      * Preprocessing
37989      */
37990     lex(src) {
37991       src = src.replace(/\r\n|\r/g, "\n");
37992       this.blockTokens(src, this.tokens);
37993       let next;
37994       while (next = this.inlineQueue.shift()) {
37995         this.inlineTokens(next.src, next.tokens);
37996       }
37997       return this.tokens;
37998     }
37999     blockTokens(src, tokens = []) {
38000       if (this.options.pedantic) {
38001         src = src.replace(/\t/g, "    ").replace(/^ +$/gm, "");
38002       } else {
38003         src = src.replace(/^( *)(\t+)/gm, (_2, leading, tabs) => {
38004           return leading + "    ".repeat(tabs.length);
38005         });
38006       }
38007       let token;
38008       let lastToken;
38009       let cutSrc;
38010       let lastParagraphClipped;
38011       while (src) {
38012         if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((extTokenizer) => {
38013           if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
38014             src = src.substring(token.raw.length);
38015             tokens.push(token);
38016             return true;
38017           }
38018           return false;
38019         })) {
38020           continue;
38021         }
38022         if (token = this.tokenizer.space(src)) {
38023           src = src.substring(token.raw.length);
38024           if (token.raw.length === 1 && tokens.length > 0) {
38025             tokens[tokens.length - 1].raw += "\n";
38026           } else {
38027             tokens.push(token);
38028           }
38029           continue;
38030         }
38031         if (token = this.tokenizer.code(src)) {
38032           src = src.substring(token.raw.length);
38033           lastToken = tokens[tokens.length - 1];
38034           if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
38035             lastToken.raw += "\n" + token.raw;
38036             lastToken.text += "\n" + token.text;
38037             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
38038           } else {
38039             tokens.push(token);
38040           }
38041           continue;
38042         }
38043         if (token = this.tokenizer.fences(src)) {
38044           src = src.substring(token.raw.length);
38045           tokens.push(token);
38046           continue;
38047         }
38048         if (token = this.tokenizer.heading(src)) {
38049           src = src.substring(token.raw.length);
38050           tokens.push(token);
38051           continue;
38052         }
38053         if (token = this.tokenizer.hr(src)) {
38054           src = src.substring(token.raw.length);
38055           tokens.push(token);
38056           continue;
38057         }
38058         if (token = this.tokenizer.blockquote(src)) {
38059           src = src.substring(token.raw.length);
38060           tokens.push(token);
38061           continue;
38062         }
38063         if (token = this.tokenizer.list(src)) {
38064           src = src.substring(token.raw.length);
38065           tokens.push(token);
38066           continue;
38067         }
38068         if (token = this.tokenizer.html(src)) {
38069           src = src.substring(token.raw.length);
38070           tokens.push(token);
38071           continue;
38072         }
38073         if (token = this.tokenizer.def(src)) {
38074           src = src.substring(token.raw.length);
38075           lastToken = tokens[tokens.length - 1];
38076           if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
38077             lastToken.raw += "\n" + token.raw;
38078             lastToken.text += "\n" + token.raw;
38079             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
38080           } else if (!this.tokens.links[token.tag]) {
38081             this.tokens.links[token.tag] = {
38082               href: token.href,
38083               title: token.title
38084             };
38085           }
38086           continue;
38087         }
38088         if (token = this.tokenizer.table(src)) {
38089           src = src.substring(token.raw.length);
38090           tokens.push(token);
38091           continue;
38092         }
38093         if (token = this.tokenizer.lheading(src)) {
38094           src = src.substring(token.raw.length);
38095           tokens.push(token);
38096           continue;
38097         }
38098         cutSrc = src;
38099         if (this.options.extensions && this.options.extensions.startBlock) {
38100           let startIndex = Infinity;
38101           const tempSrc = src.slice(1);
38102           let tempStart;
38103           this.options.extensions.startBlock.forEach((getStartIndex) => {
38104             tempStart = getStartIndex.call({ lexer: this }, tempSrc);
38105             if (typeof tempStart === "number" && tempStart >= 0) {
38106               startIndex = Math.min(startIndex, tempStart);
38107             }
38108           });
38109           if (startIndex < Infinity && startIndex >= 0) {
38110             cutSrc = src.substring(0, startIndex + 1);
38111           }
38112         }
38113         if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
38114           lastToken = tokens[tokens.length - 1];
38115           if (lastParagraphClipped && lastToken.type === "paragraph") {
38116             lastToken.raw += "\n" + token.raw;
38117             lastToken.text += "\n" + token.text;
38118             this.inlineQueue.pop();
38119             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
38120           } else {
38121             tokens.push(token);
38122           }
38123           lastParagraphClipped = cutSrc.length !== src.length;
38124           src = src.substring(token.raw.length);
38125           continue;
38126         }
38127         if (token = this.tokenizer.text(src)) {
38128           src = src.substring(token.raw.length);
38129           lastToken = tokens[tokens.length - 1];
38130           if (lastToken && lastToken.type === "text") {
38131             lastToken.raw += "\n" + token.raw;
38132             lastToken.text += "\n" + token.text;
38133             this.inlineQueue.pop();
38134             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
38135           } else {
38136             tokens.push(token);
38137           }
38138           continue;
38139         }
38140         if (src) {
38141           const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
38142           if (this.options.silent) {
38143             console.error(errMsg);
38144             break;
38145           } else {
38146             throw new Error(errMsg);
38147           }
38148         }
38149       }
38150       this.state.top = true;
38151       return tokens;
38152     }
38153     inline(src, tokens = []) {
38154       this.inlineQueue.push({ src, tokens });
38155       return tokens;
38156     }
38157     /**
38158      * Lexing/Compiling
38159      */
38160     inlineTokens(src, tokens = []) {
38161       let token, lastToken, cutSrc;
38162       let maskedSrc = src;
38163       let match;
38164       let keepPrevChar, prevChar;
38165       if (this.tokens.links) {
38166         const links = Object.keys(this.tokens.links);
38167         if (links.length > 0) {
38168           while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
38169             if (links.includes(match[0].slice(match[0].lastIndexOf("[") + 1, -1))) {
38170               maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
38171             }
38172           }
38173         }
38174       }
38175       while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
38176         maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
38177       }
38178       while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) {
38179         maskedSrc = maskedSrc.slice(0, match.index) + "++" + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
38180       }
38181       while (src) {
38182         if (!keepPrevChar) {
38183           prevChar = "";
38184         }
38185         keepPrevChar = false;
38186         if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((extTokenizer) => {
38187           if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
38188             src = src.substring(token.raw.length);
38189             tokens.push(token);
38190             return true;
38191           }
38192           return false;
38193         })) {
38194           continue;
38195         }
38196         if (token = this.tokenizer.escape(src)) {
38197           src = src.substring(token.raw.length);
38198           tokens.push(token);
38199           continue;
38200         }
38201         if (token = this.tokenizer.tag(src)) {
38202           src = src.substring(token.raw.length);
38203           lastToken = tokens[tokens.length - 1];
38204           if (lastToken && token.type === "text" && lastToken.type === "text") {
38205             lastToken.raw += token.raw;
38206             lastToken.text += token.text;
38207           } else {
38208             tokens.push(token);
38209           }
38210           continue;
38211         }
38212         if (token = this.tokenizer.link(src)) {
38213           src = src.substring(token.raw.length);
38214           tokens.push(token);
38215           continue;
38216         }
38217         if (token = this.tokenizer.reflink(src, this.tokens.links)) {
38218           src = src.substring(token.raw.length);
38219           lastToken = tokens[tokens.length - 1];
38220           if (lastToken && token.type === "text" && lastToken.type === "text") {
38221             lastToken.raw += token.raw;
38222             lastToken.text += token.text;
38223           } else {
38224             tokens.push(token);
38225           }
38226           continue;
38227         }
38228         if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
38229           src = src.substring(token.raw.length);
38230           tokens.push(token);
38231           continue;
38232         }
38233         if (token = this.tokenizer.codespan(src)) {
38234           src = src.substring(token.raw.length);
38235           tokens.push(token);
38236           continue;
38237         }
38238         if (token = this.tokenizer.br(src)) {
38239           src = src.substring(token.raw.length);
38240           tokens.push(token);
38241           continue;
38242         }
38243         if (token = this.tokenizer.del(src)) {
38244           src = src.substring(token.raw.length);
38245           tokens.push(token);
38246           continue;
38247         }
38248         if (token = this.tokenizer.autolink(src, mangle)) {
38249           src = src.substring(token.raw.length);
38250           tokens.push(token);
38251           continue;
38252         }
38253         if (!this.state.inLink && (token = this.tokenizer.url(src, mangle))) {
38254           src = src.substring(token.raw.length);
38255           tokens.push(token);
38256           continue;
38257         }
38258         cutSrc = src;
38259         if (this.options.extensions && this.options.extensions.startInline) {
38260           let startIndex = Infinity;
38261           const tempSrc = src.slice(1);
38262           let tempStart;
38263           this.options.extensions.startInline.forEach((getStartIndex) => {
38264             tempStart = getStartIndex.call({ lexer: this }, tempSrc);
38265             if (typeof tempStart === "number" && tempStart >= 0) {
38266               startIndex = Math.min(startIndex, tempStart);
38267             }
38268           });
38269           if (startIndex < Infinity && startIndex >= 0) {
38270             cutSrc = src.substring(0, startIndex + 1);
38271           }
38272         }
38273         if (token = this.tokenizer.inlineText(cutSrc, smartypants)) {
38274           src = src.substring(token.raw.length);
38275           if (token.raw.slice(-1) !== "_") {
38276             prevChar = token.raw.slice(-1);
38277           }
38278           keepPrevChar = true;
38279           lastToken = tokens[tokens.length - 1];
38280           if (lastToken && lastToken.type === "text") {
38281             lastToken.raw += token.raw;
38282             lastToken.text += token.text;
38283           } else {
38284             tokens.push(token);
38285           }
38286           continue;
38287         }
38288         if (src) {
38289           const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
38290           if (this.options.silent) {
38291             console.error(errMsg);
38292             break;
38293           } else {
38294             throw new Error(errMsg);
38295           }
38296         }
38297       }
38298       return tokens;
38299     }
38300   };
38301   var _Renderer = class {
38302     options;
38303     constructor(options2) {
38304       this.options = options2 || _defaults;
38305     }
38306     code(code, infostring, escaped) {
38307       const lang = (infostring || "").match(/\S*/)[0];
38308       if (this.options.highlight) {
38309         const out = this.options.highlight(code, lang);
38310         if (out != null && out !== code) {
38311           escaped = true;
38312           code = out;
38313         }
38314       }
38315       code = code.replace(/\n$/, "") + "\n";
38316       if (!lang) {
38317         return "<pre><code>" + (escaped ? code : escape4(code, true)) + "</code></pre>\n";
38318       }
38319       return '<pre><code class="' + this.options.langPrefix + escape4(lang) + '">' + (escaped ? code : escape4(code, true)) + "</code></pre>\n";
38320     }
38321     blockquote(quote2) {
38322       return `<blockquote>
38323 ${quote2}</blockquote>
38324 `;
38325     }
38326     html(html2, block2) {
38327       return html2;
38328     }
38329     heading(text2, level, raw, slugger) {
38330       if (this.options.headerIds) {
38331         const id2 = this.options.headerPrefix + slugger.slug(raw);
38332         return `<h${level} id="${id2}">${text2}</h${level}>
38333 `;
38334       }
38335       return `<h${level}>${text2}</h${level}>
38336 `;
38337     }
38338     hr() {
38339       return this.options.xhtml ? "<hr/>\n" : "<hr>\n";
38340     }
38341     list(body, ordered, start2) {
38342       const type2 = ordered ? "ol" : "ul", startatt = ordered && start2 !== 1 ? ' start="' + start2 + '"' : "";
38343       return "<" + type2 + startatt + ">\n" + body + "</" + type2 + ">\n";
38344     }
38345     listitem(text2, task, checked) {
38346       return `<li>${text2}</li>
38347 `;
38348     }
38349     checkbox(checked) {
38350       return "<input " + (checked ? 'checked="" ' : "") + 'disabled="" type="checkbox"' + (this.options.xhtml ? " /" : "") + "> ";
38351     }
38352     paragraph(text2) {
38353       return `<p>${text2}</p>
38354 `;
38355     }
38356     table(header, body) {
38357       if (body)
38358         body = `<tbody>${body}</tbody>`;
38359       return "<table>\n<thead>\n" + header + "</thead>\n" + body + "</table>\n";
38360     }
38361     tablerow(content) {
38362       return `<tr>
38363 ${content}</tr>
38364 `;
38365     }
38366     tablecell(content, flags) {
38367       const type2 = flags.header ? "th" : "td";
38368       const tag = flags.align ? `<${type2} align="${flags.align}">` : `<${type2}>`;
38369       return tag + content + `</${type2}>
38370 `;
38371     }
38372     /**
38373      * span level renderer
38374      */
38375     strong(text2) {
38376       return `<strong>${text2}</strong>`;
38377     }
38378     em(text2) {
38379       return `<em>${text2}</em>`;
38380     }
38381     codespan(text2) {
38382       return `<code>${text2}</code>`;
38383     }
38384     br() {
38385       return this.options.xhtml ? "<br/>" : "<br>";
38386     }
38387     del(text2) {
38388       return `<del>${text2}</del>`;
38389     }
38390     link(href, title, text2) {
38391       href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
38392       if (href === null) {
38393         return text2;
38394       }
38395       let out = '<a href="' + href + '"';
38396       if (title) {
38397         out += ' title="' + title + '"';
38398       }
38399       out += ">" + text2 + "</a>";
38400       return out;
38401     }
38402     image(href, title, text2) {
38403       href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
38404       if (href === null) {
38405         return text2;
38406       }
38407       let out = `<img src="${href}" alt="${text2}"`;
38408       if (title) {
38409         out += ` title="${title}"`;
38410       }
38411       out += this.options.xhtml ? "/>" : ">";
38412       return out;
38413     }
38414     text(text2) {
38415       return text2;
38416     }
38417   };
38418   var _TextRenderer = class {
38419     // no need for block level renderers
38420     strong(text2) {
38421       return text2;
38422     }
38423     em(text2) {
38424       return text2;
38425     }
38426     codespan(text2) {
38427       return text2;
38428     }
38429     del(text2) {
38430       return text2;
38431     }
38432     html(text2) {
38433       return text2;
38434     }
38435     text(text2) {
38436       return text2;
38437     }
38438     link(href, title, text2) {
38439       return "" + text2;
38440     }
38441     image(href, title, text2) {
38442       return "" + text2;
38443     }
38444     br() {
38445       return "";
38446     }
38447   };
38448   var _Slugger = class {
38449     seen;
38450     constructor() {
38451       this.seen = {};
38452     }
38453     serialize(value) {
38454       return value.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig, "").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, "").replace(/\s/g, "-");
38455     }
38456     /**
38457      * Finds the next safe (unique) slug to use
38458      */
38459     getNextSafeSlug(originalSlug, isDryRun) {
38460       let slug = originalSlug;
38461       let occurenceAccumulator = 0;
38462       if (this.seen.hasOwnProperty(slug)) {
38463         occurenceAccumulator = this.seen[originalSlug];
38464         do {
38465           occurenceAccumulator++;
38466           slug = originalSlug + "-" + occurenceAccumulator;
38467         } while (this.seen.hasOwnProperty(slug));
38468       }
38469       if (!isDryRun) {
38470         this.seen[originalSlug] = occurenceAccumulator;
38471         this.seen[slug] = 0;
38472       }
38473       return slug;
38474     }
38475     /**
38476      * Convert string to unique id
38477      */
38478     slug(value, options2 = {}) {
38479       const slug = this.serialize(value);
38480       return this.getNextSafeSlug(slug, options2.dryrun);
38481     }
38482   };
38483   var _Parser = class __Parser {
38484     options;
38485     renderer;
38486     textRenderer;
38487     slugger;
38488     constructor(options2) {
38489       this.options = options2 || _defaults;
38490       this.options.renderer = this.options.renderer || new _Renderer();
38491       this.renderer = this.options.renderer;
38492       this.renderer.options = this.options;
38493       this.textRenderer = new _TextRenderer();
38494       this.slugger = new _Slugger();
38495     }
38496     /**
38497      * Static Parse Method
38498      */
38499     static parse(tokens, options2) {
38500       const parser3 = new __Parser(options2);
38501       return parser3.parse(tokens);
38502     }
38503     /**
38504      * Static Parse Inline Method
38505      */
38506     static parseInline(tokens, options2) {
38507       const parser3 = new __Parser(options2);
38508       return parser3.parseInline(tokens);
38509     }
38510     /**
38511      * Parse Loop
38512      */
38513     parse(tokens, top = true) {
38514       let out = "", i3, j3, k2, l2, l3, row, cell, header, body, token, ordered, start2, loose, itemBody, item, checked, task, checkbox, ret;
38515       const l4 = tokens.length;
38516       for (i3 = 0; i3 < l4; i3++) {
38517         token = tokens[i3];
38518         if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
38519           ret = this.options.extensions.renderers[token.type].call({ parser: this }, token);
38520           if (ret !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(token.type)) {
38521             out += ret || "";
38522             continue;
38523           }
38524         }
38525         switch (token.type) {
38526           case "space": {
38527             continue;
38528           }
38529           case "hr": {
38530             out += this.renderer.hr();
38531             continue;
38532           }
38533           case "heading": {
38534             out += this.renderer.heading(this.parseInline(token.tokens), token.depth, unescape3(this.parseInline(token.tokens, this.textRenderer)), this.slugger);
38535             continue;
38536           }
38537           case "code": {
38538             out += this.renderer.code(token.text, token.lang, !!token.escaped);
38539             continue;
38540           }
38541           case "table": {
38542             header = "";
38543             cell = "";
38544             l2 = token.header.length;
38545             for (j3 = 0; j3 < l2; j3++) {
38546               cell += this.renderer.tablecell(this.parseInline(token.header[j3].tokens), { header: true, align: token.align[j3] });
38547             }
38548             header += this.renderer.tablerow(cell);
38549             body = "";
38550             l2 = token.rows.length;
38551             for (j3 = 0; j3 < l2; j3++) {
38552               row = token.rows[j3];
38553               cell = "";
38554               l3 = row.length;
38555               for (k2 = 0; k2 < l3; k2++) {
38556                 cell += this.renderer.tablecell(this.parseInline(row[k2].tokens), { header: false, align: token.align[k2] });
38557               }
38558               body += this.renderer.tablerow(cell);
38559             }
38560             out += this.renderer.table(header, body);
38561             continue;
38562           }
38563           case "blockquote": {
38564             body = this.parse(token.tokens);
38565             out += this.renderer.blockquote(body);
38566             continue;
38567           }
38568           case "list": {
38569             ordered = token.ordered;
38570             start2 = token.start;
38571             loose = token.loose;
38572             l2 = token.items.length;
38573             body = "";
38574             for (j3 = 0; j3 < l2; j3++) {
38575               item = token.items[j3];
38576               checked = item.checked;
38577               task = item.task;
38578               itemBody = "";
38579               if (item.task) {
38580                 checkbox = this.renderer.checkbox(!!checked);
38581                 if (loose) {
38582                   if (item.tokens.length > 0 && item.tokens[0].type === "paragraph") {
38583                     item.tokens[0].text = checkbox + " " + item.tokens[0].text;
38584                     if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") {
38585                       item.tokens[0].tokens[0].text = checkbox + " " + item.tokens[0].tokens[0].text;
38586                     }
38587                   } else {
38588                     item.tokens.unshift({
38589                       type: "text",
38590                       text: checkbox
38591                     });
38592                   }
38593                 } else {
38594                   itemBody += checkbox;
38595                 }
38596               }
38597               itemBody += this.parse(item.tokens, loose);
38598               body += this.renderer.listitem(itemBody, task, !!checked);
38599             }
38600             out += this.renderer.list(body, ordered, start2);
38601             continue;
38602           }
38603           case "html": {
38604             out += this.renderer.html(token.text, token.block);
38605             continue;
38606           }
38607           case "paragraph": {
38608             out += this.renderer.paragraph(this.parseInline(token.tokens));
38609             continue;
38610           }
38611           case "text": {
38612             body = token.tokens ? this.parseInline(token.tokens) : token.text;
38613             while (i3 + 1 < l4 && tokens[i3 + 1].type === "text") {
38614               token = tokens[++i3];
38615               body += "\n" + (token.tokens ? this.parseInline(token.tokens) : token.text);
38616             }
38617             out += top ? this.renderer.paragraph(body) : body;
38618             continue;
38619           }
38620           default: {
38621             const errMsg = 'Token with "' + token.type + '" type was not found.';
38622             if (this.options.silent) {
38623               console.error(errMsg);
38624               return "";
38625             } else {
38626               throw new Error(errMsg);
38627             }
38628           }
38629         }
38630       }
38631       return out;
38632     }
38633     /**
38634      * Parse Inline Tokens
38635      */
38636     parseInline(tokens, renderer) {
38637       renderer = renderer || this.renderer;
38638       let out = "", i3, token, ret;
38639       const l2 = tokens.length;
38640       for (i3 = 0; i3 < l2; i3++) {
38641         token = tokens[i3];
38642         if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
38643           ret = this.options.extensions.renderers[token.type].call({ parser: this }, token);
38644           if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(token.type)) {
38645             out += ret || "";
38646             continue;
38647           }
38648         }
38649         switch (token.type) {
38650           case "escape": {
38651             out += renderer.text(token.text);
38652             break;
38653           }
38654           case "html": {
38655             out += renderer.html(token.text);
38656             break;
38657           }
38658           case "link": {
38659             out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer));
38660             break;
38661           }
38662           case "image": {
38663             out += renderer.image(token.href, token.title, token.text);
38664             break;
38665           }
38666           case "strong": {
38667             out += renderer.strong(this.parseInline(token.tokens, renderer));
38668             break;
38669           }
38670           case "em": {
38671             out += renderer.em(this.parseInline(token.tokens, renderer));
38672             break;
38673           }
38674           case "codespan": {
38675             out += renderer.codespan(token.text);
38676             break;
38677           }
38678           case "br": {
38679             out += renderer.br();
38680             break;
38681           }
38682           case "del": {
38683             out += renderer.del(this.parseInline(token.tokens, renderer));
38684             break;
38685           }
38686           case "text": {
38687             out += renderer.text(token.text);
38688             break;
38689           }
38690           default: {
38691             const errMsg = 'Token with "' + token.type + '" type was not found.';
38692             if (this.options.silent) {
38693               console.error(errMsg);
38694               return "";
38695             } else {
38696               throw new Error(errMsg);
38697             }
38698           }
38699         }
38700       }
38701       return out;
38702     }
38703   };
38704   var _Hooks = class {
38705     options;
38706     constructor(options2) {
38707       this.options = options2 || _defaults;
38708     }
38709     static passThroughHooks = /* @__PURE__ */ new Set([
38710       "preprocess",
38711       "postprocess"
38712     ]);
38713     /**
38714      * Process markdown before marked
38715      */
38716     preprocess(markdown) {
38717       return markdown;
38718     }
38719     /**
38720      * Process HTML after marked is finished
38721      */
38722     postprocess(html2) {
38723       return html2;
38724     }
38725   };
38726   var Marked = class {
38727     defaults = _getDefaults();
38728     options = this.setOptions;
38729     parse = this.#parseMarkdown(_Lexer.lex, _Parser.parse);
38730     parseInline = this.#parseMarkdown(_Lexer.lexInline, _Parser.parseInline);
38731     Parser = _Parser;
38732     parser = _Parser.parse;
38733     Renderer = _Renderer;
38734     TextRenderer = _TextRenderer;
38735     Lexer = _Lexer;
38736     lexer = _Lexer.lex;
38737     Tokenizer = _Tokenizer;
38738     Slugger = _Slugger;
38739     Hooks = _Hooks;
38740     constructor(...args) {
38741       this.use(...args);
38742     }
38743     /**
38744      * Run callback for every token
38745      */
38746     walkTokens(tokens, callback) {
38747       let values = [];
38748       for (const token of tokens) {
38749         values = values.concat(callback.call(this, token));
38750         switch (token.type) {
38751           case "table": {
38752             for (const cell of token.header) {
38753               values = values.concat(this.walkTokens(cell.tokens, callback));
38754             }
38755             for (const row of token.rows) {
38756               for (const cell of row) {
38757                 values = values.concat(this.walkTokens(cell.tokens, callback));
38758               }
38759             }
38760             break;
38761           }
38762           case "list": {
38763             values = values.concat(this.walkTokens(token.items, callback));
38764             break;
38765           }
38766           default: {
38767             if (this.defaults.extensions && this.defaults.extensions.childTokens && this.defaults.extensions.childTokens[token.type]) {
38768               this.defaults.extensions.childTokens[token.type].forEach((childTokens) => {
38769                 values = values.concat(this.walkTokens(token[childTokens], callback));
38770               });
38771             } else if (token.tokens) {
38772               values = values.concat(this.walkTokens(token.tokens, callback));
38773             }
38774           }
38775         }
38776       }
38777       return values;
38778     }
38779     use(...args) {
38780       const extensions = this.defaults.extensions || { renderers: {}, childTokens: {} };
38781       args.forEach((pack) => {
38782         const opts = { ...pack };
38783         opts.async = this.defaults.async || opts.async || false;
38784         if (pack.extensions) {
38785           pack.extensions.forEach((ext) => {
38786             if (!ext.name) {
38787               throw new Error("extension name required");
38788             }
38789             if ("renderer" in ext) {
38790               const prevRenderer = extensions.renderers[ext.name];
38791               if (prevRenderer) {
38792                 extensions.renderers[ext.name] = function(...args2) {
38793                   let ret = ext.renderer.apply(this, args2);
38794                   if (ret === false) {
38795                     ret = prevRenderer.apply(this, args2);
38796                   }
38797                   return ret;
38798                 };
38799               } else {
38800                 extensions.renderers[ext.name] = ext.renderer;
38801               }
38802             }
38803             if ("tokenizer" in ext) {
38804               if (!ext.level || ext.level !== "block" && ext.level !== "inline") {
38805                 throw new Error("extension level must be 'block' or 'inline'");
38806               }
38807               if (extensions[ext.level]) {
38808                 extensions[ext.level].unshift(ext.tokenizer);
38809               } else {
38810                 extensions[ext.level] = [ext.tokenizer];
38811               }
38812               if (ext.start) {
38813                 if (ext.level === "block") {
38814                   if (extensions.startBlock) {
38815                     extensions.startBlock.push(ext.start);
38816                   } else {
38817                     extensions.startBlock = [ext.start];
38818                   }
38819                 } else if (ext.level === "inline") {
38820                   if (extensions.startInline) {
38821                     extensions.startInline.push(ext.start);
38822                   } else {
38823                     extensions.startInline = [ext.start];
38824                   }
38825                 }
38826               }
38827             }
38828             if ("childTokens" in ext && ext.childTokens) {
38829               extensions.childTokens[ext.name] = ext.childTokens;
38830             }
38831           });
38832           opts.extensions = extensions;
38833         }
38834         if (pack.renderer) {
38835           const renderer = this.defaults.renderer || new _Renderer(this.defaults);
38836           for (const prop in pack.renderer) {
38837             const rendererFunc = pack.renderer[prop];
38838             const rendererKey = prop;
38839             const prevRenderer = renderer[rendererKey];
38840             renderer[rendererKey] = (...args2) => {
38841               let ret = rendererFunc.apply(renderer, args2);
38842               if (ret === false) {
38843                 ret = prevRenderer.apply(renderer, args2);
38844               }
38845               return ret || "";
38846             };
38847           }
38848           opts.renderer = renderer;
38849         }
38850         if (pack.tokenizer) {
38851           const tokenizer = this.defaults.tokenizer || new _Tokenizer(this.defaults);
38852           for (const prop in pack.tokenizer) {
38853             const tokenizerFunc = pack.tokenizer[prop];
38854             const tokenizerKey = prop;
38855             const prevTokenizer = tokenizer[tokenizerKey];
38856             tokenizer[tokenizerKey] = (...args2) => {
38857               let ret = tokenizerFunc.apply(tokenizer, args2);
38858               if (ret === false) {
38859                 ret = prevTokenizer.apply(tokenizer, args2);
38860               }
38861               return ret;
38862             };
38863           }
38864           opts.tokenizer = tokenizer;
38865         }
38866         if (pack.hooks) {
38867           const hooks = this.defaults.hooks || new _Hooks();
38868           for (const prop in pack.hooks) {
38869             const hooksFunc = pack.hooks[prop];
38870             const hooksKey = prop;
38871             const prevHook = hooks[hooksKey];
38872             if (_Hooks.passThroughHooks.has(prop)) {
38873               hooks[hooksKey] = (arg) => {
38874                 if (this.defaults.async) {
38875                   return Promise.resolve(hooksFunc.call(hooks, arg)).then((ret2) => {
38876                     return prevHook.call(hooks, ret2);
38877                   });
38878                 }
38879                 const ret = hooksFunc.call(hooks, arg);
38880                 return prevHook.call(hooks, ret);
38881               };
38882             } else {
38883               hooks[hooksKey] = (...args2) => {
38884                 let ret = hooksFunc.apply(hooks, args2);
38885                 if (ret === false) {
38886                   ret = prevHook.apply(hooks, args2);
38887                 }
38888                 return ret;
38889               };
38890             }
38891           }
38892           opts.hooks = hooks;
38893         }
38894         if (pack.walkTokens) {
38895           const walkTokens2 = this.defaults.walkTokens;
38896           opts.walkTokens = function(token) {
38897             let values = [];
38898             values.push(pack.walkTokens.call(this, token));
38899             if (walkTokens2) {
38900               values = values.concat(walkTokens2.call(this, token));
38901             }
38902             return values;
38903           };
38904         }
38905         this.defaults = { ...this.defaults, ...opts };
38906       });
38907       return this;
38908     }
38909     setOptions(opt) {
38910       this.defaults = { ...this.defaults, ...opt };
38911       return this;
38912     }
38913     #parseMarkdown(lexer2, parser3) {
38914       return (src, optOrCallback, callback) => {
38915         if (typeof optOrCallback === "function") {
38916           callback = optOrCallback;
38917           optOrCallback = null;
38918         }
38919         const origOpt = { ...optOrCallback };
38920         const opt = { ...this.defaults, ...origOpt };
38921         const throwError = this.#onError(!!opt.silent, !!opt.async, callback);
38922         if (typeof src === "undefined" || src === null) {
38923           return throwError(new Error("marked(): input parameter is undefined or null"));
38924         }
38925         if (typeof src !== "string") {
38926           return throwError(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected"));
38927         }
38928         checkDeprecations(opt, callback);
38929         if (opt.hooks) {
38930           opt.hooks.options = opt;
38931         }
38932         if (callback) {
38933           const highlight = opt.highlight;
38934           let tokens;
38935           try {
38936             if (opt.hooks) {
38937               src = opt.hooks.preprocess(src);
38938             }
38939             tokens = lexer2(src, opt);
38940           } catch (e3) {
38941             return throwError(e3);
38942           }
38943           const done = (err) => {
38944             let out;
38945             if (!err) {
38946               try {
38947                 if (opt.walkTokens) {
38948                   this.walkTokens(tokens, opt.walkTokens);
38949                 }
38950                 out = parser3(tokens, opt);
38951                 if (opt.hooks) {
38952                   out = opt.hooks.postprocess(out);
38953                 }
38954               } catch (e3) {
38955                 err = e3;
38956               }
38957             }
38958             opt.highlight = highlight;
38959             return err ? throwError(err) : callback(null, out);
38960           };
38961           if (!highlight || highlight.length < 3) {
38962             return done();
38963           }
38964           delete opt.highlight;
38965           if (!tokens.length)
38966             return done();
38967           let pending = 0;
38968           this.walkTokens(tokens, (token) => {
38969             if (token.type === "code") {
38970               pending++;
38971               setTimeout(() => {
38972                 highlight(token.text, token.lang, (err, code) => {
38973                   if (err) {
38974                     return done(err);
38975                   }
38976                   if (code != null && code !== token.text) {
38977                     token.text = code;
38978                     token.escaped = true;
38979                   }
38980                   pending--;
38981                   if (pending === 0) {
38982                     done();
38983                   }
38984                 });
38985               }, 0);
38986             }
38987           });
38988           if (pending === 0) {
38989             done();
38990           }
38991           return;
38992         }
38993         if (opt.async) {
38994           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);
38995         }
38996         try {
38997           if (opt.hooks) {
38998             src = opt.hooks.preprocess(src);
38999           }
39000           const tokens = lexer2(src, opt);
39001           if (opt.walkTokens) {
39002             this.walkTokens(tokens, opt.walkTokens);
39003           }
39004           let html2 = parser3(tokens, opt);
39005           if (opt.hooks) {
39006             html2 = opt.hooks.postprocess(html2);
39007           }
39008           return html2;
39009         } catch (e3) {
39010           return throwError(e3);
39011         }
39012       };
39013     }
39014     #onError(silent, async, callback) {
39015       return (e3) => {
39016         e3.message += "\nPlease report this to https://github.com/markedjs/marked.";
39017         if (silent) {
39018           const msg = "<p>An error occurred:</p><pre>" + escape4(e3.message + "", true) + "</pre>";
39019           if (async) {
39020             return Promise.resolve(msg);
39021           }
39022           if (callback) {
39023             callback(null, msg);
39024             return;
39025           }
39026           return msg;
39027         }
39028         if (async) {
39029           return Promise.reject(e3);
39030         }
39031         if (callback) {
39032           callback(e3);
39033           return;
39034         }
39035         throw e3;
39036       };
39037     }
39038   };
39039   var markedInstance = new Marked();
39040   function marked(src, opt, callback) {
39041     return markedInstance.parse(src, opt, callback);
39042   }
39043   marked.options = marked.setOptions = function(options2) {
39044     markedInstance.setOptions(options2);
39045     marked.defaults = markedInstance.defaults;
39046     changeDefaults(marked.defaults);
39047     return marked;
39048   };
39049   marked.getDefaults = _getDefaults;
39050   marked.defaults = _defaults;
39051   marked.use = function(...args) {
39052     markedInstance.use(...args);
39053     marked.defaults = markedInstance.defaults;
39054     changeDefaults(marked.defaults);
39055     return marked;
39056   };
39057   marked.walkTokens = function(tokens, callback) {
39058     return markedInstance.walkTokens(tokens, callback);
39059   };
39060   marked.parseInline = markedInstance.parseInline;
39061   marked.Parser = _Parser;
39062   marked.parser = _Parser.parse;
39063   marked.Renderer = _Renderer;
39064   marked.TextRenderer = _TextRenderer;
39065   marked.Lexer = _Lexer;
39066   marked.lexer = _Lexer.lex;
39067   marked.Tokenizer = _Tokenizer;
39068   marked.Slugger = _Slugger;
39069   marked.Hooks = _Hooks;
39070   marked.parse = marked;
39071   var options = marked.options;
39072   var setOptions = marked.setOptions;
39073   var use = marked.use;
39074   var walkTokens = marked.walkTokens;
39075   var parseInline = marked.parseInline;
39076   var parser2 = _Parser.parse;
39077   var lexer = _Lexer.lex;
39078
39079   // modules/services/osmose.js
39080   var tiler3 = utilTiler();
39081   var dispatch4 = dispatch_default("loaded");
39082   var _tileZoom3 = 14;
39083   var _osmoseUrlRoot = "https://osmose.openstreetmap.fr/api/0.3";
39084   var _osmoseData = { icons: {}, items: [] };
39085   var _cache3;
39086   function abortRequest3(controller) {
39087     if (controller) {
39088       controller.abort();
39089     }
39090   }
39091   function abortUnwantedRequests3(cache, tiles) {
39092     Object.keys(cache.inflightTile).forEach((k2) => {
39093       let wanted = tiles.find((tile) => k2 === tile.id);
39094       if (!wanted) {
39095         abortRequest3(cache.inflightTile[k2]);
39096         delete cache.inflightTile[k2];
39097       }
39098     });
39099   }
39100   function encodeIssueRtree3(d2) {
39101     return { minX: d2.loc[0], minY: d2.loc[1], maxX: d2.loc[0], maxY: d2.loc[1], data: d2 };
39102   }
39103   function updateRtree3(item, replace) {
39104     _cache3.rtree.remove(item, (a2, b2) => a2.data.id === b2.data.id);
39105     if (replace) {
39106       _cache3.rtree.insert(item);
39107     }
39108   }
39109   function preventCoincident2(loc) {
39110     let coincident = false;
39111     do {
39112       let delta = coincident ? [1e-5, 0] : [0, 1e-5];
39113       loc = geoVecAdd(loc, delta);
39114       let bbox2 = geoExtent(loc).bbox();
39115       coincident = _cache3.rtree.search(bbox2).length;
39116     } while (coincident);
39117     return loc;
39118   }
39119   var osmose_default = {
39120     title: "osmose",
39121     init() {
39122       _mainFileFetcher.get("qa_data").then((d2) => {
39123         _osmoseData = d2.osmose;
39124         _osmoseData.items = Object.keys(d2.osmose.icons).map((s2) => s2.split("-")[0]).reduce((unique, item) => unique.indexOf(item) !== -1 ? unique : [...unique, item], []);
39125       });
39126       if (!_cache3) {
39127         this.reset();
39128       }
39129       this.event = utilRebind(this, dispatch4, "on");
39130     },
39131     reset() {
39132       let _strings = {};
39133       let _colors = {};
39134       if (_cache3) {
39135         Object.values(_cache3.inflightTile).forEach(abortRequest3);
39136         _strings = _cache3.strings;
39137         _colors = _cache3.colors;
39138       }
39139       _cache3 = {
39140         data: {},
39141         loadedTile: {},
39142         inflightTile: {},
39143         inflightPost: {},
39144         closed: {},
39145         rtree: new import_rbush3.default(),
39146         strings: _strings,
39147         colors: _colors
39148       };
39149     },
39150     loadIssues(projection2) {
39151       let params = {
39152         // Tiles return a maximum # of issues
39153         // So we want to filter our request for only types iD supports
39154         item: _osmoseData.items
39155       };
39156       let tiles = tiler3.zoomExtent([_tileZoom3, _tileZoom3]).getTiles(projection2);
39157       abortUnwantedRequests3(_cache3, tiles);
39158       tiles.forEach((tile) => {
39159         if (_cache3.loadedTile[tile.id] || _cache3.inflightTile[tile.id])
39160           return;
39161         let [x2, y2, z2] = tile.xyz;
39162         let url = `${_osmoseUrlRoot}/issues/${z2}/${x2}/${y2}.geojson?` + utilQsString(params);
39163         let controller = new AbortController();
39164         _cache3.inflightTile[tile.id] = controller;
39165         json_default(url, { signal: controller.signal }).then((data) => {
39166           delete _cache3.inflightTile[tile.id];
39167           _cache3.loadedTile[tile.id] = true;
39168           if (data.features) {
39169             data.features.forEach((issue) => {
39170               const { item, class: cl, uuid: id2 } = issue.properties;
39171               const itemType = `${item}-${cl}`;
39172               if (itemType in _osmoseData.icons) {
39173                 let loc = issue.geometry.coordinates;
39174                 loc = preventCoincident2(loc);
39175                 let d2 = new QAItem(loc, this, itemType, id2, { item });
39176                 if (item === 8300 || item === 8360) {
39177                   d2.elems = [];
39178                 }
39179                 _cache3.data[d2.id] = d2;
39180                 _cache3.rtree.insert(encodeIssueRtree3(d2));
39181               }
39182             });
39183           }
39184           dispatch4.call("loaded");
39185         }).catch(() => {
39186           delete _cache3.inflightTile[tile.id];
39187           _cache3.loadedTile[tile.id] = true;
39188         });
39189       });
39190     },
39191     loadIssueDetail(issue) {
39192       if (issue.elems !== void 0) {
39193         return Promise.resolve(issue);
39194       }
39195       const url = `${_osmoseUrlRoot}/issue/${issue.id}?langs=${_mainLocalizer.localeCode()}`;
39196       const cacheDetails = (data) => {
39197         issue.elems = data.elems.map((e3) => e3.type.substring(0, 1) + e3.id);
39198         issue.detail = data.subtitle ? marked(data.subtitle.auto) : "";
39199         this.replaceItem(issue);
39200       };
39201       return json_default(url).then(cacheDetails).then(() => issue);
39202     },
39203     loadStrings(locale2 = _mainLocalizer.localeCode()) {
39204       const items = Object.keys(_osmoseData.icons);
39205       if (locale2 in _cache3.strings && Object.keys(_cache3.strings[locale2]).length === items.length) {
39206         return Promise.resolve(_cache3.strings[locale2]);
39207       }
39208       if (!(locale2 in _cache3.strings)) {
39209         _cache3.strings[locale2] = {};
39210       }
39211       const allRequests = items.map((itemType) => {
39212         if (itemType in _cache3.strings[locale2])
39213           return null;
39214         const cacheData = (data) => {
39215           const [cat = { items: [] }] = data.categories;
39216           const [item2 = { class: [] }] = cat.items;
39217           const [cl2 = null] = item2.class;
39218           if (!cl2) {
39219             console.log(`Osmose strings request (${itemType}) had unexpected data`);
39220             return;
39221           }
39222           const { item: itemInt, color: color2 } = item2;
39223           if (/^#[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/.test(color2)) {
39224             _cache3.colors[itemInt] = color2;
39225           }
39226           const { title, detail, fix, trap } = cl2;
39227           let issueStrings = {};
39228           if (title)
39229             issueStrings.title = title.auto;
39230           if (detail)
39231             issueStrings.detail = marked(detail.auto);
39232           if (trap)
39233             issueStrings.trap = marked(trap.auto);
39234           if (fix)
39235             issueStrings.fix = marked(fix.auto);
39236           _cache3.strings[locale2][itemType] = issueStrings;
39237         };
39238         const [item, cl] = itemType.split("-");
39239         const url = `${_osmoseUrlRoot}/items/${item}/class/${cl}?langs=${locale2}`;
39240         return json_default(url).then(cacheData);
39241       }).filter(Boolean);
39242       return Promise.all(allRequests).then(() => _cache3.strings[locale2]);
39243     },
39244     getStrings(itemType, locale2 = _mainLocalizer.localeCode()) {
39245       return locale2 in _cache3.strings ? _cache3.strings[locale2][itemType] : {};
39246     },
39247     getColor(itemType) {
39248       return itemType in _cache3.colors ? _cache3.colors[itemType] : "#FFFFFF";
39249     },
39250     postUpdate(issue, callback) {
39251       if (_cache3.inflightPost[issue.id]) {
39252         return callback({ message: "Issue update already inflight", status: -2 }, issue);
39253       }
39254       const url = `${_osmoseUrlRoot}/issue/${issue.id}/${issue.newStatus}`;
39255       const controller = new AbortController();
39256       const after = () => {
39257         delete _cache3.inflightPost[issue.id];
39258         this.removeItem(issue);
39259         if (issue.newStatus === "done") {
39260           if (!(issue.item in _cache3.closed)) {
39261             _cache3.closed[issue.item] = 0;
39262           }
39263           _cache3.closed[issue.item] += 1;
39264         }
39265         if (callback)
39266           callback(null, issue);
39267       };
39268       _cache3.inflightPost[issue.id] = controller;
39269       fetch(url, { signal: controller.signal }).then(after).catch((err) => {
39270         delete _cache3.inflightPost[issue.id];
39271         if (callback)
39272           callback(err.message);
39273       });
39274     },
39275     // Get all cached QAItems covering the viewport
39276     getItems(projection2) {
39277       const viewport = projection2.clipExtent();
39278       const min3 = [viewport[0][0], viewport[1][1]];
39279       const max3 = [viewport[1][0], viewport[0][1]];
39280       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
39281       return _cache3.rtree.search(bbox2).map((d2) => d2.data);
39282     },
39283     // Get a QAItem from cache
39284     // NOTE: Don't change method name until UI v3 is merged
39285     getError(id2) {
39286       return _cache3.data[id2];
39287     },
39288     // get the name of the icon to display for this item
39289     getIcon(itemType) {
39290       return _osmoseData.icons[itemType];
39291     },
39292     // Replace a single QAItem in the cache
39293     replaceItem(item) {
39294       if (!(item instanceof QAItem) || !item.id)
39295         return;
39296       _cache3.data[item.id] = item;
39297       updateRtree3(encodeIssueRtree3(item), true);
39298       return item;
39299     },
39300     // Remove a single QAItem from the cache
39301     removeItem(item) {
39302       if (!(item instanceof QAItem) || !item.id)
39303         return;
39304       delete _cache3.data[item.id];
39305       updateRtree3(encodeIssueRtree3(item), false);
39306     },
39307     // Used to populate `closed:osmose:*` changeset tags
39308     getClosedCounts() {
39309       return _cache3.closed;
39310     },
39311     itemURL(item) {
39312       return `https://osmose.openstreetmap.fr/en/error/${item.id}`;
39313     }
39314   };
39315
39316   // modules/services/mapillary.js
39317   var import_pbf = __toESM(require_pbf());
39318   var import_rbush4 = __toESM(require_rbush_min());
39319   var import_vector_tile = __toESM(require_vector_tile());
39320   var accessToken = "MLY|4100327730013843|5bb78b81720791946a9a7b956c57b7cf";
39321   var apiUrl = "https://graph.mapillary.com/";
39322   var baseTileUrl = "https://tiles.mapillary.com/maps/vtp";
39323   var mapFeatureTileUrl = `${baseTileUrl}/mly_map_feature_point/2/{z}/{x}/{y}?access_token=${accessToken}`;
39324   var tileUrl = `${baseTileUrl}/mly1_public/2/{z}/{x}/{y}?access_token=${accessToken}`;
39325   var trafficSignTileUrl = `${baseTileUrl}/mly_map_feature_traffic_sign/2/{z}/{x}/{y}?access_token=${accessToken}`;
39326   var viewercss = "mapillary-js/mapillary.css";
39327   var viewerjs = "mapillary-js/mapillary.js";
39328   var minZoom = 14;
39329   var dispatch5 = dispatch_default("change", "loadedImages", "loadedSigns", "loadedMapFeatures", "bearingChanged", "imageChanged");
39330   var _loadViewerPromise;
39331   var _mlyActiveImage;
39332   var _mlyCache;
39333   var _mlyFallback = false;
39334   var _mlyHighlightedDetection;
39335   var _mlyShowFeatureDetections = false;
39336   var _mlyShowSignDetections = false;
39337   var _mlyViewer;
39338   var _mlyViewerFilter = ["all"];
39339   function loadTiles(which, url, maxZoom2, projection2) {
39340     const tiler9 = utilTiler().zoomExtent([minZoom, maxZoom2]).skipNullIsland(true);
39341     const tiles = tiler9.getTiles(projection2);
39342     tiles.forEach(function(tile) {
39343       loadTile(which, url, tile);
39344     });
39345   }
39346   function loadTile(which, url, tile) {
39347     const cache = _mlyCache.requests;
39348     const tileId = `${tile.id}-${which}`;
39349     if (cache.loaded[tileId] || cache.inflight[tileId])
39350       return;
39351     const controller = new AbortController();
39352     cache.inflight[tileId] = controller;
39353     const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
39354     fetch(requestUrl, { signal: controller.signal }).then(function(response) {
39355       if (!response.ok) {
39356         throw new Error(response.status + " " + response.statusText);
39357       }
39358       cache.loaded[tileId] = true;
39359       delete cache.inflight[tileId];
39360       return response.arrayBuffer();
39361     }).then(function(data) {
39362       if (!data) {
39363         throw new Error("No Data");
39364       }
39365       loadTileDataToCache(data, tile, which);
39366       if (which === "images") {
39367         dispatch5.call("loadedImages");
39368       } else if (which === "signs") {
39369         dispatch5.call("loadedSigns");
39370       } else if (which === "points") {
39371         dispatch5.call("loadedMapFeatures");
39372       }
39373     }).catch(function() {
39374       cache.loaded[tileId] = true;
39375       delete cache.inflight[tileId];
39376     });
39377   }
39378   function loadTileDataToCache(data, tile, which) {
39379     const vectorTile = new import_vector_tile.VectorTile(new import_pbf.default(data));
39380     let features, cache, layer, i3, feature3, loc, d2;
39381     if (vectorTile.layers.hasOwnProperty("image")) {
39382       features = [];
39383       cache = _mlyCache.images;
39384       layer = vectorTile.layers.image;
39385       for (i3 = 0; i3 < layer.length; i3++) {
39386         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
39387         loc = feature3.geometry.coordinates;
39388         d2 = {
39389           loc,
39390           captured_at: feature3.properties.captured_at,
39391           ca: feature3.properties.compass_angle,
39392           id: feature3.properties.id,
39393           is_pano: feature3.properties.is_pano,
39394           sequence_id: feature3.properties.sequence_id
39395         };
39396         cache.forImageId[d2.id] = d2;
39397         features.push({
39398           minX: loc[0],
39399           minY: loc[1],
39400           maxX: loc[0],
39401           maxY: loc[1],
39402           data: d2
39403         });
39404       }
39405       if (cache.rtree) {
39406         cache.rtree.load(features);
39407       }
39408     }
39409     if (vectorTile.layers.hasOwnProperty("sequence")) {
39410       features = [];
39411       cache = _mlyCache.sequences;
39412       layer = vectorTile.layers.sequence;
39413       for (i3 = 0; i3 < layer.length; i3++) {
39414         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
39415         if (cache.lineString[feature3.properties.id]) {
39416           cache.lineString[feature3.properties.id].push(feature3);
39417         } else {
39418           cache.lineString[feature3.properties.id] = [feature3];
39419         }
39420       }
39421     }
39422     if (vectorTile.layers.hasOwnProperty("point")) {
39423       features = [];
39424       cache = _mlyCache[which];
39425       layer = vectorTile.layers.point;
39426       for (i3 = 0; i3 < layer.length; i3++) {
39427         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
39428         loc = feature3.geometry.coordinates;
39429         d2 = {
39430           loc,
39431           id: feature3.properties.id,
39432           first_seen_at: feature3.properties.first_seen_at,
39433           last_seen_at: feature3.properties.last_seen_at,
39434           value: feature3.properties.value
39435         };
39436         features.push({
39437           minX: loc[0],
39438           minY: loc[1],
39439           maxX: loc[0],
39440           maxY: loc[1],
39441           data: d2
39442         });
39443       }
39444       if (cache.rtree) {
39445         cache.rtree.load(features);
39446       }
39447     }
39448     if (vectorTile.layers.hasOwnProperty("traffic_sign")) {
39449       features = [];
39450       cache = _mlyCache[which];
39451       layer = vectorTile.layers.traffic_sign;
39452       for (i3 = 0; i3 < layer.length; i3++) {
39453         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
39454         loc = feature3.geometry.coordinates;
39455         d2 = {
39456           loc,
39457           id: feature3.properties.id,
39458           first_seen_at: feature3.properties.first_seen_at,
39459           last_seen_at: feature3.properties.last_seen_at,
39460           value: feature3.properties.value
39461         };
39462         features.push({
39463           minX: loc[0],
39464           minY: loc[1],
39465           maxX: loc[0],
39466           maxY: loc[1],
39467           data: d2
39468         });
39469       }
39470       if (cache.rtree) {
39471         cache.rtree.load(features);
39472       }
39473     }
39474   }
39475   function loadData(url) {
39476     return fetch(url).then(function(response) {
39477       if (!response.ok) {
39478         throw new Error(response.status + " " + response.statusText);
39479       }
39480       return response.json();
39481     }).then(function(result) {
39482       if (!result) {
39483         return [];
39484       }
39485       return result.data || [];
39486     });
39487   }
39488   function partitionViewport(projection2) {
39489     const z2 = geoScaleToZoom(projection2.scale());
39490     const z22 = Math.ceil(z2 * 2) / 2 + 2.5;
39491     const tiler9 = utilTiler().zoomExtent([z22, z22]);
39492     return tiler9.getTiles(projection2).map(function(tile) {
39493       return tile.extent;
39494     });
39495   }
39496   function searchLimited(limit, projection2, rtree) {
39497     limit = limit || 5;
39498     return partitionViewport(projection2).reduce(function(result, extent) {
39499       const found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
39500         return d2.data;
39501       });
39502       return found.length ? result.concat(found) : result;
39503     }, []);
39504   }
39505   var mapillary_default = {
39506     // Initialize Mapillary
39507     init: function() {
39508       if (!_mlyCache) {
39509         this.reset();
39510       }
39511       this.event = utilRebind(this, dispatch5, "on");
39512     },
39513     // Reset cache and state
39514     reset: function() {
39515       if (_mlyCache) {
39516         Object.values(_mlyCache.requests.inflight).forEach(function(request3) {
39517           request3.abort();
39518         });
39519       }
39520       _mlyCache = {
39521         images: { rtree: new import_rbush4.default(), forImageId: {} },
39522         image_detections: { forImageId: {} },
39523         signs: { rtree: new import_rbush4.default() },
39524         points: { rtree: new import_rbush4.default() },
39525         sequences: { rtree: new import_rbush4.default(), lineString: {} },
39526         requests: { loaded: {}, inflight: {} }
39527       };
39528       _mlyActiveImage = null;
39529     },
39530     // Get visible images
39531     images: function(projection2) {
39532       const limit = 5;
39533       return searchLimited(limit, projection2, _mlyCache.images.rtree);
39534     },
39535     // Get visible traffic signs
39536     signs: function(projection2) {
39537       const limit = 5;
39538       return searchLimited(limit, projection2, _mlyCache.signs.rtree);
39539     },
39540     // Get visible map (point) features
39541     mapFeatures: function(projection2) {
39542       const limit = 5;
39543       return searchLimited(limit, projection2, _mlyCache.points.rtree);
39544     },
39545     // Get cached image by id
39546     cachedImage: function(imageId) {
39547       return _mlyCache.images.forImageId[imageId];
39548     },
39549     // Get visible sequences
39550     sequences: function(projection2) {
39551       const viewport = projection2.clipExtent();
39552       const min3 = [viewport[0][0], viewport[1][1]];
39553       const max3 = [viewport[1][0], viewport[0][1]];
39554       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
39555       const sequenceIds = {};
39556       let lineStrings = [];
39557       _mlyCache.images.rtree.search(bbox2).forEach(function(d2) {
39558         if (d2.data.sequence_id) {
39559           sequenceIds[d2.data.sequence_id] = true;
39560         }
39561       });
39562       Object.keys(sequenceIds).forEach(function(sequenceId) {
39563         if (_mlyCache.sequences.lineString[sequenceId]) {
39564           lineStrings = lineStrings.concat(_mlyCache.sequences.lineString[sequenceId]);
39565         }
39566       });
39567       return lineStrings;
39568     },
39569     // Load images in the visible area
39570     loadImages: function(projection2) {
39571       loadTiles("images", tileUrl, 14, projection2);
39572     },
39573     // Load traffic signs in the visible area
39574     loadSigns: function(projection2) {
39575       loadTiles("signs", trafficSignTileUrl, 14, projection2);
39576     },
39577     // Load map (point) features in the visible area
39578     loadMapFeatures: function(projection2) {
39579       loadTiles("points", mapFeatureTileUrl, 14, projection2);
39580     },
39581     // Return a promise that resolves when the image viewer (Mapillary JS) library has finished loading
39582     ensureViewerLoaded: function(context) {
39583       if (_loadViewerPromise)
39584         return _loadViewerPromise;
39585       const wrap2 = context.container().select(".photoviewer").selectAll(".mly-wrapper").data([0]);
39586       wrap2.enter().append("div").attr("id", "ideditor-mly").attr("class", "photo-wrapper mly-wrapper").classed("hide", true);
39587       const that = this;
39588       _loadViewerPromise = new Promise((resolve, reject) => {
39589         let loadedCount = 0;
39590         function loaded() {
39591           loadedCount += 1;
39592           if (loadedCount === 2)
39593             resolve();
39594         }
39595         const head = select_default2("head");
39596         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() {
39597           reject();
39598         });
39599         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() {
39600           reject();
39601         });
39602       }).catch(function() {
39603         _loadViewerPromise = null;
39604       }).then(function() {
39605         that.initViewer(context);
39606       });
39607       return _loadViewerPromise;
39608     },
39609     // Load traffic sign image sprites
39610     loadSignResources: function(context) {
39611       context.ui().svgDefs.addSprites(
39612         ["mapillary-sprite"],
39613         false
39614         /* don't override colors */
39615       );
39616       return this;
39617     },
39618     // Load map (point) feature image sprites
39619     loadObjectResources: function(context) {
39620       context.ui().svgDefs.addSprites(
39621         ["mapillary-object-sprite"],
39622         false
39623         /* don't override colors */
39624       );
39625       return this;
39626     },
39627     // Remove previous detections in image viewer
39628     resetTags: function() {
39629       if (_mlyViewer && !_mlyFallback) {
39630         _mlyViewer.getComponent("tag").removeAll();
39631       }
39632     },
39633     // Show map feature detections in image viewer
39634     showFeatureDetections: function(value) {
39635       _mlyShowFeatureDetections = value;
39636       if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
39637         this.resetTags();
39638       }
39639     },
39640     // Show traffic sign detections in image viewer
39641     showSignDetections: function(value) {
39642       _mlyShowSignDetections = value;
39643       if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
39644         this.resetTags();
39645       }
39646     },
39647     // Apply filter to image viewer
39648     filterViewer: function(context) {
39649       const showsPano = context.photos().showsPanoramic();
39650       const showsFlat = context.photos().showsFlat();
39651       const fromDate = context.photos().fromDate();
39652       const toDate = context.photos().toDate();
39653       const filter2 = ["all"];
39654       if (!showsPano)
39655         filter2.push(["!=", "cameraType", "spherical"]);
39656       if (!showsFlat && showsPano)
39657         filter2.push(["==", "pano", true]);
39658       if (fromDate) {
39659         filter2.push([">=", "capturedAt", new Date(fromDate).getTime()]);
39660       }
39661       if (toDate) {
39662         filter2.push([">=", "capturedAt", new Date(toDate).getTime()]);
39663       }
39664       if (_mlyViewer) {
39665         _mlyViewer.setFilter(filter2);
39666       }
39667       _mlyViewerFilter = filter2;
39668       return filter2;
39669     },
39670     // Make the image viewer visible
39671     showViewer: function(context) {
39672       const wrap2 = context.container().select(".photoviewer").classed("hide", false);
39673       const isHidden = wrap2.selectAll(".photo-wrapper.mly-wrapper.hide").size();
39674       if (isHidden && _mlyViewer) {
39675         wrap2.selectAll(".photo-wrapper:not(.mly-wrapper)").classed("hide", true);
39676         wrap2.selectAll(".photo-wrapper.mly-wrapper").classed("hide", false);
39677         _mlyViewer.resize();
39678       }
39679       return this;
39680     },
39681     // Hide the image viewer and resets map markers
39682     hideViewer: function(context) {
39683       _mlyActiveImage = null;
39684       if (!_mlyFallback && _mlyViewer) {
39685         _mlyViewer.getComponent("sequence").stop();
39686       }
39687       const viewer = context.container().select(".photoviewer");
39688       if (!viewer.empty())
39689         viewer.datum(null);
39690       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
39691       this.updateUrlImage(null);
39692       dispatch5.call("imageChanged");
39693       dispatch5.call("loadedMapFeatures");
39694       dispatch5.call("loadedSigns");
39695       return this.setStyles(context, null);
39696     },
39697     // Update the URL with current image id
39698     updateUrlImage: function(imageId) {
39699       if (!window.mocha) {
39700         const hash = utilStringQs(window.location.hash);
39701         if (imageId) {
39702           hash.photo = "mapillary/" + imageId;
39703         } else {
39704           delete hash.photo;
39705         }
39706         window.location.replace("#" + utilQsString(hash, true));
39707       }
39708     },
39709     // Highlight the detection in the viewer that is related to the clicked map feature
39710     highlightDetection: function(detection) {
39711       if (detection) {
39712         _mlyHighlightedDetection = detection.id;
39713       }
39714       return this;
39715     },
39716     // Initialize image viewer (Mapillar JS)
39717     initViewer: function(context) {
39718       const that = this;
39719       if (!window.mapillary)
39720         return;
39721       const opts = {
39722         accessToken,
39723         component: {
39724           cover: false,
39725           keyboard: false,
39726           tag: true
39727         },
39728         container: "ideditor-mly"
39729       };
39730       if (!mapillary.isSupported() && mapillary.isFallbackSupported()) {
39731         _mlyFallback = true;
39732         opts.component = {
39733           cover: false,
39734           direction: false,
39735           imagePlane: false,
39736           keyboard: false,
39737           mouse: false,
39738           sequence: false,
39739           tag: false,
39740           image: true,
39741           // fallback
39742           navigation: true
39743           // fallback
39744         };
39745       }
39746       _mlyViewer = new mapillary.Viewer(opts);
39747       _mlyViewer.on("image", imageChanged);
39748       _mlyViewer.on("bearing", bearingChanged);
39749       if (_mlyViewerFilter) {
39750         _mlyViewer.setFilter(_mlyViewerFilter);
39751       }
39752       context.ui().photoviewer.on("resize.mapillary", function() {
39753         if (_mlyViewer)
39754           _mlyViewer.resize();
39755       });
39756       function imageChanged(node) {
39757         that.resetTags();
39758         const image = node.image;
39759         that.setActiveImage(image);
39760         that.setStyles(context, null);
39761         const loc = [image.originalLngLat.lng, image.originalLngLat.lat];
39762         context.map().centerEase(loc);
39763         that.updateUrlImage(image.id);
39764         if (_mlyShowFeatureDetections || _mlyShowSignDetections) {
39765           that.updateDetections(image.id, `${apiUrl}/${image.id}/detections?access_token=${accessToken}&fields=id,image,geometry,value`);
39766         }
39767         dispatch5.call("imageChanged");
39768       }
39769       function bearingChanged(e3) {
39770         dispatch5.call("bearingChanged", void 0, e3);
39771       }
39772     },
39773     // Move to an image
39774     selectImage: function(context, imageId) {
39775       if (_mlyViewer && imageId) {
39776         _mlyViewer.moveTo(imageId).catch(function(e3) {
39777           console.error("mly3", e3);
39778         });
39779       }
39780       return this;
39781     },
39782     // Return the currently displayed image
39783     getActiveImage: function() {
39784       return _mlyActiveImage;
39785     },
39786     // Return a list of detection objects for the given id
39787     getDetections: function(id2) {
39788       return loadData(`${apiUrl}/${id2}/detections?access_token=${accessToken}&fields=id,value,image`);
39789     },
39790     // Set the currently visible image
39791     setActiveImage: function(image) {
39792       if (image) {
39793         _mlyActiveImage = {
39794           ca: image.originalCompassAngle,
39795           id: image.id,
39796           loc: [image.originalLngLat.lng, image.originalLngLat.lat],
39797           is_pano: image.cameraType === "spherical",
39798           sequence_id: image.sequenceId
39799         };
39800       } else {
39801         _mlyActiveImage = null;
39802       }
39803     },
39804     // Update the currently highlighted sequence and selected bubble.
39805     setStyles: function(context, hovered) {
39806       const hoveredImageId = hovered && hovered.id;
39807       const hoveredSequenceId = hovered && hovered.sequence_id;
39808       const selectedSequenceId = _mlyActiveImage && _mlyActiveImage.sequence_id;
39809       context.container().selectAll(".layer-mapillary .viewfield-group").classed("highlighted", function(d2) {
39810         return d2.sequence_id === selectedSequenceId || d2.id === hoveredImageId;
39811       }).classed("hovered", function(d2) {
39812         return d2.id === hoveredImageId;
39813       });
39814       context.container().selectAll(".layer-mapillary .sequence").classed("highlighted", function(d2) {
39815         return d2.properties.id === hoveredSequenceId;
39816       }).classed("currentView", function(d2) {
39817         return d2.properties.id === selectedSequenceId;
39818       });
39819       return this;
39820     },
39821     // Get detections for the current image and shows them in the image viewer
39822     updateDetections: function(imageId, url) {
39823       if (!_mlyViewer || _mlyFallback)
39824         return;
39825       if (!imageId)
39826         return;
39827       const cache = _mlyCache.image_detections;
39828       if (cache.forImageId[imageId]) {
39829         showDetections(_mlyCache.image_detections.forImageId[imageId]);
39830       } else {
39831         loadData(url).then((detections) => {
39832           detections.forEach(function(detection) {
39833             if (!cache.forImageId[imageId]) {
39834               cache.forImageId[imageId] = [];
39835             }
39836             cache.forImageId[imageId].push({
39837               geometry: detection.geometry,
39838               id: detection.id,
39839               image_id: imageId,
39840               value: detection.value
39841             });
39842           });
39843           showDetections(_mlyCache.image_detections.forImageId[imageId] || []);
39844         });
39845       }
39846       function showDetections(detections) {
39847         const tagComponent = _mlyViewer.getComponent("tag");
39848         detections.forEach(function(data) {
39849           const tag = makeTag(data);
39850           if (tag) {
39851             tagComponent.add([tag]);
39852           }
39853         });
39854       }
39855       function makeTag(data) {
39856         const valueParts = data.value.split("--");
39857         if (!valueParts.length)
39858           return;
39859         let tag;
39860         let text2;
39861         let color2 = 16777215;
39862         if (_mlyHighlightedDetection === data.id) {
39863           color2 = 16776960;
39864           text2 = valueParts[1];
39865           if (text2 === "flat" || text2 === "discrete" || text2 === "sign") {
39866             text2 = valueParts[2];
39867           }
39868           text2 = text2.replace(/-/g, " ");
39869           text2 = text2.charAt(0).toUpperCase() + text2.slice(1);
39870           _mlyHighlightedDetection = null;
39871         }
39872         var decodedGeometry = window.atob(data.geometry);
39873         var uintArray = new Uint8Array(decodedGeometry.length);
39874         for (var i3 = 0; i3 < decodedGeometry.length; i3++) {
39875           uintArray[i3] = decodedGeometry.charCodeAt(i3);
39876         }
39877         const tile = new import_vector_tile.VectorTile(new import_pbf.default(uintArray.buffer));
39878         const layer = tile.layers["mpy-or"];
39879         const geometries = layer.feature(0).loadGeometry();
39880         const polygon2 = geometries.map((ring) => ring.map((point2) => [point2.x / layer.extent, point2.y / layer.extent]));
39881         tag = new mapillary.OutlineTag(
39882           data.id,
39883           new mapillary.PolygonGeometry(polygon2[0]),
39884           {
39885             text: text2,
39886             textColor: color2,
39887             lineColor: color2,
39888             lineWidth: 2,
39889             fillColor: color2,
39890             fillOpacity: 0.3
39891           }
39892         );
39893         return tag;
39894       }
39895     },
39896     // Return the current cache
39897     cache: function() {
39898       return _mlyCache;
39899     }
39900   };
39901
39902   // modules/core/validation/models.js
39903   function validationIssue(attrs) {
39904     this.type = attrs.type;
39905     this.subtype = attrs.subtype;
39906     this.severity = attrs.severity;
39907     this.message = attrs.message;
39908     this.reference = attrs.reference;
39909     this.entityIds = attrs.entityIds;
39910     this.loc = attrs.loc;
39911     this.data = attrs.data;
39912     this.dynamicFixes = attrs.dynamicFixes;
39913     this.hash = attrs.hash;
39914     this.id = generateID.apply(this);
39915     this.key = generateKey.apply(this);
39916     this.autoFix = null;
39917     function generateID() {
39918       var parts = [this.type];
39919       if (this.hash) {
39920         parts.push(this.hash);
39921       }
39922       if (this.subtype) {
39923         parts.push(this.subtype);
39924       }
39925       if (this.entityIds) {
39926         var entityKeys = this.entityIds.slice().sort();
39927         parts.push.apply(parts, entityKeys);
39928       }
39929       return parts.join(":");
39930     }
39931     function generateKey() {
39932       return this.id + ":" + Date.now().toString();
39933     }
39934     this.extent = function(resolver) {
39935       if (this.loc) {
39936         return geoExtent(this.loc);
39937       }
39938       if (this.entityIds && this.entityIds.length) {
39939         return this.entityIds.reduce(function(extent, entityId) {
39940           return extent.extend(resolver.entity(entityId).extent(resolver));
39941         }, geoExtent());
39942       }
39943       return null;
39944     };
39945     this.fixes = function(context) {
39946       var fixes = this.dynamicFixes ? this.dynamicFixes(context) : [];
39947       var issue = this;
39948       if (issue.severity === "warning") {
39949         fixes.push(new validationIssueFix({
39950           title: _t.append("issues.fix.ignore_issue.title"),
39951           icon: "iD-icon-close",
39952           onClick: function() {
39953             context.validator().ignoreIssue(this.issue.id);
39954           }
39955         }));
39956       }
39957       fixes.forEach(function(fix) {
39958         fix.id = fix.title.stringId;
39959         fix.issue = issue;
39960         if (fix.autoArgs) {
39961           issue.autoFix = fix;
39962         }
39963       });
39964       return fixes;
39965     };
39966   }
39967   function validationIssueFix(attrs) {
39968     this.title = attrs.title;
39969     this.onClick = attrs.onClick;
39970     this.disabledReason = attrs.disabledReason;
39971     this.icon = attrs.icon;
39972     this.entityIds = attrs.entityIds || [];
39973     this.autoArgs = attrs.autoArgs;
39974     this.issue = null;
39975   }
39976
39977   // modules/services/maprules.js
39978   var buildRuleChecks = function() {
39979     return {
39980       equals: function(equals) {
39981         return function(tags) {
39982           return Object.keys(equals).every(function(k2) {
39983             return equals[k2] === tags[k2];
39984           });
39985         };
39986       },
39987       notEquals: function(notEquals) {
39988         return function(tags) {
39989           return Object.keys(notEquals).some(function(k2) {
39990             return notEquals[k2] !== tags[k2];
39991           });
39992         };
39993       },
39994       absence: function(absence) {
39995         return function(tags) {
39996           return Object.keys(tags).indexOf(absence) === -1;
39997         };
39998       },
39999       presence: function(presence) {
40000         return function(tags) {
40001           return Object.keys(tags).indexOf(presence) > -1;
40002         };
40003       },
40004       greaterThan: function(greaterThan) {
40005         var key = Object.keys(greaterThan)[0];
40006         var value = greaterThan[key];
40007         return function(tags) {
40008           return tags[key] > value;
40009         };
40010       },
40011       greaterThanEqual: function(greaterThanEqual) {
40012         var key = Object.keys(greaterThanEqual)[0];
40013         var value = greaterThanEqual[key];
40014         return function(tags) {
40015           return tags[key] >= value;
40016         };
40017       },
40018       lessThan: function(lessThan) {
40019         var key = Object.keys(lessThan)[0];
40020         var value = lessThan[key];
40021         return function(tags) {
40022           return tags[key] < value;
40023         };
40024       },
40025       lessThanEqual: function(lessThanEqual) {
40026         var key = Object.keys(lessThanEqual)[0];
40027         var value = lessThanEqual[key];
40028         return function(tags) {
40029           return tags[key] <= value;
40030         };
40031       },
40032       positiveRegex: function(positiveRegex) {
40033         var tagKey = Object.keys(positiveRegex)[0];
40034         var expression = positiveRegex[tagKey].join("|");
40035         var regex = new RegExp(expression);
40036         return function(tags) {
40037           return regex.test(tags[tagKey]);
40038         };
40039       },
40040       negativeRegex: function(negativeRegex) {
40041         var tagKey = Object.keys(negativeRegex)[0];
40042         var expression = negativeRegex[tagKey].join("|");
40043         var regex = new RegExp(expression);
40044         return function(tags) {
40045           return !regex.test(tags[tagKey]);
40046         };
40047       }
40048     };
40049   };
40050   var buildLineKeys = function() {
40051     return {
40052       highway: {
40053         rest_area: true,
40054         services: true
40055       },
40056       railway: {
40057         roundhouse: true,
40058         station: true,
40059         traverser: true,
40060         turntable: true,
40061         wash: true
40062       }
40063     };
40064   };
40065   var maprules_default = {
40066     init: function() {
40067       this._ruleChecks = buildRuleChecks();
40068       this._validationRules = [];
40069       this._areaKeys = osmAreaKeys;
40070       this._lineKeys = buildLineKeys();
40071     },
40072     // list of rules only relevant to tag checks...
40073     filterRuleChecks: function(selector) {
40074       var _ruleChecks = this._ruleChecks;
40075       return Object.keys(selector).reduce(function(rules, key) {
40076         if (["geometry", "error", "warning"].indexOf(key) === -1) {
40077           rules.push(_ruleChecks[key](selector[key]));
40078         }
40079         return rules;
40080       }, []);
40081     },
40082     // builds tagMap from mapcss-parse selector object...
40083     buildTagMap: function(selector) {
40084       var getRegexValues = function(regexes) {
40085         return regexes.map(function(regex) {
40086           return regex.replace(/\$|\^/g, "");
40087         });
40088       };
40089       var tagMap = Object.keys(selector).reduce(function(expectedTags, key) {
40090         var values;
40091         var isRegex = /regex/gi.test(key);
40092         var isEqual4 = /equals/gi.test(key);
40093         if (isRegex || isEqual4) {
40094           Object.keys(selector[key]).forEach(function(selectorKey) {
40095             values = isEqual4 ? [selector[key][selectorKey]] : getRegexValues(selector[key][selectorKey]);
40096             if (expectedTags.hasOwnProperty(selectorKey)) {
40097               values = values.concat(expectedTags[selectorKey]);
40098             }
40099             expectedTags[selectorKey] = values;
40100           });
40101         } else if (/(greater|less)Than(Equal)?|presence/g.test(key)) {
40102           var tagKey = /presence/.test(key) ? selector[key] : Object.keys(selector[key])[0];
40103           values = [selector[key][tagKey]];
40104           if (expectedTags.hasOwnProperty(tagKey)) {
40105             values = values.concat(expectedTags[tagKey]);
40106           }
40107           expectedTags[tagKey] = values;
40108         }
40109         return expectedTags;
40110       }, {});
40111       return tagMap;
40112     },
40113     // inspired by osmWay#isArea()
40114     inferGeometry: function(tagMap) {
40115       var _lineKeys = this._lineKeys;
40116       var _areaKeys = this._areaKeys;
40117       var keyValueDoesNotImplyArea = function(key2) {
40118         return utilArrayIntersection(tagMap[key2], Object.keys(_areaKeys[key2])).length > 0;
40119       };
40120       var keyValueImpliesLine = function(key2) {
40121         return utilArrayIntersection(tagMap[key2], Object.keys(_lineKeys[key2])).length > 0;
40122       };
40123       if (tagMap.hasOwnProperty("area")) {
40124         if (tagMap.area.indexOf("yes") > -1) {
40125           return "area";
40126         }
40127         if (tagMap.area.indexOf("no") > -1) {
40128           return "line";
40129         }
40130       }
40131       for (var key in tagMap) {
40132         if (key in _areaKeys && !keyValueDoesNotImplyArea(key)) {
40133           return "area";
40134         }
40135         if (key in _lineKeys && keyValueImpliesLine(key)) {
40136           return "area";
40137         }
40138       }
40139       return "line";
40140     },
40141     // adds from mapcss-parse selector check...
40142     addRule: function(selector) {
40143       var rule = {
40144         // checks relevant to mapcss-selector
40145         checks: this.filterRuleChecks(selector),
40146         // true if all conditions for a tag error are true..
40147         matches: function(entity) {
40148           return this.checks.every(function(check) {
40149             return check(entity.tags);
40150           });
40151         },
40152         // borrowed from Way#isArea()
40153         inferredGeometry: this.inferGeometry(this.buildTagMap(selector), this._areaKeys),
40154         geometryMatches: function(entity, graph) {
40155           if (entity.type === "node" || entity.type === "relation") {
40156             return selector.geometry === entity.type;
40157           } else if (entity.type === "way") {
40158             return this.inferredGeometry === entity.geometry(graph);
40159           }
40160         },
40161         // when geometries match and tag matches are present, return a warning...
40162         findIssues: function(entity, graph, issues) {
40163           if (this.geometryMatches(entity, graph) && this.matches(entity)) {
40164             var severity = Object.keys(selector).indexOf("error") > -1 ? "error" : "warning";
40165             var message = selector[severity];
40166             issues.push(new validationIssue({
40167               type: "maprules",
40168               severity,
40169               message: function() {
40170                 return message;
40171               },
40172               entityIds: [entity.id]
40173             }));
40174           }
40175         }
40176       };
40177       this._validationRules.push(rule);
40178     },
40179     clearRules: function() {
40180       this._validationRules = [];
40181     },
40182     // returns validationRules...
40183     validationRules: function() {
40184       return this._validationRules;
40185     },
40186     // returns ruleChecks
40187     ruleChecks: function() {
40188       return this._ruleChecks;
40189     }
40190   };
40191
40192   // modules/services/nominatim.js
40193   var import_rbush7 = __toESM(require_rbush_min());
40194
40195   // modules/core/difference.js
40196   var import_fast_deep_equal3 = __toESM(require_fast_deep_equal());
40197   function coreDifference(base, head) {
40198     var _changes = {};
40199     var _didChange = {};
40200     var _diff = {};
40201     function checkEntityID(id2) {
40202       var h2 = head.entities[id2];
40203       var b2 = base.entities[id2];
40204       if (h2 === b2)
40205         return;
40206       if (_changes[id2])
40207         return;
40208       if (!h2 && b2) {
40209         _changes[id2] = { base: b2, head: h2 };
40210         _didChange.deletion = true;
40211         return;
40212       }
40213       if (h2 && !b2) {
40214         _changes[id2] = { base: b2, head: h2 };
40215         _didChange.addition = true;
40216         return;
40217       }
40218       if (h2 && b2) {
40219         if (h2.members && b2.members && !(0, import_fast_deep_equal3.default)(h2.members, b2.members)) {
40220           _changes[id2] = { base: b2, head: h2 };
40221           _didChange.geometry = true;
40222           _didChange.properties = true;
40223           return;
40224         }
40225         if (h2.loc && b2.loc && !geoVecEqual(h2.loc, b2.loc)) {
40226           _changes[id2] = { base: b2, head: h2 };
40227           _didChange.geometry = true;
40228         }
40229         if (h2.nodes && b2.nodes && !(0, import_fast_deep_equal3.default)(h2.nodes, b2.nodes)) {
40230           _changes[id2] = { base: b2, head: h2 };
40231           _didChange.geometry = true;
40232         }
40233         if (h2.tags && b2.tags && !(0, import_fast_deep_equal3.default)(h2.tags, b2.tags)) {
40234           _changes[id2] = { base: b2, head: h2 };
40235           _didChange.properties = true;
40236         }
40237       }
40238     }
40239     function load() {
40240       var ids = utilArrayUniq(Object.keys(head.entities).concat(Object.keys(base.entities)));
40241       for (var i3 = 0; i3 < ids.length; i3++) {
40242         checkEntityID(ids[i3]);
40243       }
40244     }
40245     load();
40246     _diff.length = function length() {
40247       return Object.keys(_changes).length;
40248     };
40249     _diff.changes = function changes() {
40250       return _changes;
40251     };
40252     _diff.didChange = _didChange;
40253     _diff.extantIDs = function extantIDs(includeRelMembers) {
40254       var result = /* @__PURE__ */ new Set();
40255       Object.keys(_changes).forEach(function(id2) {
40256         if (_changes[id2].head) {
40257           result.add(id2);
40258         }
40259         var h2 = _changes[id2].head;
40260         var b2 = _changes[id2].base;
40261         var entity = h2 || b2;
40262         if (includeRelMembers && entity.type === "relation") {
40263           var mh = h2 ? h2.members.map(function(m2) {
40264             return m2.id;
40265           }) : [];
40266           var mb = b2 ? b2.members.map(function(m2) {
40267             return m2.id;
40268           }) : [];
40269           utilArrayUnion(mh, mb).forEach(function(memberID) {
40270             if (head.hasEntity(memberID)) {
40271               result.add(memberID);
40272             }
40273           });
40274         }
40275       });
40276       return Array.from(result);
40277     };
40278     _diff.modified = function modified() {
40279       var result = [];
40280       Object.values(_changes).forEach(function(change) {
40281         if (change.base && change.head) {
40282           result.push(change.head);
40283         }
40284       });
40285       return result;
40286     };
40287     _diff.created = function created() {
40288       var result = [];
40289       Object.values(_changes).forEach(function(change) {
40290         if (!change.base && change.head) {
40291           result.push(change.head);
40292         }
40293       });
40294       return result;
40295     };
40296     _diff.deleted = function deleted() {
40297       var result = [];
40298       Object.values(_changes).forEach(function(change) {
40299         if (change.base && !change.head) {
40300           result.push(change.base);
40301         }
40302       });
40303       return result;
40304     };
40305     _diff.summary = function summary() {
40306       var relevant = {};
40307       var keys2 = Object.keys(_changes);
40308       for (var i3 = 0; i3 < keys2.length; i3++) {
40309         var change = _changes[keys2[i3]];
40310         if (change.head && change.head.geometry(head) !== "vertex") {
40311           addEntity(change.head, head, change.base ? "modified" : "created");
40312         } else if (change.base && change.base.geometry(base) !== "vertex") {
40313           addEntity(change.base, base, "deleted");
40314         } else if (change.base && change.head) {
40315           var moved = !(0, import_fast_deep_equal3.default)(change.base.loc, change.head.loc);
40316           var retagged = !(0, import_fast_deep_equal3.default)(change.base.tags, change.head.tags);
40317           if (moved) {
40318             addParents(change.head);
40319           }
40320           if (retagged || moved && change.head.hasInterestingTags()) {
40321             addEntity(change.head, head, "modified");
40322           }
40323         } else if (change.head && change.head.hasInterestingTags()) {
40324           addEntity(change.head, head, "created");
40325         } else if (change.base && change.base.hasInterestingTags()) {
40326           addEntity(change.base, base, "deleted");
40327         }
40328       }
40329       return Object.values(relevant);
40330       function addEntity(entity, graph, changeType) {
40331         relevant[entity.id] = {
40332           entity,
40333           graph,
40334           changeType
40335         };
40336       }
40337       function addParents(entity) {
40338         var parents = head.parentWays(entity);
40339         for (var j3 = parents.length - 1; j3 >= 0; j3--) {
40340           var parent = parents[j3];
40341           if (!(parent.id in relevant)) {
40342             addEntity(parent, head, "modified");
40343           }
40344         }
40345       }
40346     };
40347     _diff.complete = function complete(extent) {
40348       var result = {};
40349       var id2, change;
40350       for (id2 in _changes) {
40351         change = _changes[id2];
40352         var h2 = change.head;
40353         var b2 = change.base;
40354         var entity = h2 || b2;
40355         var i3;
40356         if (extent && (!h2 || !h2.intersects(extent, head)) && (!b2 || !b2.intersects(extent, base))) {
40357           continue;
40358         }
40359         result[id2] = h2;
40360         if (entity.type === "way") {
40361           var nh = h2 ? h2.nodes : [];
40362           var nb = b2 ? b2.nodes : [];
40363           var diff;
40364           diff = utilArrayDifference(nh, nb);
40365           for (i3 = 0; i3 < diff.length; i3++) {
40366             result[diff[i3]] = head.hasEntity(diff[i3]);
40367           }
40368           diff = utilArrayDifference(nb, nh);
40369           for (i3 = 0; i3 < diff.length; i3++) {
40370             result[diff[i3]] = head.hasEntity(diff[i3]);
40371           }
40372         }
40373         if (entity.type === "relation" && entity.isMultipolygon()) {
40374           var mh = h2 ? h2.members.map(function(m2) {
40375             return m2.id;
40376           }) : [];
40377           var mb = b2 ? b2.members.map(function(m2) {
40378             return m2.id;
40379           }) : [];
40380           var ids = utilArrayUnion(mh, mb);
40381           for (i3 = 0; i3 < ids.length; i3++) {
40382             var member = head.hasEntity(ids[i3]);
40383             if (!member)
40384               continue;
40385             if (extent && !member.intersects(extent, head))
40386               continue;
40387             result[ids[i3]] = member;
40388           }
40389         }
40390         addParents(head.parentWays(entity), result);
40391         addParents(head.parentRelations(entity), result);
40392       }
40393       return result;
40394       function addParents(parents, result2) {
40395         for (var i4 = 0; i4 < parents.length; i4++) {
40396           var parent = parents[i4];
40397           if (parent.id in result2)
40398             continue;
40399           result2[parent.id] = parent;
40400           addParents(head.parentRelations(parent), result2);
40401         }
40402       }
40403     };
40404     return _diff;
40405   }
40406
40407   // modules/core/tree.js
40408   var import_rbush5 = __toESM(require_rbush_min());
40409   function coreTree(head) {
40410     var _rtree = new import_rbush5.default();
40411     var _bboxes = {};
40412     var _segmentsRTree = new import_rbush5.default();
40413     var _segmentsBBoxes = {};
40414     var _segmentsByWayId = {};
40415     var tree = {};
40416     function entityBBox(entity) {
40417       var bbox2 = entity.extent(head).bbox();
40418       bbox2.id = entity.id;
40419       _bboxes[entity.id] = bbox2;
40420       return bbox2;
40421     }
40422     function segmentBBox(segment) {
40423       var extent = segment.extent(head);
40424       if (!extent)
40425         return null;
40426       var bbox2 = extent.bbox();
40427       bbox2.segment = segment;
40428       _segmentsBBoxes[segment.id] = bbox2;
40429       return bbox2;
40430     }
40431     function removeEntity(entity) {
40432       _rtree.remove(_bboxes[entity.id]);
40433       delete _bboxes[entity.id];
40434       if (_segmentsByWayId[entity.id]) {
40435         _segmentsByWayId[entity.id].forEach(function(segment) {
40436           _segmentsRTree.remove(_segmentsBBoxes[segment.id]);
40437           delete _segmentsBBoxes[segment.id];
40438         });
40439         delete _segmentsByWayId[entity.id];
40440       }
40441     }
40442     function loadEntities(entities) {
40443       _rtree.load(entities.map(entityBBox));
40444       var segments = [];
40445       entities.forEach(function(entity) {
40446         if (entity.segments) {
40447           var entitySegments = entity.segments(head);
40448           _segmentsByWayId[entity.id] = entitySegments;
40449           segments = segments.concat(entitySegments);
40450         }
40451       });
40452       if (segments.length)
40453         _segmentsRTree.load(segments.map(segmentBBox).filter(Boolean));
40454     }
40455     function updateParents(entity, insertions, memo) {
40456       head.parentWays(entity).forEach(function(way) {
40457         if (_bboxes[way.id]) {
40458           removeEntity(way);
40459           insertions[way.id] = way;
40460         }
40461         updateParents(way, insertions, memo);
40462       });
40463       head.parentRelations(entity).forEach(function(relation) {
40464         if (memo[entity.id])
40465           return;
40466         memo[entity.id] = true;
40467         if (_bboxes[relation.id]) {
40468           removeEntity(relation);
40469           insertions[relation.id] = relation;
40470         }
40471         updateParents(relation, insertions, memo);
40472       });
40473     }
40474     tree.rebase = function(entities, force) {
40475       var insertions = {};
40476       for (var i3 = 0; i3 < entities.length; i3++) {
40477         var entity = entities[i3];
40478         if (!entity.visible)
40479           continue;
40480         if (head.entities.hasOwnProperty(entity.id) || _bboxes[entity.id]) {
40481           if (!force) {
40482             continue;
40483           } else if (_bboxes[entity.id]) {
40484             removeEntity(entity);
40485           }
40486         }
40487         insertions[entity.id] = entity;
40488         updateParents(entity, insertions, {});
40489       }
40490       loadEntities(Object.values(insertions));
40491       return tree;
40492     };
40493     function updateToGraph(graph) {
40494       if (graph === head)
40495         return;
40496       var diff = coreDifference(head, graph);
40497       head = graph;
40498       var changed = diff.didChange;
40499       if (!changed.addition && !changed.deletion && !changed.geometry)
40500         return;
40501       var insertions = {};
40502       if (changed.deletion) {
40503         diff.deleted().forEach(function(entity) {
40504           removeEntity(entity);
40505         });
40506       }
40507       if (changed.geometry) {
40508         diff.modified().forEach(function(entity) {
40509           removeEntity(entity);
40510           insertions[entity.id] = entity;
40511           updateParents(entity, insertions, {});
40512         });
40513       }
40514       if (changed.addition) {
40515         diff.created().forEach(function(entity) {
40516           insertions[entity.id] = entity;
40517         });
40518       }
40519       loadEntities(Object.values(insertions));
40520     }
40521     tree.intersects = function(extent, graph) {
40522       updateToGraph(graph);
40523       return _rtree.search(extent.bbox()).map(function(bbox2) {
40524         return graph.entity(bbox2.id);
40525       });
40526     };
40527     tree.waySegments = function(extent, graph) {
40528       updateToGraph(graph);
40529       return _segmentsRTree.search(extent.bbox()).map(function(bbox2) {
40530         return bbox2.segment;
40531       });
40532     };
40533     return tree;
40534   }
40535
40536   // modules/svg/icon.js
40537   function svgIcon(name, svgklass, useklass) {
40538     return function drawIcon(selection2) {
40539       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);
40540     };
40541   }
40542
40543   // modules/ui/modal.js
40544   function uiModal(selection2, blocking) {
40545     let keybinding = utilKeybinding("modal");
40546     let previous = selection2.select("div.modal");
40547     let animate = previous.empty();
40548     previous.transition().duration(200).style("opacity", 0).remove();
40549     let shaded = selection2.append("div").attr("class", "shaded").style("opacity", 0);
40550     shaded.close = () => {
40551       shaded.transition().duration(200).style("opacity", 0).remove();
40552       modal.transition().duration(200).style("top", "0px");
40553       select_default2(document).call(keybinding.unbind);
40554     };
40555     let modal = shaded.append("div").attr("class", "modal fillL");
40556     modal.append("input").attr("class", "keytrap keytrap-first").on("focus.keytrap", moveFocusToLast);
40557     if (!blocking) {
40558       shaded.on("click.remove-modal", (d3_event) => {
40559         if (d3_event.target === this) {
40560           shaded.close();
40561         }
40562       });
40563       modal.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", shaded.close).call(svgIcon("#iD-icon-close"));
40564       keybinding.on("\u232B", shaded.close).on("\u238B", shaded.close);
40565       select_default2(document).call(keybinding);
40566     }
40567     modal.append("div").attr("class", "content");
40568     modal.append("input").attr("class", "keytrap keytrap-last").on("focus.keytrap", moveFocusToFirst);
40569     if (animate) {
40570       shaded.transition().style("opacity", 1);
40571     } else {
40572       shaded.style("opacity", 1);
40573     }
40574     return shaded;
40575     function moveFocusToFirst() {
40576       let node = modal.select("a, button, input:not(.keytrap), select, textarea").node();
40577       if (node) {
40578         node.focus();
40579       } else {
40580         select_default2(this).node().blur();
40581       }
40582     }
40583     function moveFocusToLast() {
40584       let nodes = modal.selectAll("a, button, input:not(.keytrap), select, textarea").nodes();
40585       if (nodes.length) {
40586         nodes[nodes.length - 1].focus();
40587       } else {
40588         select_default2(this).node().blur();
40589       }
40590     }
40591   }
40592
40593   // modules/ui/loading.js
40594   function uiLoading(context) {
40595     let _modalSelection = select_default2(null);
40596     let _message = "";
40597     let _blocking = false;
40598     let loading = (selection2) => {
40599       _modalSelection = uiModal(selection2, _blocking);
40600       let loadertext = _modalSelection.select(".content").classed("loading-modal", true).append("div").attr("class", "modal-section fillL");
40601       loadertext.append("img").attr("class", "loader").attr("src", context.imagePath("loader-white.gif"));
40602       loadertext.append("h3").html(_message);
40603       _modalSelection.select("button.close").attr("class", "hide");
40604       return loading;
40605     };
40606     loading.message = function(val) {
40607       if (!arguments.length)
40608         return _message;
40609       _message = val;
40610       return loading;
40611     };
40612     loading.blocking = function(val) {
40613       if (!arguments.length)
40614         return _blocking;
40615       _blocking = val;
40616       return loading;
40617     };
40618     loading.close = () => {
40619       _modalSelection.remove();
40620     };
40621     loading.isShown = () => {
40622       return _modalSelection && !_modalSelection.empty() && _modalSelection.node().parentNode;
40623     };
40624     return loading;
40625   }
40626
40627   // modules/core/history.js
40628   function coreHistory(context) {
40629     var dispatch14 = dispatch_default("reset", "change", "merge", "restore", "undone", "redone", "storage_error");
40630     var lock = utilSessionMutex("lock");
40631     var _hasUnresolvedRestorableChanges = lock.lock() && !!corePreferences(getKey("saved_history"));
40632     var duration = 150;
40633     var _imageryUsed = [];
40634     var _photoOverlaysUsed = [];
40635     var _checkpoints = {};
40636     var _pausedGraph;
40637     var _stack;
40638     var _index;
40639     var _tree;
40640     function _act(actions, t2) {
40641       actions = Array.prototype.slice.call(actions);
40642       var annotation;
40643       if (typeof actions[actions.length - 1] !== "function") {
40644         annotation = actions.pop();
40645       }
40646       var graph = _stack[_index].graph;
40647       for (var i3 = 0; i3 < actions.length; i3++) {
40648         graph = actions[i3](graph, t2);
40649       }
40650       return {
40651         graph,
40652         annotation,
40653         imageryUsed: _imageryUsed,
40654         photoOverlaysUsed: _photoOverlaysUsed,
40655         transform: context.projection.transform(),
40656         selectedIDs: context.selectedIDs()
40657       };
40658     }
40659     function _perform(args, t2) {
40660       var previous = _stack[_index].graph;
40661       _stack = _stack.slice(0, _index + 1);
40662       var actionResult = _act(args, t2);
40663       _stack.push(actionResult);
40664       _index++;
40665       return change(previous);
40666     }
40667     function _replace(args, t2) {
40668       var previous = _stack[_index].graph;
40669       var actionResult = _act(args, t2);
40670       _stack[_index] = actionResult;
40671       return change(previous);
40672     }
40673     function _overwrite(args, t2) {
40674       var previous = _stack[_index].graph;
40675       if (_index > 0) {
40676         _index--;
40677         _stack.pop();
40678       }
40679       _stack = _stack.slice(0, _index + 1);
40680       var actionResult = _act(args, t2);
40681       _stack.push(actionResult);
40682       _index++;
40683       return change(previous);
40684     }
40685     function change(previous) {
40686       var difference = coreDifference(previous, history.graph());
40687       if (!_pausedGraph) {
40688         dispatch14.call("change", this, difference);
40689       }
40690       return difference;
40691     }
40692     function getKey(n3) {
40693       return "iD_" + window.location.origin + "_" + n3;
40694     }
40695     var history = {
40696       graph: function() {
40697         return _stack[_index].graph;
40698       },
40699       tree: function() {
40700         return _tree;
40701       },
40702       base: function() {
40703         return _stack[0].graph;
40704       },
40705       merge: function(entities) {
40706         var stack = _stack.map(function(state) {
40707           return state.graph;
40708         });
40709         _stack[0].graph.rebase(entities, stack, false);
40710         _tree.rebase(entities, false);
40711         dispatch14.call("merge", this, entities);
40712       },
40713       perform: function() {
40714         select_default2(document).interrupt("history.perform");
40715         var transitionable = false;
40716         var action0 = arguments[0];
40717         if (arguments.length === 1 || arguments.length === 2 && typeof arguments[1] !== "function") {
40718           transitionable = !!action0.transitionable;
40719         }
40720         if (transitionable) {
40721           var origArguments = arguments;
40722           select_default2(document).transition("history.perform").duration(duration).ease(linear2).tween("history.tween", function() {
40723             return function(t2) {
40724               if (t2 < 1)
40725                 _overwrite([action0], t2);
40726             };
40727           }).on("start", function() {
40728             _perform([action0], 0);
40729           }).on("end interrupt", function() {
40730             _overwrite(origArguments, 1);
40731           });
40732         } else {
40733           return _perform(arguments);
40734         }
40735       },
40736       replace: function() {
40737         select_default2(document).interrupt("history.perform");
40738         return _replace(arguments, 1);
40739       },
40740       // Same as calling pop and then perform
40741       overwrite: function() {
40742         select_default2(document).interrupt("history.perform");
40743         return _overwrite(arguments, 1);
40744       },
40745       pop: function(n3) {
40746         select_default2(document).interrupt("history.perform");
40747         var previous = _stack[_index].graph;
40748         if (isNaN(+n3) || +n3 < 0) {
40749           n3 = 1;
40750         }
40751         while (n3-- > 0 && _index > 0) {
40752           _index--;
40753           _stack.pop();
40754         }
40755         return change(previous);
40756       },
40757       // Back to the previous annotated state or _index = 0.
40758       undo: function() {
40759         select_default2(document).interrupt("history.perform");
40760         var previousStack = _stack[_index];
40761         var previous = previousStack.graph;
40762         while (_index > 0) {
40763           _index--;
40764           if (_stack[_index].annotation)
40765             break;
40766         }
40767         dispatch14.call("undone", this, _stack[_index], previousStack);
40768         return change(previous);
40769       },
40770       // Forward to the next annotated state.
40771       redo: function() {
40772         select_default2(document).interrupt("history.perform");
40773         var previousStack = _stack[_index];
40774         var previous = previousStack.graph;
40775         var tryIndex = _index;
40776         while (tryIndex < _stack.length - 1) {
40777           tryIndex++;
40778           if (_stack[tryIndex].annotation) {
40779             _index = tryIndex;
40780             dispatch14.call("redone", this, _stack[_index], previousStack);
40781             break;
40782           }
40783         }
40784         return change(previous);
40785       },
40786       pauseChangeDispatch: function() {
40787         if (!_pausedGraph) {
40788           _pausedGraph = _stack[_index].graph;
40789         }
40790       },
40791       resumeChangeDispatch: function() {
40792         if (_pausedGraph) {
40793           var previous = _pausedGraph;
40794           _pausedGraph = null;
40795           return change(previous);
40796         }
40797       },
40798       undoAnnotation: function() {
40799         var i3 = _index;
40800         while (i3 >= 0) {
40801           if (_stack[i3].annotation)
40802             return _stack[i3].annotation;
40803           i3--;
40804         }
40805       },
40806       redoAnnotation: function() {
40807         var i3 = _index + 1;
40808         while (i3 <= _stack.length - 1) {
40809           if (_stack[i3].annotation)
40810             return _stack[i3].annotation;
40811           i3++;
40812         }
40813       },
40814       // Returns the entities from the active graph with bounding boxes
40815       // overlapping the given `extent`.
40816       intersects: function(extent) {
40817         return _tree.intersects(extent, _stack[_index].graph);
40818       },
40819       difference: function() {
40820         var base = _stack[0].graph;
40821         var head = _stack[_index].graph;
40822         return coreDifference(base, head);
40823       },
40824       changes: function(action) {
40825         var base = _stack[0].graph;
40826         var head = _stack[_index].graph;
40827         if (action) {
40828           head = action(head);
40829         }
40830         var difference = coreDifference(base, head);
40831         return {
40832           modified: difference.modified(),
40833           created: difference.created(),
40834           deleted: difference.deleted()
40835         };
40836       },
40837       hasChanges: function() {
40838         return this.difference().length() > 0;
40839       },
40840       imageryUsed: function(sources) {
40841         if (sources) {
40842           _imageryUsed = sources;
40843           return history;
40844         } else {
40845           var s2 = /* @__PURE__ */ new Set();
40846           _stack.slice(1, _index + 1).forEach(function(state) {
40847             state.imageryUsed.forEach(function(source) {
40848               if (source !== "Custom") {
40849                 s2.add(source);
40850               }
40851             });
40852           });
40853           return Array.from(s2);
40854         }
40855       },
40856       photoOverlaysUsed: function(sources) {
40857         if (sources) {
40858           _photoOverlaysUsed = sources;
40859           return history;
40860         } else {
40861           var s2 = /* @__PURE__ */ new Set();
40862           _stack.slice(1, _index + 1).forEach(function(state) {
40863             if (state.photoOverlaysUsed && Array.isArray(state.photoOverlaysUsed)) {
40864               state.photoOverlaysUsed.forEach(function(photoOverlay) {
40865                 s2.add(photoOverlay);
40866               });
40867             }
40868           });
40869           return Array.from(s2);
40870         }
40871       },
40872       // save the current history state
40873       checkpoint: function(key) {
40874         _checkpoints[key] = {
40875           stack: _stack,
40876           index: _index
40877         };
40878         return history;
40879       },
40880       // restore history state to a given checkpoint or reset completely
40881       reset: function(key) {
40882         if (key !== void 0 && _checkpoints.hasOwnProperty(key)) {
40883           _stack = _checkpoints[key].stack;
40884           _index = _checkpoints[key].index;
40885         } else {
40886           _stack = [{ graph: coreGraph() }];
40887           _index = 0;
40888           _tree = coreTree(_stack[0].graph);
40889           _checkpoints = {};
40890         }
40891         dispatch14.call("reset");
40892         dispatch14.call("change");
40893         return history;
40894       },
40895       // `toIntroGraph()` is used to export the intro graph used by the walkthrough.
40896       //
40897       // To use it:
40898       //  1. Start the walkthrough.
40899       //  2. Get to a "free editing" tutorial step
40900       //  3. Make your edits to the walkthrough map
40901       //  4. In your browser dev console run:
40902       //        `id.history().toIntroGraph()`
40903       //  5. This outputs stringified JSON to the browser console
40904       //  6. Copy it to `data/intro_graph.json` and prettify it in your code editor
40905       toIntroGraph: function() {
40906         var nextID = { n: 0, r: 0, w: 0 };
40907         var permIDs = {};
40908         var graph = this.graph();
40909         var baseEntities = {};
40910         Object.values(graph.base().entities).forEach(function(entity) {
40911           var copy2 = copyIntroEntity(entity);
40912           baseEntities[copy2.id] = copy2;
40913         });
40914         Object.keys(graph.entities).forEach(function(id2) {
40915           var entity = graph.entities[id2];
40916           if (entity) {
40917             var copy2 = copyIntroEntity(entity);
40918             baseEntities[copy2.id] = copy2;
40919           } else {
40920             delete baseEntities[id2];
40921           }
40922         });
40923         Object.values(baseEntities).forEach(function(entity) {
40924           if (Array.isArray(entity.nodes)) {
40925             entity.nodes = entity.nodes.map(function(node) {
40926               return permIDs[node] || node;
40927             });
40928           }
40929           if (Array.isArray(entity.members)) {
40930             entity.members = entity.members.map(function(member) {
40931               member.id = permIDs[member.id] || member.id;
40932               return member;
40933             });
40934           }
40935         });
40936         return JSON.stringify({ dataIntroGraph: baseEntities });
40937         function copyIntroEntity(source) {
40938           var copy2 = utilObjectOmit(source, ["type", "user", "v", "version", "visible"]);
40939           if (copy2.tags && !Object.keys(copy2.tags)) {
40940             delete copy2.tags;
40941           }
40942           if (Array.isArray(copy2.loc)) {
40943             copy2.loc[0] = +copy2.loc[0].toFixed(6);
40944             copy2.loc[1] = +copy2.loc[1].toFixed(6);
40945           }
40946           var match = source.id.match(/([nrw])-\d*/);
40947           if (match !== null) {
40948             var nrw = match[1];
40949             var permID;
40950             do {
40951               permID = nrw + ++nextID[nrw];
40952             } while (baseEntities.hasOwnProperty(permID));
40953             copy2.id = permIDs[source.id] = permID;
40954           }
40955           return copy2;
40956         }
40957       },
40958       toJSON: function() {
40959         if (!this.hasChanges())
40960           return;
40961         var allEntities = {};
40962         var baseEntities = {};
40963         var base = _stack[0];
40964         var s2 = _stack.map(function(i3) {
40965           var modified = [];
40966           var deleted = [];
40967           Object.keys(i3.graph.entities).forEach(function(id2) {
40968             var entity = i3.graph.entities[id2];
40969             if (entity) {
40970               var key = osmEntity.key(entity);
40971               allEntities[key] = entity;
40972               modified.push(key);
40973             } else {
40974               deleted.push(id2);
40975             }
40976             if (id2 in base.graph.entities) {
40977               baseEntities[id2] = base.graph.entities[id2];
40978             }
40979             if (entity && entity.nodes) {
40980               entity.nodes.forEach(function(nodeID) {
40981                 if (nodeID in base.graph.entities) {
40982                   baseEntities[nodeID] = base.graph.entities[nodeID];
40983                 }
40984               });
40985             }
40986             var baseParents = base.graph._parentWays[id2];
40987             if (baseParents) {
40988               baseParents.forEach(function(parentID) {
40989                 if (parentID in base.graph.entities) {
40990                   baseEntities[parentID] = base.graph.entities[parentID];
40991                 }
40992               });
40993             }
40994           });
40995           var x2 = {};
40996           if (modified.length)
40997             x2.modified = modified;
40998           if (deleted.length)
40999             x2.deleted = deleted;
41000           if (i3.imageryUsed)
41001             x2.imageryUsed = i3.imageryUsed;
41002           if (i3.photoOverlaysUsed)
41003             x2.photoOverlaysUsed = i3.photoOverlaysUsed;
41004           if (i3.annotation)
41005             x2.annotation = i3.annotation;
41006           if (i3.transform)
41007             x2.transform = i3.transform;
41008           if (i3.selectedIDs)
41009             x2.selectedIDs = i3.selectedIDs;
41010           return x2;
41011         });
41012         return JSON.stringify({
41013           version: 3,
41014           entities: Object.values(allEntities),
41015           baseEntities: Object.values(baseEntities),
41016           stack: s2,
41017           nextIDs: osmEntity.id.next,
41018           index: _index,
41019           // note the time the changes were saved
41020           timestamp: (/* @__PURE__ */ new Date()).getTime()
41021         });
41022       },
41023       fromJSON: function(json, loadChildNodes) {
41024         var h2 = JSON.parse(json);
41025         var loadComplete = true;
41026         osmEntity.id.next = h2.nextIDs;
41027         _index = h2.index;
41028         if (h2.version === 2 || h2.version === 3) {
41029           var allEntities = {};
41030           h2.entities.forEach(function(entity) {
41031             allEntities[osmEntity.key(entity)] = osmEntity(entity);
41032           });
41033           if (h2.version === 3) {
41034             var baseEntities = h2.baseEntities.map(function(d2) {
41035               return osmEntity(d2);
41036             });
41037             var stack = _stack.map(function(state) {
41038               return state.graph;
41039             });
41040             _stack[0].graph.rebase(baseEntities, stack, true);
41041             _tree.rebase(baseEntities, true);
41042             if (loadChildNodes) {
41043               var osm = context.connection();
41044               var baseWays = baseEntities.filter(function(e3) {
41045                 return e3.type === "way";
41046               });
41047               var nodeIDs = baseWays.reduce(function(acc, way) {
41048                 return utilArrayUnion(acc, way.nodes);
41049               }, []);
41050               var missing = nodeIDs.filter(function(n3) {
41051                 return !_stack[0].graph.hasEntity(n3);
41052               });
41053               if (missing.length && osm) {
41054                 loadComplete = false;
41055                 context.map().redrawEnable(false);
41056                 var loading = uiLoading(context).blocking(true);
41057                 context.container().call(loading);
41058                 var childNodesLoaded = function(err, result) {
41059                   if (!err) {
41060                     var visibleGroups = utilArrayGroupBy(result.data, "visible");
41061                     var visibles = visibleGroups.true || [];
41062                     var invisibles = visibleGroups.false || [];
41063                     if (visibles.length) {
41064                       var visibleIDs = visibles.map(function(entity) {
41065                         return entity.id;
41066                       });
41067                       var stack2 = _stack.map(function(state) {
41068                         return state.graph;
41069                       });
41070                       missing = utilArrayDifference(missing, visibleIDs);
41071                       _stack[0].graph.rebase(visibles, stack2, true);
41072                       _tree.rebase(visibles, true);
41073                     }
41074                     invisibles.forEach(function(entity) {
41075                       osm.loadEntityVersion(entity.id, +entity.version - 1, childNodesLoaded);
41076                     });
41077                   }
41078                   if (err || !missing.length) {
41079                     loading.close();
41080                     context.map().redrawEnable(true);
41081                     dispatch14.call("change");
41082                     dispatch14.call("restore", this);
41083                   }
41084                 };
41085                 osm.loadMultiple(missing, childNodesLoaded);
41086               }
41087             }
41088           }
41089           _stack = h2.stack.map(function(d2) {
41090             var entities = {}, entity;
41091             if (d2.modified) {
41092               d2.modified.forEach(function(key) {
41093                 entity = allEntities[key];
41094                 entities[entity.id] = entity;
41095               });
41096             }
41097             if (d2.deleted) {
41098               d2.deleted.forEach(function(id2) {
41099                 entities[id2] = void 0;
41100               });
41101             }
41102             return {
41103               graph: coreGraph(_stack[0].graph).load(entities),
41104               annotation: d2.annotation,
41105               imageryUsed: d2.imageryUsed,
41106               photoOverlaysUsed: d2.photoOverlaysUsed,
41107               transform: d2.transform,
41108               selectedIDs: d2.selectedIDs
41109             };
41110           });
41111         } else {
41112           _stack = h2.stack.map(function(d2) {
41113             var entities = {};
41114             for (var i3 in d2.entities) {
41115               var entity = d2.entities[i3];
41116               entities[i3] = entity === "undefined" ? void 0 : osmEntity(entity);
41117             }
41118             d2.graph = coreGraph(_stack[0].graph).load(entities);
41119             return d2;
41120           });
41121         }
41122         var transform2 = _stack[_index].transform;
41123         if (transform2) {
41124           context.map().transformEase(transform2, 0);
41125         }
41126         if (loadComplete) {
41127           dispatch14.call("change");
41128           dispatch14.call("restore", this);
41129         }
41130         return history;
41131       },
41132       lock: function() {
41133         return lock.lock();
41134       },
41135       unlock: function() {
41136         lock.unlock();
41137       },
41138       save: function() {
41139         if (lock.locked() && // don't overwrite existing, unresolved changes
41140         !_hasUnresolvedRestorableChanges) {
41141           const success = corePreferences(getKey("saved_history"), history.toJSON() || null);
41142           if (!success)
41143             dispatch14.call("storage_error");
41144         }
41145         return history;
41146       },
41147       // delete the history version saved in localStorage
41148       clearSaved: function() {
41149         context.debouncedSave.cancel();
41150         if (lock.locked()) {
41151           _hasUnresolvedRestorableChanges = false;
41152           corePreferences(getKey("saved_history"), null);
41153           corePreferences("comment", null);
41154           corePreferences("hashtags", null);
41155           corePreferences("source", null);
41156         }
41157         return history;
41158       },
41159       savedHistoryJSON: function() {
41160         return corePreferences(getKey("saved_history"));
41161       },
41162       hasRestorableChanges: function() {
41163         return _hasUnresolvedRestorableChanges;
41164       },
41165       // load history from a version stored in localStorage
41166       restore: function() {
41167         if (lock.locked()) {
41168           _hasUnresolvedRestorableChanges = false;
41169           var json = this.savedHistoryJSON();
41170           if (json)
41171             history.fromJSON(json, true);
41172         }
41173       },
41174       _getKey: getKey
41175     };
41176     history.reset();
41177     return utilRebind(history, dispatch14, "on");
41178   }
41179
41180   // modules/validations/index.js
41181   var validations_exports = {};
41182   __export(validations_exports, {
41183     validationAlmostJunction: () => validationAlmostJunction,
41184     validationCloseNodes: () => validationCloseNodes,
41185     validationCrossingWays: () => validationCrossingWays,
41186     validationDisconnectedWay: () => validationDisconnectedWay,
41187     validationFormatting: () => validationFormatting,
41188     validationHelpRequest: () => validationHelpRequest,
41189     validationImpossibleOneway: () => validationImpossibleOneway,
41190     validationIncompatibleSource: () => validationIncompatibleSource,
41191     validationMaprules: () => validationMaprules,
41192     validationMismatchedGeometry: () => validationMismatchedGeometry,
41193     validationMissingRole: () => validationMissingRole,
41194     validationMissingTag: () => validationMissingTag,
41195     validationOutdatedTags: () => validationOutdatedTags,
41196     validationPrivateData: () => validationPrivateData,
41197     validationSuspiciousName: () => validationSuspiciousName,
41198     validationUnsquareWay: () => validationUnsquareWay
41199   });
41200
41201   // modules/validations/almost_junction.js
41202   function validationAlmostJunction(context) {
41203     const type2 = "almost_junction";
41204     const EXTEND_TH_METERS = 5;
41205     const WELD_TH_METERS = 0.75;
41206     const CLOSE_NODE_TH = EXTEND_TH_METERS - WELD_TH_METERS;
41207     const SIG_ANGLE_TH = Math.atan(WELD_TH_METERS / EXTEND_TH_METERS);
41208     function isHighway(entity) {
41209       return entity.type === "way" && osmRoutableHighwayTagValues[entity.tags.highway];
41210     }
41211     function isTaggedAsNotContinuing(node) {
41212       return node.tags.noexit === "yes" || node.tags.amenity === "parking_entrance" || node.tags.entrance && node.tags.entrance !== "no";
41213     }
41214     const validation = function checkAlmostJunction(entity, graph) {
41215       if (!isHighway(entity))
41216         return [];
41217       if (entity.isDegenerate())
41218         return [];
41219       const tree = context.history().tree();
41220       const extendableNodeInfos = findConnectableEndNodesByExtension(entity);
41221       let issues = [];
41222       extendableNodeInfos.forEach((extendableNodeInfo) => {
41223         issues.push(new validationIssue({
41224           type: type2,
41225           subtype: "highway-highway",
41226           severity: "warning",
41227           message: function(context2) {
41228             const entity1 = context2.hasEntity(this.entityIds[0]);
41229             if (this.entityIds[0] === this.entityIds[2]) {
41230               return entity1 ? _t.append("issues.almost_junction.self.message", {
41231                 feature: utilDisplayLabel(entity1, context2.graph())
41232               }) : "";
41233             } else {
41234               const entity2 = context2.hasEntity(this.entityIds[2]);
41235               return entity1 && entity2 ? _t.append("issues.almost_junction.message", {
41236                 feature: utilDisplayLabel(entity1, context2.graph()),
41237                 feature2: utilDisplayLabel(entity2, context2.graph())
41238               }) : "";
41239             }
41240           },
41241           reference: showReference,
41242           entityIds: [
41243             entity.id,
41244             extendableNodeInfo.node.id,
41245             extendableNodeInfo.wid
41246           ],
41247           loc: extendableNodeInfo.node.loc,
41248           hash: JSON.stringify(extendableNodeInfo.node.loc),
41249           data: {
41250             midId: extendableNodeInfo.mid.id,
41251             edge: extendableNodeInfo.edge,
41252             cross_loc: extendableNodeInfo.cross_loc
41253           },
41254           dynamicFixes: makeFixes
41255         }));
41256       });
41257       return issues;
41258       function makeFixes(context2) {
41259         let fixes = [new validationIssueFix({
41260           icon: "iD-icon-abutment",
41261           title: _t.append("issues.fix.connect_features.title"),
41262           onClick: function(context3) {
41263             const annotation = _t("issues.fix.connect_almost_junction.annotation");
41264             const [, endNodeId, crossWayId] = this.issue.entityIds;
41265             const midNode = context3.entity(this.issue.data.midId);
41266             const endNode = context3.entity(endNodeId);
41267             const crossWay = context3.entity(crossWayId);
41268             const nearEndNodes = findNearbyEndNodes(endNode, crossWay);
41269             if (nearEndNodes.length > 0) {
41270               const collinear = findSmallJoinAngle(midNode, endNode, nearEndNodes);
41271               if (collinear) {
41272                 context3.perform(
41273                   actionMergeNodes([collinear.id, endNode.id], collinear.loc),
41274                   annotation
41275                 );
41276                 return;
41277               }
41278             }
41279             const targetEdge = this.issue.data.edge;
41280             const crossLoc = this.issue.data.cross_loc;
41281             const edgeNodes = [context3.entity(targetEdge[0]), context3.entity(targetEdge[1])];
41282             const closestNodeInfo = geoSphericalClosestNode(edgeNodes, crossLoc);
41283             if (closestNodeInfo.distance < WELD_TH_METERS) {
41284               context3.perform(
41285                 actionMergeNodes([closestNodeInfo.node.id, endNode.id], closestNodeInfo.node.loc),
41286                 annotation
41287               );
41288             } else {
41289               context3.perform(
41290                 actionAddMidpoint({ loc: crossLoc, edge: targetEdge }, endNode),
41291                 annotation
41292               );
41293             }
41294           }
41295         })];
41296         const node = context2.hasEntity(this.entityIds[1]);
41297         if (node && !node.hasInterestingTags()) {
41298           fixes.push(new validationIssueFix({
41299             icon: "maki-barrier",
41300             title: _t.append("issues.fix.tag_as_disconnected.title"),
41301             onClick: function(context3) {
41302               const nodeID = this.issue.entityIds[1];
41303               const tags = Object.assign({}, context3.entity(nodeID).tags);
41304               tags.noexit = "yes";
41305               context3.perform(
41306                 actionChangeTags(nodeID, tags),
41307                 _t("issues.fix.tag_as_disconnected.annotation")
41308               );
41309             }
41310           }));
41311         }
41312         return fixes;
41313       }
41314       function showReference(selection2) {
41315         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.almost_junction.highway-highway.reference"));
41316       }
41317       function isExtendableCandidate(node, way) {
41318         const osm = services.osm;
41319         if (osm && !osm.isDataLoaded(node.loc)) {
41320           return false;
41321         }
41322         if (isTaggedAsNotContinuing(node) || graph.parentWays(node).length !== 1) {
41323           return false;
41324         }
41325         let occurrences = 0;
41326         for (const index in way.nodes) {
41327           if (way.nodes[index] === node.id) {
41328             occurrences += 1;
41329             if (occurrences > 1) {
41330               return false;
41331             }
41332           }
41333         }
41334         return true;
41335       }
41336       function findConnectableEndNodesByExtension(way) {
41337         let results = [];
41338         if (way.isClosed())
41339           return results;
41340         let testNodes;
41341         const indices = [0, way.nodes.length - 1];
41342         indices.forEach((nodeIndex) => {
41343           const nodeID = way.nodes[nodeIndex];
41344           const node = graph.entity(nodeID);
41345           if (!isExtendableCandidate(node, way))
41346             return;
41347           const connectionInfo = canConnectByExtend(way, nodeIndex);
41348           if (!connectionInfo)
41349             return;
41350           testNodes = graph.childNodes(way).slice();
41351           testNodes[nodeIndex] = testNodes[nodeIndex].move(connectionInfo.cross_loc);
41352           if (geoHasSelfIntersections(testNodes, nodeID))
41353             return;
41354           results.push(connectionInfo);
41355         });
41356         return results;
41357       }
41358       function findNearbyEndNodes(node, way) {
41359         return [
41360           way.nodes[0],
41361           way.nodes[way.nodes.length - 1]
41362         ].map((d2) => graph.entity(d2)).filter((d2) => {
41363           return d2.id !== node.id && geoSphericalDistance(node.loc, d2.loc) <= CLOSE_NODE_TH;
41364         });
41365       }
41366       function findSmallJoinAngle(midNode, tipNode, endNodes) {
41367         let joinTo;
41368         let minAngle = Infinity;
41369         endNodes.forEach((endNode) => {
41370           const a1 = geoAngle(midNode, tipNode, context.projection) + Math.PI;
41371           const a2 = geoAngle(midNode, endNode, context.projection) + Math.PI;
41372           const diff = Math.max(a1, a2) - Math.min(a1, a2);
41373           if (diff < minAngle) {
41374             joinTo = endNode;
41375             minAngle = diff;
41376           }
41377         });
41378         if (minAngle <= SIG_ANGLE_TH)
41379           return joinTo;
41380         return null;
41381       }
41382       function hasTag(tags, key) {
41383         return tags[key] !== void 0 && tags[key] !== "no";
41384       }
41385       function canConnectWays(way, way2) {
41386         if (way.id === way2.id)
41387           return true;
41388         if ((hasTag(way.tags, "bridge") || hasTag(way2.tags, "bridge")) && !(hasTag(way.tags, "bridge") && hasTag(way2.tags, "bridge")))
41389           return false;
41390         if ((hasTag(way.tags, "tunnel") || hasTag(way2.tags, "tunnel")) && !(hasTag(way.tags, "tunnel") && hasTag(way2.tags, "tunnel")))
41391           return false;
41392         const layer1 = way.tags.layer || "0", layer2 = way2.tags.layer || "0";
41393         if (layer1 !== layer2)
41394           return false;
41395         const level1 = way.tags.level || "0", level2 = way2.tags.level || "0";
41396         if (level1 !== level2)
41397           return false;
41398         return true;
41399       }
41400       function canConnectByExtend(way, endNodeIdx) {
41401         const tipNid = way.nodes[endNodeIdx];
41402         const midNid = endNodeIdx === 0 ? way.nodes[1] : way.nodes[way.nodes.length - 2];
41403         const tipNode = graph.entity(tipNid);
41404         const midNode = graph.entity(midNid);
41405         const lon = tipNode.loc[0];
41406         const lat = tipNode.loc[1];
41407         const lon_range = geoMetersToLon(EXTEND_TH_METERS, lat) / 2;
41408         const lat_range = geoMetersToLat(EXTEND_TH_METERS) / 2;
41409         const queryExtent = geoExtent([
41410           [lon - lon_range, lat - lat_range],
41411           [lon + lon_range, lat + lat_range]
41412         ]);
41413         const edgeLen = geoSphericalDistance(midNode.loc, tipNode.loc);
41414         const t2 = EXTEND_TH_METERS / edgeLen + 1;
41415         const extTipLoc = geoVecInterp(midNode.loc, tipNode.loc, t2);
41416         const segmentInfos = tree.waySegments(queryExtent, graph);
41417         for (let i3 = 0; i3 < segmentInfos.length; i3++) {
41418           let segmentInfo = segmentInfos[i3];
41419           let way2 = graph.entity(segmentInfo.wayId);
41420           if (!isHighway(way2))
41421             continue;
41422           if (!canConnectWays(way, way2))
41423             continue;
41424           let nAid = segmentInfo.nodes[0], nBid = segmentInfo.nodes[1];
41425           if (nAid === tipNid || nBid === tipNid)
41426             continue;
41427           let nA = graph.entity(nAid), nB = graph.entity(nBid);
41428           let crossLoc = geoLineIntersection([tipNode.loc, extTipLoc], [nA.loc, nB.loc]);
41429           if (crossLoc) {
41430             return {
41431               mid: midNode,
41432               node: tipNode,
41433               wid: way2.id,
41434               edge: [nA.id, nB.id],
41435               cross_loc: crossLoc
41436             };
41437           }
41438         }
41439         return null;
41440       }
41441     };
41442     validation.type = type2;
41443     return validation;
41444   }
41445
41446   // modules/validations/close_nodes.js
41447   function validationCloseNodes(context) {
41448     var type2 = "close_nodes";
41449     var pointThresholdMeters = 0.2;
41450     var validation = function(entity, graph) {
41451       if (entity.type === "node") {
41452         return getIssuesForNode(entity);
41453       } else if (entity.type === "way") {
41454         return getIssuesForWay(entity);
41455       }
41456       return [];
41457       function getIssuesForNode(node) {
41458         var parentWays = graph.parentWays(node);
41459         if (parentWays.length) {
41460           return getIssuesForVertex(node, parentWays);
41461         } else {
41462           return getIssuesForDetachedPoint(node);
41463         }
41464       }
41465       function wayTypeFor(way) {
41466         if (way.tags.boundary && way.tags.boundary !== "no")
41467           return "boundary";
41468         if (way.tags.indoor && way.tags.indoor !== "no")
41469           return "indoor";
41470         if (way.tags.building && way.tags.building !== "no" || way.tags["building:part"] && way.tags["building:part"] !== "no")
41471           return "building";
41472         if (osmPathHighwayTagValues[way.tags.highway])
41473           return "path";
41474         var parentRelations = graph.parentRelations(way);
41475         for (var i3 in parentRelations) {
41476           var relation = parentRelations[i3];
41477           if (relation.tags.type === "boundary")
41478             return "boundary";
41479           if (relation.isMultipolygon()) {
41480             if (relation.tags.indoor && relation.tags.indoor !== "no")
41481               return "indoor";
41482             if (relation.tags.building && relation.tags.building !== "no" || relation.tags["building:part"] && relation.tags["building:part"] !== "no")
41483               return "building";
41484           }
41485         }
41486         return "other";
41487       }
41488       function shouldCheckWay(way) {
41489         if (way.nodes.length <= 2 || way.isClosed() && way.nodes.length <= 4)
41490           return false;
41491         var bbox2 = way.extent(graph).bbox();
41492         var hypotenuseMeters = geoSphericalDistance([bbox2.minX, bbox2.minY], [bbox2.maxX, bbox2.maxY]);
41493         if (hypotenuseMeters < 1.5)
41494           return false;
41495         return true;
41496       }
41497       function getIssuesForWay(way) {
41498         if (!shouldCheckWay(way))
41499           return [];
41500         var issues = [], nodes = graph.childNodes(way);
41501         for (var i3 = 0; i3 < nodes.length - 1; i3++) {
41502           var node1 = nodes[i3];
41503           var node2 = nodes[i3 + 1];
41504           var issue = getWayIssueIfAny(node1, node2, way);
41505           if (issue)
41506             issues.push(issue);
41507         }
41508         return issues;
41509       }
41510       function getIssuesForVertex(node, parentWays) {
41511         var issues = [];
41512         function checkForCloseness(node1, node2, way) {
41513           var issue = getWayIssueIfAny(node1, node2, way);
41514           if (issue)
41515             issues.push(issue);
41516         }
41517         for (var i3 = 0; i3 < parentWays.length; i3++) {
41518           var parentWay = parentWays[i3];
41519           if (!shouldCheckWay(parentWay))
41520             continue;
41521           var lastIndex = parentWay.nodes.length - 1;
41522           for (var j3 = 0; j3 < parentWay.nodes.length; j3++) {
41523             if (j3 !== 0) {
41524               if (parentWay.nodes[j3 - 1] === node.id) {
41525                 checkForCloseness(node, graph.entity(parentWay.nodes[j3]), parentWay);
41526               }
41527             }
41528             if (j3 !== lastIndex) {
41529               if (parentWay.nodes[j3 + 1] === node.id) {
41530                 checkForCloseness(graph.entity(parentWay.nodes[j3]), node, parentWay);
41531               }
41532             }
41533           }
41534         }
41535         return issues;
41536       }
41537       function thresholdMetersForWay(way) {
41538         if (!shouldCheckWay(way))
41539           return 0;
41540         var wayType = wayTypeFor(way);
41541         if (wayType === "boundary")
41542           return 0;
41543         if (wayType === "indoor")
41544           return 0.01;
41545         if (wayType === "building")
41546           return 0.05;
41547         if (wayType === "path")
41548           return 0.1;
41549         return 0.2;
41550       }
41551       function getIssuesForDetachedPoint(node) {
41552         var issues = [];
41553         var lon = node.loc[0];
41554         var lat = node.loc[1];
41555         var lon_range = geoMetersToLon(pointThresholdMeters, lat) / 2;
41556         var lat_range = geoMetersToLat(pointThresholdMeters) / 2;
41557         var queryExtent = geoExtent([
41558           [lon - lon_range, lat - lat_range],
41559           [lon + lon_range, lat + lat_range]
41560         ]);
41561         var intersected = context.history().tree().intersects(queryExtent, graph);
41562         for (var j3 = 0; j3 < intersected.length; j3++) {
41563           var nearby = intersected[j3];
41564           if (nearby.id === node.id)
41565             continue;
41566           if (nearby.type !== "node" || nearby.geometry(graph) !== "point")
41567             continue;
41568           if (nearby.loc === node.loc || geoSphericalDistance(node.loc, nearby.loc) < pointThresholdMeters) {
41569             if ("memorial:type" in node.tags && "memorial:type" in nearby.tags && node.tags["memorial:type"] === "stolperstein" && nearby.tags["memorial:type"] === "stolperstein")
41570               continue;
41571             if ("memorial" in node.tags && "memorial" in nearby.tags && node.tags.memorial === "stolperstein" && nearby.tags.memorial === "stolperstein")
41572               continue;
41573             var zAxisKeys = { layer: true, level: true, "addr:housenumber": true, "addr:unit": true };
41574             var zAxisDifferentiates = false;
41575             for (var key in zAxisKeys) {
41576               var nodeValue = node.tags[key] || "0";
41577               var nearbyValue = nearby.tags[key] || "0";
41578               if (nodeValue !== nearbyValue) {
41579                 zAxisDifferentiates = true;
41580                 break;
41581               }
41582             }
41583             if (zAxisDifferentiates)
41584               continue;
41585             issues.push(new validationIssue({
41586               type: type2,
41587               subtype: "detached",
41588               severity: "warning",
41589               message: function(context2) {
41590                 var entity2 = context2.hasEntity(this.entityIds[0]), entity22 = context2.hasEntity(this.entityIds[1]);
41591                 return entity2 && entity22 ? _t.append("issues.close_nodes.detached.message", {
41592                   feature: utilDisplayLabel(entity2, context2.graph()),
41593                   feature2: utilDisplayLabel(entity22, context2.graph())
41594                 }) : "";
41595               },
41596               reference: showReference,
41597               entityIds: [node.id, nearby.id],
41598               dynamicFixes: function() {
41599                 return [
41600                   new validationIssueFix({
41601                     icon: "iD-operation-disconnect",
41602                     title: _t.append("issues.fix.move_points_apart.title")
41603                   }),
41604                   new validationIssueFix({
41605                     icon: "iD-icon-layers",
41606                     title: _t.append("issues.fix.use_different_layers_or_levels.title")
41607                   })
41608                 ];
41609               }
41610             }));
41611           }
41612         }
41613         return issues;
41614         function showReference(selection2) {
41615           var referenceText = _t("issues.close_nodes.detached.reference");
41616           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
41617         }
41618       }
41619       function getWayIssueIfAny(node1, node2, way) {
41620         if (node1.id === node2.id || node1.hasInterestingTags() && node2.hasInterestingTags()) {
41621           return null;
41622         }
41623         if (node1.loc !== node2.loc) {
41624           var parentWays1 = graph.parentWays(node1);
41625           var parentWays2 = new Set(graph.parentWays(node2));
41626           var sharedWays = parentWays1.filter(function(parentWay) {
41627             return parentWays2.has(parentWay);
41628           });
41629           var thresholds = sharedWays.map(function(parentWay) {
41630             return thresholdMetersForWay(parentWay);
41631           });
41632           var threshold = Math.min(...thresholds);
41633           var distance = geoSphericalDistance(node1.loc, node2.loc);
41634           if (distance > threshold)
41635             return null;
41636         }
41637         return new validationIssue({
41638           type: type2,
41639           subtype: "vertices",
41640           severity: "warning",
41641           message: function(context2) {
41642             var entity2 = context2.hasEntity(this.entityIds[0]);
41643             return entity2 ? _t.append("issues.close_nodes.message", { way: utilDisplayLabel(entity2, context2.graph()) }) : "";
41644           },
41645           reference: showReference,
41646           entityIds: [way.id, node1.id, node2.id],
41647           loc: node1.loc,
41648           dynamicFixes: function() {
41649             return [
41650               new validationIssueFix({
41651                 icon: "iD-icon-plus",
41652                 title: _t.append("issues.fix.merge_points.title"),
41653                 onClick: function(context2) {
41654                   var entityIds = this.issue.entityIds;
41655                   var action = actionMergeNodes([entityIds[1], entityIds[2]]);
41656                   context2.perform(action, _t("issues.fix.merge_close_vertices.annotation"));
41657                 }
41658               }),
41659               new validationIssueFix({
41660                 icon: "iD-operation-disconnect",
41661                 title: _t.append("issues.fix.move_points_apart.title")
41662               })
41663             ];
41664           }
41665         });
41666         function showReference(selection2) {
41667           var referenceText = _t("issues.close_nodes.reference");
41668           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
41669         }
41670       }
41671     };
41672     validation.type = type2;
41673     return validation;
41674   }
41675
41676   // modules/validations/crossing_ways.js
41677   var import_lodash3 = __toESM(require_lodash());
41678   function validationCrossingWays(context) {
41679     var type2 = "crossing_ways";
41680     function getFeatureWithFeatureTypeTagsForWay(way, graph) {
41681       if (getFeatureType(way, graph) === null) {
41682         var parentRels = graph.parentRelations(way);
41683         for (var i3 = 0; i3 < parentRels.length; i3++) {
41684           var rel = parentRels[i3];
41685           if (getFeatureType(rel, graph) !== null) {
41686             return rel;
41687           }
41688         }
41689       }
41690       return way;
41691     }
41692     function hasTag(tags, key) {
41693       return tags[key] !== void 0 && tags[key] !== "no";
41694     }
41695     function taggedAsIndoor(tags) {
41696       return hasTag(tags, "indoor") || hasTag(tags, "level") || tags.highway === "corridor";
41697     }
41698     function allowsBridge(featureType) {
41699       return featureType === "highway" || featureType === "railway" || featureType === "waterway";
41700     }
41701     function allowsTunnel(featureType) {
41702       return featureType === "highway" || featureType === "railway" || featureType === "waterway";
41703     }
41704     var ignoredBuildings = {
41705       demolished: true,
41706       dismantled: true,
41707       proposed: true,
41708       razed: true
41709     };
41710     function getFeatureType(entity, graph) {
41711       var geometry = entity.geometry(graph);
41712       if (geometry !== "line" && geometry !== "area")
41713         return null;
41714       var tags = entity.tags;
41715       if (hasTag(tags, "building") && !ignoredBuildings[tags.building])
41716         return "building";
41717       if (hasTag(tags, "highway") && osmRoutableHighwayTagValues[tags.highway])
41718         return "highway";
41719       if (geometry !== "line")
41720         return null;
41721       if (hasTag(tags, "railway") && osmRailwayTrackTagValues[tags.railway])
41722         return "railway";
41723       if (hasTag(tags, "waterway") && osmFlowingWaterwayTagValues[tags.waterway])
41724         return "waterway";
41725       return null;
41726     }
41727     function isLegitCrossing(tags1, featureType1, tags2, featureType2) {
41728       var level1 = tags1.level || "0";
41729       var level2 = tags2.level || "0";
41730       if (taggedAsIndoor(tags1) && taggedAsIndoor(tags2) && level1 !== level2) {
41731         return true;
41732       }
41733       var layer1 = tags1.layer || "0";
41734       var layer2 = tags2.layer || "0";
41735       if (allowsBridge(featureType1) && allowsBridge(featureType2)) {
41736         if (hasTag(tags1, "bridge") && !hasTag(tags2, "bridge"))
41737           return true;
41738         if (!hasTag(tags1, "bridge") && hasTag(tags2, "bridge"))
41739           return true;
41740         if (hasTag(tags1, "bridge") && hasTag(tags2, "bridge") && layer1 !== layer2)
41741           return true;
41742       } else if (allowsBridge(featureType1) && hasTag(tags1, "bridge"))
41743         return true;
41744       else if (allowsBridge(featureType2) && hasTag(tags2, "bridge"))
41745         return true;
41746       if (allowsTunnel(featureType1) && allowsTunnel(featureType2)) {
41747         if (hasTag(tags1, "tunnel") && !hasTag(tags2, "tunnel"))
41748           return true;
41749         if (!hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel"))
41750           return true;
41751         if (hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel") && layer1 !== layer2)
41752           return true;
41753       } else if (allowsTunnel(featureType1) && hasTag(tags1, "tunnel"))
41754         return true;
41755       else if (allowsTunnel(featureType2) && hasTag(tags2, "tunnel"))
41756         return true;
41757       if (featureType1 === "waterway" && featureType2 === "highway" && tags2.man_made === "pier")
41758         return true;
41759       if (featureType2 === "waterway" && featureType1 === "highway" && tags1.man_made === "pier")
41760         return true;
41761       if (featureType1 === "building" || featureType2 === "building" || taggedAsIndoor(tags1) || taggedAsIndoor(tags2)) {
41762         if (layer1 !== layer2)
41763           return true;
41764       }
41765       return false;
41766     }
41767     var highwaysDisallowingFords = {
41768       motorway: true,
41769       motorway_link: true,
41770       trunk: true,
41771       trunk_link: true,
41772       primary: true,
41773       primary_link: true,
41774       secondary: true,
41775       secondary_link: true
41776     };
41777     function tagsForConnectionNodeIfAllowed(entity1, entity2, graph, lessLikelyTags) {
41778       var featureType1 = getFeatureType(entity1, graph);
41779       var featureType2 = getFeatureType(entity2, graph);
41780       var geometry1 = entity1.geometry(graph);
41781       var geometry2 = entity2.geometry(graph);
41782       var bothLines = geometry1 === "line" && geometry2 === "line";
41783       if (featureType1 === featureType2) {
41784         if (featureType1 === "highway") {
41785           var entity1IsPath = osmPathHighwayTagValues[entity1.tags.highway];
41786           var entity2IsPath = osmPathHighwayTagValues[entity2.tags.highway];
41787           if ((entity1IsPath || entity2IsPath) && entity1IsPath !== entity2IsPath) {
41788             var roadFeature = entity1IsPath ? entity2 : entity1;
41789             var pathFeature = entity1IsPath ? entity1 : entity2;
41790             if (roadFeature.tags.highway === "track") {
41791               return {};
41792             }
41793             if (!lessLikelyTags && roadFeature.tags.highway === "service" && pathFeature.tags.highway === "footway" && pathFeature.tags.footway === "sidewalk") {
41794               return {};
41795             }
41796             if (["marked", "unmarked", "traffic_signals", "uncontrolled"].indexOf(pathFeature.tags.crossing) !== -1) {
41797               return bothLines ? { highway: "crossing", crossing: pathFeature.tags.crossing } : {};
41798             }
41799             return bothLines ? { highway: "crossing" } : {};
41800           }
41801           return {};
41802         }
41803         if (featureType1 === "waterway")
41804           return {};
41805         if (featureType1 === "railway")
41806           return {};
41807       } else {
41808         var featureTypes = [featureType1, featureType2];
41809         if (featureTypes.indexOf("highway") !== -1) {
41810           if (featureTypes.indexOf("railway") !== -1) {
41811             if (!bothLines)
41812               return {};
41813             var isTram = entity1.tags.railway === "tram" || entity2.tags.railway === "tram";
41814             if (osmPathHighwayTagValues[entity1.tags.highway] || osmPathHighwayTagValues[entity2.tags.highway]) {
41815               if (isTram)
41816                 return { railway: "tram_crossing" };
41817               return { railway: "crossing" };
41818             } else {
41819               if (isTram)
41820                 return { railway: "tram_level_crossing" };
41821               return { railway: "level_crossing" };
41822             }
41823           }
41824           if (featureTypes.indexOf("waterway") !== -1) {
41825             if (hasTag(entity1.tags, "tunnel") && hasTag(entity2.tags, "tunnel"))
41826               return null;
41827             if (hasTag(entity1.tags, "bridge") && hasTag(entity2.tags, "bridge"))
41828               return null;
41829             if (highwaysDisallowingFords[entity1.tags.highway] || highwaysDisallowingFords[entity2.tags.highway]) {
41830               return null;
41831             }
41832             return bothLines ? { ford: "yes" } : {};
41833           }
41834         }
41835       }
41836       return null;
41837     }
41838     function findCrossingsByWay(way1, graph, tree) {
41839       var edgeCrossInfos = [];
41840       if (way1.type !== "way")
41841         return edgeCrossInfos;
41842       var taggedFeature1 = getFeatureWithFeatureTypeTagsForWay(way1, graph);
41843       var way1FeatureType = getFeatureType(taggedFeature1, graph);
41844       if (way1FeatureType === null)
41845         return edgeCrossInfos;
41846       var checkedSingleCrossingWays = {};
41847       var i3, j3;
41848       var extent;
41849       var n1, n22, nA, nB, nAId, nBId;
41850       var segment1, segment2;
41851       var oneOnly;
41852       var segmentInfos, segment2Info, way2, taggedFeature2, way2FeatureType;
41853       var way1Nodes = graph.childNodes(way1);
41854       var comparedWays = {};
41855       for (i3 = 0; i3 < way1Nodes.length - 1; i3++) {
41856         n1 = way1Nodes[i3];
41857         n22 = way1Nodes[i3 + 1];
41858         extent = geoExtent([
41859           [
41860             Math.min(n1.loc[0], n22.loc[0]),
41861             Math.min(n1.loc[1], n22.loc[1])
41862           ],
41863           [
41864             Math.max(n1.loc[0], n22.loc[0]),
41865             Math.max(n1.loc[1], n22.loc[1])
41866           ]
41867         ]);
41868         segmentInfos = tree.waySegments(extent, graph);
41869         for (j3 = 0; j3 < segmentInfos.length; j3++) {
41870           segment2Info = segmentInfos[j3];
41871           if (segment2Info.wayId === way1.id)
41872             continue;
41873           if (checkedSingleCrossingWays[segment2Info.wayId])
41874             continue;
41875           comparedWays[segment2Info.wayId] = true;
41876           way2 = graph.hasEntity(segment2Info.wayId);
41877           if (!way2)
41878             continue;
41879           taggedFeature2 = getFeatureWithFeatureTypeTagsForWay(way2, graph);
41880           way2FeatureType = getFeatureType(taggedFeature2, graph);
41881           if (way2FeatureType === null || isLegitCrossing(taggedFeature1.tags, way1FeatureType, taggedFeature2.tags, way2FeatureType)) {
41882             continue;
41883           }
41884           oneOnly = way1FeatureType === "building" || way2FeatureType === "building";
41885           nAId = segment2Info.nodes[0];
41886           nBId = segment2Info.nodes[1];
41887           if (nAId === n1.id || nAId === n22.id || nBId === n1.id || nBId === n22.id) {
41888             continue;
41889           }
41890           nA = graph.hasEntity(nAId);
41891           if (!nA)
41892             continue;
41893           nB = graph.hasEntity(nBId);
41894           if (!nB)
41895             continue;
41896           segment1 = [n1.loc, n22.loc];
41897           segment2 = [nA.loc, nB.loc];
41898           var point2 = geoLineIntersection(segment1, segment2);
41899           if (point2) {
41900             edgeCrossInfos.push({
41901               wayInfos: [
41902                 {
41903                   way: way1,
41904                   featureType: way1FeatureType,
41905                   edge: [n1.id, n22.id]
41906                 },
41907                 {
41908                   way: way2,
41909                   featureType: way2FeatureType,
41910                   edge: [nA.id, nB.id]
41911                 }
41912               ],
41913               crossPoint: point2
41914             });
41915             if (oneOnly) {
41916               checkedSingleCrossingWays[way2.id] = true;
41917               break;
41918             }
41919           }
41920         }
41921       }
41922       return edgeCrossInfos;
41923     }
41924     function waysToCheck(entity, graph) {
41925       var featureType = getFeatureType(entity, graph);
41926       if (!featureType)
41927         return [];
41928       if (entity.type === "way") {
41929         return [entity];
41930       } else if (entity.type === "relation") {
41931         return entity.members.reduce(function(array2, member) {
41932           if (member.type === "way" && // only look at geometry ways
41933           (!member.role || member.role === "outer" || member.role === "inner")) {
41934             var entity2 = graph.hasEntity(member.id);
41935             if (entity2 && array2.indexOf(entity2) === -1) {
41936               array2.push(entity2);
41937             }
41938           }
41939           return array2;
41940         }, []);
41941       }
41942       return [];
41943     }
41944     var validation = function checkCrossingWays(entity, graph) {
41945       var tree = context.history().tree();
41946       var ways = waysToCheck(entity, graph);
41947       var issues = [];
41948       var wayIndex, crossingIndex, crossings;
41949       for (wayIndex in ways) {
41950         crossings = findCrossingsByWay(ways[wayIndex], graph, tree);
41951         for (crossingIndex in crossings) {
41952           issues.push(createIssue(crossings[crossingIndex], graph));
41953         }
41954       }
41955       return issues;
41956     };
41957     function createIssue(crossing, graph) {
41958       crossing.wayInfos.sort(function(way1Info, way2Info) {
41959         var type1 = way1Info.featureType;
41960         var type22 = way2Info.featureType;
41961         if (type1 === type22) {
41962           return utilDisplayLabel(way1Info.way, graph) > utilDisplayLabel(way2Info.way, graph);
41963         } else if (type1 === "waterway") {
41964           return true;
41965         } else if (type22 === "waterway") {
41966           return false;
41967         }
41968         return type1 < type22;
41969       });
41970       var entities = crossing.wayInfos.map(function(wayInfo) {
41971         return getFeatureWithFeatureTypeTagsForWay(wayInfo.way, graph);
41972       });
41973       var edges = [crossing.wayInfos[0].edge, crossing.wayInfos[1].edge];
41974       var featureTypes = [crossing.wayInfos[0].featureType, crossing.wayInfos[1].featureType];
41975       var connectionTags = tagsForConnectionNodeIfAllowed(entities[0], entities[1], graph);
41976       var featureType1 = crossing.wayInfos[0].featureType;
41977       var featureType2 = crossing.wayInfos[1].featureType;
41978       var isCrossingIndoors = taggedAsIndoor(entities[0].tags) && taggedAsIndoor(entities[1].tags);
41979       var isCrossingTunnels = allowsTunnel(featureType1) && hasTag(entities[0].tags, "tunnel") && allowsTunnel(featureType2) && hasTag(entities[1].tags, "tunnel");
41980       var isCrossingBridges = allowsBridge(featureType1) && hasTag(entities[0].tags, "bridge") && allowsBridge(featureType2) && hasTag(entities[1].tags, "bridge");
41981       var subtype = [featureType1, featureType2].sort().join("-");
41982       var crossingTypeID = subtype;
41983       if (isCrossingIndoors) {
41984         crossingTypeID = "indoor-indoor";
41985       } else if (isCrossingTunnels) {
41986         crossingTypeID = "tunnel-tunnel";
41987       } else if (isCrossingBridges) {
41988         crossingTypeID = "bridge-bridge";
41989       }
41990       if (connectionTags && (isCrossingIndoors || isCrossingTunnels || isCrossingBridges)) {
41991         crossingTypeID += "_connectable";
41992       }
41993       var uniqueID = crossing.crossPoint[0].toFixed(4) + "," + crossing.crossPoint[1].toFixed(4);
41994       return new validationIssue({
41995         type: type2,
41996         subtype,
41997         severity: "warning",
41998         message: function(context2) {
41999           var graph2 = context2.graph();
42000           var entity1 = graph2.hasEntity(this.entityIds[0]), entity2 = graph2.hasEntity(this.entityIds[1]);
42001           return entity1 && entity2 ? _t.append("issues.crossing_ways.message", {
42002             feature: utilDisplayLabel(entity1, graph2),
42003             feature2: utilDisplayLabel(entity2, graph2)
42004           }) : "";
42005         },
42006         reference: showReference,
42007         entityIds: entities.map(function(entity) {
42008           return entity.id;
42009         }),
42010         data: {
42011           edges,
42012           featureTypes,
42013           connectionTags
42014         },
42015         hash: uniqueID,
42016         loc: crossing.crossPoint,
42017         dynamicFixes: function(context2) {
42018           var mode = context2.mode();
42019           if (!mode || mode.id !== "select" || mode.selectedIDs().length !== 1)
42020             return [];
42021           var selectedIndex = this.entityIds[0] === mode.selectedIDs()[0] ? 0 : 1;
42022           var selectedFeatureType = this.data.featureTypes[selectedIndex];
42023           var otherFeatureType = this.data.featureTypes[selectedIndex === 0 ? 1 : 0];
42024           var fixes = [];
42025           if (connectionTags) {
42026             fixes.push(makeConnectWaysFix(this.data.connectionTags));
42027             let lessLikelyConnectionTags = tagsForConnectionNodeIfAllowed(entities[0], entities[1], graph, true);
42028             if (lessLikelyConnectionTags && !(0, import_lodash3.isEqual)(connectionTags, lessLikelyConnectionTags)) {
42029               fixes.push(makeConnectWaysFix(lessLikelyConnectionTags));
42030             }
42031           }
42032           if (isCrossingIndoors) {
42033             fixes.push(new validationIssueFix({
42034               icon: "iD-icon-layers",
42035               title: _t.append("issues.fix.use_different_levels.title")
42036             }));
42037           } else if (isCrossingTunnels || isCrossingBridges || featureType1 === "building" || featureType2 === "building") {
42038             fixes.push(makeChangeLayerFix("higher"));
42039             fixes.push(makeChangeLayerFix("lower"));
42040           } else if (context2.graph().geometry(this.entityIds[0]) === "line" && context2.graph().geometry(this.entityIds[1]) === "line") {
42041             if (allowsBridge(selectedFeatureType) && selectedFeatureType !== "waterway") {
42042               fixes.push(makeAddBridgeOrTunnelFix("add_a_bridge", "temaki-bridge", "bridge"));
42043             }
42044             var skipTunnelFix = otherFeatureType === "waterway" && selectedFeatureType !== "waterway";
42045             if (allowsTunnel(selectedFeatureType) && !skipTunnelFix) {
42046               fixes.push(makeAddBridgeOrTunnelFix("add_a_tunnel", "temaki-tunnel", "tunnel"));
42047             }
42048           }
42049           fixes.push(new validationIssueFix({
42050             icon: "iD-operation-move",
42051             title: _t.append("issues.fix.reposition_features.title")
42052           }));
42053           return fixes;
42054         }
42055       });
42056       function showReference(selection2) {
42057         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.crossing_ways." + crossingTypeID + ".reference"));
42058       }
42059     }
42060     function makeAddBridgeOrTunnelFix(fixTitleID, iconName, bridgeOrTunnel) {
42061       return new validationIssueFix({
42062         icon: iconName,
42063         title: _t.append("issues.fix." + fixTitleID + ".title"),
42064         onClick: function(context2) {
42065           var mode = context2.mode();
42066           if (!mode || mode.id !== "select")
42067             return;
42068           var selectedIDs = mode.selectedIDs();
42069           if (selectedIDs.length !== 1)
42070             return;
42071           var selectedWayID = selectedIDs[0];
42072           if (!context2.hasEntity(selectedWayID))
42073             return;
42074           var resultWayIDs = [selectedWayID];
42075           var edge, crossedEdge, crossedWayID;
42076           if (this.issue.entityIds[0] === selectedWayID) {
42077             edge = this.issue.data.edges[0];
42078             crossedEdge = this.issue.data.edges[1];
42079             crossedWayID = this.issue.entityIds[1];
42080           } else {
42081             edge = this.issue.data.edges[1];
42082             crossedEdge = this.issue.data.edges[0];
42083             crossedWayID = this.issue.entityIds[0];
42084           }
42085           var crossingLoc = this.issue.loc;
42086           var projection2 = context2.projection;
42087           var action = function actionAddStructure(graph) {
42088             var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
42089             var crossedWay = graph.hasEntity(crossedWayID);
42090             var structLengthMeters = crossedWay && isFinite(crossedWay.tags.width) && Number(crossedWay.tags.width);
42091             if (!structLengthMeters) {
42092               structLengthMeters = crossedWay && crossedWay.impliedLineWidthMeters();
42093             }
42094             if (structLengthMeters) {
42095               if (getFeatureType(crossedWay, graph) === "railway") {
42096                 structLengthMeters *= 2;
42097               }
42098             } else {
42099               structLengthMeters = 8;
42100             }
42101             var a1 = geoAngle(edgeNodes[0], edgeNodes[1], projection2) + Math.PI;
42102             var a2 = geoAngle(graph.entity(crossedEdge[0]), graph.entity(crossedEdge[1]), projection2) + Math.PI;
42103             var crossingAngle = Math.max(a1, a2) - Math.min(a1, a2);
42104             if (crossingAngle > Math.PI)
42105               crossingAngle -= Math.PI;
42106             structLengthMeters = structLengthMeters / 2 / Math.sin(crossingAngle) * 2;
42107             structLengthMeters += 4;
42108             structLengthMeters = Math.min(Math.max(structLengthMeters, 4), 50);
42109             function geomToProj(geoPoint) {
42110               return [
42111                 geoLonToMeters(geoPoint[0], geoPoint[1]),
42112                 geoLatToMeters(geoPoint[1])
42113               ];
42114             }
42115             function projToGeom(projPoint) {
42116               var lat = geoMetersToLat(projPoint[1]);
42117               return [
42118                 geoMetersToLon(projPoint[0], lat),
42119                 lat
42120               ];
42121             }
42122             var projEdgeNode1 = geomToProj(edgeNodes[0].loc);
42123             var projEdgeNode2 = geomToProj(edgeNodes[1].loc);
42124             var projectedAngle = geoVecAngle(projEdgeNode1, projEdgeNode2);
42125             var projectedCrossingLoc = geomToProj(crossingLoc);
42126             var linearToSphericalMetersRatio = geoVecLength(projEdgeNode1, projEdgeNode2) / geoSphericalDistance(edgeNodes[0].loc, edgeNodes[1].loc);
42127             function locSphericalDistanceFromCrossingLoc(angle2, distanceMeters) {
42128               var lengthSphericalMeters = distanceMeters * linearToSphericalMetersRatio;
42129               return projToGeom([
42130                 projectedCrossingLoc[0] + Math.cos(angle2) * lengthSphericalMeters,
42131                 projectedCrossingLoc[1] + Math.sin(angle2) * lengthSphericalMeters
42132               ]);
42133             }
42134             var endpointLocGetter1 = function(lengthMeters) {
42135               return locSphericalDistanceFromCrossingLoc(projectedAngle, lengthMeters);
42136             };
42137             var endpointLocGetter2 = function(lengthMeters) {
42138               return locSphericalDistanceFromCrossingLoc(projectedAngle + Math.PI, lengthMeters);
42139             };
42140             var minEdgeLengthMeters = 0.55;
42141             function determineEndpoint(edge2, endNode, locGetter) {
42142               var newNode;
42143               var idealLengthMeters = structLengthMeters / 2;
42144               var crossingToEdgeEndDistance = geoSphericalDistance(crossingLoc, endNode.loc);
42145               if (crossingToEdgeEndDistance - idealLengthMeters > minEdgeLengthMeters) {
42146                 var idealNodeLoc = locGetter(idealLengthMeters);
42147                 newNode = osmNode();
42148                 graph = actionAddMidpoint({ loc: idealNodeLoc, edge: edge2 }, newNode)(graph);
42149               } else {
42150                 var edgeCount = 0;
42151                 endNode.parentIntersectionWays(graph).forEach(function(way) {
42152                   way.nodes.forEach(function(nodeID) {
42153                     if (nodeID === endNode.id) {
42154                       if (endNode.id === way.first() && endNode.id !== way.last() || endNode.id === way.last() && endNode.id !== way.first()) {
42155                         edgeCount += 1;
42156                       } else {
42157                         edgeCount += 2;
42158                       }
42159                     }
42160                   });
42161                 });
42162                 if (edgeCount >= 3) {
42163                   var insetLength = crossingToEdgeEndDistance - minEdgeLengthMeters;
42164                   if (insetLength > minEdgeLengthMeters) {
42165                     var insetNodeLoc = locGetter(insetLength);
42166                     newNode = osmNode();
42167                     graph = actionAddMidpoint({ loc: insetNodeLoc, edge: edge2 }, newNode)(graph);
42168                   }
42169                 }
42170               }
42171               if (!newNode)
42172                 newNode = endNode;
42173               var splitAction = actionSplit([newNode.id]).limitWays(resultWayIDs);
42174               graph = splitAction(graph);
42175               if (splitAction.getCreatedWayIDs().length) {
42176                 resultWayIDs.push(splitAction.getCreatedWayIDs()[0]);
42177               }
42178               return newNode;
42179             }
42180             var structEndNode1 = determineEndpoint(edge, edgeNodes[1], endpointLocGetter1);
42181             var structEndNode2 = determineEndpoint([edgeNodes[0].id, structEndNode1.id], edgeNodes[0], endpointLocGetter2);
42182             var structureWay = resultWayIDs.map(function(id2) {
42183               return graph.entity(id2);
42184             }).find(function(way) {
42185               return way.nodes.indexOf(structEndNode1.id) !== -1 && way.nodes.indexOf(structEndNode2.id) !== -1;
42186             });
42187             var tags = Object.assign({}, structureWay.tags);
42188             if (bridgeOrTunnel === "bridge") {
42189               tags.bridge = "yes";
42190               tags.layer = "1";
42191             } else {
42192               var tunnelValue = "yes";
42193               if (getFeatureType(structureWay, graph) === "waterway") {
42194                 tunnelValue = "culvert";
42195               }
42196               tags.tunnel = tunnelValue;
42197               tags.layer = "-1";
42198             }
42199             graph = actionChangeTags(structureWay.id, tags)(graph);
42200             return graph;
42201           };
42202           context2.perform(action, _t("issues.fix." + fixTitleID + ".annotation"));
42203           context2.enter(modeSelect(context2, resultWayIDs));
42204         }
42205       });
42206     }
42207     function makeConnectWaysFix(connectionTags) {
42208       var fixTitleID = "connect_features";
42209       var fixIcon = "iD-icon-crossing";
42210       if (connectionTags.highway === "crossing") {
42211         fixTitleID = "connect_using_crossing";
42212         fixIcon = "temaki-pedestrian";
42213       }
42214       if (connectionTags.ford) {
42215         fixTitleID = "connect_using_ford";
42216         fixIcon = "roentgen-ford";
42217       }
42218       const fix = new validationIssueFix({
42219         icon: fixIcon,
42220         title: _t.append("issues.fix." + fixTitleID + ".title"),
42221         onClick: function(context2) {
42222           var loc = this.issue.loc;
42223           var edges = this.issue.data.edges;
42224           context2.perform(
42225             function actionConnectCrossingWays(graph) {
42226               var node = osmNode({ loc, tags: connectionTags });
42227               graph = graph.replace(node);
42228               var nodesToMerge = [node.id];
42229               var mergeThresholdInMeters = 0.75;
42230               edges.forEach(function(edge) {
42231                 var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
42232                 var nearby = geoSphericalClosestNode(edgeNodes, loc);
42233                 if ((!nearby.node.hasInterestingTags() || nearby.node.isCrossing()) && nearby.distance < mergeThresholdInMeters) {
42234                   nodesToMerge.push(nearby.node.id);
42235                 } else {
42236                   graph = actionAddMidpoint({ loc, edge }, node)(graph);
42237                 }
42238               });
42239               if (nodesToMerge.length > 1) {
42240                 graph = actionMergeNodes(nodesToMerge, loc)(graph);
42241               }
42242               return graph;
42243             },
42244             _t("issues.fix.connect_crossing_features.annotation")
42245           );
42246         }
42247       });
42248       fix._connectionTags = connectionTags;
42249       return fix;
42250     }
42251     function makeChangeLayerFix(higherOrLower) {
42252       return new validationIssueFix({
42253         icon: "iD-icon-" + (higherOrLower === "higher" ? "up" : "down"),
42254         title: _t.append("issues.fix.tag_this_as_" + higherOrLower + ".title"),
42255         onClick: function(context2) {
42256           var mode = context2.mode();
42257           if (!mode || mode.id !== "select")
42258             return;
42259           var selectedIDs = mode.selectedIDs();
42260           if (selectedIDs.length !== 1)
42261             return;
42262           var selectedID = selectedIDs[0];
42263           if (!this.issue.entityIds.some(function(entityId) {
42264             return entityId === selectedID;
42265           }))
42266             return;
42267           var entity = context2.hasEntity(selectedID);
42268           if (!entity)
42269             return;
42270           var tags = Object.assign({}, entity.tags);
42271           var layer = tags.layer && Number(tags.layer);
42272           if (layer && !isNaN(layer)) {
42273             if (higherOrLower === "higher") {
42274               layer += 1;
42275             } else {
42276               layer -= 1;
42277             }
42278           } else {
42279             if (higherOrLower === "higher") {
42280               layer = 1;
42281             } else {
42282               layer = -1;
42283             }
42284           }
42285           tags.layer = layer.toString();
42286           context2.perform(
42287             actionChangeTags(entity.id, tags),
42288             _t("operations.change_tags.annotation")
42289           );
42290         }
42291       });
42292     }
42293     validation.type = type2;
42294     return validation;
42295   }
42296
42297   // modules/behavior/draw_way.js
42298   function behaviorDrawWay(context, wayID, mode, startGraph) {
42299     const keybinding = utilKeybinding("drawWay");
42300     var dispatch14 = dispatch_default("rejectedSelfIntersection");
42301     var behavior = behaviorDraw(context);
42302     var _nodeIndex;
42303     var _origWay;
42304     var _wayGeometry;
42305     var _headNodeID;
42306     var _annotation;
42307     var _pointerHasMoved = false;
42308     var _drawNode;
42309     var _didResolveTempEdit = false;
42310     function createDrawNode(loc) {
42311       _drawNode = osmNode({ loc });
42312       context.pauseChangeDispatch();
42313       context.replace(function actionAddDrawNode(graph) {
42314         var way = graph.entity(wayID);
42315         return graph.replace(_drawNode).replace(way.addNode(_drawNode.id, _nodeIndex));
42316       }, _annotation);
42317       context.resumeChangeDispatch();
42318       setActiveElements();
42319     }
42320     function removeDrawNode() {
42321       context.pauseChangeDispatch();
42322       context.replace(
42323         function actionDeleteDrawNode(graph) {
42324           var way = graph.entity(wayID);
42325           return graph.replace(way.removeNode(_drawNode.id)).remove(_drawNode);
42326         },
42327         _annotation
42328       );
42329       _drawNode = void 0;
42330       context.resumeChangeDispatch();
42331     }
42332     function keydown(d3_event) {
42333       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
42334         if (context.surface().classed("nope")) {
42335           context.surface().classed("nope-suppressed", true);
42336         }
42337         context.surface().classed("nope", false).classed("nope-disabled", true);
42338       }
42339     }
42340     function keyup(d3_event) {
42341       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
42342         if (context.surface().classed("nope-suppressed")) {
42343           context.surface().classed("nope", true);
42344         }
42345         context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
42346       }
42347     }
42348     function allowsVertex(d2) {
42349       return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
42350     }
42351     function move(d3_event, datum2) {
42352       var loc = context.map().mouseCoordinates();
42353       if (!_drawNode)
42354         createDrawNode(loc);
42355       context.surface().classed("nope-disabled", d3_event.altKey);
42356       var targetLoc = datum2 && datum2.properties && datum2.properties.entity && allowsVertex(datum2.properties.entity) && datum2.properties.entity.loc;
42357       var targetNodes = datum2 && datum2.properties && datum2.properties.nodes;
42358       if (targetLoc) {
42359         loc = targetLoc;
42360       } else if (targetNodes) {
42361         var choice = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, _drawNode.id);
42362         if (choice) {
42363           loc = choice.loc;
42364         }
42365       }
42366       context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
42367       _drawNode = context.entity(_drawNode.id);
42368       checkGeometry(
42369         true
42370         /* includeDrawNode */
42371       );
42372     }
42373     function checkGeometry(includeDrawNode) {
42374       var nopeDisabled = context.surface().classed("nope-disabled");
42375       var isInvalid = isInvalidGeometry(includeDrawNode);
42376       if (nopeDisabled) {
42377         context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
42378       } else {
42379         context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
42380       }
42381     }
42382     function isInvalidGeometry(includeDrawNode) {
42383       var testNode = _drawNode;
42384       var parentWay = context.graph().entity(wayID);
42385       var nodes = context.graph().childNodes(parentWay).slice();
42386       if (includeDrawNode) {
42387         if (parentWay.isClosed()) {
42388           nodes.pop();
42389         }
42390       } else {
42391         if (parentWay.isClosed()) {
42392           if (nodes.length < 3)
42393             return false;
42394           if (_drawNode)
42395             nodes.splice(-2, 1);
42396           testNode = nodes[nodes.length - 2];
42397         } else {
42398           return false;
42399         }
42400       }
42401       return testNode && geoHasSelfIntersections(nodes, testNode.id);
42402     }
42403     function undone() {
42404       _didResolveTempEdit = true;
42405       context.pauseChangeDispatch();
42406       var nextMode;
42407       if (context.graph() === startGraph) {
42408         nextMode = modeSelect(context, [wayID]);
42409       } else {
42410         context.pop(1);
42411         nextMode = mode;
42412       }
42413       context.perform(actionNoop());
42414       context.pop(1);
42415       context.resumeChangeDispatch();
42416       context.enter(nextMode);
42417     }
42418     function setActiveElements() {
42419       if (!_drawNode)
42420         return;
42421       context.surface().selectAll("." + _drawNode.id).classed("active", true);
42422     }
42423     function resetToStartGraph() {
42424       while (context.graph() !== startGraph) {
42425         context.pop();
42426       }
42427     }
42428     var drawWay = function(surface) {
42429       _drawNode = void 0;
42430       _didResolveTempEdit = false;
42431       _origWay = context.entity(wayID);
42432       if (typeof _nodeIndex === "number") {
42433         _headNodeID = _origWay.nodes[_nodeIndex];
42434       } else if (_origWay.isClosed()) {
42435         _headNodeID = _origWay.nodes[_origWay.nodes.length - 2];
42436       } else {
42437         _headNodeID = _origWay.nodes[_origWay.nodes.length - 1];
42438       }
42439       _wayGeometry = _origWay.geometry(context.graph());
42440       _annotation = _t(
42441         (_origWay.nodes.length === (_origWay.isClosed() ? 2 : 1) ? "operations.start.annotation." : "operations.continue.annotation.") + _wayGeometry
42442       );
42443       _pointerHasMoved = false;
42444       context.pauseChangeDispatch();
42445       context.perform(actionNoop(), _annotation);
42446       context.resumeChangeDispatch();
42447       behavior.hover().initialNodeID(_headNodeID);
42448       behavior.on("move", function() {
42449         _pointerHasMoved = true;
42450         move.apply(this, arguments);
42451       }).on("down", function() {
42452         move.apply(this, arguments);
42453       }).on("downcancel", function() {
42454         if (_drawNode)
42455           removeDrawNode();
42456       }).on("click", drawWay.add).on("clickWay", drawWay.addWay).on("clickNode", drawWay.addNode).on("undo", context.undo).on("cancel", drawWay.cancel).on("finish", drawWay.finish);
42457       select_default2(window).on("keydown.drawWay", keydown).on("keyup.drawWay", keyup);
42458       context.map().dblclickZoomEnable(false).on("drawn.draw", setActiveElements);
42459       setActiveElements();
42460       surface.call(behavior);
42461       context.history().on("undone.draw", undone);
42462     };
42463     drawWay.off = function(surface) {
42464       if (!_didResolveTempEdit) {
42465         context.pauseChangeDispatch();
42466         resetToStartGraph();
42467         context.resumeChangeDispatch();
42468       }
42469       _drawNode = void 0;
42470       _nodeIndex = void 0;
42471       context.map().on("drawn.draw", null);
42472       surface.call(behavior.off).selectAll(".active").classed("active", false);
42473       surface.classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false);
42474       select_default2(window).on("keydown.drawWay", null).on("keyup.drawWay", null);
42475       context.history().on("undone.draw", null);
42476     };
42477     function attemptAdd(d2, loc, doAdd) {
42478       if (_drawNode) {
42479         context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
42480         _drawNode = context.entity(_drawNode.id);
42481       } else {
42482         createDrawNode(loc);
42483       }
42484       checkGeometry(
42485         true
42486         /* includeDrawNode */
42487       );
42488       if (d2 && d2.properties && d2.properties.nope || context.surface().classed("nope")) {
42489         if (!_pointerHasMoved) {
42490           removeDrawNode();
42491         }
42492         dispatch14.call("rejectedSelfIntersection", this);
42493         return;
42494       }
42495       context.pauseChangeDispatch();
42496       doAdd();
42497       _didResolveTempEdit = true;
42498       context.resumeChangeDispatch();
42499       context.enter(mode);
42500     }
42501     drawWay.add = function(loc, d2) {
42502       attemptAdd(d2, loc, function() {
42503       });
42504     };
42505     drawWay.addWay = function(loc, edge, d2) {
42506       attemptAdd(d2, loc, function() {
42507         context.replace(
42508           actionAddMidpoint({ loc, edge }, _drawNode),
42509           _annotation
42510         );
42511       });
42512     };
42513     drawWay.addNode = function(node, d2) {
42514       if (node.id === _headNodeID || // or the first node when drawing an area
42515       _origWay.isClosed() && node.id === _origWay.first()) {
42516         drawWay.finish();
42517         return;
42518       }
42519       attemptAdd(d2, node.loc, function() {
42520         context.replace(
42521           function actionReplaceDrawNode(graph) {
42522             graph = graph.replace(graph.entity(wayID).removeNode(_drawNode.id)).remove(_drawNode);
42523             return graph.replace(graph.entity(wayID).addNode(node.id, _nodeIndex));
42524           },
42525           _annotation
42526         );
42527       });
42528     };
42529     function getFeatureType(ways) {
42530       if (ways.every((way) => way.isClosed()))
42531         return "area";
42532       if (ways.every((way) => !way.isClosed()))
42533         return "line";
42534       return "generic";
42535     }
42536     function followMode() {
42537       if (_didResolveTempEdit)
42538         return;
42539       try {
42540         const isDrawingArea = _origWay.nodes[0] === _origWay.nodes.slice(-1)[0];
42541         const [secondLastNodeId, lastNodeId] = _origWay.nodes.slice(isDrawingArea ? -3 : -2);
42542         const historyGraph = context.history().graph();
42543         if (!lastNodeId || !secondLastNodeId || !historyGraph.hasEntity(lastNodeId) || !historyGraph.hasEntity(secondLastNodeId)) {
42544           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.needs_more_initial_nodes"))();
42545           return;
42546         }
42547         const lastNodesParents = historyGraph.parentWays(historyGraph.entity(lastNodeId)).filter((w2) => w2.id !== wayID);
42548         const secondLastNodesParents = historyGraph.parentWays(historyGraph.entity(secondLastNodeId)).filter((w2) => w2.id !== wayID);
42549         const featureType = getFeatureType(lastNodesParents);
42550         if (lastNodesParents.length !== 1 || secondLastNodesParents.length === 0) {
42551           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(`operations.follow.error.intersection_of_multiple_ways.${featureType}`))();
42552           return;
42553         }
42554         if (!secondLastNodesParents.some((n3) => n3.id === lastNodesParents[0].id)) {
42555           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(`operations.follow.error.intersection_of_different_ways.${featureType}`))();
42556           return;
42557         }
42558         const way = lastNodesParents[0];
42559         const indexOfLast = way.nodes.indexOf(lastNodeId);
42560         const indexOfSecondLast = way.nodes.indexOf(secondLastNodeId);
42561         const isDescendingPastZero = indexOfLast === way.nodes.length - 2 && indexOfSecondLast === 0;
42562         let nextNodeIndex = indexOfLast + (indexOfLast > indexOfSecondLast && !isDescendingPastZero ? 1 : -1);
42563         if (nextNodeIndex === -1)
42564           nextNodeIndex = indexOfSecondLast === 1 ? way.nodes.length - 2 : 1;
42565         const nextNode = historyGraph.entity(way.nodes[nextNodeIndex]);
42566         drawWay.addNode(nextNode, {
42567           geometry: { type: "Point", coordinates: nextNode.loc },
42568           id: nextNode.id,
42569           properties: { target: true, entity: nextNode }
42570         });
42571       } catch (ex) {
42572         context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.unknown"))();
42573       }
42574     }
42575     keybinding.on(_t("operations.follow.key"), followMode);
42576     select_default2(document).call(keybinding);
42577     drawWay.finish = function() {
42578       checkGeometry(
42579         false
42580         /* includeDrawNode */
42581       );
42582       if (context.surface().classed("nope")) {
42583         dispatch14.call("rejectedSelfIntersection", this);
42584         return;
42585       }
42586       context.pauseChangeDispatch();
42587       context.pop(1);
42588       _didResolveTempEdit = true;
42589       context.resumeChangeDispatch();
42590       var way = context.hasEntity(wayID);
42591       if (!way || way.isDegenerate()) {
42592         drawWay.cancel();
42593         return;
42594       }
42595       window.setTimeout(function() {
42596         context.map().dblclickZoomEnable(true);
42597       }, 1e3);
42598       var isNewFeature = !mode.isContinuing;
42599       context.enter(modeSelect(context, [wayID]).newFeature(isNewFeature));
42600     };
42601     drawWay.cancel = function() {
42602       context.pauseChangeDispatch();
42603       resetToStartGraph();
42604       context.resumeChangeDispatch();
42605       window.setTimeout(function() {
42606         context.map().dblclickZoomEnable(true);
42607       }, 1e3);
42608       context.surface().classed("nope", false).classed("nope-disabled", false).classed("nope-suppressed", false);
42609       context.enter(modeBrowse(context));
42610     };
42611     drawWay.nodeIndex = function(val) {
42612       if (!arguments.length)
42613         return _nodeIndex;
42614       _nodeIndex = val;
42615       return drawWay;
42616     };
42617     drawWay.activeID = function() {
42618       if (!arguments.length)
42619         return _drawNode && _drawNode.id;
42620       return drawWay;
42621     };
42622     return utilRebind(drawWay, dispatch14, "on");
42623   }
42624
42625   // modules/modes/draw_line.js
42626   function modeDrawLine(context, wayID, startGraph, button, affix, continuing) {
42627     var mode = {
42628       button,
42629       id: "draw-line"
42630     };
42631     var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawLine", function() {
42632       context.ui().flash.iconName("#iD-icon-no").label(_t.append("self_intersection.error.lines"))();
42633     });
42634     mode.wayID = wayID;
42635     mode.isContinuing = continuing;
42636     mode.enter = function() {
42637       behavior.nodeIndex(affix === "prefix" ? 0 : void 0);
42638       context.install(behavior);
42639     };
42640     mode.exit = function() {
42641       context.uninstall(behavior);
42642     };
42643     mode.selectedIDs = function() {
42644       return [wayID];
42645     };
42646     mode.activeID = function() {
42647       return behavior && behavior.activeID() || [];
42648     };
42649     return mode;
42650   }
42651
42652   // modules/validations/disconnected_way.js
42653   function validationDisconnectedWay() {
42654     var type2 = "disconnected_way";
42655     function isTaggedAsHighway(entity) {
42656       return osmRoutableHighwayTagValues[entity.tags.highway];
42657     }
42658     var validation = function checkDisconnectedWay(entity, graph) {
42659       var routingIslandWays = routingIslandForEntity(entity);
42660       if (!routingIslandWays)
42661         return [];
42662       return [new validationIssue({
42663         type: type2,
42664         subtype: "highway",
42665         severity: "warning",
42666         message: function(context) {
42667           var entity2 = this.entityIds.length && context.hasEntity(this.entityIds[0]);
42668           var label = entity2 && utilDisplayLabel(entity2, context.graph());
42669           return _t.append("issues.disconnected_way.routable.message", { count: this.entityIds.length, highway: label });
42670         },
42671         reference: showReference,
42672         entityIds: Array.from(routingIslandWays).map(function(way) {
42673           return way.id;
42674         }),
42675         dynamicFixes: makeFixes
42676       })];
42677       function makeFixes(context) {
42678         var fixes = [];
42679         var singleEntity = this.entityIds.length === 1 && context.hasEntity(this.entityIds[0]);
42680         if (singleEntity) {
42681           if (singleEntity.type === "way" && !singleEntity.isClosed()) {
42682             var textDirection = _mainLocalizer.textDirection();
42683             var startFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.first(), "start");
42684             if (startFix)
42685               fixes.push(startFix);
42686             var endFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.last(), "end");
42687             if (endFix)
42688               fixes.push(endFix);
42689           }
42690           if (!fixes.length) {
42691             fixes.push(new validationIssueFix({
42692               title: _t.append("issues.fix.connect_feature.title")
42693             }));
42694           }
42695           fixes.push(new validationIssueFix({
42696             icon: "iD-operation-delete",
42697             title: _t.append("issues.fix.delete_feature.title"),
42698             entityIds: [singleEntity.id],
42699             onClick: function(context2) {
42700               var id2 = this.issue.entityIds[0];
42701               var operation = operationDelete(context2, [id2]);
42702               if (!operation.disabled()) {
42703                 operation();
42704               }
42705             }
42706           }));
42707         } else {
42708           fixes.push(new validationIssueFix({
42709             title: _t.append("issues.fix.connect_features.title")
42710           }));
42711         }
42712         return fixes;
42713       }
42714       function showReference(selection2) {
42715         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.disconnected_way.routable.reference"));
42716       }
42717       function routingIslandForEntity(entity2) {
42718         var routingIsland = /* @__PURE__ */ new Set();
42719         var waysToCheck = [];
42720         function queueParentWays(node) {
42721           graph.parentWays(node).forEach(function(parentWay) {
42722             if (!routingIsland.has(parentWay) && // only check each feature once
42723             isRoutableWay(parentWay, false)) {
42724               routingIsland.add(parentWay);
42725               waysToCheck.push(parentWay);
42726             }
42727           });
42728         }
42729         if (entity2.type === "way" && isRoutableWay(entity2, true)) {
42730           routingIsland.add(entity2);
42731           waysToCheck.push(entity2);
42732         } else if (entity2.type === "node" && isRoutableNode(entity2)) {
42733           routingIsland.add(entity2);
42734           queueParentWays(entity2);
42735         } else {
42736           return null;
42737         }
42738         while (waysToCheck.length) {
42739           var wayToCheck = waysToCheck.pop();
42740           var childNodes = graph.childNodes(wayToCheck);
42741           for (var i3 in childNodes) {
42742             var vertex = childNodes[i3];
42743             if (isConnectedVertex(vertex)) {
42744               return null;
42745             }
42746             if (isRoutableNode(vertex)) {
42747               routingIsland.add(vertex);
42748             }
42749             queueParentWays(vertex);
42750           }
42751         }
42752         return routingIsland;
42753       }
42754       function isConnectedVertex(vertex) {
42755         var osm = services.osm;
42756         if (osm && !osm.isDataLoaded(vertex.loc))
42757           return true;
42758         if (vertex.tags.entrance && vertex.tags.entrance !== "no")
42759           return true;
42760         if (vertex.tags.amenity === "parking_entrance")
42761           return true;
42762         return false;
42763       }
42764       function isRoutableNode(node) {
42765         if (node.tags.highway === "elevator")
42766           return true;
42767         return false;
42768       }
42769       function isRoutableWay(way, ignoreInnerWays) {
42770         if (isTaggedAsHighway(way) || way.tags.route === "ferry")
42771           return true;
42772         return graph.parentRelations(way).some(function(parentRelation) {
42773           if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry")
42774             return true;
42775           if (parentRelation.isMultipolygon() && isTaggedAsHighway(parentRelation) && (!ignoreInnerWays || parentRelation.memberById(way.id).role !== "inner"))
42776             return true;
42777           return false;
42778         });
42779       }
42780       function makeContinueDrawingFixIfAllowed(textDirection, vertexID, whichEnd) {
42781         var vertex = graph.hasEntity(vertexID);
42782         if (!vertex || vertex.tags.noexit === "yes")
42783           return null;
42784         var useLeftContinue = whichEnd === "start" && textDirection === "ltr" || whichEnd === "end" && textDirection === "rtl";
42785         return new validationIssueFix({
42786           icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
42787           title: _t.append("issues.fix.continue_from_" + whichEnd + ".title"),
42788           entityIds: [vertexID],
42789           onClick: function(context) {
42790             var wayId = this.issue.entityIds[0];
42791             var way = context.hasEntity(wayId);
42792             var vertexId = this.entityIds[0];
42793             var vertex2 = context.hasEntity(vertexId);
42794             if (!way || !vertex2)
42795               return;
42796             var map2 = context.map();
42797             if (!context.editable() || !map2.trimmedExtent().contains(vertex2.loc)) {
42798               map2.zoomToEase(vertex2);
42799             }
42800             context.enter(
42801               modeDrawLine(context, wayId, context.graph(), "line", way.affix(vertexId), true)
42802             );
42803           }
42804         });
42805       }
42806     };
42807     validation.type = type2;
42808     return validation;
42809   }
42810
42811   // modules/validations/invalid_format.js
42812   function validationFormatting() {
42813     var type2 = "invalid_format";
42814     var validation = function(entity) {
42815       var issues = [];
42816       function isValidEmail(email) {
42817         var valid_email = /^[^\(\)\\,":;<>@\[\]]+@[^\(\)\\,":;<>@\[\]\.]+(?:\.[a-z0-9-]+)*$/i;
42818         return !email || valid_email.test(email);
42819       }
42820       function showReferenceEmail(selection2) {
42821         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.invalid_format.email.reference"));
42822       }
42823       if (entity.tags.email) {
42824         var emails = entity.tags.email.split(";").map(function(s2) {
42825           return s2.trim();
42826         }).filter(function(x2) {
42827           return !isValidEmail(x2);
42828         });
42829         if (emails.length) {
42830           issues.push(new validationIssue({
42831             type: type2,
42832             subtype: "email",
42833             severity: "warning",
42834             message: function(context) {
42835               var entity2 = context.hasEntity(this.entityIds[0]);
42836               return entity2 ? _t.append(
42837                 "issues.invalid_format.email.message" + this.data,
42838                 { feature: utilDisplayLabel(entity2, context.graph()), email: emails.join(", ") }
42839               ) : "";
42840             },
42841             reference: showReferenceEmail,
42842             entityIds: [entity.id],
42843             hash: emails.join(),
42844             data: emails.length > 1 ? "_multi" : ""
42845           }));
42846         }
42847       }
42848       return issues;
42849     };
42850     validation.type = type2;
42851     return validation;
42852   }
42853
42854   // modules/validations/help_request.js
42855   function validationHelpRequest(context) {
42856     var type2 = "help_request";
42857     var validation = function checkFixmeTag(entity) {
42858       if (!entity.tags.fixme)
42859         return [];
42860       if (entity.version === void 0)
42861         return [];
42862       if (entity.v !== void 0) {
42863         var baseEntity = context.history().base().hasEntity(entity.id);
42864         if (!baseEntity || !baseEntity.tags.fixme)
42865           return [];
42866       }
42867       return [new validationIssue({
42868         type: type2,
42869         subtype: "fixme_tag",
42870         severity: "warning",
42871         message: function(context2) {
42872           var entity2 = context2.hasEntity(this.entityIds[0]);
42873           return entity2 ? _t.append("issues.fixme_tag.message", {
42874             feature: utilDisplayLabel(
42875               entity2,
42876               context2.graph(),
42877               true
42878               /* verbose */
42879             )
42880           }) : "";
42881         },
42882         dynamicFixes: function() {
42883           return [
42884             new validationIssueFix({
42885               title: _t.append("issues.fix.address_the_concern.title")
42886             })
42887           ];
42888         },
42889         reference: showReference,
42890         entityIds: [entity.id]
42891       })];
42892       function showReference(selection2) {
42893         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.fixme_tag.reference"));
42894       }
42895     };
42896     validation.type = type2;
42897     return validation;
42898   }
42899
42900   // modules/validations/impossible_oneway.js
42901   function validationImpossibleOneway() {
42902     var type2 = "impossible_oneway";
42903     var validation = function checkImpossibleOneway(entity, graph) {
42904       if (entity.type !== "way" || entity.geometry(graph) !== "line")
42905         return [];
42906       if (entity.isClosed())
42907         return [];
42908       if (!typeForWay(entity))
42909         return [];
42910       if (!isOneway(entity))
42911         return [];
42912       var firstIssues = issuesForNode(entity, entity.first());
42913       var lastIssues = issuesForNode(entity, entity.last());
42914       return firstIssues.concat(lastIssues);
42915       function typeForWay(way) {
42916         if (way.geometry(graph) !== "line")
42917           return null;
42918         if (osmRoutableHighwayTagValues[way.tags.highway])
42919           return "highway";
42920         if (osmFlowingWaterwayTagValues[way.tags.waterway])
42921           return "waterway";
42922         return null;
42923       }
42924       function isOneway(way) {
42925         if (way.tags.oneway === "yes")
42926           return true;
42927         if (way.tags.oneway)
42928           return false;
42929         for (var key in way.tags) {
42930           if (osmOneWayTags[key] && osmOneWayTags[key][way.tags[key]]) {
42931             return true;
42932           }
42933         }
42934         return false;
42935       }
42936       function nodeOccursMoreThanOnce(way, nodeID) {
42937         var occurrences = 0;
42938         for (var index in way.nodes) {
42939           if (way.nodes[index] === nodeID) {
42940             occurrences += 1;
42941             if (occurrences > 1)
42942               return true;
42943           }
42944         }
42945         return false;
42946       }
42947       function isConnectedViaOtherTypes(way, node) {
42948         var wayType = typeForWay(way);
42949         if (wayType === "highway") {
42950           if (node.tags.entrance && node.tags.entrance !== "no")
42951             return true;
42952           if (node.tags.amenity === "parking_entrance")
42953             return true;
42954         } else if (wayType === "waterway") {
42955           if (node.id === way.first()) {
42956             if (node.tags.natural === "spring")
42957               return true;
42958           } else {
42959             if (node.tags.manhole === "drain")
42960               return true;
42961           }
42962         }
42963         return graph.parentWays(node).some(function(parentWay) {
42964           if (parentWay.id === way.id)
42965             return false;
42966           if (wayType === "highway") {
42967             if (parentWay.geometry(graph) === "area" && osmRoutableHighwayTagValues[parentWay.tags.highway])
42968               return true;
42969             if (parentWay.tags.route === "ferry")
42970               return true;
42971             return graph.parentRelations(parentWay).some(function(parentRelation) {
42972               if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry")
42973                 return true;
42974               return parentRelation.isMultipolygon() && osmRoutableHighwayTagValues[parentRelation.tags.highway];
42975             });
42976           } else if (wayType === "waterway") {
42977             if (parentWay.tags.natural === "water" || parentWay.tags.natural === "coastline")
42978               return true;
42979           }
42980           return false;
42981         });
42982       }
42983       function issuesForNode(way, nodeID) {
42984         var isFirst = nodeID === way.first();
42985         var wayType = typeForWay(way);
42986         if (nodeOccursMoreThanOnce(way, nodeID))
42987           return [];
42988         var osm = services.osm;
42989         if (!osm)
42990           return [];
42991         var node = graph.hasEntity(nodeID);
42992         if (!node || !osm.isDataLoaded(node.loc))
42993           return [];
42994         if (isConnectedViaOtherTypes(way, node))
42995           return [];
42996         var attachedWaysOfSameType = graph.parentWays(node).filter(function(parentWay) {
42997           if (parentWay.id === way.id)
42998             return false;
42999           return typeForWay(parentWay) === wayType;
43000         });
43001         if (wayType === "waterway" && attachedWaysOfSameType.length === 0)
43002           return [];
43003         var attachedOneways = attachedWaysOfSameType.filter(function(attachedWay) {
43004           return isOneway(attachedWay);
43005         });
43006         if (attachedOneways.length < attachedWaysOfSameType.length)
43007           return [];
43008         if (attachedOneways.length) {
43009           var connectedEndpointsOkay = attachedOneways.some(function(attachedOneway) {
43010             if ((isFirst ? attachedOneway.first() : attachedOneway.last()) !== nodeID)
43011               return true;
43012             if (nodeOccursMoreThanOnce(attachedOneway, nodeID))
43013               return true;
43014             return false;
43015           });
43016           if (connectedEndpointsOkay)
43017             return [];
43018         }
43019         var placement = isFirst ? "start" : "end", messageID = wayType + ".", referenceID = wayType + ".";
43020         if (wayType === "waterway") {
43021           messageID += "connected." + placement;
43022           referenceID += "connected";
43023         } else {
43024           messageID += placement;
43025           referenceID += placement;
43026         }
43027         return [new validationIssue({
43028           type: type2,
43029           subtype: wayType,
43030           severity: "warning",
43031           message: function(context) {
43032             var entity2 = context.hasEntity(this.entityIds[0]);
43033             return entity2 ? _t.append("issues.impossible_oneway." + messageID + ".message", {
43034               feature: utilDisplayLabel(entity2, context.graph())
43035             }) : "";
43036           },
43037           reference: getReference(referenceID),
43038           entityIds: [way.id, node.id],
43039           dynamicFixes: function() {
43040             var fixes = [];
43041             if (attachedOneways.length) {
43042               fixes.push(new validationIssueFix({
43043                 icon: "iD-operation-reverse",
43044                 title: _t.append("issues.fix.reverse_feature.title"),
43045                 entityIds: [way.id],
43046                 onClick: function(context) {
43047                   var id2 = this.issue.entityIds[0];
43048                   context.perform(actionReverse(id2), _t("operations.reverse.annotation.line", { n: 1 }));
43049                 }
43050               }));
43051             }
43052             if (node.tags.noexit !== "yes") {
43053               var textDirection = _mainLocalizer.textDirection();
43054               var useLeftContinue = isFirst && textDirection === "ltr" || !isFirst && textDirection === "rtl";
43055               fixes.push(new validationIssueFix({
43056                 icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
43057                 title: _t.append("issues.fix.continue_from_" + (isFirst ? "start" : "end") + ".title"),
43058                 onClick: function(context) {
43059                   var entityID = this.issue.entityIds[0];
43060                   var vertexID = this.issue.entityIds[1];
43061                   var way2 = context.entity(entityID);
43062                   var vertex = context.entity(vertexID);
43063                   continueDrawing(way2, vertex, context);
43064                 }
43065               }));
43066             }
43067             return fixes;
43068           },
43069           loc: node.loc
43070         })];
43071         function getReference(referenceID2) {
43072           return function showReference(selection2) {
43073             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.impossible_oneway." + referenceID2 + ".reference"));
43074           };
43075         }
43076       }
43077     };
43078     function continueDrawing(way, vertex, context) {
43079       var map2 = context.map();
43080       if (!context.editable() || !map2.trimmedExtent().contains(vertex.loc)) {
43081         map2.zoomToEase(vertex);
43082       }
43083       context.enter(
43084         modeDrawLine(context, way.id, context.graph(), "line", way.affix(vertex.id), true)
43085       );
43086     }
43087     validation.type = type2;
43088     return validation;
43089   }
43090
43091   // modules/validations/incompatible_source.js
43092   function validationIncompatibleSource() {
43093     const type2 = "incompatible_source";
43094     const incompatibleRules = [
43095       {
43096         id: "amap",
43097         regex: /(^amap$|^amap\.com|autonavi|mapabc|高德)/i
43098       },
43099       {
43100         id: "baidu",
43101         regex: /(baidu|mapbar|百度)/i
43102       },
43103       {
43104         id: "google",
43105         regex: /google/i,
43106         exceptRegex: /((books|drive)\.google|google\s?(books|drive|plus))|(esri\/Google_Africa_Buildings)/i
43107       }
43108     ];
43109     const validation = function checkIncompatibleSource(entity) {
43110       const entitySources = entity.tags && entity.tags.source && entity.tags.source.split(";");
43111       if (!entitySources)
43112         return [];
43113       const entityID = entity.id;
43114       return entitySources.map((source) => {
43115         const matchRule = incompatibleRules.find((rule) => {
43116           if (!rule.regex.test(source))
43117             return false;
43118           if (rule.exceptRegex && rule.exceptRegex.test(source))
43119             return false;
43120           return true;
43121         });
43122         if (!matchRule)
43123           return null;
43124         return new validationIssue({
43125           type: type2,
43126           severity: "warning",
43127           message: (context) => {
43128             const entity2 = context.hasEntity(entityID);
43129             return entity2 ? _t.append("issues.incompatible_source.feature.message", {
43130               feature: utilDisplayLabel(
43131                 entity2,
43132                 context.graph(),
43133                 true
43134                 /* verbose */
43135               ),
43136               value: source
43137             }) : "";
43138           },
43139           reference: getReference(matchRule.id),
43140           entityIds: [entityID],
43141           hash: source,
43142           dynamicFixes: () => {
43143             return [
43144               new validationIssueFix({ title: _t.append("issues.fix.remove_proprietary_data.title") })
43145             ];
43146           }
43147         });
43148       }).filter(Boolean);
43149       function getReference(id2) {
43150         return function showReference(selection2) {
43151           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append(`issues.incompatible_source.reference.${id2}`));
43152         };
43153       }
43154     };
43155     validation.type = type2;
43156     return validation;
43157   }
43158
43159   // modules/validations/maprules.js
43160   function validationMaprules() {
43161     var type2 = "maprules";
43162     var validation = function checkMaprules(entity, graph) {
43163       if (!services.maprules)
43164         return [];
43165       var rules = services.maprules.validationRules();
43166       var issues = [];
43167       for (var i3 = 0; i3 < rules.length; i3++) {
43168         var rule = rules[i3];
43169         rule.findIssues(entity, graph, issues);
43170       }
43171       return issues;
43172     };
43173     validation.type = type2;
43174     return validation;
43175   }
43176
43177   // modules/validations/mismatched_geometry.js
43178   var import_fast_deep_equal4 = __toESM(require_fast_deep_equal());
43179   function validationMismatchedGeometry() {
43180     var type2 = "mismatched_geometry";
43181     function tagSuggestingLineIsArea(entity) {
43182       if (entity.type !== "way" || entity.isClosed())
43183         return null;
43184       var tagSuggestingArea = entity.tagSuggestingArea();
43185       if (!tagSuggestingArea) {
43186         return null;
43187       }
43188       var asLine = _mainPresetIndex.matchTags(tagSuggestingArea, "line");
43189       var asArea = _mainPresetIndex.matchTags(tagSuggestingArea, "area");
43190       if (asLine && asArea && (0, import_fast_deep_equal4.default)(asLine.tags, asArea.tags)) {
43191         return null;
43192       }
43193       return tagSuggestingArea;
43194     }
43195     function makeConnectEndpointsFixOnClick(way, graph) {
43196       if (way.nodes.length < 3)
43197         return null;
43198       var nodes = graph.childNodes(way), testNodes;
43199       var firstToLastDistanceMeters = geoSphericalDistance(nodes[0].loc, nodes[nodes.length - 1].loc);
43200       if (firstToLastDistanceMeters < 0.75) {
43201         testNodes = nodes.slice();
43202         testNodes.pop();
43203         testNodes.push(testNodes[0]);
43204         if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
43205           return function(context) {
43206             var way2 = context.entity(this.issue.entityIds[0]);
43207             context.perform(
43208               actionMergeNodes([way2.nodes[0], way2.nodes[way2.nodes.length - 1]], nodes[0].loc),
43209               _t("issues.fix.connect_endpoints.annotation")
43210             );
43211           };
43212         }
43213       }
43214       testNodes = nodes.slice();
43215       testNodes.push(testNodes[0]);
43216       if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
43217         return function(context) {
43218           var wayId = this.issue.entityIds[0];
43219           var way2 = context.entity(wayId);
43220           var nodeId = way2.nodes[0];
43221           var index = way2.nodes.length;
43222           context.perform(
43223             actionAddVertex(wayId, nodeId, index),
43224             _t("issues.fix.connect_endpoints.annotation")
43225           );
43226         };
43227       }
43228     }
43229     function lineTaggedAsAreaIssue(entity) {
43230       var tagSuggestingArea = tagSuggestingLineIsArea(entity);
43231       if (!tagSuggestingArea)
43232         return null;
43233       var validAsLine = false;
43234       var presetAsLine = _mainPresetIndex.matchTags(entity.tags, "line");
43235       if (presetAsLine) {
43236         validAsLine = true;
43237         var key = Object.keys(tagSuggestingArea)[0];
43238         if (presetAsLine.tags[key] && presetAsLine.tags[key] === "*") {
43239           validAsLine = false;
43240         }
43241         if (Object.keys(presetAsLine.tags).length === 0) {
43242           validAsLine = false;
43243         }
43244       }
43245       return new validationIssue({
43246         type: type2,
43247         subtype: "area_as_line",
43248         severity: "warning",
43249         message: function(context) {
43250           var entity2 = context.hasEntity(this.entityIds[0]);
43251           return entity2 ? _t.append("issues.tag_suggests_area.message", {
43252             feature: utilDisplayLabel(
43253               entity2,
43254               "area",
43255               true
43256               /* verbose */
43257             ),
43258             tag: utilTagText({ tags: tagSuggestingArea })
43259           }) : "";
43260         },
43261         reference: showReference,
43262         entityIds: [entity.id],
43263         hash: JSON.stringify(tagSuggestingArea),
43264         dynamicFixes: function(context) {
43265           var fixes = [];
43266           var entity2 = context.entity(this.entityIds[0]);
43267           var connectEndsOnClick = makeConnectEndpointsFixOnClick(entity2, context.graph());
43268           if (!validAsLine) {
43269             fixes.push(new validationIssueFix({
43270               title: _t.append("issues.fix.connect_endpoints.title"),
43271               onClick: connectEndsOnClick
43272             }));
43273           }
43274           fixes.push(new validationIssueFix({
43275             icon: "iD-operation-delete",
43276             title: _t.append("issues.fix.remove_tag.title"),
43277             onClick: function(context2) {
43278               var entityId = this.issue.entityIds[0];
43279               var entity3 = context2.entity(entityId);
43280               var tags = Object.assign({}, entity3.tags);
43281               for (var key2 in tagSuggestingArea) {
43282                 delete tags[key2];
43283               }
43284               context2.perform(
43285                 actionChangeTags(entityId, tags),
43286                 _t("issues.fix.remove_tag.annotation")
43287               );
43288             }
43289           }));
43290           return fixes;
43291         }
43292       });
43293       function showReference(selection2) {
43294         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.tag_suggests_area.reference"));
43295       }
43296     }
43297     function vertexPointIssue(entity, graph) {
43298       if (entity.type !== "node")
43299         return null;
43300       if (Object.keys(entity.tags).length === 0)
43301         return null;
43302       if (entity.isOnAddressLine(graph))
43303         return null;
43304       var geometry = entity.geometry(graph);
43305       var allowedGeometries = osmNodeGeometriesForTags(entity.tags);
43306       if (geometry === "point" && !allowedGeometries.point && allowedGeometries.vertex) {
43307         return new validationIssue({
43308           type: type2,
43309           subtype: "vertex_as_point",
43310           severity: "warning",
43311           message: function(context) {
43312             var entity2 = context.hasEntity(this.entityIds[0]);
43313             return entity2 ? _t.append("issues.vertex_as_point.message", {
43314               feature: utilDisplayLabel(
43315                 entity2,
43316                 "vertex",
43317                 true
43318                 /* verbose */
43319               )
43320             }) : "";
43321           },
43322           reference: function showReference(selection2) {
43323             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.vertex_as_point.reference"));
43324           },
43325           entityIds: [entity.id]
43326         });
43327       } else if (geometry === "vertex" && !allowedGeometries.vertex && allowedGeometries.point) {
43328         return new validationIssue({
43329           type: type2,
43330           subtype: "point_as_vertex",
43331           severity: "warning",
43332           message: function(context) {
43333             var entity2 = context.hasEntity(this.entityIds[0]);
43334             return entity2 ? _t.append("issues.point_as_vertex.message", {
43335               feature: utilDisplayLabel(
43336                 entity2,
43337                 "point",
43338                 true
43339                 /* verbose */
43340               )
43341             }) : "";
43342           },
43343           reference: function showReference(selection2) {
43344             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.point_as_vertex.reference"));
43345           },
43346           entityIds: [entity.id],
43347           dynamicFixes: extractPointDynamicFixes
43348         });
43349       }
43350       return null;
43351     }
43352     function otherMismatchIssue(entity, graph) {
43353       if (!entity.hasInterestingTags())
43354         return null;
43355       if (entity.type !== "node" && entity.type !== "way")
43356         return null;
43357       if (entity.type === "node" && entity.isOnAddressLine(graph))
43358         return null;
43359       var sourceGeom = entity.geometry(graph);
43360       var targetGeoms = entity.type === "way" ? ["point", "vertex"] : ["line", "area"];
43361       if (sourceGeom === "area")
43362         targetGeoms.unshift("line");
43363       var asSource = _mainPresetIndex.match(entity, graph);
43364       var targetGeom = targetGeoms.find((nodeGeom) => {
43365         var asTarget = _mainPresetIndex.matchTags(entity.tags, nodeGeom);
43366         if (!asSource || !asTarget || asSource === asTarget || // sometimes there are two presets with the same tags for different geometries
43367         (0, import_fast_deep_equal4.default)(asSource.tags, asTarget.tags))
43368           return false;
43369         if (asTarget.isFallback())
43370           return false;
43371         var primaryKey = Object.keys(asTarget.tags)[0];
43372         if (primaryKey === "building")
43373           return false;
43374         if (asTarget.tags[primaryKey] === "*")
43375           return false;
43376         return asSource.isFallback() || asSource.tags[primaryKey] === "*";
43377       });
43378       if (!targetGeom)
43379         return null;
43380       var subtype = targetGeom + "_as_" + sourceGeom;
43381       if (targetGeom === "vertex")
43382         targetGeom = "point";
43383       if (sourceGeom === "vertex")
43384         sourceGeom = "point";
43385       var referenceId = targetGeom + "_as_" + sourceGeom;
43386       var dynamicFixes;
43387       if (targetGeom === "point") {
43388         dynamicFixes = extractPointDynamicFixes;
43389       } else if (sourceGeom === "area" && targetGeom === "line") {
43390         dynamicFixes = lineToAreaDynamicFixes;
43391       }
43392       return new validationIssue({
43393         type: type2,
43394         subtype,
43395         severity: "warning",
43396         message: function(context) {
43397           var entity2 = context.hasEntity(this.entityIds[0]);
43398           return entity2 ? _t.append("issues." + referenceId + ".message", {
43399             feature: utilDisplayLabel(
43400               entity2,
43401               targetGeom,
43402               true
43403               /* verbose */
43404             )
43405           }) : "";
43406         },
43407         reference: function showReference(selection2) {
43408           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.mismatched_geometry.reference"));
43409         },
43410         entityIds: [entity.id],
43411         dynamicFixes
43412       });
43413     }
43414     function lineToAreaDynamicFixes(context) {
43415       var convertOnClick;
43416       var entityId = this.entityIds[0];
43417       var entity = context.entity(entityId);
43418       var tags = Object.assign({}, entity.tags);
43419       delete tags.area;
43420       if (!osmTagSuggestingArea(tags)) {
43421         convertOnClick = function(context2) {
43422           var entityId2 = this.issue.entityIds[0];
43423           var entity2 = context2.entity(entityId2);
43424           var tags2 = Object.assign({}, entity2.tags);
43425           if (tags2.area) {
43426             delete tags2.area;
43427           }
43428           context2.perform(
43429             actionChangeTags(entityId2, tags2),
43430             _t("issues.fix.convert_to_line.annotation")
43431           );
43432         };
43433       }
43434       return [
43435         new validationIssueFix({
43436           icon: "iD-icon-line",
43437           title: _t.append("issues.fix.convert_to_line.title"),
43438           onClick: convertOnClick
43439         })
43440       ];
43441     }
43442     function extractPointDynamicFixes(context) {
43443       var entityId = this.entityIds[0];
43444       var extractOnClick = null;
43445       if (!context.hasHiddenConnections(entityId)) {
43446         extractOnClick = function(context2) {
43447           var entityId2 = this.issue.entityIds[0];
43448           var action = actionExtract(entityId2, context2.projection);
43449           context2.perform(
43450             action,
43451             _t("operations.extract.annotation", { n: 1 })
43452           );
43453           context2.enter(modeSelect(context2, [action.getExtractedNodeID()]));
43454         };
43455       }
43456       return [
43457         new validationIssueFix({
43458           icon: "iD-operation-extract",
43459           title: _t.append("issues.fix.extract_point.title"),
43460           onClick: extractOnClick
43461         })
43462       ];
43463     }
43464     function unclosedMultipolygonPartIssues(entity, graph) {
43465       if (entity.type !== "relation" || !entity.isMultipolygon() || entity.isDegenerate() || // cannot determine issues for incompletely-downloaded relations
43466       !entity.isComplete(graph))
43467         return [];
43468       var sequences = osmJoinWays(entity.members, graph);
43469       var issues = [];
43470       for (var i3 in sequences) {
43471         var sequence = sequences[i3];
43472         if (!sequence.nodes)
43473           continue;
43474         var firstNode = sequence.nodes[0];
43475         var lastNode = sequence.nodes[sequence.nodes.length - 1];
43476         if (firstNode === lastNode)
43477           continue;
43478         var issue = new validationIssue({
43479           type: type2,
43480           subtype: "unclosed_multipolygon_part",
43481           severity: "warning",
43482           message: function(context) {
43483             var entity2 = context.hasEntity(this.entityIds[0]);
43484             return entity2 ? _t.append("issues.unclosed_multipolygon_part.message", {
43485               feature: utilDisplayLabel(
43486                 entity2,
43487                 context.graph(),
43488                 true
43489                 /* verbose */
43490               )
43491             }) : "";
43492           },
43493           reference: showReference,
43494           loc: sequence.nodes[0].loc,
43495           entityIds: [entity.id],
43496           hash: sequence.map(function(way) {
43497             return way.id;
43498           }).join()
43499         });
43500         issues.push(issue);
43501       }
43502       return issues;
43503       function showReference(selection2) {
43504         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unclosed_multipolygon_part.reference"));
43505       }
43506     }
43507     var validation = function checkMismatchedGeometry(entity, graph) {
43508       var vertexPoint = vertexPointIssue(entity, graph);
43509       if (vertexPoint)
43510         return [vertexPoint];
43511       var lineAsArea = lineTaggedAsAreaIssue(entity);
43512       if (lineAsArea)
43513         return [lineAsArea];
43514       var mismatch = otherMismatchIssue(entity, graph);
43515       if (mismatch)
43516         return [mismatch];
43517       return unclosedMultipolygonPartIssues(entity, graph);
43518     };
43519     validation.type = type2;
43520     return validation;
43521   }
43522
43523   // modules/validations/missing_role.js
43524   function validationMissingRole() {
43525     var type2 = "missing_role";
43526     var validation = function checkMissingRole(entity, graph) {
43527       var issues = [];
43528       if (entity.type === "way") {
43529         graph.parentRelations(entity).forEach(function(relation) {
43530           if (!relation.isMultipolygon())
43531             return;
43532           var member = relation.memberById(entity.id);
43533           if (member && isMissingRole(member)) {
43534             issues.push(makeIssue(entity, relation, member));
43535           }
43536         });
43537       } else if (entity.type === "relation" && entity.isMultipolygon()) {
43538         entity.indexedMembers().forEach(function(member) {
43539           var way = graph.hasEntity(member.id);
43540           if (way && isMissingRole(member)) {
43541             issues.push(makeIssue(way, entity, member));
43542           }
43543         });
43544       }
43545       return issues;
43546     };
43547     function isMissingRole(member) {
43548       return !member.role || !member.role.trim().length;
43549     }
43550     function makeIssue(way, relation, member) {
43551       return new validationIssue({
43552         type: type2,
43553         severity: "warning",
43554         message: function(context) {
43555           var member2 = context.hasEntity(this.entityIds[1]), relation2 = context.hasEntity(this.entityIds[0]);
43556           return member2 && relation2 ? _t.append("issues.missing_role.message", {
43557             member: utilDisplayLabel(member2, context.graph()),
43558             relation: utilDisplayLabel(relation2, context.graph())
43559           }) : "";
43560         },
43561         reference: showReference,
43562         entityIds: [relation.id, way.id],
43563         data: {
43564           member
43565         },
43566         hash: member.index.toString(),
43567         dynamicFixes: function() {
43568           return [
43569             makeAddRoleFix("inner"),
43570             makeAddRoleFix("outer"),
43571             new validationIssueFix({
43572               icon: "iD-operation-delete",
43573               title: _t.append("issues.fix.remove_from_relation.title"),
43574               onClick: function(context) {
43575                 context.perform(
43576                   actionDeleteMember(this.issue.entityIds[0], this.issue.data.member.index),
43577                   _t("operations.delete_member.annotation", {
43578                     n: 1
43579                   })
43580                 );
43581               }
43582             })
43583           ];
43584         }
43585       });
43586       function showReference(selection2) {
43587         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.missing_role.multipolygon.reference"));
43588       }
43589     }
43590     function makeAddRoleFix(role) {
43591       return new validationIssueFix({
43592         title: _t.append("issues.fix.set_as_" + role + ".title"),
43593         onClick: function(context) {
43594           var oldMember = this.issue.data.member;
43595           var member = { id: this.issue.entityIds[1], type: oldMember.type, role };
43596           context.perform(
43597             actionChangeMember(this.issue.entityIds[0], member, oldMember.index),
43598             _t("operations.change_role.annotation", {
43599               n: 1
43600             })
43601           );
43602         }
43603       });
43604     }
43605     validation.type = type2;
43606     return validation;
43607   }
43608
43609   // modules/validations/missing_tag.js
43610   function validationMissingTag(context) {
43611     var type2 = "missing_tag";
43612     function hasDescriptiveTags(entity, graph) {
43613       var onlyAttributeKeys = ["description", "name", "note", "start_date"];
43614       var entityDescriptiveKeys = Object.keys(entity.tags).filter(function(k2) {
43615         if (k2 === "area" || !osmIsInterestingTag(k2))
43616           return false;
43617         return !onlyAttributeKeys.some(function(attributeKey) {
43618           return k2 === attributeKey || k2.indexOf(attributeKey + ":") === 0;
43619         });
43620       });
43621       if (entity.type === "relation" && entityDescriptiveKeys.length === 1 && entity.tags.type === "multipolygon") {
43622         return osmOldMultipolygonOuterMemberOfRelation(entity, graph);
43623       }
43624       return entityDescriptiveKeys.length > 0;
43625     }
43626     function isUnknownRoad(entity) {
43627       return entity.type === "way" && entity.tags.highway === "road";
43628     }
43629     function isUntypedRelation(entity) {
43630       return entity.type === "relation" && !entity.tags.type;
43631     }
43632     var validation = function checkMissingTag(entity, graph) {
43633       var subtype;
43634       var osm = context.connection();
43635       var isUnloadedNode = entity.type === "node" && osm && !osm.isDataLoaded(entity.loc);
43636       if (!isUnloadedNode && // allow untagged nodes that are part of ways
43637       entity.geometry(graph) !== "vertex" && // allow untagged entities that are part of relations
43638       !entity.hasParentRelations(graph)) {
43639         if (Object.keys(entity.tags).length === 0) {
43640           subtype = "any";
43641         } else if (!hasDescriptiveTags(entity, graph)) {
43642           subtype = "descriptive";
43643         } else if (isUntypedRelation(entity)) {
43644           subtype = "relation_type";
43645         }
43646       }
43647       if (!subtype && isUnknownRoad(entity)) {
43648         subtype = "highway_classification";
43649       }
43650       if (!subtype)
43651         return [];
43652       var messageID = subtype === "highway_classification" ? "unknown_road" : "missing_tag." + subtype;
43653       var referenceID = subtype === "highway_classification" ? "unknown_road" : "missing_tag";
43654       var canDelete = entity.version === void 0 || entity.v !== void 0;
43655       var severity = canDelete && subtype !== "highway_classification" ? "error" : "warning";
43656       return [new validationIssue({
43657         type: type2,
43658         subtype,
43659         severity,
43660         message: function(context2) {
43661           var entity2 = context2.hasEntity(this.entityIds[0]);
43662           return entity2 ? _t.append("issues." + messageID + ".message", {
43663             feature: utilDisplayLabel(entity2, context2.graph())
43664           }) : "";
43665         },
43666         reference: showReference,
43667         entityIds: [entity.id],
43668         dynamicFixes: function(context2) {
43669           var fixes = [];
43670           var selectFixType = subtype === "highway_classification" ? "select_road_type" : "select_preset";
43671           fixes.push(new validationIssueFix({
43672             icon: "iD-icon-search",
43673             title: _t.append("issues.fix." + selectFixType + ".title"),
43674             onClick: function(context3) {
43675               context3.ui().sidebar.showPresetList();
43676             }
43677           }));
43678           var deleteOnClick;
43679           var id2 = this.entityIds[0];
43680           var operation = operationDelete(context2, [id2]);
43681           var disabledReasonID = operation.disabled();
43682           if (!disabledReasonID) {
43683             deleteOnClick = function(context3) {
43684               var id3 = this.issue.entityIds[0];
43685               var operation2 = operationDelete(context3, [id3]);
43686               if (!operation2.disabled()) {
43687                 operation2();
43688               }
43689             };
43690           }
43691           fixes.push(
43692             new validationIssueFix({
43693               icon: "iD-operation-delete",
43694               title: _t.append("issues.fix.delete_feature.title"),
43695               disabledReason: disabledReasonID ? _t("operations.delete." + disabledReasonID + ".single") : void 0,
43696               onClick: deleteOnClick
43697             })
43698           );
43699           return fixes;
43700         }
43701       })];
43702       function showReference(selection2) {
43703         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues." + referenceID + ".reference"));
43704       }
43705     };
43706     validation.type = type2;
43707     return validation;
43708   }
43709
43710   // modules/validations/outdated_tags.js
43711   function validationOutdatedTags() {
43712     const type2 = "outdated_tags";
43713     let _waitingForDeprecated = true;
43714     let _dataDeprecated;
43715     _mainFileFetcher.get("deprecated").then((d2) => _dataDeprecated = d2).catch(() => {
43716     }).finally(() => _waitingForDeprecated = false);
43717     function oldTagIssues(entity, graph) {
43718       if (!entity.hasInterestingTags())
43719         return [];
43720       let preset = _mainPresetIndex.match(entity, graph);
43721       if (!preset)
43722         return [];
43723       const oldTags = Object.assign({}, entity.tags);
43724       let subtype = "deprecated_tags";
43725       if (preset.replacement) {
43726         const newPreset = _mainPresetIndex.item(preset.replacement);
43727         graph = actionChangePreset(
43728           entity.id,
43729           preset,
43730           newPreset,
43731           true
43732           /* skip field defaults */
43733         )(graph);
43734         entity = graph.entity(entity.id);
43735         preset = newPreset;
43736       }
43737       if (_dataDeprecated) {
43738         const deprecatedTags = entity.deprecatedTags(_dataDeprecated);
43739         if (deprecatedTags.length) {
43740           deprecatedTags.forEach((tag) => {
43741             graph = actionUpgradeTags(entity.id, tag.old, tag.replace)(graph);
43742           });
43743           entity = graph.entity(entity.id);
43744         }
43745       }
43746       let newTags = Object.assign({}, entity.tags);
43747       if (preset.tags !== preset.addTags) {
43748         Object.keys(preset.addTags).forEach((k2) => {
43749           if (!newTags[k2]) {
43750             if (preset.addTags[k2] === "*") {
43751               newTags[k2] = "yes";
43752             } else {
43753               newTags[k2] = preset.addTags[k2];
43754             }
43755           }
43756         });
43757       }
43758       const nsi = services.nsi;
43759       let waitingForNsi = false;
43760       let nsiResult;
43761       if (nsi) {
43762         waitingForNsi = nsi.status() === "loading";
43763         if (!waitingForNsi) {
43764           const loc = entity.extent(graph).center();
43765           nsiResult = nsi.upgradeTags(newTags, loc);
43766           if (nsiResult) {
43767             newTags = nsiResult.newTags;
43768             subtype = "noncanonical_brand";
43769           }
43770         }
43771       }
43772       let issues = [];
43773       issues.provisional = _waitingForDeprecated || waitingForNsi;
43774       const tagDiff = utilTagDiff(oldTags, newTags);
43775       if (!tagDiff.length)
43776         return issues;
43777       const isOnlyAddingTags = tagDiff.every((d2) => d2.type === "+");
43778       let prefix = "";
43779       if (nsiResult) {
43780         prefix = "noncanonical_brand.";
43781       } else if (subtype === "deprecated_tags" && isOnlyAddingTags) {
43782         subtype = "incomplete_tags";
43783         prefix = "incomplete.";
43784       }
43785       let autoArgs = subtype !== "noncanonical_brand" ? [doUpgrade, _t("issues.fix.upgrade_tags.annotation")] : null;
43786       issues.push(new validationIssue({
43787         type: type2,
43788         subtype,
43789         severity: "warning",
43790         message: showMessage,
43791         reference: showReference,
43792         entityIds: [entity.id],
43793         hash: utilHashcode(JSON.stringify(tagDiff)),
43794         dynamicFixes: () => {
43795           let fixes = [
43796             new validationIssueFix({
43797               autoArgs,
43798               title: _t.append("issues.fix.upgrade_tags.title"),
43799               onClick: (context) => {
43800                 context.perform(doUpgrade, _t("issues.fix.upgrade_tags.annotation"));
43801               }
43802             })
43803           ];
43804           const item = nsiResult && nsiResult.matched;
43805           if (item) {
43806             fixes.push(
43807               new validationIssueFix({
43808                 title: _t.append("issues.fix.tag_as_not.title", { name: item.displayName }),
43809                 onClick: (context) => {
43810                   context.perform(addNotTag, _t("issues.fix.tag_as_not.annotation"));
43811                 }
43812               })
43813             );
43814           }
43815           return fixes;
43816         }
43817       }));
43818       return issues;
43819       function doUpgrade(graph2) {
43820         const currEntity = graph2.hasEntity(entity.id);
43821         if (!currEntity)
43822           return graph2;
43823         let newTags2 = Object.assign({}, currEntity.tags);
43824         tagDiff.forEach((diff) => {
43825           if (diff.type === "-") {
43826             delete newTags2[diff.key];
43827           } else if (diff.type === "+") {
43828             newTags2[diff.key] = diff.newVal;
43829           }
43830         });
43831         return actionChangeTags(currEntity.id, newTags2)(graph2);
43832       }
43833       function addNotTag(graph2) {
43834         const currEntity = graph2.hasEntity(entity.id);
43835         if (!currEntity)
43836           return graph2;
43837         const item = nsiResult && nsiResult.matched;
43838         if (!item)
43839           return graph2;
43840         let newTags2 = Object.assign({}, currEntity.tags);
43841         const wd = item.mainTag;
43842         const notwd = `not:${wd}`;
43843         const qid = item.tags[wd];
43844         newTags2[notwd] = qid;
43845         if (newTags2[wd] === qid) {
43846           const wp = item.mainTag.replace("wikidata", "wikipedia");
43847           delete newTags2[wd];
43848           delete newTags2[wp];
43849         }
43850         return actionChangeTags(currEntity.id, newTags2)(graph2);
43851       }
43852       function showMessage(context) {
43853         const currEntity = context.hasEntity(entity.id);
43854         if (!currEntity)
43855           return "";
43856         let messageID = `issues.outdated_tags.${prefix}message`;
43857         if (subtype === "noncanonical_brand" && isOnlyAddingTags) {
43858           messageID += "_incomplete";
43859         }
43860         return _t.append(messageID, {
43861           feature: utilDisplayLabel(
43862             currEntity,
43863             context.graph(),
43864             true
43865             /* verbose */
43866           )
43867         });
43868       }
43869       function showReference(selection2) {
43870         let enter = selection2.selectAll(".issue-reference").data([0]).enter();
43871         enter.append("div").attr("class", "issue-reference").call(_t.append(`issues.outdated_tags.${prefix}reference`));
43872         enter.append("strong").call(_t.append("issues.suggested"));
43873         enter.append("table").attr("class", "tagDiff-table").selectAll(".tagDiff-row").data(tagDiff).enter().append("tr").attr("class", "tagDiff-row").append("td").attr("class", (d2) => {
43874           let klass = d2.type === "+" ? "add" : "remove";
43875           return `tagDiff-cell tagDiff-cell-${klass}`;
43876         }).html((d2) => d2.display);
43877       }
43878     }
43879     function oldMultipolygonIssues(entity, graph) {
43880       let multipolygon, outerWay;
43881       if (entity.type === "relation") {
43882         outerWay = osmOldMultipolygonOuterMemberOfRelation(entity, graph);
43883         multipolygon = entity;
43884       } else if (entity.type === "way") {
43885         multipolygon = osmIsOldMultipolygonOuterMember(entity, graph);
43886         outerWay = entity;
43887       } else {
43888         return [];
43889       }
43890       if (!multipolygon || !outerWay)
43891         return [];
43892       return [new validationIssue({
43893         type: type2,
43894         subtype: "old_multipolygon",
43895         severity: "warning",
43896         message: showMessage,
43897         reference: showReference,
43898         entityIds: [outerWay.id, multipolygon.id],
43899         dynamicFixes: () => {
43900           return [
43901             new validationIssueFix({
43902               autoArgs: [doUpgrade, _t("issues.fix.move_tags.annotation")],
43903               title: _t.append("issues.fix.move_tags.title"),
43904               onClick: (context) => {
43905                 context.perform(doUpgrade, _t("issues.fix.move_tags.annotation"));
43906               }
43907             })
43908           ];
43909         }
43910       })];
43911       function doUpgrade(graph2) {
43912         let currMultipolygon = graph2.hasEntity(multipolygon.id);
43913         let currOuterWay = graph2.hasEntity(outerWay.id);
43914         if (!currMultipolygon || !currOuterWay)
43915           return graph2;
43916         currMultipolygon = currMultipolygon.mergeTags(currOuterWay.tags);
43917         graph2 = graph2.replace(currMultipolygon);
43918         return actionChangeTags(currOuterWay.id, {})(graph2);
43919       }
43920       function showMessage(context) {
43921         let currMultipolygon = context.hasEntity(multipolygon.id);
43922         if (!currMultipolygon)
43923           return "";
43924         return _t.append(
43925           "issues.old_multipolygon.message",
43926           { multipolygon: utilDisplayLabel(
43927             currMultipolygon,
43928             context.graph(),
43929             true
43930             /* verbose */
43931           ) }
43932         );
43933       }
43934       function showReference(selection2) {
43935         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.old_multipolygon.reference"));
43936       }
43937     }
43938     let validation = function checkOutdatedTags(entity, graph) {
43939       let issues = oldMultipolygonIssues(entity, graph);
43940       if (!issues.length)
43941         issues = oldTagIssues(entity, graph);
43942       return issues;
43943     };
43944     validation.type = type2;
43945     return validation;
43946   }
43947
43948   // modules/validations/private_data.js
43949   function validationPrivateData() {
43950     var type2 = "private_data";
43951     var privateBuildingValues = {
43952       detached: true,
43953       farm: true,
43954       house: true,
43955       houseboat: true,
43956       residential: true,
43957       semidetached_house: true,
43958       static_caravan: true
43959     };
43960     var publicKeys = {
43961       amenity: true,
43962       craft: true,
43963       historic: true,
43964       leisure: true,
43965       office: true,
43966       shop: true,
43967       tourism: true
43968     };
43969     var personalTags = {
43970       "contact:email": true,
43971       "contact:fax": true,
43972       "contact:phone": true,
43973       email: true,
43974       fax: true,
43975       phone: true
43976     };
43977     var validation = function checkPrivateData(entity) {
43978       var tags = entity.tags;
43979       if (!tags.building || !privateBuildingValues[tags.building])
43980         return [];
43981       var keepTags = {};
43982       for (var k2 in tags) {
43983         if (publicKeys[k2])
43984           return [];
43985         if (!personalTags[k2]) {
43986           keepTags[k2] = tags[k2];
43987         }
43988       }
43989       var tagDiff = utilTagDiff(tags, keepTags);
43990       if (!tagDiff.length)
43991         return [];
43992       var fixID = tagDiff.length === 1 ? "remove_tag" : "remove_tags";
43993       return [new validationIssue({
43994         type: type2,
43995         severity: "warning",
43996         message: showMessage,
43997         reference: showReference,
43998         entityIds: [entity.id],
43999         dynamicFixes: function() {
44000           return [
44001             new validationIssueFix({
44002               icon: "iD-operation-delete",
44003               title: _t.append("issues.fix." + fixID + ".title"),
44004               onClick: function(context) {
44005                 context.perform(doUpgrade, _t("issues.fix.remove_tag.annotation"));
44006               }
44007             })
44008           ];
44009         }
44010       })];
44011       function doUpgrade(graph) {
44012         var currEntity = graph.hasEntity(entity.id);
44013         if (!currEntity)
44014           return graph;
44015         var newTags = Object.assign({}, currEntity.tags);
44016         tagDiff.forEach(function(diff) {
44017           if (diff.type === "-") {
44018             delete newTags[diff.key];
44019           } else if (diff.type === "+") {
44020             newTags[diff.key] = diff.newVal;
44021           }
44022         });
44023         return actionChangeTags(currEntity.id, newTags)(graph);
44024       }
44025       function showMessage(context) {
44026         var currEntity = context.hasEntity(this.entityIds[0]);
44027         if (!currEntity)
44028           return "";
44029         return _t.append(
44030           "issues.private_data.contact.message",
44031           { feature: utilDisplayLabel(currEntity, context.graph()) }
44032         );
44033       }
44034       function showReference(selection2) {
44035         var enter = selection2.selectAll(".issue-reference").data([0]).enter();
44036         enter.append("div").attr("class", "issue-reference").call(_t.append("issues.private_data.reference"));
44037         enter.append("strong").call(_t.append("issues.suggested"));
44038         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) {
44039           var klass = d2.type === "+" ? "add" : "remove";
44040           return "tagDiff-cell tagDiff-cell-" + klass;
44041         }).html(function(d2) {
44042           return d2.display;
44043         });
44044       }
44045     };
44046     validation.type = type2;
44047     return validation;
44048   }
44049
44050   // modules/validations/suspicious_name.js
44051   function validationSuspiciousName() {
44052     const type2 = "suspicious_name";
44053     const keysToTestForGenericValues = [
44054       "aerialway",
44055       "aeroway",
44056       "amenity",
44057       "building",
44058       "craft",
44059       "highway",
44060       "leisure",
44061       "railway",
44062       "man_made",
44063       "office",
44064       "shop",
44065       "tourism",
44066       "waterway"
44067     ];
44068     let _waitingForNsi = false;
44069     function isGenericMatchInNsi(tags) {
44070       const nsi = services.nsi;
44071       if (nsi) {
44072         _waitingForNsi = nsi.status() === "loading";
44073         if (!_waitingForNsi) {
44074           return nsi.isGenericName(tags);
44075         }
44076       }
44077       return false;
44078     }
44079     function nameMatchesRawTag(lowercaseName, tags) {
44080       for (let i3 = 0; i3 < keysToTestForGenericValues.length; i3++) {
44081         let key = keysToTestForGenericValues[i3];
44082         let val = tags[key];
44083         if (val) {
44084           val = val.toLowerCase();
44085           if (key === lowercaseName || val === lowercaseName || key.replace(/\_/g, " ") === lowercaseName || val.replace(/\_/g, " ") === lowercaseName) {
44086             return true;
44087           }
44088         }
44089       }
44090       return false;
44091     }
44092     function isGenericName(name, tags) {
44093       name = name.toLowerCase();
44094       return nameMatchesRawTag(name, tags) || isGenericMatchInNsi(tags);
44095     }
44096     function makeGenericNameIssue(entityId, nameKey, genericName, langCode) {
44097       return new validationIssue({
44098         type: type2,
44099         subtype: "generic_name",
44100         severity: "warning",
44101         message: function(context) {
44102           let entity = context.hasEntity(this.entityIds[0]);
44103           if (!entity)
44104             return "";
44105           let preset = _mainPresetIndex.match(entity, context.graph());
44106           let langName = langCode && _mainLocalizer.languageName(langCode);
44107           return _t.append(
44108             "issues.generic_name.message" + (langName ? "_language" : ""),
44109             { feature: preset.name(), name: genericName, language: langName }
44110           );
44111         },
44112         reference: showReference,
44113         entityIds: [entityId],
44114         hash: `${nameKey}=${genericName}`,
44115         dynamicFixes: function() {
44116           return [
44117             new validationIssueFix({
44118               icon: "iD-operation-delete",
44119               title: _t.append("issues.fix.remove_the_name.title"),
44120               onClick: function(context) {
44121                 let entityId2 = this.issue.entityIds[0];
44122                 let entity = context.entity(entityId2);
44123                 let tags = Object.assign({}, entity.tags);
44124                 delete tags[nameKey];
44125                 context.perform(
44126                   actionChangeTags(entityId2, tags),
44127                   _t("issues.fix.remove_generic_name.annotation")
44128                 );
44129               }
44130             })
44131           ];
44132         }
44133       });
44134       function showReference(selection2) {
44135         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.generic_name.reference"));
44136       }
44137     }
44138     function makeIncorrectNameIssue(entityId, nameKey, incorrectName, langCode) {
44139       return new validationIssue({
44140         type: type2,
44141         subtype: "not_name",
44142         severity: "warning",
44143         message: function(context) {
44144           const entity = context.hasEntity(this.entityIds[0]);
44145           if (!entity)
44146             return "";
44147           const preset = _mainPresetIndex.match(entity, context.graph());
44148           const langName = langCode && _mainLocalizer.languageName(langCode);
44149           return _t.append(
44150             "issues.incorrect_name.message" + (langName ? "_language" : ""),
44151             { feature: preset.name(), name: incorrectName, language: langName }
44152           );
44153         },
44154         reference: showReference,
44155         entityIds: [entityId],
44156         hash: `${nameKey}=${incorrectName}`,
44157         dynamicFixes: function() {
44158           return [
44159             new validationIssueFix({
44160               icon: "iD-operation-delete",
44161               title: _t.append("issues.fix.remove_the_name.title"),
44162               onClick: function(context) {
44163                 const entityId2 = this.issue.entityIds[0];
44164                 const entity = context.entity(entityId2);
44165                 let tags = Object.assign({}, entity.tags);
44166                 delete tags[nameKey];
44167                 context.perform(
44168                   actionChangeTags(entityId2, tags),
44169                   _t("issues.fix.remove_mistaken_name.annotation")
44170                 );
44171               }
44172             })
44173           ];
44174         }
44175       });
44176       function showReference(selection2) {
44177         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.generic_name.reference"));
44178       }
44179     }
44180     let validation = function checkGenericName(entity) {
44181       const tags = entity.tags;
44182       const hasWikidata = !!tags.wikidata || !!tags["brand:wikidata"] || !!tags["operator:wikidata"];
44183       if (hasWikidata)
44184         return [];
44185       let issues = [];
44186       const notNames2 = (tags["not:name"] || "").split(";");
44187       for (let key in tags) {
44188         const m2 = key.match(/^name(?:(?::)([a-zA-Z_-]+))?$/);
44189         if (!m2)
44190           continue;
44191         const langCode = m2.length >= 2 ? m2[1] : null;
44192         const value = tags[key];
44193         if (notNames2.length) {
44194           for (let i3 in notNames2) {
44195             const notName = notNames2[i3];
44196             if (notName && value === notName) {
44197               issues.push(makeIncorrectNameIssue(entity.id, key, value, langCode));
44198               continue;
44199             }
44200           }
44201         }
44202         if (isGenericName(value, tags)) {
44203           issues.provisional = _waitingForNsi;
44204           issues.push(makeGenericNameIssue(entity.id, key, value, langCode));
44205         }
44206       }
44207       return issues;
44208     };
44209     validation.type = type2;
44210     return validation;
44211   }
44212
44213   // modules/validations/unsquare_way.js
44214   function validationUnsquareWay(context) {
44215     var type2 = "unsquare_way";
44216     var DEFAULT_DEG_THRESHOLD = 5;
44217     var epsilon3 = 0.05;
44218     var nodeThreshold = 10;
44219     function isBuilding(entity, graph) {
44220       if (entity.type !== "way" || entity.geometry(graph) !== "area")
44221         return false;
44222       return entity.tags.building && entity.tags.building !== "no";
44223     }
44224     var validation = function checkUnsquareWay(entity, graph) {
44225       if (!isBuilding(entity, graph))
44226         return [];
44227       if (entity.tags.nonsquare === "yes")
44228         return [];
44229       var isClosed = entity.isClosed();
44230       if (!isClosed)
44231         return [];
44232       var nodes = graph.childNodes(entity).slice();
44233       if (nodes.length > nodeThreshold + 1)
44234         return [];
44235       var osm = services.osm;
44236       if (!osm || nodes.some(function(node) {
44237         return !osm.isDataLoaded(node.loc);
44238       }))
44239         return [];
44240       var hasConnectedSquarableWays = nodes.some(function(node) {
44241         return graph.parentWays(node).some(function(way) {
44242           if (way.id === entity.id)
44243             return false;
44244           if (isBuilding(way, graph))
44245             return true;
44246           return graph.parentRelations(way).some(function(parentRelation) {
44247             return parentRelation.isMultipolygon() && parentRelation.tags.building && parentRelation.tags.building !== "no";
44248           });
44249         });
44250       });
44251       if (hasConnectedSquarableWays)
44252         return [];
44253       var storedDegreeThreshold = corePreferences("validate-square-degrees");
44254       var degreeThreshold = isFinite(storedDegreeThreshold) ? Number(storedDegreeThreshold) : DEFAULT_DEG_THRESHOLD;
44255       var points = nodes.map(function(node) {
44256         return context.projection(node.loc);
44257       });
44258       if (!geoOrthoCanOrthogonalize(points, isClosed, epsilon3, degreeThreshold, true))
44259         return [];
44260       var autoArgs;
44261       if (!entity.tags.wikidata) {
44262         var autoAction = actionOrthogonalize(entity.id, context.projection, void 0, degreeThreshold);
44263         autoAction.transitionable = false;
44264         autoArgs = [autoAction, _t("operations.orthogonalize.annotation.feature", { n: 1 })];
44265       }
44266       return [new validationIssue({
44267         type: type2,
44268         subtype: "building",
44269         severity: "warning",
44270         message: function(context2) {
44271           var entity2 = context2.hasEntity(this.entityIds[0]);
44272           return entity2 ? _t.append("issues.unsquare_way.message", {
44273             feature: utilDisplayLabel(entity2, context2.graph())
44274           }) : "";
44275         },
44276         reference: showReference,
44277         entityIds: [entity.id],
44278         hash: degreeThreshold,
44279         dynamicFixes: function() {
44280           return [
44281             new validationIssueFix({
44282               icon: "iD-operation-orthogonalize",
44283               title: _t.append("issues.fix.square_feature.title"),
44284               autoArgs,
44285               onClick: function(context2, completionHandler) {
44286                 var entityId = this.issue.entityIds[0];
44287                 context2.perform(
44288                   actionOrthogonalize(entityId, context2.projection, void 0, degreeThreshold),
44289                   _t("operations.orthogonalize.annotation.feature", { n: 1 })
44290                 );
44291                 window.setTimeout(function() {
44292                   completionHandler();
44293                 }, 175);
44294               }
44295             })
44296             /*
44297             new validationIssueFix({
44298                 title: t.append('issues.fix.tag_as_unsquare.title'),
44299                 onClick: function(context) {
44300                     var entityId = this.issue.entityIds[0];
44301                     var entity = context.entity(entityId);
44302                     var tags = Object.assign({}, entity.tags);  // shallow copy
44303                     tags.nonsquare = 'yes';
44304                     context.perform(
44305                         actionChangeTags(entityId, tags),
44306                         t('issues.fix.tag_as_unsquare.annotation')
44307                     );
44308                 }
44309             })
44310             */
44311           ];
44312         }
44313       })];
44314       function showReference(selection2) {
44315         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unsquare_way.buildings.reference"));
44316       }
44317     };
44318     validation.type = type2;
44319     return validation;
44320   }
44321
44322   // modules/core/validator.js
44323   function coreValidator(context) {
44324     let dispatch14 = dispatch_default("validated", "focusedIssue");
44325     let validator = utilRebind({}, dispatch14, "on");
44326     let _rules = {};
44327     let _disabledRules = {};
44328     let _ignoredIssueIDs = /* @__PURE__ */ new Set();
44329     let _resolvedIssueIDs = /* @__PURE__ */ new Set();
44330     let _baseCache = validationCache("base");
44331     let _headCache = validationCache("head");
44332     let _completeDiff = {};
44333     let _headIsCurrent = false;
44334     let _deferredRIC = {};
44335     let _deferredST = /* @__PURE__ */ new Set();
44336     let _headPromise;
44337     const RETRY = 5e3;
44338     const _errorOverrides = parseHashParam(context.initialHashParams.validationError);
44339     const _warningOverrides = parseHashParam(context.initialHashParams.validationWarning);
44340     const _disableOverrides = parseHashParam(context.initialHashParams.validationDisable);
44341     function parseHashParam(param) {
44342       let result = [];
44343       let rules = (param || "").split(",");
44344       rules.forEach((rule) => {
44345         rule = rule.trim();
44346         const parts = rule.split("/", 2);
44347         const type2 = parts[0];
44348         const subtype = parts[1] || "*";
44349         if (!type2 || !subtype)
44350           return;
44351         result.push({ type: makeRegExp(type2), subtype: makeRegExp(subtype) });
44352       });
44353       return result;
44354       function makeRegExp(str2) {
44355         const escaped = str2.replace(/[-\/\\^$+?.()|[\]{}]/g, "\\$&").replace(/\*/g, ".*");
44356         return new RegExp("^" + escaped + "$");
44357       }
44358     }
44359     validator.init = () => {
44360       Object.values(validations_exports).forEach((validation) => {
44361         if (typeof validation !== "function")
44362           return;
44363         const fn = validation(context);
44364         const key = fn.type;
44365         _rules[key] = fn;
44366       });
44367       let disabledRules = corePreferences("validate-disabledRules");
44368       if (disabledRules) {
44369         disabledRules.split(",").forEach((k2) => _disabledRules[k2] = true);
44370       }
44371     };
44372     function reset(resetIgnored) {
44373       _baseCache.queue = [];
44374       _headCache.queue = [];
44375       Object.keys(_deferredRIC).forEach((key) => {
44376         window.cancelIdleCallback(key);
44377         _deferredRIC[key]();
44378       });
44379       _deferredRIC = {};
44380       _deferredST.forEach(window.clearTimeout);
44381       _deferredST.clear();
44382       if (resetIgnored)
44383         _ignoredIssueIDs.clear();
44384       _resolvedIssueIDs.clear();
44385       _baseCache = validationCache("base");
44386       _headCache = validationCache("head");
44387       _completeDiff = {};
44388       _headIsCurrent = false;
44389     }
44390     validator.reset = () => {
44391       reset(true);
44392     };
44393     validator.resetIgnoredIssues = () => {
44394       _ignoredIssueIDs.clear();
44395       dispatch14.call("validated");
44396     };
44397     validator.revalidateUnsquare = () => {
44398       revalidateUnsquare(_headCache);
44399       revalidateUnsquare(_baseCache);
44400       dispatch14.call("validated");
44401     };
44402     function revalidateUnsquare(cache) {
44403       const checkUnsquareWay = _rules.unsquare_way;
44404       if (!cache.graph || typeof checkUnsquareWay !== "function")
44405         return;
44406       cache.uncacheIssuesOfType("unsquare_way");
44407       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");
44408       buildings.forEach((entity) => {
44409         const detected = checkUnsquareWay(entity, cache.graph);
44410         if (!detected.length)
44411           return;
44412         cache.cacheIssues(detected);
44413       });
44414     }
44415     validator.getIssues = (options2) => {
44416       const opts = Object.assign({ what: "all", where: "all", includeIgnored: false, includeDisabledRules: false }, options2);
44417       const view = context.map().extent();
44418       let seen = /* @__PURE__ */ new Set();
44419       let results = [];
44420       if (_headCache.graph && _headCache.graph !== _baseCache.graph) {
44421         Object.values(_headCache.issuesByIssueID).forEach((issue) => {
44422           const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
44423           if (opts.what === "edited" && !userModified)
44424             return;
44425           if (!filter2(issue))
44426             return;
44427           seen.add(issue.id);
44428           results.push(issue);
44429         });
44430       }
44431       if (opts.what === "all") {
44432         Object.values(_baseCache.issuesByIssueID).forEach((issue) => {
44433           if (!filter2(issue))
44434             return;
44435           seen.add(issue.id);
44436           results.push(issue);
44437         });
44438       }
44439       return results;
44440       function filter2(issue) {
44441         if (!issue)
44442           return false;
44443         if (seen.has(issue.id))
44444           return false;
44445         if (_resolvedIssueIDs.has(issue.id))
44446           return false;
44447         if (opts.includeDisabledRules === "only" && !_disabledRules[issue.type])
44448           return false;
44449         if (!opts.includeDisabledRules && _disabledRules[issue.type])
44450           return false;
44451         if (opts.includeIgnored === "only" && !_ignoredIssueIDs.has(issue.id))
44452           return false;
44453         if (!opts.includeIgnored && _ignoredIssueIDs.has(issue.id))
44454           return false;
44455         if ((issue.entityIds || []).some((id2) => !context.hasEntity(id2)))
44456           return false;
44457         if (opts.where === "visible") {
44458           const extent = issue.extent(context.graph());
44459           if (!view.intersects(extent))
44460             return false;
44461         }
44462         return true;
44463       }
44464     };
44465     validator.getResolvedIssues = () => {
44466       return Array.from(_resolvedIssueIDs).map((issueID) => _baseCache.issuesByIssueID[issueID]).filter(Boolean);
44467     };
44468     validator.focusIssue = (issue) => {
44469       const graph = context.graph();
44470       let selectID;
44471       let focusCenter;
44472       const issueExtent = issue.extent(graph);
44473       if (issueExtent) {
44474         focusCenter = issueExtent.center();
44475       }
44476       if (issue.entityIds && issue.entityIds.length) {
44477         selectID = issue.entityIds[0];
44478         if (selectID && selectID.charAt(0) === "r") {
44479           const ids = utilEntityAndDeepMemberIDs([selectID], graph);
44480           let nodeID = ids.find((id2) => id2.charAt(0) === "n" && graph.hasEntity(id2));
44481           if (!nodeID) {
44482             const wayID = ids.find((id2) => id2.charAt(0) === "w" && graph.hasEntity(id2));
44483             if (wayID) {
44484               nodeID = graph.entity(wayID).first();
44485             }
44486           }
44487           if (nodeID) {
44488             focusCenter = graph.entity(nodeID).loc;
44489           }
44490         }
44491       }
44492       if (focusCenter) {
44493         const setZoom = Math.max(context.map().zoom(), 19);
44494         context.map().unobscuredCenterZoomEase(focusCenter, setZoom);
44495       }
44496       if (selectID) {
44497         window.setTimeout(() => {
44498           context.enter(modeSelect(context, [selectID]));
44499           dispatch14.call("focusedIssue", this, issue);
44500         }, 250);
44501       }
44502     };
44503     validator.getIssuesBySeverity = (options2) => {
44504       let groups = utilArrayGroupBy(validator.getIssues(options2), "severity");
44505       groups.error = groups.error || [];
44506       groups.warning = groups.warning || [];
44507       return groups;
44508     };
44509     validator.getSharedEntityIssues = (entityIDs, options2) => {
44510       const orderedIssueTypes = [
44511         // Show some issue types in a particular order:
44512         "missing_tag",
44513         "missing_role",
44514         // - missing data first
44515         "outdated_tags",
44516         "mismatched_geometry",
44517         // - identity issues
44518         "crossing_ways",
44519         "almost_junction",
44520         // - geometry issues where fixing them might solve connectivity issues
44521         "disconnected_way",
44522         "impossible_oneway"
44523         // - finally connectivity issues
44524       ];
44525       const allIssues = validator.getIssues(options2);
44526       const forEntityIDs = new Set(entityIDs);
44527       return allIssues.filter((issue) => (issue.entityIds || []).some((entityID) => forEntityIDs.has(entityID))).sort((issue1, issue2) => {
44528         if (issue1.type === issue2.type) {
44529           return issue1.id < issue2.id ? -1 : 1;
44530         }
44531         const index1 = orderedIssueTypes.indexOf(issue1.type);
44532         const index2 = orderedIssueTypes.indexOf(issue2.type);
44533         if (index1 !== -1 && index2 !== -1) {
44534           return index1 - index2;
44535         } else if (index1 === -1 && index2 === -1) {
44536           return issue1.type < issue2.type ? -1 : 1;
44537         } else {
44538           return index1 !== -1 ? -1 : 1;
44539         }
44540       });
44541     };
44542     validator.getEntityIssues = (entityID, options2) => {
44543       return validator.getSharedEntityIssues([entityID], options2);
44544     };
44545     validator.getRuleKeys = () => {
44546       return Object.keys(_rules);
44547     };
44548     validator.isRuleEnabled = (key) => {
44549       return !_disabledRules[key];
44550     };
44551     validator.toggleRule = (key) => {
44552       if (_disabledRules[key]) {
44553         delete _disabledRules[key];
44554       } else {
44555         _disabledRules[key] = true;
44556       }
44557       corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
44558       validator.validate();
44559     };
44560     validator.disableRules = (keys2) => {
44561       _disabledRules = {};
44562       keys2.forEach((k2) => _disabledRules[k2] = true);
44563       corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
44564       validator.validate();
44565     };
44566     validator.ignoreIssue = (issueID) => {
44567       _ignoredIssueIDs.add(issueID);
44568     };
44569     validator.validate = () => {
44570       const baseGraph = context.history().base();
44571       if (!_headCache.graph)
44572         _headCache.graph = baseGraph;
44573       if (!_baseCache.graph)
44574         _baseCache.graph = baseGraph;
44575       const prevGraph = _headCache.graph;
44576       const currGraph = context.graph();
44577       if (currGraph === prevGraph) {
44578         _headIsCurrent = true;
44579         dispatch14.call("validated");
44580         return Promise.resolve();
44581       }
44582       if (_headPromise) {
44583         _headIsCurrent = false;
44584         return _headPromise;
44585       }
44586       _headCache.graph = currGraph;
44587       _completeDiff = context.history().difference().complete();
44588       const incrementalDiff = coreDifference(prevGraph, currGraph);
44589       let entityIDs = Object.keys(incrementalDiff.complete());
44590       entityIDs = _headCache.withAllRelatedEntities(entityIDs);
44591       if (!entityIDs.size) {
44592         dispatch14.call("validated");
44593         return Promise.resolve();
44594       }
44595       _headPromise = validateEntitiesAsync(entityIDs, _headCache).then(() => updateResolvedIssues(entityIDs)).then(() => dispatch14.call("validated")).catch(() => {
44596       }).then(() => {
44597         _headPromise = null;
44598         if (!_headIsCurrent) {
44599           validator.validate();
44600         }
44601       });
44602       return _headPromise;
44603     };
44604     context.history().on("restore.validator", validator.validate).on("undone.validator", validator.validate).on("redone.validator", validator.validate).on("reset.validator", () => {
44605       reset(false);
44606       validator.validate();
44607     });
44608     context.on("exit.validator", validator.validate);
44609     context.history().on("merge.validator", (entities) => {
44610       if (!entities)
44611         return;
44612       const baseGraph = context.history().base();
44613       if (!_headCache.graph)
44614         _headCache.graph = baseGraph;
44615       if (!_baseCache.graph)
44616         _baseCache.graph = baseGraph;
44617       let entityIDs = entities.map((entity) => entity.id);
44618       entityIDs = _baseCache.withAllRelatedEntities(entityIDs);
44619       validateEntitiesAsync(entityIDs, _baseCache);
44620     });
44621     function validateEntity(entity, graph) {
44622       let result = { issues: [], provisional: false };
44623       Object.keys(_rules).forEach(runValidation);
44624       return result;
44625       function runValidation(key) {
44626         const fn = _rules[key];
44627         if (typeof fn !== "function") {
44628           console.error("no such validation rule = " + key);
44629           return;
44630         }
44631         let detected = fn(entity, graph);
44632         if (detected.provisional) {
44633           result.provisional = true;
44634         }
44635         detected = detected.filter(applySeverityOverrides);
44636         result.issues = result.issues.concat(detected);
44637         function applySeverityOverrides(issue) {
44638           const type2 = issue.type;
44639           const subtype = issue.subtype || "";
44640           let i3;
44641           for (i3 = 0; i3 < _errorOverrides.length; i3++) {
44642             if (_errorOverrides[i3].type.test(type2) && _errorOverrides[i3].subtype.test(subtype)) {
44643               issue.severity = "error";
44644               return true;
44645             }
44646           }
44647           for (i3 = 0; i3 < _warningOverrides.length; i3++) {
44648             if (_warningOverrides[i3].type.test(type2) && _warningOverrides[i3].subtype.test(subtype)) {
44649               issue.severity = "warning";
44650               return true;
44651             }
44652           }
44653           for (i3 = 0; i3 < _disableOverrides.length; i3++) {
44654             if (_disableOverrides[i3].type.test(type2) && _disableOverrides[i3].subtype.test(subtype)) {
44655               return false;
44656             }
44657           }
44658           return true;
44659         }
44660       }
44661     }
44662     function updateResolvedIssues(entityIDs) {
44663       entityIDs.forEach((entityID) => {
44664         const baseIssues = _baseCache.issuesByEntityID[entityID];
44665         if (!baseIssues)
44666           return;
44667         baseIssues.forEach((issueID) => {
44668           const issue = _baseCache.issuesByIssueID[issueID];
44669           const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
44670           if (userModified && !_headCache.issuesByIssueID[issueID]) {
44671             _resolvedIssueIDs.add(issueID);
44672           } else {
44673             _resolvedIssueIDs.delete(issueID);
44674           }
44675         });
44676       });
44677     }
44678     function validateEntitiesAsync(entityIDs, cache) {
44679       const jobs = Array.from(entityIDs).map((entityID) => {
44680         if (cache.queuedEntityIDs.has(entityID))
44681           return null;
44682         cache.queuedEntityIDs.add(entityID);
44683         cache.uncacheEntityID(entityID);
44684         return () => {
44685           cache.queuedEntityIDs.delete(entityID);
44686           const graph = cache.graph;
44687           if (!graph)
44688             return;
44689           const entity = graph.hasEntity(entityID);
44690           if (!entity)
44691             return;
44692           const result = validateEntity(entity, graph);
44693           if (result.provisional) {
44694             cache.provisionalEntityIDs.add(entityID);
44695           }
44696           cache.cacheIssues(result.issues);
44697         };
44698       }).filter(Boolean);
44699       cache.queue = cache.queue.concat(utilArrayChunk(jobs, 100));
44700       if (cache.queuePromise)
44701         return cache.queuePromise;
44702       cache.queuePromise = processQueue(cache).then(() => revalidateProvisionalEntities(cache)).catch(() => {
44703       }).finally(() => cache.queuePromise = null);
44704       return cache.queuePromise;
44705     }
44706     function revalidateProvisionalEntities(cache) {
44707       if (!cache.provisionalEntityIDs.size)
44708         return;
44709       const handle = window.setTimeout(() => {
44710         _deferredST.delete(handle);
44711         if (!cache.provisionalEntityIDs.size)
44712           return;
44713         validateEntitiesAsync(Array.from(cache.provisionalEntityIDs), cache);
44714       }, RETRY);
44715       _deferredST.add(handle);
44716     }
44717     function processQueue(cache) {
44718       if (!cache.queue.length)
44719         return Promise.resolve();
44720       const chunk = cache.queue.pop();
44721       return new Promise((resolvePromise, rejectPromise) => {
44722         const handle = window.requestIdleCallback(() => {
44723           delete _deferredRIC[handle];
44724           chunk.forEach((job) => job());
44725           resolvePromise();
44726         });
44727         _deferredRIC[handle] = rejectPromise;
44728       }).then(() => {
44729         if (cache.queue.length % 25 === 0)
44730           dispatch14.call("validated");
44731       }).then(() => processQueue(cache));
44732     }
44733     return validator;
44734   }
44735   function validationCache(which) {
44736     let cache = {
44737       which,
44738       graph: null,
44739       queue: [],
44740       queuePromise: null,
44741       queuedEntityIDs: /* @__PURE__ */ new Set(),
44742       provisionalEntityIDs: /* @__PURE__ */ new Set(),
44743       issuesByIssueID: {},
44744       // issue.id -> issue
44745       issuesByEntityID: {}
44746       // entity.id -> Set(issue.id)
44747     };
44748     cache.cacheIssue = (issue) => {
44749       (issue.entityIds || []).forEach((entityID) => {
44750         if (!cache.issuesByEntityID[entityID]) {
44751           cache.issuesByEntityID[entityID] = /* @__PURE__ */ new Set();
44752         }
44753         cache.issuesByEntityID[entityID].add(issue.id);
44754       });
44755       cache.issuesByIssueID[issue.id] = issue;
44756     };
44757     cache.uncacheIssue = (issue) => {
44758       (issue.entityIds || []).forEach((entityID) => {
44759         if (cache.issuesByEntityID[entityID]) {
44760           cache.issuesByEntityID[entityID].delete(issue.id);
44761         }
44762       });
44763       delete cache.issuesByIssueID[issue.id];
44764     };
44765     cache.cacheIssues = (issues) => {
44766       issues.forEach(cache.cacheIssue);
44767     };
44768     cache.uncacheIssues = (issues) => {
44769       issues.forEach(cache.uncacheIssue);
44770     };
44771     cache.uncacheIssuesOfType = (type2) => {
44772       const issuesOfType = Object.values(cache.issuesByIssueID).filter((issue) => issue.type === type2);
44773       cache.uncacheIssues(issuesOfType);
44774     };
44775     cache.uncacheEntityID = (entityID) => {
44776       const entityIssueIDs = cache.issuesByEntityID[entityID];
44777       if (entityIssueIDs) {
44778         entityIssueIDs.forEach((issueID) => {
44779           const issue = cache.issuesByIssueID[issueID];
44780           if (issue) {
44781             cache.uncacheIssue(issue);
44782           } else {
44783             delete cache.issuesByIssueID[issueID];
44784           }
44785         });
44786       }
44787       delete cache.issuesByEntityID[entityID];
44788       cache.provisionalEntityIDs.delete(entityID);
44789     };
44790     cache.withAllRelatedEntities = (entityIDs) => {
44791       let result = /* @__PURE__ */ new Set();
44792       (entityIDs || []).forEach((entityID) => {
44793         result.add(entityID);
44794         const entityIssueIDs = cache.issuesByEntityID[entityID];
44795         if (entityIssueIDs) {
44796           entityIssueIDs.forEach((issueID) => {
44797             const issue = cache.issuesByIssueID[issueID];
44798             if (issue) {
44799               (issue.entityIds || []).forEach((relatedID) => result.add(relatedID));
44800             } else {
44801               delete cache.issuesByIssueID[issueID];
44802             }
44803           });
44804         }
44805       });
44806       return result;
44807     };
44808     return cache;
44809   }
44810
44811   // modules/core/uploader.js
44812   function coreUploader(context) {
44813     var dispatch14 = dispatch_default(
44814       // Start and end events are dispatched exactly once each per legitimate outside call to `save`
44815       "saveStarted",
44816       // dispatched as soon as a call to `save` has been deemed legitimate
44817       "saveEnded",
44818       // dispatched after the result event has been dispatched
44819       "willAttemptUpload",
44820       // dispatched before the actual upload call occurs, if it will
44821       "progressChanged",
44822       // Each save results in one of these outcomes:
44823       "resultNoChanges",
44824       // upload wasn't attempted since there were no edits
44825       "resultErrors",
44826       // upload failed due to errors
44827       "resultConflicts",
44828       // upload failed due to data conflicts
44829       "resultSuccess"
44830       // upload completed without errors
44831     );
44832     var _isSaving = false;
44833     var _conflicts = [];
44834     var _errors = [];
44835     var _origChanges;
44836     var _discardTags = {};
44837     _mainFileFetcher.get("discarded").then(function(d2) {
44838       _discardTags = d2;
44839     }).catch(function() {
44840     });
44841     var uploader = utilRebind({}, dispatch14, "on");
44842     uploader.isSaving = function() {
44843       return _isSaving;
44844     };
44845     uploader.save = function(changeset, tryAgain, checkConflicts) {
44846       if (_isSaving && !tryAgain) {
44847         return;
44848       }
44849       var osm = context.connection();
44850       if (!osm)
44851         return;
44852       if (!osm.authenticated()) {
44853         osm.authenticate(function(err) {
44854           if (!err) {
44855             uploader.save(changeset, tryAgain, checkConflicts);
44856           }
44857         });
44858         return;
44859       }
44860       if (!_isSaving) {
44861         _isSaving = true;
44862         dispatch14.call("saveStarted", this);
44863       }
44864       var history = context.history();
44865       _conflicts = [];
44866       _errors = [];
44867       _origChanges = history.changes(actionDiscardTags(history.difference(), _discardTags));
44868       if (!tryAgain) {
44869         history.perform(actionNoop());
44870       }
44871       if (!checkConflicts) {
44872         upload(changeset);
44873       } else {
44874         performFullConflictCheck(changeset);
44875       }
44876     };
44877     function performFullConflictCheck(changeset) {
44878       var osm = context.connection();
44879       if (!osm)
44880         return;
44881       var history = context.history();
44882       var localGraph = context.graph();
44883       var remoteGraph = coreGraph(history.base(), true);
44884       var summary = history.difference().summary();
44885       var _toCheck = [];
44886       for (var i3 = 0; i3 < summary.length; i3++) {
44887         var item = summary[i3];
44888         if (item.changeType === "modified") {
44889           _toCheck.push(item.entity.id);
44890         }
44891       }
44892       var _toLoad = withChildNodes(_toCheck, localGraph);
44893       var _loaded = {};
44894       var _toLoadCount = 0;
44895       var _toLoadTotal = _toLoad.length;
44896       if (_toCheck.length) {
44897         dispatch14.call("progressChanged", this, _toLoadCount, _toLoadTotal);
44898         _toLoad.forEach(function(id2) {
44899           _loaded[id2] = false;
44900         });
44901         osm.loadMultiple(_toLoad, loaded);
44902       } else {
44903         upload(changeset);
44904       }
44905       return;
44906       function withChildNodes(ids, graph) {
44907         var s2 = new Set(ids);
44908         ids.forEach(function(id2) {
44909           var entity = graph.entity(id2);
44910           if (entity.type !== "way")
44911             return;
44912           graph.childNodes(entity).forEach(function(child) {
44913             if (child.version !== void 0) {
44914               s2.add(child.id);
44915             }
44916           });
44917         });
44918         return Array.from(s2);
44919       }
44920       function loaded(err, result) {
44921         if (_errors.length)
44922           return;
44923         if (err) {
44924           _errors.push({
44925             msg: err.message || err.responseText,
44926             details: [_t("save.status_code", { code: err.status })]
44927           });
44928           didResultInErrors();
44929         } else {
44930           var loadMore = [];
44931           result.data.forEach(function(entity) {
44932             remoteGraph.replace(entity);
44933             _loaded[entity.id] = true;
44934             _toLoad = _toLoad.filter(function(val) {
44935               return val !== entity.id;
44936             });
44937             if (!entity.visible)
44938               return;
44939             var i4, id2;
44940             if (entity.type === "way") {
44941               for (i4 = 0; i4 < entity.nodes.length; i4++) {
44942                 id2 = entity.nodes[i4];
44943                 if (_loaded[id2] === void 0) {
44944                   _loaded[id2] = false;
44945                   loadMore.push(id2);
44946                 }
44947               }
44948             } else if (entity.type === "relation" && entity.isMultipolygon()) {
44949               for (i4 = 0; i4 < entity.members.length; i4++) {
44950                 id2 = entity.members[i4].id;
44951                 if (_loaded[id2] === void 0) {
44952                   _loaded[id2] = false;
44953                   loadMore.push(id2);
44954                 }
44955               }
44956             }
44957           });
44958           _toLoadCount += result.data.length;
44959           _toLoadTotal += loadMore.length;
44960           dispatch14.call("progressChanged", this, _toLoadCount, _toLoadTotal);
44961           if (loadMore.length) {
44962             _toLoad.push.apply(_toLoad, loadMore);
44963             osm.loadMultiple(loadMore, loaded);
44964           }
44965           if (!_toLoad.length) {
44966             detectConflicts();
44967             upload(changeset);
44968           }
44969         }
44970       }
44971       function detectConflicts() {
44972         function choice(id2, text2, action) {
44973           return {
44974             id: id2,
44975             text: text2,
44976             action: function() {
44977               history.replace(action);
44978             }
44979           };
44980         }
44981         function formatUser(d2) {
44982           return '<a href="' + osm.userURL(d2) + '" target="_blank">' + escape_default(d2) + "</a>";
44983         }
44984         function entityName(entity) {
44985           return utilDisplayName(entity) || utilDisplayType(entity.id) + " " + entity.id;
44986         }
44987         function sameVersions(local, remote) {
44988           if (local.version !== remote.version)
44989             return false;
44990           if (local.type === "way") {
44991             var children2 = utilArrayUnion(local.nodes, remote.nodes);
44992             for (var i4 = 0; i4 < children2.length; i4++) {
44993               var a2 = localGraph.hasEntity(children2[i4]);
44994               var b2 = remoteGraph.hasEntity(children2[i4]);
44995               if (a2 && b2 && a2.version !== b2.version)
44996                 return false;
44997             }
44998           }
44999           return true;
45000         }
45001         _toCheck.forEach(function(id2) {
45002           var local = localGraph.entity(id2);
45003           var remote = remoteGraph.entity(id2);
45004           if (sameVersions(local, remote))
45005             return;
45006           var merge2 = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags, formatUser);
45007           history.replace(merge2);
45008           var mergeConflicts = merge2.conflicts();
45009           if (!mergeConflicts.length)
45010             return;
45011           var forceLocal = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_local");
45012           var forceRemote = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_remote");
45013           var keepMine = _t("save.conflict." + (remote.visible ? "keep_local" : "restore"));
45014           var keepTheirs = _t("save.conflict." + (remote.visible ? "keep_remote" : "delete"));
45015           _conflicts.push({
45016             id: id2,
45017             name: entityName(local),
45018             details: mergeConflicts,
45019             chosen: 1,
45020             choices: [
45021               choice(id2, keepMine, forceLocal),
45022               choice(id2, keepTheirs, forceRemote)
45023             ]
45024           });
45025         });
45026       }
45027     }
45028     function upload(changeset) {
45029       var osm = context.connection();
45030       if (!osm) {
45031         _errors.push({ msg: "No OSM Service" });
45032       }
45033       if (_conflicts.length) {
45034         didResultInConflicts(changeset);
45035       } else if (_errors.length) {
45036         didResultInErrors();
45037       } else {
45038         var history = context.history();
45039         var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
45040         if (changes.modified.length || changes.created.length || changes.deleted.length) {
45041           dispatch14.call("willAttemptUpload", this);
45042           osm.putChangeset(changeset, changes, uploadCallback);
45043         } else {
45044           didResultInNoChanges();
45045         }
45046       }
45047     }
45048     function uploadCallback(err, changeset) {
45049       if (err) {
45050         if (err.status === 409) {
45051           uploader.save(changeset, true, true);
45052         } else {
45053           _errors.push({
45054             msg: err.message || err.responseText,
45055             details: [_t("save.status_code", { code: err.status })]
45056           });
45057           didResultInErrors();
45058         }
45059       } else {
45060         didResultInSuccess(changeset);
45061       }
45062     }
45063     function didResultInNoChanges() {
45064       dispatch14.call("resultNoChanges", this);
45065       endSave();
45066       context.flush();
45067     }
45068     function didResultInErrors() {
45069       context.history().pop();
45070       dispatch14.call("resultErrors", this, _errors);
45071       endSave();
45072     }
45073     function didResultInConflicts(changeset) {
45074       _conflicts.sort(function(a2, b2) {
45075         return b2.id.localeCompare(a2.id);
45076       });
45077       dispatch14.call("resultConflicts", this, changeset, _conflicts, _origChanges);
45078       endSave();
45079     }
45080     function didResultInSuccess(changeset) {
45081       context.history().clearSaved();
45082       dispatch14.call("resultSuccess", this, changeset);
45083       window.setTimeout(function() {
45084         endSave();
45085         context.flush();
45086       }, 2500);
45087     }
45088     function endSave() {
45089       _isSaving = false;
45090       dispatch14.call("saveEnded", this);
45091     }
45092     uploader.cancelConflictResolution = function() {
45093       context.history().pop();
45094     };
45095     uploader.processResolvedConflicts = function(changeset) {
45096       var history = context.history();
45097       for (var i3 = 0; i3 < _conflicts.length; i3++) {
45098         if (_conflicts[i3].chosen === 1) {
45099           var entity = context.hasEntity(_conflicts[i3].id);
45100           if (entity && entity.type === "way") {
45101             var children2 = utilArrayUniq(entity.nodes);
45102             for (var j3 = 0; j3 < children2.length; j3++) {
45103               history.replace(actionRevert(children2[j3]));
45104             }
45105           }
45106           history.replace(actionRevert(_conflicts[i3].id));
45107         }
45108       }
45109       uploader.save(changeset, true, false);
45110     };
45111     uploader.reset = function() {
45112     };
45113     return uploader;
45114   }
45115
45116   // modules/renderer/background_source.js
45117   var import_lodash4 = __toESM(require_lodash());
45118
45119   // modules/util/IntervalTasksQueue.js
45120   var IntervalTasksQueue = class {
45121     /**
45122      * Interval in milliseconds inside which only 1 task can execute.
45123      * e.g. if interval is 200ms, and 5 async tasks are unqueued,
45124      * they will complete in ~1s if not cleared
45125      * @param {number} intervalInMs
45126      */
45127     constructor(intervalInMs) {
45128       this.intervalInMs = intervalInMs;
45129       this.pendingHandles = [];
45130       this.time = 0;
45131     }
45132     enqueue(task) {
45133       let taskTimeout = this.time;
45134       this.time += this.intervalInMs;
45135       this.pendingHandles.push(setTimeout(() => {
45136         this.time -= this.intervalInMs;
45137         task();
45138       }, taskTimeout));
45139     }
45140     clear() {
45141       this.pendingHandles.forEach((timeoutHandle) => {
45142         clearTimeout(timeoutHandle);
45143       });
45144       this.pendingHandles = [];
45145       this.time = 0;
45146     }
45147   };
45148
45149   // modules/renderer/background_source.js
45150   var isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
45151   window.matchMedia(`
45152         (-webkit-min-device-pixel-ratio: 2), /* Safari */
45153         (min-resolution: 2dppx),             /* standard */
45154         (min-resolution: 192dpi)             /* fallback */
45155     `).addListener(function() {
45156     isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
45157   });
45158   function localeDateString(s2) {
45159     if (!s2)
45160       return null;
45161     var options2 = { day: "numeric", month: "short", year: "numeric" };
45162     var d2 = new Date(s2);
45163     if (isNaN(d2.getTime()))
45164       return null;
45165     return d2.toLocaleDateString(_mainLocalizer.localeCode(), options2);
45166   }
45167   function vintageRange(vintage) {
45168     var s2;
45169     if (vintage.start || vintage.end) {
45170       s2 = vintage.start || "?";
45171       if (vintage.start !== vintage.end) {
45172         s2 += " - " + (vintage.end || "?");
45173       }
45174     }
45175     return s2;
45176   }
45177   function rendererBackgroundSource(data) {
45178     var source = Object.assign({}, data);
45179     var _offset = [0, 0];
45180     var _name = source.name;
45181     var _description = source.description;
45182     var _best = !!source.best;
45183     var _template = source.encrypted ? utilAesDecrypt(source.template) : source.template;
45184     source.tileSize = data.tileSize || 256;
45185     source.zoomExtent = data.zoomExtent || [0, 22];
45186     source.overzoom = data.overzoom !== false;
45187     source.offset = function(val) {
45188       if (!arguments.length)
45189         return _offset;
45190       _offset = val;
45191       return source;
45192     };
45193     source.nudge = function(val, zoomlevel) {
45194       _offset[0] += val[0] / Math.pow(2, zoomlevel);
45195       _offset[1] += val[1] / Math.pow(2, zoomlevel);
45196       return source;
45197     };
45198     source.name = function() {
45199       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
45200       return _t("imagery." + id_safe + ".name", { default: (0, import_lodash4.escape)(_name) });
45201     };
45202     source.label = function() {
45203       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
45204       return _t.append("imagery." + id_safe + ".name", { default: (0, import_lodash4.escape)(_name) });
45205     };
45206     source.hasDescription = function() {
45207       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
45208       var descriptionText = _mainLocalizer.tInfo("imagery." + id_safe + ".description", { default: (0, import_lodash4.escape)(_description) }).text;
45209       return descriptionText !== "";
45210     };
45211     source.description = function() {
45212       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
45213       return _t.append("imagery." + id_safe + ".description", { default: (0, import_lodash4.escape)(_description) });
45214     };
45215     source.best = function() {
45216       return _best;
45217     };
45218     source.area = function() {
45219       if (!data.polygon)
45220         return Number.MAX_VALUE;
45221       var area = area_default({ type: "MultiPolygon", coordinates: [data.polygon] });
45222       return isNaN(area) ? 0 : area;
45223     };
45224     source.imageryUsed = function() {
45225       return _name || source.id;
45226     };
45227     source.template = function(val) {
45228       if (!arguments.length)
45229         return _template;
45230       if (source.id === "custom" || source.id === "Bing") {
45231         _template = val;
45232       }
45233       return source;
45234     };
45235     source.url = function(coord2) {
45236       var result = _template.replace(/#[\s\S]*/u, "");
45237       if (result === "")
45238         return result;
45239       if (!source.type || source.id === "custom") {
45240         if (/SERVICE=WMS|\{(proj|wkid|bbox)\}/.test(result)) {
45241           source.type = "wms";
45242           source.projection = "EPSG:3857";
45243         } else if (/\{(x|y)\}/.test(result)) {
45244           source.type = "tms";
45245         } else if (/\{u\}/.test(result)) {
45246           source.type = "bing";
45247         }
45248       }
45249       if (source.type === "wms") {
45250         var tileToProjectedCoords = function(x2, y2, z2) {
45251           var zoomSize = Math.pow(2, z2);
45252           var lon = x2 / zoomSize * Math.PI * 2 - Math.PI;
45253           var lat = Math.atan(Math.sinh(Math.PI * (1 - 2 * y2 / zoomSize)));
45254           switch (source.projection) {
45255             case "EPSG:4326":
45256               return {
45257                 x: lon * 180 / Math.PI,
45258                 y: lat * 180 / Math.PI
45259               };
45260             default:
45261               var mercCoords = mercatorRaw(lon, lat);
45262               return {
45263                 x: 2003750834e-2 / Math.PI * mercCoords[0],
45264                 y: 2003750834e-2 / Math.PI * mercCoords[1]
45265               };
45266           }
45267         };
45268         var tileSize = source.tileSize;
45269         var projection2 = source.projection;
45270         var minXmaxY = tileToProjectedCoords(coord2[0], coord2[1], coord2[2]);
45271         var maxXminY = tileToProjectedCoords(coord2[0] + 1, coord2[1] + 1, coord2[2]);
45272         result = result.replace(/\{(\w+)\}/g, function(token, key) {
45273           switch (key) {
45274             case "width":
45275             case "height":
45276               return tileSize;
45277             case "proj":
45278               return projection2;
45279             case "wkid":
45280               return projection2.replace(/^EPSG:/, "");
45281             case "bbox":
45282               if (projection2 === "EPSG:4326" && // The CRS parameter implies version 1.3 (prior versions use SRS)
45283               /VERSION=1.3|CRS={proj}/.test(source.template().toUpperCase())) {
45284                 return maxXminY.y + "," + minXmaxY.x + "," + minXmaxY.y + "," + maxXminY.x;
45285               } else {
45286                 return minXmaxY.x + "," + maxXminY.y + "," + maxXminY.x + "," + minXmaxY.y;
45287               }
45288             case "w":
45289               return minXmaxY.x;
45290             case "s":
45291               return maxXminY.y;
45292             case "n":
45293               return maxXminY.x;
45294             case "e":
45295               return minXmaxY.y;
45296             default:
45297               return token;
45298           }
45299         });
45300       } else if (source.type === "tms") {
45301         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" : "");
45302       } else if (source.type === "bing") {
45303         result = result.replace("{u}", function() {
45304           var u2 = "";
45305           for (var zoom = coord2[2]; zoom > 0; zoom--) {
45306             var b2 = 0;
45307             var mask = 1 << zoom - 1;
45308             if ((coord2[0] & mask) !== 0)
45309               b2++;
45310             if ((coord2[1] & mask) !== 0)
45311               b2 += 2;
45312             u2 += b2.toString();
45313           }
45314           return u2;
45315         });
45316       }
45317       result = result.replace(/\{switch:([^}]+)\}/, function(s2, r2) {
45318         var subdomains = r2.split(",");
45319         return subdomains[(coord2[0] + coord2[1]) % subdomains.length];
45320       });
45321       return result;
45322     };
45323     source.validZoom = function(z2) {
45324       return source.zoomExtent[0] <= z2 && (source.overzoom || source.zoomExtent[1] > z2);
45325     };
45326     source.isLocatorOverlay = function() {
45327       return source.id === "mapbox_locator_overlay";
45328     };
45329     source.isHidden = function() {
45330       return source.id === "DigitalGlobe-Premium-vintage" || source.id === "DigitalGlobe-Standard-vintage";
45331     };
45332     source.copyrightNotices = function() {
45333     };
45334     source.getMetadata = function(center, tileCoord, callback) {
45335       var vintage = {
45336         start: localeDateString(source.startDate),
45337         end: localeDateString(source.endDate)
45338       };
45339       vintage.range = vintageRange(vintage);
45340       var metadata = { vintage };
45341       callback(null, metadata);
45342     };
45343     return source;
45344   }
45345   rendererBackgroundSource.Bing = function(data, dispatch14) {
45346     data.template = "https://ecn.t{switch:0,1,2,3}.tiles.virtualearth.net/tiles/a{u}.jpeg?g=1&pr=odbl&n=z";
45347     var bing = rendererBackgroundSource(data);
45348     var key = utilAesDecrypt("5c875730b09c6b422433e807e1ff060b6536c791dbfffcffc4c6b18a1bdba1f14593d151adb50e19e1be1ab19aef813bf135d0f103475e5c724dec94389e45d0");
45349     const strictParam = "n";
45350     var url = "https://dev.virtualearth.net/REST/v1/Imagery/Metadata/AerialOSM?include=ImageryProviders&uriScheme=https&key=" + key;
45351     var cache = {};
45352     var inflight = {};
45353     var providers = [];
45354     var taskQueue = new IntervalTasksQueue(250);
45355     var metadataLastZoom = -1;
45356     json_default(url).then(function(json) {
45357       let imageryResource = json.resourceSets[0].resources[0];
45358       let template = imageryResource.imageUrl;
45359       let subDomains = imageryResource.imageUrlSubdomains;
45360       let subDomainNumbers = subDomains.map((subDomain) => {
45361         return subDomain.substring(1);
45362       }).join(",");
45363       template = template.replace("{subdomain}", `t{switch:${subDomainNumbers}}`).replace("{quadkey}", "{u}");
45364       if (!new URLSearchParams(template).has(strictParam)) {
45365         template += `&${strictParam}=z`;
45366       }
45367       bing.template(template);
45368       providers = imageryResource.imageryProviders.map(function(provider) {
45369         return {
45370           attribution: provider.attribution,
45371           areas: provider.coverageAreas.map(function(area) {
45372             return {
45373               zoom: [area.zoomMin, area.zoomMax],
45374               extent: geoExtent([area.bbox[1], area.bbox[0]], [area.bbox[3], area.bbox[2]])
45375             };
45376           })
45377         };
45378       });
45379       dispatch14.call("change");
45380     }).catch(function() {
45381     });
45382     bing.copyrightNotices = function(zoom, extent) {
45383       zoom = Math.min(zoom, 21);
45384       return providers.filter(function(provider) {
45385         return provider.areas.some(function(area) {
45386           return extent.intersects(area.extent) && area.zoom[0] <= zoom && area.zoom[1] >= zoom;
45387         });
45388       }).map(function(provider) {
45389         return provider.attribution;
45390       }).join(", ");
45391     };
45392     bing.getMetadata = function(center, tileCoord, callback) {
45393       var tileID = tileCoord.slice(0, 3).join("/");
45394       var zoom = Math.min(tileCoord[2], 21);
45395       var centerPoint = center[1] + "," + center[0];
45396       var url2 = "https://dev.virtualearth.net/REST/v1/Imagery/BasicMetadata/AerialOSM/" + centerPoint + "?zl=" + zoom + "&key=" + key;
45397       if (inflight[tileID])
45398         return;
45399       if (!cache[tileID]) {
45400         cache[tileID] = {};
45401       }
45402       if (cache[tileID] && cache[tileID].metadata) {
45403         return callback(null, cache[tileID].metadata);
45404       }
45405       inflight[tileID] = true;
45406       if (metadataLastZoom !== tileCoord[2]) {
45407         metadataLastZoom = tileCoord[2];
45408         taskQueue.clear();
45409       }
45410       taskQueue.enqueue(() => {
45411         json_default(url2).then(function(result) {
45412           delete inflight[tileID];
45413           if (!result) {
45414             throw new Error("Unknown Error");
45415           }
45416           var vintage = {
45417             start: localeDateString(result.resourceSets[0].resources[0].vintageStart),
45418             end: localeDateString(result.resourceSets[0].resources[0].vintageEnd)
45419           };
45420           vintage.range = vintageRange(vintage);
45421           var metadata = { vintage };
45422           cache[tileID].metadata = metadata;
45423           if (callback)
45424             callback(null, metadata);
45425         }).catch(function(err) {
45426           delete inflight[tileID];
45427           if (callback)
45428             callback(err.message);
45429         });
45430       });
45431     };
45432     bing.terms_url = "https://blog.openstreetmap.org/2010/11/30/microsoft-imagery-details";
45433     return bing;
45434   };
45435   rendererBackgroundSource.Esri = function(data) {
45436     if (data.template.match(/blankTile/) === null) {
45437       data.template = data.template + "?blankTile=false";
45438     }
45439     var esri = rendererBackgroundSource(data);
45440     var cache = {};
45441     var inflight = {};
45442     var _prevCenter;
45443     esri.fetchTilemap = function(center) {
45444       if (_prevCenter && geoSphericalDistance(center, _prevCenter) < 5e3)
45445         return;
45446       _prevCenter = center;
45447       var z2 = 20;
45448       var dummyUrl = esri.url([1, 2, 3]);
45449       var x2 = Math.floor((center[0] + 180) / 360 * Math.pow(2, z2));
45450       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));
45451       var tilemapUrl = dummyUrl.replace(/tile\/[0-9]+\/[0-9]+\/[0-9]+\?blankTile=false/, "tilemap") + "/" + z2 + "/" + y2 + "/" + x2 + "/8/8";
45452       json_default(tilemapUrl).then(function(tilemap) {
45453         if (!tilemap) {
45454           throw new Error("Unknown Error");
45455         }
45456         var hasTiles = true;
45457         for (var i3 = 0; i3 < tilemap.data.length; i3++) {
45458           if (!tilemap.data[i3]) {
45459             hasTiles = false;
45460             break;
45461           }
45462         }
45463         esri.zoomExtent[1] = hasTiles ? 22 : 19;
45464       }).catch(function() {
45465       });
45466     };
45467     esri.getMetadata = function(center, tileCoord, callback) {
45468       if (esri.id !== "EsriWorldImagery") {
45469         return callback(null, {});
45470       }
45471       var tileID = tileCoord.slice(0, 3).join("/");
45472       var zoom = Math.min(tileCoord[2], esri.zoomExtent[1]);
45473       var centerPoint = center[0] + "," + center[1];
45474       var unknown = _t("info_panels.background.unknown");
45475       var vintage = {};
45476       var metadata = {};
45477       if (inflight[tileID])
45478         return;
45479       var url = "https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/4/query";
45480       url += "?returnGeometry=false&geometry=" + centerPoint + "&inSR=4326&geometryType=esriGeometryPoint&outFields=*&f=json";
45481       if (!cache[tileID]) {
45482         cache[tileID] = {};
45483       }
45484       if (cache[tileID] && cache[tileID].metadata) {
45485         return callback(null, cache[tileID].metadata);
45486       }
45487       inflight[tileID] = true;
45488       json_default(url).then(function(result) {
45489         delete inflight[tileID];
45490         result = result.features.map((f3) => f3.attributes).filter((a2) => a2.MinMapLevel <= zoom && a2.MaxMapLevel >= zoom)[0];
45491         if (!result) {
45492           throw new Error("Unknown Error");
45493         } else if (result.features && result.features.length < 1) {
45494           throw new Error("No Results");
45495         } else if (result.error && result.error.message) {
45496           throw new Error(result.error.message);
45497         }
45498         var captureDate = localeDateString(result.SRC_DATE2);
45499         vintage = {
45500           start: captureDate,
45501           end: captureDate,
45502           range: captureDate
45503         };
45504         metadata = {
45505           vintage,
45506           source: clean2(result.NICE_NAME),
45507           description: clean2(result.NICE_DESC),
45508           resolution: clean2(+Number(result.SRC_RES).toFixed(4)),
45509           accuracy: clean2(+Number(result.SRC_ACC).toFixed(4))
45510         };
45511         if (isFinite(metadata.resolution)) {
45512           metadata.resolution += " m";
45513         }
45514         if (isFinite(metadata.accuracy)) {
45515           metadata.accuracy += " m";
45516         }
45517         cache[tileID].metadata = metadata;
45518         if (callback)
45519           callback(null, metadata);
45520       }).catch(function(err) {
45521         delete inflight[tileID];
45522         if (callback)
45523           callback(err.message);
45524       });
45525       function clean2(val) {
45526         return String(val).trim() || unknown;
45527       }
45528     };
45529     return esri;
45530   };
45531   rendererBackgroundSource.None = function() {
45532     var source = rendererBackgroundSource({ id: "none", template: "" });
45533     source.name = function() {
45534       return _t("background.none");
45535     };
45536     source.label = function() {
45537       return _t.append("background.none");
45538     };
45539     source.imageryUsed = function() {
45540       return null;
45541     };
45542     source.area = function() {
45543       return -1;
45544     };
45545     return source;
45546   };
45547   rendererBackgroundSource.Custom = function(template) {
45548     var source = rendererBackgroundSource({ id: "custom", template });
45549     source.name = function() {
45550       return _t("background.custom");
45551     };
45552     source.label = function() {
45553       return _t.append("background.custom");
45554     };
45555     source.imageryUsed = function() {
45556       var cleaned = source.template();
45557       if (cleaned.indexOf("?") !== -1) {
45558         var parts = cleaned.split("?", 2);
45559         var qs = utilStringQs(parts[1]);
45560         ["access_token", "connectId", "token"].forEach(function(param) {
45561           if (qs[param]) {
45562             qs[param] = "{apikey}";
45563           }
45564         });
45565         cleaned = parts[0] + "?" + utilQsString(qs, true);
45566       }
45567       cleaned = cleaned.replace(/token\/(\w+)/, "token/{apikey}").replace(/key=(\w+)/, "key={apikey}");
45568       return "Custom (" + cleaned + " )";
45569     };
45570     source.area = function() {
45571       return -2;
45572     };
45573     return source;
45574   };
45575
45576   // node_modules/@turf/helpers/dist/es/index.js
45577   var earthRadius = 63710088e-1;
45578   var factors = {
45579     centimeters: earthRadius * 100,
45580     centimetres: earthRadius * 100,
45581     degrees: earthRadius / 111325,
45582     feet: earthRadius * 3.28084,
45583     inches: earthRadius * 39.37,
45584     kilometers: earthRadius / 1e3,
45585     kilometres: earthRadius / 1e3,
45586     meters: earthRadius,
45587     metres: earthRadius,
45588     miles: earthRadius / 1609.344,
45589     millimeters: earthRadius * 1e3,
45590     millimetres: earthRadius * 1e3,
45591     nauticalmiles: earthRadius / 1852,
45592     radians: 1,
45593     yards: earthRadius * 1.0936
45594   };
45595   var unitsFactors = {
45596     centimeters: 100,
45597     centimetres: 100,
45598     degrees: 1 / 111325,
45599     feet: 3.28084,
45600     inches: 39.37,
45601     kilometers: 1 / 1e3,
45602     kilometres: 1 / 1e3,
45603     meters: 1,
45604     metres: 1,
45605     miles: 1 / 1609.344,
45606     millimeters: 1e3,
45607     millimetres: 1e3,
45608     nauticalmiles: 1 / 1852,
45609     radians: 1 / earthRadius,
45610     yards: 1.0936133
45611   };
45612   function feature2(geom, properties, options2) {
45613     if (options2 === void 0) {
45614       options2 = {};
45615     }
45616     var feat = { type: "Feature" };
45617     if (options2.id === 0 || options2.id) {
45618       feat.id = options2.id;
45619     }
45620     if (options2.bbox) {
45621       feat.bbox = options2.bbox;
45622     }
45623     feat.properties = properties || {};
45624     feat.geometry = geom;
45625     return feat;
45626   }
45627   function polygon(coordinates, properties, options2) {
45628     if (options2 === void 0) {
45629       options2 = {};
45630     }
45631     for (var _i = 0, coordinates_1 = coordinates; _i < coordinates_1.length; _i++) {
45632       var ring = coordinates_1[_i];
45633       if (ring.length < 4) {
45634         throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");
45635       }
45636       for (var j3 = 0; j3 < ring[ring.length - 1].length; j3++) {
45637         if (ring[ring.length - 1][j3] !== ring[0][j3]) {
45638           throw new Error("First and last Position are not equivalent.");
45639         }
45640       }
45641     }
45642     var geom = {
45643       type: "Polygon",
45644       coordinates
45645     };
45646     return feature2(geom, properties, options2);
45647   }
45648   function lineString(coordinates, properties, options2) {
45649     if (options2 === void 0) {
45650       options2 = {};
45651     }
45652     if (coordinates.length < 2) {
45653       throw new Error("coordinates must be an array of two or more positions");
45654     }
45655     var geom = {
45656       type: "LineString",
45657       coordinates
45658     };
45659     return feature2(geom, properties, options2);
45660   }
45661   function multiLineString(coordinates, properties, options2) {
45662     if (options2 === void 0) {
45663       options2 = {};
45664     }
45665     var geom = {
45666       type: "MultiLineString",
45667       coordinates
45668     };
45669     return feature2(geom, properties, options2);
45670   }
45671   function multiPolygon(coordinates, properties, options2) {
45672     if (options2 === void 0) {
45673       options2 = {};
45674     }
45675     var geom = {
45676       type: "MultiPolygon",
45677       coordinates
45678     };
45679     return feature2(geom, properties, options2);
45680   }
45681
45682   // node_modules/@turf/invariant/dist/es/index.js
45683   function getGeom(geojson) {
45684     if (geojson.type === "Feature") {
45685       return geojson.geometry;
45686     }
45687     return geojson;
45688   }
45689
45690   // node_modules/@turf/bbox-clip/dist/es/lib/lineclip.js
45691   function lineclip(points, bbox2, result) {
45692     var len = points.length, codeA = bitCode(points[0], bbox2), part = [], i3, codeB, lastCode;
45693     var a2;
45694     var b2;
45695     if (!result)
45696       result = [];
45697     for (i3 = 1; i3 < len; i3++) {
45698       a2 = points[i3 - 1];
45699       b2 = points[i3];
45700       codeB = lastCode = bitCode(b2, bbox2);
45701       while (true) {
45702         if (!(codeA | codeB)) {
45703           part.push(a2);
45704           if (codeB !== lastCode) {
45705             part.push(b2);
45706             if (i3 < len - 1) {
45707               result.push(part);
45708               part = [];
45709             }
45710           } else if (i3 === len - 1) {
45711             part.push(b2);
45712           }
45713           break;
45714         } else if (codeA & codeB) {
45715           break;
45716         } else if (codeA) {
45717           a2 = intersect(a2, b2, codeA, bbox2);
45718           codeA = bitCode(a2, bbox2);
45719         } else {
45720           b2 = intersect(a2, b2, codeB, bbox2);
45721           codeB = bitCode(b2, bbox2);
45722         }
45723       }
45724       codeA = lastCode;
45725     }
45726     if (part.length)
45727       result.push(part);
45728     return result;
45729   }
45730   function polygonclip(points, bbox2) {
45731     var result, edge, prev, prevInside, i3, p2, inside;
45732     for (edge = 1; edge <= 8; edge *= 2) {
45733       result = [];
45734       prev = points[points.length - 1];
45735       prevInside = !(bitCode(prev, bbox2) & edge);
45736       for (i3 = 0; i3 < points.length; i3++) {
45737         p2 = points[i3];
45738         inside = !(bitCode(p2, bbox2) & edge);
45739         if (inside !== prevInside)
45740           result.push(intersect(prev, p2, edge, bbox2));
45741         if (inside)
45742           result.push(p2);
45743         prev = p2;
45744         prevInside = inside;
45745       }
45746       points = result;
45747       if (!points.length)
45748         break;
45749     }
45750     return result;
45751   }
45752   function intersect(a2, b2, edge, bbox2) {
45753     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;
45754   }
45755   function bitCode(p2, bbox2) {
45756     var code = 0;
45757     if (p2[0] < bbox2[0])
45758       code |= 1;
45759     else if (p2[0] > bbox2[2])
45760       code |= 2;
45761     if (p2[1] < bbox2[1])
45762       code |= 4;
45763     else if (p2[1] > bbox2[3])
45764       code |= 8;
45765     return code;
45766   }
45767
45768   // node_modules/@turf/bbox-clip/dist/es/index.js
45769   function bboxClip(feature3, bbox2) {
45770     var geom = getGeom(feature3);
45771     var type2 = geom.type;
45772     var properties = feature3.type === "Feature" ? feature3.properties : {};
45773     var coords = geom.coordinates;
45774     switch (type2) {
45775       case "LineString":
45776       case "MultiLineString": {
45777         var lines_1 = [];
45778         if (type2 === "LineString") {
45779           coords = [coords];
45780         }
45781         coords.forEach(function(line) {
45782           lineclip(line, bbox2, lines_1);
45783         });
45784         if (lines_1.length === 1) {
45785           return lineString(lines_1[0], properties);
45786         }
45787         return multiLineString(lines_1, properties);
45788       }
45789       case "Polygon":
45790         return polygon(clipPolygon(coords, bbox2), properties);
45791       case "MultiPolygon":
45792         return multiPolygon(coords.map(function(poly) {
45793           return clipPolygon(poly, bbox2);
45794         }), properties);
45795       default:
45796         throw new Error("geometry " + type2 + " not supported");
45797     }
45798   }
45799   function clipPolygon(rings, bbox2) {
45800     var outRings = [];
45801     for (var _i = 0, rings_1 = rings; _i < rings_1.length; _i++) {
45802       var ring = rings_1[_i];
45803       var clipped = polygonclip(ring, bbox2);
45804       if (clipped.length > 0) {
45805         if (clipped[0][0] !== clipped[clipped.length - 1][0] || clipped[0][1] !== clipped[clipped.length - 1][1]) {
45806           clipped.push(clipped[0]);
45807         }
45808         if (clipped.length >= 4) {
45809           outRings.push(clipped);
45810         }
45811       }
45812     }
45813     return outRings;
45814   }
45815
45816   // node_modules/@turf/meta/dist/es/index.js
45817   function coordEach(geojson, callback, excludeWrapCoord) {
45818     if (geojson === null)
45819       return;
45820     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;
45821     for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
45822       geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
45823       isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
45824       stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
45825       for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
45826         var multiFeatureIndex = 0;
45827         var geometryIndex = 0;
45828         geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
45829         if (geometry === null)
45830           continue;
45831         coords = geometry.coordinates;
45832         var geomType = geometry.type;
45833         wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
45834         switch (geomType) {
45835           case null:
45836             break;
45837           case "Point":
45838             if (callback(
45839               coords,
45840               coordIndex,
45841               featureIndex,
45842               multiFeatureIndex,
45843               geometryIndex
45844             ) === false)
45845               return false;
45846             coordIndex++;
45847             multiFeatureIndex++;
45848             break;
45849           case "LineString":
45850           case "MultiPoint":
45851             for (j3 = 0; j3 < coords.length; j3++) {
45852               if (callback(
45853                 coords[j3],
45854                 coordIndex,
45855                 featureIndex,
45856                 multiFeatureIndex,
45857                 geometryIndex
45858               ) === false)
45859                 return false;
45860               coordIndex++;
45861               if (geomType === "MultiPoint")
45862                 multiFeatureIndex++;
45863             }
45864             if (geomType === "LineString")
45865               multiFeatureIndex++;
45866             break;
45867           case "Polygon":
45868           case "MultiLineString":
45869             for (j3 = 0; j3 < coords.length; j3++) {
45870               for (k2 = 0; k2 < coords[j3].length - wrapShrink; k2++) {
45871                 if (callback(
45872                   coords[j3][k2],
45873                   coordIndex,
45874                   featureIndex,
45875                   multiFeatureIndex,
45876                   geometryIndex
45877                 ) === false)
45878                   return false;
45879                 coordIndex++;
45880               }
45881               if (geomType === "MultiLineString")
45882                 multiFeatureIndex++;
45883               if (geomType === "Polygon")
45884                 geometryIndex++;
45885             }
45886             if (geomType === "Polygon")
45887               multiFeatureIndex++;
45888             break;
45889           case "MultiPolygon":
45890             for (j3 = 0; j3 < coords.length; j3++) {
45891               geometryIndex = 0;
45892               for (k2 = 0; k2 < coords[j3].length; k2++) {
45893                 for (l2 = 0; l2 < coords[j3][k2].length - wrapShrink; l2++) {
45894                   if (callback(
45895                     coords[j3][k2][l2],
45896                     coordIndex,
45897                     featureIndex,
45898                     multiFeatureIndex,
45899                     geometryIndex
45900                   ) === false)
45901                     return false;
45902                   coordIndex++;
45903                 }
45904                 geometryIndex++;
45905               }
45906               multiFeatureIndex++;
45907             }
45908             break;
45909           case "GeometryCollection":
45910             for (j3 = 0; j3 < geometry.geometries.length; j3++)
45911               if (coordEach(geometry.geometries[j3], callback, excludeWrapCoord) === false)
45912                 return false;
45913             break;
45914           default:
45915             throw new Error("Unknown Geometry Type");
45916         }
45917       }
45918     }
45919   }
45920
45921   // node_modules/@turf/bbox/dist/es/index.js
45922   function bbox(geojson) {
45923     var result = [Infinity, Infinity, -Infinity, -Infinity];
45924     coordEach(geojson, function(coord2) {
45925       if (result[0] > coord2[0]) {
45926         result[0] = coord2[0];
45927       }
45928       if (result[1] > coord2[1]) {
45929         result[1] = coord2[1];
45930       }
45931       if (result[2] < coord2[0]) {
45932         result[2] = coord2[0];
45933       }
45934       if (result[3] < coord2[1]) {
45935         result[3] = coord2[1];
45936       }
45937     });
45938     return result;
45939   }
45940   bbox["default"] = bbox;
45941   var es_default = bbox;
45942
45943   // modules/renderer/background.js
45944   var import_which_polygon3 = __toESM(require_which_polygon());
45945
45946   // modules/renderer/tile_layer.js
45947   function rendererTileLayer(context) {
45948     var transformProp = utilPrefixCSSProperty("Transform");
45949     var tiler9 = utilTiler();
45950     var _tileSize = 256;
45951     var _projection;
45952     var _cache4 = {};
45953     var _tileOrigin;
45954     var _zoom;
45955     var _source;
45956     function tileSizeAtZoom(d2, z2) {
45957       var EPSILON = 2e-3;
45958       return _tileSize * Math.pow(2, z2 - d2[2]) / _tileSize + EPSILON;
45959     }
45960     function atZoom(t2, distance) {
45961       var power = Math.pow(2, distance);
45962       return [
45963         Math.floor(t2[0] * power),
45964         Math.floor(t2[1] * power),
45965         t2[2] + distance
45966       ];
45967     }
45968     function lookUp(d2) {
45969       for (var up = -1; up > -d2[2]; up--) {
45970         var tile = atZoom(d2, up);
45971         if (_cache4[_source.url(tile)] !== false) {
45972           return tile;
45973         }
45974       }
45975     }
45976     function uniqueBy(a2, n3) {
45977       var o2 = [];
45978       var seen = {};
45979       for (var i3 = 0; i3 < a2.length; i3++) {
45980         if (seen[a2[i3][n3]] === void 0) {
45981           o2.push(a2[i3]);
45982           seen[a2[i3][n3]] = true;
45983         }
45984       }
45985       return o2;
45986     }
45987     function addSource(d2) {
45988       d2.push(_source.url(d2));
45989       return d2;
45990     }
45991     function background(selection2) {
45992       _zoom = geoScaleToZoom(_projection.scale(), _tileSize);
45993       var pixelOffset;
45994       if (_source) {
45995         pixelOffset = [
45996           _source.offset()[0] * Math.pow(2, _zoom),
45997           _source.offset()[1] * Math.pow(2, _zoom)
45998         ];
45999       } else {
46000         pixelOffset = [0, 0];
46001       }
46002       var translate = [
46003         _projection.translate()[0] + pixelOffset[0],
46004         _projection.translate()[1] + pixelOffset[1]
46005       ];
46006       tiler9.scale(_projection.scale() * 2 * Math.PI).translate(translate);
46007       _tileOrigin = [
46008         _projection.scale() * Math.PI - translate[0],
46009         _projection.scale() * Math.PI - translate[1]
46010       ];
46011       render(selection2);
46012     }
46013     function render(selection2) {
46014       if (!_source)
46015         return;
46016       var requests = [];
46017       var showDebug = context.getDebug("tile") && !_source.overlay;
46018       if (_source.validZoom(_zoom)) {
46019         tiler9.skipNullIsland(!!_source.overlay);
46020         tiler9().forEach(function(d2) {
46021           addSource(d2);
46022           if (d2[3] === "")
46023             return;
46024           if (typeof d2[3] !== "string")
46025             return;
46026           requests.push(d2);
46027           if (_cache4[d2[3]] === false && lookUp(d2)) {
46028             requests.push(addSource(lookUp(d2)));
46029           }
46030         });
46031         requests = uniqueBy(requests, 3).filter(function(r2) {
46032           return _cache4[r2[3]] !== false;
46033         });
46034       }
46035       function load(d3_event, d2) {
46036         _cache4[d2[3]] = true;
46037         select_default2(this).on("error", null).on("load", null).classed("tile-loaded", true);
46038         render(selection2);
46039       }
46040       function error(d3_event, d2) {
46041         _cache4[d2[3]] = false;
46042         select_default2(this).on("error", null).on("load", null).remove();
46043         render(selection2);
46044       }
46045       function imageTransform(d2) {
46046         var ts = _tileSize * Math.pow(2, _zoom - d2[2]);
46047         var scale = tileSizeAtZoom(d2, _zoom);
46048         return "translate(" + (d2[0] * ts - _tileOrigin[0]) + "px," + (d2[1] * ts - _tileOrigin[1]) + "px) scale(" + scale + "," + scale + ")";
46049       }
46050       function tileCenter(d2) {
46051         var ts = _tileSize * Math.pow(2, _zoom - d2[2]);
46052         return [
46053           d2[0] * ts - _tileOrigin[0] + ts / 2,
46054           d2[1] * ts - _tileOrigin[1] + ts / 2
46055         ];
46056       }
46057       function debugTransform(d2) {
46058         var coord2 = tileCenter(d2);
46059         return "translate(" + coord2[0] + "px," + coord2[1] + "px)";
46060       }
46061       var dims = tiler9.size();
46062       var mapCenter = [dims[0] / 2, dims[1] / 2];
46063       var minDist = Math.max(dims[0], dims[1]);
46064       var nearCenter;
46065       requests.forEach(function(d2) {
46066         var c2 = tileCenter(d2);
46067         var dist = geoVecLength(c2, mapCenter);
46068         if (dist < minDist) {
46069           minDist = dist;
46070           nearCenter = d2;
46071         }
46072       });
46073       var image = selection2.selectAll("img").data(requests, function(d2) {
46074         return d2[3];
46075       });
46076       image.exit().style(transformProp, imageTransform).classed("tile-removing", true).classed("tile-center", false).each(function() {
46077         var tile = select_default2(this);
46078         window.setTimeout(function() {
46079           if (tile.classed("tile-removing")) {
46080             tile.remove();
46081           }
46082         }, 300);
46083       });
46084       image.enter().append("img").attr("class", "tile").attr("alt", "").attr("draggable", "false").style("width", _tileSize + "px").style("height", _tileSize + "px").attr("src", function(d2) {
46085         return d2[3];
46086       }).on("error", error).on("load", load).merge(image).style(transformProp, imageTransform).classed("tile-debug", showDebug).classed("tile-removing", false).classed("tile-center", function(d2) {
46087         return d2 === nearCenter;
46088       });
46089       var debug2 = selection2.selectAll(".tile-label-debug").data(showDebug ? requests : [], function(d2) {
46090         return d2[3];
46091       });
46092       debug2.exit().remove();
46093       if (showDebug) {
46094         var debugEnter = debug2.enter().append("div").attr("class", "tile-label-debug");
46095         debugEnter.append("div").attr("class", "tile-label-debug-coord");
46096         debugEnter.append("div").attr("class", "tile-label-debug-vintage");
46097         debug2 = debug2.merge(debugEnter);
46098         debug2.style(transformProp, debugTransform);
46099         debug2.selectAll(".tile-label-debug-coord").text(function(d2) {
46100           return d2[2] + " / " + d2[0] + " / " + d2[1];
46101         });
46102         debug2.selectAll(".tile-label-debug-vintage").each(function(d2) {
46103           var span = select_default2(this);
46104           var center = context.projection.invert(tileCenter(d2));
46105           _source.getMetadata(center, d2, function(err, result) {
46106             if (result && result.vintage && result.vintage.range) {
46107               span.text(result.vintage.range);
46108             } else {
46109               span.text("");
46110               span.call(_t.append("info_panels.background.vintage"));
46111               span.append("span").text(": ");
46112               span.call(_t.append("info_panels.background.unknown"));
46113             }
46114           });
46115         });
46116       }
46117     }
46118     background.projection = function(val) {
46119       if (!arguments.length)
46120         return _projection;
46121       _projection = val;
46122       return background;
46123     };
46124     background.dimensions = function(val) {
46125       if (!arguments.length)
46126         return tiler9.size();
46127       tiler9.size(val);
46128       return background;
46129     };
46130     background.source = function(val) {
46131       if (!arguments.length)
46132         return _source;
46133       _source = val;
46134       _tileSize = _source.tileSize;
46135       _cache4 = {};
46136       tiler9.tileSize(_source.tileSize).zoomExtent(_source.zoomExtent);
46137       return background;
46138     };
46139     return background;
46140   }
46141
46142   // modules/renderer/background.js
46143   var _imageryIndex = null;
46144   function rendererBackground(context) {
46145     const dispatch14 = dispatch_default("change");
46146     const baseLayer = rendererTileLayer(context).projection(context.projection);
46147     let _checkedBlocklists = [];
46148     let _isValid = true;
46149     let _overlayLayers = [];
46150     let _brightness = 1;
46151     let _contrast = 1;
46152     let _saturation = 1;
46153     let _sharpness = 1;
46154     function ensureImageryIndex() {
46155       return _mainFileFetcher.get("imagery").then((sources) => {
46156         if (_imageryIndex)
46157           return _imageryIndex;
46158         _imageryIndex = {
46159           imagery: sources,
46160           features: {}
46161         };
46162         const features = sources.map((source) => {
46163           if (!source.polygon)
46164             return null;
46165           const rings = source.polygon.map((ring) => [ring]);
46166           const feature3 = {
46167             type: "Feature",
46168             properties: { id: source.id },
46169             geometry: { type: "MultiPolygon", coordinates: rings }
46170           };
46171           _imageryIndex.features[source.id] = feature3;
46172           return feature3;
46173         }).filter(Boolean);
46174         _imageryIndex.query = (0, import_which_polygon3.default)({ type: "FeatureCollection", features });
46175         _imageryIndex.backgrounds = sources.map((source) => {
46176           if (source.type === "bing") {
46177             return rendererBackgroundSource.Bing(source, dispatch14);
46178           } else if (/^EsriWorldImagery/.test(source.id)) {
46179             return rendererBackgroundSource.Esri(source);
46180           } else {
46181             return rendererBackgroundSource(source);
46182           }
46183         });
46184         _imageryIndex.backgrounds.unshift(rendererBackgroundSource.None());
46185         let template = corePreferences("background-custom-template") || "";
46186         const custom = rendererBackgroundSource.Custom(template);
46187         _imageryIndex.backgrounds.unshift(custom);
46188         return _imageryIndex;
46189       });
46190     }
46191     function background(selection2) {
46192       const currSource = baseLayer.source();
46193       if (context.map().zoom() > 18) {
46194         if (currSource && /^EsriWorldImagery/.test(currSource.id)) {
46195           const center = context.map().center();
46196           currSource.fetchTilemap(center);
46197         }
46198       }
46199       const sources = background.sources(context.map().extent());
46200       const wasValid = _isValid;
46201       _isValid = !!sources.filter((d2) => d2 === currSource).length;
46202       if (wasValid !== _isValid) {
46203         background.updateImagery();
46204       }
46205       let baseFilter = "";
46206       if (_brightness !== 1) {
46207         baseFilter += ` brightness(${_brightness})`;
46208       }
46209       if (_contrast !== 1) {
46210         baseFilter += ` contrast(${_contrast})`;
46211       }
46212       if (_saturation !== 1) {
46213         baseFilter += ` saturate(${_saturation})`;
46214       }
46215       if (_sharpness < 1) {
46216         const blur = number_default(0.5, 5)(1 - _sharpness);
46217         baseFilter += ` blur(${blur}px)`;
46218       }
46219       let base = selection2.selectAll(".layer-background").data([0]);
46220       base = base.enter().insert("div", ".layer-data").attr("class", "layer layer-background").merge(base);
46221       base.style("filter", baseFilter || null);
46222       let imagery = base.selectAll(".layer-imagery").data([0]);
46223       imagery.enter().append("div").attr("class", "layer layer-imagery").merge(imagery).call(baseLayer);
46224       let maskFilter = "";
46225       let mixBlendMode = "";
46226       if (_sharpness > 1) {
46227         mixBlendMode = "overlay";
46228         maskFilter = "saturate(0) blur(3px) invert(1)";
46229         let contrast = _sharpness - 1;
46230         maskFilter += ` contrast(${contrast})`;
46231         let brightness = number_default(1, 0.85)(_sharpness - 1);
46232         maskFilter += ` brightness(${brightness})`;
46233       }
46234       let mask = base.selectAll(".layer-unsharp-mask").data(_sharpness > 1 ? [0] : []);
46235       mask.exit().remove();
46236       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);
46237       let overlays = selection2.selectAll(".layer-overlay").data(_overlayLayers, (d2) => d2.source().name());
46238       overlays.exit().remove();
46239       overlays.enter().insert("div", ".layer-data").attr("class", "layer layer-overlay").merge(overlays).each((layer, i3, nodes) => select_default2(nodes[i3]).call(layer));
46240     }
46241     background.updateImagery = function() {
46242       let currSource = baseLayer.source();
46243       if (context.inIntro() || !currSource)
46244         return;
46245       let o2 = _overlayLayers.filter((d2) => !d2.source().isLocatorOverlay() && !d2.source().isHidden()).map((d2) => d2.source().id).join(",");
46246       const meters = geoOffsetToMeters(currSource.offset());
46247       const EPSILON = 0.01;
46248       const x2 = +meters[0].toFixed(2);
46249       const y2 = +meters[1].toFixed(2);
46250       let hash = utilStringQs(window.location.hash);
46251       let id2 = currSource.id;
46252       if (id2 === "custom") {
46253         id2 = `custom:${currSource.template()}`;
46254       }
46255       if (id2) {
46256         hash.background = id2;
46257       } else {
46258         delete hash.background;
46259       }
46260       if (o2) {
46261         hash.overlays = o2;
46262       } else {
46263         delete hash.overlays;
46264       }
46265       if (Math.abs(x2) > EPSILON || Math.abs(y2) > EPSILON) {
46266         hash.offset = `${x2},${y2}`;
46267       } else {
46268         delete hash.offset;
46269       }
46270       if (!window.mocha) {
46271         window.location.replace("#" + utilQsString(hash, true));
46272       }
46273       let imageryUsed = [];
46274       let photoOverlaysUsed = [];
46275       const currUsed = currSource.imageryUsed();
46276       if (currUsed && _isValid) {
46277         imageryUsed.push(currUsed);
46278       }
46279       _overlayLayers.filter((d2) => !d2.source().isLocatorOverlay() && !d2.source().isHidden()).forEach((d2) => imageryUsed.push(d2.source().imageryUsed()));
46280       const dataLayer = context.layers().layer("data");
46281       if (dataLayer && dataLayer.enabled() && dataLayer.hasData()) {
46282         imageryUsed.push(dataLayer.getSrc());
46283       }
46284       const photoOverlayLayers = {
46285         streetside: "Bing Streetside",
46286         mapillary: "Mapillary Images",
46287         "mapillary-map-features": "Mapillary Map Features",
46288         "mapillary-signs": "Mapillary Signs",
46289         kartaview: "KartaView Images",
46290         vegbilder: "Norwegian Road Administration Images",
46291         mapilio: "Mapilio Images"
46292       };
46293       for (let layerID in photoOverlayLayers) {
46294         const layer = context.layers().layer(layerID);
46295         if (layer && layer.enabled()) {
46296           photoOverlaysUsed.push(layerID);
46297           imageryUsed.push(photoOverlayLayers[layerID]);
46298         }
46299       }
46300       context.history().imageryUsed(imageryUsed);
46301       context.history().photoOverlaysUsed(photoOverlaysUsed);
46302     };
46303     background.sources = (extent, zoom, includeCurrent) => {
46304       if (!_imageryIndex)
46305         return [];
46306       let visible = {};
46307       (_imageryIndex.query.bbox(extent.rectangle(), true) || []).forEach((d2) => visible[d2.id] = true);
46308       const currSource = baseLayer.source();
46309       const osm = context.connection();
46310       const blocklists = osm && osm.imageryBlocklists() || [];
46311       const blocklistChanged = blocklists.length !== _checkedBlocklists.length || blocklists.some((regex, index) => String(regex) !== _checkedBlocklists[index]);
46312       if (blocklistChanged) {
46313         _imageryIndex.backgrounds.forEach((source) => {
46314           source.isBlocked = blocklists.some((regex) => regex.test(source.template()));
46315         });
46316         _checkedBlocklists = blocklists.map((regex) => String(regex));
46317       }
46318       return _imageryIndex.backgrounds.filter((source) => {
46319         if (includeCurrent && currSource === source)
46320           return true;
46321         if (source.isBlocked)
46322           return false;
46323         if (!source.polygon)
46324           return true;
46325         if (zoom && zoom < 6)
46326           return false;
46327         return visible[source.id];
46328       });
46329     };
46330     background.dimensions = (val) => {
46331       if (!val)
46332         return;
46333       baseLayer.dimensions(val);
46334       _overlayLayers.forEach((layer) => layer.dimensions(val));
46335     };
46336     background.baseLayerSource = function(d2) {
46337       if (!arguments.length)
46338         return baseLayer.source();
46339       const osm = context.connection();
46340       if (!osm)
46341         return background;
46342       const blocklists = osm.imageryBlocklists();
46343       const template = d2.template();
46344       let fail = false;
46345       let tested = 0;
46346       let regex;
46347       for (let i3 = 0; i3 < blocklists.length; i3++) {
46348         regex = blocklists[i3];
46349         fail = regex.test(template);
46350         tested++;
46351         if (fail)
46352           break;
46353       }
46354       if (!tested) {
46355         regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
46356         fail = regex.test(template);
46357       }
46358       baseLayer.source(!fail ? d2 : background.findSource("none"));
46359       dispatch14.call("change");
46360       background.updateImagery();
46361       return background;
46362     };
46363     background.findSource = (id2) => {
46364       if (!id2 || !_imageryIndex)
46365         return null;
46366       return _imageryIndex.backgrounds.find((d2) => d2.id && d2.id === id2);
46367     };
46368     background.bing = () => {
46369       background.baseLayerSource(background.findSource("Bing"));
46370     };
46371     background.showsLayer = (d2) => {
46372       const currSource = baseLayer.source();
46373       if (!d2 || !currSource)
46374         return false;
46375       return d2.id === currSource.id || _overlayLayers.some((layer) => d2.id === layer.source().id);
46376     };
46377     background.overlayLayerSources = () => {
46378       return _overlayLayers.map((layer) => layer.source());
46379     };
46380     background.toggleOverlayLayer = (d2) => {
46381       let layer;
46382       for (let i3 = 0; i3 < _overlayLayers.length; i3++) {
46383         layer = _overlayLayers[i3];
46384         if (layer.source() === d2) {
46385           _overlayLayers.splice(i3, 1);
46386           dispatch14.call("change");
46387           background.updateImagery();
46388           return;
46389         }
46390       }
46391       layer = rendererTileLayer(context).source(d2).projection(context.projection).dimensions(
46392         baseLayer.dimensions()
46393       );
46394       _overlayLayers.push(layer);
46395       dispatch14.call("change");
46396       background.updateImagery();
46397     };
46398     background.nudge = (d2, zoom) => {
46399       const currSource = baseLayer.source();
46400       if (currSource) {
46401         currSource.nudge(d2, zoom);
46402         dispatch14.call("change");
46403         background.updateImagery();
46404       }
46405       return background;
46406     };
46407     background.offset = function(d2) {
46408       const currSource = baseLayer.source();
46409       if (!arguments.length) {
46410         return currSource && currSource.offset() || [0, 0];
46411       }
46412       if (currSource) {
46413         currSource.offset(d2);
46414         dispatch14.call("change");
46415         background.updateImagery();
46416       }
46417       return background;
46418     };
46419     background.brightness = function(d2) {
46420       if (!arguments.length)
46421         return _brightness;
46422       _brightness = d2;
46423       if (context.mode())
46424         dispatch14.call("change");
46425       return background;
46426     };
46427     background.contrast = function(d2) {
46428       if (!arguments.length)
46429         return _contrast;
46430       _contrast = d2;
46431       if (context.mode())
46432         dispatch14.call("change");
46433       return background;
46434     };
46435     background.saturation = function(d2) {
46436       if (!arguments.length)
46437         return _saturation;
46438       _saturation = d2;
46439       if (context.mode())
46440         dispatch14.call("change");
46441       return background;
46442     };
46443     background.sharpness = function(d2) {
46444       if (!arguments.length)
46445         return _sharpness;
46446       _sharpness = d2;
46447       if (context.mode())
46448         dispatch14.call("change");
46449       return background;
46450     };
46451     let _loadPromise;
46452     background.ensureLoaded = () => {
46453       if (_loadPromise)
46454         return _loadPromise;
46455       return _loadPromise = ensureImageryIndex();
46456     };
46457     background.init = () => {
46458       const loadPromise = background.ensureLoaded();
46459       const hash = utilStringQs(window.location.hash);
46460       const requestedBackground = hash.background || hash.layer;
46461       const lastUsedBackground = corePreferences("background-last-used");
46462       return loadPromise.then((imageryIndex) => {
46463         const extent = context.map().extent();
46464         const validBackgrounds = background.sources(extent).filter((d2) => d2.id !== "none" && d2.id !== "custom");
46465         const first = validBackgrounds.length && validBackgrounds[0];
46466         const isLastUsedValid = !!validBackgrounds.find((d2) => d2.id && d2.id === lastUsedBackground);
46467         let best;
46468         if (!requestedBackground && extent) {
46469           const viewArea = extent.area();
46470           best = validBackgrounds.find((s2) => {
46471             if (!s2.best() || s2.overlay)
46472               return false;
46473             let bbox2 = es_default(bboxClip(
46474               { type: "MultiPolygon", coordinates: [s2.polygon || [extent.polygon()]] },
46475               extent.rectangle()
46476             ));
46477             let area = geoExtent(bbox2.slice(0, 2), bbox2.slice(2, 4)).area();
46478             return area / viewArea > 0.5;
46479           });
46480         }
46481         if (requestedBackground && requestedBackground.indexOf("custom:") === 0) {
46482           const template = requestedBackground.replace(/^custom:/, "");
46483           const custom = background.findSource("custom");
46484           background.baseLayerSource(custom.template(template));
46485           corePreferences("background-custom-template", template);
46486         } else {
46487           background.baseLayerSource(
46488             background.findSource(requestedBackground) || best || isLastUsedValid && background.findSource(lastUsedBackground) || background.findSource("Bing") || first || background.findSource("none")
46489           );
46490         }
46491         const locator = imageryIndex.backgrounds.find((d2) => d2.overlay && d2.default);
46492         if (locator) {
46493           background.toggleOverlayLayer(locator);
46494         }
46495         const overlays = (hash.overlays || "").split(",");
46496         overlays.forEach((overlay) => {
46497           overlay = background.findSource(overlay);
46498           if (overlay) {
46499             background.toggleOverlayLayer(overlay);
46500           }
46501         });
46502         if (hash.gpx) {
46503           const gpx2 = context.layers().layer("data");
46504           if (gpx2) {
46505             gpx2.url(hash.gpx, ".gpx");
46506           }
46507         }
46508         if (hash.offset) {
46509           const offset = hash.offset.replace(/;/g, ",").split(",").map((n3) => !isNaN(n3) && n3);
46510           if (offset.length === 2) {
46511             background.offset(geoMetersToOffset(offset));
46512           }
46513         }
46514       }).catch((err) => {
46515         console.error(err);
46516       });
46517     };
46518     return utilRebind(background, dispatch14, "on");
46519   }
46520
46521   // modules/renderer/features.js
46522   function rendererFeatures(context) {
46523     var dispatch14 = dispatch_default("change", "redraw");
46524     var features = utilRebind({}, dispatch14, "on");
46525     var _deferred2 = /* @__PURE__ */ new Set();
46526     var traffic_roads = {
46527       "motorway": true,
46528       "motorway_link": true,
46529       "trunk": true,
46530       "trunk_link": true,
46531       "primary": true,
46532       "primary_link": true,
46533       "secondary": true,
46534       "secondary_link": true,
46535       "tertiary": true,
46536       "tertiary_link": true,
46537       "residential": true,
46538       "unclassified": true,
46539       "living_street": true,
46540       "busway": true
46541     };
46542     var service_roads = {
46543       "service": true,
46544       "road": true,
46545       "track": true
46546     };
46547     var paths = {
46548       "path": true,
46549       "footway": true,
46550       "cycleway": true,
46551       "bridleway": true,
46552       "steps": true,
46553       "pedestrian": true
46554     };
46555     var _cullFactor = 1;
46556     var _cache4 = {};
46557     var _rules = {};
46558     var _stats = {};
46559     var _keys = [];
46560     var _hidden = [];
46561     var _forceVisible = {};
46562     function update() {
46563       if (!window.mocha) {
46564         var hash = utilStringQs(window.location.hash);
46565         var disabled = features.disabled();
46566         if (disabled.length) {
46567           hash.disable_features = disabled.join(",");
46568         } else {
46569           delete hash.disable_features;
46570         }
46571         window.location.replace("#" + utilQsString(hash, true));
46572         corePreferences("disabled-features", disabled.join(","));
46573       }
46574       _hidden = features.hidden();
46575       dispatch14.call("change");
46576       dispatch14.call("redraw");
46577     }
46578     function defineRule(k2, filter2, max3) {
46579       var isEnabled = true;
46580       _keys.push(k2);
46581       _rules[k2] = {
46582         filter: filter2,
46583         enabled: isEnabled,
46584         // whether the user wants it enabled..
46585         count: 0,
46586         currentMax: max3 || Infinity,
46587         defaultMax: max3 || Infinity,
46588         enable: function() {
46589           this.enabled = true;
46590           this.currentMax = this.defaultMax;
46591         },
46592         disable: function() {
46593           this.enabled = false;
46594           this.currentMax = 0;
46595         },
46596         hidden: function() {
46597           return this.count === 0 && !this.enabled || this.count > this.currentMax * _cullFactor;
46598         },
46599         autoHidden: function() {
46600           return this.hidden() && this.currentMax > 0;
46601         }
46602       };
46603     }
46604     defineRule("points", function isPoint(tags, geometry) {
46605       return geometry === "point";
46606     }, 200);
46607     defineRule("traffic_roads", function isTrafficRoad(tags) {
46608       return traffic_roads[tags.highway];
46609     });
46610     defineRule("service_roads", function isServiceRoad(tags) {
46611       return service_roads[tags.highway];
46612     });
46613     defineRule("paths", function isPath(tags) {
46614       return paths[tags.highway];
46615     });
46616     defineRule("buildings", function isBuilding(tags) {
46617       return !!tags.building && tags.building !== "no" || tags.parking === "multi-storey" || tags.parking === "sheds" || tags.parking === "carports" || tags.parking === "garage_boxes";
46618     }, 250);
46619     defineRule("building_parts", function isBuildingPart(tags) {
46620       return tags["building:part"];
46621     });
46622     defineRule("indoor", function isIndoor(tags) {
46623       return tags.indoor;
46624     });
46625     defineRule("landuse", function isLanduse(tags, geometry) {
46626       return geometry === "area" && !_rules.buildings.filter(tags) && !_rules.building_parts.filter(tags) && !_rules.indoor.filter(tags) && !_rules.water.filter(tags) && !_rules.pistes.filter(tags);
46627     });
46628     defineRule("boundaries", function isBoundary(tags, geometry) {
46629       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);
46630     });
46631     defineRule("water", function isWater(tags) {
46632       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";
46633     });
46634     defineRule("rail", function isRail(tags) {
46635       return (!!tags.railway || tags.landuse === "railway") && !(traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]);
46636     });
46637     defineRule("pistes", function isPiste(tags) {
46638       return tags["piste:type"];
46639     });
46640     defineRule("aerialways", function isPiste(tags) {
46641       return tags.aerialway && tags.aerialway !== "yes" && tags.aerialway !== "station";
46642     });
46643     defineRule("power", function isPower(tags) {
46644       return !!tags.power;
46645     });
46646     defineRule("past_future", function isPastFuture(tags) {
46647       if (traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]) {
46648         return false;
46649       }
46650       var strings = Object.keys(tags);
46651       for (var i3 = 0; i3 < strings.length; i3++) {
46652         var s2 = strings[i3];
46653         if (osmLifecyclePrefixes[s2] || osmLifecyclePrefixes[tags[s2]])
46654           return true;
46655       }
46656       return false;
46657     });
46658     defineRule("others", function isOther(tags, geometry) {
46659       return geometry === "line" || geometry === "area";
46660     });
46661     features.features = function() {
46662       return _rules;
46663     };
46664     features.keys = function() {
46665       return _keys;
46666     };
46667     features.enabled = function(k2) {
46668       if (!arguments.length) {
46669         return _keys.filter(function(k3) {
46670           return _rules[k3].enabled;
46671         });
46672       }
46673       return _rules[k2] && _rules[k2].enabled;
46674     };
46675     features.disabled = function(k2) {
46676       if (!arguments.length) {
46677         return _keys.filter(function(k3) {
46678           return !_rules[k3].enabled;
46679         });
46680       }
46681       return _rules[k2] && !_rules[k2].enabled;
46682     };
46683     features.hidden = function(k2) {
46684       if (!arguments.length) {
46685         return _keys.filter(function(k3) {
46686           return _rules[k3].hidden();
46687         });
46688       }
46689       return _rules[k2] && _rules[k2].hidden();
46690     };
46691     features.autoHidden = function(k2) {
46692       if (!arguments.length) {
46693         return _keys.filter(function(k3) {
46694           return _rules[k3].autoHidden();
46695         });
46696       }
46697       return _rules[k2] && _rules[k2].autoHidden();
46698     };
46699     features.enable = function(k2) {
46700       if (_rules[k2] && !_rules[k2].enabled) {
46701         _rules[k2].enable();
46702         update();
46703       }
46704     };
46705     features.enableAll = function() {
46706       var didEnable = false;
46707       for (var k2 in _rules) {
46708         if (!_rules[k2].enabled) {
46709           didEnable = true;
46710           _rules[k2].enable();
46711         }
46712       }
46713       if (didEnable)
46714         update();
46715     };
46716     features.disable = function(k2) {
46717       if (_rules[k2] && _rules[k2].enabled) {
46718         _rules[k2].disable();
46719         update();
46720       }
46721     };
46722     features.disableAll = function() {
46723       var didDisable = false;
46724       for (var k2 in _rules) {
46725         if (_rules[k2].enabled) {
46726           didDisable = true;
46727           _rules[k2].disable();
46728         }
46729       }
46730       if (didDisable)
46731         update();
46732     };
46733     features.toggle = function(k2) {
46734       if (_rules[k2]) {
46735         (function(f3) {
46736           return f3.enabled ? f3.disable() : f3.enable();
46737         })(_rules[k2]);
46738         update();
46739       }
46740     };
46741     features.resetStats = function() {
46742       for (var i3 = 0; i3 < _keys.length; i3++) {
46743         _rules[_keys[i3]].count = 0;
46744       }
46745       dispatch14.call("change");
46746     };
46747     features.gatherStats = function(d2, resolver, dimensions) {
46748       var needsRedraw = false;
46749       var types = utilArrayGroupBy(d2, "type");
46750       var entities = [].concat(types.relation || [], types.way || [], types.node || []);
46751       var currHidden, geometry, matches, i3, j3;
46752       for (i3 = 0; i3 < _keys.length; i3++) {
46753         _rules[_keys[i3]].count = 0;
46754       }
46755       _cullFactor = dimensions[0] * dimensions[1] / 1e6;
46756       for (i3 = 0; i3 < entities.length; i3++) {
46757         geometry = entities[i3].geometry(resolver);
46758         matches = Object.keys(features.getMatches(entities[i3], resolver, geometry));
46759         for (j3 = 0; j3 < matches.length; j3++) {
46760           _rules[matches[j3]].count++;
46761         }
46762       }
46763       currHidden = features.hidden();
46764       if (currHidden !== _hidden) {
46765         _hidden = currHidden;
46766         needsRedraw = true;
46767         dispatch14.call("change");
46768       }
46769       return needsRedraw;
46770     };
46771     features.stats = function() {
46772       for (var i3 = 0; i3 < _keys.length; i3++) {
46773         _stats[_keys[i3]] = _rules[_keys[i3]].count;
46774       }
46775       return _stats;
46776     };
46777     features.clear = function(d2) {
46778       for (var i3 = 0; i3 < d2.length; i3++) {
46779         features.clearEntity(d2[i3]);
46780       }
46781     };
46782     features.clearEntity = function(entity) {
46783       delete _cache4[osmEntity.key(entity)];
46784     };
46785     features.reset = function() {
46786       Array.from(_deferred2).forEach(function(handle) {
46787         window.cancelIdleCallback(handle);
46788         _deferred2.delete(handle);
46789       });
46790       _cache4 = {};
46791     };
46792     function relationShouldBeChecked(relation) {
46793       return relation.tags.type === "boundary";
46794     }
46795     features.getMatches = function(entity, resolver, geometry) {
46796       if (geometry === "vertex" || geometry === "relation" && !relationShouldBeChecked(entity))
46797         return {};
46798       var ent = osmEntity.key(entity);
46799       if (!_cache4[ent]) {
46800         _cache4[ent] = {};
46801       }
46802       if (!_cache4[ent].matches) {
46803         var matches = {};
46804         var hasMatch = false;
46805         for (var i3 = 0; i3 < _keys.length; i3++) {
46806           if (_keys[i3] === "others") {
46807             if (hasMatch)
46808               continue;
46809             if (entity.type === "way") {
46810               var parents = features.getParents(entity, resolver, geometry);
46811               if (parents.length === 1 && parents[0].isMultipolygon() || // 2b. or belongs only to boundary relations
46812               parents.length > 0 && parents.every(function(parent) {
46813                 return parent.tags.type === "boundary";
46814               })) {
46815                 var pkey = osmEntity.key(parents[0]);
46816                 if (_cache4[pkey] && _cache4[pkey].matches) {
46817                   matches = Object.assign({}, _cache4[pkey].matches);
46818                   continue;
46819                 }
46820               }
46821             }
46822           }
46823           if (_rules[_keys[i3]].filter(entity.tags, geometry)) {
46824             matches[_keys[i3]] = hasMatch = true;
46825           }
46826         }
46827         _cache4[ent].matches = matches;
46828       }
46829       return _cache4[ent].matches;
46830     };
46831     features.getParents = function(entity, resolver, geometry) {
46832       if (geometry === "point")
46833         return [];
46834       var ent = osmEntity.key(entity);
46835       if (!_cache4[ent]) {
46836         _cache4[ent] = {};
46837       }
46838       if (!_cache4[ent].parents) {
46839         var parents = [];
46840         if (geometry === "vertex") {
46841           parents = resolver.parentWays(entity);
46842         } else {
46843           parents = resolver.parentRelations(entity);
46844         }
46845         _cache4[ent].parents = parents;
46846       }
46847       return _cache4[ent].parents;
46848     };
46849     features.isHiddenPreset = function(preset, geometry) {
46850       if (!_hidden.length)
46851         return false;
46852       if (!preset.tags)
46853         return false;
46854       var test = preset.setTags({}, geometry);
46855       for (var key in _rules) {
46856         if (_rules[key].filter(test, geometry)) {
46857           if (_hidden.indexOf(key) !== -1) {
46858             return key;
46859           }
46860           return false;
46861         }
46862       }
46863       return false;
46864     };
46865     features.isHiddenFeature = function(entity, resolver, geometry) {
46866       if (!_hidden.length)
46867         return false;
46868       if (!entity.version)
46869         return false;
46870       if (_forceVisible[entity.id])
46871         return false;
46872       var matches = Object.keys(features.getMatches(entity, resolver, geometry));
46873       return matches.length && matches.every(function(k2) {
46874         return features.hidden(k2);
46875       });
46876     };
46877     features.isHiddenChild = function(entity, resolver, geometry) {
46878       if (!_hidden.length)
46879         return false;
46880       if (!entity.version || geometry === "point")
46881         return false;
46882       if (_forceVisible[entity.id])
46883         return false;
46884       var parents = features.getParents(entity, resolver, geometry);
46885       if (!parents.length)
46886         return false;
46887       for (var i3 = 0; i3 < parents.length; i3++) {
46888         if (!features.isHidden(parents[i3], resolver, parents[i3].geometry(resolver))) {
46889           return false;
46890         }
46891       }
46892       return true;
46893     };
46894     features.hasHiddenConnections = function(entity, resolver) {
46895       if (!_hidden.length)
46896         return false;
46897       var childNodes, connections;
46898       if (entity.type === "midpoint") {
46899         childNodes = [resolver.entity(entity.edge[0]), resolver.entity(entity.edge[1])];
46900         connections = [];
46901       } else {
46902         childNodes = entity.nodes ? resolver.childNodes(entity) : [];
46903         connections = features.getParents(entity, resolver, entity.geometry(resolver));
46904       }
46905       connections = childNodes.reduce(function(result, e3) {
46906         return resolver.isShared(e3) ? utilArrayUnion(result, resolver.parentWays(e3)) : result;
46907       }, connections);
46908       return connections.some(function(e3) {
46909         return features.isHidden(e3, resolver, e3.geometry(resolver));
46910       });
46911     };
46912     features.isHidden = function(entity, resolver, geometry) {
46913       if (!_hidden.length)
46914         return false;
46915       if (!entity.version)
46916         return false;
46917       var fn = geometry === "vertex" ? features.isHiddenChild : features.isHiddenFeature;
46918       return fn(entity, resolver, geometry);
46919     };
46920     features.filter = function(d2, resolver) {
46921       if (!_hidden.length)
46922         return d2;
46923       var result = [];
46924       for (var i3 = 0; i3 < d2.length; i3++) {
46925         var entity = d2[i3];
46926         if (!features.isHidden(entity, resolver, entity.geometry(resolver))) {
46927           result.push(entity);
46928         }
46929       }
46930       return result;
46931     };
46932     features.forceVisible = function(entityIDs) {
46933       if (!arguments.length)
46934         return Object.keys(_forceVisible);
46935       _forceVisible = {};
46936       for (var i3 = 0; i3 < entityIDs.length; i3++) {
46937         _forceVisible[entityIDs[i3]] = true;
46938         var entity = context.hasEntity(entityIDs[i3]);
46939         if (entity && entity.type === "relation") {
46940           for (var j3 in entity.members) {
46941             _forceVisible[entity.members[j3].id] = true;
46942           }
46943         }
46944       }
46945       return features;
46946     };
46947     features.init = function() {
46948       var storage = corePreferences("disabled-features");
46949       if (storage) {
46950         var storageDisabled = storage.replace(/;/g, ",").split(",");
46951         storageDisabled.forEach(features.disable);
46952       }
46953       var hash = utilStringQs(window.location.hash);
46954       if (hash.disable_features) {
46955         var hashDisabled = hash.disable_features.replace(/;/g, ",").split(",");
46956         hashDisabled.forEach(features.disable);
46957       }
46958     };
46959     context.history().on("merge.features", function(newEntities) {
46960       if (!newEntities)
46961         return;
46962       var handle = window.requestIdleCallback(function() {
46963         var graph = context.graph();
46964         var types = utilArrayGroupBy(newEntities, "type");
46965         var entities = [].concat(types.relation || [], types.way || [], types.node || []);
46966         for (var i3 = 0; i3 < entities.length; i3++) {
46967           var geometry = entities[i3].geometry(graph);
46968           features.getMatches(entities[i3], graph, geometry);
46969         }
46970       });
46971       _deferred2.add(handle);
46972     });
46973     return features;
46974   }
46975
46976   // modules/svg/areas.js
46977   var import_fast_deep_equal5 = __toESM(require_fast_deep_equal());
46978
46979   // modules/svg/helpers.js
46980   function svgPassiveVertex(node, graph, activeID) {
46981     if (!activeID)
46982       return 1;
46983     if (activeID === node.id)
46984       return 0;
46985     var parents = graph.parentWays(node);
46986     var i3, j3, nodes, isClosed, ix1, ix2, ix3, ix4, max3;
46987     for (i3 = 0; i3 < parents.length; i3++) {
46988       nodes = parents[i3].nodes;
46989       isClosed = parents[i3].isClosed();
46990       for (j3 = 0; j3 < nodes.length; j3++) {
46991         if (nodes[j3] === node.id) {
46992           ix1 = j3 - 2;
46993           ix2 = j3 - 1;
46994           ix3 = j3 + 1;
46995           ix4 = j3 + 2;
46996           if (isClosed) {
46997             max3 = nodes.length - 1;
46998             if (ix1 < 0)
46999               ix1 = max3 + ix1;
47000             if (ix2 < 0)
47001               ix2 = max3 + ix2;
47002             if (ix3 > max3)
47003               ix3 = ix3 - max3;
47004             if (ix4 > max3)
47005               ix4 = ix4 - max3;
47006           }
47007           if (nodes[ix1] === activeID)
47008             return 0;
47009           else if (nodes[ix2] === activeID)
47010             return 2;
47011           else if (nodes[ix3] === activeID)
47012             return 2;
47013           else if (nodes[ix4] === activeID)
47014             return 0;
47015           else if (isClosed && nodes.indexOf(activeID) !== -1)
47016             return 0;
47017         }
47018       }
47019     }
47020     return 1;
47021   }
47022   function svgMarkerSegments(projection2, graph, dt2, shouldReverse, bothDirections) {
47023     return function(entity) {
47024       var i3 = 0;
47025       var offset = dt2;
47026       var segments = [];
47027       var clip = identity_default2().clipExtent(projection2.clipExtent()).stream;
47028       var coordinates = graph.childNodes(entity).map(function(n3) {
47029         return n3.loc;
47030       });
47031       var a2, b2;
47032       if (shouldReverse(entity)) {
47033         coordinates.reverse();
47034       }
47035       stream_default({
47036         type: "LineString",
47037         coordinates
47038       }, projection2.stream(clip({
47039         lineStart: function() {
47040         },
47041         lineEnd: function() {
47042           a2 = null;
47043         },
47044         point: function(x2, y2) {
47045           b2 = [x2, y2];
47046           if (a2) {
47047             var span = geoVecLength(a2, b2) - offset;
47048             if (span >= 0) {
47049               var heading = geoVecAngle(a2, b2);
47050               var dx = dt2 * Math.cos(heading);
47051               var dy = dt2 * Math.sin(heading);
47052               var p2 = [
47053                 a2[0] + offset * Math.cos(heading),
47054                 a2[1] + offset * Math.sin(heading)
47055               ];
47056               var coord2 = [a2, p2];
47057               for (span -= dt2; span >= 0; span -= dt2) {
47058                 p2 = geoVecAdd(p2, [dx, dy]);
47059                 coord2.push(p2);
47060               }
47061               coord2.push(b2);
47062               var segment = "";
47063               var j3;
47064               for (j3 = 0; j3 < coord2.length; j3++) {
47065                 segment += (j3 === 0 ? "M" : "L") + coord2[j3][0] + "," + coord2[j3][1];
47066               }
47067               segments.push({ id: entity.id, index: i3++, d: segment });
47068               if (bothDirections(entity)) {
47069                 segment = "";
47070                 for (j3 = coord2.length - 1; j3 >= 0; j3--) {
47071                   segment += (j3 === coord2.length - 1 ? "M" : "L") + coord2[j3][0] + "," + coord2[j3][1];
47072                 }
47073                 segments.push({ id: entity.id, index: i3++, d: segment });
47074               }
47075             }
47076             offset = -span;
47077           }
47078           a2 = b2;
47079         }
47080       })));
47081       return segments;
47082     };
47083   }
47084   function svgPath(projection2, graph, isArea) {
47085     var cache = {};
47086     var padding = isArea ? 65 : 5;
47087     var viewport = projection2.clipExtent();
47088     var paddedExtent = [
47089       [viewport[0][0] - padding, viewport[0][1] - padding],
47090       [viewport[1][0] + padding, viewport[1][1] + padding]
47091     ];
47092     var clip = identity_default2().clipExtent(paddedExtent).stream;
47093     var project = projection2.stream;
47094     var path = path_default().projection({ stream: function(output) {
47095       return project(clip(output));
47096     } });
47097     var svgpath = function(entity) {
47098       if (entity.id in cache) {
47099         return cache[entity.id];
47100       } else {
47101         return cache[entity.id] = path(entity.asGeoJSON(graph));
47102       }
47103     };
47104     svgpath.geojson = function(d2) {
47105       if (d2.__featurehash__ !== void 0) {
47106         if (d2.__featurehash__ in cache) {
47107           return cache[d2.__featurehash__];
47108         } else {
47109           return cache[d2.__featurehash__] = path(d2);
47110         }
47111       } else {
47112         return path(d2);
47113       }
47114     };
47115     return svgpath;
47116   }
47117   function svgPointTransform(projection2) {
47118     var svgpoint = function(entity) {
47119       var pt2 = projection2(entity.loc);
47120       return "translate(" + pt2[0] + "," + pt2[1] + ")";
47121     };
47122     svgpoint.geojson = function(d2) {
47123       return svgpoint(d2.properties.entity);
47124     };
47125     return svgpoint;
47126   }
47127   function svgRelationMemberTags(graph) {
47128     return function(entity) {
47129       var tags = entity.tags;
47130       var shouldCopyMultipolygonTags = !entity.hasInterestingTags();
47131       graph.parentRelations(entity).forEach(function(relation) {
47132         var type2 = relation.tags.type;
47133         if (type2 === "multipolygon" && shouldCopyMultipolygonTags || type2 === "boundary") {
47134           tags = Object.assign({}, relation.tags, tags);
47135         }
47136       });
47137       return tags;
47138     };
47139   }
47140   function svgSegmentWay(way, graph, activeID) {
47141     if (activeID === void 0) {
47142       return graph.transient(way, "waySegments", getWaySegments);
47143     } else {
47144       return getWaySegments();
47145     }
47146     function getWaySegments() {
47147       var isActiveWay = way.nodes.indexOf(activeID) !== -1;
47148       var features = { passive: [], active: [] };
47149       var start2 = {};
47150       var end = {};
47151       var node, type2;
47152       for (var i3 = 0; i3 < way.nodes.length; i3++) {
47153         node = graph.entity(way.nodes[i3]);
47154         type2 = svgPassiveVertex(node, graph, activeID);
47155         end = { node, type: type2 };
47156         if (start2.type !== void 0) {
47157           if (start2.node.id === activeID || end.node.id === activeID) {
47158           } else if (isActiveWay && (start2.type === 2 || end.type === 2)) {
47159             pushActive(start2, end, i3);
47160           } else if (start2.type === 0 && end.type === 0) {
47161             pushActive(start2, end, i3);
47162           } else {
47163             pushPassive(start2, end, i3);
47164           }
47165         }
47166         start2 = end;
47167       }
47168       return features;
47169       function pushActive(start3, end2, index) {
47170         features.active.push({
47171           type: "Feature",
47172           id: way.id + "-" + index + "-nope",
47173           properties: {
47174             nope: true,
47175             target: true,
47176             entity: way,
47177             nodes: [start3.node, end2.node],
47178             index
47179           },
47180           geometry: {
47181             type: "LineString",
47182             coordinates: [start3.node.loc, end2.node.loc]
47183           }
47184         });
47185       }
47186       function pushPassive(start3, end2, index) {
47187         features.passive.push({
47188           type: "Feature",
47189           id: way.id + "-" + index,
47190           properties: {
47191             target: true,
47192             entity: way,
47193             nodes: [start3.node, end2.node],
47194             index
47195           },
47196           geometry: {
47197             type: "LineString",
47198             coordinates: [start3.node.loc, end2.node.loc]
47199           }
47200         });
47201       }
47202     }
47203   }
47204
47205   // modules/svg/tag_classes.js
47206   function svgTagClasses() {
47207     var primaries = [
47208       "building",
47209       "highway",
47210       "railway",
47211       "waterway",
47212       "aeroway",
47213       "aerialway",
47214       "piste:type",
47215       "boundary",
47216       "power",
47217       "amenity",
47218       "natural",
47219       "landuse",
47220       "leisure",
47221       "military",
47222       "place",
47223       "man_made",
47224       "route",
47225       "attraction",
47226       "building:part",
47227       "indoor"
47228     ];
47229     var statuses = Object.keys(osmLifecyclePrefixes);
47230     var secondaries = [
47231       "oneway",
47232       "bridge",
47233       "tunnel",
47234       "embankment",
47235       "cutting",
47236       "barrier",
47237       "surface",
47238       "tracktype",
47239       "footway",
47240       "crossing",
47241       "service",
47242       "sport",
47243       "public_transport",
47244       "location",
47245       "parking",
47246       "golf",
47247       "type",
47248       "leisure",
47249       "man_made",
47250       "indoor",
47251       "construction",
47252       "proposed"
47253     ];
47254     var _tags = function(entity) {
47255       return entity.tags;
47256     };
47257     var tagClasses = function(selection2) {
47258       selection2.each(function tagClassesEach(entity) {
47259         var value = this.className;
47260         if (value.baseVal !== void 0) {
47261           value = value.baseVal;
47262         }
47263         var t2 = _tags(entity);
47264         var computed = tagClasses.getClassesString(t2, value);
47265         if (computed !== value) {
47266           select_default2(this).attr("class", computed);
47267         }
47268       });
47269     };
47270     tagClasses.getClassesString = function(t2, value) {
47271       var primary, status;
47272       var i3, j3, k2, v2;
47273       var overrideGeometry;
47274       if (/\bstroke\b/.test(value)) {
47275         if (!!t2.barrier && t2.barrier !== "no") {
47276           overrideGeometry = "line";
47277         }
47278       }
47279       var classes = value.trim().split(/\s+/).filter(function(klass) {
47280         return klass.length && !/^tag-/.test(klass);
47281       }).map(function(klass) {
47282         return klass === "line" || klass === "area" ? overrideGeometry || klass : klass;
47283       });
47284       for (i3 = 0; i3 < primaries.length; i3++) {
47285         k2 = primaries[i3];
47286         v2 = t2[k2];
47287         if (!v2 || v2 === "no")
47288           continue;
47289         if (k2 === "piste:type") {
47290           k2 = "piste";
47291         } else if (k2 === "building:part") {
47292           k2 = "building_part";
47293         }
47294         primary = k2;
47295         if (statuses.indexOf(v2) !== -1) {
47296           status = v2;
47297           classes.push("tag-" + k2);
47298         } else {
47299           classes.push("tag-" + k2);
47300           classes.push("tag-" + k2 + "-" + v2);
47301         }
47302         break;
47303       }
47304       if (!primary) {
47305         for (i3 = 0; i3 < statuses.length; i3++) {
47306           for (j3 = 0; j3 < primaries.length; j3++) {
47307             k2 = statuses[i3] + ":" + primaries[j3];
47308             v2 = t2[k2];
47309             if (!v2 || v2 === "no")
47310               continue;
47311             status = statuses[i3];
47312             break;
47313           }
47314         }
47315       }
47316       if (!status) {
47317         for (i3 = 0; i3 < statuses.length; i3++) {
47318           k2 = statuses[i3];
47319           v2 = t2[k2];
47320           if (!v2 || v2 === "no")
47321             continue;
47322           if (v2 === "yes") {
47323             status = k2;
47324           } else if (primary && primary === v2) {
47325             status = k2;
47326           } else if (!primary && primaries.indexOf(v2) !== -1) {
47327             status = k2;
47328             primary = v2;
47329             classes.push("tag-" + v2);
47330           }
47331           if (status)
47332             break;
47333         }
47334       }
47335       if (status) {
47336         classes.push("tag-status");
47337         classes.push("tag-status-" + status);
47338       }
47339       for (i3 = 0; i3 < secondaries.length; i3++) {
47340         k2 = secondaries[i3];
47341         v2 = t2[k2];
47342         if (!v2 || v2 === "no" || k2 === primary)
47343           continue;
47344         classes.push("tag-" + k2);
47345         classes.push("tag-" + k2 + "-" + v2);
47346       }
47347       if (primary === "highway" && !osmPathHighwayTagValues[t2.highway] || primary === "aeroway") {
47348         var surface = t2.highway === "track" ? "unpaved" : "paved";
47349         for (k2 in t2) {
47350           v2 = t2[k2];
47351           if (k2 in osmPavedTags) {
47352             surface = osmPavedTags[k2][v2] ? "paved" : "unpaved";
47353           }
47354           if (k2 in osmSemipavedTags && !!osmSemipavedTags[k2][v2]) {
47355             surface = "semipaved";
47356           }
47357         }
47358         classes.push("tag-" + surface);
47359       }
47360       var qid = t2.wikidata || t2["flag:wikidata"] || t2["brand:wikidata"] || t2["network:wikidata"] || t2["operator:wikidata"];
47361       if (qid) {
47362         classes.push("tag-wikidata");
47363       }
47364       return classes.filter((klass) => /^[-_a-z0-9]+$/.test(klass)).join(" ").trim();
47365     };
47366     tagClasses.tags = function(val) {
47367       if (!arguments.length)
47368         return _tags;
47369       _tags = val;
47370       return tagClasses;
47371     };
47372     return tagClasses;
47373   }
47374
47375   // modules/svg/tag_pattern.js
47376   var patterns = {
47377     // tag - pattern name
47378     // -or-
47379     // tag - value - pattern name
47380     // -or-
47381     // tag - value - rules (optional tag-values, pattern name)
47382     // (matches earlier rules first, so fallback should be last entry)
47383     amenity: {
47384       grave_yard: "cemetery",
47385       fountain: "water_standing"
47386     },
47387     landuse: {
47388       cemetery: [
47389         { religion: "christian", pattern: "cemetery_christian" },
47390         { religion: "buddhist", pattern: "cemetery_buddhist" },
47391         { religion: "muslim", pattern: "cemetery_muslim" },
47392         { religion: "jewish", pattern: "cemetery_jewish" },
47393         { pattern: "cemetery" }
47394       ],
47395       construction: "construction",
47396       farmland: "farmland",
47397       farmyard: "farmyard",
47398       forest: [
47399         { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
47400         { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
47401         { leaf_type: "leafless", pattern: "forest_leafless" },
47402         { pattern: "forest" }
47403         // same as 'leaf_type:mixed'
47404       ],
47405       grave_yard: "cemetery",
47406       grass: "grass",
47407       landfill: "landfill",
47408       meadow: "meadow",
47409       military: "construction",
47410       orchard: "orchard",
47411       quarry: "quarry",
47412       vineyard: "vineyard"
47413     },
47414     leisure: {
47415       horse_riding: "farmyard"
47416     },
47417     natural: {
47418       beach: "beach",
47419       grassland: "grass",
47420       sand: "beach",
47421       scrub: "scrub",
47422       water: [
47423         { water: "pond", pattern: "pond" },
47424         { water: "reservoir", pattern: "water_standing" },
47425         { pattern: "waves" }
47426       ],
47427       wetland: [
47428         { wetland: "marsh", pattern: "wetland_marsh" },
47429         { wetland: "swamp", pattern: "wetland_swamp" },
47430         { wetland: "bog", pattern: "wetland_bog" },
47431         { wetland: "reedbed", pattern: "wetland_reedbed" },
47432         { pattern: "wetland" }
47433       ],
47434       wood: [
47435         { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
47436         { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
47437         { leaf_type: "leafless", pattern: "forest_leafless" },
47438         { pattern: "forest" }
47439         // same as 'leaf_type:mixed'
47440       ]
47441     },
47442     golf: {
47443       green: "golf_green",
47444       tee: "grass",
47445       fairway: "grass",
47446       rough: "scrub"
47447     },
47448     surface: {
47449       grass: "grass",
47450       sand: "beach"
47451     }
47452   };
47453   function svgTagPattern(tags) {
47454     if (tags.building && tags.building !== "no") {
47455       return null;
47456     }
47457     for (var tag in patterns) {
47458       var entityValue = tags[tag];
47459       if (!entityValue)
47460         continue;
47461       if (typeof patterns[tag] === "string") {
47462         return "pattern-" + patterns[tag];
47463       } else {
47464         var values = patterns[tag];
47465         for (var value in values) {
47466           if (entityValue !== value)
47467             continue;
47468           var rules = values[value];
47469           if (typeof rules === "string") {
47470             return "pattern-" + rules;
47471           }
47472           for (var ruleKey in rules) {
47473             var rule = rules[ruleKey];
47474             var pass = true;
47475             for (var criterion in rule) {
47476               if (criterion !== "pattern") {
47477                 var v2 = tags[criterion];
47478                 if (!v2 || v2 !== rule[criterion]) {
47479                   pass = false;
47480                   break;
47481                 }
47482               }
47483             }
47484             if (pass) {
47485               return "pattern-" + rule.pattern;
47486             }
47487           }
47488         }
47489       }
47490     }
47491     return null;
47492   }
47493
47494   // modules/svg/areas.js
47495   function svgAreas(projection2, context) {
47496     function getPatternStyle(tags) {
47497       var imageID = svgTagPattern(tags);
47498       if (imageID) {
47499         return 'url("#ideditor-' + imageID + '")';
47500       }
47501       return "";
47502     }
47503     function drawTargets(selection2, graph, entities, filter2) {
47504       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
47505       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
47506       var getPath = svgPath(projection2).geojson;
47507       var activeID = context.activeID();
47508       var base = context.history().base();
47509       var data = { targets: [], nopes: [] };
47510       entities.forEach(function(way) {
47511         var features = svgSegmentWay(way, graph, activeID);
47512         data.targets.push.apply(data.targets, features.passive);
47513         data.nopes.push.apply(data.nopes, features.active);
47514       });
47515       var targetData = data.targets.filter(getPath);
47516       var targets = selection2.selectAll(".area.target-allowed").filter(function(d2) {
47517         return filter2(d2.properties.entity);
47518       }).data(targetData, function key(d2) {
47519         return d2.id;
47520       });
47521       targets.exit().remove();
47522       var segmentWasEdited = function(d2) {
47523         var wayID = d2.properties.entity.id;
47524         if (!base.entities[wayID] || !(0, import_fast_deep_equal5.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
47525           return false;
47526         }
47527         return d2.properties.nodes.some(function(n3) {
47528           return !base.entities[n3.id] || !(0, import_fast_deep_equal5.default)(graph.entities[n3.id].loc, base.entities[n3.id].loc);
47529         });
47530       };
47531       targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d2) {
47532         return "way area target target-allowed " + targetClass + d2.id;
47533       }).classed("segment-edited", segmentWasEdited);
47534       var nopeData = data.nopes.filter(getPath);
47535       var nopes = selection2.selectAll(".area.target-nope").filter(function(d2) {
47536         return filter2(d2.properties.entity);
47537       }).data(nopeData, function key(d2) {
47538         return d2.id;
47539       });
47540       nopes.exit().remove();
47541       nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d2) {
47542         return "way area target target-nope " + nopeClass + d2.id;
47543       }).classed("segment-edited", segmentWasEdited);
47544     }
47545     function drawAreas(selection2, graph, entities, filter2) {
47546       var path = svgPath(projection2, graph, true);
47547       var areas = {};
47548       var multipolygon;
47549       var base = context.history().base();
47550       for (var i3 = 0; i3 < entities.length; i3++) {
47551         var entity = entities[i3];
47552         if (entity.geometry(graph) !== "area")
47553           continue;
47554         multipolygon = osmIsOldMultipolygonOuterMember(entity, graph);
47555         if (multipolygon) {
47556           areas[multipolygon.id] = {
47557             entity: multipolygon.mergeTags(entity.tags),
47558             area: Math.abs(entity.area(graph))
47559           };
47560         } else if (!areas[entity.id]) {
47561           areas[entity.id] = {
47562             entity,
47563             area: Math.abs(entity.area(graph))
47564           };
47565         }
47566       }
47567       var fills = Object.values(areas).filter(function hasPath(a2) {
47568         return path(a2.entity);
47569       });
47570       fills.sort(function areaSort(a2, b2) {
47571         return b2.area - a2.area;
47572       });
47573       fills = fills.map(function(a2) {
47574         return a2.entity;
47575       });
47576       var strokes = fills.filter(function(area) {
47577         return area.type === "way";
47578       });
47579       var data = {
47580         clip: fills,
47581         shadow: strokes,
47582         stroke: strokes,
47583         fill: fills
47584       };
47585       var clipPaths = context.surface().selectAll("defs").selectAll(".clipPath-osm").filter(filter2).data(data.clip, osmEntity.key);
47586       clipPaths.exit().remove();
47587       var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-osm").attr("id", function(entity2) {
47588         return "ideditor-" + entity2.id + "-clippath";
47589       });
47590       clipPathsEnter.append("path");
47591       clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", path);
47592       var drawLayer = selection2.selectAll(".layer-osm.areas");
47593       var touchLayer = selection2.selectAll(".layer-touch.areas");
47594       var areagroup = drawLayer.selectAll("g.areagroup").data(["fill", "shadow", "stroke"]);
47595       areagroup = areagroup.enter().append("g").attr("class", function(d2) {
47596         return "areagroup area-" + d2;
47597       }).merge(areagroup);
47598       var paths = areagroup.selectAll("path").filter(filter2).data(function(layer) {
47599         return data[layer];
47600       }, osmEntity.key);
47601       paths.exit().remove();
47602       var fillpaths = selection2.selectAll(".area-fill path.area").nodes();
47603       var bisect = bisector(function(node) {
47604         return -node.__data__.area(graph);
47605       }).left;
47606       function sortedByArea(entity2) {
47607         if (this._parent.__data__ === "fill") {
47608           return fillpaths[bisect(fillpaths, -entity2.area(graph))];
47609         }
47610       }
47611       paths = paths.enter().insert("path", sortedByArea).merge(paths).each(function(entity2) {
47612         var layer = this.parentNode.__data__;
47613         this.setAttribute("class", entity2.type + " area " + layer + " " + entity2.id);
47614         if (layer === "fill") {
47615           this.setAttribute("clip-path", "url(#ideditor-" + entity2.id + "-clippath)");
47616           this.style.fill = this.style.stroke = getPatternStyle(entity2.tags);
47617         }
47618       }).classed("added", function(d2) {
47619         return !base.entities[d2.id];
47620       }).classed("geometry-edited", function(d2) {
47621         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);
47622       }).classed("retagged", function(d2) {
47623         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);
47624       }).call(svgTagClasses()).attr("d", path);
47625       touchLayer.call(drawTargets, graph, data.stroke, filter2);
47626     }
47627     return drawAreas;
47628   }
47629
47630   // modules/svg/data.js
47631   var import_fast_json_stable_stringify = __toESM(require_fast_json_stable_stringify());
47632
47633   // node_modules/@tmcw/togeojson/dist/togeojson.es.mjs
47634   function $(element, tagName) {
47635     return Array.from(element.getElementsByTagName(tagName));
47636   }
47637   function normalizeId(id2) {
47638     return id2[0] === "#" ? id2 : `#${id2}`;
47639   }
47640   function $ns(element, tagName, ns) {
47641     return Array.from(element.getElementsByTagNameNS(ns, tagName));
47642   }
47643   function nodeVal(node) {
47644     node?.normalize();
47645     return node && node.textContent || "";
47646   }
47647   function get1(node, tagName, callback) {
47648     const n3 = node.getElementsByTagName(tagName);
47649     const result = n3.length ? n3[0] : null;
47650     if (result && callback)
47651       callback(result);
47652     return result;
47653   }
47654   function get3(node, tagName, callback) {
47655     const properties = {};
47656     if (!node)
47657       return properties;
47658     const n3 = node.getElementsByTagName(tagName);
47659     const result = n3.length ? n3[0] : null;
47660     if (result && callback) {
47661       return callback(result, properties);
47662     }
47663     return properties;
47664   }
47665   function val1(node, tagName, callback) {
47666     const val = nodeVal(get1(node, tagName));
47667     if (val && callback)
47668       return callback(val) || {};
47669     return {};
47670   }
47671   function $num(node, tagName, callback) {
47672     const val = parseFloat(nodeVal(get1(node, tagName)));
47673     if (isNaN(val))
47674       return void 0;
47675     if (val && callback)
47676       return callback(val) || {};
47677     return {};
47678   }
47679   function num1(node, tagName, callback) {
47680     const val = parseFloat(nodeVal(get1(node, tagName)));
47681     if (isNaN(val))
47682       return void 0;
47683     if (callback)
47684       callback(val);
47685     return val;
47686   }
47687   function getMulti(node, propertyNames) {
47688     const properties = {};
47689     for (const property of propertyNames) {
47690       val1(node, property, (val) => {
47691         properties[property] = val;
47692       });
47693     }
47694     return properties;
47695   }
47696   function isElement(node) {
47697     return node?.nodeType === 1;
47698   }
47699   function getLineStyle(node) {
47700     return get3(node, "line", (lineStyle) => {
47701       const val = Object.assign({}, val1(lineStyle, "color", (color2) => {
47702         return { stroke: `#${color2}` };
47703       }), $num(lineStyle, "opacity", (opacity) => {
47704         return { "stroke-opacity": opacity };
47705       }), $num(lineStyle, "width", (width) => {
47706         return { "stroke-width": width * 96 / 25.4 };
47707       }));
47708       return val;
47709     });
47710   }
47711   function getExtensions(node) {
47712     let values = [];
47713     if (node === null)
47714       return values;
47715     for (const child of Array.from(node.childNodes)) {
47716       if (!isElement(child))
47717         continue;
47718       const name = abbreviateName(child.nodeName);
47719       if (name === "gpxtpx:TrackPointExtension") {
47720         values = values.concat(getExtensions(child));
47721       } else {
47722         const val = nodeVal(child);
47723         values.push([name, parseNumeric(val)]);
47724       }
47725     }
47726     return values;
47727   }
47728   function abbreviateName(name) {
47729     return ["heart", "gpxtpx:hr", "hr"].includes(name) ? "heart" : name;
47730   }
47731   function parseNumeric(val) {
47732     const num = parseFloat(val);
47733     return isNaN(num) ? val : num;
47734   }
47735   function coordPair$1(node) {
47736     const ll = [
47737       parseFloat(node.getAttribute("lon") || ""),
47738       parseFloat(node.getAttribute("lat") || "")
47739     ];
47740     if (isNaN(ll[0]) || isNaN(ll[1])) {
47741       return null;
47742     }
47743     num1(node, "ele", (val) => {
47744       ll.push(val);
47745     });
47746     const time = get1(node, "time");
47747     return {
47748       coordinates: ll,
47749       time: time ? nodeVal(time) : null,
47750       extendedValues: getExtensions(get1(node, "extensions"))
47751     };
47752   }
47753   function extractProperties(node) {
47754     const properties = getMulti(node, [
47755       "name",
47756       "cmt",
47757       "desc",
47758       "type",
47759       "time",
47760       "keywords"
47761     ]);
47762     const extensions = Array.from(node.getElementsByTagNameNS("http://www.garmin.com/xmlschemas/GpxExtensions/v3", "*"));
47763     for (const child of extensions) {
47764       if (child.parentNode?.parentNode === node) {
47765         properties[child.tagName.replace(":", "_")] = nodeVal(child);
47766       }
47767     }
47768     const links = $(node, "link");
47769     if (links.length) {
47770       properties.links = links.map((link2) => Object.assign({ href: link2.getAttribute("href") }, getMulti(link2, ["text", "type"])));
47771     }
47772     return properties;
47773   }
47774   function getPoints$1(node, pointname) {
47775     const pts = $(node, pointname);
47776     const line = [];
47777     const times = [];
47778     const extendedValues = {};
47779     for (let i3 = 0; i3 < pts.length; i3++) {
47780       const c2 = coordPair$1(pts[i3]);
47781       if (!c2) {
47782         continue;
47783       }
47784       line.push(c2.coordinates);
47785       if (c2.time)
47786         times.push(c2.time);
47787       for (const [name, val] of c2.extendedValues) {
47788         const plural = name === "heart" ? name : name.replace("gpxtpx:", "") + "s";
47789         if (!extendedValues[plural]) {
47790           extendedValues[plural] = Array(pts.length).fill(null);
47791         }
47792         extendedValues[plural][i3] = val;
47793       }
47794     }
47795     if (line.length < 2)
47796       return;
47797     return {
47798       line,
47799       times,
47800       extendedValues
47801     };
47802   }
47803   function getRoute(node) {
47804     const line = getPoints$1(node, "rtept");
47805     if (!line)
47806       return;
47807     return {
47808       type: "Feature",
47809       properties: Object.assign({ _gpxType: "rte" }, extractProperties(node), getLineStyle(get1(node, "extensions"))),
47810       geometry: {
47811         type: "LineString",
47812         coordinates: line.line
47813       }
47814     };
47815   }
47816   function getTrack(node) {
47817     const segments = $(node, "trkseg");
47818     const track = [];
47819     const times = [];
47820     const extractedLines = [];
47821     for (const segment of segments) {
47822       const line = getPoints$1(segment, "trkpt");
47823       if (line) {
47824         extractedLines.push(line);
47825         if (line.times && line.times.length)
47826           times.push(line.times);
47827       }
47828     }
47829     if (extractedLines.length === 0)
47830       return null;
47831     const multi = extractedLines.length > 1;
47832     const properties = Object.assign({ _gpxType: "trk" }, extractProperties(node), getLineStyle(get1(node, "extensions")), times.length ? {
47833       coordinateProperties: {
47834         times: multi ? times : times[0]
47835       }
47836     } : {});
47837     for (const line of extractedLines) {
47838       track.push(line.line);
47839       if (!properties.coordinateProperties) {
47840         properties.coordinateProperties = {};
47841       }
47842       const props = properties.coordinateProperties;
47843       const entries = Object.entries(line.extendedValues);
47844       for (let i3 = 0; i3 < entries.length; i3++) {
47845         const [name, val] = entries[i3];
47846         if (multi) {
47847           if (!props[name]) {
47848             props[name] = extractedLines.map((line2) => new Array(line2.line.length).fill(null));
47849           }
47850           props[name][i3] = val;
47851         } else {
47852           props[name] = val;
47853         }
47854       }
47855     }
47856     return {
47857       type: "Feature",
47858       properties,
47859       geometry: multi ? {
47860         type: "MultiLineString",
47861         coordinates: track
47862       } : {
47863         type: "LineString",
47864         coordinates: track[0]
47865       }
47866     };
47867   }
47868   function getPoint(node) {
47869     const properties = Object.assign(extractProperties(node), getMulti(node, ["sym"]));
47870     const pair3 = coordPair$1(node);
47871     if (!pair3)
47872       return null;
47873     return {
47874       type: "Feature",
47875       properties,
47876       geometry: {
47877         type: "Point",
47878         coordinates: pair3.coordinates
47879       }
47880     };
47881   }
47882   function* gpxGen(node) {
47883     for (const track of $(node, "trk")) {
47884       const feature3 = getTrack(track);
47885       if (feature3)
47886         yield feature3;
47887     }
47888     for (const route of $(node, "rte")) {
47889       const feature3 = getRoute(route);
47890       if (feature3)
47891         yield feature3;
47892     }
47893     for (const waypoint of $(node, "wpt")) {
47894       const point2 = getPoint(waypoint);
47895       if (point2)
47896         yield point2;
47897     }
47898   }
47899   function gpx(node) {
47900     return {
47901       type: "FeatureCollection",
47902       features: Array.from(gpxGen(node))
47903     };
47904   }
47905   function fixColor(v2, prefix) {
47906     const properties = {};
47907     const colorProp = prefix == "stroke" || prefix === "fill" ? prefix : prefix + "-color";
47908     if (v2[0] === "#") {
47909       v2 = v2.substring(1);
47910     }
47911     if (v2.length === 6 || v2.length === 3) {
47912       properties[colorProp] = "#" + v2;
47913     } else if (v2.length === 8) {
47914       properties[prefix + "-opacity"] = parseInt(v2.substring(0, 2), 16) / 255;
47915       properties[colorProp] = "#" + v2.substring(6, 8) + v2.substring(4, 6) + v2.substring(2, 4);
47916     }
47917     return properties;
47918   }
47919   function numericProperty(node, source, target) {
47920     const properties = {};
47921     num1(node, source, (val) => {
47922       properties[target] = val;
47923     });
47924     return properties;
47925   }
47926   function getColor(node, output) {
47927     return get3(node, "color", (elem) => fixColor(nodeVal(elem), output));
47928   }
47929   function extractIconHref(node) {
47930     return get3(node, "Icon", (icon2, properties) => {
47931       val1(icon2, "href", (href) => {
47932         properties.icon = href;
47933       });
47934       return properties;
47935     });
47936   }
47937   function extractIcon(node) {
47938     return get3(node, "IconStyle", (iconStyle) => {
47939       return Object.assign(getColor(iconStyle, "icon"), numericProperty(iconStyle, "scale", "icon-scale"), numericProperty(iconStyle, "heading", "icon-heading"), get3(iconStyle, "hotSpot", (hotspot) => {
47940         const left = parseFloat(hotspot.getAttribute("x") || "");
47941         const top = parseFloat(hotspot.getAttribute("y") || "");
47942         const xunits = hotspot.getAttribute("xunits") || "";
47943         const yunits = hotspot.getAttribute("yunits") || "";
47944         if (!isNaN(left) && !isNaN(top))
47945           return {
47946             "icon-offset": [left, top],
47947             "icon-offset-units": [xunits, yunits]
47948           };
47949         return {};
47950       }), extractIconHref(iconStyle));
47951     });
47952   }
47953   function extractLabel(node) {
47954     return get3(node, "LabelStyle", (labelStyle) => {
47955       return Object.assign(getColor(labelStyle, "label"), numericProperty(labelStyle, "scale", "label-scale"));
47956     });
47957   }
47958   function extractLine(node) {
47959     return get3(node, "LineStyle", (lineStyle) => {
47960       return Object.assign(getColor(lineStyle, "stroke"), numericProperty(lineStyle, "width", "stroke-width"));
47961     });
47962   }
47963   function extractPoly(node) {
47964     return get3(node, "PolyStyle", (polyStyle, properties) => {
47965       return Object.assign(properties, get3(polyStyle, "color", (elem) => fixColor(nodeVal(elem), "fill")), val1(polyStyle, "fill", (fill) => {
47966         if (fill === "0")
47967           return { "fill-opacity": 0 };
47968       }), val1(polyStyle, "outline", (outline) => {
47969         if (outline === "0")
47970           return { "stroke-opacity": 0 };
47971       }));
47972     });
47973   }
47974   function extractStyle(node) {
47975     return Object.assign({}, extractPoly(node), extractLine(node), extractLabel(node), extractIcon(node));
47976   }
47977   var toNumber2 = (x2) => Number(x2);
47978   var typeConverters = {
47979     string: (x2) => x2,
47980     int: toNumber2,
47981     uint: toNumber2,
47982     short: toNumber2,
47983     ushort: toNumber2,
47984     float: toNumber2,
47985     double: toNumber2,
47986     bool: (x2) => Boolean(x2)
47987   };
47988   function extractExtendedData(node, schema) {
47989     return get3(node, "ExtendedData", (extendedData, properties) => {
47990       for (const data of $(extendedData, "Data")) {
47991         properties[data.getAttribute("name") || ""] = nodeVal(get1(data, "value"));
47992       }
47993       for (const simpleData of $(extendedData, "SimpleData")) {
47994         const name = simpleData.getAttribute("name") || "";
47995         const typeConverter = schema[name] || typeConverters.string;
47996         properties[name] = typeConverter(nodeVal(simpleData));
47997       }
47998       return properties;
47999     });
48000   }
48001   function getMaybeHTMLDescription(node) {
48002     const descriptionNode = get1(node, "description");
48003     for (const c2 of Array.from(descriptionNode?.childNodes || [])) {
48004       if (c2.nodeType === 4) {
48005         return {
48006           description: {
48007             "@type": "html",
48008             value: nodeVal(c2)
48009           }
48010         };
48011       }
48012     }
48013     return {};
48014   }
48015   function extractTimeSpan(node) {
48016     return get3(node, "TimeSpan", (timeSpan) => {
48017       return {
48018         timespan: {
48019           begin: nodeVal(get1(timeSpan, "begin")),
48020           end: nodeVal(get1(timeSpan, "end"))
48021         }
48022       };
48023     });
48024   }
48025   function extractTimeStamp(node) {
48026     return get3(node, "TimeStamp", (timeStamp) => {
48027       return { timestamp: nodeVal(get1(timeStamp, "when")) };
48028     });
48029   }
48030   function extractCascadedStyle(node, styleMap) {
48031     return val1(node, "styleUrl", (styleUrl) => {
48032       styleUrl = normalizeId(styleUrl);
48033       if (styleMap[styleUrl]) {
48034         return Object.assign({ styleUrl }, styleMap[styleUrl]);
48035       }
48036       return { styleUrl };
48037     });
48038   }
48039   var removeSpace = /\s*/g;
48040   var trimSpace = /^\s*|\s*$/g;
48041   var splitSpace = /\s+/;
48042   function coord1(value) {
48043     return value.replace(removeSpace, "").split(",").map(parseFloat).filter((num) => !isNaN(num)).slice(0, 3);
48044   }
48045   function coord(value) {
48046     return value.replace(trimSpace, "").split(splitSpace).map(coord1).filter((coord2) => {
48047       return coord2.length >= 2;
48048     });
48049   }
48050   function gxCoords(node) {
48051     let elems = $(node, "coord");
48052     if (elems.length === 0) {
48053       elems = $ns(node, "coord", "*");
48054     }
48055     const coordinates = elems.map((elem) => {
48056       return nodeVal(elem).split(" ").map(parseFloat);
48057     });
48058     if (coordinates.length === 0) {
48059       return null;
48060     }
48061     return {
48062       geometry: coordinates.length > 2 ? {
48063         type: "LineString",
48064         coordinates
48065       } : {
48066         type: "Point",
48067         coordinates: coordinates[0]
48068       },
48069       times: $(node, "when").map((elem) => nodeVal(elem))
48070     };
48071   }
48072   function fixRing(ring) {
48073     if (ring.length === 0)
48074       return ring;
48075     const first = ring[0];
48076     const last = ring[ring.length - 1];
48077     let equal = true;
48078     for (let i3 = 0; i3 < Math.max(first.length, last.length); i3++) {
48079       if (first[i3] !== last[i3]) {
48080         equal = false;
48081         break;
48082       }
48083     }
48084     if (!equal) {
48085       return ring.concat([ring[0]]);
48086     }
48087     return ring;
48088   }
48089   function getCoordinates(node) {
48090     return nodeVal(get1(node, "coordinates"));
48091   }
48092   function getGeometry(node) {
48093     let geometries = [];
48094     let coordTimes = [];
48095     for (let i3 = 0; i3 < node.childNodes.length; i3++) {
48096       const child = node.childNodes.item(i3);
48097       if (isElement(child)) {
48098         switch (child.tagName) {
48099           case "MultiGeometry":
48100           case "MultiTrack":
48101           case "gx:MultiTrack": {
48102             const childGeometries = getGeometry(child);
48103             geometries = geometries.concat(childGeometries.geometries);
48104             coordTimes = coordTimes.concat(childGeometries.coordTimes);
48105             break;
48106           }
48107           case "Point": {
48108             const coordinates = coord1(getCoordinates(child));
48109             if (coordinates.length >= 2) {
48110               geometries.push({
48111                 type: "Point",
48112                 coordinates
48113               });
48114             }
48115             break;
48116           }
48117           case "LinearRing":
48118           case "LineString": {
48119             const coordinates = coord(getCoordinates(child));
48120             if (coordinates.length >= 2) {
48121               geometries.push({
48122                 type: "LineString",
48123                 coordinates
48124               });
48125             }
48126             break;
48127           }
48128           case "Polygon": {
48129             const coords = [];
48130             for (const linearRing of $(child, "LinearRing")) {
48131               const ring = fixRing(coord(getCoordinates(linearRing)));
48132               if (ring.length >= 4) {
48133                 coords.push(ring);
48134               }
48135             }
48136             if (coords.length) {
48137               geometries.push({
48138                 type: "Polygon",
48139                 coordinates: coords
48140               });
48141             }
48142             break;
48143           }
48144           case "Track":
48145           case "gx:Track": {
48146             const gx = gxCoords(child);
48147             if (!gx)
48148               break;
48149             const { times, geometry } = gx;
48150             geometries.push(geometry);
48151             if (times.length)
48152               coordTimes.push(times);
48153             break;
48154           }
48155         }
48156       }
48157     }
48158     return {
48159       geometries,
48160       coordTimes
48161     };
48162   }
48163   function geometryListToGeometry(geometries) {
48164     return geometries.length === 0 ? null : geometries.length === 1 ? geometries[0] : {
48165       type: "GeometryCollection",
48166       geometries
48167     };
48168   }
48169   function getPlacemark(node, styleMap, schema, options2) {
48170     const { coordTimes, geometries } = getGeometry(node);
48171     const geometry = geometryListToGeometry(geometries);
48172     if (!geometry && options2.skipNullGeometry) {
48173       return null;
48174     }
48175     const feature3 = {
48176       type: "Feature",
48177       geometry,
48178       properties: Object.assign(getMulti(node, [
48179         "name",
48180         "address",
48181         "visibility",
48182         "open",
48183         "phoneNumber",
48184         "description"
48185       ]), getMaybeHTMLDescription(node), extractCascadedStyle(node, styleMap), extractStyle(node), extractExtendedData(node, schema), extractTimeSpan(node), extractTimeStamp(node), coordTimes.length ? {
48186         coordinateProperties: {
48187           times: coordTimes.length === 1 ? coordTimes[0] : coordTimes
48188         }
48189       } : {})
48190     };
48191     if (feature3.properties?.visibility !== void 0) {
48192       feature3.properties.visibility = feature3.properties.visibility !== "0";
48193     }
48194     const id2 = node.getAttribute("id");
48195     if (id2 !== null && id2 !== "")
48196       feature3.id = id2;
48197     return feature3;
48198   }
48199   function getGroundOverlayBox(node) {
48200     const latLonQuad = get1(node, "gx:LatLonQuad");
48201     if (latLonQuad) {
48202       const ring = fixRing(coord(getCoordinates(node)));
48203       return {
48204         geometry: {
48205           type: "Polygon",
48206           coordinates: [ring]
48207         }
48208       };
48209     }
48210     return getLatLonBox(node);
48211   }
48212   var DEGREES_TO_RADIANS = Math.PI / 180;
48213   function rotateBox(bbox2, coordinates, rotation) {
48214     const center = [(bbox2[0] + bbox2[2]) / 2, (bbox2[1] + bbox2[3]) / 2];
48215     return [
48216       coordinates[0].map((coordinate) => {
48217         const dy = coordinate[1] - center[1];
48218         const dx = coordinate[0] - center[0];
48219         const distance = Math.sqrt(Math.pow(dy, 2) + Math.pow(dx, 2));
48220         const angle2 = Math.atan2(dy, dx) + rotation * DEGREES_TO_RADIANS;
48221         return [
48222           center[0] + Math.cos(angle2) * distance,
48223           center[1] + Math.sin(angle2) * distance
48224         ];
48225       })
48226     ];
48227   }
48228   function getLatLonBox(node) {
48229     const latLonBox = get1(node, "LatLonBox");
48230     if (latLonBox) {
48231       const north = num1(latLonBox, "north");
48232       const west = num1(latLonBox, "west");
48233       const east = num1(latLonBox, "east");
48234       const south = num1(latLonBox, "south");
48235       const rotation = num1(latLonBox, "rotation");
48236       if (typeof north === "number" && typeof south === "number" && typeof west === "number" && typeof east === "number") {
48237         const bbox2 = [west, south, east, north];
48238         let coordinates = [
48239           [
48240             [west, north],
48241             [east, north],
48242             [east, south],
48243             [west, south],
48244             [west, north]
48245             // top left (again)
48246           ]
48247         ];
48248         if (typeof rotation === "number") {
48249           coordinates = rotateBox(bbox2, coordinates, rotation);
48250         }
48251         return {
48252           bbox: bbox2,
48253           geometry: {
48254             type: "Polygon",
48255             coordinates
48256           }
48257         };
48258       }
48259     }
48260     return null;
48261   }
48262   function getGroundOverlay(node, styleMap, schema, options2) {
48263     const box = getGroundOverlayBox(node);
48264     const geometry = box?.geometry || null;
48265     if (!geometry && options2.skipNullGeometry) {
48266       return null;
48267     }
48268     const feature3 = {
48269       type: "Feature",
48270       geometry,
48271       properties: Object.assign(
48272         /**
48273          * Related to
48274          * https://gist.github.com/tmcw/037a1cb6660d74a392e9da7446540f46
48275          */
48276         { "@geometry-type": "groundoverlay" },
48277         getMulti(node, [
48278           "name",
48279           "address",
48280           "visibility",
48281           "open",
48282           "phoneNumber",
48283           "description"
48284         ]),
48285         getMaybeHTMLDescription(node),
48286         extractCascadedStyle(node, styleMap),
48287         extractStyle(node),
48288         extractIconHref(node),
48289         extractExtendedData(node, schema),
48290         extractTimeSpan(node),
48291         extractTimeStamp(node)
48292       )
48293     };
48294     if (box?.bbox) {
48295       feature3.bbox = box.bbox;
48296     }
48297     if (feature3.properties?.visibility !== void 0) {
48298       feature3.properties.visibility = feature3.properties.visibility !== "0";
48299     }
48300     const id2 = node.getAttribute("id");
48301     if (id2 !== null && id2 !== "")
48302       feature3.id = id2;
48303     return feature3;
48304   }
48305   function getStyleId(style) {
48306     let id2 = style.getAttribute("id");
48307     const parentNode = style.parentNode;
48308     if (!id2 && isElement(parentNode) && parentNode.localName === "CascadingStyle") {
48309       id2 = parentNode.getAttribute("kml:id") || parentNode.getAttribute("id");
48310     }
48311     return normalizeId(id2 || "");
48312   }
48313   function buildStyleMap(node) {
48314     const styleMap = {};
48315     for (const style of $(node, "Style")) {
48316       styleMap[getStyleId(style)] = extractStyle(style);
48317     }
48318     for (const map2 of $(node, "StyleMap")) {
48319       const id2 = normalizeId(map2.getAttribute("id") || "");
48320       val1(map2, "styleUrl", (styleUrl) => {
48321         styleUrl = normalizeId(styleUrl);
48322         if (styleMap[styleUrl]) {
48323           styleMap[id2] = styleMap[styleUrl];
48324         }
48325       });
48326     }
48327     return styleMap;
48328   }
48329   function buildSchema(node) {
48330     const schema = {};
48331     for (const field of $(node, "SimpleField")) {
48332       schema[field.getAttribute("name") || ""] = typeConverters[field.getAttribute("type") || ""] || typeConverters["string"];
48333     }
48334     return schema;
48335   }
48336   function* kmlGen(node, options2 = {
48337     skipNullGeometry: false
48338   }) {
48339     const styleMap = buildStyleMap(node);
48340     const schema = buildSchema(node);
48341     for (const placemark of $(node, "Placemark")) {
48342       const feature3 = getPlacemark(placemark, styleMap, schema, options2);
48343       if (feature3)
48344         yield feature3;
48345     }
48346     for (const groundOverlay of $(node, "GroundOverlay")) {
48347       const feature3 = getGroundOverlay(groundOverlay, styleMap, schema, options2);
48348       if (feature3)
48349         yield feature3;
48350     }
48351   }
48352   function kml(node, options2 = {
48353     skipNullGeometry: false
48354   }) {
48355     return {
48356       type: "FeatureCollection",
48357       features: Array.from(kmlGen(node, options2))
48358     };
48359   }
48360
48361   // modules/svg/data.js
48362   var _initialized = false;
48363   var _enabled = false;
48364   var _geojson;
48365   function svgData(projection2, context, dispatch14) {
48366     var throttledRedraw = throttle_default(function() {
48367       dispatch14.call("change");
48368     }, 1e3);
48369     var _showLabels = true;
48370     var detected = utilDetect();
48371     var layer = select_default2(null);
48372     var _vtService;
48373     var _fileList;
48374     var _template;
48375     var _src;
48376     const supportedFormats = [
48377       ".gpx",
48378       ".kml",
48379       ".geojson",
48380       ".json"
48381     ];
48382     function init2() {
48383       if (_initialized)
48384         return;
48385       _geojson = {};
48386       _enabled = true;
48387       function over(d3_event) {
48388         d3_event.stopPropagation();
48389         d3_event.preventDefault();
48390         d3_event.dataTransfer.dropEffect = "copy";
48391       }
48392       context.container().attr("dropzone", "copy").on("drop.svgData", function(d3_event) {
48393         d3_event.stopPropagation();
48394         d3_event.preventDefault();
48395         if (!detected.filedrop)
48396           return;
48397         var f3 = d3_event.dataTransfer.files[0];
48398         var extension = getExtension(f3.name);
48399         if (!supportedFormats.includes(extension))
48400           return;
48401         drawData.fileList(d3_event.dataTransfer.files);
48402       }).on("dragenter.svgData", over).on("dragexit.svgData", over).on("dragover.svgData", over);
48403       _initialized = true;
48404     }
48405     function getService() {
48406       if (services.vectorTile && !_vtService) {
48407         _vtService = services.vectorTile;
48408         _vtService.event.on("loadedData", throttledRedraw);
48409       } else if (!services.vectorTile && _vtService) {
48410         _vtService = null;
48411       }
48412       return _vtService;
48413     }
48414     function showLayer() {
48415       layerOn();
48416       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
48417         dispatch14.call("change");
48418       });
48419     }
48420     function hideLayer() {
48421       throttledRedraw.cancel();
48422       layer.transition().duration(250).style("opacity", 0).on("end", layerOff);
48423     }
48424     function layerOn() {
48425       layer.style("display", "block");
48426     }
48427     function layerOff() {
48428       layer.selectAll(".viewfield-group").remove();
48429       layer.style("display", "none");
48430     }
48431     function ensureIDs(gj) {
48432       if (!gj)
48433         return null;
48434       if (gj.type === "FeatureCollection") {
48435         for (var i3 = 0; i3 < gj.features.length; i3++) {
48436           ensureFeatureID(gj.features[i3]);
48437         }
48438       } else {
48439         ensureFeatureID(gj);
48440       }
48441       return gj;
48442     }
48443     function ensureFeatureID(feature3) {
48444       if (!feature3)
48445         return;
48446       feature3.__featurehash__ = utilHashcode((0, import_fast_json_stable_stringify.default)(feature3));
48447       return feature3;
48448     }
48449     function getFeatures(gj) {
48450       if (!gj)
48451         return [];
48452       if (gj.type === "FeatureCollection") {
48453         return gj.features;
48454       } else {
48455         return [gj];
48456       }
48457     }
48458     function featureKey(d2) {
48459       return d2.__featurehash__;
48460     }
48461     function isPolygon(d2) {
48462       return d2.geometry.type === "Polygon" || d2.geometry.type === "MultiPolygon";
48463     }
48464     function clipPathID(d2) {
48465       return "ideditor-data-" + d2.__featurehash__ + "-clippath";
48466     }
48467     function featureClasses(d2) {
48468       return [
48469         "data" + d2.__featurehash__,
48470         d2.geometry.type,
48471         isPolygon(d2) ? "area" : "",
48472         d2.__layerID__ || ""
48473       ].filter(Boolean).join(" ");
48474     }
48475     function drawData(selection2) {
48476       var vtService = getService();
48477       var getPath = svgPath(projection2).geojson;
48478       var getAreaPath = svgPath(projection2, null, true).geojson;
48479       var hasData = drawData.hasData();
48480       layer = selection2.selectAll(".layer-mapdata").data(_enabled && hasData ? [0] : []);
48481       layer.exit().remove();
48482       layer = layer.enter().append("g").attr("class", "layer-mapdata").merge(layer);
48483       var surface = context.surface();
48484       if (!surface || surface.empty())
48485         return;
48486       var geoData, polygonData;
48487       if (_template && vtService) {
48488         var sourceID = _template;
48489         vtService.loadTiles(sourceID, _template, projection2);
48490         geoData = vtService.data(sourceID, projection2);
48491       } else {
48492         geoData = getFeatures(_geojson);
48493       }
48494       geoData = geoData.filter(getPath);
48495       polygonData = geoData.filter(isPolygon);
48496       var clipPaths = surface.selectAll("defs").selectAll(".clipPath-data").data(polygonData, featureKey);
48497       clipPaths.exit().remove();
48498       var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-data").attr("id", clipPathID);
48499       clipPathsEnter.append("path");
48500       clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", getAreaPath);
48501       var datagroups = layer.selectAll("g.datagroup").data(["fill", "shadow", "stroke"]);
48502       datagroups = datagroups.enter().append("g").attr("class", function(d2) {
48503         return "datagroup datagroup-" + d2;
48504       }).merge(datagroups);
48505       var pathData = {
48506         fill: polygonData,
48507         shadow: geoData,
48508         stroke: geoData
48509       };
48510       var paths = datagroups.selectAll("path").data(function(layer2) {
48511         return pathData[layer2];
48512       }, featureKey);
48513       paths.exit().remove();
48514       paths = paths.enter().append("path").attr("class", function(d2) {
48515         var datagroup = this.parentNode.__data__;
48516         return "pathdata " + datagroup + " " + featureClasses(d2);
48517       }).attr("clip-path", function(d2) {
48518         var datagroup = this.parentNode.__data__;
48519         return datagroup === "fill" ? "url(#" + clipPathID(d2) + ")" : null;
48520       }).merge(paths).attr("d", function(d2) {
48521         var datagroup = this.parentNode.__data__;
48522         return datagroup === "fill" ? getAreaPath(d2) : getPath(d2);
48523       });
48524       layer.call(drawLabels, "label-halo", geoData).call(drawLabels, "label", geoData);
48525       function drawLabels(selection3, textClass, data) {
48526         var labelPath = path_default(projection2);
48527         var labelData = data.filter(function(d2) {
48528           return _showLabels && d2.properties && (d2.properties.desc || d2.properties.name);
48529         });
48530         var labels = selection3.selectAll("text." + textClass).data(labelData, featureKey);
48531         labels.exit().remove();
48532         labels = labels.enter().append("text").attr("class", function(d2) {
48533           return textClass + " " + featureClasses(d2);
48534         }).merge(labels).text(function(d2) {
48535           return d2.properties.desc || d2.properties.name;
48536         }).attr("x", function(d2) {
48537           var centroid = labelPath.centroid(d2);
48538           return centroid[0] + 11;
48539         }).attr("y", function(d2) {
48540           var centroid = labelPath.centroid(d2);
48541           return centroid[1];
48542         });
48543       }
48544     }
48545     function getExtension(fileName) {
48546       if (!fileName)
48547         return;
48548       var re3 = /\.(gpx|kml|(geo)?json|png)$/i;
48549       var match = fileName.toLowerCase().match(re3);
48550       return match && match.length && match[0];
48551     }
48552     function xmlToDom(textdata) {
48553       return new DOMParser().parseFromString(textdata, "text/xml");
48554     }
48555     function stringifyGeojsonProperties(feature3) {
48556       const properties = feature3.properties;
48557       for (const key in properties) {
48558         const property = properties[key];
48559         if (typeof property === "number" || typeof property === "boolean" || Array.isArray(property)) {
48560           properties[key] = property.toString();
48561         } else if (property === null) {
48562           properties[key] = "null";
48563         } else if (typeof property === "object") {
48564           properties[key] = JSON.stringify(property);
48565         }
48566       }
48567     }
48568     drawData.setFile = function(extension, data) {
48569       _template = null;
48570       _fileList = null;
48571       _geojson = null;
48572       _src = null;
48573       var gj;
48574       switch (extension) {
48575         case ".gpx":
48576           gj = gpx(xmlToDom(data));
48577           break;
48578         case ".kml":
48579           gj = kml(xmlToDom(data));
48580           break;
48581         case ".geojson":
48582         case ".json":
48583           gj = JSON.parse(data);
48584           if (gj.type === "FeatureCollection") {
48585             gj.features.forEach(stringifyGeojsonProperties);
48586           } else if (gj.type === "Feature") {
48587             stringifyGeojsonProperties(gj);
48588           }
48589           break;
48590       }
48591       gj = gj || {};
48592       if (Object.keys(gj).length) {
48593         _geojson = ensureIDs(gj);
48594         _src = extension + " data file";
48595         this.fitZoom();
48596       }
48597       dispatch14.call("change");
48598       return this;
48599     };
48600     drawData.showLabels = function(val) {
48601       if (!arguments.length)
48602         return _showLabels;
48603       _showLabels = val;
48604       return this;
48605     };
48606     drawData.enabled = function(val) {
48607       if (!arguments.length)
48608         return _enabled;
48609       _enabled = val;
48610       if (_enabled) {
48611         showLayer();
48612       } else {
48613         hideLayer();
48614       }
48615       dispatch14.call("change");
48616       return this;
48617     };
48618     drawData.hasData = function() {
48619       var gj = _geojson || {};
48620       return !!(_template || Object.keys(gj).length);
48621     };
48622     drawData.template = function(val, src) {
48623       if (!arguments.length)
48624         return _template;
48625       var osm = context.connection();
48626       if (osm) {
48627         var blocklists = osm.imageryBlocklists();
48628         var fail = false;
48629         var tested = 0;
48630         var regex;
48631         for (var i3 = 0; i3 < blocklists.length; i3++) {
48632           regex = blocklists[i3];
48633           fail = regex.test(val);
48634           tested++;
48635           if (fail)
48636             break;
48637         }
48638         if (!tested) {
48639           regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
48640           fail = regex.test(val);
48641         }
48642       }
48643       _template = val;
48644       _fileList = null;
48645       _geojson = null;
48646       _src = src || "vectortile:" + val.split(/[?#]/)[0];
48647       dispatch14.call("change");
48648       return this;
48649     };
48650     drawData.geojson = function(gj, src) {
48651       if (!arguments.length)
48652         return _geojson;
48653       _template = null;
48654       _fileList = null;
48655       _geojson = null;
48656       _src = null;
48657       gj = gj || {};
48658       if (Object.keys(gj).length) {
48659         _geojson = ensureIDs(gj);
48660         _src = src || "unknown.geojson";
48661       }
48662       dispatch14.call("change");
48663       return this;
48664     };
48665     drawData.fileList = function(fileList) {
48666       if (!arguments.length)
48667         return _fileList;
48668       _template = null;
48669       _geojson = null;
48670       _src = null;
48671       _fileList = fileList;
48672       if (!fileList || !fileList.length)
48673         return this;
48674       var f3 = fileList[0];
48675       var extension = getExtension(f3.name);
48676       var reader = new FileReader();
48677       reader.onload = function() {
48678         return function(e3) {
48679           drawData.setFile(extension, e3.target.result);
48680         };
48681       }(f3);
48682       reader.readAsText(f3);
48683       return this;
48684     };
48685     drawData.url = function(url, defaultExtension) {
48686       _template = null;
48687       _fileList = null;
48688       _geojson = null;
48689       _src = null;
48690       var testUrl = url.split(/[?#]/)[0];
48691       var extension = getExtension(testUrl) || defaultExtension;
48692       if (extension) {
48693         _template = null;
48694         text_default3(url).then(function(data) {
48695           drawData.setFile(extension, data);
48696         }).catch(function() {
48697         });
48698       } else {
48699         drawData.template(url);
48700       }
48701       return this;
48702     };
48703     drawData.getSrc = function() {
48704       return _src || "";
48705     };
48706     drawData.fitZoom = function() {
48707       var features = getFeatures(_geojson);
48708       if (!features.length)
48709         return;
48710       var map2 = context.map();
48711       var viewport = map2.trimmedExtent().polygon();
48712       var coords = features.reduce(function(coords2, feature3) {
48713         var geom = feature3.geometry;
48714         if (!geom)
48715           return coords2;
48716         var c2 = geom.coordinates;
48717         switch (geom.type) {
48718           case "Point":
48719             c2 = [c2];
48720           case "MultiPoint":
48721           case "LineString":
48722             break;
48723           case "MultiPolygon":
48724             c2 = utilArrayFlatten(c2);
48725           case "Polygon":
48726           case "MultiLineString":
48727             c2 = utilArrayFlatten(c2);
48728             break;
48729         }
48730         return utilArrayUnion(coords2, c2);
48731       }, []);
48732       if (!geoPolygonIntersectsPolygon(viewport, coords, true)) {
48733         var extent = geoExtent(bounds_default({ type: "LineString", coordinates: coords }));
48734         map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
48735       }
48736       return this;
48737     };
48738     init2();
48739     return drawData;
48740   }
48741
48742   // modules/svg/debug.js
48743   function svgDebug(projection2, context) {
48744     function drawDebug(selection2) {
48745       const showTile = context.getDebug("tile");
48746       const showCollision = context.getDebug("collision");
48747       const showImagery = context.getDebug("imagery");
48748       const showTouchTargets = context.getDebug("target");
48749       const showDownloaded = context.getDebug("downloaded");
48750       let debugData = [];
48751       if (showTile) {
48752         debugData.push({ class: "red", label: "tile" });
48753       }
48754       if (showCollision) {
48755         debugData.push({ class: "yellow", label: "collision" });
48756       }
48757       if (showImagery) {
48758         debugData.push({ class: "orange", label: "imagery" });
48759       }
48760       if (showTouchTargets) {
48761         debugData.push({ class: "pink", label: "touchTargets" });
48762       }
48763       if (showDownloaded) {
48764         debugData.push({ class: "purple", label: "downloaded" });
48765       }
48766       let legend = context.container().select(".main-content").selectAll(".debug-legend").data(debugData.length ? [0] : []);
48767       legend.exit().remove();
48768       legend = legend.enter().append("div").attr("class", "fillD debug-legend").merge(legend);
48769       let legendItems = legend.selectAll(".debug-legend-item").data(debugData, (d2) => d2.label);
48770       legendItems.exit().remove();
48771       legendItems.enter().append("span").attr("class", (d2) => `debug-legend-item ${d2.class}`).text((d2) => d2.label);
48772       let layer = selection2.selectAll(".layer-debug").data(showImagery || showDownloaded ? [0] : []);
48773       layer.exit().remove();
48774       layer = layer.enter().append("g").attr("class", "layer-debug").merge(layer);
48775       const extent = context.map().extent();
48776       _mainFileFetcher.get("imagery").then((d2) => {
48777         const hits = showImagery && d2.query.bbox(extent.rectangle(), true) || [];
48778         const features = hits.map((d4) => d4.features[d4.id]);
48779         let imagery = layer.selectAll("path.debug-imagery").data(features);
48780         imagery.exit().remove();
48781         imagery.enter().append("path").attr("class", "debug-imagery debug orange");
48782       }).catch(() => {
48783       });
48784       const osm = context.connection();
48785       let dataDownloaded = [];
48786       if (osm && showDownloaded) {
48787         const rtree = osm.caches("get").tile.rtree;
48788         dataDownloaded = rtree.all().map((bbox2) => {
48789           return {
48790             type: "Feature",
48791             properties: { id: bbox2.id },
48792             geometry: {
48793               type: "Polygon",
48794               coordinates: [[
48795                 [bbox2.minX, bbox2.minY],
48796                 [bbox2.minX, bbox2.maxY],
48797                 [bbox2.maxX, bbox2.maxY],
48798                 [bbox2.maxX, bbox2.minY],
48799                 [bbox2.minX, bbox2.minY]
48800               ]]
48801             }
48802           };
48803         });
48804       }
48805       let downloaded = layer.selectAll("path.debug-downloaded").data(showDownloaded ? dataDownloaded : []);
48806       downloaded.exit().remove();
48807       downloaded.enter().append("path").attr("class", "debug-downloaded debug purple");
48808       layer.selectAll("path").attr("d", svgPath(projection2).geojson);
48809     }
48810     drawDebug.enabled = function() {
48811       if (!arguments.length) {
48812         return context.getDebug("tile") || context.getDebug("collision") || context.getDebug("imagery") || context.getDebug("target") || context.getDebug("downloaded");
48813       } else {
48814         return this;
48815       }
48816     };
48817     return drawDebug;
48818   }
48819
48820   // modules/svg/defs.js
48821   function svgDefs(context) {
48822     var _defsSelection = select_default2(null);
48823     var _spritesheetIds = [
48824       "iD-sprite",
48825       "maki-sprite",
48826       "temaki-sprite",
48827       "fa-sprite",
48828       "roentgen-sprite",
48829       "community-sprite"
48830     ];
48831     function drawDefs(selection2) {
48832       _defsSelection = selection2.append("defs");
48833       _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");
48834       function addSidedMarker(name, color2, offset) {
48835         _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);
48836       }
48837       addSidedMarker("natural", "rgb(170, 170, 170)", 0);
48838       addSidedMarker("coastline", "#77dede", 1);
48839       addSidedMarker("waterway", "#77dede", 1);
48840       addSidedMarker("barrier", "#ddd", 1);
48841       addSidedMarker("man_made", "#fff", 0);
48842       _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");
48843       _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");
48844       var patterns2 = _defsSelection.selectAll("pattern").data([
48845         // pattern name, pattern image name
48846         ["beach", "dots"],
48847         ["construction", "construction"],
48848         ["cemetery", "cemetery"],
48849         ["cemetery_christian", "cemetery_christian"],
48850         ["cemetery_buddhist", "cemetery_buddhist"],
48851         ["cemetery_muslim", "cemetery_muslim"],
48852         ["cemetery_jewish", "cemetery_jewish"],
48853         ["farmland", "farmland"],
48854         ["farmyard", "farmyard"],
48855         ["forest", "forest"],
48856         ["forest_broadleaved", "forest_broadleaved"],
48857         ["forest_needleleaved", "forest_needleleaved"],
48858         ["forest_leafless", "forest_leafless"],
48859         ["golf_green", "grass"],
48860         ["grass", "grass"],
48861         ["landfill", "landfill"],
48862         ["meadow", "grass"],
48863         ["orchard", "orchard"],
48864         ["pond", "pond"],
48865         ["quarry", "quarry"],
48866         ["scrub", "bushes"],
48867         ["vineyard", "vineyard"],
48868         ["water_standing", "lines"],
48869         ["waves", "waves"],
48870         ["wetland", "wetland"],
48871         ["wetland_marsh", "wetland_marsh"],
48872         ["wetland_swamp", "wetland_swamp"],
48873         ["wetland_bog", "wetland_bog"],
48874         ["wetland_reedbed", "wetland_reedbed"]
48875       ]).enter().append("pattern").attr("id", function(d2) {
48876         return "ideditor-pattern-" + d2[0];
48877       }).attr("width", 32).attr("height", 32).attr("patternUnits", "userSpaceOnUse");
48878       patterns2.append("rect").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("class", function(d2) {
48879         return "pattern-color-" + d2[0];
48880       });
48881       patterns2.append("image").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("xlink:href", function(d2) {
48882         return context.imagePath("pattern/" + d2[1] + ".png");
48883       });
48884       _defsSelection.selectAll("clipPath").data([12, 18, 20, 32, 45]).enter().append("clipPath").attr("id", function(d2) {
48885         return "ideditor-clip-square-" + d2;
48886       }).append("rect").attr("x", 0).attr("y", 0).attr("width", function(d2) {
48887         return d2;
48888       }).attr("height", function(d2) {
48889         return d2;
48890       });
48891       addSprites(_spritesheetIds, true);
48892     }
48893     function addSprites(ids, overrideColors) {
48894       _spritesheetIds = utilArrayUniq(_spritesheetIds.concat(ids));
48895       var spritesheets = _defsSelection.selectAll(".spritesheet").data(_spritesheetIds);
48896       spritesheets.enter().append("g").attr("class", function(d2) {
48897         return "spritesheet spritesheet-" + d2;
48898       }).each(function(d2) {
48899         var url = context.imagePath(d2 + ".svg");
48900         var node = select_default2(this).node();
48901         svg(url).then(function(svg2) {
48902           node.appendChild(
48903             select_default2(svg2.documentElement).attr("id", "ideditor-" + d2).node()
48904           );
48905           if (overrideColors && d2 !== "iD-sprite") {
48906             select_default2(node).selectAll("path").attr("fill", "currentColor");
48907           }
48908         }).catch(function() {
48909         });
48910       });
48911       spritesheets.exit().remove();
48912     }
48913     drawDefs.addSprites = addSprites;
48914     return drawDefs;
48915   }
48916
48917   // modules/svg/keepRight.js
48918   var _layerEnabled = false;
48919   var _qaService;
48920   function svgKeepRight(projection2, context, dispatch14) {
48921     const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
48922     const minZoom4 = 12;
48923     let touchLayer = select_default2(null);
48924     let drawLayer = select_default2(null);
48925     let layerVisible = false;
48926     function markerPath(selection2, klass) {
48927       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");
48928     }
48929     function getService() {
48930       if (services.keepRight && !_qaService) {
48931         _qaService = services.keepRight;
48932         _qaService.on("loaded", throttledRedraw);
48933       } else if (!services.keepRight && _qaService) {
48934         _qaService = null;
48935       }
48936       return _qaService;
48937     }
48938     function editOn() {
48939       if (!layerVisible) {
48940         layerVisible = true;
48941         drawLayer.style("display", "block");
48942       }
48943     }
48944     function editOff() {
48945       if (layerVisible) {
48946         layerVisible = false;
48947         drawLayer.style("display", "none");
48948         drawLayer.selectAll(".qaItem.keepRight").remove();
48949         touchLayer.selectAll(".qaItem.keepRight").remove();
48950       }
48951     }
48952     function layerOn() {
48953       editOn();
48954       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch14.call("change"));
48955     }
48956     function layerOff() {
48957       throttledRedraw.cancel();
48958       drawLayer.interrupt();
48959       touchLayer.selectAll(".qaItem.keepRight").remove();
48960       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
48961         editOff();
48962         dispatch14.call("change");
48963       });
48964     }
48965     function updateMarkers() {
48966       if (!layerVisible || !_layerEnabled)
48967         return;
48968       const service = getService();
48969       const selectedID = context.selectedErrorID();
48970       const data = service ? service.getItems(projection2) : [];
48971       const getTransform = svgPointTransform(projection2);
48972       const markers = drawLayer.selectAll(".qaItem.keepRight").data(data, (d2) => d2.id);
48973       markers.exit().remove();
48974       const markersEnter = markers.enter().append("g").attr("class", (d2) => `qaItem ${d2.service} itemId-${d2.id} itemType-${d2.parentIssueType}`);
48975       markersEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
48976       markersEnter.append("path").call(markerPath, "shadow");
48977       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");
48978       markers.merge(markersEnter).sort(sortY).classed("selected", (d2) => d2.id === selectedID).attr("transform", getTransform);
48979       if (touchLayer.empty())
48980         return;
48981       const fillClass = context.getDebug("target") ? "pink " : "nocolor ";
48982       const targets = touchLayer.selectAll(".qaItem.keepRight").data(data, (d2) => d2.id);
48983       targets.exit().remove();
48984       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);
48985       function sortY(a2, b2) {
48986         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];
48987       }
48988     }
48989     function drawKeepRight(selection2) {
48990       const service = getService();
48991       const surface = context.surface();
48992       if (surface && !surface.empty()) {
48993         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
48994       }
48995       drawLayer = selection2.selectAll(".layer-keepRight").data(service ? [0] : []);
48996       drawLayer.exit().remove();
48997       drawLayer = drawLayer.enter().append("g").attr("class", "layer-keepRight").style("display", _layerEnabled ? "block" : "none").merge(drawLayer);
48998       if (_layerEnabled) {
48999         if (service && ~~context.map().zoom() >= minZoom4) {
49000           editOn();
49001           service.loadIssues(projection2);
49002           updateMarkers();
49003         } else {
49004           editOff();
49005         }
49006       }
49007     }
49008     drawKeepRight.enabled = function(val) {
49009       if (!arguments.length)
49010         return _layerEnabled;
49011       _layerEnabled = val;
49012       if (_layerEnabled) {
49013         layerOn();
49014       } else {
49015         layerOff();
49016         if (context.selectedErrorID()) {
49017           context.enter(modeBrowse(context));
49018         }
49019       }
49020       dispatch14.call("change");
49021       return this;
49022     };
49023     drawKeepRight.supported = () => !!getService();
49024     return drawKeepRight;
49025   }
49026
49027   // modules/svg/geolocate.js
49028   function svgGeolocate(projection2) {
49029     var layer = select_default2(null);
49030     var _position;
49031     function init2() {
49032       if (svgGeolocate.initialized)
49033         return;
49034       svgGeolocate.enabled = false;
49035       svgGeolocate.initialized = true;
49036     }
49037     function showLayer() {
49038       layer.style("display", "block");
49039     }
49040     function hideLayer() {
49041       layer.transition().duration(250).style("opacity", 0);
49042     }
49043     function layerOn() {
49044       layer.style("opacity", 0).transition().duration(250).style("opacity", 1);
49045     }
49046     function layerOff() {
49047       layer.style("display", "none");
49048     }
49049     function transform2(d2) {
49050       return svgPointTransform(projection2)(d2);
49051     }
49052     function accuracy(accuracy2, loc) {
49053       var degreesRadius = geoMetersToLat(accuracy2), tangentLoc = [loc[0], loc[1] + degreesRadius], projectedTangent = projection2(tangentLoc), projectedLoc = projection2([loc[0], loc[1]]);
49054       return Math.round(projectedLoc[1] - projectedTangent[1]).toString();
49055     }
49056     function update() {
49057       var geolocation = { loc: [_position.coords.longitude, _position.coords.latitude] };
49058       var groups = layer.selectAll(".geolocations").selectAll(".geolocation").data([geolocation]);
49059       groups.exit().remove();
49060       var pointsEnter = groups.enter().append("g").attr("class", "geolocation");
49061       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");
49062       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");
49063       groups.merge(pointsEnter).attr("transform", transform2);
49064       layer.select(".geolocate-radius").attr("r", accuracy(_position.coords.accuracy, geolocation.loc));
49065     }
49066     function drawLocation(selection2) {
49067       var enabled = svgGeolocate.enabled;
49068       layer = selection2.selectAll(".layer-geolocate").data([0]);
49069       layer.exit().remove();
49070       var layerEnter = layer.enter().append("g").attr("class", "layer-geolocate").style("display", enabled ? "block" : "none");
49071       layerEnter.append("g").attr("class", "geolocations");
49072       layer = layerEnter.merge(layer);
49073       if (enabled) {
49074         update();
49075       } else {
49076         layerOff();
49077       }
49078     }
49079     drawLocation.enabled = function(position, enabled) {
49080       if (!arguments.length)
49081         return svgGeolocate.enabled;
49082       _position = position;
49083       svgGeolocate.enabled = enabled;
49084       if (svgGeolocate.enabled) {
49085         showLayer();
49086         layerOn();
49087       } else {
49088         hideLayer();
49089       }
49090       return this;
49091     };
49092     init2();
49093     return drawLocation;
49094   }
49095
49096   // modules/svg/labels.js
49097   var import_rbush6 = __toESM(require_rbush_min());
49098   function svgLabels(projection2, context) {
49099     var path = path_default(projection2);
49100     var detected = utilDetect();
49101     var baselineHack = detected.ie || detected.browser.toLowerCase() === "edge" || detected.browser.toLowerCase() === "firefox" && detected.version >= 70;
49102     var _rdrawn = new import_rbush6.default();
49103     var _rskipped = new import_rbush6.default();
49104     var _textWidthCache = {};
49105     var _entitybboxes = {};
49106     var labelStack = [
49107       ["line", "aeroway", "*", 12],
49108       ["line", "highway", "motorway", 12],
49109       ["line", "highway", "trunk", 12],
49110       ["line", "highway", "primary", 12],
49111       ["line", "highway", "secondary", 12],
49112       ["line", "highway", "tertiary", 12],
49113       ["line", "highway", "*", 12],
49114       ["line", "railway", "*", 12],
49115       ["line", "waterway", "*", 12],
49116       ["area", "aeroway", "*", 12],
49117       ["area", "amenity", "*", 12],
49118       ["area", "building", "*", 12],
49119       ["area", "historic", "*", 12],
49120       ["area", "leisure", "*", 12],
49121       ["area", "man_made", "*", 12],
49122       ["area", "natural", "*", 12],
49123       ["area", "shop", "*", 12],
49124       ["area", "tourism", "*", 12],
49125       ["area", "camp_site", "*", 12],
49126       ["point", "aeroway", "*", 10],
49127       ["point", "amenity", "*", 10],
49128       ["point", "building", "*", 10],
49129       ["point", "historic", "*", 10],
49130       ["point", "leisure", "*", 10],
49131       ["point", "man_made", "*", 10],
49132       ["point", "natural", "*", 10],
49133       ["point", "shop", "*", 10],
49134       ["point", "tourism", "*", 10],
49135       ["point", "camp_site", "*", 10],
49136       ["line", "ref", "*", 12],
49137       ["area", "ref", "*", 12],
49138       ["point", "ref", "*", 10],
49139       ["line", "name", "*", 12],
49140       ["area", "name", "*", 12],
49141       ["point", "name", "*", 10]
49142     ];
49143     function shouldSkipIcon(preset) {
49144       var noIcons = ["building", "landuse", "natural"];
49145       return noIcons.some(function(s2) {
49146         return preset.id.indexOf(s2) >= 0;
49147       });
49148     }
49149     function get4(array2, prop) {
49150       return function(d2, i3) {
49151         return array2[i3][prop];
49152       };
49153     }
49154     function textWidth(text2, size, elem) {
49155       var c2 = _textWidthCache[size];
49156       if (!c2)
49157         c2 = _textWidthCache[size] = {};
49158       if (c2[text2]) {
49159         return c2[text2];
49160       } else if (elem) {
49161         c2[text2] = elem.getComputedTextLength();
49162         return c2[text2];
49163       } else {
49164         var str2 = encodeURIComponent(text2).match(/%[CDEFcdef]/g);
49165         if (str2 === null) {
49166           return size / 3 * 2 * text2.length;
49167         } else {
49168           return size / 3 * (2 * text2.length + str2.length);
49169         }
49170       }
49171     }
49172     function drawLinePaths(selection2, entities, filter2, classes, labels) {
49173       var paths = selection2.selectAll("path").filter(filter2).data(entities, osmEntity.key);
49174       paths.exit().remove();
49175       paths.enter().append("path").style("stroke-width", get4(labels, "font-size")).attr("id", function(d2) {
49176         return "ideditor-labelpath-" + d2.id;
49177       }).attr("class", classes).merge(paths).attr("d", get4(labels, "lineString"));
49178     }
49179     function drawLineLabels(selection2, entities, filter2, classes, labels) {
49180       var texts = selection2.selectAll("text." + classes).filter(filter2).data(entities, osmEntity.key);
49181       texts.exit().remove();
49182       texts.enter().append("text").attr("class", function(d2, i3) {
49183         return classes + " " + labels[i3].classes + " " + d2.id;
49184       }).attr("dy", baselineHack ? "0.35em" : null).append("textPath").attr("class", "textpath");
49185       selection2.selectAll("text." + classes).selectAll(".textpath").filter(filter2).data(entities, osmEntity.key).attr("startOffset", "50%").attr("xlink:href", function(d2) {
49186         return "#ideditor-labelpath-" + d2.id;
49187       }).text(utilDisplayNameForPath);
49188     }
49189     function drawPointLabels(selection2, entities, filter2, classes, labels) {
49190       var texts = selection2.selectAll("text." + classes).filter(filter2).data(entities, osmEntity.key);
49191       texts.exit().remove();
49192       texts.enter().append("text").attr("class", function(d2, i3) {
49193         return classes + " " + labels[i3].classes + " " + d2.id;
49194       }).merge(texts).attr("x", get4(labels, "x")).attr("y", get4(labels, "y")).style("text-anchor", get4(labels, "textAnchor")).text(utilDisplayName).each(function(d2, i3) {
49195         textWidth(utilDisplayName(d2), labels[i3].height, this);
49196       });
49197     }
49198     function drawAreaLabels(selection2, entities, filter2, classes, labels) {
49199       entities = entities.filter(hasText);
49200       labels = labels.filter(hasText);
49201       drawPointLabels(selection2, entities, filter2, classes, labels);
49202       function hasText(d2, i3) {
49203         return labels[i3].hasOwnProperty("x") && labels[i3].hasOwnProperty("y");
49204       }
49205     }
49206     function drawAreaIcons(selection2, entities, filter2, classes, labels) {
49207       var icons = selection2.selectAll("use." + classes).filter(filter2).data(entities, osmEntity.key);
49208       icons.exit().remove();
49209       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) {
49210         var preset = _mainPresetIndex.match(d2, context.graph());
49211         var picon = preset && preset.icon;
49212         return picon ? "#" + picon : "";
49213       });
49214     }
49215     function drawCollisionBoxes(selection2, rtree, which) {
49216       var classes = "debug " + which + " " + (which === "debug-skipped" ? "orange" : "yellow");
49217       var gj = [];
49218       if (context.getDebug("collision")) {
49219         gj = rtree.all().map(function(d2) {
49220           return { type: "Polygon", coordinates: [[
49221             [d2.minX, d2.minY],
49222             [d2.maxX, d2.minY],
49223             [d2.maxX, d2.maxY],
49224             [d2.minX, d2.maxY],
49225             [d2.minX, d2.minY]
49226           ]] };
49227         });
49228       }
49229       var boxes = selection2.selectAll("." + which).data(gj);
49230       boxes.exit().remove();
49231       boxes.enter().append("path").attr("class", classes).merge(boxes).attr("d", path_default());
49232     }
49233     function drawLabels(selection2, graph, entities, filter2, dimensions, fullRedraw) {
49234       var wireframe = context.surface().classed("fill-wireframe");
49235       var zoom = geoScaleToZoom(projection2.scale());
49236       var labelable = [];
49237       var renderNodeAs = {};
49238       var i3, j3, k2, entity, geometry;
49239       for (i3 = 0; i3 < labelStack.length; i3++) {
49240         labelable.push([]);
49241       }
49242       if (fullRedraw) {
49243         _rdrawn.clear();
49244         _rskipped.clear();
49245         _entitybboxes = {};
49246       } else {
49247         for (i3 = 0; i3 < entities.length; i3++) {
49248           entity = entities[i3];
49249           var toRemove = [].concat(_entitybboxes[entity.id] || []).concat(_entitybboxes[entity.id + "I"] || []);
49250           for (j3 = 0; j3 < toRemove.length; j3++) {
49251             _rdrawn.remove(toRemove[j3]);
49252             _rskipped.remove(toRemove[j3]);
49253           }
49254         }
49255       }
49256       for (i3 = 0; i3 < entities.length; i3++) {
49257         entity = entities[i3];
49258         geometry = entity.geometry(graph);
49259         if (geometry === "point" || geometry === "vertex" && isInterestingVertex(entity)) {
49260           var hasDirections = entity.directions(graph, projection2).length;
49261           var markerPadding;
49262           if (!wireframe && geometry === "point" && !(zoom >= 18 && hasDirections)) {
49263             renderNodeAs[entity.id] = "point";
49264             markerPadding = 20;
49265           } else {
49266             renderNodeAs[entity.id] = "vertex";
49267             markerPadding = 0;
49268           }
49269           var coord2 = projection2(entity.loc);
49270           var nodePadding = 10;
49271           var bbox2 = {
49272             minX: coord2[0] - nodePadding,
49273             minY: coord2[1] - nodePadding - markerPadding,
49274             maxX: coord2[0] + nodePadding,
49275             maxY: coord2[1] + nodePadding
49276           };
49277           doInsert(bbox2, entity.id + "P");
49278         }
49279         if (geometry === "vertex") {
49280           geometry = "point";
49281         }
49282         var preset = geometry === "area" && _mainPresetIndex.match(entity, graph);
49283         var icon2 = preset && !shouldSkipIcon(preset) && preset.icon;
49284         if (!icon2 && !utilDisplayName(entity))
49285           continue;
49286         for (k2 = 0; k2 < labelStack.length; k2++) {
49287           var matchGeom = labelStack[k2][0];
49288           var matchKey = labelStack[k2][1];
49289           var matchVal = labelStack[k2][2];
49290           var hasVal = entity.tags[matchKey];
49291           if (geometry === matchGeom && hasVal && (matchVal === "*" || matchVal === hasVal)) {
49292             labelable[k2].push(entity);
49293             break;
49294           }
49295         }
49296       }
49297       var positions = {
49298         point: [],
49299         line: [],
49300         area: []
49301       };
49302       var labelled = {
49303         point: [],
49304         line: [],
49305         area: []
49306       };
49307       for (k2 = 0; k2 < labelable.length; k2++) {
49308         var fontSize = labelStack[k2][3];
49309         for (i3 = 0; i3 < labelable[k2].length; i3++) {
49310           entity = labelable[k2][i3];
49311           geometry = entity.geometry(graph);
49312           var getName = geometry === "line" ? utilDisplayNameForPath : utilDisplayName;
49313           var name = getName(entity);
49314           var width = name && textWidth(name, fontSize);
49315           var p2 = null;
49316           if (geometry === "point" || geometry === "vertex") {
49317             if (wireframe)
49318               continue;
49319             var renderAs = renderNodeAs[entity.id];
49320             if (renderAs === "vertex" && zoom < 17)
49321               continue;
49322             p2 = getPointLabel(entity, width, fontSize, renderAs);
49323           } else if (geometry === "line") {
49324             p2 = getLineLabel(entity, width, fontSize);
49325           } else if (geometry === "area") {
49326             p2 = getAreaLabel(entity, width, fontSize);
49327           }
49328           if (p2) {
49329             if (geometry === "vertex") {
49330               geometry = "point";
49331             }
49332             p2.classes = geometry + " tag-" + labelStack[k2][1];
49333             positions[geometry].push(p2);
49334             labelled[geometry].push(entity);
49335           }
49336         }
49337       }
49338       function isInterestingVertex(entity2) {
49339         var selectedIDs = context.selectedIDs();
49340         return entity2.hasInterestingTags() || entity2.isEndpoint(graph) || entity2.isConnected(graph) || selectedIDs.indexOf(entity2.id) !== -1 || graph.parentWays(entity2).some(function(parent) {
49341           return selectedIDs.indexOf(parent.id) !== -1;
49342         });
49343       }
49344       function getPointLabel(entity2, width2, height, geometry2) {
49345         var y2 = geometry2 === "point" ? -12 : 0;
49346         var pointOffsets = {
49347           ltr: [15, y2, "start"],
49348           rtl: [-15, y2, "end"]
49349         };
49350         var textDirection = _mainLocalizer.textDirection();
49351         var coord3 = projection2(entity2.loc);
49352         var textPadding = 2;
49353         var offset = pointOffsets[textDirection];
49354         var p3 = {
49355           height,
49356           width: width2,
49357           x: coord3[0] + offset[0],
49358           y: coord3[1] + offset[1],
49359           textAnchor: offset[2]
49360         };
49361         var bbox3;
49362         if (textDirection === "rtl") {
49363           bbox3 = {
49364             minX: p3.x - width2 - textPadding,
49365             minY: p3.y - height / 2 - textPadding,
49366             maxX: p3.x + textPadding,
49367             maxY: p3.y + height / 2 + textPadding
49368           };
49369         } else {
49370           bbox3 = {
49371             minX: p3.x - textPadding,
49372             minY: p3.y - height / 2 - textPadding,
49373             maxX: p3.x + width2 + textPadding,
49374             maxY: p3.y + height / 2 + textPadding
49375           };
49376         }
49377         if (tryInsert([bbox3], entity2.id, true)) {
49378           return p3;
49379         }
49380       }
49381       function getLineLabel(entity2, width2, height) {
49382         var viewport = geoExtent(context.projection.clipExtent()).polygon();
49383         var points = graph.childNodes(entity2).map(function(node) {
49384           return projection2(node.loc);
49385         });
49386         var length = geoPathLength(points);
49387         if (length < width2 + 20)
49388           return;
49389         var lineOffsets = [
49390           50,
49391           45,
49392           55,
49393           40,
49394           60,
49395           35,
49396           65,
49397           30,
49398           70,
49399           25,
49400           75,
49401           20,
49402           80,
49403           15,
49404           95,
49405           10,
49406           90,
49407           5,
49408           95
49409         ];
49410         var padding = 3;
49411         for (var i4 = 0; i4 < lineOffsets.length; i4++) {
49412           var offset = lineOffsets[i4];
49413           var middle = offset / 100 * length;
49414           var start2 = middle - width2 / 2;
49415           if (start2 < 0 || start2 + width2 > length)
49416             continue;
49417           var sub = subpath(points, start2, start2 + width2);
49418           if (!sub || !geoPolygonIntersectsPolygon(viewport, sub, true)) {
49419             continue;
49420           }
49421           var isReverse = reverse(sub);
49422           if (isReverse) {
49423             sub = sub.reverse();
49424           }
49425           var bboxes = [];
49426           var boxsize = (height + 2) / 2;
49427           for (var j4 = 0; j4 < sub.length - 1; j4++) {
49428             var a2 = sub[j4];
49429             var b2 = sub[j4 + 1];
49430             var num = Math.max(1, Math.floor(geoVecLength(a2, b2) / boxsize / 2));
49431             for (var box = 0; box < num; box++) {
49432               var p3 = geoVecInterp(a2, b2, box / num);
49433               var x05 = p3[0] - boxsize - padding;
49434               var y05 = p3[1] - boxsize - padding;
49435               var x12 = p3[0] + boxsize + padding;
49436               var y12 = p3[1] + boxsize + padding;
49437               bboxes.push({
49438                 minX: Math.min(x05, x12),
49439                 minY: Math.min(y05, y12),
49440                 maxX: Math.max(x05, x12),
49441                 maxY: Math.max(y05, y12)
49442               });
49443             }
49444           }
49445           if (tryInsert(bboxes, entity2.id, false)) {
49446             return {
49447               "font-size": height + 2,
49448               lineString: lineString2(sub),
49449               startOffset: offset + "%"
49450             };
49451           }
49452         }
49453         function reverse(p4) {
49454           var angle2 = Math.atan2(p4[1][1] - p4[0][1], p4[1][0] - p4[0][0]);
49455           return !(p4[0][0] < p4[p4.length - 1][0] && angle2 < Math.PI / 2 && angle2 > -Math.PI / 2);
49456         }
49457         function lineString2(points2) {
49458           return "M" + points2.join("L");
49459         }
49460         function subpath(points2, from, to) {
49461           var sofar = 0;
49462           var start3, end, i0, i1;
49463           for (var i5 = 0; i5 < points2.length - 1; i5++) {
49464             var a3 = points2[i5];
49465             var b3 = points2[i5 + 1];
49466             var current = geoVecLength(a3, b3);
49467             var portion;
49468             if (!start3 && sofar + current >= from) {
49469               portion = (from - sofar) / current;
49470               start3 = [
49471                 a3[0] + portion * (b3[0] - a3[0]),
49472                 a3[1] + portion * (b3[1] - a3[1])
49473               ];
49474               i0 = i5 + 1;
49475             }
49476             if (!end && sofar + current >= to) {
49477               portion = (to - sofar) / current;
49478               end = [
49479                 a3[0] + portion * (b3[0] - a3[0]),
49480                 a3[1] + portion * (b3[1] - a3[1])
49481               ];
49482               i1 = i5 + 1;
49483             }
49484             sofar += current;
49485           }
49486           var result = points2.slice(i0, i1);
49487           result.unshift(start3);
49488           result.push(end);
49489           return result;
49490         }
49491       }
49492       function getAreaLabel(entity2, width2, height) {
49493         var centroid = path.centroid(entity2.asGeoJSON(graph));
49494         var extent = entity2.extent(graph);
49495         var areaWidth = projection2(extent[1])[0] - projection2(extent[0])[0];
49496         if (isNaN(centroid[0]) || areaWidth < 20)
49497           return;
49498         var preset2 = _mainPresetIndex.match(entity2, context.graph());
49499         var picon = preset2 && preset2.icon;
49500         var iconSize = 17;
49501         var padding = 2;
49502         var p3 = {};
49503         if (picon) {
49504           if (addIcon()) {
49505             addLabel(iconSize + padding);
49506             return p3;
49507           }
49508         } else {
49509           if (addLabel(0)) {
49510             return p3;
49511           }
49512         }
49513         function addIcon() {
49514           var iconX = centroid[0] - iconSize / 2;
49515           var iconY = centroid[1] - iconSize / 2;
49516           var bbox3 = {
49517             minX: iconX,
49518             minY: iconY,
49519             maxX: iconX + iconSize,
49520             maxY: iconY + iconSize
49521           };
49522           if (tryInsert([bbox3], entity2.id + "I", true)) {
49523             p3.transform = "translate(" + iconX + "," + iconY + ")";
49524             return true;
49525           }
49526           return false;
49527         }
49528         function addLabel(yOffset) {
49529           if (width2 && areaWidth >= width2 + 20) {
49530             var labelX = centroid[0];
49531             var labelY = centroid[1] + yOffset;
49532             var bbox3 = {
49533               minX: labelX - width2 / 2 - padding,
49534               minY: labelY - height / 2 - padding,
49535               maxX: labelX + width2 / 2 + padding,
49536               maxY: labelY + height / 2 + padding
49537             };
49538             if (tryInsert([bbox3], entity2.id, true)) {
49539               p3.x = labelX;
49540               p3.y = labelY;
49541               p3.textAnchor = "middle";
49542               p3.height = height;
49543               return true;
49544             }
49545           }
49546           return false;
49547         }
49548       }
49549       function doInsert(bbox3, id2) {
49550         bbox3.id = id2;
49551         var oldbox = _entitybboxes[id2];
49552         if (oldbox) {
49553           _rdrawn.remove(oldbox);
49554         }
49555         _entitybboxes[id2] = bbox3;
49556         _rdrawn.insert(bbox3);
49557       }
49558       function tryInsert(bboxes, id2, saveSkipped) {
49559         var skipped = false;
49560         for (var i4 = 0; i4 < bboxes.length; i4++) {
49561           var bbox3 = bboxes[i4];
49562           bbox3.id = id2;
49563           if (bbox3.minX < 0 || bbox3.minY < 0 || bbox3.maxX > dimensions[0] || bbox3.maxY > dimensions[1]) {
49564             skipped = true;
49565             break;
49566           }
49567           if (_rdrawn.collides(bbox3)) {
49568             skipped = true;
49569             break;
49570           }
49571         }
49572         _entitybboxes[id2] = bboxes;
49573         if (skipped) {
49574           if (saveSkipped) {
49575             _rskipped.load(bboxes);
49576           }
49577         } else {
49578           _rdrawn.load(bboxes);
49579         }
49580         return !skipped;
49581       }
49582       var layer = selection2.selectAll(".layer-osm.labels");
49583       layer.selectAll(".labels-group").data(["halo", "label", "debug"]).enter().append("g").attr("class", function(d2) {
49584         return "labels-group " + d2;
49585       });
49586       var halo = layer.selectAll(".labels-group.halo");
49587       var label = layer.selectAll(".labels-group.label");
49588       var debug2 = layer.selectAll(".labels-group.debug");
49589       drawPointLabels(label, labelled.point, filter2, "pointlabel", positions.point);
49590       drawPointLabels(halo, labelled.point, filter2, "pointlabel-halo", positions.point);
49591       drawLinePaths(layer, labelled.line, filter2, "", positions.line);
49592       drawLineLabels(label, labelled.line, filter2, "linelabel", positions.line);
49593       drawLineLabels(halo, labelled.line, filter2, "linelabel-halo", positions.line);
49594       drawAreaLabels(label, labelled.area, filter2, "arealabel", positions.area);
49595       drawAreaLabels(halo, labelled.area, filter2, "arealabel-halo", positions.area);
49596       drawAreaIcons(label, labelled.area, filter2, "areaicon", positions.area);
49597       drawAreaIcons(halo, labelled.area, filter2, "areaicon-halo", positions.area);
49598       drawCollisionBoxes(debug2, _rskipped, "debug-skipped");
49599       drawCollisionBoxes(debug2, _rdrawn, "debug-drawn");
49600       layer.call(filterLabels);
49601     }
49602     function filterLabels(selection2) {
49603       var drawLayer = selection2.selectAll(".layer-osm.labels");
49604       var layers = drawLayer.selectAll(".labels-group.halo, .labels-group.label");
49605       layers.selectAll(".nolabel").classed("nolabel", false);
49606       var mouse = context.map().mouse();
49607       var graph = context.graph();
49608       var selectedIDs = context.selectedIDs();
49609       var ids = [];
49610       var pad2, bbox2;
49611       if (mouse) {
49612         pad2 = 20;
49613         bbox2 = { minX: mouse[0] - pad2, minY: mouse[1] - pad2, maxX: mouse[0] + pad2, maxY: mouse[1] + pad2 };
49614         var nearMouse = _rdrawn.search(bbox2).map(function(entity2) {
49615           return entity2.id;
49616         });
49617         ids.push.apply(ids, nearMouse);
49618       }
49619       for (var i3 = 0; i3 < selectedIDs.length; i3++) {
49620         var entity = graph.hasEntity(selectedIDs[i3]);
49621         if (entity && entity.type === "node") {
49622           ids.push(selectedIDs[i3]);
49623         }
49624       }
49625       layers.selectAll(utilEntitySelector(ids)).classed("nolabel", true);
49626       var debug2 = selection2.selectAll(".labels-group.debug");
49627       var gj = [];
49628       if (context.getDebug("collision")) {
49629         gj = bbox2 ? [{
49630           type: "Polygon",
49631           coordinates: [[
49632             [bbox2.minX, bbox2.minY],
49633             [bbox2.maxX, bbox2.minY],
49634             [bbox2.maxX, bbox2.maxY],
49635             [bbox2.minX, bbox2.maxY],
49636             [bbox2.minX, bbox2.minY]
49637           ]]
49638         }] : [];
49639       }
49640       var box = debug2.selectAll(".debug-mouse").data(gj);
49641       box.exit().remove();
49642       box.enter().append("path").attr("class", "debug debug-mouse yellow").merge(box).attr("d", path_default());
49643     }
49644     var throttleFilterLabels = throttle_default(filterLabels, 100);
49645     drawLabels.observe = function(selection2) {
49646       var listener = function() {
49647         throttleFilterLabels(selection2);
49648       };
49649       selection2.on("mousemove.hidelabels", listener);
49650       context.on("enter.hidelabels", listener);
49651     };
49652     drawLabels.off = function(selection2) {
49653       throttleFilterLabels.cancel();
49654       selection2.on("mousemove.hidelabels", null);
49655       context.on("enter.hidelabels", null);
49656     };
49657     return drawLabels;
49658   }
49659
49660   // node_modules/exifr/dist/full.esm.mjs
49661   var e = "undefined" != typeof self ? self : global;
49662   var t = "undefined" != typeof navigator;
49663   var i2 = t && "undefined" == typeof HTMLImageElement;
49664   var n2 = !("undefined" == typeof global || "undefined" == typeof process || !process.versions || !process.versions.node);
49665   var s = e.Buffer;
49666   var r = e.BigInt;
49667   var a = !!s;
49668   var o = (e3) => e3;
49669   function l(e3, t2 = o) {
49670     if (n2)
49671       try {
49672         return "function" == typeof __require ? Promise.resolve(t2(__require(e3))) : import(
49673           /* webpackIgnore: true */
49674           e3
49675         ).then(t2);
49676       } catch (t3) {
49677         console.warn(`Couldn't load ${e3}`);
49678       }
49679   }
49680   var h = e.fetch;
49681   var u = (e3) => h = e3;
49682   if (!e.fetch) {
49683     const e3 = l("http", (e4) => e4), t2 = l("https", (e4) => e4), i3 = (n3, { headers: s2 } = {}) => new Promise(async (r2, a2) => {
49684       let { port: o2, hostname: l2, pathname: h2, protocol: u2, search: c2 } = new URL(n3);
49685       const f3 = { method: "GET", hostname: l2, path: encodeURI(h2) + c2, headers: s2 };
49686       "" !== o2 && (f3.port = Number(o2));
49687       const d2 = ("https:" === u2 ? await t2 : await e3).request(f3, (e4) => {
49688         if (301 === e4.statusCode || 302 === e4.statusCode) {
49689           let t3 = new URL(e4.headers.location, n3).toString();
49690           return i3(t3, { headers: s2 }).then(r2).catch(a2);
49691         }
49692         r2({ status: e4.statusCode, arrayBuffer: () => new Promise((t3) => {
49693           let i4 = [];
49694           e4.on("data", (e6) => i4.push(e6)), e4.on("end", () => t3(Buffer.concat(i4)));
49695         }) });
49696       });
49697       d2.on("error", a2), d2.end();
49698     });
49699     u(i3);
49700   }
49701   function c(e3, t2, i3) {
49702     return t2 in e3 ? Object.defineProperty(e3, t2, { value: i3, enumerable: true, configurable: true, writable: true }) : e3[t2] = i3, e3;
49703   }
49704   var f2 = (e3) => p(e3) ? void 0 : e3;
49705   var d = (e3) => void 0 !== e3;
49706   function p(e3) {
49707     return void 0 === e3 || (e3 instanceof Map ? 0 === e3.size : 0 === Object.values(e3).filter(d).length);
49708   }
49709   function g2(e3) {
49710     let t2 = new Error(e3);
49711     throw delete t2.stack, t2;
49712   }
49713   function m(e3) {
49714     return "" === (e3 = function(e4) {
49715       for (; e4.endsWith("\0"); )
49716         e4 = e4.slice(0, -1);
49717       return e4;
49718     }(e3).trim()) ? void 0 : e3;
49719   }
49720   function S(e3) {
49721     let t2 = function(e4) {
49722       let t3 = 0;
49723       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;
49724     }(e3);
49725     return e3.jfif.enabled && (t2 += 50), e3.xmp.enabled && (t2 += 2e4), e3.iptc.enabled && (t2 += 14e3), e3.icc.enabled && (t2 += 6e3), t2;
49726   }
49727   var C = (e3) => String.fromCharCode.apply(null, e3);
49728   var y = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : void 0;
49729   function b(e3) {
49730     return y ? y.decode(e3) : a ? Buffer.from(e3).toString("utf8") : decodeURIComponent(escape(C(e3)));
49731   }
49732   var I = class _I {
49733     static from(e3, t2) {
49734       return e3 instanceof this && e3.le === t2 ? e3 : new _I(e3, void 0, void 0, t2);
49735     }
49736     constructor(e3, t2 = 0, i3, n3) {
49737       if ("boolean" == typeof n3 && (this.le = n3), Array.isArray(e3) && (e3 = new Uint8Array(e3)), 0 === e3)
49738         this.byteOffset = 0, this.byteLength = 0;
49739       else if (e3 instanceof ArrayBuffer) {
49740         void 0 === i3 && (i3 = e3.byteLength - t2);
49741         let n4 = new DataView(e3, t2, i3);
49742         this._swapDataView(n4);
49743       } else if (e3 instanceof Uint8Array || e3 instanceof DataView || e3 instanceof _I) {
49744         void 0 === i3 && (i3 = e3.byteLength - t2), (t2 += e3.byteOffset) + i3 > e3.byteOffset + e3.byteLength && g2("Creating view outside of available memory in ArrayBuffer");
49745         let n4 = new DataView(e3.buffer, t2, i3);
49746         this._swapDataView(n4);
49747       } else if ("number" == typeof e3) {
49748         let t3 = new DataView(new ArrayBuffer(e3));
49749         this._swapDataView(t3);
49750       } else
49751         g2("Invalid input argument for BufferView: " + e3);
49752     }
49753     _swapArrayBuffer(e3) {
49754       this._swapDataView(new DataView(e3));
49755     }
49756     _swapBuffer(e3) {
49757       this._swapDataView(new DataView(e3.buffer, e3.byteOffset, e3.byteLength));
49758     }
49759     _swapDataView(e3) {
49760       this.dataView = e3, this.buffer = e3.buffer, this.byteOffset = e3.byteOffset, this.byteLength = e3.byteLength;
49761     }
49762     _lengthToEnd(e3) {
49763       return this.byteLength - e3;
49764     }
49765     set(e3, t2, i3 = _I) {
49766       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);
49767     }
49768     subarray(e3, t2) {
49769       return t2 = t2 || this._lengthToEnd(e3), new _I(this, e3, t2);
49770     }
49771     toUint8() {
49772       return new Uint8Array(this.buffer, this.byteOffset, this.byteLength);
49773     }
49774     getUint8Array(e3, t2) {
49775       return new Uint8Array(this.buffer, this.byteOffset + e3, t2);
49776     }
49777     getString(e3 = 0, t2 = this.byteLength) {
49778       return b(this.getUint8Array(e3, t2));
49779     }
49780     getLatin1String(e3 = 0, t2 = this.byteLength) {
49781       let i3 = this.getUint8Array(e3, t2);
49782       return C(i3);
49783     }
49784     getUnicodeString(e3 = 0, t2 = this.byteLength) {
49785       const i3 = [];
49786       for (let n3 = 0; n3 < t2 && e3 + n3 < this.byteLength; n3 += 2)
49787         i3.push(this.getUint16(e3 + n3));
49788       return C(i3);
49789     }
49790     getInt8(e3) {
49791       return this.dataView.getInt8(e3);
49792     }
49793     getUint8(e3) {
49794       return this.dataView.getUint8(e3);
49795     }
49796     getInt16(e3, t2 = this.le) {
49797       return this.dataView.getInt16(e3, t2);
49798     }
49799     getInt32(e3, t2 = this.le) {
49800       return this.dataView.getInt32(e3, t2);
49801     }
49802     getUint16(e3, t2 = this.le) {
49803       return this.dataView.getUint16(e3, t2);
49804     }
49805     getUint32(e3, t2 = this.le) {
49806       return this.dataView.getUint32(e3, t2);
49807     }
49808     getFloat32(e3, t2 = this.le) {
49809       return this.dataView.getFloat32(e3, t2);
49810     }
49811     getFloat64(e3, t2 = this.le) {
49812       return this.dataView.getFloat64(e3, t2);
49813     }
49814     getFloat(e3, t2 = this.le) {
49815       return this.dataView.getFloat32(e3, t2);
49816     }
49817     getDouble(e3, t2 = this.le) {
49818       return this.dataView.getFloat64(e3, t2);
49819     }
49820     getUintBytes(e3, t2, i3) {
49821       switch (t2) {
49822         case 1:
49823           return this.getUint8(e3, i3);
49824         case 2:
49825           return this.getUint16(e3, i3);
49826         case 4:
49827           return this.getUint32(e3, i3);
49828         case 8:
49829           return this.getUint64 && this.getUint64(e3, i3);
49830       }
49831     }
49832     getUint(e3, t2, i3) {
49833       switch (t2) {
49834         case 8:
49835           return this.getUint8(e3, i3);
49836         case 16:
49837           return this.getUint16(e3, i3);
49838         case 32:
49839           return this.getUint32(e3, i3);
49840         case 64:
49841           return this.getUint64 && this.getUint64(e3, i3);
49842       }
49843     }
49844     toString(e3) {
49845       return this.dataView.toString(e3, this.constructor.name);
49846     }
49847     ensureChunk() {
49848     }
49849   };
49850   function P(e3, t2) {
49851     g2(`${e3} '${t2}' was not loaded, try using full build of exifr.`);
49852   }
49853   var k = class extends Map {
49854     constructor(e3) {
49855       super(), this.kind = e3;
49856     }
49857     get(e3, t2) {
49858       return this.has(e3) || P(this.kind, e3), t2 && (e3 in t2 || function(e4, t3) {
49859         g2(`Unknown ${e4} '${t3}'.`);
49860       }(this.kind, e3), t2[e3].enabled || P(this.kind, e3)), super.get(e3);
49861     }
49862     keyList() {
49863       return Array.from(this.keys());
49864     }
49865   };
49866   var w = new k("file parser");
49867   var T = new k("segment parser");
49868   var A = new k("file reader");
49869   function D(e3, n3) {
49870     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");
49871   }
49872   function O(e3, i3) {
49873     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");
49874     var s2;
49875   }
49876   async function x(e3, t2, i3, n3) {
49877     return A.has(i3) ? v(e3, t2, i3) : n3 ? async function(e4, t3) {
49878       let i4 = await t3(e4);
49879       return new I(i4);
49880     }(e3, n3) : void g2(`Parser ${i3} is not loaded`);
49881   }
49882   async function v(e3, t2, i3) {
49883     let n3 = new (A.get(i3))(e3, t2);
49884     return await n3.read(), n3;
49885   }
49886   var M = (e3) => h(e3).then((e4) => e4.arrayBuffer());
49887   var R = (e3) => new Promise((t2, i3) => {
49888     let n3 = new FileReader();
49889     n3.onloadend = () => t2(n3.result || new ArrayBuffer()), n3.onerror = i3, n3.readAsArrayBuffer(e3);
49890   });
49891   var L = class extends Map {
49892     get tagKeys() {
49893       return this.allKeys || (this.allKeys = Array.from(this.keys())), this.allKeys;
49894     }
49895     get tagValues() {
49896       return this.allValues || (this.allValues = Array.from(this.values())), this.allValues;
49897     }
49898   };
49899   function U(e3, t2, i3) {
49900     let n3 = new L();
49901     for (let [e4, t3] of i3)
49902       n3.set(e4, t3);
49903     if (Array.isArray(t2))
49904       for (let i4 of t2)
49905         e3.set(i4, n3);
49906     else
49907       e3.set(t2, n3);
49908     return n3;
49909   }
49910   function F(e3, t2, i3) {
49911     let n3, s2 = e3.get(t2);
49912     for (n3 of i3)
49913       s2.set(n3[0], n3[1]);
49914   }
49915   var E = /* @__PURE__ */ new Map();
49916   var B = /* @__PURE__ */ new Map();
49917   var N = /* @__PURE__ */ new Map();
49918   var G = ["chunked", "firstChunkSize", "firstChunkSizeNode", "firstChunkSizeBrowser", "chunkSize", "chunkLimit"];
49919   var V = ["jfif", "xmp", "icc", "iptc", "ihdr"];
49920   var z = ["tiff", ...V];
49921   var H = ["ifd0", "ifd1", "exif", "gps", "interop"];
49922   var j2 = [...z, ...H];
49923   var W = ["makerNote", "userComment"];
49924   var K = ["translateKeys", "translateValues", "reviveValues", "multiSegment"];
49925   var X = [...K, "sanitize", "mergeOutput", "silentErrors"];
49926   var _ = class {
49927     get translate() {
49928       return this.translateKeys || this.translateValues || this.reviveValues;
49929     }
49930   };
49931   var Y = class extends _ {
49932     get needed() {
49933       return this.enabled || this.deps.size > 0;
49934     }
49935     constructor(e3, t2, i3, n3) {
49936       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)
49937         if (Array.isArray(i3))
49938           this.parse = this.enabled = true, this.canBeFiltered && i3.length > 0 && this.translateTagSet(i3, this.pick);
49939         else if ("object" == typeof i3) {
49940           if (this.enabled = true, this.parse = false !== i3.parse, this.canBeFiltered) {
49941             let { pick: e4, skip: t3 } = i3;
49942             e4 && e4.length > 0 && this.translateTagSet(e4, this.pick), t3 && t3.length > 0 && this.translateTagSet(t3, this.skip);
49943           }
49944           this.applyInheritables(i3);
49945         } else
49946           true === i3 || false === i3 ? this.parse = this.enabled = i3 : g2(`Invalid options argument: ${i3}`);
49947     }
49948     applyInheritables(e3) {
49949       let t2, i3;
49950       for (t2 of K)
49951         i3 = e3[t2], void 0 !== i3 && (this[t2] = i3);
49952     }
49953     translateTagSet(e3, t2) {
49954       if (this.dict) {
49955         let i3, n3, { tagKeys: s2, tagValues: r2 } = this.dict;
49956         for (i3 of e3)
49957           "string" == typeof i3 ? (n3 = r2.indexOf(i3), -1 === n3 && (n3 = s2.indexOf(Number(i3))), -1 !== n3 && t2.add(Number(s2[n3]))) : t2.add(i3);
49958       } else
49959         for (let i3 of e3)
49960           t2.add(i3);
49961     }
49962     finalizeFilters() {
49963       !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);
49964     }
49965   };
49966   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 };
49967   var J = /* @__PURE__ */ new Map();
49968   var q = class extends _ {
49969     static useCached(e3) {
49970       let t2 = J.get(e3);
49971       return void 0 !== t2 || (t2 = new this(e3), J.set(e3, t2)), t2;
49972     }
49973     constructor(e3) {
49974       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();
49975     }
49976     setupFromUndefined() {
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] = $2[e3];
49984       for (e3 of j2)
49985         this[e3] = new Y(e3, $2[e3], void 0, this);
49986     }
49987     setupFromTrue() {
49988       let e3;
49989       for (e3 of G)
49990         this[e3] = $2[e3];
49991       for (e3 of X)
49992         this[e3] = $2[e3];
49993       for (e3 of W)
49994         this[e3] = true;
49995       for (e3 of j2)
49996         this[e3] = new Y(e3, true, void 0, this);
49997     }
49998     setupFromArray(e3) {
49999       let t2;
50000       for (t2 of G)
50001         this[t2] = $2[t2];
50002       for (t2 of X)
50003         this[t2] = $2[t2];
50004       for (t2 of W)
50005         this[t2] = $2[t2];
50006       for (t2 of j2)
50007         this[t2] = new Y(t2, false, void 0, this);
50008       this.setupGlobalFilters(e3, void 0, H);
50009     }
50010     setupFromObject(e3) {
50011       let t2;
50012       for (t2 of (H.ifd0 = H.ifd0 || H.image, H.ifd1 = H.ifd1 || H.thumbnail, Object.assign(this, e3), G))
50013         this[t2] = Z(e3[t2], $2[t2]);
50014       for (t2 of X)
50015         this[t2] = Z(e3[t2], $2[t2]);
50016       for (t2 of W)
50017         this[t2] = Z(e3[t2], $2[t2]);
50018       for (t2 of z)
50019         this[t2] = new Y(t2, $2[t2], e3[t2], this);
50020       for (t2 of H)
50021         this[t2] = new Y(t2, $2[t2], e3[t2], this.tiff);
50022       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);
50023     }
50024     batchEnableWithBool(e3, t2) {
50025       for (let i3 of e3)
50026         this[i3].enabled = t2;
50027     }
50028     batchEnableWithUserValue(e3, t2) {
50029       for (let i3 of e3) {
50030         let e4 = t2[i3];
50031         this[i3].enabled = false !== e4 && void 0 !== e4;
50032       }
50033     }
50034     setupGlobalFilters(e3, t2, i3, n3 = i3) {
50035       if (e3 && e3.length) {
50036         for (let e4 of n3)
50037           this[e4].enabled = false;
50038         let t3 = Q(e3, i3);
50039         for (let [e4, i4] of t3)
50040           ee(this[e4].pick, i4), this[e4].enabled = true;
50041       } else if (t2 && t2.length) {
50042         let e4 = Q(t2, i3);
50043         for (let [t3, i4] of e4)
50044           ee(this[t3].skip, i4);
50045       }
50046     }
50047     filterNestedSegmentTags() {
50048       let { ifd0: e3, exif: t2, xmp: i3, iptc: n3, icc: s2 } = this;
50049       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);
50050     }
50051     traverseTiffDependencyTree() {
50052       let { ifd0: e3, exif: t2, gps: i3, interop: n3 } = this;
50053       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;
50054       for (let e4 of H)
50055         this[e4].finalizeFilters();
50056     }
50057     get onlyTiff() {
50058       return !V.map((e3) => this[e3].enabled).some((e3) => true === e3) && this.tiff.enabled;
50059     }
50060     checkLoadedPlugins() {
50061       for (let e3 of z)
50062         this[e3].enabled && !T.has(e3) && P("segment parser", e3);
50063     }
50064   };
50065   function Q(e3, t2) {
50066     let i3, n3, s2, r2, a2 = [];
50067     for (s2 of t2) {
50068       for (r2 of (i3 = E.get(s2), n3 = [], i3))
50069         (e3.includes(r2[0]) || e3.includes(r2[1])) && n3.push(r2[0]);
50070       n3.length && a2.push([s2, n3]);
50071     }
50072     return a2;
50073   }
50074   function Z(e3, t2) {
50075     return void 0 !== e3 ? e3 : void 0 !== t2 ? t2 : void 0;
50076   }
50077   function ee(e3, t2) {
50078     for (let i3 of t2)
50079       e3.add(i3);
50080   }
50081   c(q, "default", $2);
50082   var te = class {
50083     constructor(e3) {
50084       c(this, "parsers", {}), c(this, "output", {}), c(this, "errors", []), c(this, "pushToErrors", (e4) => this.errors.push(e4)), this.options = q.useCached(e3);
50085     }
50086     async read(e3) {
50087       this.file = await D(e3, this.options);
50088     }
50089     setup() {
50090       if (this.fileParser)
50091         return;
50092       let { file: e3 } = this, t2 = e3.getUint16(0);
50093       for (let [i3, n3] of w)
50094         if (n3.canHandle(e3, t2))
50095           return this.fileParser = new n3(this.options, this.file, this.parsers), e3[i3] = true;
50096       this.file.close && this.file.close(), g2("Unknown file format");
50097     }
50098     async parse() {
50099       let { output: e3, errors: t2 } = this;
50100       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);
50101     }
50102     async executeParsers() {
50103       let { output: e3 } = this;
50104       await this.fileParser.parse();
50105       let t2 = Object.values(this.parsers).map(async (t3) => {
50106         let i3 = await t3.parse();
50107         t3.assignToOutput(e3, i3);
50108       });
50109       this.options.silentErrors && (t2 = t2.map((e4) => e4.catch(this.pushToErrors))), await Promise.all(t2);
50110     }
50111     async extractThumbnail() {
50112       this.setup();
50113       let { options: e3, file: t2 } = this, i3 = T.get("tiff", e3);
50114       var n3;
50115       if (t2.tiff ? n3 = { start: 0, type: "tiff" } : t2.jpeg && (n3 = await this.fileParser.getOrFindSegment("tiff")), void 0 === n3)
50116         return;
50117       let s2 = await this.fileParser.ensureSegmentChunk(n3), r2 = this.parsers.tiff = new i3(s2, e3, t2), a2 = await r2.extractThumbnail();
50118       return t2.close && t2.close(), a2;
50119     }
50120   };
50121   async function ie(e3, t2) {
50122     let i3 = new te(t2);
50123     return await i3.read(e3), i3.parse();
50124   }
50125   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 });
50126   var se = class {
50127     constructor(e3, t2, i3) {
50128       c(this, "errors", []), c(this, "ensureSegmentChunk", async (e4) => {
50129         let t3 = e4.start, i4 = e4.size || 65536;
50130         if (this.file.chunked)
50131           if (this.file.available(t3, i4))
50132             e4.chunk = this.file.subarray(t3, i4);
50133           else
50134             try {
50135               e4.chunk = await this.file.readChunk(t3, i4);
50136             } catch (t4) {
50137               g2(`Couldn't read segment: ${JSON.stringify(e4)}. ${t4.message}`);
50138             }
50139         else
50140           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));
50141         return e4.chunk;
50142       }), this.extendOptions && this.extendOptions(e3), this.options = e3, this.file = t2, this.parsers = i3;
50143     }
50144     injectSegment(e3, t2) {
50145       this.options[e3].enabled && this.createParser(e3, t2);
50146     }
50147     createParser(e3, t2) {
50148       let i3 = new (T.get(e3))(t2, this.options, this.file);
50149       return this.parsers[e3] = i3;
50150     }
50151     createParsers(e3) {
50152       for (let t2 of e3) {
50153         let { type: e4, chunk: i3 } = t2, n3 = this.options[e4];
50154         if (n3 && n3.enabled) {
50155           let t3 = this.parsers[e4];
50156           t3 && t3.append || t3 || this.createParser(e4, i3);
50157         }
50158       }
50159     }
50160     async readSegments(e3) {
50161       let t2 = e3.map(this.ensureSegmentChunk);
50162       await Promise.all(t2);
50163     }
50164   };
50165   var re2 = class {
50166     static findPosition(e3, t2) {
50167       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;
50168       return { offset: t2, length: i3, headerLength: n3, start: s2, size: r2, end: s2 + r2 };
50169     }
50170     static parse(e3, t2 = {}) {
50171       return new this(e3, new q({ [this.type]: t2 }), e3).parse();
50172     }
50173     normalizeInput(e3) {
50174       return e3 instanceof I ? e3 : new I(e3);
50175     }
50176     constructor(e3, t2 = {}, i3) {
50177       c(this, "errors", []), c(this, "raw", /* @__PURE__ */ new Map()), c(this, "handleError", (e4) => {
50178         if (!this.options.silentErrors)
50179           throw e4;
50180         this.errors.push(e4.message);
50181       }), 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;
50182     }
50183     translate() {
50184       this.canTranslate && (this.translated = this.translateBlock(this.raw, this.type));
50185     }
50186     get output() {
50187       return this.translated ? this.translated : this.raw ? Object.fromEntries(this.raw) : void 0;
50188     }
50189     translateBlock(e3, t2) {
50190       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 = {};
50191       for (let [t3, r3] of e3)
50192         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;
50193       return h2;
50194     }
50195     translateValue(e3, t2) {
50196       return t2[e3] || t2.DEFAULT || e3;
50197     }
50198     assignToOutput(e3, t2) {
50199       this.assignObjectToOutput(e3, this.constructor.type, t2);
50200     }
50201     assignObjectToOutput(e3, t2, i3) {
50202       if (this.globalOptions.mergeOutput)
50203         return Object.assign(e3, i3);
50204       e3[t2] ? Object.assign(e3[t2], i3) : e3[t2] = i3;
50205     }
50206   };
50207   c(re2, "headerLength", 4), c(re2, "type", void 0), c(re2, "multiSegment", false), c(re2, "canHandle", () => false);
50208   function ae(e3) {
50209     return 192 === e3 || 194 === e3 || 196 === e3 || 219 === e3 || 221 === e3 || 218 === e3 || 254 === e3;
50210   }
50211   function oe(e3) {
50212     return e3 >= 224 && e3 <= 239;
50213   }
50214   function le(e3, t2, i3) {
50215     for (let [n3, s2] of T)
50216       if (s2.canHandle(e3, t2, i3))
50217         return n3;
50218   }
50219   var he = class extends se {
50220     constructor(...e3) {
50221       super(...e3), c(this, "appSegments", []), c(this, "jpegSegments", []), c(this, "unknownSegments", []);
50222     }
50223     static canHandle(e3, t2) {
50224       return 65496 === t2;
50225     }
50226     async parse() {
50227       await this.findAppSegments(), await this.readSegments(this.appSegments), this.mergeMultiSegments(), this.createParsers(this.mergedAppSegments || this.appSegments);
50228     }
50229     setupSegmentFinderArgs(e3) {
50230       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;
50231     }
50232     async findAppSegments(e3 = 0, t2) {
50233       this.setupSegmentFinderArgs(t2);
50234       let { file: i3, findAll: n3, wanted: s2, remaining: r2 } = this;
50235       if (!n3 && this.file.chunked && (n3 = Array.from(s2).some((e4) => {
50236         let t3 = T.get(e4), i4 = this.options[e4];
50237         return t3.multiSegment && i4.multiSegment;
50238       }), n3 && await this.file.readWhole()), e3 = this.findAppSegmentsInRange(e3, i3.byteLength), !this.options.onlyTiff && i3.chunked) {
50239         let t3 = false;
50240         for (; r2.size > 0 && !t3 && (i3.canReadNextChunk || this.unfinishedMultiSegment); ) {
50241           let { nextChunkOffset: n4 } = i3, s3 = this.appSegments.some((e4) => !this.file.available(e4.offset || e4.start, e4.length || e4.size));
50242           if (t3 = e3 > n4 && !s3 ? !await i3.readNextChunk(e3) : !await i3.readNextChunk(n4), void 0 === (e3 = this.findAppSegmentsInRange(e3, i3.byteLength)))
50243             return;
50244         }
50245       }
50246     }
50247     findAppSegmentsInRange(e3, t2) {
50248       t2 -= 2;
50249       let i3, n3, s2, r2, a2, o2, { file: l2, findAll: h2, wanted: u2, remaining: c2, options: f3 } = this;
50250       for (; e3 < t2; e3++)
50251         if (255 === l2.getUint8(e3)) {
50252           if (i3 = l2.getUint8(e3 + 1), oe(i3)) {
50253             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)))
50254               break;
50255             f3.recordUnknownSegments && (a2 = re2.findPosition(l2, e3), a2.marker = i3, this.unknownSegments.push(a2)), e3 += n3 + 1;
50256           } else if (ae(i3)) {
50257             if (n3 = l2.getUint16(e3 + 2), 218 === i3 && false !== f3.stopAfterSos)
50258               return;
50259             f3.recordJpegSegments && this.jpegSegments.push({ offset: e3, length: n3, marker: i3 }), e3 += n3 + 1;
50260           }
50261         }
50262       return e3;
50263     }
50264     mergeMultiSegments() {
50265       if (!this.appSegments.some((e4) => e4.multiSegment))
50266         return;
50267       let e3 = function(e4, t2) {
50268         let i3, n3, s2, r2 = /* @__PURE__ */ new Map();
50269         for (let a2 = 0; a2 < e4.length; a2++)
50270           i3 = e4[a2], n3 = i3[t2], r2.has(n3) ? s2 = r2.get(n3) : r2.set(n3, s2 = []), s2.push(i3);
50271         return Array.from(r2);
50272       }(this.appSegments, "type");
50273       this.mergedAppSegments = e3.map(([e4, t2]) => {
50274         let i3 = T.get(e4, this.options);
50275         if (i3.handleMultiSegments) {
50276           return { type: e4, chunk: i3.handleMultiSegments(t2) };
50277         }
50278         return t2[0];
50279       });
50280     }
50281     getSegment(e3) {
50282       return this.appSegments.find((t2) => t2.type === e3);
50283     }
50284     async getOrFindSegment(e3) {
50285       let t2 = this.getSegment(e3);
50286       return void 0 === t2 && (await this.findAppSegments(0, [e3]), t2 = this.getSegment(e3)), t2;
50287     }
50288   };
50289   c(he, "type", "jpeg"), w.set("jpeg", he);
50290   var ue = [void 0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 4];
50291   var ce = class extends re2 {
50292     parseHeader() {
50293       var e3 = this.chunk.getUint16();
50294       18761 === e3 ? this.le = true : 19789 === e3 && (this.le = false), this.chunk.le = this.le, this.headerParsed = true;
50295     }
50296     parseTags(e3, t2, i3 = /* @__PURE__ */ new Map()) {
50297       let { pick: n3, skip: s2 } = this.options[t2];
50298       n3 = new Set(n3);
50299       let r2 = n3.size > 0, a2 = 0 === s2.size, o2 = this.chunk.getUint16(e3);
50300       e3 += 2;
50301       for (let l2 = 0; l2 < o2; l2++) {
50302         let o3 = this.chunk.getUint16(e3);
50303         if (r2) {
50304           if (n3.has(o3) && (i3.set(o3, this.parseTag(e3, o3, t2)), n3.delete(o3), 0 === n3.size))
50305             break;
50306         } else
50307           !a2 && s2.has(o3) || i3.set(o3, this.parseTag(e3, o3, t2));
50308         e3 += 12;
50309       }
50310       return i3;
50311     }
50312     parseTag(e3, t2, i3) {
50313       let { chunk: n3 } = this, s2 = n3.getUint16(e3 + 2), r2 = n3.getUint32(e3 + 4), a2 = ue[s2];
50314       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)
50315         return n3.getUint8Array(e3, r2);
50316       if (2 === s2)
50317         return m(n3.getString(e3, r2));
50318       if (7 === s2)
50319         return n3.getUint8Array(e3, r2);
50320       if (1 === r2)
50321         return this.parseTagValue(s2, e3);
50322       {
50323         let t3 = new (function(e4) {
50324           switch (e4) {
50325             case 1:
50326               return Uint8Array;
50327             case 3:
50328               return Uint16Array;
50329             case 4:
50330               return Uint32Array;
50331             case 5:
50332               return Array;
50333             case 6:
50334               return Int8Array;
50335             case 8:
50336               return Int16Array;
50337             case 9:
50338               return Int32Array;
50339             case 10:
50340               return Array;
50341             case 11:
50342               return Float32Array;
50343             case 12:
50344               return Float64Array;
50345             default:
50346               return Array;
50347           }
50348         }(s2))(r2), i4 = a2;
50349         for (let n4 = 0; n4 < r2; n4++)
50350           t3[n4] = this.parseTagValue(s2, e3), e3 += i4;
50351         return t3;
50352       }
50353     }
50354     parseTagValue(e3, t2) {
50355       let { chunk: i3 } = this;
50356       switch (e3) {
50357         case 1:
50358           return i3.getUint8(t2);
50359         case 3:
50360           return i3.getUint16(t2);
50361         case 4:
50362           return i3.getUint32(t2);
50363         case 5:
50364           return i3.getUint32(t2) / i3.getUint32(t2 + 4);
50365         case 6:
50366           return i3.getInt8(t2);
50367         case 8:
50368           return i3.getInt16(t2);
50369         case 9:
50370           return i3.getInt32(t2);
50371         case 10:
50372           return i3.getInt32(t2) / i3.getInt32(t2 + 4);
50373         case 11:
50374           return i3.getFloat(t2);
50375         case 12:
50376           return i3.getDouble(t2);
50377         case 13:
50378           return i3.getUint32(t2);
50379         default:
50380           g2(`Invalid tiff type ${e3}`);
50381       }
50382     }
50383   };
50384   var fe = class extends ce {
50385     static canHandle(e3, t2) {
50386       return 225 === e3.getUint8(t2 + 1) && 1165519206 === e3.getUint32(t2 + 4) && 0 === e3.getUint16(t2 + 8);
50387     }
50388     async parse() {
50389       this.parseHeader();
50390       let { options: e3 } = this;
50391       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();
50392     }
50393     safeParse(e3) {
50394       let t2 = this[e3]();
50395       return void 0 !== t2.catch && (t2 = t2.catch(this.handleError)), t2;
50396     }
50397     findIfd0Offset() {
50398       void 0 === this.ifd0Offset && (this.ifd0Offset = this.chunk.getUint32(4));
50399     }
50400     findIfd1Offset() {
50401       if (void 0 === this.ifd1Offset) {
50402         this.findIfd0Offset();
50403         let e3 = this.chunk.getUint16(this.ifd0Offset), t2 = this.ifd0Offset + 2 + 12 * e3;
50404         this.ifd1Offset = this.chunk.getUint32(t2);
50405       }
50406     }
50407     parseBlock(e3, t2) {
50408       let i3 = /* @__PURE__ */ new Map();
50409       return this[t2] = i3, this.parseTags(e3, t2, i3), i3;
50410     }
50411     async parseIfd0Block() {
50412       if (this.ifd0)
50413         return;
50414       let { file: e3 } = this;
50415       this.findIfd0Offset(), this.ifd0Offset < 8 && g2("Malformed EXIF data"), !e3.chunked && this.ifd0Offset > e3.byteLength && g2(`IFD0 offset points to outside of file.
50416 this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e3.byteLength}`), e3.tiff && await e3.ensureChunk(this.ifd0Offset, S(this.options));
50417       let t2 = this.parseBlock(this.ifd0Offset, "ifd0");
50418       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;
50419     }
50420     async parseExifBlock() {
50421       if (this.exif)
50422         return;
50423       if (this.ifd0 || await this.parseIfd0Block(), void 0 === this.exifOffset)
50424         return;
50425       this.file.tiff && await this.file.ensureChunk(this.exifOffset, S(this.options));
50426       let e3 = this.parseBlock(this.exifOffset, "exif");
50427       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;
50428     }
50429     unpack(e3, t2) {
50430       let i3 = e3.get(t2);
50431       i3 && 1 === i3.length && e3.set(t2, i3[0]);
50432     }
50433     async parseGpsBlock() {
50434       if (this.gps)
50435         return;
50436       if (this.ifd0 || await this.parseIfd0Block(), void 0 === this.gpsOffset)
50437         return;
50438       let e3 = this.parseBlock(this.gpsOffset, "gps");
50439       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;
50440     }
50441     async parseInteropBlock() {
50442       if (!this.interop && (this.ifd0 || await this.parseIfd0Block(), void 0 !== this.interopOffset || this.exif || await this.parseExifBlock(), void 0 !== this.interopOffset))
50443         return this.parseBlock(this.interopOffset, "interop");
50444     }
50445     async parseThumbnailBlock(e3 = false) {
50446       if (!this.ifd1 && !this.ifd1Parsed && (!this.options.mergeOutput || e3))
50447         return this.findIfd1Offset(), this.ifd1Offset > 0 && (this.parseBlock(this.ifd1Offset, "ifd1"), this.ifd1Parsed = true), this.ifd1;
50448     }
50449     async extractThumbnail() {
50450       if (this.headerParsed || this.parseHeader(), this.ifd1Parsed || await this.parseThumbnailBlock(true), void 0 === this.ifd1)
50451         return;
50452       let e3 = this.ifd1.get(513), t2 = this.ifd1.get(514);
50453       return this.chunk.getUint8Array(e3, t2);
50454     }
50455     get image() {
50456       return this.ifd0;
50457     }
50458     get thumbnail() {
50459       return this.ifd1;
50460     }
50461     createOutput() {
50462       let e3, t2, i3, n3 = {};
50463       for (t2 of H)
50464         if (e3 = this[t2], !p(e3))
50465           if (i3 = this.canTranslate ? this.translateBlock(e3, t2) : Object.fromEntries(e3), this.options.mergeOutput) {
50466             if ("ifd1" === t2)
50467               continue;
50468             Object.assign(n3, i3);
50469           } else
50470             n3[t2] = i3;
50471       return this.makerNote && (n3.makerNote = this.makerNote), this.userComment && (n3.userComment = this.userComment), n3;
50472     }
50473     assignToOutput(e3, t2) {
50474       if (this.globalOptions.mergeOutput)
50475         Object.assign(e3, t2);
50476       else
50477         for (let [i3, n3] of Object.entries(t2))
50478           this.assignObjectToOutput(e3, i3, n3);
50479     }
50480   };
50481   function de(e3, t2, i3, n3) {
50482     var s2 = e3 + t2 / 60 + i3 / 3600;
50483     return "S" !== n3 && "W" !== n3 || (s2 *= -1), s2;
50484   }
50485   c(fe, "type", "tiff"), c(fe, "headerLength", 10), T.set("tiff", fe);
50486   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 });
50487   var ge = { ifd0: false, ifd1: false, exif: false, gps: false, interop: false, sanitize: false, reviveValues: true, translateKeys: false, translateValues: false, mergeOutput: false };
50488   var me = Object.assign({}, ge, { firstChunkSize: 4e4, gps: [1, 2, 3, 4] });
50489   async function Se(e3) {
50490     let t2 = new te(me);
50491     await t2.read(e3);
50492     let i3 = await t2.parse();
50493     if (i3 && i3.gps) {
50494       let { latitude: e4, longitude: t3 } = i3.gps;
50495       return { latitude: e4, longitude: t3 };
50496     }
50497   }
50498   var Ce = Object.assign({}, ge, { tiff: false, ifd1: true, mergeOutput: false });
50499   async function ye(e3) {
50500     let t2 = new te(Ce);
50501     await t2.read(e3);
50502     let i3 = await t2.extractThumbnail();
50503     return i3 && a ? s.from(i3) : i3;
50504   }
50505   async function be(e3) {
50506     let t2 = await this.thumbnail(e3);
50507     if (void 0 !== t2) {
50508       let e4 = new Blob([t2]);
50509       return URL.createObjectURL(e4);
50510     }
50511   }
50512   var Ie = Object.assign({}, ge, { firstChunkSize: 4e4, ifd0: [274] });
50513   async function Pe(e3) {
50514     let t2 = new te(Ie);
50515     await t2.read(e3);
50516     let i3 = await t2.parse();
50517     if (i3 && i3.ifd0)
50518       return i3.ifd0[274];
50519   }
50520   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 } });
50521   var we = true;
50522   var Te = true;
50523   if ("object" == typeof navigator) {
50524     let e3 = navigator.userAgent;
50525     if (e3.includes("iPad") || e3.includes("iPhone")) {
50526       let t2 = e3.match(/OS (\d+)_(\d+)/);
50527       if (t2) {
50528         let [, e4, i3] = t2, n3 = Number(e4) + 0.1 * Number(i3);
50529         we = n3 < 13.4, Te = false;
50530       }
50531     } else if (e3.includes("OS X 10")) {
50532       let [, t2] = e3.match(/OS X 10[_.](\d+)/);
50533       we = Te = Number(t2) < 15;
50534     }
50535     if (e3.includes("Chrome/")) {
50536       let [, t2] = e3.match(/Chrome\/(\d+)/);
50537       we = Te = Number(t2) < 81;
50538     } else if (e3.includes("Firefox/")) {
50539       let [, t2] = e3.match(/Firefox\/(\d+)/);
50540       we = Te = Number(t2) < 77;
50541     }
50542   }
50543   async function Ae(e3) {
50544     let t2 = await Pe(e3);
50545     return Object.assign({ canvas: we, css: Te }, ke[t2]);
50546   }
50547   var De = class extends I {
50548     constructor(...e3) {
50549       super(...e3), c(this, "ranges", new Oe()), 0 !== this.byteLength && this.ranges.add(0, this.byteLength);
50550     }
50551     _tryExtend(e3, t2, i3) {
50552       if (0 === e3 && 0 === this.byteLength && i3) {
50553         let e4 = new DataView(i3.buffer || i3, i3.byteOffset, i3.byteLength);
50554         this._swapDataView(e4);
50555       } else {
50556         let i4 = e3 + t2;
50557         if (i4 > this.byteLength) {
50558           let { dataView: e4 } = this._extend(i4);
50559           this._swapDataView(e4);
50560         }
50561       }
50562     }
50563     _extend(e3) {
50564       let t2;
50565       t2 = a ? s.allocUnsafe(e3) : new Uint8Array(e3);
50566       let i3 = new DataView(t2.buffer, t2.byteOffset, t2.byteLength);
50567       return t2.set(new Uint8Array(this.buffer, this.byteOffset, this.byteLength), 0), { uintView: t2, dataView: i3 };
50568     }
50569     subarray(e3, t2, i3 = false) {
50570       return t2 = t2 || this._lengthToEnd(e3), i3 && this._tryExtend(e3, t2), this.ranges.add(e3, t2), super.subarray(e3, t2);
50571     }
50572     set(e3, t2, i3 = false) {
50573       i3 && this._tryExtend(t2, e3.byteLength, e3);
50574       let n3 = super.set(e3, t2);
50575       return this.ranges.add(t2, n3.byteLength), n3;
50576     }
50577     async ensureChunk(e3, t2) {
50578       this.chunked && (this.ranges.available(e3, t2) || await this.readChunk(e3, t2));
50579     }
50580     available(e3, t2) {
50581       return this.ranges.available(e3, t2);
50582     }
50583   };
50584   var Oe = class {
50585     constructor() {
50586       c(this, "list", []);
50587     }
50588     get length() {
50589       return this.list.length;
50590     }
50591     add(e3, t2, i3 = 0) {
50592       let n3 = e3 + t2, s2 = this.list.filter((t3) => xe(e3, t3.offset, n3) || xe(e3, t3.end, n3));
50593       if (s2.length > 0) {
50594         e3 = Math.min(e3, ...s2.map((e4) => e4.offset)), n3 = Math.max(n3, ...s2.map((e4) => e4.end)), t2 = n3 - e3;
50595         let i4 = s2.shift();
50596         i4.offset = e3, i4.length = t2, i4.end = n3, this.list = this.list.filter((e4) => !s2.includes(e4));
50597       } else
50598         this.list.push({ offset: e3, length: t2, end: n3 });
50599     }
50600     available(e3, t2) {
50601       let i3 = e3 + t2;
50602       return this.list.some((t3) => t3.offset <= e3 && i3 <= t3.end);
50603     }
50604   };
50605   function xe(e3, t2, i3) {
50606     return e3 <= t2 && t2 <= i3;
50607   }
50608   var ve = class extends De {
50609     constructor(e3, t2) {
50610       super(0), c(this, "chunksRead", 0), this.input = e3, this.options = t2;
50611     }
50612     async readWhole() {
50613       this.chunked = false, await this.readChunk(this.nextChunkOffset);
50614     }
50615     async readChunked() {
50616       this.chunked = true, await this.readChunk(0, this.options.firstChunkSize);
50617     }
50618     async readNextChunk(e3 = this.nextChunkOffset) {
50619       if (this.fullyRead)
50620         return this.chunksRead++, false;
50621       let t2 = this.options.chunkSize, i3 = await this.readChunk(e3, t2);
50622       return !!i3 && i3.byteLength === t2;
50623     }
50624     async readChunk(e3, t2) {
50625       if (this.chunksRead++, 0 !== (t2 = this.safeWrapAddress(e3, t2)))
50626         return this._readChunk(e3, t2);
50627     }
50628     safeWrapAddress(e3, t2) {
50629       return void 0 !== this.size && e3 + t2 > this.size ? Math.max(0, this.size - e3) : t2;
50630     }
50631     get nextChunkOffset() {
50632       if (0 !== this.ranges.list.length)
50633         return this.ranges.list[0].length;
50634     }
50635     get canReadNextChunk() {
50636       return this.chunksRead < this.options.chunkLimit;
50637     }
50638     get fullyRead() {
50639       return void 0 !== this.size && this.nextChunkOffset === this.size;
50640     }
50641     read() {
50642       return this.options.chunked ? this.readChunked() : this.readWhole();
50643     }
50644     close() {
50645     }
50646   };
50647   A.set("blob", class extends ve {
50648     async readWhole() {
50649       this.chunked = false;
50650       let e3 = await R(this.input);
50651       this._swapArrayBuffer(e3);
50652     }
50653     readChunked() {
50654       return this.chunked = true, this.size = this.input.size, super.readChunked();
50655     }
50656     async _readChunk(e3, t2) {
50657       let i3 = t2 ? e3 + t2 : void 0, n3 = this.input.slice(e3, i3), s2 = await R(n3);
50658       return this.set(s2, e3, true);
50659     }
50660   });
50661   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() {
50662     return we;
50663   }, get rotateCss() {
50664     return Te;
50665   }, rotation: Ae });
50666   A.set("url", class extends ve {
50667     async readWhole() {
50668       this.chunked = false;
50669       let e3 = await M(this.input);
50670       e3 instanceof ArrayBuffer ? this._swapArrayBuffer(e3) : e3 instanceof Uint8Array && this._swapBuffer(e3);
50671     }
50672     async _readChunk(e3, t2) {
50673       let i3 = t2 ? e3 + t2 - 1 : void 0, n3 = this.options.httpHeaders || {};
50674       (e3 || i3) && (n3.range = `bytes=${[e3, i3].join("-")}`);
50675       let s2 = await h(this.input, { headers: n3 }), r2 = await s2.arrayBuffer(), a2 = r2.byteLength;
50676       if (416 !== s2.status)
50677         return a2 !== t2 && (this.size = e3 + a2), this.set(r2, e3, true);
50678     }
50679   });
50680   I.prototype.getUint64 = function(e3) {
50681     let t2 = this.getUint32(e3), i3 = this.getUint32(e3 + 4);
50682     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.");
50683   };
50684   var Re = class extends se {
50685     parseBoxes(e3 = 0) {
50686       let t2 = [];
50687       for (; e3 < this.file.byteLength - 4; ) {
50688         let i3 = this.parseBoxHead(e3);
50689         if (t2.push(i3), 0 === i3.length)
50690           break;
50691         e3 += i3.length;
50692       }
50693       return t2;
50694     }
50695     parseSubBoxes(e3) {
50696       e3.boxes = this.parseBoxes(e3.start);
50697     }
50698     findBox(e3, t2) {
50699       return void 0 === e3.boxes && this.parseSubBoxes(e3), e3.boxes.find((e4) => e4.kind === t2);
50700     }
50701     parseBoxHead(e3) {
50702       let t2 = this.file.getUint32(e3), i3 = this.file.getString(e3 + 4, 4), n3 = e3 + 8;
50703       return 1 === t2 && (t2 = this.file.getUint64(e3 + 8), n3 += 8), { offset: e3, length: t2, kind: i3, start: n3 };
50704     }
50705     parseBoxFullHead(e3) {
50706       if (void 0 !== e3.version)
50707         return;
50708       let t2 = this.file.getUint32(e3.start);
50709       e3.version = t2 >> 24, e3.start += 4;
50710     }
50711   };
50712   var Le = class extends Re {
50713     static canHandle(e3, t2) {
50714       if (0 !== t2)
50715         return false;
50716       let i3 = e3.getUint16(2);
50717       if (i3 > 50)
50718         return false;
50719       let n3 = 16, s2 = [];
50720       for (; n3 < i3; )
50721         s2.push(e3.getString(n3, 4)), n3 += 4;
50722       return s2.includes(this.type);
50723     }
50724     async parse() {
50725       let e3 = this.file.getUint32(0), t2 = this.parseBoxHead(e3);
50726       for (; "meta" !== t2.kind; )
50727         e3 += t2.length, await this.file.ensureChunk(e3, 16), t2 = this.parseBoxHead(e3);
50728       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);
50729     }
50730     async registerSegment(e3, t2, i3) {
50731       await this.file.ensureChunk(t2, i3);
50732       let n3 = this.file.subarray(t2, i3);
50733       this.createParser(e3, n3);
50734     }
50735     async findIcc(e3) {
50736       let t2 = this.findBox(e3, "iprp");
50737       if (void 0 === t2)
50738         return;
50739       let i3 = this.findBox(t2, "ipco");
50740       if (void 0 === i3)
50741         return;
50742       let n3 = this.findBox(i3, "colr");
50743       void 0 !== n3 && await this.registerSegment("icc", n3.offset + 12, n3.length);
50744     }
50745     async findExif(e3) {
50746       let t2 = this.findBox(e3, "iinf");
50747       if (void 0 === t2)
50748         return;
50749       let i3 = this.findBox(e3, "iloc");
50750       if (void 0 === i3)
50751         return;
50752       let n3 = this.findExifLocIdInIinf(t2), s2 = this.findExtentInIloc(i3, n3);
50753       if (void 0 === s2)
50754         return;
50755       let [r2, a2] = s2;
50756       await this.file.ensureChunk(r2, a2);
50757       let o2 = 4 + this.file.getUint32(r2);
50758       r2 += o2, a2 -= o2, await this.registerSegment("tiff", r2, a2);
50759     }
50760     findExifLocIdInIinf(e3) {
50761       this.parseBoxFullHead(e3);
50762       let t2, i3, n3, s2, r2 = e3.start, a2 = this.file.getUint16(r2);
50763       for (r2 += 2; a2--; ) {
50764         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))
50765           return this.file.getUintBytes(i3, n3);
50766         r2 += t2.length;
50767       }
50768     }
50769     get8bits(e3) {
50770       let t2 = this.file.getUint8(e3);
50771       return [t2 >> 4, 15 & t2];
50772     }
50773     findExtentInIloc(e3, t2) {
50774       this.parseBoxFullHead(e3);
50775       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);
50776       for (i3 += u2; c2--; ) {
50777         let e4 = this.file.getUintBytes(i3, o2);
50778         i3 += o2 + l2 + 2 + r2;
50779         let u3 = this.file.getUint16(i3);
50780         if (i3 += 2, e4 === t2)
50781           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)];
50782         i3 += u3 * h2;
50783       }
50784     }
50785   };
50786   var Ue = class extends Le {
50787   };
50788   c(Ue, "type", "heic");
50789   var Fe = class extends Le {
50790   };
50791   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" }]]);
50792   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" }]]);
50793   var Be = { 1: "No absolute unit of measurement", 2: "Inch", 3: "Centimeter" };
50794   Ee.set(37392, Be), Ee.set(41488, Be);
50795   var Ne = { 0: "Normal", 1: "Low", 2: "High" };
50796   function Ge(e3) {
50797     return "object" == typeof e3 && void 0 !== e3.length ? e3[0] : e3;
50798   }
50799   function Ve(e3) {
50800     let t2 = Array.from(e3).slice(1);
50801     return t2[1] > 15 && (t2 = t2.map((e4) => String.fromCharCode(e4))), "0" !== t2[2] && 0 !== t2[2] || t2.pop(), t2.join(".");
50802   }
50803   function ze(e3) {
50804     if ("string" == typeof e3) {
50805       var [t2, i3, n3, s2, r2, a2] = e3.trim().split(/[-: ]/g).map(Number), o2 = new Date(t2, i3 - 1, n3);
50806       return Number.isNaN(s2) || Number.isNaN(r2) || Number.isNaN(a2) || (o2.setHours(s2), o2.setMinutes(r2), o2.setSeconds(a2)), Number.isNaN(+o2) ? e3 : o2;
50807     }
50808   }
50809   function He(e3) {
50810     if ("string" == typeof e3)
50811       return e3;
50812     let t2 = [];
50813     if (0 === e3[1] && 0 === e3[e3.length - 1])
50814       for (let i3 = 0; i3 < e3.length; i3 += 2)
50815         t2.push(je(e3[i3 + 1], e3[i3]));
50816     else
50817       for (let i3 = 0; i3 < e3.length; i3 += 2)
50818         t2.push(je(e3[i3], e3[i3 + 1]));
50819     return m(String.fromCodePoint(...t2));
50820   }
50821   function je(e3, t2) {
50822     return e3 << 8 | t2;
50823   }
50824   Ee.set(41992, Ne), Ee.set(41993, Ne), Ee.set(41994, Ne), U(N, ["ifd0", "ifd1"], [[50827, function(e3) {
50825     return "string" != typeof e3 ? b(e3) : e3;
50826   }], [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(":")]]);
50827   var We = class extends re2 {
50828     static canHandle(e3, t2) {
50829       return 225 === e3.getUint8(t2 + 1) && 1752462448 === e3.getUint32(t2 + 4) && "http://ns.adobe.com/" === e3.getString(t2 + 4, "http://ns.adobe.com/".length);
50830     }
50831     static headerLength(e3, t2) {
50832       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;
50833     }
50834     static findPosition(e3, t2) {
50835       let i3 = super.findPosition(e3, t2);
50836       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;
50837     }
50838     static handleMultiSegments(e3) {
50839       return e3.map((e4) => e4.chunk.getString()).join("");
50840     }
50841     normalizeInput(e3) {
50842       return "string" == typeof e3 ? e3 : I.from(e3).getString();
50843     }
50844     parse(e3 = this.chunk) {
50845       if (!this.localOptions.parse)
50846         return e3;
50847       e3 = function(e4) {
50848         let t3 = {}, i4 = {};
50849         for (let e6 of Ze)
50850           t3[e6] = [], i4[e6] = 0;
50851         return e4.replace(et, (e6, n4, s2) => {
50852           if ("<" === n4) {
50853             let n5 = ++i4[s2];
50854             return t3[s2].push(n5), `${e6}#${n5}`;
50855           }
50856           return `${e6}#${t3[s2].pop()}`;
50857         });
50858       }(e3);
50859       let t2 = Xe.findAll(e3, "rdf", "Description");
50860       0 === t2.length && t2.push(new Xe("rdf", "Description", void 0, e3));
50861       let i3, n3 = {};
50862       for (let e4 of t2)
50863         for (let t3 of e4.properties)
50864           i3 = Je(t3.ns, n3), _e(t3, i3);
50865       return function(e4) {
50866         let t3;
50867         for (let i4 in e4)
50868           t3 = e4[i4] = f2(e4[i4]), void 0 === t3 && delete e4[i4];
50869         return f2(e4);
50870       }(n3);
50871     }
50872     assignToOutput(e3, t2) {
50873       if (this.localOptions.parse)
50874         for (let [i3, n3] of Object.entries(t2))
50875           switch (i3) {
50876             case "tiff":
50877               this.assignObjectToOutput(e3, "ifd0", n3);
50878               break;
50879             case "exif":
50880               this.assignObjectToOutput(e3, "exif", n3);
50881               break;
50882             case "xmlns":
50883               break;
50884             default:
50885               this.assignObjectToOutput(e3, i3, n3);
50886           }
50887       else
50888         e3.xmp = t2;
50889     }
50890   };
50891   c(We, "type", "xmp"), c(We, "multiSegment", true), T.set("xmp", We);
50892   var Ke = class _Ke {
50893     static findAll(e3) {
50894       return qe(e3, /([a-zA-Z0-9-]+):([a-zA-Z0-9-]+)=("[^"]*"|'[^']*')/gm).map(_Ke.unpackMatch);
50895     }
50896     static unpackMatch(e3) {
50897       let t2 = e3[1], i3 = e3[2], n3 = e3[3].slice(1, -1);
50898       return n3 = Qe(n3), new _Ke(t2, i3, n3);
50899     }
50900     constructor(e3, t2, i3) {
50901       this.ns = e3, this.name = t2, this.value = i3;
50902     }
50903     serialize() {
50904       return this.value;
50905     }
50906   };
50907   var Xe = class _Xe {
50908     static findAll(e3, t2, i3) {
50909       if (void 0 !== t2 || void 0 !== i3) {
50910         t2 = t2 || "[\\w\\d-]+", i3 = i3 || "[\\w\\d-]+";
50911         var n3 = new RegExp(`<(${t2}):(${i3})(#\\d+)?((\\s+?[\\w\\d-:]+=("[^"]*"|'[^']*'))*\\s*)(\\/>|>([\\s\\S]*?)<\\/\\1:\\2\\3>)`, "gm");
50912       } else
50913         n3 = /<([\w\d-]+):([\w\d-]+)(#\d+)?((\s+?[\w\d-:]+=("[^"]*"|'[^']*'))*\s*)(\/>|>([\s\S]*?)<\/\1:\2\3>)/gm;
50914       return qe(e3, n3).map(_Xe.unpackMatch);
50915     }
50916     static unpackMatch(e3) {
50917       let t2 = e3[1], i3 = e3[2], n3 = e3[4], s2 = e3[8];
50918       return new _Xe(t2, i3, n3, s2);
50919     }
50920     constructor(e3, t2, i3, n3) {
50921       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];
50922     }
50923     get isPrimitive() {
50924       return void 0 !== this.value && 0 === this.attrs.length && 0 === this.children.length;
50925     }
50926     get isListContainer() {
50927       return 1 === this.children.length && this.children[0].isList;
50928     }
50929     get isList() {
50930       let { ns: e3, name: t2 } = this;
50931       return "rdf" === e3 && ("Seq" === t2 || "Bag" === t2 || "Alt" === t2);
50932     }
50933     get isListItem() {
50934       return "rdf" === this.ns && "li" === this.name;
50935     }
50936     serialize() {
50937       if (0 === this.properties.length && void 0 === this.value)
50938         return;
50939       if (this.isPrimitive)
50940         return this.value;
50941       if (this.isListContainer)
50942         return this.children[0].serialize();
50943       if (this.isList)
50944         return $e(this.children.map(Ye));
50945       if (this.isListItem && 1 === this.children.length && 0 === this.attrs.length)
50946         return this.children[0].serialize();
50947       let e3 = {};
50948       for (let t2 of this.properties)
50949         _e(t2, e3);
50950       return void 0 !== this.value && (e3.value = this.value), f2(e3);
50951     }
50952   };
50953   function _e(e3, t2) {
50954     let i3 = e3.serialize();
50955     void 0 !== i3 && (t2[e3.name] = i3);
50956   }
50957   var Ye = (e3) => e3.serialize();
50958   var $e = (e3) => 1 === e3.length ? e3[0] : e3;
50959   var Je = (e3, t2) => t2[e3] ? t2[e3] : t2[e3] = {};
50960   function qe(e3, t2) {
50961     let i3, n3 = [];
50962     if (!e3)
50963       return n3;
50964     for (; null !== (i3 = t2.exec(e3)); )
50965       n3.push(i3);
50966     return n3;
50967   }
50968   function Qe(e3) {
50969     if (function(e4) {
50970       return null == e4 || "null" === e4 || "undefined" === e4 || "" === e4 || "" === e4.trim();
50971     }(e3))
50972       return;
50973     let t2 = Number(e3);
50974     if (!Number.isNaN(t2))
50975       return t2;
50976     let i3 = e3.toLowerCase();
50977     return "true" === i3 || "false" !== i3 && e3.trim();
50978   }
50979   var Ze = ["rdf:li", "rdf:Seq", "rdf:Bag", "rdf:Alt", "rdf:Description"];
50980   var et = new RegExp(`(<|\\/)(${Ze.join("|")})`, "g");
50981   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() {
50982     return we;
50983   }, get rotateCss() {
50984     return Te;
50985   }, rotation: Ae });
50986   var at = l("fs", (e3) => e3.promises);
50987   A.set("fs", class extends ve {
50988     async readWhole() {
50989       this.chunked = false, this.fs = await at;
50990       let e3 = await this.fs.readFile(this.input);
50991       this._swapBuffer(e3);
50992     }
50993     async readChunked() {
50994       this.chunked = true, this.fs = await at, await this.open(), await this.readChunk(0, this.options.firstChunkSize);
50995     }
50996     async open() {
50997       void 0 === this.fh && (this.fh = await this.fs.open(this.input, "r"), this.size = (await this.fh.stat(this.input)).size);
50998     }
50999     async _readChunk(e3, t2) {
51000       void 0 === this.fh && await this.open(), e3 + t2 > this.size && (t2 = this.size - e3);
51001       var i3 = this.subarray(e3, t2, true);
51002       return await this.fh.read(i3.dataView, 0, t2, e3), i3;
51003     }
51004     async close() {
51005       if (this.fh) {
51006         let e3 = this.fh;
51007         this.fh = void 0, await e3.close();
51008       }
51009     }
51010   });
51011   A.set("base64", class extends ve {
51012     constructor(...e3) {
51013       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);
51014     }
51015     async _readChunk(e3, t2) {
51016       let i3, n3, r2 = this.input;
51017       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);
51018       let o2 = e3 + t2, l2 = i3 + 4 * Math.ceil(o2 / 3);
51019       r2 = r2.slice(i3, l2);
51020       let h2 = Math.min(t2, this.size - e3);
51021       if (a) {
51022         let t3 = s.from(r2, "base64").slice(n3, n3 + h2);
51023         return this.set(t3, e3, true);
51024       }
51025       {
51026         let t3 = this.subarray(e3, h2, true), i4 = atob(r2), s2 = t3.toUint8();
51027         for (let e4 = 0; e4 < h2; e4++)
51028           s2[e4] = i4.charCodeAt(n3 + e4);
51029         return t3;
51030       }
51031     }
51032   });
51033   var ot = class extends se {
51034     static canHandle(e3, t2) {
51035       return 18761 === t2 || 19789 === t2;
51036     }
51037     extendOptions(e3) {
51038       let { ifd0: t2, xmp: i3, iptc: n3, icc: s2 } = e3;
51039       i3.enabled && t2.deps.add(700), n3.enabled && t2.deps.add(33723), s2.enabled && t2.deps.add(34675), t2.finalizeFilters();
51040     }
51041     async parse() {
51042       let { tiff: e3, xmp: t2, iptc: i3, icc: n3 } = this.options;
51043       if (e3.enabled || t2.enabled || i3.enabled || n3.enabled) {
51044         let e4 = Math.max(S(this.options), this.options.chunkSize);
51045         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");
51046       }
51047     }
51048     adaptTiffPropAsSegment(e3) {
51049       if (this.parsers.tiff[e3]) {
51050         let t2 = this.parsers.tiff[e3];
51051         this.injectSegment(e3, t2);
51052       }
51053     }
51054   };
51055   c(ot, "type", "tiff"), w.set("tiff", ot);
51056   var lt = l("zlib");
51057   var ht = ["ihdr", "iccp", "text", "itxt", "exif"];
51058   var ut = class extends se {
51059     constructor(...e3) {
51060       super(...e3), c(this, "catchError", (e4) => this.errors.push(e4)), c(this, "metaChunks", []), c(this, "unknownChunks", []);
51061     }
51062     static canHandle(e3, t2) {
51063       return 35152 === t2 && 2303741511 === e3.getUint32(0) && 218765834 === e3.getUint32(4);
51064     }
51065     async parse() {
51066       let { file: e3 } = this;
51067       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);
51068     }
51069     async findPngChunksInRange(e3, t2) {
51070       let { file: i3 } = this;
51071       for (; e3 < t2; ) {
51072         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 };
51073         ht.includes(s2) ? this.metaChunks.push(a2) : this.unknownChunks.push(a2), e3 += r2;
51074       }
51075     }
51076     parseTextChunks() {
51077       let e3 = this.metaChunks.filter((e4) => "text" === e4.type);
51078       for (let t2 of e3) {
51079         let [e4, i3] = this.file.getString(t2.start, t2.size).split("\0");
51080         this.injectKeyValToIhdr(e4, i3);
51081       }
51082     }
51083     injectKeyValToIhdr(e3, t2) {
51084       let i3 = this.parsers.ihdr;
51085       i3 && i3.raw.set(e3, t2);
51086     }
51087     findIhdr() {
51088       let e3 = this.metaChunks.find((e4) => "ihdr" === e4.type);
51089       e3 && false !== this.options.ihdr.enabled && this.createParser("ihdr", e3.chunk);
51090     }
51091     async findExif() {
51092       let e3 = this.metaChunks.find((e4) => "exif" === e4.type);
51093       e3 && this.injectSegment("tiff", e3.chunk);
51094     }
51095     async findXmp() {
51096       let e3 = this.metaChunks.filter((e4) => "itxt" === e4.type);
51097       for (let t2 of e3) {
51098         "XML:com.adobe.xmp" === t2.chunk.getString(0, "XML:com.adobe.xmp".length) && this.injectSegment("xmp", t2.chunk);
51099       }
51100     }
51101     async findIcc() {
51102       let e3 = this.metaChunks.find((e4) => "iccp" === e4.type);
51103       if (!e3)
51104         return;
51105       let { chunk: t2 } = e3, i3 = t2.getUint8Array(0, 81), s2 = 0;
51106       for (; s2 < 80 && 0 !== i3[s2]; )
51107         s2++;
51108       let r2 = s2 + 2, a2 = t2.getString(0, s2);
51109       if (this.injectKeyValToIhdr("ProfileName", a2), n2) {
51110         let e4 = await lt, i4 = t2.getUint8Array(r2);
51111         i4 = e4.inflateSync(i4), this.injectSegment("icc", i4);
51112       }
51113     }
51114   };
51115   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"]]);
51116   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"]];
51117   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" }]]);
51118   var ft = class extends re2 {
51119     static canHandle(e3, t2) {
51120       return 224 === e3.getUint8(t2 + 1) && 1246120262 === e3.getUint32(t2 + 4) && 0 === e3.getUint8(t2 + 8);
51121     }
51122     parse() {
51123       return this.parseTags(), this.translate(), this.output;
51124     }
51125     parseTags() {
51126       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)]]);
51127     }
51128   };
51129   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"]]);
51130   var dt = class extends re2 {
51131     parse() {
51132       return this.parseTags(), this.translate(), this.output;
51133     }
51134     parseTags() {
51135       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)]);
51136     }
51137   };
51138   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" }]]);
51139   var pt = class extends re2 {
51140     static canHandle(e3, t2) {
51141       return 226 === e3.getUint8(t2 + 1) && 1229144927 === e3.getUint32(t2 + 4);
51142     }
51143     static findPosition(e3, t2) {
51144       let i3 = super.findPosition(e3, t2);
51145       return i3.chunkNumber = e3.getUint8(t2 + 16), i3.chunkCount = e3.getUint8(t2 + 17), i3.multiSegment = i3.chunkCount > 1, i3;
51146     }
51147     static handleMultiSegments(e3) {
51148       return function(e4) {
51149         let t2 = function(e6) {
51150           let t3 = e6[0].constructor, i3 = 0;
51151           for (let t4 of e6)
51152             i3 += t4.length;
51153           let n3 = new t3(i3), s2 = 0;
51154           for (let t4 of e6)
51155             n3.set(t4, s2), s2 += t4.length;
51156           return n3;
51157         }(e4.map((e6) => e6.chunk.toUint8()));
51158         return new I(t2);
51159       }(e3);
51160     }
51161     parse() {
51162       return this.raw = /* @__PURE__ */ new Map(), this.parseHeader(), this.parseTags(), this.translate(), this.output;
51163     }
51164     parseHeader() {
51165       let { raw: e3 } = this;
51166       this.chunk.byteLength < 84 && g2("ICC header is too short");
51167       for (let [t2, i3] of Object.entries(gt)) {
51168         t2 = parseInt(t2, 10);
51169         let n3 = i3(this.chunk, t2);
51170         "\0\0\0\0" !== n3 && e3.set(t2, n3);
51171       }
51172     }
51173     parseTags() {
51174       let e3, t2, i3, n3, s2, { raw: r2 } = this, a2 = this.chunk.getUint32(128), o2 = 132, l2 = this.chunk.byteLength;
51175       for (; a2--; ) {
51176         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)
51177           return void console.warn("reached the end of the first ICC chunk. Enable options.tiff.multiSegment to read all ICC segments.");
51178         s2 = this.parseTag(n3, t2, i3), void 0 !== s2 && "\0\0\0\0" !== s2 && r2.set(e3, s2), o2 += 12;
51179       }
51180     }
51181     parseTag(e3, t2, i3) {
51182       switch (e3) {
51183         case "desc":
51184           return this.parseDesc(t2);
51185         case "mluc":
51186           return this.parseMluc(t2);
51187         case "text":
51188           return this.parseText(t2, i3);
51189         case "sig ":
51190           return this.parseSig(t2);
51191       }
51192       if (!(t2 + i3 > this.chunk.byteLength))
51193         return this.chunk.getUint8Array(t2, i3);
51194     }
51195     parseDesc(e3) {
51196       let t2 = this.chunk.getUint32(e3 + 8) - 1;
51197       return m(this.chunk.getString(e3 + 12, t2));
51198     }
51199     parseText(e3, t2) {
51200       return m(this.chunk.getString(e3 + 8, t2 - 8));
51201     }
51202     parseSig(e3) {
51203       return m(this.chunk.getString(e3 + 8, 4));
51204     }
51205     parseMluc(e3) {
51206       let { chunk: t2 } = this, i3 = t2.getUint32(e3 + 8), n3 = t2.getUint32(e3 + 12), s2 = e3 + 16, r2 = [];
51207       for (let a2 = 0; a2 < i3; a2++) {
51208         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));
51209         r2.push({ lang: i4, country: a3, text: h2 }), s2 += n3;
51210       }
51211       return 1 === i3 ? r2[0].text : r2;
51212     }
51213     translateValue(e3, t2) {
51214       return "string" == typeof e3 ? t2[e3] || t2[e3.toLowerCase()] || e3 : t2[e3] || e3;
51215     }
51216   };
51217   c(pt, "type", "icc"), c(pt, "multiSegment", true), c(pt, "headerLength", 18);
51218   var gt = { 4: mt, 8: function(e3, t2) {
51219     return [e3.getUint8(t2), e3.getUint8(t2 + 1) >> 4, e3.getUint8(t2 + 1) % 16].map((e4) => e4.toString(10)).join(".");
51220   }, 12: mt, 16: mt, 20: mt, 24: function(e3, t2) {
51221     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);
51222     return new Date(Date.UTC(i3, n3, s2, r2, a2, o2));
51223   }, 36: mt, 40: mt, 48: mt, 52: mt, 64: (e3, t2) => e3.getUint32(t2), 80: mt };
51224   function mt(e3, t2) {
51225     return m(e3.getString(t2, 4));
51226   }
51227   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"]]);
51228   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" };
51229   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!)" };
51230   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" }]]);
51231   var yt = class extends re2 {
51232     static canHandle(e3, t2, i3) {
51233       return 237 === e3.getUint8(t2 + 1) && "Photoshop" === e3.getString(t2 + 4, 9) && void 0 !== this.containsIptc8bim(e3, t2, i3);
51234     }
51235     static headerLength(e3, t2, i3) {
51236       let n3, s2 = this.containsIptc8bim(e3, t2, i3);
51237       if (void 0 !== s2)
51238         return n3 = e3.getUint8(t2 + s2 + 7), n3 % 2 != 0 && (n3 += 1), 0 === n3 && (n3 = 4), s2 + 8 + n3;
51239     }
51240     static containsIptc8bim(e3, t2, i3) {
51241       for (let n3 = 0; n3 < i3; n3++)
51242         if (this.isIptcSegmentHead(e3, t2 + n3))
51243           return n3;
51244     }
51245     static isIptcSegmentHead(e3, t2) {
51246       return 56 === e3.getUint8(t2) && 943868237 === e3.getUint32(t2) && 1028 === e3.getUint16(t2 + 4);
51247     }
51248     parse() {
51249       let { raw: e3 } = this, t2 = this.chunk.byteLength - 1, i3 = false;
51250       for (let n3 = 0; n3 < t2; n3++)
51251         if (28 === this.chunk.getUint8(n3) && 2 === this.chunk.getUint8(n3 + 1)) {
51252           i3 = true;
51253           let t3 = this.chunk.getUint16(n3 + 3), s2 = this.chunk.getUint8(n3 + 2), r2 = this.chunk.getLatin1String(n3 + 5, t3);
51254           e3.set(s2, this.pluralizeValue(e3.get(s2), r2)), n3 += 4 + t3;
51255         } else if (i3)
51256           break;
51257       return this.translate(), this.output;
51258     }
51259     pluralizeValue(e3, t2) {
51260       return void 0 !== e3 ? e3 instanceof Array ? (e3.push(t2), e3) : [e3, t2] : t2;
51261     }
51262   };
51263   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" }]]);
51264   var full_esm_default = tt;
51265
51266   // modules/services/plane_photo.js
51267   var dispatch6 = dispatch_default("viewerChanged");
51268   var _photo;
51269   var _wrapper;
51270   var imgZoom;
51271   var _widthOverflow;
51272   function zoomPan(d3_event) {
51273     let t2 = d3_event.transform;
51274     _photo.call(utilSetTransform, t2.x, t2.y, t2.k);
51275   }
51276   function zoomBeahvior() {
51277     const { width: wrapperWidth, height: wrapperHeight } = _wrapper.node().getBoundingClientRect();
51278     const { naturalHeight, naturalWidth } = _photo.node();
51279     const intrinsicRatio = naturalWidth / naturalHeight;
51280     _widthOverflow = wrapperHeight * intrinsicRatio - wrapperWidth;
51281     return zoom_default2().extent([[0, 0], [wrapperWidth, wrapperHeight]]).translateExtent([[0, 0], [wrapperWidth + _widthOverflow, wrapperHeight]]).scaleExtent([1, 15]).on("zoom", zoomPan);
51282   }
51283   function loadImage(selection2, path) {
51284     return new Promise((resolve) => {
51285       selection2.attr("src", path);
51286       selection2.on("load", () => {
51287         resolve(selection2);
51288       });
51289     });
51290   }
51291   var plane_photo_default = {
51292     init: async function(context, selection2) {
51293       this.event = utilRebind(this, dispatch6, "on");
51294       _wrapper = selection2.append("div").attr("class", "photo-frame plane-frame").classed("hide", true);
51295       _photo = _wrapper.append("img").attr("class", "plane-photo");
51296       context.ui().photoviewer.on("resize.plane", () => {
51297         imgZoom = zoomBeahvior();
51298         _wrapper.call(imgZoom);
51299       });
51300       await Promise.resolve();
51301       return this;
51302     },
51303     showPhotoFrame: function(context) {
51304       const isHidden = context.selectAll(".photo-frame.plane-frame.hide").size();
51305       if (isHidden) {
51306         context.selectAll(".photo-frame:not(.plane-frame)").classed("hide", true);
51307         context.selectAll(".photo-frame.plane-frame").classed("hide", false);
51308       }
51309       return this;
51310     },
51311     hidePhotoFrame: function(context) {
51312       context.select("photo-frame.plane-frame").classed("hide", false);
51313       return this;
51314     },
51315     selectPhoto: function(data, keepOrientation) {
51316       dispatch6.call("viewerChanged");
51317       loadImage(_photo, "");
51318       loadImage(_photo, data.image_path).then(() => {
51319         if (!keepOrientation) {
51320           imgZoom = zoomBeahvior();
51321           _wrapper.call(imgZoom);
51322           _wrapper.call(imgZoom.transform, identity2.translate(-_widthOverflow / 2, 0));
51323         }
51324       });
51325       return this;
51326     },
51327     getYaw: function() {
51328       return 0;
51329     }
51330   };
51331
51332   // modules/svg/local_photos.js
51333   var _initialized2 = false;
51334   var _enabled2 = false;
51335   var minViewfieldZoom = 16;
51336   function svgLocalPhotos(projection2, context, dispatch14) {
51337     const detected = utilDetect();
51338     let layer = select_default2(null);
51339     let _fileList;
51340     let _photos = [];
51341     let _idAutoinc = 0;
51342     let _photoFrame;
51343     function init2() {
51344       if (_initialized2)
51345         return;
51346       _enabled2 = true;
51347       function over(d3_event) {
51348         d3_event.stopPropagation();
51349         d3_event.preventDefault();
51350         d3_event.dataTransfer.dropEffect = "copy";
51351       }
51352       context.container().attr("dropzone", "copy").on("drop.svgLocalPhotos", function(d3_event) {
51353         d3_event.stopPropagation();
51354         d3_event.preventDefault();
51355         if (!detected.filedrop)
51356           return;
51357         drawPhotos.fileList(d3_event.dataTransfer.files, (loaded) => {
51358           if (loaded.length > 0) {
51359             drawPhotos.fitZoom(false);
51360           }
51361         });
51362       }).on("dragenter.svgLocalPhotos", over).on("dragexit.svgLocalPhotos", over).on("dragover.svgLocalPhotos", over);
51363       _initialized2 = true;
51364     }
51365     function ensureViewerLoaded(context2) {
51366       if (_photoFrame) {
51367         return Promise.resolve(_photoFrame);
51368       }
51369       const viewer = context2.container().select(".photoviewer").selectAll(".local-photos-wrapper").data([0]);
51370       const viewerEnter = viewer.enter().append("div").attr("class", "photo-wrapper local-photos-wrapper").classed("hide", true);
51371       viewerEnter.append("div").attr("class", "photo-attribution fillD");
51372       return plane_photo_default.init(context2, viewerEnter).then((planePhotoFrame) => {
51373         _photoFrame = planePhotoFrame;
51374       });
51375     }
51376     function click(d3_event, image, zoomTo) {
51377       ensureViewerLoaded(context).then(() => {
51378         const viewer = context.container().select(".photoviewer").datum(image).classed("hide", false);
51379         const viewerWrap = viewer.select(".local-photos-wrapper").classed("hide", false);
51380         const attribution = viewerWrap.selectAll(".photo-attribution").text("");
51381         if (image.name) {
51382           attribution.append("span").classed("filename", true).text(image.name);
51383         }
51384         _photoFrame.selectPhoto({ image_path: "" });
51385         image.getSrc().then((src) => {
51386           _photoFrame.selectPhoto({ image_path: src }).showPhotoFrame(viewerWrap);
51387           setStyles();
51388         });
51389       });
51390       if (zoomTo) {
51391         context.map().centerEase(image.loc);
51392       }
51393     }
51394     function transform2(d2) {
51395       var svgpoint = projection2(d2.loc);
51396       return "translate(" + svgpoint[0] + "," + svgpoint[1] + ")";
51397     }
51398     function setStyles(hovered) {
51399       const viewer = context.container().select(".photoviewer");
51400       const selected = viewer.empty() ? void 0 : viewer.datum();
51401       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);
51402     }
51403     function display_markers(imageList) {
51404       imageList = imageList.filter((image) => isArray_default(image.loc) && isNumber_default(image.loc[0]) && isNumber_default(image.loc[1]));
51405       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(imageList, function(d2) {
51406         return d2.id;
51407       });
51408       groups.exit().remove();
51409       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", (d3_event, d2) => setStyles(d2)).on("mouseleave", () => setStyles(null)).on("click", click);
51410       groupsEnter.append("g").attr("class", "viewfield-scale");
51411       const markers = groups.merge(groupsEnter).attr("transform", transform2).select(".viewfield-scale");
51412       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
51413       const showViewfields = context.map().zoom() >= minViewfieldZoom;
51414       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
51415       viewfields.exit().remove();
51416       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", function() {
51417         const d2 = this.parentNode.__data__;
51418         return `rotate(${Math.round(d2.direction ?? 0)},0,0),scale(1.5,1.5),translate(-8,-13)`;
51419       }).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() {
51420         const d2 = this.parentNode.__data__;
51421         return isNumber_default(d2.direction) ? "visible" : "hidden";
51422       });
51423     }
51424     function drawPhotos(selection2) {
51425       layer = selection2.selectAll(".layer-local-photos").data(_photos ? [0] : []);
51426       layer.exit().remove();
51427       const layerEnter = layer.enter().append("g").attr("class", "layer-local-photos");
51428       layerEnter.append("g").attr("class", "markers");
51429       layer = layerEnter.merge(layer);
51430       if (_photos && _photos.length !== 0) {
51431         display_markers(_photos);
51432       }
51433     }
51434     function readFileAsDataURL(file) {
51435       return new Promise((resolve, reject) => {
51436         const reader = new FileReader();
51437         reader.onload = () => resolve(reader.result);
51438         reader.onerror = (error) => reject(error);
51439         reader.readAsDataURL(file);
51440       });
51441     }
51442     async function readmultifiles(files, callback) {
51443       const loaded = [];
51444       for (const file of files) {
51445         try {
51446           const exifData = await full_esm_default.parse(file);
51447           const photo = {
51448             id: _idAutoinc++,
51449             name: file.name,
51450             getSrc: () => readFileAsDataURL(file),
51451             file,
51452             loc: [exifData.longitude, exifData.latitude],
51453             direction: exifData.GPSImgDirection
51454           };
51455           loaded.push(photo);
51456           const sameName = _photos.filter((i3) => i3.name === photo.name);
51457           if (sameName.length === 0) {
51458             _photos.push(photo);
51459           } else {
51460             const thisContent = await photo.getSrc();
51461             const sameNameContent = await Promise.allSettled(sameName.map((i3) => i3.getSrc()));
51462             if (!sameNameContent.some((i3) => i3.value === thisContent)) {
51463               _photos.push(photo);
51464             }
51465           }
51466         } catch (err) {
51467         }
51468       }
51469       if (typeof callback === "function")
51470         callback(loaded);
51471       dispatch14.call("change");
51472     }
51473     drawPhotos.setFiles = function(fileList, callback) {
51474       readmultifiles(Array.from(fileList), callback);
51475       return this;
51476     };
51477     drawPhotos.fileList = function(fileList, callback) {
51478       if (!arguments.length)
51479         return _fileList;
51480       _fileList = fileList;
51481       if (!fileList || !fileList.length)
51482         return this;
51483       drawPhotos.setFiles(_fileList, callback);
51484       return this;
51485     };
51486     drawPhotos.getPhotos = function() {
51487       return _photos;
51488     };
51489     drawPhotos.removePhoto = function(id2) {
51490       _photos = _photos.filter((i3) => i3.id !== id2);
51491       dispatch14.call("change");
51492       return _photos;
51493     };
51494     drawPhotos.openPhoto = click;
51495     drawPhotos.fitZoom = function(force) {
51496       const coords = _photos.map((image) => image.loc).filter((l2) => isArray_default(l2) && isNumber_default(l2[0]) && isNumber_default(l2[1]));
51497       if (coords.length === 0)
51498         return;
51499       const extent = coords.map((l2) => geoExtent(l2, l2)).reduce((a2, b2) => a2.extend(b2));
51500       const map2 = context.map();
51501       var viewport = map2.trimmedExtent().polygon();
51502       if (force !== false || !geoPolygonIntersectsPolygon(viewport, coords, true)) {
51503         map2.centerZoom(extent.center(), Math.min(18, map2.trimmedExtentZoom(extent)));
51504       }
51505     };
51506     function showLayer() {
51507       layer.style("display", "block");
51508       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
51509         dispatch14.call("change");
51510       });
51511     }
51512     function hideLayer() {
51513       layer.transition().duration(250).style("opacity", 0).on("end", () => {
51514         layer.selectAll(".viewfield-group").remove();
51515         layer.style("display", "none");
51516       });
51517     }
51518     drawPhotos.enabled = function(val) {
51519       if (!arguments.length)
51520         return _enabled2;
51521       _enabled2 = val;
51522       if (_enabled2) {
51523         showLayer();
51524       } else {
51525         hideLayer();
51526       }
51527       dispatch14.call("change");
51528       return this;
51529     };
51530     drawPhotos.hasData = function() {
51531       return isArray_default(_photos) && _photos.length > 0;
51532     };
51533     init2();
51534     return drawPhotos;
51535   }
51536
51537   // modules/svg/improveOSM.js
51538   var _layerEnabled2 = false;
51539   var _qaService2;
51540   function svgImproveOSM(projection2, context, dispatch14) {
51541     const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
51542     const minZoom4 = 12;
51543     let touchLayer = select_default2(null);
51544     let drawLayer = select_default2(null);
51545     let layerVisible = false;
51546     function markerPath(selection2, klass) {
51547       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");
51548     }
51549     function getService() {
51550       if (services.improveOSM && !_qaService2) {
51551         _qaService2 = services.improveOSM;
51552         _qaService2.on("loaded", throttledRedraw);
51553       } else if (!services.improveOSM && _qaService2) {
51554         _qaService2 = null;
51555       }
51556       return _qaService2;
51557     }
51558     function editOn() {
51559       if (!layerVisible) {
51560         layerVisible = true;
51561         drawLayer.style("display", "block");
51562       }
51563     }
51564     function editOff() {
51565       if (layerVisible) {
51566         layerVisible = false;
51567         drawLayer.style("display", "none");
51568         drawLayer.selectAll(".qaItem.improveOSM").remove();
51569         touchLayer.selectAll(".qaItem.improveOSM").remove();
51570       }
51571     }
51572     function layerOn() {
51573       editOn();
51574       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch14.call("change"));
51575     }
51576     function layerOff() {
51577       throttledRedraw.cancel();
51578       drawLayer.interrupt();
51579       touchLayer.selectAll(".qaItem.improveOSM").remove();
51580       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
51581         editOff();
51582         dispatch14.call("change");
51583       });
51584     }
51585     function updateMarkers() {
51586       if (!layerVisible || !_layerEnabled2)
51587         return;
51588       const service = getService();
51589       const selectedID = context.selectedErrorID();
51590       const data = service ? service.getItems(projection2) : [];
51591       const getTransform = svgPointTransform(projection2);
51592       const markers = drawLayer.selectAll(".qaItem.improveOSM").data(data, (d2) => d2.id);
51593       markers.exit().remove();
51594       const markersEnter = markers.enter().append("g").attr("class", (d2) => `qaItem ${d2.service} itemId-${d2.id} itemType-${d2.itemType}`);
51595       markersEnter.append("polygon").call(markerPath, "shadow");
51596       markersEnter.append("ellipse").attr("cx", 0).attr("cy", 0).attr("rx", 4.5).attr("ry", 2).attr("class", "stroke");
51597       markersEnter.append("polygon").attr("fill", "currentColor").call(markerPath, "qaItem-fill");
51598       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 : "");
51599       markers.merge(markersEnter).sort(sortY).classed("selected", (d2) => d2.id === selectedID).attr("transform", getTransform);
51600       if (touchLayer.empty())
51601         return;
51602       const fillClass = context.getDebug("target") ? "pink " : "nocolor ";
51603       const targets = touchLayer.selectAll(".qaItem.improveOSM").data(data, (d2) => d2.id);
51604       targets.exit().remove();
51605       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);
51606       function sortY(a2, b2) {
51607         return a2.id === selectedID ? 1 : b2.id === selectedID ? -1 : b2.loc[1] - a2.loc[1];
51608       }
51609     }
51610     function drawImproveOSM(selection2) {
51611       const service = getService();
51612       const surface = context.surface();
51613       if (surface && !surface.empty()) {
51614         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
51615       }
51616       drawLayer = selection2.selectAll(".layer-improveOSM").data(service ? [0] : []);
51617       drawLayer.exit().remove();
51618       drawLayer = drawLayer.enter().append("g").attr("class", "layer-improveOSM").style("display", _layerEnabled2 ? "block" : "none").merge(drawLayer);
51619       if (_layerEnabled2) {
51620         if (service && ~~context.map().zoom() >= minZoom4) {
51621           editOn();
51622           service.loadIssues(projection2);
51623           updateMarkers();
51624         } else {
51625           editOff();
51626         }
51627       }
51628     }
51629     drawImproveOSM.enabled = function(val) {
51630       if (!arguments.length)
51631         return _layerEnabled2;
51632       _layerEnabled2 = val;
51633       if (_layerEnabled2) {
51634         layerOn();
51635       } else {
51636         layerOff();
51637         if (context.selectedErrorID()) {
51638           context.enter(modeBrowse(context));
51639         }
51640       }
51641       dispatch14.call("change");
51642       return this;
51643     };
51644     drawImproveOSM.supported = () => !!getService();
51645     return drawImproveOSM;
51646   }
51647
51648   // modules/svg/osmose.js
51649   var _layerEnabled3 = false;
51650   var _qaService3;
51651   function svgOsmose(projection2, context, dispatch14) {
51652     const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
51653     const minZoom4 = 12;
51654     let touchLayer = select_default2(null);
51655     let drawLayer = select_default2(null);
51656     let layerVisible = false;
51657     function markerPath(selection2, klass) {
51658       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");
51659     }
51660     function getService() {
51661       if (services.osmose && !_qaService3) {
51662         _qaService3 = services.osmose;
51663         _qaService3.on("loaded", throttledRedraw);
51664       } else if (!services.osmose && _qaService3) {
51665         _qaService3 = null;
51666       }
51667       return _qaService3;
51668     }
51669     function editOn() {
51670       if (!layerVisible) {
51671         layerVisible = true;
51672         drawLayer.style("display", "block");
51673       }
51674     }
51675     function editOff() {
51676       if (layerVisible) {
51677         layerVisible = false;
51678         drawLayer.style("display", "none");
51679         drawLayer.selectAll(".qaItem.osmose").remove();
51680         touchLayer.selectAll(".qaItem.osmose").remove();
51681       }
51682     }
51683     function layerOn() {
51684       editOn();
51685       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch14.call("change"));
51686     }
51687     function layerOff() {
51688       throttledRedraw.cancel();
51689       drawLayer.interrupt();
51690       touchLayer.selectAll(".qaItem.osmose").remove();
51691       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
51692         editOff();
51693         dispatch14.call("change");
51694       });
51695     }
51696     function updateMarkers() {
51697       if (!layerVisible || !_layerEnabled3)
51698         return;
51699       const service = getService();
51700       const selectedID = context.selectedErrorID();
51701       const data = service ? service.getItems(projection2) : [];
51702       const getTransform = svgPointTransform(projection2);
51703       const markers = drawLayer.selectAll(".qaItem.osmose").data(data, (d2) => d2.id);
51704       markers.exit().remove();
51705       const markersEnter = markers.enter().append("g").attr("class", (d2) => `qaItem ${d2.service} itemId-${d2.id} itemType-${d2.itemType}`);
51706       markersEnter.append("polygon").call(markerPath, "shadow");
51707       markersEnter.append("ellipse").attr("cx", 0).attr("cy", 0).attr("rx", 4.5).attr("ry", 2).attr("class", "stroke");
51708       markersEnter.append("polygon").attr("fill", (d2) => service.getColor(d2.item)).call(markerPath, "qaItem-fill");
51709       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 : "");
51710       markers.merge(markersEnter).sort(sortY).classed("selected", (d2) => d2.id === selectedID).attr("transform", getTransform);
51711       if (touchLayer.empty())
51712         return;
51713       const fillClass = context.getDebug("target") ? "pink" : "nocolor";
51714       const targets = touchLayer.selectAll(".qaItem.osmose").data(data, (d2) => d2.id);
51715       targets.exit().remove();
51716       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);
51717       function sortY(a2, b2) {
51718         return a2.id === selectedID ? 1 : b2.id === selectedID ? -1 : b2.loc[1] - a2.loc[1];
51719       }
51720     }
51721     function drawOsmose(selection2) {
51722       const service = getService();
51723       const surface = context.surface();
51724       if (surface && !surface.empty()) {
51725         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
51726       }
51727       drawLayer = selection2.selectAll(".layer-osmose").data(service ? [0] : []);
51728       drawLayer.exit().remove();
51729       drawLayer = drawLayer.enter().append("g").attr("class", "layer-osmose").style("display", _layerEnabled3 ? "block" : "none").merge(drawLayer);
51730       if (_layerEnabled3) {
51731         if (service && ~~context.map().zoom() >= minZoom4) {
51732           editOn();
51733           service.loadIssues(projection2);
51734           updateMarkers();
51735         } else {
51736           editOff();
51737         }
51738       }
51739     }
51740     drawOsmose.enabled = function(val) {
51741       if (!arguments.length)
51742         return _layerEnabled3;
51743       _layerEnabled3 = val;
51744       if (_layerEnabled3) {
51745         getService().loadStrings().then(layerOn).catch((err) => {
51746           console.log(err);
51747         });
51748       } else {
51749         layerOff();
51750         if (context.selectedErrorID()) {
51751           context.enter(modeBrowse(context));
51752         }
51753       }
51754       dispatch14.call("change");
51755       return this;
51756     };
51757     drawOsmose.supported = () => !!getService();
51758     return drawOsmose;
51759   }
51760
51761   // modules/svg/streetside.js
51762   function svgStreetside(projection2, context, dispatch14) {
51763     var throttledRedraw = throttle_default(function() {
51764       dispatch14.call("change");
51765     }, 1e3);
51766     var minZoom4 = 14;
51767     var minMarkerZoom = 16;
51768     var minViewfieldZoom2 = 18;
51769     var layer = select_default2(null);
51770     var _viewerYaw = 0;
51771     var _selectedSequence = null;
51772     var _streetside;
51773     function init2() {
51774       if (svgStreetside.initialized)
51775         return;
51776       svgStreetside.enabled = false;
51777       svgStreetside.initialized = true;
51778     }
51779     function getService() {
51780       if (services.streetside && !_streetside) {
51781         _streetside = services.streetside;
51782         _streetside.event.on("viewerChanged.svgStreetside", viewerChanged).on("loadedImages.svgStreetside", throttledRedraw);
51783       } else if (!services.streetside && _streetside) {
51784         _streetside = null;
51785       }
51786       return _streetside;
51787     }
51788     function showLayer() {
51789       var service = getService();
51790       if (!service)
51791         return;
51792       editOn();
51793       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
51794         dispatch14.call("change");
51795       });
51796     }
51797     function hideLayer() {
51798       throttledRedraw.cancel();
51799       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
51800     }
51801     function editOn() {
51802       layer.style("display", "block");
51803     }
51804     function editOff() {
51805       layer.selectAll(".viewfield-group").remove();
51806       layer.style("display", "none");
51807     }
51808     function click(d3_event, d2) {
51809       var service = getService();
51810       if (!service)
51811         return;
51812       if (d2.sequenceKey !== _selectedSequence) {
51813         _viewerYaw = 0;
51814       }
51815       _selectedSequence = d2.sequenceKey;
51816       service.ensureViewerLoaded(context).then(function() {
51817         service.selectImage(context, d2.key).yaw(_viewerYaw).showViewer(context);
51818       });
51819       context.map().centerEase(d2.loc);
51820     }
51821     function mouseover(d3_event, d2) {
51822       var service = getService();
51823       if (service)
51824         service.setStyles(context, d2);
51825     }
51826     function mouseout() {
51827       var service = getService();
51828       if (service)
51829         service.setStyles(context, null);
51830     }
51831     function transform2(d2) {
51832       var t2 = svgPointTransform(projection2)(d2);
51833       var rot = d2.ca + _viewerYaw;
51834       if (rot) {
51835         t2 += " rotate(" + Math.floor(rot) + ",0,0)";
51836       }
51837       return t2;
51838     }
51839     function viewerChanged() {
51840       var service = getService();
51841       if (!service)
51842         return;
51843       var viewer = service.viewer();
51844       if (!viewer)
51845         return;
51846       _viewerYaw = viewer.getYaw();
51847       if (context.map().isTransformed())
51848         return;
51849       layer.selectAll(".viewfield-group.currentView").attr("transform", transform2);
51850     }
51851     function filterBubbles(bubbles) {
51852       var fromDate = context.photos().fromDate();
51853       var toDate = context.photos().toDate();
51854       var usernames = context.photos().usernames();
51855       if (fromDate) {
51856         var fromTimestamp = new Date(fromDate).getTime();
51857         bubbles = bubbles.filter(function(bubble) {
51858           return new Date(bubble.captured_at).getTime() >= fromTimestamp;
51859         });
51860       }
51861       if (toDate) {
51862         var toTimestamp = new Date(toDate).getTime();
51863         bubbles = bubbles.filter(function(bubble) {
51864           return new Date(bubble.captured_at).getTime() <= toTimestamp;
51865         });
51866       }
51867       if (usernames) {
51868         bubbles = bubbles.filter(function(bubble) {
51869           return usernames.indexOf(bubble.captured_by) !== -1;
51870         });
51871       }
51872       return bubbles;
51873     }
51874     function filterSequences(sequences) {
51875       var fromDate = context.photos().fromDate();
51876       var toDate = context.photos().toDate();
51877       var usernames = context.photos().usernames();
51878       if (fromDate) {
51879         var fromTimestamp = new Date(fromDate).getTime();
51880         sequences = sequences.filter(function(sequences2) {
51881           return new Date(sequences2.properties.captured_at).getTime() >= fromTimestamp;
51882         });
51883       }
51884       if (toDate) {
51885         var toTimestamp = new Date(toDate).getTime();
51886         sequences = sequences.filter(function(sequences2) {
51887           return new Date(sequences2.properties.captured_at).getTime() <= toTimestamp;
51888         });
51889       }
51890       if (usernames) {
51891         sequences = sequences.filter(function(sequences2) {
51892           return usernames.indexOf(sequences2.properties.captured_by) !== -1;
51893         });
51894       }
51895       return sequences;
51896     }
51897     function update() {
51898       var viewer = context.container().select(".photoviewer");
51899       var selected = viewer.empty() ? void 0 : viewer.datum();
51900       var z2 = ~~context.map().zoom();
51901       var showMarkers = z2 >= minMarkerZoom;
51902       var showViewfields = z2 >= minViewfieldZoom2;
51903       var service = getService();
51904       var sequences = [];
51905       var bubbles = [];
51906       if (context.photos().showsPanoramic()) {
51907         sequences = service ? service.sequences(projection2) : [];
51908         bubbles = service && showMarkers ? service.bubbles(projection2) : [];
51909         sequences = filterSequences(sequences);
51910         bubbles = filterBubbles(bubbles);
51911       }
51912       var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
51913         return d2.properties.key;
51914       });
51915       traces.exit().remove();
51916       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
51917       var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(bubbles, function(d2) {
51918         return d2.key + (d2.sequenceKey ? "v1" : "v0");
51919       });
51920       groups.exit().remove();
51921       var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
51922       groupsEnter.append("g").attr("class", "viewfield-scale");
51923       var markers = groups.merge(groupsEnter).sort(function(a2, b2) {
51924         return a2 === selected ? 1 : b2 === selected ? -1 : b2.loc[1] - a2.loc[1];
51925       }).attr("transform", transform2).select(".viewfield-scale");
51926       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
51927       var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
51928       viewfields.exit().remove();
51929       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
51930       function viewfieldPath() {
51931         var d2 = this.parentNode.__data__;
51932         if (d2.pano) {
51933           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
51934         } else {
51935           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
51936         }
51937       }
51938     }
51939     function drawImages(selection2) {
51940       var enabled = svgStreetside.enabled;
51941       var service = getService();
51942       layer = selection2.selectAll(".layer-streetside-images").data(service ? [0] : []);
51943       layer.exit().remove();
51944       var layerEnter = layer.enter().append("g").attr("class", "layer-streetside-images").style("display", enabled ? "block" : "none");
51945       layerEnter.append("g").attr("class", "sequences");
51946       layerEnter.append("g").attr("class", "markers");
51947       layer = layerEnter.merge(layer);
51948       if (enabled) {
51949         if (service && ~~context.map().zoom() >= minZoom4) {
51950           editOn();
51951           update();
51952           service.loadBubbles(projection2);
51953         } else {
51954           editOff();
51955         }
51956       }
51957     }
51958     drawImages.enabled = function(_2) {
51959       if (!arguments.length)
51960         return svgStreetside.enabled;
51961       svgStreetside.enabled = _2;
51962       if (svgStreetside.enabled) {
51963         showLayer();
51964         context.photos().on("change.streetside", update);
51965       } else {
51966         hideLayer();
51967         context.photos().on("change.streetside", null);
51968       }
51969       dispatch14.call("change");
51970       return this;
51971     };
51972     drawImages.supported = function() {
51973       return !!getService();
51974     };
51975     drawImages.rendered = function(zoom) {
51976       return zoom >= minZoom4;
51977     };
51978     init2();
51979     return drawImages;
51980   }
51981
51982   // modules/svg/vegbilder.js
51983   function svgVegbilder(projection2, context, dispatch14) {
51984     const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
51985     const minZoom4 = 14;
51986     const minMarkerZoom = 16;
51987     const minViewfieldZoom2 = 18;
51988     let layer = select_default2(null);
51989     let _viewerYaw = 0;
51990     let _vegbilder;
51991     function init2() {
51992       if (svgVegbilder.initialized)
51993         return;
51994       svgVegbilder.enabled = false;
51995       svgVegbilder.initialized = true;
51996     }
51997     function getService() {
51998       if (services.vegbilder && !_vegbilder) {
51999         _vegbilder = services.vegbilder;
52000         _vegbilder.event.on("viewerChanged.svgVegbilder", viewerChanged).on("loadedImages.svgVegbilder", throttledRedraw);
52001       } else if (!services.vegbilder && _vegbilder) {
52002         _vegbilder = null;
52003       }
52004       return _vegbilder;
52005     }
52006     function showLayer() {
52007       const service = getService();
52008       if (!service)
52009         return;
52010       editOn();
52011       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", () => dispatch14.call("change"));
52012     }
52013     function hideLayer() {
52014       throttledRedraw.cancel();
52015       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
52016     }
52017     function editOn() {
52018       layer.style("display", "block");
52019     }
52020     function editOff() {
52021       layer.selectAll(".viewfield-group").remove();
52022       layer.style("display", "none");
52023     }
52024     function click(d3_event, d2) {
52025       const service = getService();
52026       if (!service)
52027         return;
52028       service.ensureViewerLoaded(context).then(() => {
52029         service.selectImage(context, d2.key).showViewer(context);
52030       });
52031       context.map().centerEase(d2.loc);
52032     }
52033     function mouseover(d3_event, d2) {
52034       const service = getService();
52035       if (service)
52036         service.setStyles(context, d2);
52037     }
52038     function mouseout() {
52039       const service = getService();
52040       if (service)
52041         service.setStyles(context, null);
52042     }
52043     function transform2(d2, selected) {
52044       let t2 = svgPointTransform(projection2)(d2);
52045       let rot = d2.ca;
52046       if (d2 === selected) {
52047         rot += _viewerYaw;
52048       }
52049       if (rot) {
52050         t2 += " rotate(" + Math.floor(rot) + ",0,0)";
52051       }
52052       return t2;
52053     }
52054     function viewerChanged() {
52055       const service = getService();
52056       if (!service)
52057         return;
52058       const frame2 = service.photoFrame();
52059       _viewerYaw = frame2.getYaw();
52060       if (context.map().isTransformed())
52061         return;
52062       layer.selectAll(".viewfield-group.currentView").attr("transform", (d2) => transform2(d2, d2));
52063     }
52064     function filterImages(images) {
52065       const photoContext = context.photos();
52066       const fromDateString = photoContext.fromDate();
52067       const toDateString = photoContext.toDate();
52068       const showsFlat = photoContext.showsFlat();
52069       const showsPano = photoContext.showsPanoramic();
52070       if (fromDateString) {
52071         const fromDate = new Date(fromDateString);
52072         images = images.filter((image) => image.captured_at.getTime() >= fromDate.getTime());
52073       }
52074       if (toDateString) {
52075         const toDate = new Date(toDateString);
52076         images = images.filter((image) => image.captured_at.getTime() <= toDate.getTime());
52077       }
52078       if (!showsPano) {
52079         images = images.filter((image) => !image.is_sphere);
52080       }
52081       if (!showsFlat) {
52082         images = images.filter((image) => image.is_sphere);
52083       }
52084       return images;
52085     }
52086     function filterSequences(sequences) {
52087       const photoContext = context.photos();
52088       const fromDateString = photoContext.fromDate();
52089       const toDateString = photoContext.toDate();
52090       const showsFlat = photoContext.showsFlat();
52091       const showsPano = photoContext.showsPanoramic();
52092       if (fromDateString) {
52093         const fromDate = new Date(fromDateString);
52094         sequences = sequences.filter(({ images }) => images[0].captured_at.getTime() >= fromDate.getTime());
52095       }
52096       if (toDateString) {
52097         const toDate = new Date(toDateString);
52098         sequences = sequences.filter(({ images }) => images[images.length - 1].captured_at.getTime() <= toDate.getTime());
52099       }
52100       if (!showsPano) {
52101         sequences = sequences.filter(({ images }) => !images[0].is_sphere);
52102       }
52103       if (!showsFlat) {
52104         sequences = sequences.filter(({ images }) => images[0].is_sphere);
52105       }
52106       return sequences;
52107     }
52108     function update() {
52109       const viewer = context.container().select(".photoviewer");
52110       const selected = viewer.empty() ? void 0 : viewer.datum();
52111       const z2 = ~~context.map().zoom();
52112       const showMarkers = z2 >= minMarkerZoom;
52113       const showViewfields = z2 >= minViewfieldZoom2;
52114       const service = getService();
52115       let sequences = [];
52116       let images = [];
52117       if (service) {
52118         service.loadImages(context);
52119         sequences = service.sequences(projection2);
52120         images = showMarkers ? service.images(projection2) : [];
52121         images = filterImages(images);
52122         sequences = filterSequences(sequences);
52123       }
52124       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, (d2) => d2.key);
52125       traces.exit().remove();
52126       traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
52127       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, (d2) => d2.key);
52128       groups.exit().remove();
52129       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
52130       groupsEnter.append("g").attr("class", "viewfield-scale");
52131       const markers = groups.merge(groupsEnter).sort((a2, b2) => {
52132         return a2 === selected ? 1 : b2 === selected ? -1 : b2.loc[1] - a2.loc[1];
52133       }).attr("transform", (d2) => transform2(d2, selected)).select(".viewfield-scale");
52134       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
52135       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
52136       viewfields.exit().remove();
52137       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
52138       function viewfieldPath() {
52139         const d2 = this.parentNode.__data__;
52140         if (d2.is_sphere) {
52141           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
52142         } else {
52143           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
52144         }
52145       }
52146     }
52147     function drawImages(selection2) {
52148       const enabled = svgVegbilder.enabled;
52149       const service = getService();
52150       layer = selection2.selectAll(".layer-vegbilder").data(service ? [0] : []);
52151       layer.exit().remove();
52152       const layerEnter = layer.enter().append("g").attr("class", "layer-vegbilder").style("display", enabled ? "block" : "none");
52153       layerEnter.append("g").attr("class", "sequences");
52154       layerEnter.append("g").attr("class", "markers");
52155       layer = layerEnter.merge(layer);
52156       if (enabled) {
52157         if (service && ~~context.map().zoom() >= minZoom4) {
52158           editOn();
52159           update();
52160           service.loadImages(context);
52161         } else {
52162           editOff();
52163         }
52164       }
52165     }
52166     drawImages.enabled = function(_2) {
52167       if (!arguments.length)
52168         return svgVegbilder.enabled;
52169       svgVegbilder.enabled = _2;
52170       if (svgVegbilder.enabled) {
52171         showLayer();
52172         context.photos().on("change.vegbilder", update);
52173       } else {
52174         hideLayer();
52175         context.photos().on("change.vegbilder", null);
52176       }
52177       dispatch14.call("change");
52178       return this;
52179     };
52180     drawImages.supported = function() {
52181       return !!getService();
52182     };
52183     drawImages.rendered = function(zoom) {
52184       return zoom >= minZoom4;
52185     };
52186     drawImages.validHere = function(extent, zoom) {
52187       return zoom >= minZoom4 - 2 && getService().validHere(extent);
52188     };
52189     init2();
52190     return drawImages;
52191   }
52192
52193   // modules/svg/mapillary_images.js
52194   function svgMapillaryImages(projection2, context, dispatch14) {
52195     const throttledRedraw = throttle_default(function() {
52196       dispatch14.call("change");
52197     }, 1e3);
52198     const minZoom4 = 12;
52199     const minMarkerZoom = 16;
52200     const minViewfieldZoom2 = 18;
52201     let layer = select_default2(null);
52202     let _mapillary;
52203     function init2() {
52204       if (svgMapillaryImages.initialized)
52205         return;
52206       svgMapillaryImages.enabled = false;
52207       svgMapillaryImages.initialized = true;
52208     }
52209     function getService() {
52210       if (services.mapillary && !_mapillary) {
52211         _mapillary = services.mapillary;
52212         _mapillary.event.on("loadedImages", throttledRedraw);
52213       } else if (!services.mapillary && _mapillary) {
52214         _mapillary = null;
52215       }
52216       return _mapillary;
52217     }
52218     function showLayer() {
52219       const service = getService();
52220       if (!service)
52221         return;
52222       editOn();
52223       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
52224         dispatch14.call("change");
52225       });
52226     }
52227     function hideLayer() {
52228       throttledRedraw.cancel();
52229       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
52230     }
52231     function editOn() {
52232       layer.style("display", "block");
52233     }
52234     function editOff() {
52235       layer.selectAll(".viewfield-group").remove();
52236       layer.style("display", "none");
52237     }
52238     function click(d3_event, image) {
52239       const service = getService();
52240       if (!service)
52241         return;
52242       service.ensureViewerLoaded(context).then(function() {
52243         service.selectImage(context, image.id).showViewer(context);
52244       });
52245       context.map().centerEase(image.loc);
52246     }
52247     function mouseover(d3_event, image) {
52248       const service = getService();
52249       if (service)
52250         service.setStyles(context, image);
52251     }
52252     function mouseout() {
52253       const service = getService();
52254       if (service)
52255         service.setStyles(context, null);
52256     }
52257     function transform2(d2) {
52258       let t2 = svgPointTransform(projection2)(d2);
52259       if (d2.ca) {
52260         t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
52261       }
52262       return t2;
52263     }
52264     function filterImages(images) {
52265       const showsPano = context.photos().showsPanoramic();
52266       const showsFlat = context.photos().showsFlat();
52267       const fromDate = context.photos().fromDate();
52268       const toDate = context.photos().toDate();
52269       if (!showsPano || !showsFlat) {
52270         images = images.filter(function(image) {
52271           if (image.is_pano)
52272             return showsPano;
52273           return showsFlat;
52274         });
52275       }
52276       if (fromDate) {
52277         images = images.filter(function(image) {
52278           return new Date(image.captured_at).getTime() >= new Date(fromDate).getTime();
52279         });
52280       }
52281       if (toDate) {
52282         images = images.filter(function(image) {
52283           return new Date(image.captured_at).getTime() <= new Date(toDate).getTime();
52284         });
52285       }
52286       return images;
52287     }
52288     function filterSequences(sequences) {
52289       const showsPano = context.photos().showsPanoramic();
52290       const showsFlat = context.photos().showsFlat();
52291       const fromDate = context.photos().fromDate();
52292       const toDate = context.photos().toDate();
52293       if (!showsPano || !showsFlat) {
52294         sequences = sequences.filter(function(sequence) {
52295           if (sequence.properties.hasOwnProperty("is_pano")) {
52296             if (sequence.properties.is_pano)
52297               return showsPano;
52298             return showsFlat;
52299           }
52300           return false;
52301         });
52302       }
52303       if (fromDate) {
52304         sequences = sequences.filter(function(sequence) {
52305           return new Date(sequence.properties.captured_at).getTime() >= new Date(fromDate).getTime().toString();
52306         });
52307       }
52308       if (toDate) {
52309         sequences = sequences.filter(function(sequence) {
52310           return new Date(sequence.properties.captured_at).getTime() <= new Date(toDate).getTime().toString();
52311         });
52312       }
52313       return sequences;
52314     }
52315     function update() {
52316       const z2 = ~~context.map().zoom();
52317       const showMarkers = z2 >= minMarkerZoom;
52318       const showViewfields = z2 >= minViewfieldZoom2;
52319       const service = getService();
52320       let sequences = service ? service.sequences(projection2) : [];
52321       let images = service && showMarkers ? service.images(projection2) : [];
52322       images = filterImages(images);
52323       sequences = filterSequences(sequences, service);
52324       service.filterViewer(context);
52325       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
52326         return d2.properties.id;
52327       });
52328       traces.exit().remove();
52329       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
52330       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
52331         return d2.id;
52332       });
52333       groups.exit().remove();
52334       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
52335       groupsEnter.append("g").attr("class", "viewfield-scale");
52336       const markers = groups.merge(groupsEnter).sort(function(a2, b2) {
52337         return b2.loc[1] - a2.loc[1];
52338       }).attr("transform", transform2).select(".viewfield-scale");
52339       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
52340       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
52341       viewfields.exit().remove();
52342       viewfields.enter().insert("path", "circle").attr("class", "viewfield").classed("pano", function() {
52343         return this.parentNode.__data__.is_pano;
52344       }).attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
52345       function viewfieldPath() {
52346         if (this.parentNode.__data__.is_pano) {
52347           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
52348         } else {
52349           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
52350         }
52351       }
52352     }
52353     function drawImages(selection2) {
52354       const enabled = svgMapillaryImages.enabled;
52355       const service = getService();
52356       layer = selection2.selectAll(".layer-mapillary").data(service ? [0] : []);
52357       layer.exit().remove();
52358       const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary").style("display", enabled ? "block" : "none");
52359       layerEnter.append("g").attr("class", "sequences");
52360       layerEnter.append("g").attr("class", "markers");
52361       layer = layerEnter.merge(layer);
52362       if (enabled) {
52363         if (service && ~~context.map().zoom() >= minZoom4) {
52364           editOn();
52365           update();
52366           service.loadImages(projection2);
52367         } else {
52368           editOff();
52369         }
52370       }
52371     }
52372     drawImages.enabled = function(_2) {
52373       if (!arguments.length)
52374         return svgMapillaryImages.enabled;
52375       svgMapillaryImages.enabled = _2;
52376       if (svgMapillaryImages.enabled) {
52377         showLayer();
52378         context.photos().on("change.mapillary_images", update);
52379       } else {
52380         hideLayer();
52381         context.photos().on("change.mapillary_images", null);
52382       }
52383       dispatch14.call("change");
52384       return this;
52385     };
52386     drawImages.supported = function() {
52387       return !!getService();
52388     };
52389     drawImages.rendered = function(zoom) {
52390       return zoom >= minZoom4;
52391     };
52392     init2();
52393     return drawImages;
52394   }
52395
52396   // modules/svg/mapillary_position.js
52397   function svgMapillaryPosition(projection2, context) {
52398     const throttledRedraw = throttle_default(function() {
52399       update();
52400     }, 1e3);
52401     const minZoom4 = 12;
52402     const minViewfieldZoom2 = 18;
52403     let layer = select_default2(null);
52404     let _mapillary;
52405     let viewerCompassAngle;
52406     function init2() {
52407       if (svgMapillaryPosition.initialized)
52408         return;
52409       svgMapillaryPosition.initialized = true;
52410     }
52411     function getService() {
52412       if (services.mapillary && !_mapillary) {
52413         _mapillary = services.mapillary;
52414         _mapillary.event.on("imageChanged", throttledRedraw);
52415         _mapillary.event.on("bearingChanged", function(e3) {
52416           viewerCompassAngle = e3.bearing;
52417           if (context.map().isTransformed())
52418             return;
52419           layer.selectAll(".viewfield-group.currentView").filter(function(d2) {
52420             return d2.is_pano;
52421           }).attr("transform", transform2);
52422         });
52423       } else if (!services.mapillary && _mapillary) {
52424         _mapillary = null;
52425       }
52426       return _mapillary;
52427     }
52428     function editOn() {
52429       layer.style("display", "block");
52430     }
52431     function editOff() {
52432       layer.selectAll(".viewfield-group").remove();
52433       layer.style("display", "none");
52434     }
52435     function transform2(d2) {
52436       let t2 = svgPointTransform(projection2)(d2);
52437       if (d2.is_pano && viewerCompassAngle !== null && isFinite(viewerCompassAngle)) {
52438         t2 += " rotate(" + Math.floor(viewerCompassAngle) + ",0,0)";
52439       } else if (d2.ca) {
52440         t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
52441       }
52442       return t2;
52443     }
52444     function update() {
52445       const z2 = ~~context.map().zoom();
52446       const showViewfields = z2 >= minViewfieldZoom2;
52447       const service = getService();
52448       const image = service && service.getActiveImage();
52449       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(image ? [image] : [], function(d2) {
52450         return d2.id;
52451       });
52452       groups.exit().remove();
52453       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group currentView highlighted");
52454       groupsEnter.append("g").attr("class", "viewfield-scale");
52455       const markers = groups.merge(groupsEnter).attr("transform", transform2).select(".viewfield-scale");
52456       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
52457       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
52458       viewfields.exit().remove();
52459       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");
52460     }
52461     function drawImages(selection2) {
52462       const service = getService();
52463       layer = selection2.selectAll(".layer-mapillary-position").data(service ? [0] : []);
52464       layer.exit().remove();
52465       const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary-position");
52466       layerEnter.append("g").attr("class", "markers");
52467       layer = layerEnter.merge(layer);
52468       if (service && ~~context.map().zoom() >= minZoom4) {
52469         editOn();
52470         update();
52471       } else {
52472         editOff();
52473       }
52474     }
52475     drawImages.enabled = function() {
52476       update();
52477       return this;
52478     };
52479     drawImages.supported = function() {
52480       return !!getService();
52481     };
52482     drawImages.rendered = function(zoom) {
52483       return zoom >= minZoom4;
52484     };
52485     init2();
52486     return drawImages;
52487   }
52488
52489   // modules/svg/mapillary_signs.js
52490   function svgMapillarySigns(projection2, context, dispatch14) {
52491     const throttledRedraw = throttle_default(function() {
52492       dispatch14.call("change");
52493     }, 1e3);
52494     const minZoom4 = 12;
52495     let layer = select_default2(null);
52496     let _mapillary;
52497     function init2() {
52498       if (svgMapillarySigns.initialized)
52499         return;
52500       svgMapillarySigns.enabled = false;
52501       svgMapillarySigns.initialized = true;
52502     }
52503     function getService() {
52504       if (services.mapillary && !_mapillary) {
52505         _mapillary = services.mapillary;
52506         _mapillary.event.on("loadedSigns", throttledRedraw);
52507       } else if (!services.mapillary && _mapillary) {
52508         _mapillary = null;
52509       }
52510       return _mapillary;
52511     }
52512     function showLayer() {
52513       const service = getService();
52514       if (!service)
52515         return;
52516       service.loadSignResources(context);
52517       editOn();
52518     }
52519     function hideLayer() {
52520       throttledRedraw.cancel();
52521       editOff();
52522     }
52523     function editOn() {
52524       layer.style("display", "block");
52525     }
52526     function editOff() {
52527       layer.selectAll(".icon-sign").remove();
52528       layer.style("display", "none");
52529     }
52530     function click(d3_event, d2) {
52531       const service = getService();
52532       if (!service)
52533         return;
52534       context.map().centerEase(d2.loc);
52535       const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
52536       service.getDetections(d2.id).then((detections) => {
52537         if (detections.length) {
52538           const imageId = detections[0].image.id;
52539           if (imageId === selectedImageId) {
52540             service.highlightDetection(detections[0]).selectImage(context, imageId);
52541           } else {
52542             service.ensureViewerLoaded(context).then(function() {
52543               service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
52544             });
52545           }
52546         }
52547       });
52548     }
52549     function filterData(detectedFeatures) {
52550       var fromDate = context.photos().fromDate();
52551       var toDate = context.photos().toDate();
52552       if (fromDate) {
52553         var fromTimestamp = new Date(fromDate).getTime();
52554         detectedFeatures = detectedFeatures.filter(function(feature3) {
52555           return new Date(feature3.last_seen_at).getTime() >= fromTimestamp;
52556         });
52557       }
52558       if (toDate) {
52559         var toTimestamp = new Date(toDate).getTime();
52560         detectedFeatures = detectedFeatures.filter(function(feature3) {
52561           return new Date(feature3.first_seen_at).getTime() <= toTimestamp;
52562         });
52563       }
52564       return detectedFeatures;
52565     }
52566     function update() {
52567       const service = getService();
52568       let data = service ? service.signs(projection2) : [];
52569       data = filterData(data);
52570       const transform2 = svgPointTransform(projection2);
52571       const signs = layer.selectAll(".icon-sign").data(data, function(d2) {
52572         return d2.id;
52573       });
52574       signs.exit().remove();
52575       const enter = signs.enter().append("g").attr("class", "icon-sign icon-detected").on("click", click);
52576       enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d2) {
52577         return "#" + d2.value;
52578       });
52579       enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
52580       signs.merge(enter).attr("transform", transform2);
52581     }
52582     function drawSigns(selection2) {
52583       const enabled = svgMapillarySigns.enabled;
52584       const service = getService();
52585       layer = selection2.selectAll(".layer-mapillary-signs").data(service ? [0] : []);
52586       layer.exit().remove();
52587       layer = layer.enter().append("g").attr("class", "layer-mapillary-signs layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
52588       if (enabled) {
52589         if (service && ~~context.map().zoom() >= minZoom4) {
52590           editOn();
52591           update();
52592           service.loadSigns(projection2);
52593           service.showSignDetections(true);
52594         } else {
52595           editOff();
52596         }
52597       } else if (service) {
52598         service.showSignDetections(false);
52599       }
52600     }
52601     drawSigns.enabled = function(_2) {
52602       if (!arguments.length)
52603         return svgMapillarySigns.enabled;
52604       svgMapillarySigns.enabled = _2;
52605       if (svgMapillarySigns.enabled) {
52606         showLayer();
52607         context.photos().on("change.mapillary_signs", update);
52608       } else {
52609         hideLayer();
52610         context.photos().on("change.mapillary_signs", null);
52611       }
52612       dispatch14.call("change");
52613       return this;
52614     };
52615     drawSigns.supported = function() {
52616       return !!getService();
52617     };
52618     drawSigns.rendered = function(zoom) {
52619       return zoom >= minZoom4;
52620     };
52621     init2();
52622     return drawSigns;
52623   }
52624
52625   // modules/svg/mapillary_map_features.js
52626   function svgMapillaryMapFeatures(projection2, context, dispatch14) {
52627     const throttledRedraw = throttle_default(function() {
52628       dispatch14.call("change");
52629     }, 1e3);
52630     const minZoom4 = 12;
52631     let layer = select_default2(null);
52632     let _mapillary;
52633     function init2() {
52634       if (svgMapillaryMapFeatures.initialized)
52635         return;
52636       svgMapillaryMapFeatures.enabled = false;
52637       svgMapillaryMapFeatures.initialized = true;
52638     }
52639     function getService() {
52640       if (services.mapillary && !_mapillary) {
52641         _mapillary = services.mapillary;
52642         _mapillary.event.on("loadedMapFeatures", throttledRedraw);
52643       } else if (!services.mapillary && _mapillary) {
52644         _mapillary = null;
52645       }
52646       return _mapillary;
52647     }
52648     function showLayer() {
52649       const service = getService();
52650       if (!service)
52651         return;
52652       service.loadObjectResources(context);
52653       editOn();
52654     }
52655     function hideLayer() {
52656       throttledRedraw.cancel();
52657       editOff();
52658     }
52659     function editOn() {
52660       layer.style("display", "block");
52661     }
52662     function editOff() {
52663       layer.selectAll(".icon-map-feature").remove();
52664       layer.style("display", "none");
52665     }
52666     function click(d3_event, d2) {
52667       const service = getService();
52668       if (!service)
52669         return;
52670       context.map().centerEase(d2.loc);
52671       const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
52672       service.getDetections(d2.id).then((detections) => {
52673         if (detections.length) {
52674           const imageId = detections[0].image.id;
52675           if (imageId === selectedImageId) {
52676             service.highlightDetection(detections[0]).selectImage(context, imageId);
52677           } else {
52678             service.ensureViewerLoaded(context).then(function() {
52679               service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
52680             });
52681           }
52682         }
52683       });
52684     }
52685     function filterData(detectedFeatures) {
52686       const fromDate = context.photos().fromDate();
52687       const toDate = context.photos().toDate();
52688       if (fromDate) {
52689         detectedFeatures = detectedFeatures.filter(function(feature3) {
52690           return new Date(feature3.last_seen_at).getTime() >= new Date(fromDate).getTime();
52691         });
52692       }
52693       if (toDate) {
52694         detectedFeatures = detectedFeatures.filter(function(feature3) {
52695           return new Date(feature3.first_seen_at).getTime() <= new Date(toDate).getTime();
52696         });
52697       }
52698       return detectedFeatures;
52699     }
52700     function update() {
52701       const service = getService();
52702       let data = service ? service.mapFeatures(projection2) : [];
52703       data = filterData(data);
52704       const transform2 = svgPointTransform(projection2);
52705       const mapFeatures = layer.selectAll(".icon-map-feature").data(data, function(d2) {
52706         return d2.id;
52707       });
52708       mapFeatures.exit().remove();
52709       const enter = mapFeatures.enter().append("g").attr("class", "icon-map-feature icon-detected").on("click", click);
52710       enter.append("title").text(function(d2) {
52711         var id2 = d2.value.replace(/--/g, ".").replace(/-/g, "_");
52712         return _t("mapillary_map_features." + id2);
52713       });
52714       enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d2) {
52715         if (d2.value === "object--billboard") {
52716           return "#object--sign--advertisement";
52717         }
52718         return "#" + d2.value;
52719       });
52720       enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
52721       mapFeatures.merge(enter).attr("transform", transform2);
52722     }
52723     function drawMapFeatures(selection2) {
52724       const enabled = svgMapillaryMapFeatures.enabled;
52725       const service = getService();
52726       layer = selection2.selectAll(".layer-mapillary-map-features").data(service ? [0] : []);
52727       layer.exit().remove();
52728       layer = layer.enter().append("g").attr("class", "layer-mapillary-map-features layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
52729       if (enabled) {
52730         if (service && ~~context.map().zoom() >= minZoom4) {
52731           editOn();
52732           update();
52733           service.loadMapFeatures(projection2);
52734           service.showFeatureDetections(true);
52735         } else {
52736           editOff();
52737         }
52738       } else if (service) {
52739         service.showFeatureDetections(false);
52740       }
52741     }
52742     drawMapFeatures.enabled = function(_2) {
52743       if (!arguments.length)
52744         return svgMapillaryMapFeatures.enabled;
52745       svgMapillaryMapFeatures.enabled = _2;
52746       if (svgMapillaryMapFeatures.enabled) {
52747         showLayer();
52748         context.photos().on("change.mapillary_map_features", update);
52749       } else {
52750         hideLayer();
52751         context.photos().on("change.mapillary_map_features", null);
52752       }
52753       dispatch14.call("change");
52754       return this;
52755     };
52756     drawMapFeatures.supported = function() {
52757       return !!getService();
52758     };
52759     drawMapFeatures.rendered = function(zoom) {
52760       return zoom >= minZoom4;
52761     };
52762     init2();
52763     return drawMapFeatures;
52764   }
52765
52766   // modules/svg/kartaview_images.js
52767   function svgKartaviewImages(projection2, context, dispatch14) {
52768     var throttledRedraw = throttle_default(function() {
52769       dispatch14.call("change");
52770     }, 1e3);
52771     var minZoom4 = 12;
52772     var minMarkerZoom = 16;
52773     var minViewfieldZoom2 = 18;
52774     var layer = select_default2(null);
52775     var _kartaview;
52776     function init2() {
52777       if (svgKartaviewImages.initialized)
52778         return;
52779       svgKartaviewImages.enabled = false;
52780       svgKartaviewImages.initialized = true;
52781     }
52782     function getService() {
52783       if (services.kartaview && !_kartaview) {
52784         _kartaview = services.kartaview;
52785         _kartaview.event.on("loadedImages", throttledRedraw);
52786       } else if (!services.kartaview && _kartaview) {
52787         _kartaview = null;
52788       }
52789       return _kartaview;
52790     }
52791     function showLayer() {
52792       var service = getService();
52793       if (!service)
52794         return;
52795       editOn();
52796       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
52797         dispatch14.call("change");
52798       });
52799     }
52800     function hideLayer() {
52801       throttledRedraw.cancel();
52802       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
52803     }
52804     function editOn() {
52805       layer.style("display", "block");
52806     }
52807     function editOff() {
52808       layer.selectAll(".viewfield-group").remove();
52809       layer.style("display", "none");
52810     }
52811     function click(d3_event, d2) {
52812       var service = getService();
52813       if (!service)
52814         return;
52815       service.ensureViewerLoaded(context).then(function() {
52816         service.selectImage(context, d2.key).showViewer(context);
52817       });
52818       context.map().centerEase(d2.loc);
52819     }
52820     function mouseover(d3_event, d2) {
52821       var service = getService();
52822       if (service)
52823         service.setStyles(context, d2);
52824     }
52825     function mouseout() {
52826       var service = getService();
52827       if (service)
52828         service.setStyles(context, null);
52829     }
52830     function transform2(d2) {
52831       var t2 = svgPointTransform(projection2)(d2);
52832       if (d2.ca) {
52833         t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
52834       }
52835       return t2;
52836     }
52837     function filterImages(images) {
52838       var fromDate = context.photos().fromDate();
52839       var toDate = context.photos().toDate();
52840       var usernames = context.photos().usernames();
52841       if (fromDate) {
52842         var fromTimestamp = new Date(fromDate).getTime();
52843         images = images.filter(function(item) {
52844           return new Date(item.captured_at).getTime() >= fromTimestamp;
52845         });
52846       }
52847       if (toDate) {
52848         var toTimestamp = new Date(toDate).getTime();
52849         images = images.filter(function(item) {
52850           return new Date(item.captured_at).getTime() <= toTimestamp;
52851         });
52852       }
52853       if (usernames) {
52854         images = images.filter(function(item) {
52855           return usernames.indexOf(item.captured_by) !== -1;
52856         });
52857       }
52858       return images;
52859     }
52860     function filterSequences(sequences) {
52861       var fromDate = context.photos().fromDate();
52862       var toDate = context.photos().toDate();
52863       var usernames = context.photos().usernames();
52864       if (fromDate) {
52865         var fromTimestamp = new Date(fromDate).getTime();
52866         sequences = sequences.filter(function(image) {
52867           return new Date(image.properties.captured_at).getTime() >= fromTimestamp;
52868         });
52869       }
52870       if (toDate) {
52871         var toTimestamp = new Date(toDate).getTime();
52872         sequences = sequences.filter(function(image) {
52873           return new Date(image.properties.captured_at).getTime() <= toTimestamp;
52874         });
52875       }
52876       if (usernames) {
52877         sequences = sequences.filter(function(image) {
52878           return usernames.indexOf(image.properties.captured_by) !== -1;
52879         });
52880       }
52881       return sequences;
52882     }
52883     function update() {
52884       var viewer = context.container().select(".photoviewer");
52885       var selected = viewer.empty() ? void 0 : viewer.datum();
52886       var z2 = ~~context.map().zoom();
52887       var showMarkers = z2 >= minMarkerZoom;
52888       var showViewfields = z2 >= minViewfieldZoom2;
52889       var service = getService();
52890       var sequences = [];
52891       var images = [];
52892       if (context.photos().showsFlat()) {
52893         sequences = service ? service.sequences(projection2) : [];
52894         images = service && showMarkers ? service.images(projection2) : [];
52895         sequences = filterSequences(sequences);
52896         images = filterImages(images);
52897       }
52898       var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
52899         return d2.properties.key;
52900       });
52901       traces.exit().remove();
52902       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
52903       var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
52904         return d2.key;
52905       });
52906       groups.exit().remove();
52907       var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
52908       groupsEnter.append("g").attr("class", "viewfield-scale");
52909       var markers = groups.merge(groupsEnter).sort(function(a2, b2) {
52910         return a2 === selected ? 1 : b2 === selected ? -1 : b2.loc[1] - a2.loc[1];
52911       }).attr("transform", transform2).select(".viewfield-scale");
52912       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
52913       var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
52914       viewfields.exit().remove();
52915       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");
52916     }
52917     function drawImages(selection2) {
52918       var enabled = svgKartaviewImages.enabled, service = getService();
52919       layer = selection2.selectAll(".layer-kartaview").data(service ? [0] : []);
52920       layer.exit().remove();
52921       var layerEnter = layer.enter().append("g").attr("class", "layer-kartaview").style("display", enabled ? "block" : "none");
52922       layerEnter.append("g").attr("class", "sequences");
52923       layerEnter.append("g").attr("class", "markers");
52924       layer = layerEnter.merge(layer);
52925       if (enabled) {
52926         if (service && ~~context.map().zoom() >= minZoom4) {
52927           editOn();
52928           update();
52929           service.loadImages(projection2);
52930         } else {
52931           editOff();
52932         }
52933       }
52934     }
52935     drawImages.enabled = function(_2) {
52936       if (!arguments.length)
52937         return svgKartaviewImages.enabled;
52938       svgKartaviewImages.enabled = _2;
52939       if (svgKartaviewImages.enabled) {
52940         showLayer();
52941         context.photos().on("change.kartaview_images", update);
52942       } else {
52943         hideLayer();
52944         context.photos().on("change.kartaview_images", null);
52945       }
52946       dispatch14.call("change");
52947       return this;
52948     };
52949     drawImages.supported = function() {
52950       return !!getService();
52951     };
52952     drawImages.rendered = function(zoom) {
52953       return zoom >= minZoom4;
52954     };
52955     init2();
52956     return drawImages;
52957   }
52958
52959   // modules/svg/mapilio_images.js
52960   function svgMapilioImages(projection2, context, dispatch14) {
52961     const throttledRedraw = throttle_default(function() {
52962       dispatch14.call("change");
52963     }, 1e3);
52964     const minZoom4 = 12;
52965     let layer = select_default2(null);
52966     let _mapilio;
52967     const viewFieldZoomLevel = 18;
52968     function init2() {
52969       if (svgMapilioImages.initialized)
52970         return;
52971       svgMapilioImages.enabled = false;
52972       svgMapilioImages.initialized = true;
52973     }
52974     function getService() {
52975       if (services.mapilio && !_mapilio) {
52976         _mapilio = services.mapilio;
52977         _mapilio.event.on("loadedImages", throttledRedraw);
52978       } else if (!services.mapilio && _mapilio) {
52979         _mapilio = null;
52980       }
52981       return _mapilio;
52982     }
52983     function showLayer() {
52984       const service = getService();
52985       if (!service)
52986         return;
52987       editOn();
52988       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
52989         dispatch14.call("change");
52990       });
52991     }
52992     function hideLayer() {
52993       throttledRedraw.cancel();
52994       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
52995     }
52996     function transform2(d2) {
52997       let t2 = svgPointTransform(projection2)(d2);
52998       if (d2.heading) {
52999         t2 += " rotate(" + Math.floor(d2.heading) + ",0,0)";
53000       }
53001       return t2;
53002     }
53003     function editOn() {
53004       layer.style("display", "block");
53005     }
53006     function editOff() {
53007       layer.selectAll(".viewfield-group").remove();
53008       layer.style("display", "none");
53009     }
53010     function click(d3_event, image) {
53011       const service = getService();
53012       if (!service)
53013         return;
53014       service.ensureViewerLoaded(context, image.id).then(function() {
53015         service.selectImage(context, image.id).showViewer(context);
53016       });
53017       context.map().centerEase(image.loc);
53018     }
53019     function mouseover(d3_event, image) {
53020       const service = getService();
53021       if (service)
53022         service.setStyles(context, image);
53023     }
53024     function mouseout() {
53025       const service = getService();
53026       if (service)
53027         service.setStyles(context, null);
53028     }
53029     function update() {
53030       const z2 = ~~context.map().zoom();
53031       const showViewfields = z2 >= viewFieldZoomLevel;
53032       const service = getService();
53033       let sequences = service ? service.sequences(projection2) : [];
53034       let images = service ? service.images(projection2) : [];
53035       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
53036         return d2.properties.id;
53037       });
53038       traces.exit().remove();
53039       traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
53040       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
53041         return d2.id;
53042       });
53043       groups.exit().remove();
53044       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
53045       groupsEnter.append("g").attr("class", "viewfield-scale");
53046       const markers = groups.merge(groupsEnter).sort(function(a2, b2) {
53047         return b2.loc[1] - a2.loc[1];
53048       }).attr("transform", transform2).select(".viewfield-scale");
53049       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
53050       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
53051       viewfields.exit().remove();
53052       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
53053       function viewfieldPath() {
53054         if (this.parentNode.__data__.isPano) {
53055           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
53056         } else {
53057           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
53058         }
53059       }
53060     }
53061     function drawImages(selection2) {
53062       const enabled = svgMapilioImages.enabled;
53063       const service = getService();
53064       layer = selection2.selectAll(".layer-mapilio").data(service ? [0] : []);
53065       layer.exit().remove();
53066       const layerEnter = layer.enter().append("g").attr("class", "layer-mapilio").style("display", enabled ? "block" : "none");
53067       layerEnter.append("g").attr("class", "sequences");
53068       layerEnter.append("g").attr("class", "markers");
53069       layer = layerEnter.merge(layer);
53070       if (enabled) {
53071         if (service && ~~context.map().zoom() >= minZoom4) {
53072           editOn();
53073           update();
53074           service.loadImages(projection2);
53075           service.loadLines(projection2);
53076         } else {
53077           editOff();
53078         }
53079       }
53080     }
53081     drawImages.enabled = function(_2) {
53082       if (!arguments.length)
53083         return svgMapilioImages.enabled;
53084       svgMapilioImages.enabled = _2;
53085       if (svgMapilioImages.enabled) {
53086         showLayer();
53087         context.photos().on("change.mapilio_images", null);
53088       } else {
53089         hideLayer();
53090         context.photos().on("change.mapilio_images", null);
53091       }
53092       dispatch14.call("change");
53093       return this;
53094     };
53095     drawImages.supported = function() {
53096       return !!getService();
53097     };
53098     drawImages.rendered = function(zoom) {
53099       return zoom >= minZoom4;
53100     };
53101     init2();
53102     return drawImages;
53103   }
53104
53105   // modules/svg/osm.js
53106   function svgOsm(projection2, context, dispatch14) {
53107     var enabled = true;
53108     function drawOsm(selection2) {
53109       selection2.selectAll(".layer-osm").data(["covered", "areas", "lines", "points", "labels"]).enter().append("g").attr("class", function(d2) {
53110         return "layer-osm " + d2;
53111       });
53112       selection2.selectAll(".layer-osm.points").selectAll(".points-group").data(["points", "midpoints", "vertices", "turns"]).enter().append("g").attr("class", function(d2) {
53113         return "points-group " + d2;
53114       });
53115     }
53116     function showLayer() {
53117       var layer = context.surface().selectAll(".data-layer.osm");
53118       layer.interrupt();
53119       layer.classed("disabled", false).style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
53120         dispatch14.call("change");
53121       });
53122     }
53123     function hideLayer() {
53124       var layer = context.surface().selectAll(".data-layer.osm");
53125       layer.interrupt();
53126       layer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
53127         layer.classed("disabled", true);
53128         dispatch14.call("change");
53129       });
53130     }
53131     drawOsm.enabled = function(val) {
53132       if (!arguments.length)
53133         return enabled;
53134       enabled = val;
53135       if (enabled) {
53136         showLayer();
53137       } else {
53138         hideLayer();
53139       }
53140       dispatch14.call("change");
53141       return this;
53142     };
53143     return drawOsm;
53144   }
53145
53146   // modules/svg/notes.js
53147   var _notesEnabled = false;
53148   var _osmService;
53149   function svgNotes(projection2, context, dispatch14) {
53150     if (!dispatch14) {
53151       dispatch14 = dispatch_default("change");
53152     }
53153     var throttledRedraw = throttle_default(function() {
53154       dispatch14.call("change");
53155     }, 1e3);
53156     var minZoom4 = 12;
53157     var touchLayer = select_default2(null);
53158     var drawLayer = select_default2(null);
53159     var _notesVisible = false;
53160     function markerPath(selection2, klass) {
53161       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");
53162     }
53163     function getService() {
53164       if (services.osm && !_osmService) {
53165         _osmService = services.osm;
53166         _osmService.on("loadedNotes", throttledRedraw);
53167       } else if (!services.osm && _osmService) {
53168         _osmService = null;
53169       }
53170       return _osmService;
53171     }
53172     function editOn() {
53173       if (!_notesVisible) {
53174         _notesVisible = true;
53175         drawLayer.style("display", "block");
53176       }
53177     }
53178     function editOff() {
53179       if (_notesVisible) {
53180         _notesVisible = false;
53181         drawLayer.style("display", "none");
53182         drawLayer.selectAll(".note").remove();
53183         touchLayer.selectAll(".note").remove();
53184       }
53185     }
53186     function layerOn() {
53187       editOn();
53188       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
53189         dispatch14.call("change");
53190       });
53191     }
53192     function layerOff() {
53193       throttledRedraw.cancel();
53194       drawLayer.interrupt();
53195       touchLayer.selectAll(".note").remove();
53196       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
53197         editOff();
53198         dispatch14.call("change");
53199       });
53200     }
53201     function updateMarkers() {
53202       if (!_notesVisible || !_notesEnabled)
53203         return;
53204       var service = getService();
53205       var selectedID = context.selectedNoteID();
53206       var data = service ? service.notes(projection2) : [];
53207       var getTransform = svgPointTransform(projection2);
53208       var notes = drawLayer.selectAll(".note").data(data, function(d2) {
53209         return d2.status + d2.id;
53210       });
53211       notes.exit().remove();
53212       var notesEnter = notes.enter().append("g").attr("class", function(d2) {
53213         return "note note-" + d2.id + " " + d2.status;
53214       }).classed("new", function(d2) {
53215         return d2.id < 0;
53216       });
53217       notesEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
53218       notesEnter.append("path").call(markerPath, "shadow");
53219       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");
53220       notesEnter.selectAll(".icon-annotation").data(function(d2) {
53221         return [d2];
53222       }).enter().append("use").attr("class", "icon-annotation").attr("width", "10px").attr("height", "10px").attr("x", "-3px").attr("y", "-19px").attr("xlink:href", function(d2) {
53223         if (d2.id < 0)
53224           return "#iD-icon-plus";
53225         if (d2.status === "open")
53226           return "#iD-icon-close";
53227         return "#iD-icon-apply";
53228       });
53229       notes.merge(notesEnter).sort(sortY).classed("selected", function(d2) {
53230         var mode = context.mode();
53231         var isMoving = mode && mode.id === "drag-note";
53232         return !isMoving && d2.id === selectedID;
53233       }).attr("transform", getTransform);
53234       if (touchLayer.empty())
53235         return;
53236       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
53237       var targets = touchLayer.selectAll(".note").data(data, function(d2) {
53238         return d2.id;
53239       });
53240       targets.exit().remove();
53241       targets.enter().append("rect").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").merge(targets).sort(sortY).attr("class", function(d2) {
53242         var newClass = d2.id < 0 ? "new" : "";
53243         return "note target note-" + d2.id + " " + fillClass + newClass;
53244       }).attr("transform", getTransform);
53245       function sortY(a2, b2) {
53246         if (a2.id === selectedID)
53247           return 1;
53248         if (b2.id === selectedID)
53249           return -1;
53250         return b2.loc[1] - a2.loc[1];
53251       }
53252     }
53253     function drawNotes(selection2) {
53254       var service = getService();
53255       var surface = context.surface();
53256       if (surface && !surface.empty()) {
53257         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
53258       }
53259       drawLayer = selection2.selectAll(".layer-notes").data(service ? [0] : []);
53260       drawLayer.exit().remove();
53261       drawLayer = drawLayer.enter().append("g").attr("class", "layer-notes").style("display", _notesEnabled ? "block" : "none").merge(drawLayer);
53262       if (_notesEnabled) {
53263         if (service && ~~context.map().zoom() >= minZoom4) {
53264           editOn();
53265           service.loadNotes(projection2);
53266           updateMarkers();
53267         } else {
53268           editOff();
53269         }
53270       }
53271     }
53272     drawNotes.enabled = function(val) {
53273       if (!arguments.length)
53274         return _notesEnabled;
53275       _notesEnabled = val;
53276       if (_notesEnabled) {
53277         layerOn();
53278       } else {
53279         layerOff();
53280         if (context.selectedNoteID()) {
53281           context.enter(modeBrowse(context));
53282         }
53283       }
53284       dispatch14.call("change");
53285       return this;
53286     };
53287     return drawNotes;
53288   }
53289
53290   // modules/svg/touch.js
53291   function svgTouch() {
53292     function drawTouch(selection2) {
53293       selection2.selectAll(".layer-touch").data(["areas", "lines", "points", "turns", "markers"]).enter().append("g").attr("class", function(d2) {
53294         return "layer-touch " + d2;
53295       });
53296     }
53297     return drawTouch;
53298   }
53299
53300   // modules/util/dimensions.js
53301   function refresh(selection2, node) {
53302     var cr = node.getBoundingClientRect();
53303     var prop = [cr.width, cr.height];
53304     selection2.property("__dimensions__", prop);
53305     return prop;
53306   }
53307   function utilGetDimensions(selection2, force) {
53308     if (!selection2 || selection2.empty()) {
53309       return [0, 0];
53310     }
53311     var node = selection2.node(), cached = selection2.property("__dimensions__");
53312     return !cached || force ? refresh(selection2, node) : cached;
53313   }
53314   function utilSetDimensions(selection2, dimensions) {
53315     if (!selection2 || selection2.empty()) {
53316       return selection2;
53317     }
53318     var node = selection2.node();
53319     if (dimensions === null) {
53320       refresh(selection2, node);
53321       return selection2;
53322     }
53323     return selection2.property("__dimensions__", [dimensions[0], dimensions[1]]).attr("width", dimensions[0]).attr("height", dimensions[1]);
53324   }
53325
53326   // modules/svg/layers.js
53327   function svgLayers(projection2, context) {
53328     var dispatch14 = dispatch_default("change");
53329     var svg2 = select_default2(null);
53330     var _layers = [
53331       { id: "osm", layer: svgOsm(projection2, context, dispatch14) },
53332       { id: "notes", layer: svgNotes(projection2, context, dispatch14) },
53333       { id: "data", layer: svgData(projection2, context, dispatch14) },
53334       { id: "keepRight", layer: svgKeepRight(projection2, context, dispatch14) },
53335       { id: "improveOSM", layer: svgImproveOSM(projection2, context, dispatch14) },
53336       { id: "osmose", layer: svgOsmose(projection2, context, dispatch14) },
53337       { id: "streetside", layer: svgStreetside(projection2, context, dispatch14) },
53338       { id: "mapillary", layer: svgMapillaryImages(projection2, context, dispatch14) },
53339       { id: "mapillary-position", layer: svgMapillaryPosition(projection2, context, dispatch14) },
53340       { id: "mapillary-map-features", layer: svgMapillaryMapFeatures(projection2, context, dispatch14) },
53341       { id: "mapillary-signs", layer: svgMapillarySigns(projection2, context, dispatch14) },
53342       { id: "kartaview", layer: svgKartaviewImages(projection2, context, dispatch14) },
53343       { id: "mapilio", layer: svgMapilioImages(projection2, context, dispatch14) },
53344       { id: "vegbilder", layer: svgVegbilder(projection2, context, dispatch14) },
53345       { id: "local-photos", layer: svgLocalPhotos(projection2, context, dispatch14) },
53346       { id: "debug", layer: svgDebug(projection2, context, dispatch14) },
53347       { id: "geolocate", layer: svgGeolocate(projection2, context, dispatch14) },
53348       { id: "touch", layer: svgTouch(projection2, context, dispatch14) }
53349     ];
53350     function drawLayers(selection2) {
53351       svg2 = selection2.selectAll(".surface").data([0]);
53352       svg2 = svg2.enter().append("svg").attr("class", "surface").merge(svg2);
53353       var defs = svg2.selectAll(".surface-defs").data([0]);
53354       defs.enter().append("defs").attr("class", "surface-defs");
53355       var groups = svg2.selectAll(".data-layer").data(_layers);
53356       groups.exit().remove();
53357       groups.enter().append("g").attr("class", function(d2) {
53358         return "data-layer " + d2.id;
53359       }).merge(groups).each(function(d2) {
53360         select_default2(this).call(d2.layer);
53361       });
53362     }
53363     drawLayers.all = function() {
53364       return _layers;
53365     };
53366     drawLayers.layer = function(id2) {
53367       var obj = _layers.find(function(o2) {
53368         return o2.id === id2;
53369       });
53370       return obj && obj.layer;
53371     };
53372     drawLayers.only = function(what) {
53373       var arr = [].concat(what);
53374       var all = _layers.map(function(layer) {
53375         return layer.id;
53376       });
53377       return drawLayers.remove(utilArrayDifference(all, arr));
53378     };
53379     drawLayers.remove = function(what) {
53380       var arr = [].concat(what);
53381       arr.forEach(function(id2) {
53382         _layers = _layers.filter(function(o2) {
53383           return o2.id !== id2;
53384         });
53385       });
53386       dispatch14.call("change");
53387       return this;
53388     };
53389     drawLayers.add = function(what) {
53390       var arr = [].concat(what);
53391       arr.forEach(function(obj) {
53392         if ("id" in obj && "layer" in obj) {
53393           _layers.push(obj);
53394         }
53395       });
53396       dispatch14.call("change");
53397       return this;
53398     };
53399     drawLayers.dimensions = function(val) {
53400       if (!arguments.length)
53401         return utilGetDimensions(svg2);
53402       utilSetDimensions(svg2, val);
53403       return this;
53404     };
53405     return utilRebind(drawLayers, dispatch14, "on");
53406   }
53407
53408   // modules/svg/lines.js
53409   var import_fast_deep_equal6 = __toESM(require_fast_deep_equal());
53410   function svgLines(projection2, context) {
53411     var detected = utilDetect();
53412     var highway_stack = {
53413       motorway: 0,
53414       motorway_link: 1,
53415       trunk: 2,
53416       trunk_link: 3,
53417       primary: 4,
53418       primary_link: 5,
53419       secondary: 6,
53420       tertiary: 7,
53421       unclassified: 8,
53422       residential: 9,
53423       service: 10,
53424       footway: 11
53425     };
53426     function drawTargets(selection2, graph, entities, filter2) {
53427       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
53428       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
53429       var getPath = svgPath(projection2).geojson;
53430       var activeID = context.activeID();
53431       var base = context.history().base();
53432       var data = { targets: [], nopes: [] };
53433       entities.forEach(function(way) {
53434         var features = svgSegmentWay(way, graph, activeID);
53435         data.targets.push.apply(data.targets, features.passive);
53436         data.nopes.push.apply(data.nopes, features.active);
53437       });
53438       var targetData = data.targets.filter(getPath);
53439       var targets = selection2.selectAll(".line.target-allowed").filter(function(d2) {
53440         return filter2(d2.properties.entity);
53441       }).data(targetData, function key(d2) {
53442         return d2.id;
53443       });
53444       targets.exit().remove();
53445       var segmentWasEdited = function(d2) {
53446         var wayID = d2.properties.entity.id;
53447         if (!base.entities[wayID] || !(0, import_fast_deep_equal6.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
53448           return false;
53449         }
53450         return d2.properties.nodes.some(function(n3) {
53451           return !base.entities[n3.id] || !(0, import_fast_deep_equal6.default)(graph.entities[n3.id].loc, base.entities[n3.id].loc);
53452         });
53453       };
53454       targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d2) {
53455         return "way line target target-allowed " + targetClass + d2.id;
53456       }).classed("segment-edited", segmentWasEdited);
53457       var nopeData = data.nopes.filter(getPath);
53458       var nopes = selection2.selectAll(".line.target-nope").filter(function(d2) {
53459         return filter2(d2.properties.entity);
53460       }).data(nopeData, function key(d2) {
53461         return d2.id;
53462       });
53463       nopes.exit().remove();
53464       nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d2) {
53465         return "way line target target-nope " + nopeClass + d2.id;
53466       }).classed("segment-edited", segmentWasEdited);
53467     }
53468     function drawLines(selection2, graph, entities, filter2) {
53469       var base = context.history().base();
53470       function waystack(a2, b2) {
53471         var selected = context.selectedIDs();
53472         var scoreA = selected.indexOf(a2.id) !== -1 ? 20 : 0;
53473         var scoreB = selected.indexOf(b2.id) !== -1 ? 20 : 0;
53474         if (a2.tags.highway) {
53475           scoreA -= highway_stack[a2.tags.highway];
53476         }
53477         if (b2.tags.highway) {
53478           scoreB -= highway_stack[b2.tags.highway];
53479         }
53480         return scoreA - scoreB;
53481       }
53482       function drawLineGroup(selection3, klass, isSelected) {
53483         var mode = context.mode();
53484         var isDrawing = mode && /^draw/.test(mode.id);
53485         var selectedClass = !isDrawing && isSelected ? "selected " : "";
53486         var lines = selection3.selectAll("path").filter(filter2).data(getPathData(isSelected), osmEntity.key);
53487         lines.exit().remove();
53488         lines.enter().append("path").attr("class", function(d2) {
53489           var prefix = "way line";
53490           if (!d2.hasInterestingTags()) {
53491             var parentRelations = graph.parentRelations(d2);
53492             var parentMultipolygons = parentRelations.filter(function(relation) {
53493               return relation.isMultipolygon();
53494             });
53495             if (parentMultipolygons.length > 0 && // and only multipolygon relations
53496             parentRelations.length === parentMultipolygons.length) {
53497               prefix = "relation area";
53498             }
53499           }
53500           var oldMPClass = oldMultiPolygonOuters[d2.id] ? "old-multipolygon " : "";
53501           return prefix + " " + klass + " " + selectedClass + oldMPClass + d2.id;
53502         }).classed("added", function(d2) {
53503           return !base.entities[d2.id];
53504         }).classed("geometry-edited", function(d2) {
53505           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);
53506         }).classed("retagged", function(d2) {
53507           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);
53508         }).call(svgTagClasses()).merge(lines).sort(waystack).attr("d", getPath).call(svgTagClasses().tags(svgRelationMemberTags(graph)));
53509         return selection3;
53510       }
53511       function getPathData(isSelected) {
53512         return function() {
53513           var layer = this.parentNode.__data__;
53514           var data = pathdata[layer] || [];
53515           return data.filter(function(d2) {
53516             if (isSelected) {
53517               return context.selectedIDs().indexOf(d2.id) !== -1;
53518             } else {
53519               return context.selectedIDs().indexOf(d2.id) === -1;
53520             }
53521           });
53522         };
53523       }
53524       function addMarkers(layergroup, pathclass, groupclass, groupdata, marker) {
53525         var markergroup = layergroup.selectAll("g." + groupclass).data([pathclass]);
53526         markergroup = markergroup.enter().append("g").attr("class", groupclass).merge(markergroup);
53527         var markers = markergroup.selectAll("path").filter(filter2).data(
53528           function data() {
53529             return groupdata[this.parentNode.__data__] || [];
53530           },
53531           function key(d2) {
53532             return [d2.id, d2.index];
53533           }
53534         );
53535         markers.exit().remove();
53536         markers = markers.enter().append("path").attr("class", pathclass).merge(markers).attr("marker-mid", marker).attr("d", function(d2) {
53537           return d2.d;
53538         });
53539         if (detected.ie) {
53540           markers.each(function() {
53541             this.parentNode.insertBefore(this, this);
53542           });
53543         }
53544       }
53545       var getPath = svgPath(projection2, graph);
53546       var ways = [];
53547       var onewaydata = {};
53548       var sideddata = {};
53549       var oldMultiPolygonOuters = {};
53550       for (var i3 = 0; i3 < entities.length; i3++) {
53551         var entity = entities[i3];
53552         var outer = osmOldMultipolygonOuterMember(entity, graph);
53553         if (outer) {
53554           ways.push(entity.mergeTags(outer.tags));
53555           oldMultiPolygonOuters[outer.id] = true;
53556         } else if (entity.geometry(graph) === "line" || entity.geometry(graph) === "area" && entity.sidednessIdentifier && entity.sidednessIdentifier() === "coastline") {
53557           ways.push(entity);
53558         }
53559       }
53560       ways = ways.filter(getPath);
53561       var pathdata = utilArrayGroupBy(ways, function(way) {
53562         return way.layer();
53563       });
53564       Object.keys(pathdata).forEach(function(k2) {
53565         var v2 = pathdata[k2];
53566         var onewayArr = v2.filter(function(d2) {
53567           return d2.isOneWay();
53568         });
53569         var onewaySegments = svgMarkerSegments(
53570           projection2,
53571           graph,
53572           35,
53573           function shouldReverse(entity2) {
53574             return entity2.tags.oneway === "-1";
53575           },
53576           function bothDirections(entity2) {
53577             return entity2.tags.oneway === "reversible" || entity2.tags.oneway === "alternating";
53578           }
53579         );
53580         onewaydata[k2] = utilArrayFlatten(onewayArr.map(onewaySegments));
53581         var sidedArr = v2.filter(function(d2) {
53582           return d2.isSided();
53583         });
53584         var sidedSegments = svgMarkerSegments(
53585           projection2,
53586           graph,
53587           30,
53588           function shouldReverse() {
53589             return false;
53590           },
53591           function bothDirections() {
53592             return false;
53593           }
53594         );
53595         sideddata[k2] = utilArrayFlatten(sidedArr.map(sidedSegments));
53596       });
53597       var covered = selection2.selectAll(".layer-osm.covered");
53598       var uncovered = selection2.selectAll(".layer-osm.lines");
53599       var touchLayer = selection2.selectAll(".layer-touch.lines");
53600       [covered, uncovered].forEach(function(selection3) {
53601         var range3 = selection3 === covered ? range(-10, 0) : range(0, 11);
53602         var layergroup = selection3.selectAll("g.layergroup").data(range3);
53603         layergroup = layergroup.enter().append("g").attr("class", function(d2) {
53604           return "layergroup layer" + String(d2);
53605         }).merge(layergroup);
53606         layergroup.selectAll("g.linegroup").data(["shadow", "casing", "stroke", "shadow-highlighted", "casing-highlighted", "stroke-highlighted"]).enter().append("g").attr("class", function(d2) {
53607           return "linegroup line-" + d2;
53608         });
53609         layergroup.selectAll("g.line-shadow").call(drawLineGroup, "shadow", false);
53610         layergroup.selectAll("g.line-casing").call(drawLineGroup, "casing", false);
53611         layergroup.selectAll("g.line-stroke").call(drawLineGroup, "stroke", false);
53612         layergroup.selectAll("g.line-shadow-highlighted").call(drawLineGroup, "shadow", true);
53613         layergroup.selectAll("g.line-casing-highlighted").call(drawLineGroup, "casing", true);
53614         layergroup.selectAll("g.line-stroke-highlighted").call(drawLineGroup, "stroke", true);
53615         addMarkers(layergroup, "oneway", "onewaygroup", onewaydata, "url(#ideditor-oneway-marker)");
53616         addMarkers(
53617           layergroup,
53618           "sided",
53619           "sidedgroup",
53620           sideddata,
53621           function marker(d2) {
53622             var category = graph.entity(d2.id).sidednessIdentifier();
53623             return "url(#ideditor-sided-marker-" + category + ")";
53624           }
53625         );
53626       });
53627       touchLayer.call(drawTargets, graph, ways, filter2);
53628     }
53629     return drawLines;
53630   }
53631
53632   // modules/svg/midpoints.js
53633   function svgMidpoints(projection2, context) {
53634     var targetRadius = 8;
53635     function drawTargets(selection2, graph, entities, filter2) {
53636       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
53637       var getTransform = svgPointTransform(projection2).geojson;
53638       var data = entities.map(function(midpoint) {
53639         return {
53640           type: "Feature",
53641           id: midpoint.id,
53642           properties: {
53643             target: true,
53644             entity: midpoint
53645           },
53646           geometry: {
53647             type: "Point",
53648             coordinates: midpoint.loc
53649           }
53650         };
53651       });
53652       var targets = selection2.selectAll(".midpoint.target").filter(function(d2) {
53653         return filter2(d2.properties.entity);
53654       }).data(data, function key(d2) {
53655         return d2.id;
53656       });
53657       targets.exit().remove();
53658       targets.enter().append("circle").attr("r", targetRadius).merge(targets).attr("class", function(d2) {
53659         return "node midpoint target " + fillClass + d2.id;
53660       }).attr("transform", getTransform);
53661     }
53662     function drawMidpoints(selection2, graph, entities, filter2, extent) {
53663       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.midpoints");
53664       var touchLayer = selection2.selectAll(".layer-touch.points");
53665       var mode = context.mode();
53666       if (mode && mode.id !== "select" || !context.map().withinEditableZoom()) {
53667         drawLayer.selectAll(".midpoint").remove();
53668         touchLayer.selectAll(".midpoint.target").remove();
53669         return;
53670       }
53671       var poly = extent.polygon();
53672       var midpoints = {};
53673       for (var i3 = 0; i3 < entities.length; i3++) {
53674         var entity = entities[i3];
53675         if (entity.type !== "way")
53676           continue;
53677         if (!filter2(entity))
53678           continue;
53679         if (context.selectedIDs().indexOf(entity.id) < 0)
53680           continue;
53681         var nodes = graph.childNodes(entity);
53682         for (var j3 = 0; j3 < nodes.length - 1; j3++) {
53683           var a2 = nodes[j3];
53684           var b2 = nodes[j3 + 1];
53685           var id2 = [a2.id, b2.id].sort().join("-");
53686           if (midpoints[id2]) {
53687             midpoints[id2].parents.push(entity);
53688           } else if (geoVecLength(projection2(a2.loc), projection2(b2.loc)) > 40) {
53689             var point2 = geoVecInterp(a2.loc, b2.loc, 0.5);
53690             var loc = null;
53691             if (extent.intersects(point2)) {
53692               loc = point2;
53693             } else {
53694               for (var k2 = 0; k2 < 4; k2++) {
53695                 point2 = geoLineIntersection([a2.loc, b2.loc], [poly[k2], poly[k2 + 1]]);
53696                 if (point2 && geoVecLength(projection2(a2.loc), projection2(point2)) > 20 && geoVecLength(projection2(b2.loc), projection2(point2)) > 20) {
53697                   loc = point2;
53698                   break;
53699                 }
53700               }
53701             }
53702             if (loc) {
53703               midpoints[id2] = {
53704                 type: "midpoint",
53705                 id: id2,
53706                 loc,
53707                 edge: [a2.id, b2.id],
53708                 parents: [entity]
53709               };
53710             }
53711           }
53712         }
53713       }
53714       function midpointFilter(d2) {
53715         if (midpoints[d2.id])
53716           return true;
53717         for (var i4 = 0; i4 < d2.parents.length; i4++) {
53718           if (filter2(d2.parents[i4])) {
53719             return true;
53720           }
53721         }
53722         return false;
53723       }
53724       var groups = drawLayer.selectAll(".midpoint").filter(midpointFilter).data(Object.values(midpoints), function(d2) {
53725         return d2.id;
53726       });
53727       groups.exit().remove();
53728       var enter = groups.enter().insert("g", ":first-child").attr("class", "midpoint");
53729       enter.append("polygon").attr("points", "-6,8 10,0 -6,-8").attr("class", "shadow");
53730       enter.append("polygon").attr("points", "-3,4 5,0 -3,-4").attr("class", "fill");
53731       groups = groups.merge(enter).attr("transform", function(d2) {
53732         var translate = svgPointTransform(projection2);
53733         var a3 = graph.entity(d2.edge[0]);
53734         var b3 = graph.entity(d2.edge[1]);
53735         var angle2 = geoAngle(a3, b3, projection2) * (180 / Math.PI);
53736         return translate(d2) + " rotate(" + angle2 + ")";
53737       }).call(svgTagClasses().tags(
53738         function(d2) {
53739           return d2.parents[0].tags;
53740         }
53741       ));
53742       groups.select("polygon.shadow");
53743       groups.select("polygon.fill");
53744       touchLayer.call(drawTargets, graph, Object.values(midpoints), midpointFilter);
53745     }
53746     return drawMidpoints;
53747   }
53748
53749   // modules/svg/points.js
53750   var import_fast_deep_equal7 = __toESM(require_fast_deep_equal());
53751   function svgPoints(projection2, context) {
53752     function markerPath(selection2, klass) {
53753       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");
53754     }
53755     function sortY(a2, b2) {
53756       return b2.loc[1] - a2.loc[1];
53757     }
53758     function fastEntityKey(d2) {
53759       var mode = context.mode();
53760       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
53761       return isMoving ? d2.id : osmEntity.key(d2);
53762     }
53763     function drawTargets(selection2, graph, entities, filter2) {
53764       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
53765       var getTransform = svgPointTransform(projection2).geojson;
53766       var activeID = context.activeID();
53767       var data = [];
53768       entities.forEach(function(node) {
53769         if (activeID === node.id)
53770           return;
53771         data.push({
53772           type: "Feature",
53773           id: node.id,
53774           properties: {
53775             target: true,
53776             entity: node
53777           },
53778           geometry: node.asGeoJSON()
53779         });
53780       });
53781       var targets = selection2.selectAll(".point.target").filter(function(d2) {
53782         return filter2(d2.properties.entity);
53783       }).data(data, function key(d2) {
53784         return d2.id;
53785       });
53786       targets.exit().remove();
53787       targets.enter().append("rect").attr("x", -10).attr("y", -26).attr("width", 20).attr("height", 30).merge(targets).attr("class", function(d2) {
53788         return "node point target " + fillClass + d2.id;
53789       }).attr("transform", getTransform);
53790     }
53791     function drawPoints(selection2, graph, entities, filter2) {
53792       var wireframe = context.surface().classed("fill-wireframe");
53793       var zoom = geoScaleToZoom(projection2.scale());
53794       var base = context.history().base();
53795       function renderAsPoint(entity) {
53796         return entity.geometry(graph) === "point" && !(zoom >= 18 && entity.directions(graph, projection2).length);
53797       }
53798       var points = wireframe ? [] : entities.filter(renderAsPoint);
53799       points.sort(sortY);
53800       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.points");
53801       var touchLayer = selection2.selectAll(".layer-touch.points");
53802       var groups = drawLayer.selectAll("g.point").filter(filter2).data(points, fastEntityKey);
53803       groups.exit().remove();
53804       var enter = groups.enter().append("g").attr("class", function(d2) {
53805         return "node point " + d2.id;
53806       }).order();
53807       enter.append("path").call(markerPath, "shadow");
53808       enter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
53809       enter.append("path").call(markerPath, "stroke");
53810       enter.append("use").attr("transform", "translate(-5.5, -20)").attr("class", "icon").attr("width", "12px").attr("height", "12px");
53811       groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("added", function(d2) {
53812         return !base.entities[d2.id];
53813       }).classed("moved", function(d2) {
53814         return base.entities[d2.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d2.id].loc, base.entities[d2.id].loc);
53815       }).classed("retagged", function(d2) {
53816         return base.entities[d2.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
53817       }).call(svgTagClasses());
53818       groups.select(".shadow");
53819       groups.select(".stroke");
53820       groups.select(".icon").attr("xlink:href", function(entity) {
53821         var preset = _mainPresetIndex.match(entity, graph);
53822         var picon = preset && preset.icon;
53823         return picon ? "#" + picon : "";
53824       });
53825       touchLayer.call(drawTargets, graph, points, filter2);
53826     }
53827     return drawPoints;
53828   }
53829
53830   // modules/svg/turns.js
53831   function svgTurns(projection2, context) {
53832     function icon2(turn) {
53833       var u2 = turn.u ? "-u" : "";
53834       if (turn.no)
53835         return "#iD-turn-no" + u2;
53836       if (turn.only)
53837         return "#iD-turn-only" + u2;
53838       return "#iD-turn-yes" + u2;
53839     }
53840     function drawTurns(selection2, graph, turns) {
53841       function turnTransform(d2) {
53842         var pxRadius = 50;
53843         var toWay = graph.entity(d2.to.way);
53844         var toPoints = graph.childNodes(toWay).map(function(n3) {
53845           return n3.loc;
53846         }).map(projection2);
53847         var toLength = geoPathLength(toPoints);
53848         var mid = toLength / 2;
53849         var toNode = graph.entity(d2.to.node);
53850         var toVertex = graph.entity(d2.to.vertex);
53851         var a2 = geoAngle(toVertex, toNode, projection2);
53852         var o2 = projection2(toVertex.loc);
53853         var r2 = d2.u ? 0 : !toWay.__via ? pxRadius : Math.min(mid, pxRadius);
53854         return "translate(" + (r2 * Math.cos(a2) + o2[0]) + "," + (r2 * Math.sin(a2) + o2[1]) + ") rotate(" + a2 * 180 / Math.PI + ")";
53855       }
53856       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.turns");
53857       var touchLayer = selection2.selectAll(".layer-touch.turns");
53858       var groups = drawLayer.selectAll("g.turn").data(turns, function(d2) {
53859         return d2.key;
53860       });
53861       groups.exit().remove();
53862       var groupsEnter = groups.enter().append("g").attr("class", function(d2) {
53863         return "turn " + d2.key;
53864       });
53865       var turnsEnter = groupsEnter.filter(function(d2) {
53866         return !d2.u;
53867       });
53868       turnsEnter.append("rect").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
53869       turnsEnter.append("use").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
53870       var uEnter = groupsEnter.filter(function(d2) {
53871         return d2.u;
53872       });
53873       uEnter.append("circle").attr("r", "16");
53874       uEnter.append("use").attr("transform", "translate(-16, -16)").attr("width", "32").attr("height", "32");
53875       groups = groups.merge(groupsEnter).attr("opacity", function(d2) {
53876         return d2.direct === false ? "0.7" : null;
53877       }).attr("transform", turnTransform);
53878       groups.select("use").attr("xlink:href", icon2);
53879       groups.select("rect");
53880       groups.select("circle");
53881       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
53882       groups = touchLayer.selectAll("g.turn").data(turns, function(d2) {
53883         return d2.key;
53884       });
53885       groups.exit().remove();
53886       groupsEnter = groups.enter().append("g").attr("class", function(d2) {
53887         return "turn " + d2.key;
53888       });
53889       turnsEnter = groupsEnter.filter(function(d2) {
53890         return !d2.u;
53891       });
53892       turnsEnter.append("rect").attr("class", "target " + fillClass).attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
53893       uEnter = groupsEnter.filter(function(d2) {
53894         return d2.u;
53895       });
53896       uEnter.append("circle").attr("class", "target " + fillClass).attr("r", "16");
53897       groups = groups.merge(groupsEnter).attr("transform", turnTransform);
53898       groups.select("rect");
53899       groups.select("circle");
53900       return this;
53901     }
53902     return drawTurns;
53903   }
53904
53905   // modules/svg/vertices.js
53906   var import_fast_deep_equal8 = __toESM(require_fast_deep_equal());
53907   function svgVertices(projection2, context) {
53908     var radiuses = {
53909       //       z16-, z17,   z18+,  w/icon
53910       shadow: [6, 7.5, 7.5, 12],
53911       stroke: [2.5, 3.5, 3.5, 8],
53912       fill: [1, 1.5, 1.5, 1.5]
53913     };
53914     var _currHoverTarget;
53915     var _currPersistent = {};
53916     var _currHover = {};
53917     var _prevHover = {};
53918     var _currSelected = {};
53919     var _prevSelected = {};
53920     var _radii = {};
53921     function sortY(a2, b2) {
53922       return b2.loc[1] - a2.loc[1];
53923     }
53924     function fastEntityKey(d2) {
53925       var mode = context.mode();
53926       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
53927       return isMoving ? d2.id : osmEntity.key(d2);
53928     }
53929     function draw(selection2, graph, vertices, sets2, filter2) {
53930       sets2 = sets2 || { selected: {}, important: {}, hovered: {} };
53931       var icons = {};
53932       var directions = {};
53933       var wireframe = context.surface().classed("fill-wireframe");
53934       var zoom = geoScaleToZoom(projection2.scale());
53935       var z2 = zoom < 17 ? 0 : zoom < 18 ? 1 : 2;
53936       var activeID = context.activeID();
53937       var base = context.history().base();
53938       function getIcon(d2) {
53939         var entity = graph.entity(d2.id);
53940         if (entity.id in icons)
53941           return icons[entity.id];
53942         icons[entity.id] = entity.hasInterestingTags() && _mainPresetIndex.match(entity, graph).icon;
53943         return icons[entity.id];
53944       }
53945       function getDirections(entity) {
53946         if (entity.id in directions)
53947           return directions[entity.id];
53948         var angles = entity.directions(graph, projection2);
53949         directions[entity.id] = angles.length ? angles : false;
53950         return angles;
53951       }
53952       function updateAttributes(selection3) {
53953         ["shadow", "stroke", "fill"].forEach(function(klass) {
53954           var rads = radiuses[klass];
53955           selection3.selectAll("." + klass).each(function(entity) {
53956             var i3 = z2 && getIcon(entity);
53957             var r2 = rads[i3 ? 3 : z2];
53958             if (entity.id !== activeID && entity.isEndpoint(graph) && !entity.isConnected(graph)) {
53959               r2 += 1.5;
53960             }
53961             if (klass === "shadow") {
53962               _radii[entity.id] = r2;
53963             }
53964             select_default2(this).attr("r", r2).attr("visibility", i3 && klass === "fill" ? "hidden" : null);
53965           });
53966         });
53967       }
53968       vertices.sort(sortY);
53969       var groups = selection2.selectAll("g.vertex").filter(filter2).data(vertices, fastEntityKey);
53970       groups.exit().remove();
53971       var enter = groups.enter().append("g").attr("class", function(d2) {
53972         return "node vertex " + d2.id;
53973       }).order();
53974       enter.append("circle").attr("class", "shadow");
53975       enter.append("circle").attr("class", "stroke");
53976       enter.filter(function(d2) {
53977         return d2.hasInterestingTags();
53978       }).append("circle").attr("class", "fill");
53979       groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("sibling", function(d2) {
53980         return d2.id in sets2.selected;
53981       }).classed("shared", function(d2) {
53982         return graph.isShared(d2);
53983       }).classed("endpoint", function(d2) {
53984         return d2.isEndpoint(graph);
53985       }).classed("added", function(d2) {
53986         return !base.entities[d2.id];
53987       }).classed("moved", function(d2) {
53988         return base.entities[d2.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d2.id].loc, base.entities[d2.id].loc);
53989       }).classed("retagged", function(d2) {
53990         return base.entities[d2.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
53991       }).call(updateAttributes);
53992       var iconUse = groups.selectAll(".icon").data(function data(d2) {
53993         return zoom >= 17 && getIcon(d2) ? [d2] : [];
53994       }, fastEntityKey);
53995       iconUse.exit().remove();
53996       iconUse.enter().append("use").attr("class", "icon").attr("width", "12px").attr("height", "12px").attr("transform", "translate(-6, -6)").attr("xlink:href", function(d2) {
53997         var picon = getIcon(d2);
53998         return picon ? "#" + picon : "";
53999       });
54000       var dgroups = groups.selectAll(".viewfieldgroup").data(function data(d2) {
54001         return zoom >= 18 && getDirections(d2) ? [d2] : [];
54002       }, fastEntityKey);
54003       dgroups.exit().remove();
54004       dgroups = dgroups.enter().insert("g", ".shadow").attr("class", "viewfieldgroup").merge(dgroups);
54005       var viewfields = dgroups.selectAll(".viewfield").data(getDirections, function key(d2) {
54006         return osmEntity.key(d2);
54007       });
54008       viewfields.exit().remove();
54009       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) {
54010         return "rotate(" + d2 + ")";
54011       });
54012     }
54013     function drawTargets(selection2, graph, entities, filter2) {
54014       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
54015       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
54016       var getTransform = svgPointTransform(projection2).geojson;
54017       var activeID = context.activeID();
54018       var data = { targets: [], nopes: [] };
54019       entities.forEach(function(node) {
54020         if (activeID === node.id)
54021           return;
54022         var vertexType = svgPassiveVertex(node, graph, activeID);
54023         if (vertexType !== 0) {
54024           data.targets.push({
54025             type: "Feature",
54026             id: node.id,
54027             properties: {
54028               target: true,
54029               entity: node
54030             },
54031             geometry: node.asGeoJSON()
54032           });
54033         } else {
54034           data.nopes.push({
54035             type: "Feature",
54036             id: node.id + "-nope",
54037             properties: {
54038               nope: true,
54039               target: true,
54040               entity: node
54041             },
54042             geometry: node.asGeoJSON()
54043           });
54044         }
54045       });
54046       var targets = selection2.selectAll(".vertex.target-allowed").filter(function(d2) {
54047         return filter2(d2.properties.entity);
54048       }).data(data.targets, function key(d2) {
54049         return d2.id;
54050       });
54051       targets.exit().remove();
54052       targets.enter().append("circle").attr("r", function(d2) {
54053         return _radii[d2.id] || radiuses.shadow[3];
54054       }).merge(targets).attr("class", function(d2) {
54055         return "node vertex target target-allowed " + targetClass + d2.id;
54056       }).attr("transform", getTransform);
54057       var nopes = selection2.selectAll(".vertex.target-nope").filter(function(d2) {
54058         return filter2(d2.properties.entity);
54059       }).data(data.nopes, function key(d2) {
54060         return d2.id;
54061       });
54062       nopes.exit().remove();
54063       nopes.enter().append("circle").attr("r", function(d2) {
54064         return _radii[d2.properties.entity.id] || radiuses.shadow[3];
54065       }).merge(nopes).attr("class", function(d2) {
54066         return "node vertex target target-nope " + nopeClass + d2.id;
54067       }).attr("transform", getTransform);
54068     }
54069     function renderAsVertex(entity, graph, wireframe, zoom) {
54070       var geometry = entity.geometry(graph);
54071       return geometry === "vertex" || geometry === "point" && (wireframe || zoom >= 18 && entity.directions(graph, projection2).length);
54072     }
54073     function isEditedNode(node, base, head) {
54074       var baseNode = base.entities[node.id];
54075       var headNode = head.entities[node.id];
54076       return !headNode || !baseNode || !(0, import_fast_deep_equal8.default)(headNode.tags, baseNode.tags) || !(0, import_fast_deep_equal8.default)(headNode.loc, baseNode.loc);
54077     }
54078     function getSiblingAndChildVertices(ids, graph, wireframe, zoom) {
54079       var results = {};
54080       var seenIds = {};
54081       function addChildVertices(entity) {
54082         if (seenIds[entity.id])
54083           return;
54084         seenIds[entity.id] = true;
54085         var geometry = entity.geometry(graph);
54086         if (!context.features().isHiddenFeature(entity, graph, geometry)) {
54087           var i3;
54088           if (entity.type === "way") {
54089             for (i3 = 0; i3 < entity.nodes.length; i3++) {
54090               var child = graph.hasEntity(entity.nodes[i3]);
54091               if (child) {
54092                 addChildVertices(child);
54093               }
54094             }
54095           } else if (entity.type === "relation") {
54096             for (i3 = 0; i3 < entity.members.length; i3++) {
54097               var member = graph.hasEntity(entity.members[i3].id);
54098               if (member) {
54099                 addChildVertices(member);
54100               }
54101             }
54102           } else if (renderAsVertex(entity, graph, wireframe, zoom)) {
54103             results[entity.id] = entity;
54104           }
54105         }
54106       }
54107       ids.forEach(function(id2) {
54108         var entity = graph.hasEntity(id2);
54109         if (!entity)
54110           return;
54111         if (entity.type === "node") {
54112           if (renderAsVertex(entity, graph, wireframe, zoom)) {
54113             results[entity.id] = entity;
54114             graph.parentWays(entity).forEach(function(entity2) {
54115               addChildVertices(entity2);
54116             });
54117           }
54118         } else {
54119           addChildVertices(entity);
54120         }
54121       });
54122       return results;
54123     }
54124     function drawVertices(selection2, graph, entities, filter2, extent, fullRedraw) {
54125       var wireframe = context.surface().classed("fill-wireframe");
54126       var visualDiff = context.surface().classed("highlight-edited");
54127       var zoom = geoScaleToZoom(projection2.scale());
54128       var mode = context.mode();
54129       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
54130       var base = context.history().base();
54131       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.vertices");
54132       var touchLayer = selection2.selectAll(".layer-touch.points");
54133       if (fullRedraw) {
54134         _currPersistent = {};
54135         _radii = {};
54136       }
54137       for (var i3 = 0; i3 < entities.length; i3++) {
54138         var entity = entities[i3];
54139         var geometry = entity.geometry(graph);
54140         var keep = false;
54141         if (geometry === "point" && renderAsVertex(entity, graph, wireframe, zoom)) {
54142           _currPersistent[entity.id] = entity;
54143           keep = true;
54144         } else if (geometry === "vertex" && (entity.hasInterestingTags() || entity.isEndpoint(graph) || entity.isConnected(graph) || visualDiff && isEditedNode(entity, base, graph))) {
54145           _currPersistent[entity.id] = entity;
54146           keep = true;
54147         }
54148         if (!keep && !fullRedraw) {
54149           delete _currPersistent[entity.id];
54150         }
54151       }
54152       var sets2 = {
54153         persistent: _currPersistent,
54154         // persistent = important vertices (render always)
54155         selected: _currSelected,
54156         // selected + siblings of selected (render always)
54157         hovered: _currHover
54158         // hovered + siblings of hovered (render only in draw modes)
54159       };
54160       var all = Object.assign({}, isMoving ? _currHover : {}, _currSelected, _currPersistent);
54161       var filterRendered = function(d2) {
54162         return d2.id in _currPersistent || d2.id in _currSelected || d2.id in _currHover || filter2(d2);
54163       };
54164       drawLayer.call(draw, graph, currentVisible(all), sets2, filterRendered);
54165       var filterTouch = function(d2) {
54166         return isMoving ? true : filterRendered(d2);
54167       };
54168       touchLayer.call(drawTargets, graph, currentVisible(all), filterTouch);
54169       function currentVisible(which) {
54170         return Object.keys(which).map(graph.hasEntity, graph).filter(function(entity2) {
54171           return entity2 && entity2.intersects(extent, graph);
54172         });
54173       }
54174     }
54175     drawVertices.drawSelected = function(selection2, graph, extent) {
54176       var wireframe = context.surface().classed("fill-wireframe");
54177       var zoom = geoScaleToZoom(projection2.scale());
54178       _prevSelected = _currSelected || {};
54179       if (context.map().isInWideSelection()) {
54180         _currSelected = {};
54181         context.selectedIDs().forEach(function(id2) {
54182           var entity = graph.hasEntity(id2);
54183           if (!entity)
54184             return;
54185           if (entity.type === "node") {
54186             if (renderAsVertex(entity, graph, wireframe, zoom)) {
54187               _currSelected[entity.id] = entity;
54188             }
54189           }
54190         });
54191       } else {
54192         _currSelected = getSiblingAndChildVertices(context.selectedIDs(), graph, wireframe, zoom);
54193       }
54194       var filter2 = function(d2) {
54195         return d2.id in _prevSelected;
54196       };
54197       drawVertices(selection2, graph, Object.values(_prevSelected), filter2, extent, false);
54198     };
54199     drawVertices.drawHover = function(selection2, graph, target, extent) {
54200       if (target === _currHoverTarget)
54201         return;
54202       var wireframe = context.surface().classed("fill-wireframe");
54203       var zoom = geoScaleToZoom(projection2.scale());
54204       _prevHover = _currHover || {};
54205       _currHoverTarget = target;
54206       var entity = target && target.properties && target.properties.entity;
54207       if (entity) {
54208         _currHover = getSiblingAndChildVertices([entity.id], graph, wireframe, zoom);
54209       } else {
54210         _currHover = {};
54211       }
54212       var filter2 = function(d2) {
54213         return d2.id in _prevHover;
54214       };
54215       drawVertices(selection2, graph, Object.values(_prevHover), filter2, extent, false);
54216     };
54217     return drawVertices;
54218   }
54219
54220   // modules/util/bind_once.js
54221   function utilBindOnce(target, type2, listener, capture) {
54222     var typeOnce = type2 + ".once";
54223     function one2() {
54224       target.on(typeOnce, null);
54225       listener.apply(this, arguments);
54226     }
54227     target.on(typeOnce, one2, capture);
54228     return this;
54229   }
54230
54231   // modules/util/zoom_pan.js
54232   function defaultFilter3(d3_event) {
54233     return !d3_event.ctrlKey && !d3_event.button;
54234   }
54235   function defaultExtent2() {
54236     var e3 = this;
54237     if (e3 instanceof SVGElement) {
54238       e3 = e3.ownerSVGElement || e3;
54239       if (e3.hasAttribute("viewBox")) {
54240         e3 = e3.viewBox.baseVal;
54241         return [[e3.x, e3.y], [e3.x + e3.width, e3.y + e3.height]];
54242       }
54243       return [[0, 0], [e3.width.baseVal.value, e3.height.baseVal.value]];
54244     }
54245     return [[0, 0], [e3.clientWidth, e3.clientHeight]];
54246   }
54247   function defaultWheelDelta2(d3_event) {
54248     return -d3_event.deltaY * (d3_event.deltaMode === 1 ? 0.05 : d3_event.deltaMode ? 1 : 2e-3);
54249   }
54250   function defaultConstrain2(transform2, extent, translateExtent) {
54251     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];
54252     return transform2.translate(
54253       dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
54254       dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
54255     );
54256   }
54257   function utilZoomPan() {
54258     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;
54259     function zoom(selection2) {
54260       selection2.on("pointerdown.zoom", pointerdown).on("wheel.zoom", wheeled).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
54261       select_default2(window).on("pointermove.zoompan", pointermove).on("pointerup.zoompan pointercancel.zoompan", pointerup);
54262     }
54263     zoom.transform = function(collection, transform2, point2) {
54264       var selection2 = collection.selection ? collection.selection() : collection;
54265       if (collection !== selection2) {
54266         schedule(collection, transform2, point2);
54267       } else {
54268         selection2.interrupt().each(function() {
54269           gesture(this, arguments).start(null).zoom(null, null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end(null);
54270         });
54271       }
54272     };
54273     zoom.scaleBy = function(selection2, k2, p2) {
54274       zoom.scaleTo(selection2, function() {
54275         var k0 = _transform.k, k1 = typeof k2 === "function" ? k2.apply(this, arguments) : k2;
54276         return k0 * k1;
54277       }, p2);
54278     };
54279     zoom.scaleTo = function(selection2, k2, p2) {
54280       zoom.transform(selection2, function() {
54281         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;
54282         return constrain(translate(scale(t0, k1), p02, p1), e3, translateExtent);
54283       }, p2);
54284     };
54285     zoom.translateBy = function(selection2, x2, y2) {
54286       zoom.transform(selection2, function() {
54287         return constrain(_transform.translate(
54288           typeof x2 === "function" ? x2.apply(this, arguments) : x2,
54289           typeof y2 === "function" ? y2.apply(this, arguments) : y2
54290         ), extent.apply(this, arguments), translateExtent);
54291       });
54292     };
54293     zoom.translateTo = function(selection2, x2, y2, p2) {
54294       zoom.transform(selection2, function() {
54295         var e3 = extent.apply(this, arguments), t2 = _transform, p02 = !p2 ? centroid(e3) : typeof p2 === "function" ? p2.apply(this, arguments) : p2;
54296         return constrain(identity2.translate(p02[0], p02[1]).scale(t2.k).translate(
54297           typeof x2 === "function" ? -x2.apply(this, arguments) : -x2,
54298           typeof y2 === "function" ? -y2.apply(this, arguments) : -y2
54299         ), e3, translateExtent);
54300       }, p2);
54301     };
54302     function scale(transform2, k2) {
54303       k2 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k2));
54304       return k2 === transform2.k ? transform2 : new Transform(k2, transform2.x, transform2.y);
54305     }
54306     function translate(transform2, p02, p1) {
54307       var x2 = p02[0] - p1[0] * transform2.k, y2 = p02[1] - p1[1] * transform2.k;
54308       return x2 === transform2.x && y2 === transform2.y ? transform2 : new Transform(transform2.k, x2, y2);
54309     }
54310     function centroid(extent2) {
54311       return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
54312     }
54313     function schedule(transition2, transform2, point2) {
54314       transition2.on("start.zoom", function() {
54315         gesture(this, arguments).start(null);
54316       }).on("interrupt.zoom end.zoom", function() {
54317         gesture(this, arguments).end(null);
54318       }).tween("zoom", function() {
54319         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));
54320         return function(t2) {
54321           if (t2 === 1) {
54322             t2 = b2;
54323           } else {
54324             var l2 = i3(t2);
54325             var k2 = w2 / l2[2];
54326             t2 = new Transform(k2, p2[0] - l2[0] * k2, p2[1] - l2[1] * k2);
54327           }
54328           g3.zoom(null, null, t2);
54329         };
54330       });
54331     }
54332     function gesture(that, args, clean2) {
54333       return !clean2 && _activeGesture || new Gesture(that, args);
54334     }
54335     function Gesture(that, args) {
54336       this.that = that;
54337       this.args = args;
54338       this.active = 0;
54339       this.extent = extent.apply(that, args);
54340     }
54341     Gesture.prototype = {
54342       start: function(d3_event) {
54343         if (++this.active === 1) {
54344           _activeGesture = this;
54345           dispatch14.call("start", this, d3_event);
54346         }
54347         return this;
54348       },
54349       zoom: function(d3_event, key, transform2) {
54350         if (this.mouse && key !== "mouse")
54351           this.mouse[1] = transform2.invert(this.mouse[0]);
54352         if (this.pointer0 && key !== "touch")
54353           this.pointer0[1] = transform2.invert(this.pointer0[0]);
54354         if (this.pointer1 && key !== "touch")
54355           this.pointer1[1] = transform2.invert(this.pointer1[0]);
54356         _transform = transform2;
54357         dispatch14.call("zoom", this, d3_event, key, transform2);
54358         return this;
54359       },
54360       end: function(d3_event) {
54361         if (--this.active === 0) {
54362           _activeGesture = null;
54363           dispatch14.call("end", this, d3_event);
54364         }
54365         return this;
54366       }
54367     };
54368     function wheeled(d3_event) {
54369       if (!filter2.apply(this, arguments))
54370         return;
54371       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);
54372       if (g3.wheel) {
54373         if (g3.mouse[0][0] !== p2[0] || g3.mouse[0][1] !== p2[1]) {
54374           g3.mouse[1] = t2.invert(g3.mouse[0] = p2);
54375         }
54376         clearTimeout(g3.wheel);
54377       } else {
54378         g3.mouse = [p2, t2.invert(p2)];
54379         interrupt_default(this);
54380         g3.start(d3_event);
54381       }
54382       d3_event.preventDefault();
54383       d3_event.stopImmediatePropagation();
54384       g3.wheel = setTimeout(wheelidled, _wheelDelay);
54385       g3.zoom(d3_event, "mouse", constrain(translate(scale(t2, k2), g3.mouse[0], g3.mouse[1]), g3.extent, translateExtent));
54386       function wheelidled() {
54387         g3.wheel = null;
54388         g3.end(d3_event);
54389       }
54390     }
54391     var _downPointerIDs = /* @__PURE__ */ new Set();
54392     var _pointerLocGetter;
54393     function pointerdown(d3_event) {
54394       _downPointerIDs.add(d3_event.pointerId);
54395       if (!filter2.apply(this, arguments))
54396         return;
54397       var g3 = gesture(this, arguments, _downPointerIDs.size === 1);
54398       var started;
54399       d3_event.stopImmediatePropagation();
54400       _pointerLocGetter = utilFastMouse(this);
54401       var loc = _pointerLocGetter(d3_event);
54402       var p2 = [loc, _transform.invert(loc), d3_event.pointerId];
54403       if (!g3.pointer0) {
54404         g3.pointer0 = p2;
54405         started = true;
54406       } else if (!g3.pointer1 && g3.pointer0[2] !== p2[2]) {
54407         g3.pointer1 = p2;
54408       }
54409       if (started) {
54410         interrupt_default(this);
54411         g3.start(d3_event);
54412       }
54413     }
54414     function pointermove(d3_event) {
54415       if (!_downPointerIDs.has(d3_event.pointerId))
54416         return;
54417       if (!_activeGesture || !_pointerLocGetter)
54418         return;
54419       var g3 = gesture(this, arguments);
54420       var isPointer0 = g3.pointer0 && g3.pointer0[2] === d3_event.pointerId;
54421       var isPointer1 = !isPointer0 && g3.pointer1 && g3.pointer1[2] === d3_event.pointerId;
54422       if ((isPointer0 || isPointer1) && "buttons" in d3_event && !d3_event.buttons) {
54423         if (g3.pointer0)
54424           _downPointerIDs.delete(g3.pointer0[2]);
54425         if (g3.pointer1)
54426           _downPointerIDs.delete(g3.pointer1[2]);
54427         g3.end(d3_event);
54428         return;
54429       }
54430       d3_event.preventDefault();
54431       d3_event.stopImmediatePropagation();
54432       var loc = _pointerLocGetter(d3_event);
54433       var t2, p2, l2;
54434       if (isPointer0)
54435         g3.pointer0[0] = loc;
54436       else if (isPointer1)
54437         g3.pointer1[0] = loc;
54438       t2 = _transform;
54439       if (g3.pointer1) {
54440         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;
54441         t2 = scale(t2, Math.sqrt(dp / dl));
54442         p2 = [(p02[0] + p1[0]) / 2, (p02[1] + p1[1]) / 2];
54443         l2 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
54444       } else if (g3.pointer0) {
54445         p2 = g3.pointer0[0];
54446         l2 = g3.pointer0[1];
54447       } else {
54448         return;
54449       }
54450       g3.zoom(d3_event, "touch", constrain(translate(t2, p2, l2), g3.extent, translateExtent));
54451     }
54452     function pointerup(d3_event) {
54453       if (!_downPointerIDs.has(d3_event.pointerId))
54454         return;
54455       _downPointerIDs.delete(d3_event.pointerId);
54456       if (!_activeGesture)
54457         return;
54458       var g3 = gesture(this, arguments);
54459       d3_event.stopImmediatePropagation();
54460       if (g3.pointer0 && g3.pointer0[2] === d3_event.pointerId)
54461         delete g3.pointer0;
54462       else if (g3.pointer1 && g3.pointer1[2] === d3_event.pointerId)
54463         delete g3.pointer1;
54464       if (g3.pointer1 && !g3.pointer0) {
54465         g3.pointer0 = g3.pointer1;
54466         delete g3.pointer1;
54467       }
54468       if (g3.pointer0) {
54469         g3.pointer0[1] = _transform.invert(g3.pointer0[0]);
54470       } else {
54471         g3.end(d3_event);
54472       }
54473     }
54474     zoom.wheelDelta = function(_2) {
54475       return arguments.length ? (wheelDelta = utilFunctor(+_2), zoom) : wheelDelta;
54476     };
54477     zoom.filter = function(_2) {
54478       return arguments.length ? (filter2 = utilFunctor(!!_2), zoom) : filter2;
54479     };
54480     zoom.extent = function(_2) {
54481       return arguments.length ? (extent = utilFunctor([[+_2[0][0], +_2[0][1]], [+_2[1][0], +_2[1][1]]]), zoom) : extent;
54482     };
54483     zoom.scaleExtent = function(_2) {
54484       return arguments.length ? (scaleExtent[0] = +_2[0], scaleExtent[1] = +_2[1], zoom) : [scaleExtent[0], scaleExtent[1]];
54485     };
54486     zoom.translateExtent = function(_2) {
54487       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]]];
54488     };
54489     zoom.constrain = function(_2) {
54490       return arguments.length ? (constrain = _2, zoom) : constrain;
54491     };
54492     zoom.interpolate = function(_2) {
54493       return arguments.length ? (interpolate = _2, zoom) : interpolate;
54494     };
54495     zoom._transform = function(_2) {
54496       return arguments.length ? (_transform = _2, zoom) : _transform;
54497     };
54498     return utilRebind(zoom, dispatch14, "on");
54499   }
54500
54501   // modules/util/double_up.js
54502   function utilDoubleUp() {
54503     var dispatch14 = dispatch_default("doubleUp");
54504     var _maxTimespan = 500;
54505     var _maxDistance = 20;
54506     var _pointer;
54507     function pointerIsValidFor(loc) {
54508       return (/* @__PURE__ */ new Date()).getTime() - _pointer.startTime <= _maxTimespan && // all pointer events must occur within a small distance of the first pointerdown
54509       geoVecLength(_pointer.startLoc, loc) <= _maxDistance;
54510     }
54511     function pointerdown(d3_event) {
54512       if (d3_event.ctrlKey || d3_event.button === 2)
54513         return;
54514       var loc = [d3_event.clientX, d3_event.clientY];
54515       if (_pointer && !pointerIsValidFor(loc)) {
54516         _pointer = void 0;
54517       }
54518       if (!_pointer) {
54519         _pointer = {
54520           startLoc: loc,
54521           startTime: (/* @__PURE__ */ new Date()).getTime(),
54522           upCount: 0,
54523           pointerId: d3_event.pointerId
54524         };
54525       } else {
54526         _pointer.pointerId = d3_event.pointerId;
54527       }
54528     }
54529     function pointerup(d3_event) {
54530       if (d3_event.ctrlKey || d3_event.button === 2)
54531         return;
54532       if (!_pointer || _pointer.pointerId !== d3_event.pointerId)
54533         return;
54534       _pointer.upCount += 1;
54535       if (_pointer.upCount === 2) {
54536         var loc = [d3_event.clientX, d3_event.clientY];
54537         if (pointerIsValidFor(loc)) {
54538           var locInThis = utilFastMouse(this)(d3_event);
54539           dispatch14.call("doubleUp", this, d3_event, locInThis);
54540         }
54541         _pointer = void 0;
54542       }
54543     }
54544     function doubleUp(selection2) {
54545       if ("PointerEvent" in window) {
54546         selection2.on("pointerdown.doubleUp", pointerdown).on("pointerup.doubleUp", pointerup);
54547       } else {
54548         selection2.on("dblclick.doubleUp", function(d3_event) {
54549           dispatch14.call("doubleUp", this, d3_event, utilFastMouse(this)(d3_event));
54550         });
54551       }
54552     }
54553     doubleUp.off = function(selection2) {
54554       selection2.on("pointerdown.doubleUp", null).on("pointerup.doubleUp", null).on("dblclick.doubleUp", null);
54555     };
54556     return utilRebind(doubleUp, dispatch14, "on");
54557   }
54558
54559   // modules/renderer/map.js
54560   var TILESIZE = 256;
54561   var minZoom2 = 2;
54562   var maxZoom = 24;
54563   var kMin = geoZoomToScale(minZoom2, TILESIZE);
54564   var kMax = geoZoomToScale(maxZoom, TILESIZE);
54565   function clamp(num, min3, max3) {
54566     return Math.max(min3, Math.min(num, max3));
54567   }
54568   function rendererMap(context) {
54569     var dispatch14 = dispatch_default(
54570       "move",
54571       "drawn",
54572       "crossEditableZoom",
54573       "hitMinZoom",
54574       "changeHighlighting",
54575       "changeAreaFill"
54576     );
54577     var projection2 = context.projection;
54578     var curtainProjection = context.curtainProjection;
54579     var drawLayers;
54580     var drawPoints;
54581     var drawVertices;
54582     var drawLines;
54583     var drawAreas;
54584     var drawMidpoints;
54585     var drawLabels;
54586     var _selection = select_default2(null);
54587     var supersurface = select_default2(null);
54588     var wrapper = select_default2(null);
54589     var surface = select_default2(null);
54590     var _dimensions = [1, 1];
54591     var _dblClickZoomEnabled = true;
54592     var _redrawEnabled = true;
54593     var _gestureTransformStart;
54594     var _transformStart = projection2.transform();
54595     var _transformLast;
54596     var _isTransformed = false;
54597     var _minzoom = 0;
54598     var _getMouseCoords;
54599     var _lastPointerEvent;
54600     var _lastWithinEditableZoom;
54601     var _pointerDown = false;
54602     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
54603     var _zoomerPannerFunction = "PointerEvent" in window ? utilZoomPan : zoom_default2;
54604     var _zoomerPanner = _zoomerPannerFunction().scaleExtent([kMin, kMax]).interpolate(value_default).filter(zoomEventFilter).on("zoom.map", zoomPan2).on("start.map", function(d3_event) {
54605       _pointerDown = d3_event && (d3_event.type === "pointerdown" || d3_event.sourceEvent && d3_event.sourceEvent.type === "pointerdown");
54606     }).on("end.map", function() {
54607       _pointerDown = false;
54608     });
54609     var _doubleUpHandler = utilDoubleUp();
54610     var scheduleRedraw = throttle_default(redraw, 750);
54611     function cancelPendingRedraw() {
54612       scheduleRedraw.cancel();
54613     }
54614     function map2(selection2) {
54615       _selection = selection2;
54616       context.on("change.map", immediateRedraw);
54617       var osm = context.connection();
54618       if (osm) {
54619         osm.on("change.map", immediateRedraw);
54620       }
54621       function didUndoOrRedo(targetTransform) {
54622         var mode = context.mode().id;
54623         if (mode !== "browse" && mode !== "select")
54624           return;
54625         if (targetTransform) {
54626           map2.transformEase(targetTransform);
54627         }
54628       }
54629       context.history().on("merge.map", function() {
54630         scheduleRedraw();
54631       }).on("change.map", immediateRedraw).on("undone.map", function(stack, fromStack) {
54632         didUndoOrRedo(fromStack.transform);
54633       }).on("redone.map", function(stack) {
54634         didUndoOrRedo(stack.transform);
54635       });
54636       context.background().on("change.map", immediateRedraw);
54637       context.features().on("redraw.map", immediateRedraw);
54638       drawLayers.on("change.map", function() {
54639         context.background().updateImagery();
54640         immediateRedraw();
54641       });
54642       selection2.on("wheel.map mousewheel.map", function(d3_event) {
54643         d3_event.preventDefault();
54644       }).call(_zoomerPanner).call(_zoomerPanner.transform, projection2.transform()).on("dblclick.zoom", null);
54645       map2.supersurface = supersurface = selection2.append("div").attr("class", "supersurface").call(utilSetTransform, 0, 0);
54646       wrapper = supersurface.append("div").attr("class", "layer layer-data");
54647       map2.surface = surface = wrapper.call(drawLayers).selectAll(".surface");
54648       surface.call(drawLabels.observe).call(_doubleUpHandler).on(_pointerPrefix + "down.zoom", function(d3_event) {
54649         _lastPointerEvent = d3_event;
54650         if (d3_event.button === 2) {
54651           d3_event.stopPropagation();
54652         }
54653       }, true).on(_pointerPrefix + "up.zoom", function(d3_event) {
54654         _lastPointerEvent = d3_event;
54655         if (resetTransform()) {
54656           immediateRedraw();
54657         }
54658       }).on(_pointerPrefix + "move.map", function(d3_event) {
54659         _lastPointerEvent = d3_event;
54660       }).on(_pointerPrefix + "over.vertices", function(d3_event) {
54661         if (map2.editableDataEnabled() && !_isTransformed) {
54662           var hover = d3_event.target.__data__;
54663           surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
54664           dispatch14.call("drawn", this, { full: false });
54665         }
54666       }).on(_pointerPrefix + "out.vertices", function(d3_event) {
54667         if (map2.editableDataEnabled() && !_isTransformed) {
54668           var hover = d3_event.relatedTarget && d3_event.relatedTarget.__data__;
54669           surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
54670           dispatch14.call("drawn", this, { full: false });
54671         }
54672       });
54673       var detected = utilDetect();
54674       if ("GestureEvent" in window && // Listening for gesture events on iOS 13.4+ breaks double-tapping,
54675       // but we only need to do this on desktop Safari anyway. – #7694
54676       !detected.isMobileWebKit) {
54677         surface.on("gesturestart.surface", function(d3_event) {
54678           d3_event.preventDefault();
54679           _gestureTransformStart = projection2.transform();
54680         }).on("gesturechange.surface", gestureChange);
54681       }
54682       updateAreaFill();
54683       _doubleUpHandler.on("doubleUp.map", function(d3_event, p02) {
54684         if (!_dblClickZoomEnabled)
54685           return;
54686         if (typeof d3_event.target.__data__ === "object" && // or area fills
54687         !select_default2(d3_event.target).classed("fill"))
54688           return;
54689         var zoomOut2 = d3_event.shiftKey;
54690         var t2 = projection2.transform();
54691         var p1 = t2.invert(p02);
54692         t2 = t2.scale(zoomOut2 ? 0.5 : 2);
54693         t2.x = p02[0] - p1[0] * t2.k;
54694         t2.y = p02[1] - p1[1] * t2.k;
54695         map2.transformEase(t2);
54696       });
54697       context.on("enter.map", function() {
54698         if (!map2.editableDataEnabled(
54699           true
54700           /* skip zoom check */
54701         ))
54702           return;
54703         if (_isTransformed)
54704           return;
54705         var graph = context.graph();
54706         var selectedAndParents = {};
54707         context.selectedIDs().forEach(function(id2) {
54708           var entity = graph.hasEntity(id2);
54709           if (entity) {
54710             selectedAndParents[entity.id] = entity;
54711             if (entity.type === "node") {
54712               graph.parentWays(entity).forEach(function(parent) {
54713                 selectedAndParents[parent.id] = parent;
54714               });
54715             }
54716           }
54717         });
54718         var data = Object.values(selectedAndParents);
54719         var filter2 = function(d2) {
54720           return d2.id in selectedAndParents;
54721         };
54722         data = context.features().filter(data, graph);
54723         surface.call(drawVertices.drawSelected, graph, map2.extent()).call(drawLines, graph, data, filter2).call(drawAreas, graph, data, filter2).call(drawMidpoints, graph, data, filter2, map2.trimmedExtent());
54724         dispatch14.call("drawn", this, { full: false });
54725         scheduleRedraw();
54726       });
54727       map2.dimensions(utilGetDimensions(selection2));
54728     }
54729     function zoomEventFilter(d3_event) {
54730       if (d3_event.type === "mousedown") {
54731         var hasOrphan = false;
54732         var listeners = window.__on;
54733         for (var i3 = 0; i3 < listeners.length; i3++) {
54734           var listener = listeners[i3];
54735           if (listener.name === "zoom" && listener.type === "mouseup") {
54736             hasOrphan = true;
54737             break;
54738           }
54739         }
54740         if (hasOrphan) {
54741           var event = window.CustomEvent;
54742           if (event) {
54743             event = new event("mouseup");
54744           } else {
54745             event = window.document.createEvent("Event");
54746             event.initEvent("mouseup", false, false);
54747           }
54748           event.view = window;
54749           window.dispatchEvent(event);
54750         }
54751       }
54752       return d3_event.button !== 2;
54753     }
54754     function pxCenter() {
54755       return [_dimensions[0] / 2, _dimensions[1] / 2];
54756     }
54757     function drawEditable(difference, extent) {
54758       var mode = context.mode();
54759       var graph = context.graph();
54760       var features = context.features();
54761       var all = context.history().intersects(map2.extent());
54762       var fullRedraw = false;
54763       var data;
54764       var set3;
54765       var filter2;
54766       var applyFeatureLayerFilters = true;
54767       if (map2.isInWideSelection()) {
54768         data = [];
54769         utilEntityAndDeepMemberIDs(mode.selectedIDs(), context.graph()).forEach(function(id2) {
54770           var entity = context.hasEntity(id2);
54771           if (entity)
54772             data.push(entity);
54773         });
54774         fullRedraw = true;
54775         filter2 = utilFunctor(true);
54776         applyFeatureLayerFilters = false;
54777       } else if (difference) {
54778         var complete = difference.complete(map2.extent());
54779         data = Object.values(complete).filter(Boolean);
54780         set3 = new Set(Object.keys(complete));
54781         filter2 = function(d2) {
54782           return set3.has(d2.id);
54783         };
54784         features.clear(data);
54785       } else {
54786         if (features.gatherStats(all, graph, _dimensions)) {
54787           extent = void 0;
54788         }
54789         if (extent) {
54790           data = context.history().intersects(map2.extent().intersection(extent));
54791           set3 = new Set(data.map(function(entity) {
54792             return entity.id;
54793           }));
54794           filter2 = function(d2) {
54795             return set3.has(d2.id);
54796           };
54797         } else {
54798           data = all;
54799           fullRedraw = true;
54800           filter2 = utilFunctor(true);
54801         }
54802       }
54803       if (applyFeatureLayerFilters) {
54804         data = features.filter(data, graph);
54805       } else {
54806         context.features().resetStats();
54807       }
54808       if (mode && mode.id === "select") {
54809         surface.call(drawVertices.drawSelected, graph, map2.extent());
54810       }
54811       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);
54812       dispatch14.call("drawn", this, { full: true });
54813     }
54814     map2.init = function() {
54815       drawLayers = svgLayers(projection2, context);
54816       drawPoints = svgPoints(projection2, context);
54817       drawVertices = svgVertices(projection2, context);
54818       drawLines = svgLines(projection2, context);
54819       drawAreas = svgAreas(projection2, context);
54820       drawMidpoints = svgMidpoints(projection2, context);
54821       drawLabels = svgLabels(projection2, context);
54822     };
54823     function editOff() {
54824       context.features().resetStats();
54825       surface.selectAll(".layer-osm *").remove();
54826       surface.selectAll(".layer-touch:not(.markers) *").remove();
54827       var allowed = {
54828         "browse": true,
54829         "save": true,
54830         "select-note": true,
54831         "select-data": true,
54832         "select-error": true
54833       };
54834       var mode = context.mode();
54835       if (mode && !allowed[mode.id]) {
54836         context.enter(modeBrowse(context));
54837       }
54838       dispatch14.call("drawn", this, { full: true });
54839     }
54840     function gestureChange(d3_event) {
54841       var e3 = d3_event;
54842       e3.preventDefault();
54843       var props = {
54844         deltaMode: 0,
54845         // dummy values to ignore in zoomPan
54846         deltaY: 1,
54847         // dummy values to ignore in zoomPan
54848         clientX: e3.clientX,
54849         clientY: e3.clientY,
54850         screenX: e3.screenX,
54851         screenY: e3.screenY,
54852         x: e3.x,
54853         y: e3.y
54854       };
54855       var e22 = new WheelEvent("wheel", props);
54856       e22._scale = e3.scale;
54857       e22._rotation = e3.rotation;
54858       _selection.node().dispatchEvent(e22);
54859     }
54860     function zoomPan2(event, key, transform2) {
54861       var source = event && event.sourceEvent || event;
54862       var eventTransform = transform2 || event && event.transform;
54863       var x2 = eventTransform.x;
54864       var y2 = eventTransform.y;
54865       var k2 = eventTransform.k;
54866       if (source && source.type === "wheel") {
54867         if (_pointerDown)
54868           return;
54869         var detected = utilDetect();
54870         var dX = source.deltaX;
54871         var dY = source.deltaY;
54872         var x22 = x2;
54873         var y22 = y2;
54874         var k22 = k2;
54875         var t0, p02, p1;
54876         if (source.deltaMode === 1) {
54877           var lines = Math.abs(source.deltaY);
54878           var sign2 = source.deltaY > 0 ? 1 : -1;
54879           dY = sign2 * clamp(
54880             Math.exp((lines - 1) * 0.75) * 4.000244140625,
54881             4.000244140625,
54882             // min
54883             350.000244140625
54884             // max
54885           );
54886           if (detected.os !== "mac") {
54887             dY *= 5;
54888           }
54889           t0 = _isTransformed ? _transformLast : _transformStart;
54890           p02 = _getMouseCoords(source);
54891           p1 = t0.invert(p02);
54892           k22 = t0.k * Math.pow(2, -dY / 500);
54893           k22 = clamp(k22, kMin, kMax);
54894           x22 = p02[0] - p1[0] * k22;
54895           y22 = p02[1] - p1[1] * k22;
54896         } else if (source._scale) {
54897           t0 = _gestureTransformStart;
54898           p02 = _getMouseCoords(source);
54899           p1 = t0.invert(p02);
54900           k22 = t0.k * source._scale;
54901           k22 = clamp(k22, kMin, kMax);
54902           x22 = p02[0] - p1[0] * k22;
54903           y22 = p02[1] - p1[1] * k22;
54904         } else if (source.ctrlKey && !isInteger(dY)) {
54905           dY *= 6;
54906           t0 = _isTransformed ? _transformLast : _transformStart;
54907           p02 = _getMouseCoords(source);
54908           p1 = t0.invert(p02);
54909           k22 = t0.k * Math.pow(2, -dY / 500);
54910           k22 = clamp(k22, kMin, kMax);
54911           x22 = p02[0] - p1[0] * k22;
54912           y22 = p02[1] - p1[1] * k22;
54913         } else if ((source.altKey || source.shiftKey) && isInteger(dY)) {
54914           t0 = _isTransformed ? _transformLast : _transformStart;
54915           p02 = _getMouseCoords(source);
54916           p1 = t0.invert(p02);
54917           k22 = t0.k * Math.pow(2, -dY / 500);
54918           k22 = clamp(k22, kMin, kMax);
54919           x22 = p02[0] - p1[0] * k22;
54920           y22 = p02[1] - p1[1] * k22;
54921         } else if (detected.os === "mac" && detected.browser !== "Firefox" && !source.ctrlKey && isInteger(dX) && isInteger(dY)) {
54922           p1 = projection2.translate();
54923           x22 = p1[0] - dX;
54924           y22 = p1[1] - dY;
54925           k22 = projection2.scale();
54926           k22 = clamp(k22, kMin, kMax);
54927         }
54928         if (x22 !== x2 || y22 !== y2 || k22 !== k2) {
54929           x2 = x22;
54930           y2 = y22;
54931           k2 = k22;
54932           eventTransform = identity2.translate(x22, y22).scale(k22);
54933           if (_zoomerPanner._transform) {
54934             _zoomerPanner._transform(eventTransform);
54935           } else {
54936             _selection.node().__zoom = eventTransform;
54937           }
54938         }
54939       }
54940       if (_transformStart.x === x2 && _transformStart.y === y2 && _transformStart.k === k2) {
54941         return;
54942       }
54943       if (geoScaleToZoom(k2, TILESIZE) < _minzoom) {
54944         surface.interrupt();
54945         dispatch14.call("hitMinZoom", this, map2);
54946         setCenterZoom(map2.center(), context.minEditableZoom(), 0, true);
54947         scheduleRedraw();
54948         dispatch14.call("move", this, map2);
54949         return;
54950       }
54951       projection2.transform(eventTransform);
54952       var withinEditableZoom = map2.withinEditableZoom();
54953       if (_lastWithinEditableZoom !== withinEditableZoom) {
54954         if (_lastWithinEditableZoom !== void 0) {
54955           dispatch14.call("crossEditableZoom", this, withinEditableZoom);
54956         }
54957         _lastWithinEditableZoom = withinEditableZoom;
54958       }
54959       var scale = k2 / _transformStart.k;
54960       var tX = (x2 / scale - _transformStart.x) * scale;
54961       var tY = (y2 / scale - _transformStart.y) * scale;
54962       if (context.inIntro()) {
54963         curtainProjection.transform({
54964           x: x2 - tX,
54965           y: y2 - tY,
54966           k: k2
54967         });
54968       }
54969       if (source) {
54970         _lastPointerEvent = event;
54971       }
54972       _isTransformed = true;
54973       _transformLast = eventTransform;
54974       utilSetTransform(supersurface, tX, tY, scale);
54975       scheduleRedraw();
54976       dispatch14.call("move", this, map2);
54977       function isInteger(val) {
54978         return typeof val === "number" && isFinite(val) && Math.floor(val) === val;
54979       }
54980     }
54981     function resetTransform() {
54982       if (!_isTransformed)
54983         return false;
54984       utilSetTransform(supersurface, 0, 0);
54985       _isTransformed = false;
54986       if (context.inIntro()) {
54987         curtainProjection.transform(projection2.transform());
54988       }
54989       return true;
54990     }
54991     function redraw(difference, extent) {
54992       if (surface.empty() || !_redrawEnabled)
54993         return;
54994       if (resetTransform()) {
54995         difference = extent = void 0;
54996       }
54997       var zoom = map2.zoom();
54998       var z2 = String(~~zoom);
54999       if (surface.attr("data-zoom") !== z2) {
55000         surface.attr("data-zoom", z2);
55001       }
55002       var lat = map2.center()[1];
55003       var lowzoom = linear3().domain([-60, 0, 60]).range([17, 18.5, 17]).clamp(true);
55004       surface.classed("low-zoom", zoom <= lowzoom(lat));
55005       if (!difference) {
55006         supersurface.call(context.background());
55007         wrapper.call(drawLayers);
55008       }
55009       if (map2.editableDataEnabled() || map2.isInWideSelection()) {
55010         context.loadTiles(projection2);
55011         drawEditable(difference, extent);
55012       } else {
55013         editOff();
55014       }
55015       _transformStart = projection2.transform();
55016       return map2;
55017     }
55018     var immediateRedraw = function(difference, extent) {
55019       if (!difference && !extent)
55020         cancelPendingRedraw();
55021       redraw(difference, extent);
55022     };
55023     map2.lastPointerEvent = function() {
55024       return _lastPointerEvent;
55025     };
55026     map2.mouse = function(d3_event) {
55027       var event = d3_event || _lastPointerEvent;
55028       if (event) {
55029         var s2;
55030         while (s2 = event.sourceEvent) {
55031           event = s2;
55032         }
55033         return _getMouseCoords(event);
55034       }
55035       return null;
55036     };
55037     map2.mouseCoordinates = function() {
55038       var coord2 = map2.mouse() || pxCenter();
55039       return projection2.invert(coord2);
55040     };
55041     map2.dblclickZoomEnable = function(val) {
55042       if (!arguments.length)
55043         return _dblClickZoomEnabled;
55044       _dblClickZoomEnabled = val;
55045       return map2;
55046     };
55047     map2.redrawEnable = function(val) {
55048       if (!arguments.length)
55049         return _redrawEnabled;
55050       _redrawEnabled = val;
55051       return map2;
55052     };
55053     map2.isTransformed = function() {
55054       return _isTransformed;
55055     };
55056     function setTransform(t2, duration, force) {
55057       var t3 = projection2.transform();
55058       if (!force && t2.k === t3.k && t2.x === t3.x && t2.y === t3.y)
55059         return false;
55060       if (duration) {
55061         _selection.transition().duration(duration).on("start", function() {
55062           map2.startEase();
55063         }).call(_zoomerPanner.transform, identity2.translate(t2.x, t2.y).scale(t2.k));
55064       } else {
55065         projection2.transform(t2);
55066         _transformStart = t2;
55067         _selection.call(_zoomerPanner.transform, _transformStart);
55068       }
55069       return true;
55070     }
55071     function setCenterZoom(loc2, z2, duration, force) {
55072       var c2 = map2.center();
55073       var z3 = map2.zoom();
55074       if (loc2[0] === c2[0] && loc2[1] === c2[1] && z2 === z3 && !force)
55075         return false;
55076       var proj = geoRawMercator().transform(projection2.transform());
55077       var k2 = clamp(geoZoomToScale(z2, TILESIZE), kMin, kMax);
55078       proj.scale(k2);
55079       var t2 = proj.translate();
55080       var point2 = proj(loc2);
55081       var center = pxCenter();
55082       t2[0] += center[0] - point2[0];
55083       t2[1] += center[1] - point2[1];
55084       return setTransform(identity2.translate(t2[0], t2[1]).scale(k2), duration, force);
55085     }
55086     map2.pan = function(delta, duration) {
55087       var t2 = projection2.translate();
55088       var k2 = projection2.scale();
55089       t2[0] += delta[0];
55090       t2[1] += delta[1];
55091       if (duration) {
55092         _selection.transition().duration(duration).on("start", function() {
55093           map2.startEase();
55094         }).call(_zoomerPanner.transform, identity2.translate(t2[0], t2[1]).scale(k2));
55095       } else {
55096         projection2.translate(t2);
55097         _transformStart = projection2.transform();
55098         _selection.call(_zoomerPanner.transform, _transformStart);
55099         dispatch14.call("move", this, map2);
55100         immediateRedraw();
55101       }
55102       return map2;
55103     };
55104     map2.dimensions = function(val) {
55105       if (!arguments.length)
55106         return _dimensions;
55107       _dimensions = val;
55108       drawLayers.dimensions(_dimensions);
55109       context.background().dimensions(_dimensions);
55110       projection2.clipExtent([[0, 0], _dimensions]);
55111       _getMouseCoords = utilFastMouse(supersurface.node());
55112       scheduleRedraw();
55113       return map2;
55114     };
55115     function zoomIn(delta) {
55116       setCenterZoom(map2.center(), ~~map2.zoom() + delta, 250, true);
55117     }
55118     function zoomOut(delta) {
55119       setCenterZoom(map2.center(), ~~map2.zoom() - delta, 250, true);
55120     }
55121     map2.zoomIn = function() {
55122       zoomIn(1);
55123     };
55124     map2.zoomInFurther = function() {
55125       zoomIn(4);
55126     };
55127     map2.canZoomIn = function() {
55128       return map2.zoom() < maxZoom;
55129     };
55130     map2.zoomOut = function() {
55131       zoomOut(1);
55132     };
55133     map2.zoomOutFurther = function() {
55134       zoomOut(4);
55135     };
55136     map2.canZoomOut = function() {
55137       return map2.zoom() > minZoom2;
55138     };
55139     map2.center = function(loc2) {
55140       if (!arguments.length) {
55141         return projection2.invert(pxCenter());
55142       }
55143       if (setCenterZoom(loc2, map2.zoom())) {
55144         dispatch14.call("move", this, map2);
55145       }
55146       scheduleRedraw();
55147       return map2;
55148     };
55149     map2.unobscuredCenterZoomEase = function(loc, zoom) {
55150       var offset = map2.unobscuredOffsetPx();
55151       var proj = geoRawMercator().transform(projection2.transform());
55152       proj.scale(geoZoomToScale(zoom, TILESIZE));
55153       var locPx = proj(loc);
55154       var offsetLocPx = [locPx[0] + offset[0], locPx[1] + offset[1]];
55155       var offsetLoc = proj.invert(offsetLocPx);
55156       map2.centerZoomEase(offsetLoc, zoom);
55157     };
55158     map2.unobscuredOffsetPx = function() {
55159       var openPane = context.container().select(".map-panes .map-pane.shown");
55160       if (!openPane.empty()) {
55161         return [openPane.node().offsetWidth / 2, 0];
55162       }
55163       return [0, 0];
55164     };
55165     map2.zoom = function(z2) {
55166       if (!arguments.length) {
55167         return Math.max(geoScaleToZoom(projection2.scale(), TILESIZE), 0);
55168       }
55169       if (z2 < _minzoom) {
55170         surface.interrupt();
55171         dispatch14.call("hitMinZoom", this, map2);
55172         z2 = context.minEditableZoom();
55173       }
55174       if (setCenterZoom(map2.center(), z2)) {
55175         dispatch14.call("move", this, map2);
55176       }
55177       scheduleRedraw();
55178       return map2;
55179     };
55180     map2.centerZoom = function(loc2, z2) {
55181       if (setCenterZoom(loc2, z2)) {
55182         dispatch14.call("move", this, map2);
55183       }
55184       scheduleRedraw();
55185       return map2;
55186     };
55187     map2.zoomTo = function(entity) {
55188       var extent = entity.extent(context.graph());
55189       if (!isFinite(extent.area()))
55190         return map2;
55191       var z2 = clamp(map2.trimmedExtentZoom(extent), 0, 20);
55192       return map2.centerZoom(extent.center(), z2);
55193     };
55194     map2.centerEase = function(loc2, duration) {
55195       duration = duration || 250;
55196       setCenterZoom(loc2, map2.zoom(), duration);
55197       return map2;
55198     };
55199     map2.zoomEase = function(z2, duration) {
55200       duration = duration || 250;
55201       setCenterZoom(map2.center(), z2, duration, false);
55202       return map2;
55203     };
55204     map2.centerZoomEase = function(loc2, z2, duration) {
55205       duration = duration || 250;
55206       setCenterZoom(loc2, z2, duration, false);
55207       return map2;
55208     };
55209     map2.transformEase = function(t2, duration) {
55210       duration = duration || 250;
55211       setTransform(
55212         t2,
55213         duration,
55214         false
55215         /* don't force */
55216       );
55217       return map2;
55218     };
55219     map2.zoomToEase = function(obj, duration) {
55220       var extent;
55221       if (Array.isArray(obj)) {
55222         obj.forEach(function(entity) {
55223           var entityExtent = entity.extent(context.graph());
55224           if (!extent) {
55225             extent = entityExtent;
55226           } else {
55227             extent = extent.extend(entityExtent);
55228           }
55229         });
55230       } else {
55231         extent = obj.extent(context.graph());
55232       }
55233       if (!isFinite(extent.area()))
55234         return map2;
55235       var z2 = clamp(map2.trimmedExtentZoom(extent), 0, 20);
55236       return map2.centerZoomEase(extent.center(), z2, duration);
55237     };
55238     map2.startEase = function() {
55239       utilBindOnce(surface, _pointerPrefix + "down.ease", function() {
55240         map2.cancelEase();
55241       });
55242       return map2;
55243     };
55244     map2.cancelEase = function() {
55245       _selection.interrupt();
55246       return map2;
55247     };
55248     map2.extent = function(val) {
55249       if (!arguments.length) {
55250         return new geoExtent(
55251           projection2.invert([0, _dimensions[1]]),
55252           projection2.invert([_dimensions[0], 0])
55253         );
55254       } else {
55255         var extent = geoExtent(val);
55256         map2.centerZoom(extent.center(), map2.extentZoom(extent));
55257       }
55258     };
55259     map2.trimmedExtent = function(val) {
55260       if (!arguments.length) {
55261         var headerY = 71;
55262         var footerY = 30;
55263         var pad2 = 10;
55264         return new geoExtent(
55265           projection2.invert([pad2, _dimensions[1] - footerY - pad2]),
55266           projection2.invert([_dimensions[0] - pad2, headerY + pad2])
55267         );
55268       } else {
55269         var extent = geoExtent(val);
55270         map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
55271       }
55272     };
55273     function calcExtentZoom(extent, dim) {
55274       var tl = projection2([extent[0][0], extent[1][1]]);
55275       var br = projection2([extent[1][0], extent[0][1]]);
55276       var hFactor = (br[0] - tl[0]) / dim[0];
55277       var vFactor = (br[1] - tl[1]) / dim[1];
55278       var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
55279       var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
55280       var newZoom = map2.zoom() - Math.max(hZoomDiff, vZoomDiff);
55281       return newZoom;
55282     }
55283     map2.extentZoom = function(val) {
55284       return calcExtentZoom(geoExtent(val), _dimensions);
55285     };
55286     map2.trimmedExtentZoom = function(val) {
55287       var trimY = 120;
55288       var trimX = 40;
55289       var trimmed = [_dimensions[0] - trimX, _dimensions[1] - trimY];
55290       return calcExtentZoom(geoExtent(val), trimmed);
55291     };
55292     map2.withinEditableZoom = function() {
55293       return map2.zoom() >= context.minEditableZoom();
55294     };
55295     map2.isInWideSelection = function() {
55296       return !map2.withinEditableZoom() && context.selectedIDs().length;
55297     };
55298     map2.editableDataEnabled = function(skipZoomCheck) {
55299       var layer = context.layers().layer("osm");
55300       if (!layer || !layer.enabled())
55301         return false;
55302       return skipZoomCheck || map2.withinEditableZoom();
55303     };
55304     map2.notesEditable = function() {
55305       var layer = context.layers().layer("notes");
55306       if (!layer || !layer.enabled())
55307         return false;
55308       return map2.withinEditableZoom();
55309     };
55310     map2.minzoom = function(val) {
55311       if (!arguments.length)
55312         return _minzoom;
55313       _minzoom = val;
55314       return map2;
55315     };
55316     map2.toggleHighlightEdited = function() {
55317       surface.classed("highlight-edited", !surface.classed("highlight-edited"));
55318       map2.pan([0, 0]);
55319       dispatch14.call("changeHighlighting", this);
55320     };
55321     map2.areaFillOptions = ["wireframe", "partial", "full"];
55322     map2.activeAreaFill = function(val) {
55323       if (!arguments.length)
55324         return corePreferences("area-fill") || "partial";
55325       corePreferences("area-fill", val);
55326       if (val !== "wireframe") {
55327         corePreferences("area-fill-toggle", val);
55328       }
55329       updateAreaFill();
55330       map2.pan([0, 0]);
55331       dispatch14.call("changeAreaFill", this);
55332       return map2;
55333     };
55334     map2.toggleWireframe = function() {
55335       var activeFill = map2.activeAreaFill();
55336       if (activeFill === "wireframe") {
55337         activeFill = corePreferences("area-fill-toggle") || "partial";
55338       } else {
55339         activeFill = "wireframe";
55340       }
55341       map2.activeAreaFill(activeFill);
55342     };
55343     function updateAreaFill() {
55344       var activeFill = map2.activeAreaFill();
55345       map2.areaFillOptions.forEach(function(opt) {
55346         surface.classed("fill-" + opt, Boolean(opt === activeFill));
55347       });
55348     }
55349     map2.layers = () => drawLayers;
55350     map2.doubleUpHandler = function() {
55351       return _doubleUpHandler;
55352     };
55353     return utilRebind(map2, dispatch14, "on");
55354   }
55355
55356   // modules/renderer/photos.js
55357   function rendererPhotos(context) {
55358     var dispatch14 = dispatch_default("change");
55359     var _layerIDs = ["streetside", "mapillary", "mapillary-map-features", "mapillary-signs", "kartaview", "mapilio", "vegbilder"];
55360     var _allPhotoTypes = ["flat", "panoramic"];
55361     var _shownPhotoTypes = _allPhotoTypes.slice();
55362     var _dateFilters = ["fromDate", "toDate"];
55363     var _fromDate;
55364     var _toDate;
55365     var _usernames;
55366     function photos() {
55367     }
55368     function updateStorage() {
55369       if (window.mocha)
55370         return;
55371       var hash = utilStringQs(window.location.hash);
55372       var enabled = context.layers().all().filter(function(d2) {
55373         return _layerIDs.indexOf(d2.id) !== -1 && d2.layer && d2.layer.supported() && d2.layer.enabled();
55374       }).map(function(d2) {
55375         return d2.id;
55376       });
55377       if (enabled.length) {
55378         hash.photo_overlay = enabled.join(",");
55379       } else {
55380         delete hash.photo_overlay;
55381       }
55382       window.location.replace("#" + utilQsString(hash, true));
55383     }
55384     photos.overlayLayerIDs = function() {
55385       return _layerIDs;
55386     };
55387     photos.allPhotoTypes = function() {
55388       return _allPhotoTypes;
55389     };
55390     photos.dateFilters = function() {
55391       return _dateFilters;
55392     };
55393     photos.dateFilterValue = function(val) {
55394       return val === _dateFilters[0] ? _fromDate : _toDate;
55395     };
55396     photos.setDateFilter = function(type2, val, updateUrl) {
55397       var date = val && new Date(val);
55398       if (date && !isNaN(date)) {
55399         val = date.toISOString().slice(0, 10);
55400       } else {
55401         val = null;
55402       }
55403       if (type2 === _dateFilters[0]) {
55404         _fromDate = val;
55405         if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
55406           _toDate = _fromDate;
55407         }
55408       }
55409       if (type2 === _dateFilters[1]) {
55410         _toDate = val;
55411         if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
55412           _fromDate = _toDate;
55413         }
55414       }
55415       dispatch14.call("change", this);
55416       if (updateUrl) {
55417         var rangeString;
55418         if (_fromDate || _toDate) {
55419           rangeString = (_fromDate || "") + "_" + (_toDate || "");
55420         }
55421         setUrlFilterValue("photo_dates", rangeString);
55422       }
55423     };
55424     photos.setUsernameFilter = function(val, updateUrl) {
55425       if (val && typeof val === "string")
55426         val = val.replace(/;/g, ",").split(",");
55427       if (val) {
55428         val = val.map((d2) => d2.trim()).filter(Boolean);
55429         if (!val.length) {
55430           val = null;
55431         }
55432       }
55433       _usernames = val;
55434       dispatch14.call("change", this);
55435       if (updateUrl) {
55436         var hashString;
55437         if (_usernames) {
55438           hashString = _usernames.join(",");
55439         }
55440         setUrlFilterValue("photo_username", hashString);
55441       }
55442     };
55443     function setUrlFilterValue(property, val) {
55444       if (!window.mocha) {
55445         var hash = utilStringQs(window.location.hash);
55446         if (val) {
55447           if (hash[property] === val)
55448             return;
55449           hash[property] = val;
55450         } else {
55451           if (!(property in hash))
55452             return;
55453           delete hash[property];
55454         }
55455         window.location.replace("#" + utilQsString(hash, true));
55456       }
55457     }
55458     function showsLayer(id2) {
55459       var layer = context.layers().layer(id2);
55460       return layer && layer.supported() && layer.enabled();
55461     }
55462     photos.shouldFilterByDate = function() {
55463       return showsLayer("mapillary") || showsLayer("kartaview") || showsLayer("streetside") || showsLayer("vegbilder");
55464     };
55465     photos.shouldFilterByPhotoType = function() {
55466       return showsLayer("mapillary") || showsLayer("streetside") && showsLayer("kartaview") || showsLayer("vegbilder");
55467     };
55468     photos.shouldFilterByUsername = function() {
55469       return !showsLayer("mapillary") && showsLayer("kartaview") && !showsLayer("streetside");
55470     };
55471     photos.showsPhotoType = function(val) {
55472       if (!photos.shouldFilterByPhotoType())
55473         return true;
55474       return _shownPhotoTypes.indexOf(val) !== -1;
55475     };
55476     photos.showsFlat = function() {
55477       return photos.showsPhotoType("flat");
55478     };
55479     photos.showsPanoramic = function() {
55480       return photos.showsPhotoType("panoramic");
55481     };
55482     photos.fromDate = function() {
55483       return _fromDate;
55484     };
55485     photos.toDate = function() {
55486       return _toDate;
55487     };
55488     photos.togglePhotoType = function(val) {
55489       var index = _shownPhotoTypes.indexOf(val);
55490       if (index !== -1) {
55491         _shownPhotoTypes.splice(index, 1);
55492       } else {
55493         _shownPhotoTypes.push(val);
55494       }
55495       dispatch14.call("change", this);
55496       return photos;
55497     };
55498     photos.usernames = function() {
55499       return _usernames;
55500     };
55501     photos.init = function() {
55502       var hash = utilStringQs(window.location.hash);
55503       if (hash.photo_dates) {
55504         var parts = /^(.*)[–_](.*)$/g.exec(hash.photo_dates.trim());
55505         this.setDateFilter("fromDate", parts && parts.length >= 2 && parts[1], false);
55506         this.setDateFilter("toDate", parts && parts.length >= 3 && parts[2], false);
55507       }
55508       if (hash.photo_username) {
55509         this.setUsernameFilter(hash.photo_username, false);
55510       }
55511       if (hash.photo_overlay) {
55512         var hashOverlayIDs = hash.photo_overlay.replace(/;/g, ",").split(",");
55513         hashOverlayIDs.forEach(function(id2) {
55514           if (id2 === "openstreetcam")
55515             id2 = "kartaview";
55516           var layer2 = _layerIDs.indexOf(id2) !== -1 && context.layers().layer(id2);
55517           if (layer2 && !layer2.enabled())
55518             layer2.enabled(true);
55519         });
55520       }
55521       if (hash.photo) {
55522         var photoIds = hash.photo.replace(/;/g, ",").split(",");
55523         var photoId = photoIds.length && photoIds[0].trim();
55524         var results = /(.*)\/(.*)/g.exec(photoId);
55525         if (results && results.length >= 3) {
55526           var serviceId = results[1];
55527           if (serviceId === "openstreetcam")
55528             serviceId = "kartaview";
55529           var photoKey = results[2];
55530           var service = services[serviceId];
55531           if (service && service.ensureViewerLoaded) {
55532             var layer = _layerIDs.indexOf(serviceId) !== -1 && context.layers().layer(serviceId);
55533             if (layer && !layer.enabled())
55534               layer.enabled(true);
55535             var baselineTime = Date.now();
55536             service.on("loadedImages.rendererPhotos", function() {
55537               if (Date.now() - baselineTime > 45e3) {
55538                 service.on("loadedImages.rendererPhotos", null);
55539                 return;
55540               }
55541               if (!service.cachedImage(photoKey))
55542                 return;
55543               service.on("loadedImages.rendererPhotos", null);
55544               service.ensureViewerLoaded(context).then(function() {
55545                 service.selectImage(context, photoKey).showViewer(context);
55546               });
55547             });
55548           }
55549         }
55550       }
55551       context.layers().on("change.rendererPhotos", updateStorage);
55552     };
55553     return utilRebind(photos, dispatch14, "on");
55554   }
55555
55556   // modules/ui/account.js
55557   function uiAccount(context) {
55558     const osm = context.connection();
55559     function updateUserDetails(selection2) {
55560       if (!osm)
55561         return;
55562       if (!osm.authenticated()) {
55563         render(selection2, null);
55564       } else {
55565         osm.userDetails((err, user) => render(selection2, user));
55566       }
55567     }
55568     function render(selection2, user) {
55569       let userInfo = selection2.select(".userInfo");
55570       let loginLogout = selection2.select(".loginLogout");
55571       if (user) {
55572         userInfo.html("").classed("hide", false);
55573         let userLink = userInfo.append("a").attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
55574         if (user.image_url) {
55575           userLink.append("img").attr("class", "icon pre-text user-icon").attr("src", user.image_url);
55576         } else {
55577           userLink.call(svgIcon("#iD-icon-avatar", "pre-text light"));
55578         }
55579         userLink.append("span").attr("class", "label").html(user.display_name);
55580         loginLogout.classed("hide", false).select("a").text(_t("logout")).on("click", (e3) => {
55581           e3.preventDefault();
55582           osm.logout();
55583           tryLogout();
55584         });
55585       } else {
55586         userInfo.html("").classed("hide", true);
55587         loginLogout.classed("hide", false).select("a").text(_t("login")).on("click", (e3) => {
55588           e3.preventDefault();
55589           osm.authenticate();
55590         });
55591       }
55592     }
55593     function tryLogout() {
55594       if (!osm)
55595         return;
55596       const url = osm.getUrlRoot() + "/logout?referer=%2Flogin";
55597       const w2 = 600;
55598       const h2 = 550;
55599       const settings = [
55600         ["width", w2],
55601         ["height", h2],
55602         ["left", window.screen.width / 2 - w2 / 2],
55603         ["top", window.screen.height / 2 - h2 / 2]
55604       ].map((x2) => x2.join("=")).join(",");
55605       window.open(url, "_blank", settings);
55606     }
55607     return function(selection2) {
55608       if (!osm)
55609         return;
55610       selection2.append("li").attr("class", "userInfo").classed("hide", true);
55611       selection2.append("li").attr("class", "loginLogout").classed("hide", true).append("a").attr("href", "#");
55612       osm.on("change.account", () => updateUserDetails(selection2));
55613       updateUserDetails(selection2);
55614     };
55615   }
55616
55617   // modules/ui/attribution.js
55618   function uiAttribution(context) {
55619     let _selection = select_default2(null);
55620     function render(selection2, data, klass) {
55621       let div = selection2.selectAll(`.${klass}`).data([0]);
55622       div = div.enter().append("div").attr("class", klass).merge(div);
55623       let attributions = div.selectAll(".attribution").data(data, (d2) => d2.id);
55624       attributions.exit().remove();
55625       attributions = attributions.enter().append("span").attr("class", "attribution").each((d2, i3, nodes) => {
55626         let attribution = select_default2(nodes[i3]);
55627         if (d2.terms_html) {
55628           attribution.html(d2.terms_html);
55629           return;
55630         }
55631         if (d2.terms_url) {
55632           attribution = attribution.append("a").attr("href", d2.terms_url).attr("target", "_blank");
55633         }
55634         const sourceID = d2.id.replace(/\./g, "<TX_DOT>");
55635         const terms_text = _t(
55636           `imagery.${sourceID}.attribution.text`,
55637           { default: d2.terms_text || d2.id || d2.name() }
55638         );
55639         if (d2.icon && !d2.overlay) {
55640           attribution.append("img").attr("class", "source-image").attr("src", d2.icon);
55641         }
55642         attribution.append("span").attr("class", "attribution-text").text(terms_text);
55643       }).merge(attributions);
55644       let copyright = attributions.selectAll(".copyright-notice").data((d2) => {
55645         let notice = d2.copyrightNotices(context.map().zoom(), context.map().extent());
55646         return notice ? [notice] : [];
55647       });
55648       copyright.exit().remove();
55649       copyright = copyright.enter().append("span").attr("class", "copyright-notice").merge(copyright);
55650       copyright.text(String);
55651     }
55652     function update() {
55653       let baselayer = context.background().baseLayerSource();
55654       _selection.call(render, baselayer ? [baselayer] : [], "base-layer-attribution");
55655       const z2 = context.map().zoom();
55656       let overlays = context.background().overlayLayerSources() || [];
55657       _selection.call(render, overlays.filter((s2) => s2.validZoom(z2)), "overlay-layer-attribution");
55658     }
55659     return function(selection2) {
55660       _selection = selection2;
55661       context.background().on("change.attribution", update);
55662       context.map().on("move.attribution", throttle_default(update, 400, { leading: false }));
55663       update();
55664     };
55665   }
55666
55667   // modules/ui/contributors.js
55668   function uiContributors(context) {
55669     var osm = context.connection(), debouncedUpdate = debounce_default(function() {
55670       update();
55671     }, 1e3), limit = 4, hidden = false, wrap2 = select_default2(null);
55672     function update() {
55673       if (!osm)
55674         return;
55675       var users = {}, entities = context.history().intersects(context.map().extent());
55676       entities.forEach(function(entity) {
55677         if (entity && entity.user)
55678           users[entity.user] = true;
55679       });
55680       var u2 = Object.keys(users), subset = u2.slice(0, u2.length > limit ? limit - 1 : limit);
55681       wrap2.html("").call(svgIcon("#iD-icon-nearby", "pre-text light"));
55682       var userList = select_default2(document.createElement("span"));
55683       userList.selectAll().data(subset).enter().append("a").attr("class", "user-link").attr("href", function(d2) {
55684         return osm.userURL(d2);
55685       }).attr("target", "_blank").text(String);
55686       if (u2.length > limit) {
55687         var count = select_default2(document.createElement("span"));
55688         var othersNum = u2.length - limit + 1;
55689         count.append("a").attr("target", "_blank").attr("href", function() {
55690           return osm.changesetsURL(context.map().center(), context.map().zoom());
55691         }).text(othersNum);
55692         wrap2.append("span").html(_t.html("contributors.truncated_list", { n: othersNum, users: { html: userList.html() }, count: { html: count.html() } }));
55693       } else {
55694         wrap2.append("span").html(_t.html("contributors.list", { users: { html: userList.html() } }));
55695       }
55696       if (!u2.length) {
55697         hidden = true;
55698         wrap2.transition().style("opacity", 0);
55699       } else if (hidden) {
55700         wrap2.transition().style("opacity", 1);
55701       }
55702     }
55703     return function(selection2) {
55704       if (!osm)
55705         return;
55706       wrap2 = selection2;
55707       update();
55708       osm.on("loaded.contributors", debouncedUpdate);
55709       context.map().on("move.contributors", debouncedUpdate);
55710     };
55711   }
55712
55713   // modules/ui/popover.js
55714   var _popoverID = 0;
55715   function uiPopover(klass) {
55716     var _id = _popoverID++;
55717     var _anchorSelection = select_default2(null);
55718     var popover = function(selection2) {
55719       _anchorSelection = selection2;
55720       selection2.each(setup);
55721     };
55722     var _animation = utilFunctor(false);
55723     var _placement = utilFunctor("top");
55724     var _alignment = utilFunctor("center");
55725     var _scrollContainer = utilFunctor(select_default2(null));
55726     var _content;
55727     var _displayType = utilFunctor("");
55728     var _hasArrow = utilFunctor(true);
55729     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
55730     popover.displayType = function(val) {
55731       if (arguments.length) {
55732         _displayType = utilFunctor(val);
55733         return popover;
55734       } else {
55735         return _displayType;
55736       }
55737     };
55738     popover.hasArrow = function(val) {
55739       if (arguments.length) {
55740         _hasArrow = utilFunctor(val);
55741         return popover;
55742       } else {
55743         return _hasArrow;
55744       }
55745     };
55746     popover.placement = function(val) {
55747       if (arguments.length) {
55748         _placement = utilFunctor(val);
55749         return popover;
55750       } else {
55751         return _placement;
55752       }
55753     };
55754     popover.alignment = function(val) {
55755       if (arguments.length) {
55756         _alignment = utilFunctor(val);
55757         return popover;
55758       } else {
55759         return _alignment;
55760       }
55761     };
55762     popover.scrollContainer = function(val) {
55763       if (arguments.length) {
55764         _scrollContainer = utilFunctor(val);
55765         return popover;
55766       } else {
55767         return _scrollContainer;
55768       }
55769     };
55770     popover.content = function(val) {
55771       if (arguments.length) {
55772         _content = val;
55773         return popover;
55774       } else {
55775         return _content;
55776       }
55777     };
55778     popover.isShown = function() {
55779       var popoverSelection = _anchorSelection.select(".popover-" + _id);
55780       return !popoverSelection.empty() && popoverSelection.classed("in");
55781     };
55782     popover.show = function() {
55783       _anchorSelection.each(show);
55784     };
55785     popover.updateContent = function() {
55786       _anchorSelection.each(updateContent);
55787     };
55788     popover.hide = function() {
55789       _anchorSelection.each(hide);
55790     };
55791     popover.toggle = function() {
55792       _anchorSelection.each(toggle);
55793     };
55794     popover.destroy = function(selection2, selector) {
55795       selector = selector || ".popover-" + _id;
55796       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() {
55797         return this.getAttribute("data-original-title") || this.getAttribute("title");
55798       }).attr("data-original-title", null).selectAll(selector).remove();
55799     };
55800     popover.destroyAny = function(selection2) {
55801       selection2.call(popover.destroy, ".popover");
55802     };
55803     function setup() {
55804       var anchor = select_default2(this);
55805       var animate = _animation.apply(this, arguments);
55806       var popoverSelection = anchor.selectAll(".popover-" + _id).data([0]);
55807       var enter = popoverSelection.enter().append("div").attr("class", "popover popover-" + _id + " " + (klass ? klass : "")).classed("arrowed", _hasArrow.apply(this, arguments));
55808       enter.append("div").attr("class", "popover-arrow");
55809       enter.append("div").attr("class", "popover-inner");
55810       popoverSelection = enter.merge(popoverSelection);
55811       if (animate) {
55812         popoverSelection.classed("fade", true);
55813       }
55814       var display = _displayType.apply(this, arguments);
55815       if (display === "hover") {
55816         var _lastNonMouseEnterTime;
55817         anchor.on(_pointerPrefix + "enter.popover", function(d3_event) {
55818           if (d3_event.pointerType) {
55819             if (d3_event.pointerType !== "mouse") {
55820               _lastNonMouseEnterTime = d3_event.timeStamp;
55821               return;
55822             } else if (_lastNonMouseEnterTime && d3_event.timeStamp - _lastNonMouseEnterTime < 1500) {
55823               return;
55824             }
55825           }
55826           if (d3_event.buttons !== 0)
55827             return;
55828           show.apply(this, arguments);
55829         }).on(_pointerPrefix + "leave.popover", function() {
55830           hide.apply(this, arguments);
55831         }).on("focus.popover", function() {
55832           show.apply(this, arguments);
55833         }).on("blur.popover", function() {
55834           hide.apply(this, arguments);
55835         });
55836       } else if (display === "clickFocus") {
55837         anchor.on(_pointerPrefix + "down.popover", function(d3_event) {
55838           d3_event.preventDefault();
55839           d3_event.stopPropagation();
55840         }).on(_pointerPrefix + "up.popover", function(d3_event) {
55841           d3_event.preventDefault();
55842           d3_event.stopPropagation();
55843         }).on("click.popover", toggle);
55844         popoverSelection.attr("tabindex", 0).on("blur.popover", function() {
55845           anchor.each(function() {
55846             hide.apply(this, arguments);
55847           });
55848         });
55849       }
55850     }
55851     function show() {
55852       var anchor = select_default2(this);
55853       var popoverSelection = anchor.selectAll(".popover-" + _id);
55854       if (popoverSelection.empty()) {
55855         anchor.call(popover.destroy);
55856         anchor.each(setup);
55857         popoverSelection = anchor.selectAll(".popover-" + _id);
55858       }
55859       popoverSelection.classed("in", true);
55860       var displayType = _displayType.apply(this, arguments);
55861       if (displayType === "clickFocus") {
55862         anchor.classed("active", true);
55863         popoverSelection.node().focus();
55864       }
55865       anchor.each(updateContent);
55866     }
55867     function updateContent() {
55868       var anchor = select_default2(this);
55869       if (_content) {
55870         anchor.selectAll(".popover-" + _id + " > .popover-inner").call(_content.apply(this, arguments));
55871       }
55872       updatePosition.apply(this, arguments);
55873       updatePosition.apply(this, arguments);
55874       updatePosition.apply(this, arguments);
55875     }
55876     function updatePosition() {
55877       var anchor = select_default2(this);
55878       var popoverSelection = anchor.selectAll(".popover-" + _id);
55879       var scrollContainer = _scrollContainer && _scrollContainer.apply(this, arguments);
55880       var scrollNode = scrollContainer && !scrollContainer.empty() && scrollContainer.node();
55881       var scrollLeft = scrollNode ? scrollNode.scrollLeft : 0;
55882       var scrollTop = scrollNode ? scrollNode.scrollTop : 0;
55883       var placement = _placement.apply(this, arguments);
55884       popoverSelection.classed("left", false).classed("right", false).classed("top", false).classed("bottom", false).classed(placement, true);
55885       var alignment = _alignment.apply(this, arguments);
55886       var alignFactor = 0.5;
55887       if (alignment === "leading") {
55888         alignFactor = 0;
55889       } else if (alignment === "trailing") {
55890         alignFactor = 1;
55891       }
55892       var anchorFrame = getFrame(anchor.node());
55893       var popoverFrame = getFrame(popoverSelection.node());
55894       var position;
55895       switch (placement) {
55896         case "top":
55897           position = {
55898             x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
55899             y: anchorFrame.y - popoverFrame.h
55900           };
55901           break;
55902         case "bottom":
55903           position = {
55904             x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
55905             y: anchorFrame.y + anchorFrame.h
55906           };
55907           break;
55908         case "left":
55909           position = {
55910             x: anchorFrame.x - popoverFrame.w,
55911             y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
55912           };
55913           break;
55914         case "right":
55915           position = {
55916             x: anchorFrame.x + anchorFrame.w,
55917             y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
55918           };
55919           break;
55920       }
55921       if (position) {
55922         if (scrollNode && (placement === "top" || placement === "bottom")) {
55923           var initialPosX = position.x;
55924           if (position.x + popoverFrame.w > scrollNode.offsetWidth - 10) {
55925             position.x = scrollNode.offsetWidth - 10 - popoverFrame.w;
55926           } else if (position.x < 10) {
55927             position.x = 10;
55928           }
55929           var arrow = anchor.selectAll(".popover-" + _id + " > .popover-arrow");
55930           var arrowPosX = Math.min(Math.max(popoverFrame.w / 2 - (position.x - initialPosX), 10), popoverFrame.w - 10);
55931           arrow.style("left", ~~arrowPosX + "px");
55932         }
55933         popoverSelection.style("left", ~~position.x + "px").style("top", ~~position.y + "px");
55934       } else {
55935         popoverSelection.style("left", null).style("top", null);
55936       }
55937       function getFrame(node) {
55938         var positionStyle = select_default2(node).style("position");
55939         if (positionStyle === "absolute" || positionStyle === "static") {
55940           return {
55941             x: node.offsetLeft - scrollLeft,
55942             y: node.offsetTop - scrollTop,
55943             w: node.offsetWidth,
55944             h: node.offsetHeight
55945           };
55946         } else {
55947           return {
55948             x: 0,
55949             y: 0,
55950             w: node.offsetWidth,
55951             h: node.offsetHeight
55952           };
55953         }
55954       }
55955     }
55956     function hide() {
55957       var anchor = select_default2(this);
55958       if (_displayType.apply(this, arguments) === "clickFocus") {
55959         anchor.classed("active", false);
55960       }
55961       anchor.selectAll(".popover-" + _id).classed("in", false);
55962     }
55963     function toggle() {
55964       if (select_default2(this).select(".popover-" + _id).classed("in")) {
55965         hide.apply(this, arguments);
55966       } else {
55967         show.apply(this, arguments);
55968       }
55969     }
55970     return popover;
55971   }
55972
55973   // modules/ui/tooltip.js
55974   function uiTooltip(klass) {
55975     var tooltip = uiPopover((klass || "") + " tooltip").displayType("hover");
55976     var _title = function() {
55977       var title = this.getAttribute("data-original-title");
55978       if (title) {
55979         return title;
55980       } else {
55981         title = this.getAttribute("title");
55982         this.removeAttribute("title");
55983         this.setAttribute("data-original-title", title);
55984       }
55985       return title;
55986     };
55987     var _heading = utilFunctor(null);
55988     var _keys = utilFunctor(null);
55989     tooltip.title = function(val) {
55990       if (!arguments.length)
55991         return _title;
55992       _title = utilFunctor(val);
55993       return tooltip;
55994     };
55995     tooltip.heading = function(val) {
55996       if (!arguments.length)
55997         return _heading;
55998       _heading = utilFunctor(val);
55999       return tooltip;
56000     };
56001     tooltip.keys = function(val) {
56002       if (!arguments.length)
56003         return _keys;
56004       _keys = utilFunctor(val);
56005       return tooltip;
56006     };
56007     tooltip.content(function() {
56008       var heading = _heading.apply(this, arguments);
56009       var text2 = _title.apply(this, arguments);
56010       var keys2 = _keys.apply(this, arguments);
56011       var headingCallback = typeof heading === "function" ? heading : (s2) => s2.text(heading);
56012       var textCallback = typeof text2 === "function" ? text2 : (s2) => s2.text(text2);
56013       return function(selection2) {
56014         var headingSelect = selection2.selectAll(".tooltip-heading").data(heading ? [heading] : []);
56015         headingSelect.exit().remove();
56016         headingSelect.enter().append("div").attr("class", "tooltip-heading").merge(headingSelect).text("").call(headingCallback);
56017         var textSelect = selection2.selectAll(".tooltip-text").data(text2 ? [text2] : []);
56018         textSelect.exit().remove();
56019         textSelect.enter().append("div").attr("class", "tooltip-text").merge(textSelect).text("").call(textCallback);
56020         var keyhintWrap = selection2.selectAll(".keyhint-wrap").data(keys2 && keys2.length ? [0] : []);
56021         keyhintWrap.exit().remove();
56022         var keyhintWrapEnter = keyhintWrap.enter().append("div").attr("class", "keyhint-wrap");
56023         keyhintWrapEnter.append("span").call(_t.append("tooltip_keyhint"));
56024         keyhintWrap = keyhintWrapEnter.merge(keyhintWrap);
56025         keyhintWrap.selectAll("kbd.shortcut").data(keys2 && keys2.length ? keys2 : []).enter().append("kbd").attr("class", "shortcut").text(function(d2) {
56026           return d2;
56027         });
56028       };
56029     });
56030     return tooltip;
56031   }
56032
56033   // modules/ui/edit_menu.js
56034   function uiEditMenu(context) {
56035     var dispatch14 = dispatch_default("toggled");
56036     var _menu = select_default2(null);
56037     var _operations = [];
56038     var _anchorLoc = [0, 0];
56039     var _anchorLocLonLat = [0, 0];
56040     var _triggerType = "";
56041     var _vpTopMargin = 85;
56042     var _vpBottomMargin = 45;
56043     var _vpSideMargin = 35;
56044     var _menuTop = false;
56045     var _menuHeight;
56046     var _menuWidth;
56047     var _verticalPadding = 4;
56048     var _tooltipWidth = 210;
56049     var _menuSideMargin = 10;
56050     var _tooltips = [];
56051     var editMenu = function(selection2) {
56052       var isTouchMenu = _triggerType.includes("touch") || _triggerType.includes("pen");
56053       var ops = _operations.filter(function(op) {
56054         return !isTouchMenu || !op.mouseOnly;
56055       });
56056       if (!ops.length)
56057         return;
56058       _tooltips = [];
56059       _menuTop = isTouchMenu;
56060       var showLabels = isTouchMenu;
56061       var buttonHeight = showLabels ? 32 : 34;
56062       if (showLabels) {
56063         _menuWidth = 52 + Math.min(120, 6 * Math.max.apply(Math, ops.map(function(op) {
56064           return op.title.length;
56065         })));
56066       } else {
56067         _menuWidth = 44;
56068       }
56069       _menuHeight = _verticalPadding * 2 + ops.length * buttonHeight;
56070       _menu = selection2.append("div").attr("class", "edit-menu").classed("touch-menu", isTouchMenu).style("padding", _verticalPadding + "px 0");
56071       var buttons = _menu.selectAll(".edit-menu-item").data(ops);
56072       var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
56073         return "edit-menu-item edit-menu-item-" + d2.id;
56074       }).style("height", buttonHeight + "px").on("click", click).on("pointerup", pointerup).on("pointerdown mousedown", function pointerdown(d3_event) {
56075         d3_event.stopPropagation();
56076       }).on("mouseenter.highlight", function(d3_event, d2) {
56077         if (!d2.relatedEntityIds || select_default2(this).classed("disabled"))
56078           return;
56079         utilHighlightEntities(d2.relatedEntityIds(), true, context);
56080       }).on("mouseleave.highlight", function(d3_event, d2) {
56081         if (!d2.relatedEntityIds)
56082           return;
56083         utilHighlightEntities(d2.relatedEntityIds(), false, context);
56084       });
56085       buttonsEnter.each(function(d2) {
56086         var tooltip = uiTooltip().heading(() => d2.title).title(d2.tooltip).keys([d2.keys[0]]);
56087         _tooltips.push(tooltip);
56088         select_default2(this).call(tooltip).append("div").attr("class", "icon-wrap").call(svgIcon(d2.icon && d2.icon() || "#iD-operation-" + d2.id, "operation"));
56089       });
56090       if (showLabels) {
56091         buttonsEnter.append("span").attr("class", "label").each(function(d2) {
56092           select_default2(this).call(d2.title);
56093         });
56094       }
56095       buttonsEnter.merge(buttons).classed("disabled", function(d2) {
56096         return d2.disabled();
56097       });
56098       updatePosition();
56099       var initialScale = context.projection.scale();
56100       context.map().on("move.edit-menu", function() {
56101         if (initialScale !== context.projection.scale()) {
56102           editMenu.close();
56103         }
56104       }).on("drawn.edit-menu", function(info) {
56105         if (info.full)
56106           updatePosition();
56107       });
56108       var lastPointerUpType;
56109       function pointerup(d3_event) {
56110         lastPointerUpType = d3_event.pointerType;
56111       }
56112       function click(d3_event, operation) {
56113         d3_event.stopPropagation();
56114         if (operation.relatedEntityIds) {
56115           utilHighlightEntities(operation.relatedEntityIds(), false, context);
56116         }
56117         if (operation.disabled()) {
56118           if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
56119             context.ui().flash.duration(4e3).iconName("#iD-operation-" + operation.id).iconClass("operation disabled").label(operation.tooltip())();
56120           }
56121         } else {
56122           if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
56123             context.ui().flash.duration(2e3).iconName("#iD-operation-" + operation.id).iconClass("operation").label(operation.annotation() || operation.title)();
56124           }
56125           operation();
56126           editMenu.close();
56127         }
56128         lastPointerUpType = null;
56129       }
56130       dispatch14.call("toggled", this, true);
56131     };
56132     function updatePosition() {
56133       if (!_menu || _menu.empty())
56134         return;
56135       var anchorLoc = context.projection(_anchorLocLonLat);
56136       var viewport = context.surfaceRect();
56137       if (anchorLoc[0] < 0 || anchorLoc[0] > viewport.width || anchorLoc[1] < 0 || anchorLoc[1] > viewport.height) {
56138         editMenu.close();
56139         return;
56140       }
56141       var menuLeft = displayOnLeft(viewport);
56142       var offset = [0, 0];
56143       offset[0] = menuLeft ? -1 * (_menuSideMargin + _menuWidth) : _menuSideMargin;
56144       if (_menuTop) {
56145         if (anchorLoc[1] - _menuHeight < _vpTopMargin) {
56146           offset[1] = -anchorLoc[1] + _vpTopMargin;
56147         } else {
56148           offset[1] = -_menuHeight;
56149         }
56150       } else {
56151         if (anchorLoc[1] + _menuHeight > viewport.height - _vpBottomMargin) {
56152           offset[1] = -anchorLoc[1] - _menuHeight + viewport.height - _vpBottomMargin;
56153         } else {
56154           offset[1] = 0;
56155         }
56156       }
56157       var origin = geoVecAdd(anchorLoc, offset);
56158       _menu.style("left", origin[0] + "px").style("top", origin[1] + "px");
56159       var tooltipSide = tooltipPosition(viewport, menuLeft);
56160       _tooltips.forEach(function(tooltip) {
56161         tooltip.placement(tooltipSide);
56162       });
56163       function displayOnLeft(viewport2) {
56164         if (_mainLocalizer.textDirection() === "ltr") {
56165           if (anchorLoc[0] + _menuSideMargin + _menuWidth > viewport2.width - _vpSideMargin) {
56166             return true;
56167           }
56168           return false;
56169         } else {
56170           if (anchorLoc[0] - _menuSideMargin - _menuWidth < _vpSideMargin) {
56171             return false;
56172           }
56173           return true;
56174         }
56175       }
56176       function tooltipPosition(viewport2, menuLeft2) {
56177         if (_mainLocalizer.textDirection() === "ltr") {
56178           if (menuLeft2) {
56179             return "left";
56180           }
56181           if (anchorLoc[0] + _menuSideMargin + _menuWidth + _tooltipWidth > viewport2.width - _vpSideMargin) {
56182             return "left";
56183           }
56184           return "right";
56185         } else {
56186           if (!menuLeft2) {
56187             return "right";
56188           }
56189           if (anchorLoc[0] - _menuSideMargin - _menuWidth - _tooltipWidth < _vpSideMargin) {
56190             return "right";
56191           }
56192           return "left";
56193         }
56194       }
56195     }
56196     editMenu.close = function() {
56197       context.map().on("move.edit-menu", null).on("drawn.edit-menu", null);
56198       _menu.remove();
56199       _tooltips = [];
56200       dispatch14.call("toggled", this, false);
56201     };
56202     editMenu.anchorLoc = function(val) {
56203       if (!arguments.length)
56204         return _anchorLoc;
56205       _anchorLoc = val;
56206       _anchorLocLonLat = context.projection.invert(_anchorLoc);
56207       return editMenu;
56208     };
56209     editMenu.triggerType = function(val) {
56210       if (!arguments.length)
56211         return _triggerType;
56212       _triggerType = val;
56213       return editMenu;
56214     };
56215     editMenu.operations = function(val) {
56216       if (!arguments.length)
56217         return _operations;
56218       _operations = val;
56219       return editMenu;
56220     };
56221     return utilRebind(editMenu, dispatch14, "on");
56222   }
56223
56224   // modules/ui/feature_info.js
56225   function uiFeatureInfo(context) {
56226     function update(selection2) {
56227       var features = context.features();
56228       var stats = features.stats();
56229       var count = 0;
56230       var hiddenList = features.hidden().map(function(k2) {
56231         if (stats[k2]) {
56232           count += stats[k2];
56233           return _t.append("inspector.title_count", {
56234             title: _t("feature." + k2 + ".description"),
56235             count: stats[k2]
56236           });
56237         }
56238         return null;
56239       }).filter(Boolean);
56240       selection2.text("");
56241       if (hiddenList.length) {
56242         var tooltipBehavior = uiTooltip().placement("top").title(function() {
56243           return (selection3) => {
56244             hiddenList.forEach((hiddenFeature) => {
56245               selection3.append("div").call(hiddenFeature);
56246             });
56247           };
56248         });
56249         selection2.append("a").attr("class", "chip").attr("href", "#").call(_t.append("feature_info.hidden_warning", { count })).call(tooltipBehavior).on("click", function(d3_event) {
56250           tooltipBehavior.hide();
56251           d3_event.preventDefault();
56252           context.ui().togglePanes(context.container().select(".map-panes .map-data-pane"));
56253         });
56254       }
56255       selection2.classed("hide", !hiddenList.length);
56256     }
56257     return function(selection2) {
56258       update(selection2);
56259       context.features().on("change.feature_info", function() {
56260         update(selection2);
56261       });
56262     };
56263   }
56264
56265   // modules/ui/flash.js
56266   function uiFlash(context) {
56267     var _flashTimer;
56268     var _duration = 2e3;
56269     var _iconName = "#iD-icon-no";
56270     var _iconClass = "disabled";
56271     var _label = (s2) => s2.text("");
56272     function flash() {
56273       if (_flashTimer) {
56274         _flashTimer.stop();
56275       }
56276       context.container().select(".main-footer-wrap").classed("footer-hide", true).classed("footer-show", false);
56277       context.container().select(".flash-wrap").classed("footer-hide", false).classed("footer-show", true);
56278       var content = context.container().select(".flash-wrap").selectAll(".flash-content").data([0]);
56279       var contentEnter = content.enter().append("div").attr("class", "flash-content");
56280       var iconEnter = contentEnter.append("svg").attr("class", "flash-icon icon").append("g").attr("transform", "translate(10,10)");
56281       iconEnter.append("circle").attr("r", 9);
56282       iconEnter.append("use").attr("transform", "translate(-7,-7)").attr("width", "14").attr("height", "14");
56283       contentEnter.append("div").attr("class", "flash-text");
56284       content = content.merge(contentEnter);
56285       content.selectAll(".flash-icon").attr("class", "icon flash-icon " + (_iconClass || ""));
56286       content.selectAll(".flash-icon use").attr("xlink:href", _iconName);
56287       content.selectAll(".flash-text").attr("class", "flash-text").call(_label);
56288       _flashTimer = timeout_default(function() {
56289         _flashTimer = null;
56290         context.container().select(".main-footer-wrap").classed("footer-hide", false).classed("footer-show", true);
56291         context.container().select(".flash-wrap").classed("footer-hide", true).classed("footer-show", false);
56292       }, _duration);
56293       return content;
56294     }
56295     flash.duration = function(_2) {
56296       if (!arguments.length)
56297         return _duration;
56298       _duration = _2;
56299       return flash;
56300     };
56301     flash.label = function(_2) {
56302       if (!arguments.length)
56303         return _label;
56304       if (typeof _2 !== "function") {
56305         _label = (selection2) => selection2.text(_2);
56306       } else {
56307         _label = (selection2) => selection2.text("").call(_2);
56308       }
56309       return flash;
56310     };
56311     flash.iconName = function(_2) {
56312       if (!arguments.length)
56313         return _iconName;
56314       _iconName = _2;
56315       return flash;
56316     };
56317     flash.iconClass = function(_2) {
56318       if (!arguments.length)
56319         return _iconClass;
56320       _iconClass = _2;
56321       return flash;
56322     };
56323     return flash;
56324   }
56325
56326   // modules/ui/full_screen.js
56327   function uiFullScreen(context) {
56328     var element = context.container().node();
56329     function getFullScreenFn() {
56330       if (element.requestFullscreen) {
56331         return element.requestFullscreen;
56332       } else if (element.msRequestFullscreen) {
56333         return element.msRequestFullscreen;
56334       } else if (element.mozRequestFullScreen) {
56335         return element.mozRequestFullScreen;
56336       } else if (element.webkitRequestFullscreen) {
56337         return element.webkitRequestFullscreen;
56338       }
56339     }
56340     function getExitFullScreenFn() {
56341       if (document.exitFullscreen) {
56342         return document.exitFullscreen;
56343       } else if (document.msExitFullscreen) {
56344         return document.msExitFullscreen;
56345       } else if (document.mozCancelFullScreen) {
56346         return document.mozCancelFullScreen;
56347       } else if (document.webkitExitFullscreen) {
56348         return document.webkitExitFullscreen;
56349       }
56350     }
56351     function isFullScreen() {
56352       return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement;
56353     }
56354     function isSupported() {
56355       return !!getFullScreenFn();
56356     }
56357     function fullScreen(d3_event) {
56358       d3_event.preventDefault();
56359       if (!isFullScreen()) {
56360         getFullScreenFn().apply(element);
56361       } else {
56362         getExitFullScreenFn().apply(document);
56363       }
56364     }
56365     return function() {
56366       if (!isSupported())
56367         return;
56368       var detected = utilDetect();
56369       var keys2 = detected.os === "mac" ? [uiCmd("\u2303\u2318F"), "f11"] : ["f11"];
56370       context.keybinding().on(keys2, fullScreen);
56371     };
56372   }
56373
56374   // modules/ui/geolocate.js
56375   function uiGeolocate(context) {
56376     var _geolocationOptions = {
56377       // prioritize speed and power usage over precision
56378       enableHighAccuracy: false,
56379       // don't hang indefinitely getting the location
56380       timeout: 6e3
56381       // 6sec
56382     };
56383     var _locating = uiLoading(context).message(_t.html("geolocate.locating")).blocking(true);
56384     var _layer = context.layers().layer("geolocate");
56385     var _position;
56386     var _extent;
56387     var _timeoutID;
56388     var _button = select_default2(null);
56389     function click() {
56390       if (context.inIntro())
56391         return;
56392       if (!_layer.enabled() && !_locating.isShown()) {
56393         _timeoutID = setTimeout(
56394           error,
56395           1e4
56396           /* 10sec */
56397         );
56398         context.container().call(_locating);
56399         navigator.geolocation.getCurrentPosition(success, error, _geolocationOptions);
56400       } else {
56401         _locating.close();
56402         _layer.enabled(null, false);
56403         updateButtonState();
56404       }
56405     }
56406     function zoomTo() {
56407       context.enter(modeBrowse(context));
56408       var map2 = context.map();
56409       _layer.enabled(_position, true);
56410       updateButtonState();
56411       map2.centerZoomEase(_extent.center(), Math.min(20, map2.extentZoom(_extent)));
56412     }
56413     function success(geolocation) {
56414       _position = geolocation;
56415       var coords = _position.coords;
56416       _extent = geoExtent([coords.longitude, coords.latitude]).padByMeters(coords.accuracy);
56417       zoomTo();
56418       finish();
56419     }
56420     function error() {
56421       if (_position) {
56422         zoomTo();
56423       } else {
56424         context.ui().flash.label(_t.append("geolocate.location_unavailable")).iconName("#iD-icon-geolocate")();
56425       }
56426       finish();
56427     }
56428     function finish() {
56429       _locating.close();
56430       if (_timeoutID) {
56431         clearTimeout(_timeoutID);
56432       }
56433       _timeoutID = void 0;
56434     }
56435     function updateButtonState() {
56436       _button.classed("active", _layer.enabled());
56437       _button.attr("aria-pressed", _layer.enabled());
56438     }
56439     return function(selection2) {
56440       if (!navigator.geolocation || !navigator.geolocation.getCurrentPosition)
56441         return;
56442       _button = selection2.append("button").on("click", click).attr("aria-pressed", false).call(svgIcon("#iD-icon-geolocate", "light")).call(
56443         uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(() => _t.append("geolocate.title")).keys([_t("geolocate.key")])
56444       );
56445       context.keybinding().on(_t("geolocate.key"), click);
56446     };
56447   }
56448
56449   // modules/ui/panels/background.js
56450   function uiPanelBackground(context) {
56451     var background = context.background();
56452     var _currSourceName = null;
56453     var _metadata = {};
56454     var _metadataKeys = [
56455       "zoom",
56456       "vintage",
56457       "source",
56458       "description",
56459       "resolution",
56460       "accuracy"
56461     ];
56462     var debouncedRedraw = debounce_default(redraw, 250);
56463     function redraw(selection2) {
56464       var source = background.baseLayerSource();
56465       if (!source)
56466         return;
56467       var isDG = source.id.match(/^DigitalGlobe/i) !== null;
56468       var sourceLabel = source.label();
56469       if (_currSourceName !== sourceLabel) {
56470         _currSourceName = sourceLabel;
56471         _metadata = {};
56472       }
56473       selection2.text("");
56474       var list = selection2.append("ul").attr("class", "background-info");
56475       list.append("li").call(_currSourceName);
56476       _metadataKeys.forEach(function(k2) {
56477         if (isDG && k2 === "vintage")
56478           return;
56479         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]);
56480       });
56481       debouncedGetMetadata(selection2);
56482       var toggleTiles = context.getDebug("tile") ? "hide_tiles" : "show_tiles";
56483       selection2.append("a").call(_t.append("info_panels.background." + toggleTiles)).attr("href", "#").attr("class", "button button-toggle-tiles").on("click", function(d3_event) {
56484         d3_event.preventDefault();
56485         context.setDebug("tile", !context.getDebug("tile"));
56486         selection2.call(redraw);
56487       });
56488       if (isDG) {
56489         var key = source.id + "-vintage";
56490         var sourceVintage = context.background().findSource(key);
56491         var showsVintage = context.background().showsLayer(sourceVintage);
56492         var toggleVintage = showsVintage ? "hide_vintage" : "show_vintage";
56493         selection2.append("a").call(_t.append("info_panels.background." + toggleVintage)).attr("href", "#").attr("class", "button button-toggle-vintage").on("click", function(d3_event) {
56494           d3_event.preventDefault();
56495           context.background().toggleOverlayLayer(sourceVintage);
56496           selection2.call(redraw);
56497         });
56498       }
56499       ["DigitalGlobe-Premium", "DigitalGlobe-Standard"].forEach(function(layerId) {
56500         if (source.id !== layerId) {
56501           var key2 = layerId + "-vintage";
56502           var sourceVintage2 = context.background().findSource(key2);
56503           if (context.background().showsLayer(sourceVintage2)) {
56504             context.background().toggleOverlayLayer(sourceVintage2);
56505           }
56506         }
56507       });
56508     }
56509     var debouncedGetMetadata = debounce_default(getMetadata, 250);
56510     function getMetadata(selection2) {
56511       var tile = context.container().select(".layer-background img.tile-center");
56512       if (tile.empty())
56513         return;
56514       var sourceName = _currSourceName;
56515       var d2 = tile.datum();
56516       var zoom = d2 && d2.length >= 3 && d2[2] || Math.floor(context.map().zoom());
56517       var center = context.map().center();
56518       _metadata.zoom = String(zoom);
56519       selection2.selectAll(".background-info-list-zoom").classed("hide", false).selectAll(".background-info-span-zoom").text(_metadata.zoom);
56520       if (!d2 || !d2.length >= 3)
56521         return;
56522       background.baseLayerSource().getMetadata(center, d2, function(err, result) {
56523         if (err || _currSourceName !== sourceName)
56524           return;
56525         var vintage = result.vintage;
56526         _metadata.vintage = vintage && vintage.range || _t("info_panels.background.unknown");
56527         selection2.selectAll(".background-info-list-vintage").classed("hide", false).selectAll(".background-info-span-vintage").text(_metadata.vintage);
56528         _metadataKeys.forEach(function(k2) {
56529           if (k2 === "zoom" || k2 === "vintage")
56530             return;
56531           var val = result[k2];
56532           _metadata[k2] = val;
56533           selection2.selectAll(".background-info-list-" + k2).classed("hide", !val).selectAll(".background-info-span-" + k2).text(val);
56534         });
56535       });
56536     }
56537     var panel = function(selection2) {
56538       selection2.call(redraw);
56539       context.map().on("drawn.info-background", function() {
56540         selection2.call(debouncedRedraw);
56541       }).on("move.info-background", function() {
56542         selection2.call(debouncedGetMetadata);
56543       });
56544     };
56545     panel.off = function() {
56546       context.map().on("drawn.info-background", null).on("move.info-background", null);
56547     };
56548     panel.id = "background";
56549     panel.label = _t.append("info_panels.background.title");
56550     panel.key = _t("info_panels.background.key");
56551     return panel;
56552   }
56553
56554   // modules/ui/panels/history.js
56555   function uiPanelHistory(context) {
56556     var osm;
56557     function displayTimestamp(timestamp) {
56558       if (!timestamp)
56559         return _t("info_panels.history.unknown");
56560       var options2 = {
56561         day: "numeric",
56562         month: "short",
56563         year: "numeric",
56564         hour: "numeric",
56565         minute: "numeric",
56566         second: "numeric"
56567       };
56568       var d2 = new Date(timestamp);
56569       if (isNaN(d2.getTime()))
56570         return _t("info_panels.history.unknown");
56571       return d2.toLocaleString(_mainLocalizer.localeCode(), options2);
56572     }
56573     function displayUser(selection2, userName) {
56574       if (!userName) {
56575         selection2.append("span").call(_t.append("info_panels.history.unknown"));
56576         return;
56577       }
56578       selection2.append("span").attr("class", "user-name").text(userName);
56579       var links = selection2.append("div").attr("class", "links");
56580       if (osm) {
56581         links.append("a").attr("class", "user-osm-link").attr("href", osm.userURL(userName)).attr("target", "_blank").call(_t.append("info_panels.history.profile_link"));
56582       }
56583       links.append("a").attr("class", "user-hdyc-link").attr("href", "https://hdyc.neis-one.org/?" + userName).attr("target", "_blank").attr("tabindex", -1).text("HDYC");
56584     }
56585     function displayChangeset(selection2, changeset) {
56586       if (!changeset) {
56587         selection2.append("span").call(_t.append("info_panels.history.unknown"));
56588         return;
56589       }
56590       selection2.append("span").attr("class", "changeset-id").text(changeset);
56591       var links = selection2.append("div").attr("class", "links");
56592       if (osm) {
56593         links.append("a").attr("class", "changeset-osm-link").attr("href", osm.changesetURL(changeset)).attr("target", "_blank").call(_t.append("info_panels.history.changeset_link"));
56594       }
56595       links.append("a").attr("class", "changeset-osmcha-link").attr("href", "https://osmcha.org/changesets/" + changeset).attr("target", "_blank").text("OSMCha");
56596       links.append("a").attr("class", "changeset-achavi-link").attr("href", "https://overpass-api.de/achavi/?changeset=" + changeset).attr("target", "_blank").text("Achavi");
56597     }
56598     function redraw(selection2) {
56599       var selectedNoteID = context.selectedNoteID();
56600       osm = context.connection();
56601       var selected, note, entity;
56602       if (selectedNoteID && osm) {
56603         selected = [_t.html("note.note") + " " + selectedNoteID];
56604         note = osm.getNote(selectedNoteID);
56605       } else {
56606         selected = context.selectedIDs().filter(function(e3) {
56607           return context.hasEntity(e3);
56608         });
56609         if (selected.length) {
56610           entity = context.entity(selected[0]);
56611         }
56612       }
56613       var singular = selected.length === 1 ? selected[0] : null;
56614       selection2.html("");
56615       if (singular) {
56616         selection2.append("h4").attr("class", "history-heading").html(singular);
56617       } else {
56618         selection2.append("h4").attr("class", "history-heading").call(_t.append("info_panels.selected", { n: selected.length }));
56619       }
56620       if (!singular)
56621         return;
56622       if (entity) {
56623         selection2.call(redrawEntity, entity);
56624       } else if (note) {
56625         selection2.call(redrawNote, note);
56626       }
56627     }
56628     function redrawNote(selection2, note) {
56629       if (!note || note.isNew()) {
56630         selection2.append("div").call(_t.append("info_panels.history.note_no_history"));
56631         return;
56632       }
56633       var list = selection2.append("ul");
56634       list.append("li").call(_t.append("info_panels.history.note_comments", { suffix: ":" })).append("span").text(note.comments.length);
56635       if (note.comments.length) {
56636         list.append("li").call(_t.append("info_panels.history.note_created_date", { suffix: ":" })).append("span").text(displayTimestamp(note.comments[0].date));
56637         list.append("li").call(_t.append("info_panels.history.note_created_user", { suffix: ":" })).call(displayUser, note.comments[0].user);
56638       }
56639       if (osm) {
56640         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"));
56641       }
56642     }
56643     function redrawEntity(selection2, entity) {
56644       if (!entity || entity.isNew()) {
56645         selection2.append("div").call(_t.append("info_panels.history.no_history"));
56646         return;
56647       }
56648       var links = selection2.append("div").attr("class", "links");
56649       if (osm) {
56650         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"));
56651       }
56652       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");
56653       var list = selection2.append("ul");
56654       list.append("li").call(_t.append("info_panels.history.version", { suffix: ":" })).append("span").text(entity.version);
56655       list.append("li").call(_t.append("info_panels.history.last_edit", { suffix: ":" })).append("span").text(displayTimestamp(entity.timestamp));
56656       list.append("li").call(_t.append("info_panels.history.edited_by", { suffix: ":" })).call(displayUser, entity.user);
56657       list.append("li").call(_t.append("info_panels.history.changeset", { suffix: ":" })).call(displayChangeset, entity.changeset);
56658     }
56659     var panel = function(selection2) {
56660       selection2.call(redraw);
56661       context.map().on("drawn.info-history", function() {
56662         selection2.call(redraw);
56663       });
56664       context.on("enter.info-history", function() {
56665         selection2.call(redraw);
56666       });
56667     };
56668     panel.off = function() {
56669       context.map().on("drawn.info-history", null);
56670       context.on("enter.info-history", null);
56671     };
56672     panel.id = "history";
56673     panel.label = _t.append("info_panels.history.title");
56674     panel.key = _t("info_panels.history.key");
56675     return panel;
56676   }
56677
56678   // modules/util/units.js
56679   var OSM_PRECISION = 7;
56680   function displayLength(m2, isImperial) {
56681     var d2 = m2 * (isImperial ? 3.28084 : 1);
56682     var unit2;
56683     if (isImperial) {
56684       if (d2 >= 5280) {
56685         d2 /= 5280;
56686         unit2 = "miles";
56687       } else {
56688         unit2 = "feet";
56689       }
56690     } else {
56691       if (d2 >= 1e3) {
56692         d2 /= 1e3;
56693         unit2 = "kilometers";
56694       } else {
56695         unit2 = "meters";
56696       }
56697     }
56698     return _t("units." + unit2, {
56699       quantity: d2.toLocaleString(_mainLocalizer.localeCode(), {
56700         maximumSignificantDigits: 4
56701       })
56702     });
56703   }
56704   function displayArea(m2, isImperial) {
56705     var locale2 = _mainLocalizer.localeCode();
56706     var d2 = m2 * (isImperial ? 10.7639111056 : 1);
56707     var d1, d22, area;
56708     var unit1 = "";
56709     var unit2 = "";
56710     if (isImperial) {
56711       if (d2 >= 6969600) {
56712         d1 = d2 / 27878400;
56713         unit1 = "square_miles";
56714       } else {
56715         d1 = d2;
56716         unit1 = "square_feet";
56717       }
56718       if (d2 > 4356 && d2 < 4356e4) {
56719         d22 = d2 / 43560;
56720         unit2 = "acres";
56721       }
56722     } else {
56723       if (d2 >= 25e4) {
56724         d1 = d2 / 1e6;
56725         unit1 = "square_kilometers";
56726       } else {
56727         d1 = d2;
56728         unit1 = "square_meters";
56729       }
56730       if (d2 > 1e3 && d2 < 1e7) {
56731         d22 = d2 / 1e4;
56732         unit2 = "hectares";
56733       }
56734     }
56735     area = _t("units." + unit1, {
56736       quantity: d1.toLocaleString(locale2, {
56737         maximumSignificantDigits: 4
56738       })
56739     });
56740     if (d22) {
56741       return _t("units.area_pair", {
56742         area1: area,
56743         area2: _t("units." + unit2, {
56744           quantity: d22.toLocaleString(locale2, {
56745             maximumSignificantDigits: 2
56746           })
56747         })
56748       });
56749     } else {
56750       return area;
56751     }
56752   }
56753   function wrap(x2, min3, max3) {
56754     var d2 = max3 - min3;
56755     return ((x2 - min3) % d2 + d2) % d2 + min3;
56756   }
56757   function clamp2(x2, min3, max3) {
56758     return Math.max(min3, Math.min(x2, max3));
56759   }
56760   function displayCoordinate(deg, pos, neg) {
56761     var locale2 = _mainLocalizer.localeCode();
56762     var min3 = (Math.abs(deg) - Math.floor(Math.abs(deg))) * 60;
56763     var sec = (min3 - Math.floor(min3)) * 60;
56764     var displayDegrees = _t("units.arcdegrees", {
56765       quantity: Math.floor(Math.abs(deg)).toLocaleString(locale2)
56766     });
56767     var displayCoordinate2;
56768     if (Math.floor(sec) > 0) {
56769       displayCoordinate2 = displayDegrees + _t("units.arcminutes", {
56770         quantity: Math.floor(min3).toLocaleString(locale2)
56771       }) + _t("units.arcseconds", {
56772         quantity: Math.round(sec).toLocaleString(locale2)
56773       });
56774     } else if (Math.floor(min3) > 0) {
56775       displayCoordinate2 = displayDegrees + _t("units.arcminutes", {
56776         quantity: Math.round(min3).toLocaleString(locale2)
56777       });
56778     } else {
56779       displayCoordinate2 = _t("units.arcdegrees", {
56780         quantity: Math.round(Math.abs(deg)).toLocaleString(locale2)
56781       });
56782     }
56783     if (deg === 0) {
56784       return displayCoordinate2;
56785     } else {
56786       return _t("units.coordinate", {
56787         coordinate: displayCoordinate2,
56788         direction: _t("units." + (deg > 0 ? pos : neg))
56789       });
56790     }
56791   }
56792   function dmsCoordinatePair(coord2) {
56793     return _t("units.coordinate_pair", {
56794       latitude: displayCoordinate(clamp2(coord2[1], -90, 90), "north", "south"),
56795       longitude: displayCoordinate(wrap(coord2[0], -180, 180), "east", "west")
56796     });
56797   }
56798   function decimalCoordinatePair(coord2) {
56799     return _t("units.coordinate_pair", {
56800       latitude: clamp2(coord2[1], -90, 90).toFixed(OSM_PRECISION),
56801       longitude: wrap(coord2[0], -180, 180).toFixed(OSM_PRECISION)
56802     });
56803   }
56804
56805   // modules/ui/panels/location.js
56806   function uiPanelLocation(context) {
56807     var currLocation = "";
56808     function redraw(selection2) {
56809       selection2.html("");
56810       var list = selection2.append("ul");
56811       var coord2 = context.map().mouseCoordinates();
56812       if (coord2.some(isNaN)) {
56813         coord2 = context.map().center();
56814       }
56815       list.append("li").text(dmsCoordinatePair(coord2)).append("li").text(decimalCoordinatePair(coord2));
56816       selection2.append("div").attr("class", "location-info").text(currLocation || " ");
56817       debouncedGetLocation(selection2, coord2);
56818     }
56819     var debouncedGetLocation = debounce_default(getLocation, 250);
56820     function getLocation(selection2, coord2) {
56821       if (!services.geocoder) {
56822         currLocation = _t("info_panels.location.unknown_location");
56823         selection2.selectAll(".location-info").text(currLocation);
56824       } else {
56825         services.geocoder.reverse(coord2, function(err, result) {
56826           currLocation = result ? result.display_name : _t("info_panels.location.unknown_location");
56827           selection2.selectAll(".location-info").text(currLocation);
56828         });
56829       }
56830     }
56831     var panel = function(selection2) {
56832       selection2.call(redraw);
56833       context.surface().on(("PointerEvent" in window ? "pointer" : "mouse") + "move.info-location", function() {
56834         selection2.call(redraw);
56835       });
56836     };
56837     panel.off = function() {
56838       context.surface().on(".info-location", null);
56839     };
56840     panel.id = "location";
56841     panel.label = _t.append("info_panels.location.title");
56842     panel.key = _t("info_panels.location.key");
56843     return panel;
56844   }
56845
56846   // modules/ui/panels/measurement.js
56847   function uiPanelMeasurement(context) {
56848     function radiansToMeters(r2) {
56849       return r2 * 63710071809e-4;
56850     }
56851     function steradiansToSqmeters(r2) {
56852       return r2 / (4 * Math.PI) * 510065621724e3;
56853     }
56854     function toLineString(feature3) {
56855       if (feature3.type === "LineString")
56856         return feature3;
56857       var result = { type: "LineString", coordinates: [] };
56858       if (feature3.type === "Polygon") {
56859         result.coordinates = feature3.coordinates[0];
56860       } else if (feature3.type === "MultiPolygon") {
56861         result.coordinates = feature3.coordinates[0][0];
56862       }
56863       return result;
56864     }
56865     var _isImperial = !_mainLocalizer.usesMetric();
56866     function redraw(selection2) {
56867       var graph = context.graph();
56868       var selectedNoteID = context.selectedNoteID();
56869       var osm = services.osm;
56870       var localeCode = _mainLocalizer.localeCode();
56871       var heading;
56872       var center, location, centroid;
56873       var closed, geometry;
56874       var totalNodeCount, length = 0, area = 0, distance;
56875       if (selectedNoteID && osm) {
56876         var note = osm.getNote(selectedNoteID);
56877         heading = _t.html("note.note") + " " + selectedNoteID;
56878         location = note.loc;
56879         geometry = "note";
56880       } else {
56881         var selectedIDs = context.selectedIDs().filter(function(id2) {
56882           return context.hasEntity(id2);
56883         });
56884         var selected = selectedIDs.map(function(id2) {
56885           return context.entity(id2);
56886         });
56887         heading = selected.length === 1 ? selected[0].id : _t.html("info_panels.selected", { n: selected.length });
56888         if (selected.length) {
56889           var extent = geoExtent();
56890           for (var i3 in selected) {
56891             var entity = selected[i3];
56892             extent._extend(entity.extent(graph));
56893             geometry = entity.geometry(graph);
56894             if (geometry === "line" || geometry === "area") {
56895               closed = entity.type === "relation" || entity.isClosed() && !entity.isDegenerate();
56896               var feature3 = entity.asGeoJSON(graph);
56897               length += radiansToMeters(length_default(toLineString(feature3)));
56898               centroid = path_default(context.projection).centroid(entity.asGeoJSON(graph));
56899               centroid = centroid && context.projection.invert(centroid);
56900               if (!centroid || !isFinite(centroid[0]) || !isFinite(centroid[1])) {
56901                 centroid = entity.extent(graph).center();
56902               }
56903               if (closed) {
56904                 area += steradiansToSqmeters(entity.area(graph));
56905               }
56906             }
56907           }
56908           if (selected.length > 1) {
56909             geometry = null;
56910             closed = null;
56911             centroid = null;
56912           }
56913           if (selected.length === 2 && selected[0].type === "node" && selected[1].type === "node") {
56914             distance = geoSphericalDistance(selected[0].loc, selected[1].loc);
56915           }
56916           if (selected.length === 1 && selected[0].type === "node") {
56917             location = selected[0].loc;
56918           } else {
56919             totalNodeCount = utilGetAllNodes(selectedIDs, context.graph()).length;
56920           }
56921           if (!location && !centroid) {
56922             center = extent.center();
56923           }
56924         }
56925       }
56926       selection2.html("");
56927       if (heading) {
56928         selection2.append("h4").attr("class", "measurement-heading").html(heading);
56929       }
56930       var list = selection2.append("ul");
56931       var coordItem;
56932       if (geometry) {
56933         list.append("li").call(_t.append("info_panels.measurement.geometry", { suffix: ":" })).append("span").html(
56934           closed ? _t.html("info_panels.measurement.closed_" + geometry) : _t.html("geometry." + geometry)
56935         );
56936       }
56937       if (totalNodeCount) {
56938         list.append("li").call(_t.append("info_panels.measurement.node_count", { suffix: ":" })).append("span").text(totalNodeCount.toLocaleString(localeCode));
56939       }
56940       if (area) {
56941         list.append("li").call(_t.append("info_panels.measurement.area", { suffix: ":" })).append("span").text(displayArea(area, _isImperial));
56942       }
56943       if (length) {
56944         list.append("li").call(_t.append("info_panels.measurement." + (closed ? "perimeter" : "length"), { suffix: ":" })).append("span").text(displayLength(length, _isImperial));
56945       }
56946       if (typeof distance === "number") {
56947         list.append("li").call(_t.append("info_panels.measurement.distance", { suffix: ":" })).append("span").text(displayLength(distance, _isImperial));
56948       }
56949       if (location) {
56950         coordItem = list.append("li").call(_t.append("info_panels.measurement.location", { suffix: ":" }));
56951         coordItem.append("span").text(dmsCoordinatePair(location));
56952         coordItem.append("span").text(decimalCoordinatePair(location));
56953       }
56954       if (centroid) {
56955         coordItem = list.append("li").call(_t.append("info_panels.measurement.centroid", { suffix: ":" }));
56956         coordItem.append("span").text(dmsCoordinatePair(centroid));
56957         coordItem.append("span").text(decimalCoordinatePair(centroid));
56958       }
56959       if (center) {
56960         coordItem = list.append("li").call(_t.append("info_panels.measurement.center", { suffix: ":" }));
56961         coordItem.append("span").text(dmsCoordinatePair(center));
56962         coordItem.append("span").text(decimalCoordinatePair(center));
56963       }
56964       if (length || area || typeof distance === "number") {
56965         var toggle = _isImperial ? "imperial" : "metric";
56966         selection2.append("a").call(_t.append("info_panels.measurement." + toggle)).attr("href", "#").attr("class", "button button-toggle-units").on("click", function(d3_event) {
56967           d3_event.preventDefault();
56968           _isImperial = !_isImperial;
56969           selection2.call(redraw);
56970         });
56971       }
56972     }
56973     var panel = function(selection2) {
56974       selection2.call(redraw);
56975       context.map().on("drawn.info-measurement", function() {
56976         selection2.call(redraw);
56977       });
56978       context.on("enter.info-measurement", function() {
56979         selection2.call(redraw);
56980       });
56981     };
56982     panel.off = function() {
56983       context.map().on("drawn.info-measurement", null);
56984       context.on("enter.info-measurement", null);
56985     };
56986     panel.id = "measurement";
56987     panel.label = _t.append("info_panels.measurement.title");
56988     panel.key = _t("info_panels.measurement.key");
56989     return panel;
56990   }
56991
56992   // modules/ui/panels/index.js
56993   var uiInfoPanels = {
56994     background: uiPanelBackground,
56995     history: uiPanelHistory,
56996     location: uiPanelLocation,
56997     measurement: uiPanelMeasurement
56998   };
56999
57000   // modules/ui/info.js
57001   function uiInfo(context) {
57002     var ids = Object.keys(uiInfoPanels);
57003     var wasActive = ["measurement"];
57004     var panels = {};
57005     var active = {};
57006     ids.forEach(function(k2) {
57007       if (!panels[k2]) {
57008         panels[k2] = uiInfoPanels[k2](context);
57009         active[k2] = false;
57010       }
57011     });
57012     function info(selection2) {
57013       function redraw() {
57014         var activeids = ids.filter(function(k2) {
57015           return active[k2];
57016         }).sort();
57017         var containers = infoPanels.selectAll(".panel-container").data(activeids, function(k2) {
57018           return k2;
57019         });
57020         containers.exit().style("opacity", 1).transition().duration(200).style("opacity", 0).on("end", function(d2) {
57021           select_default2(this).call(panels[d2].off).remove();
57022         });
57023         var enter = containers.enter().append("div").attr("class", function(d2) {
57024           return "fillD2 panel-container panel-container-" + d2;
57025         });
57026         enter.style("opacity", 0).transition().duration(200).style("opacity", 1);
57027         var title = enter.append("div").attr("class", "panel-title fillD2");
57028         title.append("h3").each(function(d2) {
57029           return panels[d2].label(select_default2(this));
57030         });
57031         title.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function(d3_event, d2) {
57032           d3_event.stopImmediatePropagation();
57033           d3_event.preventDefault();
57034           info.toggle(d2);
57035         }).call(svgIcon("#iD-icon-close"));
57036         enter.append("div").attr("class", function(d2) {
57037           return "panel-content panel-content-" + d2;
57038         });
57039         infoPanels.selectAll(".panel-content").each(function(d2) {
57040           select_default2(this).call(panels[d2]);
57041         });
57042       }
57043       info.toggle = function(which) {
57044         var activeids = ids.filter(function(k2) {
57045           return active[k2];
57046         });
57047         if (which) {
57048           active[which] = !active[which];
57049           if (activeids.length === 1 && activeids[0] === which) {
57050             wasActive = [which];
57051           }
57052           context.container().select("." + which + "-panel-toggle-item").classed("active", active[which]).select("input").property("checked", active[which]);
57053         } else {
57054           if (activeids.length) {
57055             wasActive = activeids;
57056             activeids.forEach(function(k2) {
57057               active[k2] = false;
57058             });
57059           } else {
57060             wasActive.forEach(function(k2) {
57061               active[k2] = true;
57062             });
57063           }
57064         }
57065         redraw();
57066       };
57067       var infoPanels = selection2.selectAll(".info-panels").data([0]);
57068       infoPanels = infoPanels.enter().append("div").attr("class", "info-panels").merge(infoPanels);
57069       redraw();
57070       context.keybinding().on(uiCmd("\u2318" + _t("info_panels.key")), function(d3_event) {
57071         d3_event.stopImmediatePropagation();
57072         d3_event.preventDefault();
57073         info.toggle();
57074       });
57075       ids.forEach(function(k2) {
57076         var key = _t("info_panels." + k2 + ".key", { default: null });
57077         if (!key)
57078           return;
57079         context.keybinding().on(uiCmd("\u2318\u21E7" + key), function(d3_event) {
57080           d3_event.stopImmediatePropagation();
57081           d3_event.preventDefault();
57082           info.toggle(k2);
57083         });
57084       });
57085     }
57086     return info;
57087   }
57088
57089   // modules/ui/intro/helper.js
57090   function pointBox(loc, context) {
57091     var rect = context.surfaceRect();
57092     var point2 = context.curtainProjection(loc);
57093     return {
57094       left: point2[0] + rect.left - 40,
57095       top: point2[1] + rect.top - 60,
57096       width: 80,
57097       height: 90
57098     };
57099   }
57100   function pad(locOrBox, padding, context) {
57101     var box;
57102     if (locOrBox instanceof Array) {
57103       var rect = context.surfaceRect();
57104       var point2 = context.curtainProjection(locOrBox);
57105       box = {
57106         left: point2[0] + rect.left,
57107         top: point2[1] + rect.top
57108       };
57109     } else {
57110       box = locOrBox;
57111     }
57112     return {
57113       left: box.left - padding,
57114       top: box.top - padding,
57115       width: (box.width || 0) + 2 * padding,
57116       height: (box.width || 0) + 2 * padding
57117     };
57118   }
57119   function icon(name, svgklass, useklass) {
57120     return '<svg class="icon ' + (svgklass || "") + '"><use xlink:href="' + name + '"' + (useklass ? ' class="' + useklass + '"' : "") + "></use></svg>";
57121   }
57122   var helpStringReplacements;
57123   function helpHtml(id2, replacements) {
57124     if (!helpStringReplacements) {
57125       helpStringReplacements = {
57126         // insert icons corresponding to various UI elements
57127         point_icon: icon("#iD-icon-point", "inline"),
57128         line_icon: icon("#iD-icon-line", "inline"),
57129         area_icon: icon("#iD-icon-area", "inline"),
57130         note_icon: icon("#iD-icon-note", "inline add-note"),
57131         plus: icon("#iD-icon-plus", "inline"),
57132         minus: icon("#iD-icon-minus", "inline"),
57133         layers_icon: icon("#iD-icon-layers", "inline"),
57134         data_icon: icon("#iD-icon-data", "inline"),
57135         inspect: icon("#iD-icon-inspect", "inline"),
57136         help_icon: icon("#iD-icon-help", "inline"),
57137         undo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo", "inline"),
57138         redo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-undo" : "#iD-icon-redo", "inline"),
57139         save_icon: icon("#iD-icon-save", "inline"),
57140         // operation icons
57141         circularize_icon: icon("#iD-operation-circularize", "inline operation"),
57142         continue_icon: icon("#iD-operation-continue", "inline operation"),
57143         copy_icon: icon("#iD-operation-copy", "inline operation"),
57144         delete_icon: icon("#iD-operation-delete", "inline operation"),
57145         disconnect_icon: icon("#iD-operation-disconnect", "inline operation"),
57146         downgrade_icon: icon("#iD-operation-downgrade", "inline operation"),
57147         extract_icon: icon("#iD-operation-extract", "inline operation"),
57148         merge_icon: icon("#iD-operation-merge", "inline operation"),
57149         move_icon: icon("#iD-operation-move", "inline operation"),
57150         orthogonalize_icon: icon("#iD-operation-orthogonalize", "inline operation"),
57151         paste_icon: icon("#iD-operation-paste", "inline operation"),
57152         reflect_long_icon: icon("#iD-operation-reflect-long", "inline operation"),
57153         reflect_short_icon: icon("#iD-operation-reflect-short", "inline operation"),
57154         reverse_icon: icon("#iD-operation-reverse", "inline operation"),
57155         rotate_icon: icon("#iD-operation-rotate", "inline operation"),
57156         split_icon: icon("#iD-operation-split", "inline operation"),
57157         straighten_icon: icon("#iD-operation-straighten", "inline operation"),
57158         // interaction icons
57159         leftclick: icon("#iD-walkthrough-mouse-left", "inline operation"),
57160         rightclick: icon("#iD-walkthrough-mouse-right", "inline operation"),
57161         mousewheel_icon: icon("#iD-walkthrough-mousewheel", "inline operation"),
57162         tap_icon: icon("#iD-walkthrough-tap", "inline operation"),
57163         doubletap_icon: icon("#iD-walkthrough-doubletap", "inline operation"),
57164         longpress_icon: icon("#iD-walkthrough-longpress", "inline operation"),
57165         touchdrag_icon: icon("#iD-walkthrough-touchdrag", "inline operation"),
57166         pinch_icon: icon("#iD-walkthrough-pinch-apart", "inline operation"),
57167         // insert keys; may be localized and platform-dependent
57168         shift: uiCmd.display("\u21E7"),
57169         alt: uiCmd.display("\u2325"),
57170         return: uiCmd.display("\u21B5"),
57171         esc: _t.html("shortcuts.key.esc"),
57172         space: _t.html("shortcuts.key.space"),
57173         add_note_key: _t.html("modes.add_note.key"),
57174         help_key: _t.html("help.key"),
57175         shortcuts_key: _t.html("shortcuts.toggle.key"),
57176         // reference localized UI labels directly so that they'll always match
57177         save: _t.html("save.title"),
57178         undo: _t.html("undo.title"),
57179         redo: _t.html("redo.title"),
57180         upload: _t.html("commit.save"),
57181         point: _t.html("modes.add_point.title"),
57182         line: _t.html("modes.add_line.title"),
57183         area: _t.html("modes.add_area.title"),
57184         note: _t.html("modes.add_note.label"),
57185         circularize: _t.html("operations.circularize.title"),
57186         continue: _t.html("operations.continue.title"),
57187         copy: _t.html("operations.copy.title"),
57188         delete: _t.html("operations.delete.title"),
57189         disconnect: _t.html("operations.disconnect.title"),
57190         downgrade: _t.html("operations.downgrade.title"),
57191         extract: _t.html("operations.extract.title"),
57192         merge: _t.html("operations.merge.title"),
57193         move: _t.html("operations.move.title"),
57194         orthogonalize: _t.html("operations.orthogonalize.title"),
57195         paste: _t.html("operations.paste.title"),
57196         reflect_long: _t.html("operations.reflect.title.long"),
57197         reflect_short: _t.html("operations.reflect.title.short"),
57198         reverse: _t.html("operations.reverse.title"),
57199         rotate: _t.html("operations.rotate.title"),
57200         split: _t.html("operations.split.title"),
57201         straighten: _t.html("operations.straighten.title"),
57202         map_data: _t.html("map_data.title"),
57203         osm_notes: _t.html("map_data.layers.notes.title"),
57204         fields: _t.html("inspector.fields"),
57205         tags: _t.html("inspector.tags"),
57206         relations: _t.html("inspector.relations"),
57207         new_relation: _t.html("inspector.new_relation"),
57208         turn_restrictions: _t.html("_tagging.presets.fields.restrictions.label"),
57209         background_settings: _t.html("background.description"),
57210         imagery_offset: _t.html("background.fix_misalignment"),
57211         start_the_walkthrough: _t.html("splash.walkthrough"),
57212         help: _t.html("help.title"),
57213         ok: _t.html("intro.ok")
57214       };
57215       for (var key in helpStringReplacements) {
57216         helpStringReplacements[key] = { html: helpStringReplacements[key] };
57217       }
57218     }
57219     var reps;
57220     if (replacements) {
57221       reps = Object.assign(replacements, helpStringReplacements);
57222     } else {
57223       reps = helpStringReplacements;
57224     }
57225     return _t.html(id2, reps).replace(/\`(.*?)\`/g, "<kbd>$1</kbd>");
57226   }
57227   function slugify(text2) {
57228     return text2.toString().toLowerCase().replace(/\s+/g, "-").replace(/[^\w\-]+/g, "").replace(/\-\-+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
57229   }
57230   var missingStrings = {};
57231   function checkKey(key, text2) {
57232     if (_t(key, { default: void 0 }) === void 0) {
57233       if (missingStrings.hasOwnProperty(key))
57234         return;
57235       missingStrings[key] = text2;
57236       var missing = key + ": " + text2;
57237       if (typeof console !== "undefined")
57238         console.log(missing);
57239     }
57240   }
57241   function localize(obj) {
57242     var key;
57243     var name = obj.tags && obj.tags.name;
57244     if (name) {
57245       key = "intro.graph.name." + slugify(name);
57246       obj.tags.name = _t(key, { default: name });
57247       checkKey(key, name);
57248     }
57249     var street = obj.tags && obj.tags["addr:street"];
57250     if (street) {
57251       key = "intro.graph.name." + slugify(street);
57252       obj.tags["addr:street"] = _t(key, { default: street });
57253       checkKey(key, street);
57254       var addrTags = [
57255         "block_number",
57256         "city",
57257         "county",
57258         "district",
57259         "hamlet",
57260         "neighbourhood",
57261         "postcode",
57262         "province",
57263         "quarter",
57264         "state",
57265         "subdistrict",
57266         "suburb"
57267       ];
57268       addrTags.forEach(function(k2) {
57269         var key2 = "intro.graph." + k2;
57270         var tag = "addr:" + k2;
57271         var val = obj.tags && obj.tags[tag];
57272         var str2 = _t(key2, { default: val });
57273         if (str2) {
57274           if (str2.match(/^<.*>$/) !== null) {
57275             delete obj.tags[tag];
57276           } else {
57277             obj.tags[tag] = str2;
57278           }
57279         }
57280       });
57281     }
57282     return obj;
57283   }
57284   function isMostlySquare(points) {
57285     var threshold = 15;
57286     var lowerBound = Math.cos((90 - threshold) * Math.PI / 180);
57287     var upperBound = Math.cos(threshold * Math.PI / 180);
57288     for (var i3 = 0; i3 < points.length; i3++) {
57289       var a2 = points[(i3 - 1 + points.length) % points.length];
57290       var origin = points[i3];
57291       var b2 = points[(i3 + 1) % points.length];
57292       var dotp = geoVecNormalizedDot(a2, b2, origin);
57293       var mag = Math.abs(dotp);
57294       if (mag > lowerBound && mag < upperBound) {
57295         return false;
57296       }
57297     }
57298     return true;
57299   }
57300   function selectMenuItem(context, operation) {
57301     return context.container().select(".edit-menu .edit-menu-item-" + operation);
57302   }
57303   function transitionTime(point1, point2) {
57304     var distance = geoSphericalDistance(point1, point2);
57305     if (distance === 0) {
57306       return 0;
57307     } else if (distance < 80) {
57308       return 500;
57309     } else {
57310       return 1e3;
57311     }
57312   }
57313
57314   // modules/ui/toggle.js
57315   function uiToggle(show, callback) {
57316     return function(selection2) {
57317       selection2.style("opacity", show ? 0 : 1).classed("hide", false).transition().style("opacity", show ? 1 : 0).on("end", function() {
57318         select_default2(this).classed("hide", !show).style("opacity", null);
57319         if (callback)
57320           callback.apply(this);
57321       });
57322     };
57323   }
57324
57325   // modules/ui/curtain.js
57326   function uiCurtain(containerNode) {
57327     var surface = select_default2(null), tooltip = select_default2(null), darkness = select_default2(null);
57328     function curtain(selection2) {
57329       surface = selection2.append("svg").attr("class", "curtain").style("top", 0).style("left", 0);
57330       darkness = surface.append("path").attr("x", 0).attr("y", 0).attr("class", "curtain-darkness");
57331       select_default2(window).on("resize.curtain", resize);
57332       tooltip = selection2.append("div").attr("class", "tooltip");
57333       tooltip.append("div").attr("class", "popover-arrow");
57334       tooltip.append("div").attr("class", "popover-inner");
57335       resize();
57336       function resize() {
57337         surface.attr("width", containerNode.clientWidth).attr("height", containerNode.clientHeight);
57338         curtain.cut(darkness.datum());
57339       }
57340     }
57341     curtain.reveal = function(box, html2, options2) {
57342       options2 = options2 || {};
57343       if (typeof box === "string") {
57344         box = select_default2(box).node();
57345       }
57346       if (box && box.getBoundingClientRect) {
57347         box = copyBox(box.getBoundingClientRect());
57348         var containerRect = containerNode.getBoundingClientRect();
57349         box.top -= containerRect.top;
57350         box.left -= containerRect.left;
57351       }
57352       if (box && options2.padding) {
57353         box.top -= options2.padding;
57354         box.left -= options2.padding;
57355         box.bottom += options2.padding;
57356         box.right += options2.padding;
57357         box.height += options2.padding * 2;
57358         box.width += options2.padding * 2;
57359       }
57360       var tooltipBox;
57361       if (options2.tooltipBox) {
57362         tooltipBox = options2.tooltipBox;
57363         if (typeof tooltipBox === "string") {
57364           tooltipBox = select_default2(tooltipBox).node();
57365         }
57366         if (tooltipBox && tooltipBox.getBoundingClientRect) {
57367           tooltipBox = copyBox(tooltipBox.getBoundingClientRect());
57368         }
57369       } else {
57370         tooltipBox = box;
57371       }
57372       if (tooltipBox && html2) {
57373         if (html2.indexOf("**") !== -1) {
57374           if (html2.indexOf("<span") === 0) {
57375             html2 = html2.replace(/^(<span.*?>)(.+?)(\*\*)/, "$1<span>$2</span>$3");
57376           } else {
57377             html2 = html2.replace(/^(.+?)(\*\*)/, "<span>$1</span>$2");
57378           }
57379           html2 = html2.replace(/\*\*(.*?)\*\*/g, '<span class="instruction">$1</span>');
57380         }
57381         html2 = html2.replace(/\*(.*?)\*/g, "<em>$1</em>");
57382         html2 = html2.replace(/\{br\}/g, "<br/><br/>");
57383         if (options2.buttonText && options2.buttonCallback) {
57384           html2 += '<div class="button-section"><button href="#" class="button action">' + options2.buttonText + "</button></div>";
57385         }
57386         var classes = "curtain-tooltip popover tooltip arrowed in " + (options2.tooltipClass || "");
57387         tooltip.classed(classes, true).selectAll(".popover-inner").html(html2);
57388         if (options2.buttonText && options2.buttonCallback) {
57389           var button = tooltip.selectAll(".button-section .button.action");
57390           button.on("click", function(d3_event) {
57391             d3_event.preventDefault();
57392             options2.buttonCallback();
57393           });
57394         }
57395         var tip = copyBox(tooltip.node().getBoundingClientRect()), w2 = containerNode.clientWidth, h2 = containerNode.clientHeight, tooltipWidth = 200, tooltipArrow = 5, side, pos;
57396         if (options2.tooltipClass === "intro-mouse") {
57397           tip.height += 80;
57398         }
57399         if (tooltipBox.top + tooltipBox.height > h2) {
57400           tooltipBox.height -= tooltipBox.top + tooltipBox.height - h2;
57401         }
57402         if (tooltipBox.left + tooltipBox.width > w2) {
57403           tooltipBox.width -= tooltipBox.left + tooltipBox.width - w2;
57404         }
57405         if (tooltipBox.top + tooltipBox.height < 100) {
57406           side = "bottom";
57407           pos = [
57408             tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
57409             tooltipBox.top + tooltipBox.height
57410           ];
57411         } else if (tooltipBox.top > h2 - 140) {
57412           side = "top";
57413           pos = [
57414             tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
57415             tooltipBox.top - tip.height
57416           ];
57417         } else {
57418           var tipY = tooltipBox.top + tooltipBox.height / 2 - tip.height / 2;
57419           if (_mainLocalizer.textDirection() === "rtl") {
57420             if (tooltipBox.left - tooltipWidth - tooltipArrow < 70) {
57421               side = "right";
57422               pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
57423             } else {
57424               side = "left";
57425               pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
57426             }
57427           } else {
57428             if (tooltipBox.left + tooltipBox.width + tooltipArrow + tooltipWidth > w2 - 70) {
57429               side = "left";
57430               pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
57431             } else {
57432               side = "right";
57433               pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
57434             }
57435           }
57436         }
57437         if (options2.duration !== 0 || !tooltip.classed(side)) {
57438           tooltip.call(uiToggle(true));
57439         }
57440         tooltip.style("top", pos[1] + "px").style("left", pos[0] + "px").attr("class", classes + " " + side);
57441         var shiftY = 0;
57442         if (side === "left" || side === "right") {
57443           if (pos[1] < 60) {
57444             shiftY = 60 - pos[1];
57445           } else if (pos[1] + tip.height > h2 - 100) {
57446             shiftY = h2 - pos[1] - tip.height - 100;
57447           }
57448         }
57449         tooltip.selectAll(".popover-inner").style("top", shiftY + "px");
57450       } else {
57451         tooltip.classed("in", false).call(uiToggle(false));
57452       }
57453       curtain.cut(box, options2.duration);
57454       return tooltip;
57455     };
57456     curtain.cut = function(datum2, duration) {
57457       darkness.datum(datum2).interrupt();
57458       var selection2;
57459       if (duration === 0) {
57460         selection2 = darkness;
57461       } else {
57462         selection2 = darkness.transition().duration(duration || 600).ease(linear2);
57463       }
57464       selection2.attr("d", function(d2) {
57465         var containerWidth = containerNode.clientWidth;
57466         var containerHeight = containerNode.clientHeight;
57467         var string = "M 0,0 L 0," + containerHeight + " L " + containerWidth + "," + containerHeight + "L" + containerWidth + ",0 Z";
57468         if (!d2)
57469           return string;
57470         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";
57471       });
57472     };
57473     curtain.remove = function() {
57474       surface.remove();
57475       tooltip.remove();
57476       select_default2(window).on("resize.curtain", null);
57477     };
57478     function copyBox(src) {
57479       return {
57480         top: src.top,
57481         right: src.right,
57482         bottom: src.bottom,
57483         left: src.left,
57484         width: src.width,
57485         height: src.height
57486       };
57487     }
57488     return curtain;
57489   }
57490
57491   // modules/ui/intro/welcome.js
57492   function uiIntroWelcome(context, reveal) {
57493     var dispatch14 = dispatch_default("done");
57494     var chapter = {
57495       title: "intro.welcome.title"
57496     };
57497     function welcome() {
57498       context.map().centerZoom([-85.63591, 41.94285], 19);
57499       reveal(
57500         ".intro-nav-wrap .chapter-welcome",
57501         helpHtml("intro.welcome.welcome"),
57502         { buttonText: _t.html("intro.ok"), buttonCallback: practice }
57503       );
57504     }
57505     function practice() {
57506       reveal(
57507         ".intro-nav-wrap .chapter-welcome",
57508         helpHtml("intro.welcome.practice"),
57509         { buttonText: _t.html("intro.ok"), buttonCallback: words }
57510       );
57511     }
57512     function words() {
57513       reveal(
57514         ".intro-nav-wrap .chapter-welcome",
57515         helpHtml("intro.welcome.words"),
57516         { buttonText: _t.html("intro.ok"), buttonCallback: chapters }
57517       );
57518     }
57519     function chapters() {
57520       dispatch14.call("done");
57521       reveal(
57522         ".intro-nav-wrap .chapter-navigation",
57523         helpHtml("intro.welcome.chapters", { next: _t("intro.navigation.title") })
57524       );
57525     }
57526     chapter.enter = function() {
57527       welcome();
57528     };
57529     chapter.exit = function() {
57530       context.container().select(".curtain-tooltip.intro-mouse").selectAll(".counter").remove();
57531     };
57532     chapter.restart = function() {
57533       chapter.exit();
57534       chapter.enter();
57535     };
57536     return utilRebind(chapter, dispatch14, "on");
57537   }
57538
57539   // modules/ui/intro/navigation.js
57540   function uiIntroNavigation(context, reveal) {
57541     var dispatch14 = dispatch_default("done");
57542     var timeouts = [];
57543     var hallId = "n2061";
57544     var townHall = [-85.63591, 41.94285];
57545     var springStreetId = "w397";
57546     var springStreetEndId = "n1834";
57547     var springStreet = [-85.63582, 41.94255];
57548     var onewayField = _mainPresetIndex.field("oneway");
57549     var maxspeedField = _mainPresetIndex.field("maxspeed");
57550     var chapter = {
57551       title: "intro.navigation.title"
57552     };
57553     function timeout2(f3, t2) {
57554       timeouts.push(window.setTimeout(f3, t2));
57555     }
57556     function eventCancel(d3_event) {
57557       d3_event.stopPropagation();
57558       d3_event.preventDefault();
57559     }
57560     function isTownHallSelected() {
57561       var ids = context.selectedIDs();
57562       return ids.length === 1 && ids[0] === hallId;
57563     }
57564     function dragMap() {
57565       context.enter(modeBrowse(context));
57566       context.history().reset("initial");
57567       var msec = transitionTime(townHall, context.map().center());
57568       if (msec) {
57569         reveal(null, null, { duration: 0 });
57570       }
57571       context.map().centerZoomEase(townHall, 19, msec);
57572       timeout2(function() {
57573         var centerStart = context.map().center();
57574         var textId = context.lastPointerType() === "mouse" ? "drag" : "drag_touch";
57575         var dragString = helpHtml("intro.navigation.map_info") + "{br}" + helpHtml("intro.navigation." + textId);
57576         reveal(".surface", dragString);
57577         context.map().on("drawn.intro", function() {
57578           reveal(".surface", dragString, { duration: 0 });
57579         });
57580         context.map().on("move.intro", function() {
57581           var centerNow = context.map().center();
57582           if (centerStart[0] !== centerNow[0] || centerStart[1] !== centerNow[1]) {
57583             context.map().on("move.intro", null);
57584             timeout2(function() {
57585               continueTo(zoomMap);
57586             }, 3e3);
57587           }
57588         });
57589       }, msec + 100);
57590       function continueTo(nextStep) {
57591         context.map().on("move.intro drawn.intro", null);
57592         nextStep();
57593       }
57594     }
57595     function zoomMap() {
57596       var zoomStart = context.map().zoom();
57597       var textId = context.lastPointerType() === "mouse" ? "zoom" : "zoom_touch";
57598       var zoomString = helpHtml("intro.navigation." + textId);
57599       reveal(".surface", zoomString);
57600       context.map().on("drawn.intro", function() {
57601         reveal(".surface", zoomString, { duration: 0 });
57602       });
57603       context.map().on("move.intro", function() {
57604         if (context.map().zoom() !== zoomStart) {
57605           context.map().on("move.intro", null);
57606           timeout2(function() {
57607             continueTo(features);
57608           }, 3e3);
57609         }
57610       });
57611       function continueTo(nextStep) {
57612         context.map().on("move.intro drawn.intro", null);
57613         nextStep();
57614       }
57615     }
57616     function features() {
57617       var onClick = function() {
57618         continueTo(pointsLinesAreas);
57619       };
57620       reveal(
57621         ".surface",
57622         helpHtml("intro.navigation.features"),
57623         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57624       );
57625       context.map().on("drawn.intro", function() {
57626         reveal(
57627           ".surface",
57628           helpHtml("intro.navigation.features"),
57629           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57630         );
57631       });
57632       function continueTo(nextStep) {
57633         context.map().on("drawn.intro", null);
57634         nextStep();
57635       }
57636     }
57637     function pointsLinesAreas() {
57638       var onClick = function() {
57639         continueTo(nodesWays);
57640       };
57641       reveal(
57642         ".surface",
57643         helpHtml("intro.navigation.points_lines_areas"),
57644         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57645       );
57646       context.map().on("drawn.intro", function() {
57647         reveal(
57648           ".surface",
57649           helpHtml("intro.navigation.points_lines_areas"),
57650           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57651         );
57652       });
57653       function continueTo(nextStep) {
57654         context.map().on("drawn.intro", null);
57655         nextStep();
57656       }
57657     }
57658     function nodesWays() {
57659       var onClick = function() {
57660         continueTo(clickTownHall);
57661       };
57662       reveal(
57663         ".surface",
57664         helpHtml("intro.navigation.nodes_ways"),
57665         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57666       );
57667       context.map().on("drawn.intro", function() {
57668         reveal(
57669           ".surface",
57670           helpHtml("intro.navigation.nodes_ways"),
57671           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57672         );
57673       });
57674       function continueTo(nextStep) {
57675         context.map().on("drawn.intro", null);
57676         nextStep();
57677       }
57678     }
57679     function clickTownHall() {
57680       context.enter(modeBrowse(context));
57681       context.history().reset("initial");
57682       var entity = context.hasEntity(hallId);
57683       if (!entity)
57684         return;
57685       reveal(null, null, { duration: 0 });
57686       context.map().centerZoomEase(entity.loc, 19, 500);
57687       timeout2(function() {
57688         var entity2 = context.hasEntity(hallId);
57689         if (!entity2)
57690           return;
57691         var box = pointBox(entity2.loc, context);
57692         var textId = context.lastPointerType() === "mouse" ? "click_townhall" : "tap_townhall";
57693         reveal(box, helpHtml("intro.navigation." + textId));
57694         context.map().on("move.intro drawn.intro", function() {
57695           var entity3 = context.hasEntity(hallId);
57696           if (!entity3)
57697             return;
57698           var box2 = pointBox(entity3.loc, context);
57699           reveal(box2, helpHtml("intro.navigation." + textId), { duration: 0 });
57700         });
57701         context.on("enter.intro", function() {
57702           if (isTownHallSelected())
57703             continueTo(selectedTownHall);
57704         });
57705       }, 550);
57706       context.history().on("change.intro", function() {
57707         if (!context.hasEntity(hallId)) {
57708           continueTo(clickTownHall);
57709         }
57710       });
57711       function continueTo(nextStep) {
57712         context.on("enter.intro", null);
57713         context.map().on("move.intro drawn.intro", null);
57714         context.history().on("change.intro", null);
57715         nextStep();
57716       }
57717     }
57718     function selectedTownHall() {
57719       if (!isTownHallSelected())
57720         return clickTownHall();
57721       var entity = context.hasEntity(hallId);
57722       if (!entity)
57723         return clickTownHall();
57724       var box = pointBox(entity.loc, context);
57725       var onClick = function() {
57726         continueTo(editorTownHall);
57727       };
57728       reveal(
57729         box,
57730         helpHtml("intro.navigation.selected_townhall"),
57731         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57732       );
57733       context.map().on("move.intro drawn.intro", function() {
57734         var entity2 = context.hasEntity(hallId);
57735         if (!entity2)
57736           return;
57737         var box2 = pointBox(entity2.loc, context);
57738         reveal(
57739           box2,
57740           helpHtml("intro.navigation.selected_townhall"),
57741           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57742         );
57743       });
57744       context.history().on("change.intro", function() {
57745         if (!context.hasEntity(hallId)) {
57746           continueTo(clickTownHall);
57747         }
57748       });
57749       function continueTo(nextStep) {
57750         context.map().on("move.intro drawn.intro", null);
57751         context.history().on("change.intro", null);
57752         nextStep();
57753       }
57754     }
57755     function editorTownHall() {
57756       if (!isTownHallSelected())
57757         return clickTownHall();
57758       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
57759       var onClick = function() {
57760         continueTo(presetTownHall);
57761       };
57762       reveal(
57763         ".entity-editor-pane",
57764         helpHtml("intro.navigation.editor_townhall"),
57765         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57766       );
57767       context.on("exit.intro", function() {
57768         continueTo(clickTownHall);
57769       });
57770       context.history().on("change.intro", function() {
57771         if (!context.hasEntity(hallId)) {
57772           continueTo(clickTownHall);
57773         }
57774       });
57775       function continueTo(nextStep) {
57776         context.on("exit.intro", null);
57777         context.history().on("change.intro", null);
57778         context.container().select(".inspector-wrap").on("wheel.intro", null);
57779         nextStep();
57780       }
57781     }
57782     function presetTownHall() {
57783       if (!isTownHallSelected())
57784         return clickTownHall();
57785       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
57786       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
57787       var entity = context.entity(context.selectedIDs()[0]);
57788       var preset = _mainPresetIndex.match(entity, context.graph());
57789       var onClick = function() {
57790         continueTo(fieldsTownHall);
57791       };
57792       reveal(
57793         ".entity-editor-pane .section-feature-type",
57794         helpHtml("intro.navigation.preset_townhall", { preset: preset.name() }),
57795         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57796       );
57797       context.on("exit.intro", function() {
57798         continueTo(clickTownHall);
57799       });
57800       context.history().on("change.intro", function() {
57801         if (!context.hasEntity(hallId)) {
57802           continueTo(clickTownHall);
57803         }
57804       });
57805       function continueTo(nextStep) {
57806         context.on("exit.intro", null);
57807         context.history().on("change.intro", null);
57808         context.container().select(".inspector-wrap").on("wheel.intro", null);
57809         nextStep();
57810       }
57811     }
57812     function fieldsTownHall() {
57813       if (!isTownHallSelected())
57814         return clickTownHall();
57815       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
57816       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
57817       var onClick = function() {
57818         continueTo(closeTownHall);
57819       };
57820       reveal(
57821         ".entity-editor-pane .section-preset-fields",
57822         helpHtml("intro.navigation.fields_townhall"),
57823         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57824       );
57825       context.on("exit.intro", function() {
57826         continueTo(clickTownHall);
57827       });
57828       context.history().on("change.intro", function() {
57829         if (!context.hasEntity(hallId)) {
57830           continueTo(clickTownHall);
57831         }
57832       });
57833       function continueTo(nextStep) {
57834         context.on("exit.intro", null);
57835         context.history().on("change.intro", null);
57836         context.container().select(".inspector-wrap").on("wheel.intro", null);
57837         nextStep();
57838       }
57839     }
57840     function closeTownHall() {
57841       if (!isTownHallSelected())
57842         return clickTownHall();
57843       var selector = ".entity-editor-pane button.close svg use";
57844       var href = select_default2(selector).attr("href") || "#iD-icon-close";
57845       reveal(
57846         ".entity-editor-pane",
57847         helpHtml("intro.navigation.close_townhall", { button: { html: icon(href, "inline") } })
57848       );
57849       context.on("exit.intro", function() {
57850         continueTo(searchStreet);
57851       });
57852       context.history().on("change.intro", function() {
57853         var selector2 = ".entity-editor-pane button.close svg use";
57854         var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
57855         reveal(
57856           ".entity-editor-pane",
57857           helpHtml("intro.navigation.close_townhall", { button: { html: icon(href2, "inline") } }),
57858           { duration: 0 }
57859         );
57860       });
57861       function continueTo(nextStep) {
57862         context.on("exit.intro", null);
57863         context.history().on("change.intro", null);
57864         nextStep();
57865       }
57866     }
57867     function searchStreet() {
57868       context.enter(modeBrowse(context));
57869       context.history().reset("initial");
57870       var msec = transitionTime(springStreet, context.map().center());
57871       if (msec) {
57872         reveal(null, null, { duration: 0 });
57873       }
57874       context.map().centerZoomEase(springStreet, 19, msec);
57875       timeout2(function() {
57876         reveal(
57877           ".search-header input",
57878           helpHtml("intro.navigation.search_street", { name: _t("intro.graph.name.spring-street") })
57879         );
57880         context.container().select(".search-header input").on("keyup.intro", checkSearchResult);
57881       }, msec + 100);
57882     }
57883     function checkSearchResult() {
57884       var first = context.container().select(".feature-list-item:nth-child(0n+2)");
57885       var firstName = first.select(".entity-name");
57886       var name = _t("intro.graph.name.spring-street");
57887       if (!firstName.empty() && firstName.html() === name) {
57888         reveal(
57889           first.node(),
57890           helpHtml("intro.navigation.choose_street", { name }),
57891           { duration: 300 }
57892         );
57893         context.on("exit.intro", function() {
57894           continueTo(selectedStreet);
57895         });
57896         context.container().select(".search-header input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
57897       }
57898       function continueTo(nextStep) {
57899         context.on("exit.intro", null);
57900         context.container().select(".search-header input").on("keydown.intro", null).on("keyup.intro", null);
57901         nextStep();
57902       }
57903     }
57904     function selectedStreet() {
57905       if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
57906         return searchStreet();
57907       }
57908       var onClick = function() {
57909         continueTo(editorStreet);
57910       };
57911       var entity = context.entity(springStreetEndId);
57912       var box = pointBox(entity.loc, context);
57913       box.height = 500;
57914       reveal(
57915         box,
57916         helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }),
57917         { duration: 600, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57918       );
57919       timeout2(function() {
57920         context.map().on("move.intro drawn.intro", function() {
57921           var entity2 = context.hasEntity(springStreetEndId);
57922           if (!entity2)
57923             return;
57924           var box2 = pointBox(entity2.loc, context);
57925           box2.height = 500;
57926           reveal(
57927             box2,
57928             helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }),
57929             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57930           );
57931         });
57932       }, 600);
57933       context.on("enter.intro", function(mode) {
57934         if (!context.hasEntity(springStreetId)) {
57935           return continueTo(searchStreet);
57936         }
57937         var ids = context.selectedIDs();
57938         if (mode.id !== "select" || !ids.length || ids[0] !== springStreetId) {
57939           context.enter(modeSelect(context, [springStreetId]));
57940         }
57941       });
57942       context.history().on("change.intro", function() {
57943         if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
57944           timeout2(function() {
57945             continueTo(searchStreet);
57946           }, 300);
57947         }
57948       });
57949       function continueTo(nextStep) {
57950         context.map().on("move.intro drawn.intro", null);
57951         context.on("enter.intro", null);
57952         context.history().on("change.intro", null);
57953         nextStep();
57954       }
57955     }
57956     function editorStreet() {
57957       var selector = ".entity-editor-pane button.close svg use";
57958       var href = select_default2(selector).attr("href") || "#iD-icon-close";
57959       reveal(".entity-editor-pane", helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
57960         button: { html: icon(href, "inline") },
57961         field1: onewayField.title(),
57962         field2: maxspeedField.title()
57963       }));
57964       context.on("exit.intro", function() {
57965         continueTo(play);
57966       });
57967       context.history().on("change.intro", function() {
57968         var selector2 = ".entity-editor-pane button.close svg use";
57969         var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
57970         reveal(
57971           ".entity-editor-pane",
57972           helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
57973             button: { html: icon(href2, "inline") },
57974             field1: onewayField.title(),
57975             field2: maxspeedField.title()
57976           }),
57977           { duration: 0 }
57978         );
57979       });
57980       function continueTo(nextStep) {
57981         context.on("exit.intro", null);
57982         context.history().on("change.intro", null);
57983         nextStep();
57984       }
57985     }
57986     function play() {
57987       dispatch14.call("done");
57988       reveal(
57989         ".ideditor",
57990         helpHtml("intro.navigation.play", { next: _t("intro.points.title") }),
57991         {
57992           tooltipBox: ".intro-nav-wrap .chapter-point",
57993           buttonText: _t.html("intro.ok"),
57994           buttonCallback: function() {
57995             reveal(".ideditor");
57996           }
57997         }
57998       );
57999     }
58000     chapter.enter = function() {
58001       dragMap();
58002     };
58003     chapter.exit = function() {
58004       timeouts.forEach(window.clearTimeout);
58005       context.on("enter.intro exit.intro", null);
58006       context.map().on("move.intro drawn.intro", null);
58007       context.history().on("change.intro", null);
58008       context.container().select(".inspector-wrap").on("wheel.intro", null);
58009       context.container().select(".search-header input").on("keydown.intro keyup.intro", null);
58010     };
58011     chapter.restart = function() {
58012       chapter.exit();
58013       chapter.enter();
58014     };
58015     return utilRebind(chapter, dispatch14, "on");
58016   }
58017
58018   // modules/ui/intro/point.js
58019   function uiIntroPoint(context, reveal) {
58020     var dispatch14 = dispatch_default("done");
58021     var timeouts = [];
58022     var intersection = [-85.63279, 41.94394];
58023     var building = [-85.632422, 41.944045];
58024     var cafePreset = _mainPresetIndex.item("amenity/cafe");
58025     var _pointID = null;
58026     var chapter = {
58027       title: "intro.points.title"
58028     };
58029     function timeout2(f3, t2) {
58030       timeouts.push(window.setTimeout(f3, t2));
58031     }
58032     function eventCancel(d3_event) {
58033       d3_event.stopPropagation();
58034       d3_event.preventDefault();
58035     }
58036     function addPoint() {
58037       context.enter(modeBrowse(context));
58038       context.history().reset("initial");
58039       var msec = transitionTime(intersection, context.map().center());
58040       if (msec) {
58041         reveal(null, null, { duration: 0 });
58042       }
58043       context.map().centerZoomEase(intersection, 19, msec);
58044       timeout2(function() {
58045         var tooltip = reveal(
58046           "button.add-point",
58047           helpHtml("intro.points.points_info") + "{br}" + helpHtml("intro.points.add_point")
58048         );
58049         _pointID = null;
58050         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-points");
58051         context.on("enter.intro", function(mode) {
58052           if (mode.id !== "add-point")
58053             return;
58054           continueTo(placePoint);
58055         });
58056       }, msec + 100);
58057       function continueTo(nextStep) {
58058         context.on("enter.intro", null);
58059         nextStep();
58060       }
58061     }
58062     function placePoint() {
58063       if (context.mode().id !== "add-point") {
58064         return chapter.restart();
58065       }
58066       var pointBox2 = pad(building, 150, context);
58067       var textId = context.lastPointerType() === "mouse" ? "place_point" : "place_point_touch";
58068       reveal(pointBox2, helpHtml("intro.points." + textId));
58069       context.map().on("move.intro drawn.intro", function() {
58070         pointBox2 = pad(building, 150, context);
58071         reveal(pointBox2, helpHtml("intro.points." + textId), { duration: 0 });
58072       });
58073       context.on("enter.intro", function(mode) {
58074         if (mode.id !== "select")
58075           return chapter.restart();
58076         _pointID = context.mode().selectedIDs()[0];
58077         continueTo(searchPreset);
58078       });
58079       function continueTo(nextStep) {
58080         context.map().on("move.intro drawn.intro", null);
58081         context.on("enter.intro", null);
58082         nextStep();
58083       }
58084     }
58085     function searchPreset() {
58086       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
58087         return addPoint();
58088       }
58089       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58090       context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
58091       reveal(
58092         ".preset-search-input",
58093         helpHtml("intro.points.search_cafe", { preset: cafePreset.name() })
58094       );
58095       context.on("enter.intro", function(mode) {
58096         if (!_pointID || !context.hasEntity(_pointID)) {
58097           return continueTo(addPoint);
58098         }
58099         var ids = context.selectedIDs();
58100         if (mode.id !== "select" || !ids.length || ids[0] !== _pointID) {
58101           context.enter(modeSelect(context, [_pointID]));
58102           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58103           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
58104           reveal(
58105             ".preset-search-input",
58106             helpHtml("intro.points.search_cafe", { preset: cafePreset.name() })
58107           );
58108           context.history().on("change.intro", null);
58109         }
58110       });
58111       function checkPresetSearch() {
58112         var first = context.container().select(".preset-list-item:first-child");
58113         if (first.classed("preset-amenity-cafe")) {
58114           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
58115           reveal(
58116             first.select(".preset-list-button").node(),
58117             helpHtml("intro.points.choose_cafe", { preset: cafePreset.name() }),
58118             { duration: 300 }
58119           );
58120           context.history().on("change.intro", function() {
58121             continueTo(aboutFeatureEditor);
58122           });
58123         }
58124       }
58125       function continueTo(nextStep) {
58126         context.on("enter.intro", null);
58127         context.history().on("change.intro", null);
58128         context.container().select(".inspector-wrap").on("wheel.intro", null);
58129         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
58130         nextStep();
58131       }
58132     }
58133     function aboutFeatureEditor() {
58134       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
58135         return addPoint();
58136       }
58137       timeout2(function() {
58138         reveal(".entity-editor-pane", helpHtml("intro.points.feature_editor"), {
58139           tooltipClass: "intro-points-describe",
58140           buttonText: _t.html("intro.ok"),
58141           buttonCallback: function() {
58142             continueTo(addName);
58143           }
58144         });
58145       }, 400);
58146       context.on("exit.intro", function() {
58147         continueTo(reselectPoint);
58148       });
58149       function continueTo(nextStep) {
58150         context.on("exit.intro", null);
58151         nextStep();
58152       }
58153     }
58154     function addName() {
58155       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
58156         return addPoint();
58157       }
58158       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58159       var addNameString = helpHtml("intro.points.fields_info") + "{br}" + helpHtml("intro.points.add_name");
58160       timeout2(function() {
58161         var entity = context.entity(_pointID);
58162         if (entity.tags.name) {
58163           var tooltip = reveal(".entity-editor-pane", addNameString, {
58164             tooltipClass: "intro-points-describe",
58165             buttonText: _t.html("intro.ok"),
58166             buttonCallback: function() {
58167               continueTo(addCloseEditor);
58168             }
58169           });
58170           tooltip.select(".instruction").style("display", "none");
58171         } else {
58172           reveal(
58173             ".entity-editor-pane",
58174             addNameString,
58175             { tooltipClass: "intro-points-describe" }
58176           );
58177         }
58178       }, 400);
58179       context.history().on("change.intro", function() {
58180         continueTo(addCloseEditor);
58181       });
58182       context.on("exit.intro", function() {
58183         continueTo(reselectPoint);
58184       });
58185       function continueTo(nextStep) {
58186         context.on("exit.intro", null);
58187         context.history().on("change.intro", null);
58188         nextStep();
58189       }
58190     }
58191     function addCloseEditor() {
58192       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58193       var selector = ".entity-editor-pane button.close svg use";
58194       var href = select_default2(selector).attr("href") || "#iD-icon-close";
58195       context.on("exit.intro", function() {
58196         continueTo(reselectPoint);
58197       });
58198       reveal(
58199         ".entity-editor-pane",
58200         helpHtml("intro.points.add_close", { button: { html: icon(href, "inline") } })
58201       );
58202       function continueTo(nextStep) {
58203         context.on("exit.intro", null);
58204         nextStep();
58205       }
58206     }
58207     function reselectPoint() {
58208       if (!_pointID)
58209         return chapter.restart();
58210       var entity = context.hasEntity(_pointID);
58211       if (!entity)
58212         return chapter.restart();
58213       var oldPreset = _mainPresetIndex.match(entity, context.graph());
58214       context.replace(actionChangePreset(_pointID, oldPreset, cafePreset));
58215       context.enter(modeBrowse(context));
58216       var msec = transitionTime(entity.loc, context.map().center());
58217       if (msec) {
58218         reveal(null, null, { duration: 0 });
58219       }
58220       context.map().centerEase(entity.loc, msec);
58221       timeout2(function() {
58222         var box = pointBox(entity.loc, context);
58223         reveal(box, helpHtml("intro.points.reselect"), { duration: 600 });
58224         timeout2(function() {
58225           context.map().on("move.intro drawn.intro", function() {
58226             var entity2 = context.hasEntity(_pointID);
58227             if (!entity2)
58228               return chapter.restart();
58229             var box2 = pointBox(entity2.loc, context);
58230             reveal(box2, helpHtml("intro.points.reselect"), { duration: 0 });
58231           });
58232         }, 600);
58233         context.on("enter.intro", function(mode) {
58234           if (mode.id !== "select")
58235             return;
58236           continueTo(updatePoint);
58237         });
58238       }, msec + 100);
58239       function continueTo(nextStep) {
58240         context.map().on("move.intro drawn.intro", null);
58241         context.on("enter.intro", null);
58242         nextStep();
58243       }
58244     }
58245     function updatePoint() {
58246       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
58247         return continueTo(reselectPoint);
58248       }
58249       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58250       context.on("exit.intro", function() {
58251         continueTo(reselectPoint);
58252       });
58253       context.history().on("change.intro", function() {
58254         continueTo(updateCloseEditor);
58255       });
58256       timeout2(function() {
58257         reveal(
58258           ".entity-editor-pane",
58259           helpHtml("intro.points.update"),
58260           { tooltipClass: "intro-points-describe" }
58261         );
58262       }, 400);
58263       function continueTo(nextStep) {
58264         context.on("exit.intro", null);
58265         context.history().on("change.intro", null);
58266         nextStep();
58267       }
58268     }
58269     function updateCloseEditor() {
58270       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
58271         return continueTo(reselectPoint);
58272       }
58273       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58274       context.on("exit.intro", function() {
58275         continueTo(rightClickPoint);
58276       });
58277       timeout2(function() {
58278         reveal(
58279           ".entity-editor-pane",
58280           helpHtml("intro.points.update_close", { button: { html: icon("#iD-icon-close", "inline") } })
58281         );
58282       }, 500);
58283       function continueTo(nextStep) {
58284         context.on("exit.intro", null);
58285         nextStep();
58286       }
58287     }
58288     function rightClickPoint() {
58289       if (!_pointID)
58290         return chapter.restart();
58291       var entity = context.hasEntity(_pointID);
58292       if (!entity)
58293         return chapter.restart();
58294       context.enter(modeBrowse(context));
58295       var box = pointBox(entity.loc, context);
58296       var textId = context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch";
58297       reveal(box, helpHtml("intro.points." + textId), { duration: 600 });
58298       timeout2(function() {
58299         context.map().on("move.intro", function() {
58300           var entity2 = context.hasEntity(_pointID);
58301           if (!entity2)
58302             return chapter.restart();
58303           var box2 = pointBox(entity2.loc, context);
58304           reveal(box2, helpHtml("intro.points." + textId), { duration: 0 });
58305         });
58306       }, 600);
58307       context.on("enter.intro", function(mode) {
58308         if (mode.id !== "select")
58309           return;
58310         var ids = context.selectedIDs();
58311         if (ids.length !== 1 || ids[0] !== _pointID)
58312           return;
58313         timeout2(function() {
58314           var node = selectMenuItem(context, "delete").node();
58315           if (!node)
58316             return;
58317           continueTo(enterDelete);
58318         }, 50);
58319       });
58320       function continueTo(nextStep) {
58321         context.on("enter.intro", null);
58322         context.map().on("move.intro", null);
58323         nextStep();
58324       }
58325     }
58326     function enterDelete() {
58327       if (!_pointID)
58328         return chapter.restart();
58329       var entity = context.hasEntity(_pointID);
58330       if (!entity)
58331         return chapter.restart();
58332       var node = selectMenuItem(context, "delete").node();
58333       if (!node) {
58334         return continueTo(rightClickPoint);
58335       }
58336       reveal(
58337         ".edit-menu",
58338         helpHtml("intro.points.delete"),
58339         { padding: 50 }
58340       );
58341       timeout2(function() {
58342         context.map().on("move.intro", function() {
58343           reveal(
58344             ".edit-menu",
58345             helpHtml("intro.points.delete"),
58346             { duration: 0, padding: 50 }
58347           );
58348         });
58349       }, 300);
58350       context.on("exit.intro", function() {
58351         if (!_pointID)
58352           return chapter.restart();
58353         var entity2 = context.hasEntity(_pointID);
58354         if (entity2)
58355           return continueTo(rightClickPoint);
58356       });
58357       context.history().on("change.intro", function(changed) {
58358         if (changed.deleted().length) {
58359           continueTo(undo);
58360         }
58361       });
58362       function continueTo(nextStep) {
58363         context.map().on("move.intro", null);
58364         context.history().on("change.intro", null);
58365         context.on("exit.intro", null);
58366         nextStep();
58367       }
58368     }
58369     function undo() {
58370       context.history().on("change.intro", function() {
58371         continueTo(play);
58372       });
58373       reveal(
58374         ".top-toolbar button.undo-button",
58375         helpHtml("intro.points.undo")
58376       );
58377       function continueTo(nextStep) {
58378         context.history().on("change.intro", null);
58379         nextStep();
58380       }
58381     }
58382     function play() {
58383       dispatch14.call("done");
58384       reveal(
58385         ".ideditor",
58386         helpHtml("intro.points.play", { next: _t("intro.areas.title") }),
58387         {
58388           tooltipBox: ".intro-nav-wrap .chapter-area",
58389           buttonText: _t.html("intro.ok"),
58390           buttonCallback: function() {
58391             reveal(".ideditor");
58392           }
58393         }
58394       );
58395     }
58396     chapter.enter = function() {
58397       addPoint();
58398     };
58399     chapter.exit = function() {
58400       timeouts.forEach(window.clearTimeout);
58401       context.on("enter.intro exit.intro", null);
58402       context.map().on("move.intro drawn.intro", null);
58403       context.history().on("change.intro", null);
58404       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58405       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
58406     };
58407     chapter.restart = function() {
58408       chapter.exit();
58409       chapter.enter();
58410     };
58411     return utilRebind(chapter, dispatch14, "on");
58412   }
58413
58414   // modules/ui/intro/area.js
58415   function uiIntroArea(context, reveal) {
58416     var dispatch14 = dispatch_default("done");
58417     var playground = [-85.63552, 41.94159];
58418     var playgroundPreset = _mainPresetIndex.item("leisure/playground");
58419     var nameField = _mainPresetIndex.field("name");
58420     var descriptionField = _mainPresetIndex.field("description");
58421     var timeouts = [];
58422     var _areaID;
58423     var chapter = {
58424       title: "intro.areas.title"
58425     };
58426     function timeout2(f3, t2) {
58427       timeouts.push(window.setTimeout(f3, t2));
58428     }
58429     function eventCancel(d3_event) {
58430       d3_event.stopPropagation();
58431       d3_event.preventDefault();
58432     }
58433     function revealPlayground(center, text2, options2) {
58434       var padding = 180 * Math.pow(2, context.map().zoom() - 19.5);
58435       var box = pad(center, padding, context);
58436       reveal(box, text2, options2);
58437     }
58438     function addArea() {
58439       context.enter(modeBrowse(context));
58440       context.history().reset("initial");
58441       _areaID = null;
58442       var msec = transitionTime(playground, context.map().center());
58443       if (msec) {
58444         reveal(null, null, { duration: 0 });
58445       }
58446       context.map().centerZoomEase(playground, 19, msec);
58447       timeout2(function() {
58448         var tooltip = reveal(
58449           "button.add-area",
58450           helpHtml("intro.areas.add_playground")
58451         );
58452         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-areas");
58453         context.on("enter.intro", function(mode) {
58454           if (mode.id !== "add-area")
58455             return;
58456           continueTo(startPlayground);
58457         });
58458       }, msec + 100);
58459       function continueTo(nextStep) {
58460         context.on("enter.intro", null);
58461         nextStep();
58462       }
58463     }
58464     function startPlayground() {
58465       if (context.mode().id !== "add-area") {
58466         return chapter.restart();
58467       }
58468       _areaID = null;
58469       context.map().zoomEase(19.5, 500);
58470       timeout2(function() {
58471         var textId = context.lastPointerType() === "mouse" ? "starting_node_click" : "starting_node_tap";
58472         var startDrawString = helpHtml("intro.areas.start_playground") + helpHtml("intro.areas." + textId);
58473         revealPlayground(
58474           playground,
58475           startDrawString,
58476           { duration: 250 }
58477         );
58478         timeout2(function() {
58479           context.map().on("move.intro drawn.intro", function() {
58480             revealPlayground(
58481               playground,
58482               startDrawString,
58483               { duration: 0 }
58484             );
58485           });
58486           context.on("enter.intro", function(mode) {
58487             if (mode.id !== "draw-area")
58488               return chapter.restart();
58489             continueTo(continuePlayground);
58490           });
58491         }, 250);
58492       }, 550);
58493       function continueTo(nextStep) {
58494         context.map().on("move.intro drawn.intro", null);
58495         context.on("enter.intro", null);
58496         nextStep();
58497       }
58498     }
58499     function continuePlayground() {
58500       if (context.mode().id !== "draw-area") {
58501         return chapter.restart();
58502       }
58503       _areaID = null;
58504       revealPlayground(
58505         playground,
58506         helpHtml("intro.areas.continue_playground"),
58507         { duration: 250 }
58508       );
58509       timeout2(function() {
58510         context.map().on("move.intro drawn.intro", function() {
58511           revealPlayground(
58512             playground,
58513             helpHtml("intro.areas.continue_playground"),
58514             { duration: 0 }
58515           );
58516         });
58517       }, 250);
58518       context.on("enter.intro", function(mode) {
58519         if (mode.id === "draw-area") {
58520           var entity = context.hasEntity(context.selectedIDs()[0]);
58521           if (entity && entity.nodes.length >= 6) {
58522             return continueTo(finishPlayground);
58523           } else {
58524             return;
58525           }
58526         } else if (mode.id === "select") {
58527           _areaID = context.selectedIDs()[0];
58528           return continueTo(searchPresets);
58529         } else {
58530           return chapter.restart();
58531         }
58532       });
58533       function continueTo(nextStep) {
58534         context.map().on("move.intro drawn.intro", null);
58535         context.on("enter.intro", null);
58536         nextStep();
58537       }
58538     }
58539     function finishPlayground() {
58540       if (context.mode().id !== "draw-area") {
58541         return chapter.restart();
58542       }
58543       _areaID = null;
58544       var finishString = helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.areas.finish_playground");
58545       revealPlayground(
58546         playground,
58547         finishString,
58548         { duration: 250 }
58549       );
58550       timeout2(function() {
58551         context.map().on("move.intro drawn.intro", function() {
58552           revealPlayground(
58553             playground,
58554             finishString,
58555             { duration: 0 }
58556           );
58557         });
58558       }, 250);
58559       context.on("enter.intro", function(mode) {
58560         if (mode.id === "draw-area") {
58561           return;
58562         } else if (mode.id === "select") {
58563           _areaID = context.selectedIDs()[0];
58564           return continueTo(searchPresets);
58565         } else {
58566           return chapter.restart();
58567         }
58568       });
58569       function continueTo(nextStep) {
58570         context.map().on("move.intro drawn.intro", null);
58571         context.on("enter.intro", null);
58572         nextStep();
58573       }
58574     }
58575     function searchPresets() {
58576       if (!_areaID || !context.hasEntity(_areaID)) {
58577         return addArea();
58578       }
58579       var ids = context.selectedIDs();
58580       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
58581         context.enter(modeSelect(context, [_areaID]));
58582       }
58583       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58584       timeout2(function() {
58585         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
58586         context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
58587         reveal(
58588           ".preset-search-input",
58589           helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() })
58590         );
58591       }, 400);
58592       context.on("enter.intro", function(mode) {
58593         if (!_areaID || !context.hasEntity(_areaID)) {
58594           return continueTo(addArea);
58595         }
58596         var ids2 = context.selectedIDs();
58597         if (mode.id !== "select" || !ids2.length || ids2[0] !== _areaID) {
58598           context.enter(modeSelect(context, [_areaID]));
58599           context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
58600           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58601           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
58602           reveal(
58603             ".preset-search-input",
58604             helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() })
58605           );
58606           context.history().on("change.intro", null);
58607         }
58608       });
58609       function checkPresetSearch() {
58610         var first = context.container().select(".preset-list-item:first-child");
58611         if (first.classed("preset-leisure-playground")) {
58612           reveal(
58613             first.select(".preset-list-button").node(),
58614             helpHtml("intro.areas.choose_playground", { preset: playgroundPreset.name() }),
58615             { duration: 300 }
58616           );
58617           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
58618           context.history().on("change.intro", function() {
58619             continueTo(clickAddField);
58620           });
58621         }
58622       }
58623       function continueTo(nextStep) {
58624         context.container().select(".inspector-wrap").on("wheel.intro", null);
58625         context.on("enter.intro", null);
58626         context.history().on("change.intro", null);
58627         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
58628         nextStep();
58629       }
58630     }
58631     function clickAddField() {
58632       if (!_areaID || !context.hasEntity(_areaID)) {
58633         return addArea();
58634       }
58635       var ids = context.selectedIDs();
58636       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
58637         return searchPresets();
58638       }
58639       if (!context.container().select(".form-field-description").empty()) {
58640         return continueTo(describePlayground);
58641       }
58642       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58643       timeout2(function() {
58644         context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58645         var entity = context.entity(_areaID);
58646         if (entity.tags.description) {
58647           return continueTo(play);
58648         }
58649         var box = context.container().select(".more-fields").node().getBoundingClientRect();
58650         if (box.top > 300) {
58651           var pane = context.container().select(".entity-editor-pane .inspector-body");
58652           var start2 = pane.node().scrollTop;
58653           var end = start2 + (box.top - 300);
58654           pane.transition().duration(250).tween("scroll.inspector", function() {
58655             var node = this;
58656             var i3 = number_default(start2, end);
58657             return function(t2) {
58658               node.scrollTop = i3(t2);
58659             };
58660           });
58661         }
58662         timeout2(function() {
58663           reveal(
58664             ".more-fields .combobox-input",
58665             helpHtml("intro.areas.add_field", {
58666               name: nameField.title(),
58667               description: descriptionField.title()
58668             }),
58669             { duration: 300 }
58670           );
58671           context.container().select(".more-fields .combobox-input").on("click.intro", function() {
58672             var watcher;
58673             watcher = window.setInterval(function() {
58674               if (!context.container().select("div.combobox").empty()) {
58675                 window.clearInterval(watcher);
58676                 continueTo(chooseDescriptionField);
58677               }
58678             }, 300);
58679           });
58680         }, 300);
58681       }, 400);
58682       context.on("exit.intro", function() {
58683         return continueTo(searchPresets);
58684       });
58685       function continueTo(nextStep) {
58686         context.container().select(".inspector-wrap").on("wheel.intro", null);
58687         context.container().select(".more-fields .combobox-input").on("click.intro", null);
58688         context.on("exit.intro", null);
58689         nextStep();
58690       }
58691     }
58692     function chooseDescriptionField() {
58693       if (!_areaID || !context.hasEntity(_areaID)) {
58694         return addArea();
58695       }
58696       var ids = context.selectedIDs();
58697       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
58698         return searchPresets();
58699       }
58700       if (!context.container().select(".form-field-description").empty()) {
58701         return continueTo(describePlayground);
58702       }
58703       if (context.container().select("div.combobox").empty()) {
58704         return continueTo(clickAddField);
58705       }
58706       var watcher;
58707       watcher = window.setInterval(function() {
58708         if (context.container().select("div.combobox").empty()) {
58709           window.clearInterval(watcher);
58710           timeout2(function() {
58711             if (context.container().select(".form-field-description").empty()) {
58712               continueTo(retryChooseDescription);
58713             } else {
58714               continueTo(describePlayground);
58715             }
58716           }, 300);
58717         }
58718       }, 300);
58719       reveal(
58720         "div.combobox",
58721         helpHtml("intro.areas.choose_field", { field: descriptionField.title() }),
58722         { duration: 300 }
58723       );
58724       context.on("exit.intro", function() {
58725         return continueTo(searchPresets);
58726       });
58727       function continueTo(nextStep) {
58728         if (watcher)
58729           window.clearInterval(watcher);
58730         context.on("exit.intro", null);
58731         nextStep();
58732       }
58733     }
58734     function describePlayground() {
58735       if (!_areaID || !context.hasEntity(_areaID)) {
58736         return addArea();
58737       }
58738       var ids = context.selectedIDs();
58739       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
58740         return searchPresets();
58741       }
58742       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58743       if (context.container().select(".form-field-description").empty()) {
58744         return continueTo(retryChooseDescription);
58745       }
58746       context.on("exit.intro", function() {
58747         continueTo(play);
58748       });
58749       reveal(
58750         ".entity-editor-pane",
58751         helpHtml("intro.areas.describe_playground", { button: { html: icon("#iD-icon-close", "inline") } }),
58752         { duration: 300 }
58753       );
58754       function continueTo(nextStep) {
58755         context.on("exit.intro", null);
58756         nextStep();
58757       }
58758     }
58759     function retryChooseDescription() {
58760       if (!_areaID || !context.hasEntity(_areaID)) {
58761         return addArea();
58762       }
58763       var ids = context.selectedIDs();
58764       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
58765         return searchPresets();
58766       }
58767       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58768       reveal(
58769         ".entity-editor-pane",
58770         helpHtml("intro.areas.retry_add_field", { field: descriptionField.title() }),
58771         {
58772           buttonText: _t.html("intro.ok"),
58773           buttonCallback: function() {
58774             continueTo(clickAddField);
58775           }
58776         }
58777       );
58778       context.on("exit.intro", function() {
58779         return continueTo(searchPresets);
58780       });
58781       function continueTo(nextStep) {
58782         context.on("exit.intro", null);
58783         nextStep();
58784       }
58785     }
58786     function play() {
58787       dispatch14.call("done");
58788       reveal(
58789         ".ideditor",
58790         helpHtml("intro.areas.play", { next: _t("intro.lines.title") }),
58791         {
58792           tooltipBox: ".intro-nav-wrap .chapter-line",
58793           buttonText: _t.html("intro.ok"),
58794           buttonCallback: function() {
58795             reveal(".ideditor");
58796           }
58797         }
58798       );
58799     }
58800     chapter.enter = function() {
58801       addArea();
58802     };
58803     chapter.exit = function() {
58804       timeouts.forEach(window.clearTimeout);
58805       context.on("enter.intro exit.intro", null);
58806       context.map().on("move.intro drawn.intro", null);
58807       context.history().on("change.intro", null);
58808       context.container().select(".inspector-wrap").on("wheel.intro", null);
58809       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
58810       context.container().select(".more-fields .combobox-input").on("click.intro", null);
58811     };
58812     chapter.restart = function() {
58813       chapter.exit();
58814       chapter.enter();
58815     };
58816     return utilRebind(chapter, dispatch14, "on");
58817   }
58818
58819   // modules/ui/intro/line.js
58820   function uiIntroLine(context, reveal) {
58821     var dispatch14 = dispatch_default("done");
58822     var timeouts = [];
58823     var _tulipRoadID = null;
58824     var flowerRoadID = "w646";
58825     var tulipRoadStart = [-85.6297754121684, 41.95805253325314];
58826     var tulipRoadMidpoint = [-85.62975395449628, 41.95787501510204];
58827     var tulipRoadIntersection = [-85.62974496187628, 41.95742515554585];
58828     var roadCategory = _mainPresetIndex.item("category-road_minor");
58829     var residentialPreset = _mainPresetIndex.item("highway/residential");
58830     var woodRoadID = "w525";
58831     var woodRoadEndID = "n2862";
58832     var woodRoadAddNode = [-85.62390110349587, 41.95397111462291];
58833     var woodRoadDragEndpoint = [-85.623867390213, 41.95466987786487];
58834     var woodRoadDragMidpoint = [-85.62386254803509, 41.95430395953872];
58835     var washingtonStreetID = "w522";
58836     var twelfthAvenueID = "w1";
58837     var eleventhAvenueEndID = "n3550";
58838     var twelfthAvenueEndID = "n5";
58839     var _washingtonSegmentID = null;
58840     var eleventhAvenueEnd = context.entity(eleventhAvenueEndID).loc;
58841     var twelfthAvenueEnd = context.entity(twelfthAvenueEndID).loc;
58842     var deleteLinesLoc = [-85.6219395542764, 41.95228033922477];
58843     var twelfthAvenue = [-85.62219310052491, 41.952505413152956];
58844     var chapter = {
58845       title: "intro.lines.title"
58846     };
58847     function timeout2(f3, t2) {
58848       timeouts.push(window.setTimeout(f3, t2));
58849     }
58850     function eventCancel(d3_event) {
58851       d3_event.stopPropagation();
58852       d3_event.preventDefault();
58853     }
58854     function addLine() {
58855       context.enter(modeBrowse(context));
58856       context.history().reset("initial");
58857       var msec = transitionTime(tulipRoadStart, context.map().center());
58858       if (msec) {
58859         reveal(null, null, { duration: 0 });
58860       }
58861       context.map().centerZoomEase(tulipRoadStart, 18.5, msec);
58862       timeout2(function() {
58863         var tooltip = reveal(
58864           "button.add-line",
58865           helpHtml("intro.lines.add_line")
58866         );
58867         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-lines");
58868         context.on("enter.intro", function(mode) {
58869           if (mode.id !== "add-line")
58870             return;
58871           continueTo(startLine);
58872         });
58873       }, msec + 100);
58874       function continueTo(nextStep) {
58875         context.on("enter.intro", null);
58876         nextStep();
58877       }
58878     }
58879     function startLine() {
58880       if (context.mode().id !== "add-line")
58881         return chapter.restart();
58882       _tulipRoadID = null;
58883       var padding = 70 * Math.pow(2, context.map().zoom() - 18);
58884       var box = pad(tulipRoadStart, padding, context);
58885       box.height = box.height + 100;
58886       var textId = context.lastPointerType() === "mouse" ? "start_line" : "start_line_tap";
58887       var startLineString = helpHtml("intro.lines.missing_road") + "{br}" + helpHtml("intro.lines.line_draw_info") + helpHtml("intro.lines." + textId);
58888       reveal(box, startLineString);
58889       context.map().on("move.intro drawn.intro", function() {
58890         padding = 70 * Math.pow(2, context.map().zoom() - 18);
58891         box = pad(tulipRoadStart, padding, context);
58892         box.height = box.height + 100;
58893         reveal(box, startLineString, { duration: 0 });
58894       });
58895       context.on("enter.intro", function(mode) {
58896         if (mode.id !== "draw-line")
58897           return chapter.restart();
58898         continueTo(drawLine);
58899       });
58900       function continueTo(nextStep) {
58901         context.map().on("move.intro drawn.intro", null);
58902         context.on("enter.intro", null);
58903         nextStep();
58904       }
58905     }
58906     function drawLine() {
58907       if (context.mode().id !== "draw-line")
58908         return chapter.restart();
58909       _tulipRoadID = context.mode().selectedIDs()[0];
58910       context.map().centerEase(tulipRoadMidpoint, 500);
58911       timeout2(function() {
58912         var padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
58913         var box = pad(tulipRoadMidpoint, padding, context);
58914         box.height = box.height * 2;
58915         reveal(
58916           box,
58917           helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") })
58918         );
58919         context.map().on("move.intro drawn.intro", function() {
58920           padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
58921           box = pad(tulipRoadMidpoint, padding, context);
58922           box.height = box.height * 2;
58923           reveal(
58924             box,
58925             helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") }),
58926             { duration: 0 }
58927           );
58928         });
58929       }, 550);
58930       context.history().on("change.intro", function() {
58931         if (isLineConnected()) {
58932           continueTo(continueLine);
58933         }
58934       });
58935       context.on("enter.intro", function(mode) {
58936         if (mode.id === "draw-line") {
58937           return;
58938         } else if (mode.id === "select") {
58939           continueTo(retryIntersect);
58940           return;
58941         } else {
58942           return chapter.restart();
58943         }
58944       });
58945       function continueTo(nextStep) {
58946         context.map().on("move.intro drawn.intro", null);
58947         context.history().on("change.intro", null);
58948         context.on("enter.intro", null);
58949         nextStep();
58950       }
58951     }
58952     function isLineConnected() {
58953       var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
58954       if (!entity)
58955         return false;
58956       var drawNodes = context.graph().childNodes(entity);
58957       return drawNodes.some(function(node) {
58958         return context.graph().parentWays(node).some(function(parent) {
58959           return parent.id === flowerRoadID;
58960         });
58961       });
58962     }
58963     function retryIntersect() {
58964       select_default2(window).on("pointerdown.intro mousedown.intro", eventCancel, true);
58965       var box = pad(tulipRoadIntersection, 80, context);
58966       reveal(
58967         box,
58968         helpHtml("intro.lines.retry_intersect", { name: _t("intro.graph.name.flower-street") })
58969       );
58970       timeout2(chapter.restart, 3e3);
58971     }
58972     function continueLine() {
58973       if (context.mode().id !== "draw-line")
58974         return chapter.restart();
58975       var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
58976       if (!entity)
58977         return chapter.restart();
58978       context.map().centerEase(tulipRoadIntersection, 500);
58979       var continueLineText = helpHtml("intro.lines.continue_line") + "{br}" + helpHtml("intro.lines.finish_line_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.lines.finish_road");
58980       reveal(".surface", continueLineText);
58981       context.on("enter.intro", function(mode) {
58982         if (mode.id === "draw-line") {
58983           return;
58984         } else if (mode.id === "select") {
58985           return continueTo(chooseCategoryRoad);
58986         } else {
58987           return chapter.restart();
58988         }
58989       });
58990       function continueTo(nextStep) {
58991         context.on("enter.intro", null);
58992         nextStep();
58993       }
58994     }
58995     function chooseCategoryRoad() {
58996       if (context.mode().id !== "select")
58997         return chapter.restart();
58998       context.on("exit.intro", function() {
58999         return chapter.restart();
59000       });
59001       var button = context.container().select(".preset-category-road_minor .preset-list-button");
59002       if (button.empty())
59003         return chapter.restart();
59004       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
59005       timeout2(function() {
59006         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
59007         reveal(
59008           button.node(),
59009           helpHtml("intro.lines.choose_category_road", { category: roadCategory.name() })
59010         );
59011         button.on("click.intro", function() {
59012           continueTo(choosePresetResidential);
59013         });
59014       }, 400);
59015       function continueTo(nextStep) {
59016         context.container().select(".inspector-wrap").on("wheel.intro", null);
59017         context.container().select(".preset-list-button").on("click.intro", null);
59018         context.on("exit.intro", null);
59019         nextStep();
59020       }
59021     }
59022     function choosePresetResidential() {
59023       if (context.mode().id !== "select")
59024         return chapter.restart();
59025       context.on("exit.intro", function() {
59026         return chapter.restart();
59027       });
59028       var subgrid = context.container().select(".preset-category-road_minor .subgrid");
59029       if (subgrid.empty())
59030         return chapter.restart();
59031       subgrid.selectAll(":not(.preset-highway-residential) .preset-list-button").on("click.intro", function() {
59032         continueTo(retryPresetResidential);
59033       });
59034       subgrid.selectAll(".preset-highway-residential .preset-list-button").on("click.intro", function() {
59035         continueTo(nameRoad);
59036       });
59037       timeout2(function() {
59038         reveal(
59039           subgrid.node(),
59040           helpHtml("intro.lines.choose_preset_residential", { preset: residentialPreset.name() }),
59041           { tooltipBox: ".preset-highway-residential .preset-list-button", duration: 300 }
59042         );
59043       }, 300);
59044       function continueTo(nextStep) {
59045         context.container().select(".preset-list-button").on("click.intro", null);
59046         context.on("exit.intro", null);
59047         nextStep();
59048       }
59049     }
59050     function retryPresetResidential() {
59051       if (context.mode().id !== "select")
59052         return chapter.restart();
59053       context.on("exit.intro", function() {
59054         return chapter.restart();
59055       });
59056       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
59057       timeout2(function() {
59058         var button = context.container().select(".entity-editor-pane .preset-list-button");
59059         reveal(
59060           button.node(),
59061           helpHtml("intro.lines.retry_preset_residential", { preset: residentialPreset.name() })
59062         );
59063         button.on("click.intro", function() {
59064           continueTo(chooseCategoryRoad);
59065         });
59066       }, 500);
59067       function continueTo(nextStep) {
59068         context.container().select(".inspector-wrap").on("wheel.intro", null);
59069         context.container().select(".preset-list-button").on("click.intro", null);
59070         context.on("exit.intro", null);
59071         nextStep();
59072       }
59073     }
59074     function nameRoad() {
59075       context.on("exit.intro", function() {
59076         continueTo(didNameRoad);
59077       });
59078       timeout2(function() {
59079         reveal(
59080           ".entity-editor-pane",
59081           helpHtml("intro.lines.name_road", { button: { html: icon("#iD-icon-close", "inline") } }),
59082           { tooltipClass: "intro-lines-name_road" }
59083         );
59084       }, 500);
59085       function continueTo(nextStep) {
59086         context.on("exit.intro", null);
59087         nextStep();
59088       }
59089     }
59090     function didNameRoad() {
59091       context.history().checkpoint("doneAddLine");
59092       timeout2(function() {
59093         reveal(".surface", helpHtml("intro.lines.did_name_road"), {
59094           buttonText: _t.html("intro.ok"),
59095           buttonCallback: function() {
59096             continueTo(updateLine);
59097           }
59098         });
59099       }, 500);
59100       function continueTo(nextStep) {
59101         nextStep();
59102       }
59103     }
59104     function updateLine() {
59105       context.history().reset("doneAddLine");
59106       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59107         return chapter.restart();
59108       }
59109       var msec = transitionTime(woodRoadDragMidpoint, context.map().center());
59110       if (msec) {
59111         reveal(null, null, { duration: 0 });
59112       }
59113       context.map().centerZoomEase(woodRoadDragMidpoint, 19, msec);
59114       timeout2(function() {
59115         var padding = 250 * Math.pow(2, context.map().zoom() - 19);
59116         var box = pad(woodRoadDragMidpoint, padding, context);
59117         var advance = function() {
59118           continueTo(addNode);
59119         };
59120         reveal(
59121           box,
59122           helpHtml("intro.lines.update_line"),
59123           { buttonText: _t.html("intro.ok"), buttonCallback: advance }
59124         );
59125         context.map().on("move.intro drawn.intro", function() {
59126           var padding2 = 250 * Math.pow(2, context.map().zoom() - 19);
59127           var box2 = pad(woodRoadDragMidpoint, padding2, context);
59128           reveal(
59129             box2,
59130             helpHtml("intro.lines.update_line"),
59131             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
59132           );
59133         });
59134       }, msec + 100);
59135       function continueTo(nextStep) {
59136         context.map().on("move.intro drawn.intro", null);
59137         nextStep();
59138       }
59139     }
59140     function addNode() {
59141       context.history().reset("doneAddLine");
59142       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59143         return chapter.restart();
59144       }
59145       var padding = 40 * Math.pow(2, context.map().zoom() - 19);
59146       var box = pad(woodRoadAddNode, padding, context);
59147       var addNodeString = helpHtml("intro.lines.add_node" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
59148       reveal(box, addNodeString);
59149       context.map().on("move.intro drawn.intro", function() {
59150         var padding2 = 40 * Math.pow(2, context.map().zoom() - 19);
59151         var box2 = pad(woodRoadAddNode, padding2, context);
59152         reveal(box2, addNodeString, { duration: 0 });
59153       });
59154       context.history().on("change.intro", function(changed) {
59155         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59156           return continueTo(updateLine);
59157         }
59158         if (changed.created().length === 1) {
59159           timeout2(function() {
59160             continueTo(startDragEndpoint);
59161           }, 500);
59162         }
59163       });
59164       context.on("enter.intro", function(mode) {
59165         if (mode.id !== "select") {
59166           continueTo(updateLine);
59167         }
59168       });
59169       function continueTo(nextStep) {
59170         context.map().on("move.intro drawn.intro", null);
59171         context.history().on("change.intro", null);
59172         context.on("enter.intro", null);
59173         nextStep();
59174       }
59175     }
59176     function startDragEndpoint() {
59177       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59178         return continueTo(updateLine);
59179       }
59180       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
59181       var box = pad(woodRoadDragEndpoint, padding, context);
59182       var startDragString = helpHtml("intro.lines.start_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch")) + helpHtml("intro.lines.drag_to_intersection");
59183       reveal(box, startDragString);
59184       context.map().on("move.intro drawn.intro", function() {
59185         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59186           return continueTo(updateLine);
59187         }
59188         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
59189         var box2 = pad(woodRoadDragEndpoint, padding2, context);
59190         reveal(box2, startDragString, { duration: 0 });
59191         var entity = context.entity(woodRoadEndID);
59192         if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) <= 4) {
59193           continueTo(finishDragEndpoint);
59194         }
59195       });
59196       function continueTo(nextStep) {
59197         context.map().on("move.intro drawn.intro", null);
59198         nextStep();
59199       }
59200     }
59201     function finishDragEndpoint() {
59202       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59203         return continueTo(updateLine);
59204       }
59205       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
59206       var box = pad(woodRoadDragEndpoint, padding, context);
59207       var finishDragString = helpHtml("intro.lines.spot_looks_good") + helpHtml("intro.lines.finish_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
59208       reveal(box, finishDragString);
59209       context.map().on("move.intro drawn.intro", function() {
59210         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59211           return continueTo(updateLine);
59212         }
59213         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
59214         var box2 = pad(woodRoadDragEndpoint, padding2, context);
59215         reveal(box2, finishDragString, { duration: 0 });
59216         var entity = context.entity(woodRoadEndID);
59217         if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) > 4) {
59218           continueTo(startDragEndpoint);
59219         }
59220       });
59221       context.on("enter.intro", function() {
59222         continueTo(startDragMidpoint);
59223       });
59224       function continueTo(nextStep) {
59225         context.map().on("move.intro drawn.intro", null);
59226         context.on("enter.intro", null);
59227         nextStep();
59228       }
59229     }
59230     function startDragMidpoint() {
59231       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59232         return continueTo(updateLine);
59233       }
59234       if (context.selectedIDs().indexOf(woodRoadID) === -1) {
59235         context.enter(modeSelect(context, [woodRoadID]));
59236       }
59237       var padding = 80 * Math.pow(2, context.map().zoom() - 19);
59238       var box = pad(woodRoadDragMidpoint, padding, context);
59239       reveal(box, helpHtml("intro.lines.start_drag_midpoint"));
59240       context.map().on("move.intro drawn.intro", function() {
59241         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59242           return continueTo(updateLine);
59243         }
59244         var padding2 = 80 * Math.pow(2, context.map().zoom() - 19);
59245         var box2 = pad(woodRoadDragMidpoint, padding2, context);
59246         reveal(box2, helpHtml("intro.lines.start_drag_midpoint"), { duration: 0 });
59247       });
59248       context.history().on("change.intro", function(changed) {
59249         if (changed.created().length === 1) {
59250           continueTo(continueDragMidpoint);
59251         }
59252       });
59253       context.on("enter.intro", function(mode) {
59254         if (mode.id !== "select") {
59255           context.enter(modeSelect(context, [woodRoadID]));
59256         }
59257       });
59258       function continueTo(nextStep) {
59259         context.map().on("move.intro drawn.intro", null);
59260         context.history().on("change.intro", null);
59261         context.on("enter.intro", null);
59262         nextStep();
59263       }
59264     }
59265     function continueDragMidpoint() {
59266       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59267         return continueTo(updateLine);
59268       }
59269       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
59270       var box = pad(woodRoadDragEndpoint, padding, context);
59271       box.height += 400;
59272       var advance = function() {
59273         context.history().checkpoint("doneUpdateLine");
59274         continueTo(deleteLines);
59275       };
59276       reveal(
59277         box,
59278         helpHtml("intro.lines.continue_drag_midpoint"),
59279         { buttonText: _t.html("intro.ok"), buttonCallback: advance }
59280       );
59281       context.map().on("move.intro drawn.intro", function() {
59282         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59283           return continueTo(updateLine);
59284         }
59285         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
59286         var box2 = pad(woodRoadDragEndpoint, padding2, context);
59287         box2.height += 400;
59288         reveal(
59289           box2,
59290           helpHtml("intro.lines.continue_drag_midpoint"),
59291           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
59292         );
59293       });
59294       function continueTo(nextStep) {
59295         context.map().on("move.intro drawn.intro", null);
59296         nextStep();
59297       }
59298     }
59299     function deleteLines() {
59300       context.history().reset("doneUpdateLine");
59301       context.enter(modeBrowse(context));
59302       if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59303         return chapter.restart();
59304       }
59305       var msec = transitionTime(deleteLinesLoc, context.map().center());
59306       if (msec) {
59307         reveal(null, null, { duration: 0 });
59308       }
59309       context.map().centerZoomEase(deleteLinesLoc, 18, msec);
59310       timeout2(function() {
59311         var padding = 200 * Math.pow(2, context.map().zoom() - 18);
59312         var box = pad(deleteLinesLoc, padding, context);
59313         box.top -= 200;
59314         box.height += 400;
59315         var advance = function() {
59316           continueTo(rightClickIntersection);
59317         };
59318         reveal(
59319           box,
59320           helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }),
59321           { buttonText: _t.html("intro.ok"), buttonCallback: advance }
59322         );
59323         context.map().on("move.intro drawn.intro", function() {
59324           var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
59325           var box2 = pad(deleteLinesLoc, padding2, context);
59326           box2.top -= 200;
59327           box2.height += 400;
59328           reveal(
59329             box2,
59330             helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }),
59331             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
59332           );
59333         });
59334         context.history().on("change.intro", function() {
59335           timeout2(function() {
59336             continueTo(deleteLines);
59337           }, 500);
59338         });
59339       }, msec + 100);
59340       function continueTo(nextStep) {
59341         context.map().on("move.intro drawn.intro", null);
59342         context.history().on("change.intro", null);
59343         nextStep();
59344       }
59345     }
59346     function rightClickIntersection() {
59347       context.history().reset("doneUpdateLine");
59348       context.enter(modeBrowse(context));
59349       context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
59350       var rightClickString = helpHtml("intro.lines.split_street", {
59351         street1: _t("intro.graph.name.11th-avenue"),
59352         street2: _t("intro.graph.name.washington-street")
59353       }) + helpHtml("intro.lines." + (context.lastPointerType() === "mouse" ? "rightclick_intersection" : "edit_menu_intersection_touch"));
59354       timeout2(function() {
59355         var padding = 60 * Math.pow(2, context.map().zoom() - 18);
59356         var box = pad(eleventhAvenueEnd, padding, context);
59357         reveal(box, rightClickString);
59358         context.map().on("move.intro drawn.intro", function() {
59359           var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
59360           var box2 = pad(eleventhAvenueEnd, padding2, context);
59361           reveal(
59362             box2,
59363             rightClickString,
59364             { duration: 0 }
59365           );
59366         });
59367         context.on("enter.intro", function(mode) {
59368           if (mode.id !== "select")
59369             return;
59370           var ids = context.selectedIDs();
59371           if (ids.length !== 1 || ids[0] !== eleventhAvenueEndID)
59372             return;
59373           timeout2(function() {
59374             var node = selectMenuItem(context, "split").node();
59375             if (!node)
59376               return;
59377             continueTo(splitIntersection);
59378           }, 50);
59379         });
59380         context.history().on("change.intro", function() {
59381           timeout2(function() {
59382             continueTo(deleteLines);
59383           }, 300);
59384         });
59385       }, 600);
59386       function continueTo(nextStep) {
59387         context.map().on("move.intro drawn.intro", null);
59388         context.on("enter.intro", null);
59389         context.history().on("change.intro", null);
59390         nextStep();
59391       }
59392     }
59393     function splitIntersection() {
59394       if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59395         return continueTo(deleteLines);
59396       }
59397       var node = selectMenuItem(context, "split").node();
59398       if (!node) {
59399         return continueTo(rightClickIntersection);
59400       }
59401       var wasChanged = false;
59402       _washingtonSegmentID = null;
59403       reveal(
59404         ".edit-menu",
59405         helpHtml(
59406           "intro.lines.split_intersection",
59407           { street: _t("intro.graph.name.washington-street") }
59408         ),
59409         { padding: 50 }
59410       );
59411       context.map().on("move.intro drawn.intro", function() {
59412         var node2 = selectMenuItem(context, "split").node();
59413         if (!wasChanged && !node2) {
59414           return continueTo(rightClickIntersection);
59415         }
59416         reveal(
59417           ".edit-menu",
59418           helpHtml(
59419             "intro.lines.split_intersection",
59420             { street: _t("intro.graph.name.washington-street") }
59421           ),
59422           { duration: 0, padding: 50 }
59423         );
59424       });
59425       context.history().on("change.intro", function(changed) {
59426         wasChanged = true;
59427         timeout2(function() {
59428           if (context.history().undoAnnotation() === _t("operations.split.annotation.line", { n: 1 })) {
59429             _washingtonSegmentID = changed.created()[0].id;
59430             continueTo(didSplit);
59431           } else {
59432             _washingtonSegmentID = null;
59433             continueTo(retrySplit);
59434           }
59435         }, 300);
59436       });
59437       function continueTo(nextStep) {
59438         context.map().on("move.intro drawn.intro", null);
59439         context.history().on("change.intro", null);
59440         nextStep();
59441       }
59442     }
59443     function retrySplit() {
59444       context.enter(modeBrowse(context));
59445       context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
59446       var advance = function() {
59447         continueTo(rightClickIntersection);
59448       };
59449       var padding = 60 * Math.pow(2, context.map().zoom() - 18);
59450       var box = pad(eleventhAvenueEnd, padding, context);
59451       reveal(
59452         box,
59453         helpHtml("intro.lines.retry_split"),
59454         { buttonText: _t.html("intro.ok"), buttonCallback: advance }
59455       );
59456       context.map().on("move.intro drawn.intro", function() {
59457         var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
59458         var box2 = pad(eleventhAvenueEnd, padding2, context);
59459         reveal(
59460           box2,
59461           helpHtml("intro.lines.retry_split"),
59462           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
59463         );
59464       });
59465       function continueTo(nextStep) {
59466         context.map().on("move.intro drawn.intro", null);
59467         nextStep();
59468       }
59469     }
59470     function didSplit() {
59471       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59472         return continueTo(rightClickIntersection);
59473       }
59474       var ids = context.selectedIDs();
59475       var string = "intro.lines.did_split_" + (ids.length > 1 ? "multi" : "single");
59476       var street = _t("intro.graph.name.washington-street");
59477       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
59478       var box = pad(twelfthAvenue, padding, context);
59479       box.width = box.width / 2;
59480       reveal(
59481         box,
59482         helpHtml(string, { street1: street, street2: street }),
59483         { duration: 500 }
59484       );
59485       timeout2(function() {
59486         context.map().centerZoomEase(twelfthAvenue, 18, 500);
59487         context.map().on("move.intro drawn.intro", function() {
59488           var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
59489           var box2 = pad(twelfthAvenue, padding2, context);
59490           box2.width = box2.width / 2;
59491           reveal(
59492             box2,
59493             helpHtml(string, { street1: street, street2: street }),
59494             { duration: 0 }
59495           );
59496         });
59497       }, 600);
59498       context.on("enter.intro", function() {
59499         var ids2 = context.selectedIDs();
59500         if (ids2.length === 1 && ids2[0] === _washingtonSegmentID) {
59501           continueTo(multiSelect);
59502         }
59503       });
59504       context.history().on("change.intro", function() {
59505         if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59506           return continueTo(rightClickIntersection);
59507         }
59508       });
59509       function continueTo(nextStep) {
59510         context.map().on("move.intro drawn.intro", null);
59511         context.on("enter.intro", null);
59512         context.history().on("change.intro", null);
59513         nextStep();
59514       }
59515     }
59516     function multiSelect() {
59517       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59518         return continueTo(rightClickIntersection);
59519       }
59520       var ids = context.selectedIDs();
59521       var hasWashington = ids.indexOf(_washingtonSegmentID) !== -1;
59522       var hasTwelfth = ids.indexOf(twelfthAvenueID) !== -1;
59523       if (hasWashington && hasTwelfth) {
59524         return continueTo(multiRightClick);
59525       } else if (!hasWashington && !hasTwelfth) {
59526         return continueTo(didSplit);
59527       }
59528       context.map().centerZoomEase(twelfthAvenue, 18, 500);
59529       timeout2(function() {
59530         var selected, other, padding, box;
59531         if (hasWashington) {
59532           selected = _t("intro.graph.name.washington-street");
59533           other = _t("intro.graph.name.12th-avenue");
59534           padding = 60 * Math.pow(2, context.map().zoom() - 18);
59535           box = pad(twelfthAvenueEnd, padding, context);
59536           box.width *= 3;
59537         } else {
59538           selected = _t("intro.graph.name.12th-avenue");
59539           other = _t("intro.graph.name.washington-street");
59540           padding = 200 * Math.pow(2, context.map().zoom() - 18);
59541           box = pad(twelfthAvenue, padding, context);
59542           box.width /= 2;
59543         }
59544         reveal(
59545           box,
59546           helpHtml(
59547             "intro.lines.multi_select",
59548             { selected, other1: other }
59549           ) + " " + helpHtml(
59550             "intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"),
59551             { selected, other2: other }
59552           )
59553         );
59554         context.map().on("move.intro drawn.intro", function() {
59555           if (hasWashington) {
59556             selected = _t("intro.graph.name.washington-street");
59557             other = _t("intro.graph.name.12th-avenue");
59558             padding = 60 * Math.pow(2, context.map().zoom() - 18);
59559             box = pad(twelfthAvenueEnd, padding, context);
59560             box.width *= 3;
59561           } else {
59562             selected = _t("intro.graph.name.12th-avenue");
59563             other = _t("intro.graph.name.washington-street");
59564             padding = 200 * Math.pow(2, context.map().zoom() - 18);
59565             box = pad(twelfthAvenue, padding, context);
59566             box.width /= 2;
59567           }
59568           reveal(
59569             box,
59570             helpHtml(
59571               "intro.lines.multi_select",
59572               { selected, other1: other }
59573             ) + " " + helpHtml(
59574               "intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"),
59575               { selected, other2: other }
59576             ),
59577             { duration: 0 }
59578           );
59579         });
59580         context.on("enter.intro", function() {
59581           continueTo(multiSelect);
59582         });
59583         context.history().on("change.intro", function() {
59584           if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59585             return continueTo(rightClickIntersection);
59586           }
59587         });
59588       }, 600);
59589       function continueTo(nextStep) {
59590         context.map().on("move.intro drawn.intro", null);
59591         context.on("enter.intro", null);
59592         context.history().on("change.intro", null);
59593         nextStep();
59594       }
59595     }
59596     function multiRightClick() {
59597       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59598         return continueTo(rightClickIntersection);
59599       }
59600       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
59601       var box = pad(twelfthAvenue, padding, context);
59602       var rightClickString = helpHtml("intro.lines.multi_select_success") + helpHtml("intro.lines.multi_" + (context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch"));
59603       reveal(box, rightClickString);
59604       context.map().on("move.intro drawn.intro", function() {
59605         var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
59606         var box2 = pad(twelfthAvenue, padding2, context);
59607         reveal(box2, rightClickString, { duration: 0 });
59608       });
59609       context.ui().editMenu().on("toggled.intro", function(open) {
59610         if (!open)
59611           return;
59612         timeout2(function() {
59613           var ids = context.selectedIDs();
59614           if (ids.length === 2 && ids.indexOf(twelfthAvenueID) !== -1 && ids.indexOf(_washingtonSegmentID) !== -1) {
59615             var node = selectMenuItem(context, "delete").node();
59616             if (!node)
59617               return;
59618             continueTo(multiDelete);
59619           } else if (ids.length === 1 && ids.indexOf(_washingtonSegmentID) !== -1) {
59620             return continueTo(multiSelect);
59621           } else {
59622             return continueTo(didSplit);
59623           }
59624         }, 300);
59625       });
59626       context.history().on("change.intro", function() {
59627         if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59628           return continueTo(rightClickIntersection);
59629         }
59630       });
59631       function continueTo(nextStep) {
59632         context.map().on("move.intro drawn.intro", null);
59633         context.ui().editMenu().on("toggled.intro", null);
59634         context.history().on("change.intro", null);
59635         nextStep();
59636       }
59637     }
59638     function multiDelete() {
59639       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59640         return continueTo(rightClickIntersection);
59641       }
59642       var node = selectMenuItem(context, "delete").node();
59643       if (!node)
59644         return continueTo(multiRightClick);
59645       reveal(
59646         ".edit-menu",
59647         helpHtml("intro.lines.multi_delete"),
59648         { padding: 50 }
59649       );
59650       context.map().on("move.intro drawn.intro", function() {
59651         reveal(
59652           ".edit-menu",
59653           helpHtml("intro.lines.multi_delete"),
59654           { duration: 0, padding: 50 }
59655         );
59656       });
59657       context.on("exit.intro", function() {
59658         if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
59659           return continueTo(multiSelect);
59660         }
59661       });
59662       context.history().on("change.intro", function() {
59663         if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
59664           continueTo(retryDelete);
59665         } else {
59666           continueTo(play);
59667         }
59668       });
59669       function continueTo(nextStep) {
59670         context.map().on("move.intro drawn.intro", null);
59671         context.on("exit.intro", null);
59672         context.history().on("change.intro", null);
59673         nextStep();
59674       }
59675     }
59676     function retryDelete() {
59677       context.enter(modeBrowse(context));
59678       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
59679       var box = pad(twelfthAvenue, padding, context);
59680       reveal(box, helpHtml("intro.lines.retry_delete"), {
59681         buttonText: _t.html("intro.ok"),
59682         buttonCallback: function() {
59683           continueTo(multiSelect);
59684         }
59685       });
59686       function continueTo(nextStep) {
59687         nextStep();
59688       }
59689     }
59690     function play() {
59691       dispatch14.call("done");
59692       reveal(
59693         ".ideditor",
59694         helpHtml("intro.lines.play", { next: _t("intro.buildings.title") }),
59695         {
59696           tooltipBox: ".intro-nav-wrap .chapter-building",
59697           buttonText: _t.html("intro.ok"),
59698           buttonCallback: function() {
59699             reveal(".ideditor");
59700           }
59701         }
59702       );
59703     }
59704     chapter.enter = function() {
59705       addLine();
59706     };
59707     chapter.exit = function() {
59708       timeouts.forEach(window.clearTimeout);
59709       select_default2(window).on("pointerdown.intro mousedown.intro", null, true);
59710       context.on("enter.intro exit.intro", null);
59711       context.map().on("move.intro drawn.intro", null);
59712       context.history().on("change.intro", null);
59713       context.container().select(".inspector-wrap").on("wheel.intro", null);
59714       context.container().select(".preset-list-button").on("click.intro", null);
59715     };
59716     chapter.restart = function() {
59717       chapter.exit();
59718       chapter.enter();
59719     };
59720     return utilRebind(chapter, dispatch14, "on");
59721   }
59722
59723   // modules/ui/intro/building.js
59724   function uiIntroBuilding(context, reveal) {
59725     var dispatch14 = dispatch_default("done");
59726     var house = [-85.62815, 41.95638];
59727     var tank = [-85.62732, 41.95347];
59728     var buildingCatetory = _mainPresetIndex.item("category-building");
59729     var housePreset = _mainPresetIndex.item("building/house");
59730     var tankPreset = _mainPresetIndex.item("man_made/storage_tank");
59731     var timeouts = [];
59732     var _houseID = null;
59733     var _tankID = null;
59734     var chapter = {
59735       title: "intro.buildings.title"
59736     };
59737     function timeout2(f3, t2) {
59738       timeouts.push(window.setTimeout(f3, t2));
59739     }
59740     function eventCancel(d3_event) {
59741       d3_event.stopPropagation();
59742       d3_event.preventDefault();
59743     }
59744     function revealHouse(center, text2, options2) {
59745       var padding = 160 * Math.pow(2, context.map().zoom() - 20);
59746       var box = pad(center, padding, context);
59747       reveal(box, text2, options2);
59748     }
59749     function revealTank(center, text2, options2) {
59750       var padding = 190 * Math.pow(2, context.map().zoom() - 19.5);
59751       var box = pad(center, padding, context);
59752       reveal(box, text2, options2);
59753     }
59754     function addHouse() {
59755       context.enter(modeBrowse(context));
59756       context.history().reset("initial");
59757       _houseID = null;
59758       var msec = transitionTime(house, context.map().center());
59759       if (msec) {
59760         reveal(null, null, { duration: 0 });
59761       }
59762       context.map().centerZoomEase(house, 19, msec);
59763       timeout2(function() {
59764         var tooltip = reveal(
59765           "button.add-area",
59766           helpHtml("intro.buildings.add_building")
59767         );
59768         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-buildings");
59769         context.on("enter.intro", function(mode) {
59770           if (mode.id !== "add-area")
59771             return;
59772           continueTo(startHouse);
59773         });
59774       }, msec + 100);
59775       function continueTo(nextStep) {
59776         context.on("enter.intro", null);
59777         nextStep();
59778       }
59779     }
59780     function startHouse() {
59781       if (context.mode().id !== "add-area") {
59782         return continueTo(addHouse);
59783       }
59784       _houseID = null;
59785       context.map().zoomEase(20, 500);
59786       timeout2(function() {
59787         var startString = helpHtml("intro.buildings.start_building") + helpHtml("intro.buildings.building_corner_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
59788         revealHouse(house, startString);
59789         context.map().on("move.intro drawn.intro", function() {
59790           revealHouse(house, startString, { duration: 0 });
59791         });
59792         context.on("enter.intro", function(mode) {
59793           if (mode.id !== "draw-area")
59794             return chapter.restart();
59795           continueTo(continueHouse);
59796         });
59797       }, 550);
59798       function continueTo(nextStep) {
59799         context.map().on("move.intro drawn.intro", null);
59800         context.on("enter.intro", null);
59801         nextStep();
59802       }
59803     }
59804     function continueHouse() {
59805       if (context.mode().id !== "draw-area") {
59806         return continueTo(addHouse);
59807       }
59808       _houseID = null;
59809       var continueString = helpHtml("intro.buildings.continue_building") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_building");
59810       revealHouse(house, continueString);
59811       context.map().on("move.intro drawn.intro", function() {
59812         revealHouse(house, continueString, { duration: 0 });
59813       });
59814       context.on("enter.intro", function(mode) {
59815         if (mode.id === "draw-area") {
59816           return;
59817         } else if (mode.id === "select") {
59818           var graph = context.graph();
59819           var way = context.entity(context.selectedIDs()[0]);
59820           var nodes = graph.childNodes(way);
59821           var points = utilArrayUniq(nodes).map(function(n3) {
59822             return context.projection(n3.loc);
59823           });
59824           if (isMostlySquare(points)) {
59825             _houseID = way.id;
59826             return continueTo(chooseCategoryBuilding);
59827           } else {
59828             return continueTo(retryHouse);
59829           }
59830         } else {
59831           return chapter.restart();
59832         }
59833       });
59834       function continueTo(nextStep) {
59835         context.map().on("move.intro drawn.intro", null);
59836         context.on("enter.intro", null);
59837         nextStep();
59838       }
59839     }
59840     function retryHouse() {
59841       var onClick = function() {
59842         continueTo(addHouse);
59843       };
59844       revealHouse(
59845         house,
59846         helpHtml("intro.buildings.retry_building"),
59847         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
59848       );
59849       context.map().on("move.intro drawn.intro", function() {
59850         revealHouse(
59851           house,
59852           helpHtml("intro.buildings.retry_building"),
59853           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
59854         );
59855       });
59856       function continueTo(nextStep) {
59857         context.map().on("move.intro drawn.intro", null);
59858         nextStep();
59859       }
59860     }
59861     function chooseCategoryBuilding() {
59862       if (!_houseID || !context.hasEntity(_houseID)) {
59863         return addHouse();
59864       }
59865       var ids = context.selectedIDs();
59866       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
59867         context.enter(modeSelect(context, [_houseID]));
59868       }
59869       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
59870       timeout2(function() {
59871         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
59872         var button = context.container().select(".preset-category-building .preset-list-button");
59873         reveal(
59874           button.node(),
59875           helpHtml("intro.buildings.choose_category_building", { category: buildingCatetory.name() })
59876         );
59877         button.on("click.intro", function() {
59878           button.on("click.intro", null);
59879           continueTo(choosePresetHouse);
59880         });
59881       }, 400);
59882       context.on("enter.intro", function(mode) {
59883         if (!_houseID || !context.hasEntity(_houseID)) {
59884           return continueTo(addHouse);
59885         }
59886         var ids2 = context.selectedIDs();
59887         if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
59888           return continueTo(chooseCategoryBuilding);
59889         }
59890       });
59891       function continueTo(nextStep) {
59892         context.container().select(".inspector-wrap").on("wheel.intro", null);
59893         context.container().select(".preset-list-button").on("click.intro", null);
59894         context.on("enter.intro", null);
59895         nextStep();
59896       }
59897     }
59898     function choosePresetHouse() {
59899       if (!_houseID || !context.hasEntity(_houseID)) {
59900         return addHouse();
59901       }
59902       var ids = context.selectedIDs();
59903       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
59904         context.enter(modeSelect(context, [_houseID]));
59905       }
59906       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
59907       timeout2(function() {
59908         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
59909         var button = context.container().select(".preset-building-house .preset-list-button");
59910         reveal(
59911           button.node(),
59912           helpHtml("intro.buildings.choose_preset_house", { preset: housePreset.name() }),
59913           { duration: 300 }
59914         );
59915         button.on("click.intro", function() {
59916           button.on("click.intro", null);
59917           continueTo(closeEditorHouse);
59918         });
59919       }, 400);
59920       context.on("enter.intro", function(mode) {
59921         if (!_houseID || !context.hasEntity(_houseID)) {
59922           return continueTo(addHouse);
59923         }
59924         var ids2 = context.selectedIDs();
59925         if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
59926           return continueTo(chooseCategoryBuilding);
59927         }
59928       });
59929       function continueTo(nextStep) {
59930         context.container().select(".inspector-wrap").on("wheel.intro", null);
59931         context.container().select(".preset-list-button").on("click.intro", null);
59932         context.on("enter.intro", null);
59933         nextStep();
59934       }
59935     }
59936     function closeEditorHouse() {
59937       if (!_houseID || !context.hasEntity(_houseID)) {
59938         return addHouse();
59939       }
59940       var ids = context.selectedIDs();
59941       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
59942         context.enter(modeSelect(context, [_houseID]));
59943       }
59944       context.history().checkpoint("hasHouse");
59945       context.on("exit.intro", function() {
59946         continueTo(rightClickHouse);
59947       });
59948       timeout2(function() {
59949         reveal(
59950           ".entity-editor-pane",
59951           helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } })
59952         );
59953       }, 500);
59954       function continueTo(nextStep) {
59955         context.on("exit.intro", null);
59956         nextStep();
59957       }
59958     }
59959     function rightClickHouse() {
59960       if (!_houseID)
59961         return chapter.restart();
59962       context.enter(modeBrowse(context));
59963       context.history().reset("hasHouse");
59964       var zoom = context.map().zoom();
59965       if (zoom < 20) {
59966         zoom = 20;
59967       }
59968       context.map().centerZoomEase(house, zoom, 500);
59969       context.on("enter.intro", function(mode) {
59970         if (mode.id !== "select")
59971           return;
59972         var ids = context.selectedIDs();
59973         if (ids.length !== 1 || ids[0] !== _houseID)
59974           return;
59975         timeout2(function() {
59976           var node = selectMenuItem(context, "orthogonalize").node();
59977           if (!node)
59978             return;
59979           continueTo(clickSquare);
59980         }, 50);
59981       });
59982       context.map().on("move.intro drawn.intro", function() {
59983         var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_building" : "edit_menu_building_touch"));
59984         revealHouse(house, rightclickString, { duration: 0 });
59985       });
59986       context.history().on("change.intro", function() {
59987         continueTo(rightClickHouse);
59988       });
59989       function continueTo(nextStep) {
59990         context.on("enter.intro", null);
59991         context.map().on("move.intro drawn.intro", null);
59992         context.history().on("change.intro", null);
59993         nextStep();
59994       }
59995     }
59996     function clickSquare() {
59997       if (!_houseID)
59998         return chapter.restart();
59999       var entity = context.hasEntity(_houseID);
60000       if (!entity)
60001         return continueTo(rightClickHouse);
60002       var node = selectMenuItem(context, "orthogonalize").node();
60003       if (!node) {
60004         return continueTo(rightClickHouse);
60005       }
60006       var wasChanged = false;
60007       reveal(
60008         ".edit-menu",
60009         helpHtml("intro.buildings.square_building"),
60010         { padding: 50 }
60011       );
60012       context.on("enter.intro", function(mode) {
60013         if (mode.id === "browse") {
60014           continueTo(rightClickHouse);
60015         } else if (mode.id === "move" || mode.id === "rotate") {
60016           continueTo(retryClickSquare);
60017         }
60018       });
60019       context.map().on("move.intro", function() {
60020         var node2 = selectMenuItem(context, "orthogonalize").node();
60021         if (!wasChanged && !node2) {
60022           return continueTo(rightClickHouse);
60023         }
60024         reveal(
60025           ".edit-menu",
60026           helpHtml("intro.buildings.square_building"),
60027           { duration: 0, padding: 50 }
60028         );
60029       });
60030       context.history().on("change.intro", function() {
60031         wasChanged = true;
60032         context.history().on("change.intro", null);
60033         timeout2(function() {
60034           if (context.history().undoAnnotation() === _t("operations.orthogonalize.annotation.feature", { n: 1 })) {
60035             continueTo(doneSquare);
60036           } else {
60037             continueTo(retryClickSquare);
60038           }
60039         }, 500);
60040       });
60041       function continueTo(nextStep) {
60042         context.on("enter.intro", null);
60043         context.map().on("move.intro", null);
60044         context.history().on("change.intro", null);
60045         nextStep();
60046       }
60047     }
60048     function retryClickSquare() {
60049       context.enter(modeBrowse(context));
60050       revealHouse(house, helpHtml("intro.buildings.retry_square"), {
60051         buttonText: _t.html("intro.ok"),
60052         buttonCallback: function() {
60053           continueTo(rightClickHouse);
60054         }
60055       });
60056       function continueTo(nextStep) {
60057         nextStep();
60058       }
60059     }
60060     function doneSquare() {
60061       context.history().checkpoint("doneSquare");
60062       revealHouse(house, helpHtml("intro.buildings.done_square"), {
60063         buttonText: _t.html("intro.ok"),
60064         buttonCallback: function() {
60065           continueTo(addTank);
60066         }
60067       });
60068       function continueTo(nextStep) {
60069         nextStep();
60070       }
60071     }
60072     function addTank() {
60073       context.enter(modeBrowse(context));
60074       context.history().reset("doneSquare");
60075       _tankID = null;
60076       var msec = transitionTime(tank, context.map().center());
60077       if (msec) {
60078         reveal(null, null, { duration: 0 });
60079       }
60080       context.map().centerZoomEase(tank, 19.5, msec);
60081       timeout2(function() {
60082         reveal(
60083           "button.add-area",
60084           helpHtml("intro.buildings.add_tank")
60085         );
60086         context.on("enter.intro", function(mode) {
60087           if (mode.id !== "add-area")
60088             return;
60089           continueTo(startTank);
60090         });
60091       }, msec + 100);
60092       function continueTo(nextStep) {
60093         context.on("enter.intro", null);
60094         nextStep();
60095       }
60096     }
60097     function startTank() {
60098       if (context.mode().id !== "add-area") {
60099         return continueTo(addTank);
60100       }
60101       _tankID = null;
60102       timeout2(function() {
60103         var startString = helpHtml("intro.buildings.start_tank") + helpHtml("intro.buildings.tank_edge_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
60104         revealTank(tank, startString);
60105         context.map().on("move.intro drawn.intro", function() {
60106           revealTank(tank, startString, { duration: 0 });
60107         });
60108         context.on("enter.intro", function(mode) {
60109           if (mode.id !== "draw-area")
60110             return chapter.restart();
60111           continueTo(continueTank);
60112         });
60113       }, 550);
60114       function continueTo(nextStep) {
60115         context.map().on("move.intro drawn.intro", null);
60116         context.on("enter.intro", null);
60117         nextStep();
60118       }
60119     }
60120     function continueTank() {
60121       if (context.mode().id !== "draw-area") {
60122         return continueTo(addTank);
60123       }
60124       _tankID = null;
60125       var continueString = helpHtml("intro.buildings.continue_tank") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_tank");
60126       revealTank(tank, continueString);
60127       context.map().on("move.intro drawn.intro", function() {
60128         revealTank(tank, continueString, { duration: 0 });
60129       });
60130       context.on("enter.intro", function(mode) {
60131         if (mode.id === "draw-area") {
60132           return;
60133         } else if (mode.id === "select") {
60134           _tankID = context.selectedIDs()[0];
60135           return continueTo(searchPresetTank);
60136         } else {
60137           return continueTo(addTank);
60138         }
60139       });
60140       function continueTo(nextStep) {
60141         context.map().on("move.intro drawn.intro", null);
60142         context.on("enter.intro", null);
60143         nextStep();
60144       }
60145     }
60146     function searchPresetTank() {
60147       if (!_tankID || !context.hasEntity(_tankID)) {
60148         return addTank();
60149       }
60150       var ids = context.selectedIDs();
60151       if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
60152         context.enter(modeSelect(context, [_tankID]));
60153       }
60154       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
60155       timeout2(function() {
60156         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
60157         context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
60158         reveal(
60159           ".preset-search-input",
60160           helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() })
60161         );
60162       }, 400);
60163       context.on("enter.intro", function(mode) {
60164         if (!_tankID || !context.hasEntity(_tankID)) {
60165           return continueTo(addTank);
60166         }
60167         var ids2 = context.selectedIDs();
60168         if (mode.id !== "select" || !ids2.length || ids2[0] !== _tankID) {
60169           context.enter(modeSelect(context, [_tankID]));
60170           context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
60171           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
60172           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
60173           reveal(
60174             ".preset-search-input",
60175             helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() })
60176           );
60177           context.history().on("change.intro", null);
60178         }
60179       });
60180       function checkPresetSearch() {
60181         var first = context.container().select(".preset-list-item:first-child");
60182         if (first.classed("preset-man_made-storage_tank")) {
60183           reveal(
60184             first.select(".preset-list-button").node(),
60185             helpHtml("intro.buildings.choose_tank", { preset: tankPreset.name() }),
60186             { duration: 300 }
60187           );
60188           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
60189           context.history().on("change.intro", function() {
60190             continueTo(closeEditorTank);
60191           });
60192         }
60193       }
60194       function continueTo(nextStep) {
60195         context.container().select(".inspector-wrap").on("wheel.intro", null);
60196         context.on("enter.intro", null);
60197         context.history().on("change.intro", null);
60198         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
60199         nextStep();
60200       }
60201     }
60202     function closeEditorTank() {
60203       if (!_tankID || !context.hasEntity(_tankID)) {
60204         return addTank();
60205       }
60206       var ids = context.selectedIDs();
60207       if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
60208         context.enter(modeSelect(context, [_tankID]));
60209       }
60210       context.history().checkpoint("hasTank");
60211       context.on("exit.intro", function() {
60212         continueTo(rightClickTank);
60213       });
60214       timeout2(function() {
60215         reveal(
60216           ".entity-editor-pane",
60217           helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } })
60218         );
60219       }, 500);
60220       function continueTo(nextStep) {
60221         context.on("exit.intro", null);
60222         nextStep();
60223       }
60224     }
60225     function rightClickTank() {
60226       if (!_tankID)
60227         return continueTo(addTank);
60228       context.enter(modeBrowse(context));
60229       context.history().reset("hasTank");
60230       context.map().centerEase(tank, 500);
60231       timeout2(function() {
60232         context.on("enter.intro", function(mode) {
60233           if (mode.id !== "select")
60234             return;
60235           var ids = context.selectedIDs();
60236           if (ids.length !== 1 || ids[0] !== _tankID)
60237             return;
60238           timeout2(function() {
60239             var node = selectMenuItem(context, "circularize").node();
60240             if (!node)
60241               return;
60242             continueTo(clickCircle);
60243           }, 50);
60244         });
60245         var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_tank" : "edit_menu_tank_touch"));
60246         revealTank(tank, rightclickString);
60247         context.map().on("move.intro drawn.intro", function() {
60248           revealTank(tank, rightclickString, { duration: 0 });
60249         });
60250         context.history().on("change.intro", function() {
60251           continueTo(rightClickTank);
60252         });
60253       }, 600);
60254       function continueTo(nextStep) {
60255         context.on("enter.intro", null);
60256         context.map().on("move.intro drawn.intro", null);
60257         context.history().on("change.intro", null);
60258         nextStep();
60259       }
60260     }
60261     function clickCircle() {
60262       if (!_tankID)
60263         return chapter.restart();
60264       var entity = context.hasEntity(_tankID);
60265       if (!entity)
60266         return continueTo(rightClickTank);
60267       var node = selectMenuItem(context, "circularize").node();
60268       if (!node) {
60269         return continueTo(rightClickTank);
60270       }
60271       var wasChanged = false;
60272       reveal(
60273         ".edit-menu",
60274         helpHtml("intro.buildings.circle_tank"),
60275         { padding: 50 }
60276       );
60277       context.on("enter.intro", function(mode) {
60278         if (mode.id === "browse") {
60279           continueTo(rightClickTank);
60280         } else if (mode.id === "move" || mode.id === "rotate") {
60281           continueTo(retryClickCircle);
60282         }
60283       });
60284       context.map().on("move.intro", function() {
60285         var node2 = selectMenuItem(context, "circularize").node();
60286         if (!wasChanged && !node2) {
60287           return continueTo(rightClickTank);
60288         }
60289         reveal(
60290           ".edit-menu",
60291           helpHtml("intro.buildings.circle_tank"),
60292           { duration: 0, padding: 50 }
60293         );
60294       });
60295       context.history().on("change.intro", function() {
60296         wasChanged = true;
60297         context.history().on("change.intro", null);
60298         timeout2(function() {
60299           if (context.history().undoAnnotation() === _t("operations.circularize.annotation.feature", { n: 1 })) {
60300             continueTo(play);
60301           } else {
60302             continueTo(retryClickCircle);
60303           }
60304         }, 500);
60305       });
60306       function continueTo(nextStep) {
60307         context.on("enter.intro", null);
60308         context.map().on("move.intro", null);
60309         context.history().on("change.intro", null);
60310         nextStep();
60311       }
60312     }
60313     function retryClickCircle() {
60314       context.enter(modeBrowse(context));
60315       revealTank(tank, helpHtml("intro.buildings.retry_circle"), {
60316         buttonText: _t.html("intro.ok"),
60317         buttonCallback: function() {
60318           continueTo(rightClickTank);
60319         }
60320       });
60321       function continueTo(nextStep) {
60322         nextStep();
60323       }
60324     }
60325     function play() {
60326       dispatch14.call("done");
60327       reveal(
60328         ".ideditor",
60329         helpHtml("intro.buildings.play", { next: _t("intro.startediting.title") }),
60330         {
60331           tooltipBox: ".intro-nav-wrap .chapter-startEditing",
60332           buttonText: _t.html("intro.ok"),
60333           buttonCallback: function() {
60334             reveal(".ideditor");
60335           }
60336         }
60337       );
60338     }
60339     chapter.enter = function() {
60340       addHouse();
60341     };
60342     chapter.exit = function() {
60343       timeouts.forEach(window.clearTimeout);
60344       context.on("enter.intro exit.intro", null);
60345       context.map().on("move.intro drawn.intro", null);
60346       context.history().on("change.intro", null);
60347       context.container().select(".inspector-wrap").on("wheel.intro", null);
60348       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
60349       context.container().select(".more-fields .combobox-input").on("click.intro", null);
60350     };
60351     chapter.restart = function() {
60352       chapter.exit();
60353       chapter.enter();
60354     };
60355     return utilRebind(chapter, dispatch14, "on");
60356   }
60357
60358   // modules/ui/intro/start_editing.js
60359   function uiIntroStartEditing(context, reveal) {
60360     var dispatch14 = dispatch_default("done", "startEditing");
60361     var modalSelection = select_default2(null);
60362     var chapter = {
60363       title: "intro.startediting.title"
60364     };
60365     function showHelp() {
60366       reveal(
60367         ".map-control.help-control",
60368         helpHtml("intro.startediting.help"),
60369         {
60370           buttonText: _t.html("intro.ok"),
60371           buttonCallback: function() {
60372             shortcuts();
60373           }
60374         }
60375       );
60376     }
60377     function shortcuts() {
60378       reveal(
60379         ".map-control.help-control",
60380         helpHtml("intro.startediting.shortcuts"),
60381         {
60382           buttonText: _t.html("intro.ok"),
60383           buttonCallback: function() {
60384             showSave();
60385           }
60386         }
60387       );
60388     }
60389     function showSave() {
60390       context.container().selectAll(".shaded").remove();
60391       reveal(
60392         ".top-toolbar button.save",
60393         helpHtml("intro.startediting.save"),
60394         {
60395           buttonText: _t.html("intro.ok"),
60396           buttonCallback: function() {
60397             showStart();
60398           }
60399         }
60400       );
60401     }
60402     function showStart() {
60403       context.container().selectAll(".shaded").remove();
60404       modalSelection = uiModal(context.container());
60405       modalSelection.select(".modal").attr("class", "modal-splash modal");
60406       modalSelection.selectAll(".close").remove();
60407       var startbutton = modalSelection.select(".content").attr("class", "fillL").append("button").attr("class", "modal-section huge-modal-button").on("click", function() {
60408         modalSelection.remove();
60409       });
60410       startbutton.append("svg").attr("class", "illustration").append("use").attr("xlink:href", "#iD-logo-walkthrough");
60411       startbutton.append("h2").call(_t.append("intro.startediting.start"));
60412       dispatch14.call("startEditing");
60413     }
60414     chapter.enter = function() {
60415       showHelp();
60416     };
60417     chapter.exit = function() {
60418       modalSelection.remove();
60419       context.container().selectAll(".shaded").remove();
60420     };
60421     return utilRebind(chapter, dispatch14, "on");
60422   }
60423
60424   // modules/ui/intro/intro.js
60425   var chapterUi = {
60426     welcome: uiIntroWelcome,
60427     navigation: uiIntroNavigation,
60428     point: uiIntroPoint,
60429     area: uiIntroArea,
60430     line: uiIntroLine,
60431     building: uiIntroBuilding,
60432     startEditing: uiIntroStartEditing
60433   };
60434   var chapterFlow = [
60435     "welcome",
60436     "navigation",
60437     "point",
60438     "area",
60439     "line",
60440     "building",
60441     "startEditing"
60442   ];
60443   function uiIntro(context) {
60444     const INTRO_IMAGERY = "EsriWorldImageryClarity";
60445     let _introGraph = {};
60446     let _currChapter;
60447     function intro(selection2) {
60448       _mainFileFetcher.get("intro_graph").then((dataIntroGraph) => {
60449         for (let id2 in dataIntroGraph) {
60450           if (!_introGraph[id2]) {
60451             _introGraph[id2] = osmEntity(localize(dataIntroGraph[id2]));
60452           }
60453         }
60454         selection2.call(startIntro);
60455       }).catch(function() {
60456       });
60457     }
60458     function startIntro(selection2) {
60459       context.enter(modeBrowse(context));
60460       let osm = context.connection();
60461       let history = context.history().toJSON();
60462       let hash = window.location.hash;
60463       let center = context.map().center();
60464       let zoom = context.map().zoom();
60465       let background = context.background().baseLayerSource();
60466       let overlays = context.background().overlayLayerSources();
60467       let opacity = context.container().selectAll(".main-map .layer-background").style("opacity");
60468       let caches = osm && osm.caches();
60469       let baseEntities = context.history().graph().base().entities;
60470       context.ui().sidebar.expand();
60471       context.container().selectAll("button.sidebar-toggle").classed("disabled", true);
60472       context.inIntro(true);
60473       if (osm) {
60474         osm.toggle(false).reset();
60475       }
60476       context.history().reset();
60477       context.history().merge(Object.values(coreGraph().load(_introGraph).entities));
60478       context.history().checkpoint("initial");
60479       let imagery = context.background().findSource(INTRO_IMAGERY);
60480       if (imagery) {
60481         context.background().baseLayerSource(imagery);
60482       } else {
60483         context.background().bing();
60484       }
60485       overlays.forEach((d2) => context.background().toggleOverlayLayer(d2));
60486       let layers = context.layers();
60487       layers.all().forEach((item) => {
60488         if (typeof item.layer.enabled === "function") {
60489           item.layer.enabled(item.id === "osm");
60490         }
60491       });
60492       context.container().selectAll(".main-map .layer-background").style("opacity", 1);
60493       let curtain = uiCurtain(context.container().node());
60494       selection2.call(curtain);
60495       corePreferences("walkthrough_started", "yes");
60496       let storedProgress = corePreferences("walkthrough_progress") || "";
60497       let progress = storedProgress.split(";").filter(Boolean);
60498       let chapters = chapterFlow.map((chapter, i3) => {
60499         let s2 = chapterUi[chapter](context, curtain.reveal).on("done", () => {
60500           buttons.filter((d2) => d2.title === s2.title).classed("finished", true);
60501           if (i3 < chapterFlow.length - 1) {
60502             const next = chapterFlow[i3 + 1];
60503             context.container().select(`button.chapter-${next}`).classed("next", true);
60504           }
60505           progress.push(chapter);
60506           corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
60507         });
60508         return s2;
60509       });
60510       chapters[chapters.length - 1].on("startEditing", () => {
60511         progress.push("startEditing");
60512         corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
60513         let incomplete = utilArrayDifference(chapterFlow, progress);
60514         if (!incomplete.length) {
60515           corePreferences("walkthrough_completed", "yes");
60516         }
60517         curtain.remove();
60518         navwrap.remove();
60519         context.container().selectAll(".main-map .layer-background").style("opacity", opacity);
60520         context.container().selectAll("button.sidebar-toggle").classed("disabled", false);
60521         if (osm) {
60522           osm.toggle(true).reset().caches(caches);
60523         }
60524         context.history().reset().merge(Object.values(baseEntities));
60525         context.background().baseLayerSource(background);
60526         overlays.forEach((d2) => context.background().toggleOverlayLayer(d2));
60527         if (history) {
60528           context.history().fromJSON(history, false);
60529         }
60530         context.map().centerZoom(center, zoom);
60531         window.location.replace(hash);
60532         context.inIntro(false);
60533       });
60534       let navwrap = selection2.append("div").attr("class", "intro-nav-wrap fillD");
60535       navwrap.append("svg").attr("class", "intro-nav-wrap-logo").append("use").attr("xlink:href", "#iD-logo-walkthrough");
60536       let buttonwrap = navwrap.append("div").attr("class", "joined").selectAll("button.chapter");
60537       let buttons = buttonwrap.data(chapters).enter().append("button").attr("class", (d2, i3) => `chapter chapter-${chapterFlow[i3]}`).on("click", enterChapter);
60538       buttons.append("span").html((d2) => _t.html(d2.title));
60539       buttons.append("span").attr("class", "status").call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
60540       enterChapter(null, chapters[0]);
60541       function enterChapter(d3_event, newChapter) {
60542         if (_currChapter) {
60543           _currChapter.exit();
60544         }
60545         context.enter(modeBrowse(context));
60546         _currChapter = newChapter;
60547         _currChapter.enter();
60548         buttons.classed("next", false).classed("active", (d2) => d2.title === _currChapter.title);
60549       }
60550     }
60551     return intro;
60552   }
60553
60554   // modules/ui/issues_info.js
60555   function uiIssuesInfo(context) {
60556     var warningsItem = {
60557       id: "warnings",
60558       count: 0,
60559       iconID: "iD-icon-alert",
60560       descriptionID: "issues.warnings_and_errors"
60561     };
60562     var resolvedItem = {
60563       id: "resolved",
60564       count: 0,
60565       iconID: "iD-icon-apply",
60566       descriptionID: "issues.user_resolved_issues"
60567     };
60568     function update(selection2) {
60569       var shownItems = [];
60570       var liveIssues = context.validator().getIssues({
60571         what: corePreferences("validate-what") || "edited",
60572         where: corePreferences("validate-where") || "all"
60573       });
60574       if (liveIssues.length) {
60575         warningsItem.count = liveIssues.length;
60576         shownItems.push(warningsItem);
60577       }
60578       if (corePreferences("validate-what") === "all") {
60579         var resolvedIssues = context.validator().getResolvedIssues();
60580         if (resolvedIssues.length) {
60581           resolvedItem.count = resolvedIssues.length;
60582           shownItems.push(resolvedItem);
60583         }
60584       }
60585       var chips = selection2.selectAll(".chip").data(shownItems, function(d2) {
60586         return d2.id;
60587       });
60588       chips.exit().remove();
60589       var enter = chips.enter().append("a").attr("class", function(d2) {
60590         return "chip " + d2.id + "-count";
60591       }).attr("href", "#").each(function(d2) {
60592         var chipSelection = select_default2(this);
60593         var tooltipBehavior = uiTooltip().placement("top").title(() => _t.append(d2.descriptionID));
60594         chipSelection.call(tooltipBehavior).on("click", function(d3_event) {
60595           d3_event.preventDefault();
60596           tooltipBehavior.hide(select_default2(this));
60597           context.ui().togglePanes(context.container().select(".map-panes .issues-pane"));
60598         });
60599         chipSelection.call(svgIcon("#" + d2.iconID));
60600       });
60601       enter.append("span").attr("class", "count");
60602       enter.merge(chips).selectAll("span.count").text(function(d2) {
60603         return d2.count.toString();
60604       });
60605     }
60606     return function(selection2) {
60607       update(selection2);
60608       context.validator().on("validated.infobox", function() {
60609         update(selection2);
60610       });
60611     };
60612   }
60613
60614   // modules/ui/map_in_map.js
60615   function uiMapInMap(context) {
60616     function mapInMap(selection2) {
60617       var backgroundLayer = rendererTileLayer(context);
60618       var overlayLayers = {};
60619       var projection2 = geoRawMercator();
60620       var dataLayer = svgData(projection2, context).showLabels(false);
60621       var debugLayer = svgDebug(projection2, context);
60622       var zoom = zoom_default2().scaleExtent([geoZoomToScale(0.5), geoZoomToScale(24)]).on("start", zoomStarted).on("zoom", zoomed).on("end", zoomEnded);
60623       var wrap2 = select_default2(null);
60624       var tiles = select_default2(null);
60625       var viewport = select_default2(null);
60626       var _isTransformed = false;
60627       var _isHidden = true;
60628       var _skipEvents = false;
60629       var _gesture = null;
60630       var _zDiff = 6;
60631       var _dMini;
60632       var _cMini;
60633       var _tStart;
60634       var _tCurr;
60635       var _timeoutID;
60636       function zoomStarted() {
60637         if (_skipEvents)
60638           return;
60639         _tStart = _tCurr = projection2.transform();
60640         _gesture = null;
60641       }
60642       function zoomed(d3_event) {
60643         if (_skipEvents)
60644           return;
60645         var x2 = d3_event.transform.x;
60646         var y2 = d3_event.transform.y;
60647         var k2 = d3_event.transform.k;
60648         var isZooming = k2 !== _tStart.k;
60649         var isPanning = x2 !== _tStart.x || y2 !== _tStart.y;
60650         if (!isZooming && !isPanning) {
60651           return;
60652         }
60653         if (!_gesture) {
60654           _gesture = isZooming ? "zoom" : "pan";
60655         }
60656         var tMini = projection2.transform();
60657         var tX, tY, scale;
60658         if (_gesture === "zoom") {
60659           scale = k2 / tMini.k;
60660           tX = (_cMini[0] / scale - _cMini[0]) * scale;
60661           tY = (_cMini[1] / scale - _cMini[1]) * scale;
60662         } else {
60663           k2 = tMini.k;
60664           scale = 1;
60665           tX = x2 - tMini.x;
60666           tY = y2 - tMini.y;
60667         }
60668         utilSetTransform(tiles, tX, tY, scale);
60669         utilSetTransform(viewport, 0, 0, scale);
60670         _isTransformed = true;
60671         _tCurr = identity2.translate(x2, y2).scale(k2);
60672         var zMain = geoScaleToZoom(context.projection.scale());
60673         var zMini = geoScaleToZoom(k2);
60674         _zDiff = zMain - zMini;
60675         queueRedraw();
60676       }
60677       function zoomEnded() {
60678         if (_skipEvents)
60679           return;
60680         if (_gesture !== "pan")
60681           return;
60682         updateProjection();
60683         _gesture = null;
60684         context.map().center(projection2.invert(_cMini));
60685       }
60686       function updateProjection() {
60687         var loc = context.map().center();
60688         var tMain = context.projection.transform();
60689         var zMain = geoScaleToZoom(tMain.k);
60690         var zMini = Math.max(zMain - _zDiff, 0.5);
60691         var kMini = geoZoomToScale(zMini);
60692         projection2.translate([tMain.x, tMain.y]).scale(kMini);
60693         var point2 = projection2(loc);
60694         var mouse = _gesture === "pan" ? geoVecSubtract([_tCurr.x, _tCurr.y], [_tStart.x, _tStart.y]) : [0, 0];
60695         var xMini = _cMini[0] - point2[0] + tMain.x + mouse[0];
60696         var yMini = _cMini[1] - point2[1] + tMain.y + mouse[1];
60697         projection2.translate([xMini, yMini]).clipExtent([[0, 0], _dMini]);
60698         _tCurr = projection2.transform();
60699         if (_isTransformed) {
60700           utilSetTransform(tiles, 0, 0);
60701           utilSetTransform(viewport, 0, 0);
60702           _isTransformed = false;
60703         }
60704         zoom.scaleExtent([geoZoomToScale(0.5), geoZoomToScale(zMain - 3)]);
60705         _skipEvents = true;
60706         wrap2.call(zoom.transform, _tCurr);
60707         _skipEvents = false;
60708       }
60709       function redraw() {
60710         clearTimeout(_timeoutID);
60711         if (_isHidden)
60712           return;
60713         updateProjection();
60714         var zMini = geoScaleToZoom(projection2.scale());
60715         tiles = wrap2.selectAll(".map-in-map-tiles").data([0]);
60716         tiles = tiles.enter().append("div").attr("class", "map-in-map-tiles").merge(tiles);
60717         backgroundLayer.source(context.background().baseLayerSource()).projection(projection2).dimensions(_dMini);
60718         var background = tiles.selectAll(".map-in-map-background").data([0]);
60719         background.enter().append("div").attr("class", "map-in-map-background").merge(background).call(backgroundLayer);
60720         var overlaySources = context.background().overlayLayerSources();
60721         var activeOverlayLayers = [];
60722         for (var i3 = 0; i3 < overlaySources.length; i3++) {
60723           if (overlaySources[i3].validZoom(zMini)) {
60724             if (!overlayLayers[i3])
60725               overlayLayers[i3] = rendererTileLayer(context);
60726             activeOverlayLayers.push(overlayLayers[i3].source(overlaySources[i3]).projection(projection2).dimensions(_dMini));
60727           }
60728         }
60729         var overlay = tiles.selectAll(".map-in-map-overlay").data([0]);
60730         overlay = overlay.enter().append("div").attr("class", "map-in-map-overlay").merge(overlay);
60731         var overlays = overlay.selectAll("div").data(activeOverlayLayers, function(d2) {
60732           return d2.source().name();
60733         });
60734         overlays.exit().remove();
60735         overlays = overlays.enter().append("div").merge(overlays).each(function(layer) {
60736           select_default2(this).call(layer);
60737         });
60738         var dataLayers = tiles.selectAll(".map-in-map-data").data([0]);
60739         dataLayers.exit().remove();
60740         dataLayers = dataLayers.enter().append("svg").attr("class", "map-in-map-data").merge(dataLayers).call(dataLayer).call(debugLayer);
60741         if (_gesture !== "pan") {
60742           var getPath = path_default(projection2);
60743           var bbox2 = { type: "Polygon", coordinates: [context.map().extent().polygon()] };
60744           viewport = wrap2.selectAll(".map-in-map-viewport").data([0]);
60745           viewport = viewport.enter().append("svg").attr("class", "map-in-map-viewport").merge(viewport);
60746           var path = viewport.selectAll(".map-in-map-bbox").data([bbox2]);
60747           path.enter().append("path").attr("class", "map-in-map-bbox").merge(path).attr("d", getPath).classed("thick", function(d2) {
60748             return getPath.area(d2) < 30;
60749           });
60750         }
60751       }
60752       function queueRedraw() {
60753         clearTimeout(_timeoutID);
60754         _timeoutID = setTimeout(function() {
60755           redraw();
60756         }, 750);
60757       }
60758       function toggle(d3_event) {
60759         if (d3_event)
60760           d3_event.preventDefault();
60761         _isHidden = !_isHidden;
60762         context.container().select(".minimap-toggle-item").classed("active", !_isHidden).select("input").property("checked", !_isHidden);
60763         if (_isHidden) {
60764           wrap2.style("display", "block").style("opacity", "1").transition().duration(200).style("opacity", "0").on("end", function() {
60765             selection2.selectAll(".map-in-map").style("display", "none");
60766           });
60767         } else {
60768           wrap2.style("display", "block").style("opacity", "0").transition().duration(200).style("opacity", "1").on("end", function() {
60769             redraw();
60770           });
60771         }
60772       }
60773       uiMapInMap.toggle = toggle;
60774       wrap2 = selection2.selectAll(".map-in-map").data([0]);
60775       wrap2 = wrap2.enter().append("div").attr("class", "map-in-map").style("display", _isHidden ? "none" : "block").call(zoom).on("dblclick.zoom", null).merge(wrap2);
60776       _dMini = [200, 150];
60777       _cMini = geoVecScale(_dMini, 0.5);
60778       context.map().on("drawn.map-in-map", function(drawn) {
60779         if (drawn.full === true) {
60780           redraw();
60781         }
60782       });
60783       redraw();
60784       context.keybinding().on(_t("background.minimap.key"), toggle);
60785     }
60786     return mapInMap;
60787   }
60788
60789   // modules/ui/notice.js
60790   function uiNotice(context) {
60791     return function(selection2) {
60792       var div = selection2.append("div").attr("class", "notice");
60793       var button = div.append("button").attr("class", "zoom-to notice fillD").on("click", function() {
60794         context.map().zoomEase(context.minEditableZoom());
60795       }).on("wheel", function(d3_event) {
60796         var e22 = new WheelEvent(d3_event.type, d3_event);
60797         context.surface().node().dispatchEvent(e22);
60798       });
60799       button.call(svgIcon("#iD-icon-plus", "pre-text")).append("span").attr("class", "label").call(_t.append("zoom_in_edit"));
60800       function disableTooHigh() {
60801         var canEdit = context.map().zoom() >= context.minEditableZoom();
60802         div.style("display", canEdit ? "none" : "block");
60803       }
60804       context.map().on("move.notice", debounce_default(disableTooHigh, 500));
60805       disableTooHigh();
60806     };
60807   }
60808
60809   // modules/ui/photoviewer.js
60810   function uiPhotoviewer(context) {
60811     var dispatch14 = dispatch_default("resize");
60812     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
60813     function photoviewer(selection2) {
60814       selection2.append("button").attr("class", "thumb-hide").attr("title", _t("icons.close")).on("click", function() {
60815         if (services.streetside) {
60816           services.streetside.hideViewer(context);
60817         }
60818         if (services.mapillary) {
60819           services.mapillary.hideViewer(context);
60820         }
60821         if (services.kartaview) {
60822           services.kartaview.hideViewer(context);
60823         }
60824         if (services.mapilio) {
60825           services.mapilio.hideViewer(context);
60826         }
60827         if (services.vegbilder) {
60828           services.vegbilder.hideViewer(context);
60829         }
60830       }).append("div").call(svgIcon("#iD-icon-close"));
60831       function preventDefault(d3_event) {
60832         d3_event.preventDefault();
60833       }
60834       selection2.append("button").attr("class", "resize-handle-xy").on("touchstart touchdown touchend", preventDefault).on(
60835         _pointerPrefix + "down",
60836         buildResizeListener(selection2, "resize", dispatch14, { resizeOnX: true, resizeOnY: true })
60837       );
60838       selection2.append("button").attr("class", "resize-handle-x").on("touchstart touchdown touchend", preventDefault).on(
60839         _pointerPrefix + "down",
60840         buildResizeListener(selection2, "resize", dispatch14, { resizeOnX: true })
60841       );
60842       selection2.append("button").attr("class", "resize-handle-y").on("touchstart touchdown touchend", preventDefault).on(
60843         _pointerPrefix + "down",
60844         buildResizeListener(selection2, "resize", dispatch14, { resizeOnY: true })
60845       );
60846       function buildResizeListener(target, eventName, dispatch15, options2) {
60847         var resizeOnX = !!options2.resizeOnX;
60848         var resizeOnY = !!options2.resizeOnY;
60849         var minHeight = options2.minHeight || 240;
60850         var minWidth = options2.minWidth || 320;
60851         var pointerId;
60852         var startX;
60853         var startY;
60854         var startWidth;
60855         var startHeight;
60856         function startResize(d3_event) {
60857           if (pointerId !== (d3_event.pointerId || "mouse"))
60858             return;
60859           d3_event.preventDefault();
60860           d3_event.stopPropagation();
60861           var mapSize = context.map().dimensions();
60862           if (resizeOnX) {
60863             var maxWidth = mapSize[0];
60864             var newWidth = clamp3(startWidth + d3_event.clientX - startX, minWidth, maxWidth);
60865             target.style("width", newWidth + "px");
60866           }
60867           if (resizeOnY) {
60868             var maxHeight = mapSize[1] - 90;
60869             var newHeight = clamp3(startHeight + startY - d3_event.clientY, minHeight, maxHeight);
60870             target.style("height", newHeight + "px");
60871           }
60872           dispatch15.call(eventName, target, subtractPadding(utilGetDimensions(target, true), target));
60873         }
60874         function clamp3(num, min3, max3) {
60875           return Math.max(min3, Math.min(num, max3));
60876         }
60877         function stopResize(d3_event) {
60878           if (pointerId !== (d3_event.pointerId || "mouse"))
60879             return;
60880           d3_event.preventDefault();
60881           d3_event.stopPropagation();
60882           select_default2(window).on("." + eventName, null);
60883         }
60884         return function initResize(d3_event) {
60885           d3_event.preventDefault();
60886           d3_event.stopPropagation();
60887           pointerId = d3_event.pointerId || "mouse";
60888           startX = d3_event.clientX;
60889           startY = d3_event.clientY;
60890           var targetRect = target.node().getBoundingClientRect();
60891           startWidth = targetRect.width;
60892           startHeight = targetRect.height;
60893           select_default2(window).on(_pointerPrefix + "move." + eventName, startResize, false).on(_pointerPrefix + "up." + eventName, stopResize, false);
60894           if (_pointerPrefix === "pointer") {
60895             select_default2(window).on("pointercancel." + eventName, stopResize, false);
60896           }
60897         };
60898       }
60899     }
60900     photoviewer.onMapResize = function() {
60901       var photoviewer2 = context.container().select(".photoviewer");
60902       var content = context.container().select(".main-content");
60903       var mapDimensions = utilGetDimensions(content, true);
60904       var photoDimensions = utilGetDimensions(photoviewer2, true);
60905       if (photoDimensions[0] > mapDimensions[0] || photoDimensions[1] > mapDimensions[1] - 90) {
60906         var setPhotoDimensions = [
60907           Math.min(photoDimensions[0], mapDimensions[0]),
60908           Math.min(photoDimensions[1], mapDimensions[1] - 90)
60909         ];
60910         photoviewer2.style("width", setPhotoDimensions[0] + "px").style("height", setPhotoDimensions[1] + "px");
60911         dispatch14.call("resize", photoviewer2, subtractPadding(setPhotoDimensions, photoviewer2));
60912       }
60913     };
60914     function subtractPadding(dimensions, selection2) {
60915       return [
60916         dimensions[0] - parseFloat(selection2.style("padding-left")) - parseFloat(selection2.style("padding-right")),
60917         dimensions[1] - parseFloat(selection2.style("padding-top")) - parseFloat(selection2.style("padding-bottom"))
60918       ];
60919     }
60920     return utilRebind(photoviewer, dispatch14, "on");
60921   }
60922
60923   // modules/ui/restore.js
60924   function uiRestore(context) {
60925     return function(selection2) {
60926       if (!context.history().hasRestorableChanges())
60927         return;
60928       let modalSelection = uiModal(selection2, true);
60929       modalSelection.select(".modal").attr("class", "modal fillL");
60930       let introModal = modalSelection.select(".content");
60931       introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("restore.heading"));
60932       introModal.append("div").attr("class", "modal-section").append("p").call(_t.append("restore.description"));
60933       let buttonWrap = introModal.append("div").attr("class", "modal-actions");
60934       let restore = buttonWrap.append("button").attr("class", "restore").on("click", () => {
60935         context.history().restore();
60936         modalSelection.remove();
60937       });
60938       restore.append("svg").attr("class", "logo logo-restore").append("use").attr("xlink:href", "#iD-logo-restore");
60939       restore.append("div").call(_t.append("restore.restore"));
60940       let reset = buttonWrap.append("button").attr("class", "reset").on("click", () => {
60941         context.history().clearSaved();
60942         modalSelection.remove();
60943       });
60944       reset.append("svg").attr("class", "logo logo-reset").append("use").attr("xlink:href", "#iD-logo-reset");
60945       reset.append("div").call(_t.append("restore.reset"));
60946       restore.node().focus();
60947     };
60948   }
60949
60950   // modules/ui/scale.js
60951   function uiScale(context) {
60952     var projection2 = context.projection, isImperial = !_mainLocalizer.usesMetric(), maxLength = 180, tickHeight = 8;
60953     function scaleDefs(loc1, loc2) {
60954       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;
60955       if (isImperial) {
60956         buckets = [528e4, 528e3, 52800, 5280, 500, 50, 5, 1];
60957       } else {
60958         buckets = [5e6, 5e5, 5e4, 5e3, 500, 50, 5, 1];
60959       }
60960       for (i3 = 0; i3 < buckets.length; i3++) {
60961         val = buckets[i3];
60962         if (dist >= val) {
60963           scale.dist = Math.floor(dist / val) * val;
60964           break;
60965         } else {
60966           scale.dist = +dist.toFixed(2);
60967         }
60968       }
60969       dLon = geoMetersToLon(scale.dist / conversion, lat);
60970       scale.px = Math.round(projection2([loc1[0] + dLon, loc1[1]])[0]);
60971       scale.text = displayLength(scale.dist / conversion, isImperial);
60972       return scale;
60973     }
60974     function update(selection2) {
60975       var dims = context.map().dimensions(), loc1 = projection2.invert([0, dims[1]]), loc2 = projection2.invert([maxLength, dims[1]]), scale = scaleDefs(loc1, loc2);
60976       selection2.select(".scale-path").attr("d", "M0.5,0.5v" + tickHeight + "h" + scale.px + "v-" + tickHeight);
60977       selection2.select(".scale-text").style(_mainLocalizer.textDirection() === "ltr" ? "left" : "right", scale.px + 16 + "px").text(scale.text);
60978     }
60979     return function(selection2) {
60980       function switchUnits() {
60981         isImperial = !isImperial;
60982         selection2.call(update);
60983       }
60984       var scalegroup = selection2.append("svg").attr("class", "scale").on("click", switchUnits).append("g").attr("transform", "translate(10,11)");
60985       scalegroup.append("path").attr("class", "scale-path");
60986       selection2.append("div").attr("class", "scale-text");
60987       selection2.call(update);
60988       context.map().on("move.scale", function() {
60989         update(selection2);
60990       });
60991     };
60992   }
60993
60994   // modules/ui/shortcuts.js
60995   function uiShortcuts(context) {
60996     var detected = utilDetect();
60997     var _activeTab = 0;
60998     var _modalSelection;
60999     var _selection = select_default2(null);
61000     var _dataShortcuts;
61001     function shortcutsModal(_modalSelection2) {
61002       _modalSelection2.select(".modal").classed("modal-shortcuts", true);
61003       var content = _modalSelection2.select(".content");
61004       content.append("div").attr("class", "modal-section header").append("h2").call(_t.append("shortcuts.title"));
61005       _mainFileFetcher.get("shortcuts").then(function(data) {
61006         _dataShortcuts = data;
61007         content.call(render);
61008       }).catch(function() {
61009       });
61010     }
61011     function render(selection2) {
61012       if (!_dataShortcuts)
61013         return;
61014       var wrapper = selection2.selectAll(".wrapper").data([0]);
61015       var wrapperEnter = wrapper.enter().append("div").attr("class", "wrapper modal-section");
61016       var tabsBar = wrapperEnter.append("div").attr("class", "tabs-bar");
61017       var shortcutsList = wrapperEnter.append("div").attr("class", "shortcuts-list");
61018       wrapper = wrapper.merge(wrapperEnter);
61019       var tabs = tabsBar.selectAll(".tab").data(_dataShortcuts);
61020       var tabsEnter = tabs.enter().append("a").attr("class", "tab").attr("href", "#").on("click", function(d3_event, d2) {
61021         d3_event.preventDefault();
61022         var i3 = _dataShortcuts.indexOf(d2);
61023         _activeTab = i3;
61024         render(selection2);
61025       });
61026       tabsEnter.append("span").html(function(d2) {
61027         return _t.html(d2.text);
61028       });
61029       wrapper.selectAll(".tab").classed("active", function(d2, i3) {
61030         return i3 === _activeTab;
61031       });
61032       var shortcuts = shortcutsList.selectAll(".shortcut-tab").data(_dataShortcuts);
61033       var shortcutsEnter = shortcuts.enter().append("div").attr("class", function(d2) {
61034         return "shortcut-tab shortcut-tab-" + d2.tab;
61035       });
61036       var columnsEnter = shortcutsEnter.selectAll(".shortcut-column").data(function(d2) {
61037         return d2.columns;
61038       }).enter().append("table").attr("class", "shortcut-column");
61039       var rowsEnter = columnsEnter.selectAll(".shortcut-row").data(function(d2) {
61040         return d2.rows;
61041       }).enter().append("tr").attr("class", "shortcut-row");
61042       var sectionRows = rowsEnter.filter(function(d2) {
61043         return !d2.shortcuts;
61044       });
61045       sectionRows.append("td");
61046       sectionRows.append("td").attr("class", "shortcut-section").append("h3").html(function(d2) {
61047         return _t.html(d2.text);
61048       });
61049       var shortcutRows = rowsEnter.filter(function(d2) {
61050         return d2.shortcuts;
61051       });
61052       var shortcutKeys = shortcutRows.append("td").attr("class", "shortcut-keys");
61053       var modifierKeys = shortcutKeys.filter(function(d2) {
61054         return d2.modifiers;
61055       });
61056       modifierKeys.selectAll("kbd.modifier").data(function(d2) {
61057         if (detected.os === "win" && d2.text === "shortcuts.editing.commands.redo") {
61058           return ["\u2318"];
61059         } else if (detected.os !== "mac" && d2.text === "shortcuts.browsing.display_options.fullscreen") {
61060           return [];
61061         } else {
61062           return d2.modifiers;
61063         }
61064       }).enter().each(function() {
61065         var selection3 = select_default2(this);
61066         selection3.append("kbd").attr("class", "modifier").text(function(d2) {
61067           return uiCmd.display(d2);
61068         });
61069         selection3.append("span").text("+");
61070       });
61071       shortcutKeys.selectAll("kbd.shortcut").data(function(d2) {
61072         var arr = d2.shortcuts;
61073         if (detected.os === "win" && d2.text === "shortcuts.editing.commands.redo") {
61074           arr = ["Y"];
61075         } else if (detected.os !== "mac" && d2.text === "shortcuts.browsing.display_options.fullscreen") {
61076           arr = ["F11"];
61077         }
61078         arr = arr.map(function(s2) {
61079           return uiCmd.display(s2.indexOf(".") !== -1 ? _t(s2) : s2);
61080         });
61081         return utilArrayUniq(arr).map(function(s2) {
61082           return {
61083             shortcut: s2,
61084             separator: d2.separator,
61085             suffix: d2.suffix
61086           };
61087         });
61088       }).enter().each(function(d2, i3, nodes) {
61089         var selection3 = select_default2(this);
61090         var click = d2.shortcut.toLowerCase().match(/(.*).click/);
61091         if (click && click[1]) {
61092           selection3.call(svgIcon("#iD-walkthrough-mouse-" + click[1], "operation"));
61093         } else if (d2.shortcut.toLowerCase() === "long-press") {
61094           selection3.call(svgIcon("#iD-walkthrough-longpress", "longpress operation"));
61095         } else if (d2.shortcut.toLowerCase() === "tap") {
61096           selection3.call(svgIcon("#iD-walkthrough-tap", "tap operation"));
61097         } else {
61098           selection3.append("kbd").attr("class", "shortcut").text(function(d4) {
61099             return d4.shortcut;
61100           });
61101         }
61102         if (i3 < nodes.length - 1) {
61103           selection3.append("span").html(d2.separator || "\xA0" + _t.html("shortcuts.or") + "\xA0");
61104         } else if (i3 === nodes.length - 1 && d2.suffix) {
61105           selection3.append("span").text(d2.suffix);
61106         }
61107       });
61108       shortcutKeys.filter(function(d2) {
61109         return d2.gesture;
61110       }).each(function() {
61111         var selection3 = select_default2(this);
61112         selection3.append("span").text("+");
61113         selection3.append("span").attr("class", "gesture").html(function(d2) {
61114           return _t.html(d2.gesture);
61115         });
61116       });
61117       shortcutRows.append("td").attr("class", "shortcut-desc").html(function(d2) {
61118         return d2.text ? _t.html(d2.text) : "\xA0";
61119       });
61120       wrapper.selectAll(".shortcut-tab").style("display", function(d2, i3) {
61121         return i3 === _activeTab ? "flex" : "none";
61122       });
61123     }
61124     return function(selection2, show) {
61125       _selection = selection2;
61126       if (show) {
61127         _modalSelection = uiModal(selection2);
61128         _modalSelection.call(shortcutsModal);
61129       } else {
61130         context.keybinding().on([_t("shortcuts.toggle.key"), "?"], function() {
61131           if (context.container().selectAll(".modal-shortcuts").size()) {
61132             if (_modalSelection) {
61133               _modalSelection.close();
61134               _modalSelection = null;
61135             }
61136           } else {
61137             _modalSelection = uiModal(_selection);
61138             _modalSelection.call(shortcutsModal);
61139           }
61140         });
61141       }
61142     };
61143   }
61144
61145   // modules/ui/data_header.js
61146   function uiDataHeader() {
61147     var _datum;
61148     function dataHeader(selection2) {
61149       var header = selection2.selectAll(".data-header").data(
61150         _datum ? [_datum] : [],
61151         function(d2) {
61152           return d2.__featurehash__;
61153         }
61154       );
61155       header.exit().remove();
61156       var headerEnter = header.enter().append("div").attr("class", "data-header");
61157       var iconEnter = headerEnter.append("div").attr("class", "data-header-icon");
61158       iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-data", "note-fill"));
61159       headerEnter.append("div").attr("class", "data-header-label").call(_t.append("map_data.layers.custom.title"));
61160     }
61161     dataHeader.datum = function(val) {
61162       if (!arguments.length)
61163         return _datum;
61164       _datum = val;
61165       return this;
61166     };
61167     return dataHeader;
61168   }
61169
61170   // modules/ui/combobox.js
61171   var _comboHideTimerID;
61172   function uiCombobox(context, klass) {
61173     var dispatch14 = dispatch_default("accept", "cancel", "update");
61174     var container = context.container();
61175     var _suggestions = [];
61176     var _data = [];
61177     var _fetched = {};
61178     var _selected = null;
61179     var _canAutocomplete = true;
61180     var _caseSensitive = false;
61181     var _cancelFetch = false;
61182     var _minItems = 2;
61183     var _tDown = 0;
61184     var _mouseEnterHandler, _mouseLeaveHandler;
61185     var _fetcher = function(val, cb) {
61186       cb(_data.filter(function(d2) {
61187         var terms = d2.terms || [];
61188         terms.push(d2.value);
61189         if (d2.key) {
61190           terms.push(d2.key);
61191         }
61192         return terms.some(function(term) {
61193           return term.toString().toLowerCase().indexOf(val.toLowerCase()) !== -1;
61194         });
61195       }));
61196     };
61197     var combobox = function(input, attachTo) {
61198       if (!input || input.empty())
61199         return;
61200       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() {
61201         var parent = this.parentNode;
61202         var sibling = this.nextSibling;
61203         select_default2(parent).selectAll(".combobox-caret").filter(function(d2) {
61204           return d2 === input.node();
61205         }).data([input.node()]).enter().insert("div", function() {
61206           return sibling;
61207         }).attr("class", "combobox-caret").on("mousedown.combo-caret", function(d3_event) {
61208           d3_event.preventDefault();
61209           input.node().focus();
61210           mousedown(d3_event);
61211         }).on("mouseup.combo-caret", function(d3_event) {
61212           d3_event.preventDefault();
61213           mouseup(d3_event);
61214         });
61215       });
61216       function mousedown(d3_event) {
61217         if (d3_event.button !== 0)
61218           return;
61219         if (input.classed("disabled"))
61220           return;
61221         _tDown = +/* @__PURE__ */ new Date();
61222         var start2 = input.property("selectionStart");
61223         var end = input.property("selectionEnd");
61224         if (start2 !== end) {
61225           var val = utilGetSetValue(input);
61226           input.node().setSelectionRange(val.length, val.length);
61227           return;
61228         }
61229         input.on("mouseup.combo-input", mouseup);
61230       }
61231       function mouseup(d3_event) {
61232         input.on("mouseup.combo-input", null);
61233         if (d3_event.button !== 0)
61234           return;
61235         if (input.classed("disabled"))
61236           return;
61237         if (input.node() !== document.activeElement)
61238           return;
61239         var start2 = input.property("selectionStart");
61240         var end = input.property("selectionEnd");
61241         if (start2 !== end)
61242           return;
61243         var combo = container.selectAll(".combobox");
61244         if (combo.empty() || combo.datum() !== input.node()) {
61245           var tOrig = _tDown;
61246           window.setTimeout(function() {
61247             if (tOrig !== _tDown)
61248               return;
61249             fetchComboData("", function() {
61250               show();
61251               render();
61252             });
61253           }, 250);
61254         } else {
61255           hide();
61256         }
61257       }
61258       function focus() {
61259         fetchComboData("");
61260       }
61261       function blur() {
61262         _comboHideTimerID = window.setTimeout(hide, 75);
61263       }
61264       function show() {
61265         hide();
61266         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) {
61267           d3_event.preventDefault();
61268         });
61269         container.on("scroll.combo-scroll", render, true);
61270       }
61271       function hide() {
61272         if (_comboHideTimerID) {
61273           window.clearTimeout(_comboHideTimerID);
61274           _comboHideTimerID = void 0;
61275         }
61276         container.selectAll(".combobox").remove();
61277         container.on("scroll.combo-scroll", null);
61278       }
61279       function keydown(d3_event) {
61280         var shown = !container.selectAll(".combobox").empty();
61281         var tagName = input.node() ? input.node().tagName.toLowerCase() : "";
61282         switch (d3_event.keyCode) {
61283           case 8:
61284           case 46:
61285             d3_event.stopPropagation();
61286             _selected = null;
61287             render();
61288             input.on("input.combo-input", function() {
61289               var start2 = input.property("selectionStart");
61290               input.node().setSelectionRange(start2, start2);
61291               input.on("input.combo-input", change);
61292               change(false);
61293             });
61294             break;
61295           case 9:
61296             accept(d3_event);
61297             break;
61298           case 13:
61299             d3_event.preventDefault();
61300             d3_event.stopPropagation();
61301             accept(d3_event);
61302             break;
61303           case 38:
61304             if (tagName === "textarea" && !shown)
61305               return;
61306             d3_event.preventDefault();
61307             if (tagName === "input" && !shown) {
61308               show();
61309             }
61310             nav(-1);
61311             break;
61312           case 40:
61313             if (tagName === "textarea" && !shown)
61314               return;
61315             d3_event.preventDefault();
61316             if (tagName === "input" && !shown) {
61317               show();
61318             }
61319             nav(1);
61320             break;
61321         }
61322       }
61323       function keyup(d3_event) {
61324         switch (d3_event.keyCode) {
61325           case 27:
61326             cancel();
61327             break;
61328         }
61329       }
61330       function change(doAutoComplete) {
61331         if (doAutoComplete === void 0)
61332           doAutoComplete = true;
61333         fetchComboData(value(), function() {
61334           _selected = null;
61335           var val = input.property("value");
61336           if (_suggestions.length) {
61337             if (doAutoComplete && input.property("selectionEnd") === val.length) {
61338               _selected = tryAutocomplete();
61339             }
61340             if (!_selected) {
61341               _selected = val;
61342             }
61343           }
61344           if (val.length) {
61345             var combo = container.selectAll(".combobox");
61346             if (combo.empty()) {
61347               show();
61348             }
61349           } else {
61350             hide();
61351           }
61352           render();
61353         });
61354       }
61355       function nav(dir) {
61356         if (_suggestions.length) {
61357           var index = -1;
61358           for (var i3 = 0; i3 < _suggestions.length; i3++) {
61359             if (_selected && _suggestions[i3].value === _selected) {
61360               index = i3;
61361               break;
61362             }
61363           }
61364           index = Math.max(Math.min(index + dir, _suggestions.length - 1), 0);
61365           _selected = _suggestions[index].value;
61366           utilGetSetValue(input, _selected);
61367           dispatch14.call("update");
61368         }
61369         render();
61370         ensureVisible();
61371       }
61372       function ensureVisible() {
61373         var combo = container.selectAll(".combobox");
61374         if (combo.empty())
61375           return;
61376         var containerRect = container.node().getBoundingClientRect();
61377         var comboRect = combo.node().getBoundingClientRect();
61378         if (comboRect.bottom > containerRect.bottom) {
61379           var node = attachTo ? attachTo.node() : input.node();
61380           node.scrollIntoView({ behavior: "instant", block: "center" });
61381           render();
61382         }
61383         var selected = combo.selectAll(".combobox-option.selected").node();
61384         if (selected) {
61385           selected.scrollIntoView({ behavior: "smooth", block: "nearest" });
61386         }
61387       }
61388       function value() {
61389         var value2 = input.property("value");
61390         var start2 = input.property("selectionStart");
61391         var end = input.property("selectionEnd");
61392         if (start2 && end) {
61393           value2 = value2.substring(0, start2);
61394         }
61395         return value2;
61396       }
61397       function fetchComboData(v2, cb) {
61398         _cancelFetch = false;
61399         _fetcher.call(input, v2, function(results) {
61400           if (_cancelFetch)
61401             return;
61402           _suggestions = results;
61403           results.forEach(function(d2) {
61404             _fetched[d2.value] = d2;
61405           });
61406           if (cb) {
61407             cb();
61408           }
61409         });
61410       }
61411       function tryAutocomplete() {
61412         if (!_canAutocomplete)
61413           return;
61414         var val = _caseSensitive ? value() : value().toLowerCase();
61415         if (!val)
61416           return;
61417         if (isFinite(val))
61418           return;
61419         const suggestionValues = [];
61420         _suggestions.forEach((s2) => {
61421           suggestionValues.push(s2.value);
61422           if (s2.key && s2.key !== s2.value) {
61423             suggestionValues.push(s2.key);
61424           }
61425         });
61426         var bestIndex = -1;
61427         for (var i3 = 0; i3 < suggestionValues.length; i3++) {
61428           var suggestion = suggestionValues[i3];
61429           var compare = _caseSensitive ? suggestion : suggestion.toLowerCase();
61430           if (compare === val) {
61431             bestIndex = i3;
61432             break;
61433           } else if (bestIndex === -1 && compare.indexOf(val) === 0) {
61434             bestIndex = i3;
61435           }
61436         }
61437         if (bestIndex !== -1) {
61438           var bestVal = suggestionValues[bestIndex];
61439           input.property("value", bestVal);
61440           input.node().setSelectionRange(val.length, bestVal.length);
61441           dispatch14.call("update");
61442           return bestVal;
61443         }
61444       }
61445       function render() {
61446         if (_suggestions.length < _minItems || document.activeElement !== input.node()) {
61447           hide();
61448           return;
61449         }
61450         var shown = !container.selectAll(".combobox").empty();
61451         if (!shown)
61452           return;
61453         var combo = container.selectAll(".combobox");
61454         var options2 = combo.selectAll(".combobox-option").data(_suggestions, function(d2) {
61455           return d2.value;
61456         });
61457         options2.exit().remove();
61458         options2.enter().append("a").attr("class", function(d2) {
61459           return "combobox-option " + (d2.klass || "");
61460         }).attr("title", function(d2) {
61461           return d2.title;
61462         }).each(function(d2) {
61463           if (d2.display) {
61464             d2.display(select_default2(this));
61465           } else {
61466             select_default2(this).text(d2.value);
61467           }
61468         }).on("mouseenter", _mouseEnterHandler).on("mouseleave", _mouseLeaveHandler).merge(options2).classed("selected", function(d2) {
61469           return d2.value === _selected || d2.key === _selected;
61470         }).on("click.combo-option", accept).order();
61471         var node = attachTo ? attachTo.node() : input.node();
61472         var containerRect = container.node().getBoundingClientRect();
61473         var rect = node.getBoundingClientRect();
61474         combo.style("left", rect.left + 5 - containerRect.left + "px").style("width", rect.width - 10 + "px").style("top", rect.height + rect.top - containerRect.top + "px");
61475       }
61476       function accept(d3_event, d2) {
61477         _cancelFetch = true;
61478         var thiz = input.node();
61479         if (d2) {
61480           utilGetSetValue(input, d2.value);
61481           utilTriggerEvent(input, "change");
61482         }
61483         var val = utilGetSetValue(input);
61484         thiz.setSelectionRange(val.length, val.length);
61485         d2 = _fetched[val];
61486         dispatch14.call("accept", thiz, d2, val);
61487         hide();
61488       }
61489       function cancel() {
61490         _cancelFetch = true;
61491         var thiz = input.node();
61492         var val = utilGetSetValue(input);
61493         var start2 = input.property("selectionStart");
61494         var end = input.property("selectionEnd");
61495         val = val.slice(0, start2) + val.slice(end);
61496         utilGetSetValue(input, val);
61497         thiz.setSelectionRange(val.length, val.length);
61498         dispatch14.call("cancel", thiz);
61499         hide();
61500       }
61501     };
61502     combobox.canAutocomplete = function(val) {
61503       if (!arguments.length)
61504         return _canAutocomplete;
61505       _canAutocomplete = val;
61506       return combobox;
61507     };
61508     combobox.caseSensitive = function(val) {
61509       if (!arguments.length)
61510         return _caseSensitive;
61511       _caseSensitive = val;
61512       return combobox;
61513     };
61514     combobox.data = function(val) {
61515       if (!arguments.length)
61516         return _data;
61517       _data = val;
61518       return combobox;
61519     };
61520     combobox.fetcher = function(val) {
61521       if (!arguments.length)
61522         return _fetcher;
61523       _fetcher = val;
61524       return combobox;
61525     };
61526     combobox.minItems = function(val) {
61527       if (!arguments.length)
61528         return _minItems;
61529       _minItems = val;
61530       return combobox;
61531     };
61532     combobox.itemsMouseEnter = function(val) {
61533       if (!arguments.length)
61534         return _mouseEnterHandler;
61535       _mouseEnterHandler = val;
61536       return combobox;
61537     };
61538     combobox.itemsMouseLeave = function(val) {
61539       if (!arguments.length)
61540         return _mouseLeaveHandler;
61541       _mouseLeaveHandler = val;
61542       return combobox;
61543     };
61544     return utilRebind(combobox, dispatch14, "on");
61545   }
61546   uiCombobox.off = function(input, context) {
61547     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);
61548     context.container().on("scroll.combo-scroll", null);
61549   };
61550
61551   // modules/ui/disclosure.js
61552   function uiDisclosure(context, key, expandedDefault) {
61553     var dispatch14 = dispatch_default("toggled");
61554     var _expanded;
61555     var _label = utilFunctor("");
61556     var _updatePreference = true;
61557     var _content = function() {
61558     };
61559     var disclosure = function(selection2) {
61560       if (_expanded === void 0 || _expanded === null) {
61561         var preference = corePreferences("disclosure." + key + ".expanded");
61562         _expanded = preference === null ? !!expandedDefault : preference === "true";
61563       }
61564       var hideToggle = selection2.selectAll(".hide-toggle-" + key).data([0]);
61565       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"));
61566       hideToggleEnter.append("span").attr("class", "hide-toggle-text");
61567       hideToggle = hideToggleEnter.merge(hideToggle);
61568       hideToggle.on("click", toggle).attr("title", _t(`icons.${_expanded ? "collapse" : "expand"}`)).attr("aria-expanded", _expanded).classed("expanded", _expanded);
61569       const label = _label();
61570       const labelSelection = hideToggle.selectAll(".hide-toggle-text");
61571       if (typeof label !== "function") {
61572         labelSelection.text(_label());
61573       } else {
61574         labelSelection.text("").call(label);
61575       }
61576       hideToggle.selectAll(".hide-toggle-icon").attr(
61577         "xlink:href",
61578         _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward"
61579       );
61580       var wrap2 = selection2.selectAll(".disclosure-wrap").data([0]);
61581       wrap2 = wrap2.enter().append("div").attr("class", "disclosure-wrap disclosure-wrap-" + key).merge(wrap2).classed("hide", !_expanded);
61582       if (_expanded) {
61583         wrap2.call(_content);
61584       }
61585       function toggle(d3_event) {
61586         d3_event.preventDefault();
61587         _expanded = !_expanded;
61588         if (_updatePreference) {
61589           corePreferences("disclosure." + key + ".expanded", _expanded);
61590         }
61591         hideToggle.classed("expanded", _expanded).attr("aria-expanded", _expanded).attr("title", _t(`icons.${_expanded ? "collapse" : "expand"}`));
61592         hideToggle.selectAll(".hide-toggle-icon").attr(
61593           "xlink:href",
61594           _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward"
61595         );
61596         wrap2.call(uiToggle(_expanded));
61597         if (_expanded) {
61598           wrap2.call(_content);
61599         }
61600         dispatch14.call("toggled", this, _expanded);
61601       }
61602     };
61603     disclosure.label = function(val) {
61604       if (!arguments.length)
61605         return _label;
61606       _label = utilFunctor(val);
61607       return disclosure;
61608     };
61609     disclosure.expanded = function(val) {
61610       if (!arguments.length)
61611         return _expanded;
61612       _expanded = val;
61613       return disclosure;
61614     };
61615     disclosure.updatePreference = function(val) {
61616       if (!arguments.length)
61617         return _updatePreference;
61618       _updatePreference = val;
61619       return disclosure;
61620     };
61621     disclosure.content = function(val) {
61622       if (!arguments.length)
61623         return _content;
61624       _content = val;
61625       return disclosure;
61626     };
61627     return utilRebind(disclosure, dispatch14, "on");
61628   }
61629
61630   // modules/ui/section.js
61631   function uiSection(id2, context) {
61632     var _classes = utilFunctor("");
61633     var _shouldDisplay;
61634     var _content;
61635     var _disclosure;
61636     var _label;
61637     var _expandedByDefault = utilFunctor(true);
61638     var _disclosureContent;
61639     var _disclosureExpanded;
61640     var _containerSelection = select_default2(null);
61641     var section = {
61642       id: id2
61643     };
61644     section.classes = function(val) {
61645       if (!arguments.length)
61646         return _classes;
61647       _classes = utilFunctor(val);
61648       return section;
61649     };
61650     section.label = function(val) {
61651       if (!arguments.length)
61652         return _label;
61653       _label = utilFunctor(val);
61654       return section;
61655     };
61656     section.expandedByDefault = function(val) {
61657       if (!arguments.length)
61658         return _expandedByDefault;
61659       _expandedByDefault = utilFunctor(val);
61660       return section;
61661     };
61662     section.shouldDisplay = function(val) {
61663       if (!arguments.length)
61664         return _shouldDisplay;
61665       _shouldDisplay = utilFunctor(val);
61666       return section;
61667     };
61668     section.content = function(val) {
61669       if (!arguments.length)
61670         return _content;
61671       _content = val;
61672       return section;
61673     };
61674     section.disclosureContent = function(val) {
61675       if (!arguments.length)
61676         return _disclosureContent;
61677       _disclosureContent = val;
61678       return section;
61679     };
61680     section.disclosureExpanded = function(val) {
61681       if (!arguments.length)
61682         return _disclosureExpanded;
61683       _disclosureExpanded = val;
61684       return section;
61685     };
61686     section.render = function(selection2) {
61687       _containerSelection = selection2.selectAll(".section-" + id2).data([0]);
61688       var sectionEnter = _containerSelection.enter().append("div").attr("class", "section section-" + id2 + " " + (_classes && _classes() || ""));
61689       _containerSelection = sectionEnter.merge(_containerSelection);
61690       _containerSelection.call(renderContent);
61691     };
61692     section.reRender = function() {
61693       _containerSelection.call(renderContent);
61694     };
61695     section.selection = function() {
61696       return _containerSelection;
61697     };
61698     section.disclosure = function() {
61699       return _disclosure;
61700     };
61701     function renderContent(selection2) {
61702       if (_shouldDisplay) {
61703         var shouldDisplay = _shouldDisplay();
61704         selection2.classed("hide", !shouldDisplay);
61705         if (!shouldDisplay) {
61706           selection2.html("");
61707           return;
61708         }
61709       }
61710       if (_disclosureContent) {
61711         if (!_disclosure) {
61712           _disclosure = uiDisclosure(context, id2.replace(/-/g, "_"), _expandedByDefault()).label(_label || "").content(_disclosureContent);
61713         }
61714         if (_disclosureExpanded !== void 0) {
61715           _disclosure.expanded(_disclosureExpanded);
61716           _disclosureExpanded = void 0;
61717         }
61718         selection2.call(_disclosure);
61719         return;
61720       }
61721       if (_content) {
61722         selection2.call(_content);
61723       }
61724     }
61725     return section;
61726   }
61727
61728   // modules/ui/tag_reference.js
61729   function uiTagReference(what) {
61730     var wikibase = what.qid ? services.wikidata : services.osmWikibase;
61731     var tagReference = {};
61732     var _button = select_default2(null);
61733     var _body = select_default2(null);
61734     var _loaded;
61735     var _showing;
61736     function load() {
61737       if (!wikibase)
61738         return;
61739       _button.classed("tag-reference-loading", true);
61740       wikibase.getDocs(what, gotDocs);
61741     }
61742     function gotDocs(err, docs) {
61743       _body.html("");
61744       if (!docs || !docs.title) {
61745         _body.append("p").attr("class", "tag-reference-description").call(_t.append("inspector.no_documentation_key"));
61746         done();
61747         return;
61748       }
61749       if (docs.imageURL) {
61750         _body.append("img").attr("class", "tag-reference-wiki-image").attr("alt", docs.description).attr("src", docs.imageURL).on("load", function() {
61751           done();
61752         }).on("error", function() {
61753           select_default2(this).remove();
61754           done();
61755         });
61756       } else {
61757         done();
61758       }
61759       var tagReferenceDescription = _body.append("p").attr("class", "tag-reference-description").append("span");
61760       if (docs.description) {
61761         tagReferenceDescription = tagReferenceDescription.attr("class", "localized-text").attr("lang", docs.descriptionLocaleCode || "und").text(docs.description);
61762       } else {
61763         tagReferenceDescription = tagReferenceDescription.call(_t.append("inspector.no_documentation_key"));
61764       }
61765       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"));
61766       if (docs.wiki) {
61767         _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));
61768       }
61769       if (what.key === "comment") {
61770         _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"));
61771       }
61772     }
61773     function done() {
61774       _loaded = true;
61775       _button.classed("tag-reference-loading", false);
61776       _body.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1");
61777       _showing = true;
61778       _button.selectAll("svg.icon use").each(function() {
61779         var iconUse = select_default2(this);
61780         if (iconUse.attr("href") === "#iD-icon-info") {
61781           iconUse.attr("href", "#iD-icon-info-filled");
61782         }
61783       });
61784     }
61785     function hide() {
61786       _body.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
61787         _body.classed("expanded", false);
61788       });
61789       _showing = false;
61790       _button.selectAll("svg.icon use").each(function() {
61791         var iconUse = select_default2(this);
61792         if (iconUse.attr("href") === "#iD-icon-info-filled") {
61793           iconUse.attr("href", "#iD-icon-info");
61794         }
61795       });
61796     }
61797     tagReference.button = function(selection2, klass, iconName) {
61798       _button = selection2.selectAll(".tag-reference-button").data([0]);
61799       _button = _button.enter().append("button").attr("class", "tag-reference-button " + (klass || "")).attr("title", _t("icons.information")).call(svgIcon("#iD-icon-" + (iconName || "inspect"))).merge(_button);
61800       _button.on("click", function(d3_event) {
61801         d3_event.stopPropagation();
61802         d3_event.preventDefault();
61803         this.blur();
61804         if (_showing) {
61805           hide();
61806         } else if (_loaded) {
61807           done();
61808         } else {
61809           load();
61810         }
61811       });
61812     };
61813     tagReference.body = function(selection2) {
61814       var itemID = what.qid || what.key + "-" + (what.value || "");
61815       _body = selection2.selectAll(".tag-reference-body").data([itemID], function(d2) {
61816         return d2;
61817       });
61818       _body.exit().remove();
61819       _body = _body.enter().append("div").attr("class", "tag-reference-body").style("max-height", "0").style("opacity", "0").merge(_body);
61820       if (_showing === false) {
61821         hide();
61822       }
61823     };
61824     tagReference.showing = function(val) {
61825       if (!arguments.length)
61826         return _showing;
61827       _showing = val;
61828       return tagReference;
61829     };
61830     return tagReference;
61831   }
61832
61833   // modules/ui/field_help.js
61834   function uiFieldHelp(context, fieldName) {
61835     var fieldHelp = {};
61836     var _inspector = select_default2(null);
61837     var _wrap = select_default2(null);
61838     var _body = select_default2(null);
61839     var fieldHelpKeys = {
61840       restrictions: [
61841         ["about", [
61842           "about",
61843           "from_via_to",
61844           "maxdist",
61845           "maxvia"
61846         ]],
61847         ["inspecting", [
61848           "about",
61849           "from_shadow",
61850           "allow_shadow",
61851           "restrict_shadow",
61852           "only_shadow",
61853           "restricted",
61854           "only"
61855         ]],
61856         ["modifying", [
61857           "about",
61858           "indicators",
61859           "allow_turn",
61860           "restrict_turn",
61861           "only_turn"
61862         ]],
61863         ["tips", [
61864           "simple",
61865           "simple_example",
61866           "indirect",
61867           "indirect_example",
61868           "indirect_noedit"
61869         ]]
61870       ]
61871     };
61872     var fieldHelpHeadings = {};
61873     var replacements = {
61874       distField: { html: _t.html("restriction.controls.distance") },
61875       viaField: { html: _t.html("restriction.controls.via") },
61876       fromShadow: { html: icon("#iD-turn-shadow", "inline shadow from") },
61877       allowShadow: { html: icon("#iD-turn-shadow", "inline shadow allow") },
61878       restrictShadow: { html: icon("#iD-turn-shadow", "inline shadow restrict") },
61879       onlyShadow: { html: icon("#iD-turn-shadow", "inline shadow only") },
61880       allowTurn: { html: icon("#iD-turn-yes", "inline turn") },
61881       restrictTurn: { html: icon("#iD-turn-no", "inline turn") },
61882       onlyTurn: { html: icon("#iD-turn-only", "inline turn") }
61883     };
61884     var docs = fieldHelpKeys[fieldName].map(function(key) {
61885       var helpkey = "help.field." + fieldName + "." + key[0];
61886       var text2 = key[1].reduce(function(all, part) {
61887         var subkey = helpkey + "." + part;
61888         var depth = fieldHelpHeadings[subkey];
61889         var hhh = depth ? Array(depth + 1).join("#") + " " : "";
61890         return all + hhh + _t.html(subkey, replacements) + "\n\n";
61891       }, "");
61892       return {
61893         key: helpkey,
61894         title: _t.html(helpkey + ".title"),
61895         html: marked(text2.trim())
61896       };
61897     });
61898     function show() {
61899       updatePosition();
61900       _body.classed("hide", false).style("opacity", "0").transition().duration(200).style("opacity", "1");
61901     }
61902     function hide() {
61903       _body.classed("hide", true).transition().duration(200).style("opacity", "0").on("end", function() {
61904         _body.classed("hide", true);
61905       });
61906     }
61907     function clickHelp(index) {
61908       var d2 = docs[index];
61909       var tkeys = fieldHelpKeys[fieldName][index][1];
61910       _body.selectAll(".field-help-nav-item").classed("active", function(d4, i3) {
61911         return i3 === index;
61912       });
61913       var content = _body.selectAll(".field-help-content").html(d2.html);
61914       content.selectAll("p").attr("class", function(d4, i3) {
61915         return tkeys[i3];
61916       });
61917       if (d2.key === "help.field.restrictions.inspecting") {
61918         content.insert("img", "p.from_shadow").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_inspect.gif"));
61919       } else if (d2.key === "help.field.restrictions.modifying") {
61920         content.insert("img", "p.allow_turn").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_modify.gif"));
61921       }
61922     }
61923     fieldHelp.button = function(selection2) {
61924       if (_body.empty())
61925         return;
61926       var button = selection2.selectAll(".field-help-button").data([0]);
61927       button.enter().append("button").attr("class", "field-help-button").call(svgIcon("#iD-icon-help")).merge(button).on("click", function(d3_event) {
61928         d3_event.stopPropagation();
61929         d3_event.preventDefault();
61930         if (_body.classed("hide")) {
61931           show();
61932         } else {
61933           hide();
61934         }
61935       });
61936     };
61937     function updatePosition() {
61938       var wrap2 = _wrap.node();
61939       var inspector = _inspector.node();
61940       var wRect = wrap2.getBoundingClientRect();
61941       var iRect = inspector.getBoundingClientRect();
61942       _body.style("top", wRect.top + inspector.scrollTop - iRect.top + "px");
61943     }
61944     fieldHelp.body = function(selection2) {
61945       _wrap = selection2.selectAll(".form-field-input-wrap");
61946       if (_wrap.empty())
61947         return;
61948       _inspector = context.container().select(".sidebar .entity-editor-pane .inspector-body");
61949       if (_inspector.empty())
61950         return;
61951       _body = _inspector.selectAll(".field-help-body").data([0]);
61952       var enter = _body.enter().append("div").attr("class", "field-help-body hide");
61953       var titleEnter = enter.append("div").attr("class", "field-help-title cf");
61954       titleEnter.append("h2").attr("class", _mainLocalizer.textDirection() === "rtl" ? "fr" : "fl").call(_t.append("help.field." + fieldName + ".title"));
61955       titleEnter.append("button").attr("class", "fr close").attr("title", _t("icons.close")).on("click", function(d3_event) {
61956         d3_event.stopPropagation();
61957         d3_event.preventDefault();
61958         hide();
61959       }).call(svgIcon("#iD-icon-close"));
61960       var navEnter = enter.append("div").attr("class", "field-help-nav cf");
61961       var titles = docs.map(function(d2) {
61962         return d2.title;
61963       });
61964       navEnter.selectAll(".field-help-nav-item").data(titles).enter().append("div").attr("class", "field-help-nav-item").html(function(d2) {
61965         return d2;
61966       }).on("click", function(d3_event, d2) {
61967         d3_event.stopPropagation();
61968         d3_event.preventDefault();
61969         clickHelp(titles.indexOf(d2));
61970       });
61971       enter.append("div").attr("class", "field-help-content");
61972       _body = _body.merge(enter);
61973       clickHelp(0);
61974     };
61975     return fieldHelp;
61976   }
61977
61978   // modules/ui/fields/check.js
61979   function uiFieldCheck(field, context) {
61980     var dispatch14 = dispatch_default("change");
61981     var options2 = field.options;
61982     var values = [];
61983     var texts = [];
61984     var _tags;
61985     var input = select_default2(null);
61986     var text2 = select_default2(null);
61987     var label = select_default2(null);
61988     var reverser = select_default2(null);
61989     var _impliedYes;
61990     var _entityIDs = [];
61991     var _value;
61992     var stringsField = field.resolveReference("stringsCrossReference");
61993     if (!options2 && stringsField.options) {
61994       options2 = stringsField.options;
61995     }
61996     if (options2) {
61997       for (var i3 in options2) {
61998         var v2 = options2[i3];
61999         values.push(v2 === "undefined" ? void 0 : v2);
62000         texts.push(stringsField.t.html("options." + v2, { "default": v2 }));
62001       }
62002     } else {
62003       values = [void 0, "yes"];
62004       texts = [_t.html("inspector.unknown"), _t.html("inspector.check.yes")];
62005       if (field.type !== "defaultCheck") {
62006         values.push("no");
62007         texts.push(_t.html("inspector.check.no"));
62008       }
62009     }
62010     function checkImpliedYes() {
62011       _impliedYes = field.id === "oneway_yes";
62012       if (field.id === "oneway") {
62013         var entity = context.entity(_entityIDs[0]);
62014         for (var key in entity.tags) {
62015           if (key in osmOneWayTags && entity.tags[key] in osmOneWayTags[key]) {
62016             _impliedYes = true;
62017             texts[0] = _t.html("_tagging.presets.fields.oneway_yes.options.undefined");
62018             break;
62019           }
62020         }
62021       }
62022     }
62023     function reverserHidden() {
62024       if (!context.container().select("div.inspector-hover").empty())
62025         return true;
62026       return !(_value === "yes" || _impliedYes && !_value);
62027     }
62028     function reverserSetText(selection2) {
62029       var entity = _entityIDs.length && context.hasEntity(_entityIDs[0]);
62030       if (reverserHidden() || !entity)
62031         return selection2;
62032       var first = entity.first();
62033       var last = entity.isClosed() ? entity.nodes[entity.nodes.length - 2] : entity.last();
62034       var pseudoDirection = first < last;
62035       var icon2 = pseudoDirection ? "#iD-icon-forward" : "#iD-icon-backward";
62036       selection2.selectAll(".reverser-span").html("").call(_t.append("inspector.check.reverser")).call(svgIcon(icon2, "inline"));
62037       return selection2;
62038     }
62039     var check = function(selection2) {
62040       checkImpliedYes();
62041       label = selection2.selectAll(".form-field-input-wrap").data([0]);
62042       var enter = label.enter().append("label").attr("class", "form-field-input-wrap form-field-input-check");
62043       enter.append("input").property("indeterminate", field.type !== "defaultCheck").attr("type", "checkbox").attr("id", field.domId);
62044       enter.append("span").html(texts[0]).attr("class", "value");
62045       if (field.type === "onewayCheck") {
62046         enter.append("button").attr("class", "reverser" + (reverserHidden() ? " hide" : "")).append("span").attr("class", "reverser-span");
62047       }
62048       label = label.merge(enter);
62049       input = label.selectAll("input");
62050       text2 = label.selectAll("span.value");
62051       input.on("click", function(d3_event) {
62052         d3_event.stopPropagation();
62053         var t2 = {};
62054         if (Array.isArray(_tags[field.key])) {
62055           if (values.indexOf("yes") !== -1) {
62056             t2[field.key] = "yes";
62057           } else {
62058             t2[field.key] = values[0];
62059           }
62060         } else {
62061           t2[field.key] = values[(values.indexOf(_value) + 1) % values.length];
62062         }
62063         if (t2[field.key] === "reversible" || t2[field.key] === "alternating") {
62064           t2[field.key] = values[0];
62065         }
62066         dispatch14.call("change", this, t2);
62067       });
62068       if (field.type === "onewayCheck") {
62069         reverser = label.selectAll(".reverser");
62070         reverser.call(reverserSetText).on("click", function(d3_event) {
62071           d3_event.preventDefault();
62072           d3_event.stopPropagation();
62073           context.perform(
62074             function(graph) {
62075               for (var i4 in _entityIDs) {
62076                 graph = actionReverse(_entityIDs[i4])(graph);
62077               }
62078               return graph;
62079             },
62080             _t("operations.reverse.annotation.line", { n: 1 })
62081           );
62082           context.validator().validate();
62083           select_default2(this).call(reverserSetText);
62084         });
62085       }
62086     };
62087     check.entityIDs = function(val) {
62088       if (!arguments.length)
62089         return _entityIDs;
62090       _entityIDs = val;
62091       return check;
62092     };
62093     check.tags = function(tags) {
62094       _tags = tags;
62095       function isChecked(val) {
62096         return val !== "no" && val !== "" && val !== void 0 && val !== null;
62097       }
62098       function textFor(val) {
62099         if (val === "")
62100           val = void 0;
62101         var index = values.indexOf(val);
62102         return index !== -1 ? texts[index] : '"' + val + '"';
62103       }
62104       checkImpliedYes();
62105       var isMixed = Array.isArray(tags[field.key]);
62106       _value = !isMixed && tags[field.key] && tags[field.key].toLowerCase();
62107       if (field.type === "onewayCheck" && (_value === "1" || _value === "-1")) {
62108         _value = "yes";
62109       }
62110       input.property("indeterminate", isMixed || field.type !== "defaultCheck" && !_value).property("checked", isChecked(_value));
62111       text2.html(isMixed ? _t.html("inspector.multiple_values") : textFor(_value)).classed("mixed", isMixed);
62112       label.classed("set", !!_value);
62113       if (field.type === "onewayCheck") {
62114         reverser.classed("hide", reverserHidden()).call(reverserSetText);
62115       }
62116     };
62117     check.focus = function() {
62118       input.node().focus();
62119     };
62120     return utilRebind(check, dispatch14, "on");
62121   }
62122
62123   // modules/ui/length_indicator.js
62124   function uiLengthIndicator(maxChars) {
62125     var _wrap = select_default2(null);
62126     var _tooltip = uiPopover("tooltip max-length-warning").placement("bottom").hasArrow(true).content(() => (selection2) => {
62127       selection2.text("");
62128       selection2.call(svgIcon("#iD-icon-alert", "inline"));
62129       selection2.call(_t.append("inspector.max_length_reached", { maxChars }));
62130     });
62131     var _silent = false;
62132     var lengthIndicator = function(selection2) {
62133       _wrap = selection2.selectAll("span.length-indicator-wrap").data([0]);
62134       _wrap = _wrap.enter().append("span").merge(_wrap).classed("length-indicator-wrap", true);
62135       selection2.call(_tooltip);
62136     };
62137     lengthIndicator.update = function(val) {
62138       const strLen = utilUnicodeCharsCount(utilCleanOsmString(val, Number.POSITIVE_INFINITY));
62139       let indicator = _wrap.selectAll("span.length-indicator").data([strLen]);
62140       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");
62141       if (_silent)
62142         return;
62143       if (strLen > maxChars) {
62144         _tooltip.show();
62145       } else {
62146         _tooltip.hide();
62147       }
62148     };
62149     lengthIndicator.silent = function(val) {
62150       if (!arguments.length)
62151         return _silent;
62152       _silent = val;
62153       return lengthIndicator;
62154     };
62155     return lengthIndicator;
62156   }
62157
62158   // modules/ui/fields/combo.js
62159   function uiFieldCombo(field, context) {
62160     var dispatch14 = dispatch_default("change");
62161     var _isMulti = field.type === "multiCombo" || field.type === "manyCombo";
62162     var _isNetwork = field.type === "networkCombo";
62163     var _isSemi = field.type === "semiCombo";
62164     var _showTagInfoSuggestions = field.type !== "manyCombo" && field.autoSuggestions !== false;
62165     var _allowCustomValues = field.type !== "manyCombo" && field.customValues !== false;
62166     var _snake_case = field.snake_case || field.snake_case === void 0;
62167     var _combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(field.caseSensitive).minItems(1);
62168     var _container = select_default2(null);
62169     var _inputWrap = select_default2(null);
62170     var _input = select_default2(null);
62171     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
62172     var _comboData = [];
62173     var _multiData = [];
62174     var _entityIDs = [];
62175     var _tags;
62176     var _countryCode;
62177     var _staticPlaceholder;
62178     var _dataDeprecated = [];
62179     _mainFileFetcher.get("deprecated").then(function(d2) {
62180       _dataDeprecated = d2;
62181     }).catch(function() {
62182     });
62183     if (_isMulti && field.key && /[^:]$/.test(field.key)) {
62184       field.key += ":";
62185     }
62186     function snake(s2) {
62187       return s2.replace(/\s+/g, "_");
62188     }
62189     function clean2(s2) {
62190       return s2.split(";").map(function(s3) {
62191         return s3.trim();
62192       }).join(";");
62193     }
62194     function tagValue(dval) {
62195       dval = clean2(dval || "");
62196       var found = getOptions(true).find(function(o2) {
62197         return o2.key && clean2(o2.value) === dval;
62198       });
62199       if (found)
62200         return found.key;
62201       if (field.type === "typeCombo" && !dval) {
62202         return "yes";
62203       }
62204       return restrictTagValueSpelling(dval) || void 0;
62205     }
62206     function restrictTagValueSpelling(dval) {
62207       if (_snake_case) {
62208         dval = snake(dval);
62209       }
62210       if (!field.caseSensitive) {
62211         dval = dval.toLowerCase();
62212       }
62213       return dval;
62214     }
62215     function getLabelId(field2, v2) {
62216       return field2.hasTextForStringId(`options.${v2}.title`) ? `options.${v2}.title` : `options.${v2}`;
62217     }
62218     function displayValue(tval) {
62219       tval = tval || "";
62220       var stringsField = field.resolveReference("stringsCrossReference");
62221       const labelId = getLabelId(stringsField, tval);
62222       if (stringsField.hasTextForStringId(labelId)) {
62223         return stringsField.t(labelId, { default: tval });
62224       }
62225       if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
62226         return "";
62227       }
62228       return tval;
62229     }
62230     function renderValue(tval) {
62231       tval = tval || "";
62232       var stringsField = field.resolveReference("stringsCrossReference");
62233       const labelId = getLabelId(stringsField, tval);
62234       if (stringsField.hasTextForStringId(labelId)) {
62235         return stringsField.t.append(labelId, { default: tval });
62236       }
62237       if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
62238         tval = "";
62239       }
62240       return (selection2) => selection2.text(tval);
62241     }
62242     function objectDifference(a2, b2) {
62243       return a2.filter(function(d1) {
62244         return !b2.some(function(d2) {
62245           return d1.value === d2.value;
62246         });
62247       });
62248     }
62249     function initCombo(selection2, attachTo) {
62250       if (!_allowCustomValues) {
62251         selection2.attr("readonly", "readonly");
62252       }
62253       if (_showTagInfoSuggestions && services.taginfo) {
62254         selection2.call(_combobox.fetcher(setTaginfoValues), attachTo);
62255         setTaginfoValues("", setPlaceholder);
62256       } else {
62257         selection2.call(_combobox, attachTo);
62258         setTimeout(() => setStaticValues(setPlaceholder), 0);
62259       }
62260     }
62261     function getOptions(allOptions) {
62262       var stringsField = field.resolveReference("stringsCrossReference");
62263       if (!(field.options || stringsField.options))
62264         return [];
62265       let options2;
62266       if (allOptions !== true) {
62267         options2 = field.options || stringsField.options;
62268       } else {
62269         options2 = [].concat(field.options, stringsField.options).filter(Boolean);
62270       }
62271       return options2.map(function(v2) {
62272         const labelId = getLabelId(stringsField, v2);
62273         return {
62274           key: v2,
62275           value: stringsField.t(labelId, { default: v2 }),
62276           title: stringsField.t(`options.${v2}.description`, { default: v2 }),
62277           display: addComboboxIcons(stringsField.t.append(labelId, { default: v2 }), v2),
62278           klass: stringsField.hasTextForStringId(labelId) ? "" : "raw-option"
62279         };
62280       });
62281     }
62282     function setStaticValues(callback, filter2) {
62283       _comboData = getOptions();
62284       if (filter2 !== void 0) {
62285         _comboData = _comboData.filter(filter2);
62286       }
62287       _comboData = objectDifference(_comboData, _multiData);
62288       _combobox.data(_comboData);
62289       if (callback)
62290         callback(_comboData);
62291     }
62292     function setTaginfoValues(q2, callback) {
62293       var queryFilter = (d2) => d2.value.toLowerCase().includes(q2.toLowerCase()) || d2.key.toLowerCase().includes(q2.toLowerCase());
62294       setStaticValues(callback, queryFilter);
62295       var stringsField = field.resolveReference("stringsCrossReference");
62296       var fn = _isMulti ? "multikeys" : "values";
62297       var query = (_isMulti ? field.key : "") + q2;
62298       var hasCountryPrefix = _isNetwork && _countryCode && _countryCode.indexOf(q2.toLowerCase()) === 0;
62299       if (hasCountryPrefix) {
62300         query = _countryCode + ":";
62301       }
62302       var params = {
62303         debounce: q2 !== "",
62304         key: field.key,
62305         query
62306       };
62307       if (_entityIDs.length) {
62308         params.geometry = context.graph().geometry(_entityIDs[0]);
62309       }
62310       services.taginfo[fn](params, function(err, data) {
62311         if (err)
62312           return;
62313         data = data.filter((d2) => field.type !== "typeCombo" || d2.value !== "yes");
62314         data = data.filter((d2) => {
62315           var value = d2.value;
62316           if (_isMulti) {
62317             value = value.slice(field.key.length);
62318           }
62319           return value === restrictTagValueSpelling(value);
62320         });
62321         var deprecatedValues = osmEntity.deprecatedTagValuesByKey(_dataDeprecated)[field.key];
62322         if (deprecatedValues) {
62323           data = data.filter((d2) => !deprecatedValues.includes(d2.value));
62324         }
62325         if (hasCountryPrefix) {
62326           data = data.filter((d2) => d2.value.toLowerCase().indexOf(_countryCode + ":") === 0);
62327         }
62328         const additionalOptions = (field.options || stringsField.options || []).filter((v2) => !data.some((dv) => dv.value === (_isMulti ? field.key + v2 : v2))).map((v2) => ({ value: v2 }));
62329         _container.classed("empty-combobox", data.length === 0);
62330         _comboData = data.concat(additionalOptions).map(function(d2) {
62331           var v2 = d2.value;
62332           if (_isMulti)
62333             v2 = v2.replace(field.key, "");
62334           const labelId = getLabelId(stringsField, v2);
62335           var isLocalizable = stringsField.hasTextForStringId(labelId);
62336           var label = stringsField.t(labelId, { default: v2 });
62337           return {
62338             key: v2,
62339             value: label,
62340             title: stringsField.t(`options.${v2}.description`, { default: isLocalizable ? v2 : d2.title !== label ? d2.title : "" }),
62341             display: addComboboxIcons(stringsField.t.append(labelId, { default: v2 }), v2),
62342             klass: isLocalizable ? "" : "raw-option"
62343           };
62344         });
62345         _comboData = _comboData.filter(queryFilter);
62346         _comboData = objectDifference(_comboData, _multiData);
62347         if (callback)
62348           callback(_comboData);
62349       });
62350     }
62351     function addComboboxIcons(disp, value) {
62352       const iconsField = field.resolveReference("iconsCrossReference");
62353       if (iconsField.icons) {
62354         return function(selection2) {
62355           var span = selection2.insert("span", ":first-child").attr("class", "tag-value-icon");
62356           if (iconsField.icons[value]) {
62357             span.call(svgIcon(`#${iconsField.icons[value]}`));
62358           }
62359           disp.call(this, selection2);
62360         };
62361       }
62362       return disp;
62363     }
62364     function setPlaceholder(values) {
62365       if (_isMulti || _isSemi) {
62366         _staticPlaceholder = field.placeholder() || _t("inspector.add");
62367       } else {
62368         var vals = values.map(function(d2) {
62369           return d2.value;
62370         }).filter(function(s2) {
62371           return s2.length < 20;
62372         });
62373         var placeholders = vals.length > 1 ? vals : values.map(function(d2) {
62374           return d2.key;
62375         });
62376         _staticPlaceholder = field.placeholder() || placeholders.slice(0, 3).join(", ");
62377       }
62378       if (!/(…|\.\.\.)$/.test(_staticPlaceholder)) {
62379         _staticPlaceholder += "\u2026";
62380       }
62381       var ph;
62382       if (!_isMulti && !_isSemi && _tags && Array.isArray(_tags[field.key])) {
62383         ph = _t("inspector.multiple_values");
62384       } else {
62385         ph = _staticPlaceholder;
62386       }
62387       _container.selectAll("input").attr("placeholder", ph);
62388       var hideAdd = !_allowCustomValues && !values.length;
62389       _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null);
62390     }
62391     function change() {
62392       var t2 = {};
62393       var val;
62394       if (_isMulti || _isSemi) {
62395         var vals;
62396         if (_isMulti) {
62397           vals = [tagValue(utilGetSetValue(_input))];
62398         } else if (_isSemi) {
62399           val = tagValue(utilGetSetValue(_input)) || "";
62400           val = val.replace(/,/g, ";");
62401           vals = val.split(";");
62402         }
62403         vals = vals.filter(Boolean);
62404         if (!vals.length)
62405           return;
62406         _container.classed("active", false);
62407         utilGetSetValue(_input, "");
62408         if (_isMulti) {
62409           utilArrayUniq(vals).forEach(function(v2) {
62410             var key = (field.key || "") + v2;
62411             if (_tags) {
62412               var old = _tags[key];
62413               if (typeof old === "string" && old.toLowerCase() !== "no")
62414                 return;
62415             }
62416             key = context.cleanTagKey(key);
62417             field.keys.push(key);
62418             t2[key] = "yes";
62419           });
62420         } else if (_isSemi) {
62421           var arr = _multiData.map(function(d2) {
62422             return d2.key;
62423           });
62424           arr = arr.concat(vals);
62425           t2[field.key] = context.cleanTagValue(utilArrayUniq(arr).filter(Boolean).join(";"));
62426         }
62427         window.setTimeout(function() {
62428           _input.node().focus();
62429         }, 10);
62430       } else {
62431         var rawValue = utilGetSetValue(_input);
62432         if (!rawValue && Array.isArray(_tags[field.key]))
62433           return;
62434         val = context.cleanTagValue(tagValue(rawValue));
62435         t2[field.key] = val || void 0;
62436       }
62437       dispatch14.call("change", this, t2);
62438     }
62439     function removeMultikey(d3_event, d2) {
62440       d3_event.preventDefault();
62441       d3_event.stopPropagation();
62442       var t2 = {};
62443       if (_isMulti) {
62444         t2[d2.key] = void 0;
62445       } else if (_isSemi) {
62446         var arr = _multiData.map(function(md) {
62447           return md.key === d2.key ? null : md.key;
62448         }).filter(Boolean);
62449         arr = utilArrayUniq(arr);
62450         t2[field.key] = arr.length ? arr.join(";") : void 0;
62451         _lengthIndicator.update(t2[field.key]);
62452       }
62453       dispatch14.call("change", this, t2);
62454     }
62455     function invertMultikey(d3_event, d2) {
62456       d3_event.preventDefault();
62457       d3_event.stopPropagation();
62458       var t2 = {};
62459       if (_isMulti) {
62460         t2[d2.key] = _tags[d2.key] === "yes" ? "no" : "yes";
62461       }
62462       dispatch14.call("change", this, t2);
62463     }
62464     function combo(selection2) {
62465       _container = selection2.selectAll(".form-field-input-wrap").data([0]);
62466       var type2 = _isMulti || _isSemi ? "multicombo" : "combo";
62467       _container = _container.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + type2).merge(_container);
62468       if (_isMulti || _isSemi) {
62469         _container = _container.selectAll(".chiplist").data([0]);
62470         var listClass = "chiplist";
62471         if (field.key === "destination" || field.key === "via") {
62472           listClass += " full-line-chips";
62473         }
62474         _container = _container.enter().append("ul").attr("class", listClass).on("click", function() {
62475           window.setTimeout(function() {
62476             _input.node().focus();
62477           }, 10);
62478         }).merge(_container);
62479         _inputWrap = _container.selectAll(".input-wrap").data([0]);
62480         _inputWrap = _inputWrap.enter().append("li").attr("class", "input-wrap").merge(_inputWrap);
62481         var hideAdd = !_allowCustomValues && !_comboData.length;
62482         _inputWrap.style("display", hideAdd ? "none" : null);
62483         _input = _inputWrap.selectAll("input").data([0]);
62484       } else {
62485         _input = _container.selectAll("input").data([0]);
62486       }
62487       _input = _input.enter().append("input").attr("type", "text").attr("id", field.domId).call(utilNoAuto).call(initCombo, _container).merge(_input);
62488       if (_isSemi) {
62489         _inputWrap.call(_lengthIndicator);
62490       } else if (!_isMulti) {
62491         _container.call(_lengthIndicator);
62492       }
62493       if (_isNetwork) {
62494         var extent = combinedEntityExtent();
62495         var countryCode = extent && iso1A2Code(extent.center());
62496         _countryCode = countryCode && countryCode.toLowerCase();
62497       }
62498       _input.on("change", change).on("blur", change).on("input", function() {
62499         let val = utilGetSetValue(_input);
62500         updateIcon(val);
62501         if (_isSemi && _tags[field.key]) {
62502           val += ";" + _tags[field.key];
62503         }
62504         _lengthIndicator.update(val);
62505       });
62506       _input.on("keydown.field", function(d3_event) {
62507         switch (d3_event.keyCode) {
62508           case 13:
62509             _input.node().blur();
62510             d3_event.stopPropagation();
62511             break;
62512         }
62513       });
62514       if (_isMulti || _isSemi) {
62515         _combobox.on("accept", function() {
62516           _input.node().blur();
62517           _input.node().focus();
62518         });
62519         _input.on("focus", function() {
62520           _container.classed("active", true);
62521         });
62522       }
62523       _combobox.on("cancel", function() {
62524         _input.node().blur();
62525       }).on("update", function() {
62526         updateIcon(utilGetSetValue(_input));
62527       });
62528     }
62529     function updateIcon(value) {
62530       value = tagValue(value);
62531       let container = _container;
62532       if (field.type === "multiCombo" || field.type === "semiCombo") {
62533         container = _container.select(".input-wrap");
62534       }
62535       const iconsField = field.resolveReference("iconsCrossReference");
62536       if (iconsField.icons) {
62537         container.selectAll(".tag-value-icon").remove();
62538         if (iconsField.icons[value]) {
62539           container.selectAll(".tag-value-icon").data([value]).enter().insert("div", "input").attr("class", "tag-value-icon").call(svgIcon(`#${iconsField.icons[value]}`));
62540         }
62541       }
62542     }
62543     combo.tags = function(tags) {
62544       _tags = tags;
62545       var stringsField = field.resolveReference("stringsCrossReference");
62546       var isMixed = Array.isArray(tags[field.key]);
62547       var showsValue = (value) => !isMixed && value && !(field.type === "typeCombo" && value === "yes");
62548       var isRawValue = (value) => showsValue(value) && !stringsField.hasTextForStringId(`options.${value}`) && !stringsField.hasTextForStringId(`options.${value}.title`);
62549       var isKnownValue = (value) => showsValue(value) && !isRawValue(value);
62550       var isReadOnly = !_allowCustomValues;
62551       if (_isMulti || _isSemi) {
62552         _multiData = [];
62553         var maxLength;
62554         if (_isMulti) {
62555           for (var k2 in tags) {
62556             if (field.key && k2.indexOf(field.key) !== 0)
62557               continue;
62558             if (!field.key && field.keys.indexOf(k2) === -1)
62559               continue;
62560             var v2 = tags[k2];
62561             var suffix = field.key ? k2.slice(field.key.length) : k2;
62562             _multiData.push({
62563               key: k2,
62564               value: displayValue(suffix),
62565               display: addComboboxIcons(renderValue(suffix), suffix),
62566               state: typeof v2 === "string" ? v2.toLowerCase() : "",
62567               isMixed: Array.isArray(v2)
62568             });
62569           }
62570           if (field.key) {
62571             field.keys = _multiData.map(function(d2) {
62572               return d2.key;
62573             });
62574             maxLength = context.maxCharsForTagKey() - utilUnicodeCharsCount(field.key);
62575           } else {
62576             maxLength = context.maxCharsForTagKey();
62577           }
62578         } else if (_isSemi) {
62579           var allValues = [];
62580           var commonValues;
62581           if (Array.isArray(tags[field.key])) {
62582             tags[field.key].forEach(function(tagVal) {
62583               var thisVals = utilArrayUniq((tagVal || "").split(";")).filter(Boolean);
62584               allValues = allValues.concat(thisVals);
62585               if (!commonValues) {
62586                 commonValues = thisVals;
62587               } else {
62588                 commonValues = commonValues.filter((value) => thisVals.includes(value));
62589               }
62590             });
62591             allValues = utilArrayUniq(allValues).filter(Boolean);
62592           } else {
62593             allValues = utilArrayUniq((tags[field.key] || "").split(";")).filter(Boolean);
62594             commonValues = allValues;
62595           }
62596           _multiData = allValues.map(function(v3) {
62597             return {
62598               key: v3,
62599               value: displayValue(v3),
62600               display: addComboboxIcons(renderValue(v3), v3),
62601               isMixed: !commonValues.includes(v3)
62602             };
62603           });
62604           var currLength = utilUnicodeCharsCount(commonValues.join(";"));
62605           maxLength = context.maxCharsForTagValue() - currLength;
62606           if (currLength > 0) {
62607             maxLength -= 1;
62608           }
62609         }
62610         maxLength = Math.max(0, maxLength);
62611         var hideAdd = maxLength <= 0 || !_allowCustomValues && !_comboData.length;
62612         _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null);
62613         var allowDragAndDrop = _isSemi && !Array.isArray(tags[field.key]);
62614         var chips = _container.selectAll(".chip").data(_multiData);
62615         chips.exit().remove();
62616         var enter = chips.enter().insert("li", ".input-wrap").attr("class", "chip");
62617         enter.append("span");
62618         enter.append("a");
62619         chips = chips.merge(enter).order().classed("raw-value", function(d2) {
62620           var k3 = d2.key;
62621           if (_isMulti)
62622             k3 = k3.replace(field.key, "");
62623           return !stringsField.hasTextForStringId("options." + k3);
62624         }).classed("draggable", allowDragAndDrop).classed("mixed", function(d2) {
62625           return d2.isMixed;
62626         }).attr("title", function(d2) {
62627           if (d2.isMixed) {
62628             return _t("inspector.unshared_value_tooltip");
62629           }
62630           if (!["yes", "no"].includes(d2.state)) {
62631             return d2.state;
62632           }
62633           return null;
62634         }).classed("negated", (d2) => d2.state === "no");
62635         if (!_isSemi) {
62636           chips.selectAll("input[type=checkbox]").remove();
62637           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);
62638         }
62639         if (allowDragAndDrop) {
62640           registerDragAndDrop(chips);
62641         }
62642         chips.select("span").each(function(d2) {
62643           const selection2 = select_default2(this);
62644           if (d2.display) {
62645             selection2.text("");
62646             d2.display(selection2);
62647           } else {
62648             selection2.text(d2.value);
62649           }
62650         });
62651         chips.select("a").attr("href", "#").on("click", removeMultikey).attr("class", "remove").text("\xD7");
62652         updateIcon("");
62653       } else {
62654         var mixedValues = isMixed && tags[field.key].map(function(val) {
62655           return displayValue(val);
62656         }).filter(Boolean);
62657         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) {
62658           if (isReadOnly && isKnownValue(tags[field.key]) && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
62659             d3_event.preventDefault();
62660             d3_event.stopPropagation();
62661             var t2 = {};
62662             t2[field.key] = void 0;
62663             dispatch14.call("change", this, t2);
62664           }
62665         });
62666         if (!Array.isArray(tags[field.key])) {
62667           updateIcon(tags[field.key]);
62668         }
62669         if (!isMixed) {
62670           _lengthIndicator.update(tags[field.key]);
62671         }
62672       }
62673       const refreshStyles = () => {
62674         _input.data([tagValue(utilGetSetValue(_input))]).classed("raw-value", isRawValue).classed("known-value", isKnownValue);
62675       };
62676       _input.on("input.refreshStyles", refreshStyles);
62677       _combobox.on("update.refreshStyles", refreshStyles);
62678       refreshStyles();
62679     };
62680     function registerDragAndDrop(selection2) {
62681       var dragOrigin, targetIndex;
62682       selection2.call(
62683         drag_default().on("start", function(d3_event) {
62684           dragOrigin = {
62685             x: d3_event.x,
62686             y: d3_event.y
62687           };
62688           targetIndex = null;
62689         }).on("drag", function(d3_event) {
62690           var x2 = d3_event.x - dragOrigin.x, y2 = d3_event.y - dragOrigin.y;
62691           if (!select_default2(this).classed("dragging") && // don't display drag until dragging beyond a distance threshold
62692           Math.sqrt(Math.pow(x2, 2) + Math.pow(y2, 2)) <= 5)
62693             return;
62694           var index = selection2.nodes().indexOf(this);
62695           select_default2(this).classed("dragging", true);
62696           targetIndex = null;
62697           var targetIndexOffsetTop = null;
62698           var draggedTagWidth = select_default2(this).node().offsetWidth;
62699           if (field.key === "destination" || field.key === "via") {
62700             _container.selectAll(".chip").style("transform", function(d2, index2) {
62701               var node = select_default2(this).node();
62702               if (index === index2) {
62703                 return "translate(" + x2 + "px, " + y2 + "px)";
62704               } else if (index2 > index && d3_event.y > node.offsetTop) {
62705                 if (targetIndex === null || index2 > targetIndex) {
62706                   targetIndex = index2;
62707                 }
62708                 return "translateY(-100%)";
62709               } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
62710                 if (targetIndex === null || index2 < targetIndex) {
62711                   targetIndex = index2;
62712                 }
62713                 return "translateY(100%)";
62714               }
62715               return null;
62716             });
62717           } else {
62718             _container.selectAll(".chip").each(function(d2, index2) {
62719               var node = select_default2(this).node();
62720               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) {
62721                 targetIndex = index2;
62722                 targetIndexOffsetTop = node.offsetTop;
62723               }
62724             }).style("transform", function(d2, index2) {
62725               var node = select_default2(this).node();
62726               if (index === index2) {
62727                 return "translate(" + x2 + "px, " + y2 + "px)";
62728               }
62729               if (node.offsetTop === targetIndexOffsetTop) {
62730                 if (index2 < index && index2 >= targetIndex) {
62731                   return "translateX(" + draggedTagWidth + "px)";
62732                 } else if (index2 > index && index2 <= targetIndex) {
62733                   return "translateX(-" + draggedTagWidth + "px)";
62734                 }
62735               }
62736               return null;
62737             });
62738           }
62739         }).on("end", function() {
62740           if (!select_default2(this).classed("dragging")) {
62741             return;
62742           }
62743           var index = selection2.nodes().indexOf(this);
62744           select_default2(this).classed("dragging", false);
62745           _container.selectAll(".chip").style("transform", null);
62746           if (typeof targetIndex === "number") {
62747             var element = _multiData[index];
62748             _multiData.splice(index, 1);
62749             _multiData.splice(targetIndex, 0, element);
62750             var t2 = {};
62751             if (_multiData.length) {
62752               t2[field.key] = _multiData.map(function(element2) {
62753                 return element2.key;
62754               }).join(";");
62755             } else {
62756               t2[field.key] = void 0;
62757             }
62758             dispatch14.call("change", this, t2);
62759           }
62760           dragOrigin = void 0;
62761           targetIndex = void 0;
62762         })
62763       );
62764     }
62765     combo.focus = function() {
62766       _input.node().focus();
62767     };
62768     combo.entityIDs = function(val) {
62769       if (!arguments.length)
62770         return _entityIDs;
62771       _entityIDs = val;
62772       return combo;
62773     };
62774     function combinedEntityExtent() {
62775       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
62776     }
62777     return utilRebind(combo, dispatch14, "on");
62778   }
62779
62780   // modules/ui/fields/input.js
62781   var likelyRawNumberFormat = /^-?(0\.\d*|\d*\.\d{0,2}(\d{4,})?|\d{4,}\.\d{3})$/;
62782   function uiFieldText(field, context) {
62783     var dispatch14 = dispatch_default("change");
62784     var input = select_default2(null);
62785     var outlinkButton = select_default2(null);
62786     var wrap2 = select_default2(null);
62787     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
62788     var _entityIDs = [];
62789     var _tags;
62790     var _phoneFormats = {};
62791     const isDirectionField = field.key.split(":").some((keyPart) => keyPart === "direction");
62792     const formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
62793     const parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
62794     const countDecimalPlaces = _mainLocalizer.decimalPlaceCounter(_mainLocalizer.languageCode());
62795     if (field.type === "tel") {
62796       _mainFileFetcher.get("phone_formats").then(function(d2) {
62797         _phoneFormats = d2;
62798         updatePhonePlaceholder();
62799       }).catch(function() {
62800       });
62801     }
62802     function calcLocked() {
62803       var isLocked = (field.id === "brand" || field.id === "network" || field.id === "operator" || field.id === "flag") && _entityIDs.length && _entityIDs.some(function(entityID) {
62804         var entity = context.graph().hasEntity(entityID);
62805         if (!entity)
62806           return false;
62807         if (entity.tags.wikidata)
62808           return true;
62809         var preset = _mainPresetIndex.match(entity, context.graph());
62810         var isSuggestion = preset && preset.suggestion;
62811         var which = field.id;
62812         return isSuggestion && !!entity.tags[which] && !!entity.tags[which + ":wikidata"];
62813       });
62814       field.locked(isLocked);
62815     }
62816     function i3(selection2) {
62817       calcLocked();
62818       var isLocked = field.locked();
62819       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
62820       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
62821       input = wrap2.selectAll("input").data([0]);
62822       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);
62823       input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
62824       wrap2.call(_lengthIndicator);
62825       if (field.type === "tel") {
62826         updatePhonePlaceholder();
62827       } else if (field.type === "number") {
62828         var rtl = _mainLocalizer.textDirection() === "rtl";
62829         input.attr("type", "text");
62830         var inc = field.increment;
62831         var buttons = wrap2.selectAll(".increment, .decrement").data(rtl ? [inc, -inc] : [-inc, inc]);
62832         buttons.enter().append("button").attr("class", function(d2) {
62833           var which = d2 > 0 ? "increment" : "decrement";
62834           return "form-field-button " + which;
62835         }).attr("title", function(d2) {
62836           var which = d2 > 0 ? "increment" : "decrement";
62837           return _t(`inspector.${which}`);
62838         }).merge(buttons).on("click", function(d3_event, d2) {
62839           d3_event.preventDefault();
62840           var isMixed = Array.isArray(_tags[field.key]);
62841           if (isMixed)
62842             return;
62843           var raw_vals = input.node().value || "0";
62844           var vals = raw_vals.split(";");
62845           vals = vals.map(function(v2) {
62846             v2 = v2.trim();
62847             const isRawNumber = likelyRawNumberFormat.test(v2);
62848             var num = isRawNumber ? parseFloat(v2) : parseLocaleFloat(v2);
62849             if (isDirectionField) {
62850               const compassDir = cardinal[v2.toLowerCase()];
62851               if (compassDir !== void 0) {
62852                 num = compassDir;
62853               }
62854             }
62855             if (!isFinite(num))
62856               return v2;
62857             num = parseFloat(num);
62858             if (!isFinite(num))
62859               return v2;
62860             num += d2;
62861             if (isDirectionField) {
62862               num = (num % 360 + 360) % 360;
62863             }
62864             return formatFloat(clamped(num), isRawNumber ? v2.includes(".") ? v2.split(".")[1].length : 0 : countDecimalPlaces(v2));
62865           });
62866           input.node().value = vals.join(";");
62867           change()();
62868         });
62869       } else if (field.type === "identifier" && field.urlFormat && field.pattern) {
62870         input.attr("type", "text");
62871         outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
62872         outlinkButton.enter().append("button").call(svgIcon("#iD-icon-out-link")).attr("class", "form-field-button foreign-id-permalink").attr("title", function() {
62873           var domainResults = /^https?:\/\/(.{1,}?)\//.exec(field.urlFormat);
62874           if (domainResults.length >= 2 && domainResults[1]) {
62875             var domain2 = domainResults[1];
62876             return _t("icons.view_on", { domain: domain2 });
62877           }
62878           return "";
62879         }).on("click", function(d3_event) {
62880           d3_event.preventDefault();
62881           var value = validIdentifierValueForLink();
62882           if (value) {
62883             var url = field.urlFormat.replace(/{value}/, encodeURIComponent(value));
62884             window.open(url, "_blank");
62885           }
62886         }).classed("disabled", () => !validIdentifierValueForLink()).merge(outlinkButton);
62887       } else if (field.type === "url") {
62888         input.attr("type", "text");
62889         outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
62890         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) {
62891           d3_event.preventDefault();
62892           const value = validIdentifierValueForLink();
62893           if (value)
62894             window.open(value, "_blank");
62895         }).merge(outlinkButton);
62896       } else if (field.type === "colour") {
62897         input.attr("type", "text");
62898         updateColourPreview();
62899       } else if (field.type === "date") {
62900         input.attr("type", "text");
62901         updateDateField();
62902       }
62903     }
62904     function updateColourPreview() {
62905       function isColourValid(colour2) {
62906         if (!colour2.match(/^(#([0-9a-fA-F]{3}){1,2}|\w+)$/)) {
62907           return false;
62908         } else if (!CSS.supports("color", colour2) || ["unset", "inherit", "initial", "revert"].includes(colour2)) {
62909           return false;
62910         }
62911         return true;
62912       }
62913       wrap2.selectAll(".colour-preview").remove();
62914       const colour = utilGetSetValue(input);
62915       if (!isColourValid(colour) && colour !== "") {
62916         wrap2.selectAll("input.colour-selector").remove();
62917         wrap2.selectAll(".form-field-button").remove();
62918         return;
62919       }
62920       var colourSelector = wrap2.selectAll(".colour-selector").data([0]);
62921       colourSelector.enter().append("input").attr("type", "color").attr("class", "colour-selector").on("input", debounce_default(function(d3_event) {
62922         d3_event.preventDefault();
62923         var colour2 = this.value;
62924         if (!isColourValid(colour2))
62925           return;
62926         utilGetSetValue(input, this.value);
62927         change()();
62928         updateColourPreview();
62929       }, 100));
62930       wrap2.selectAll("input.colour-selector").attr("value", colour);
62931       var chooserButton = wrap2.selectAll(".colour-preview").data([colour]);
62932       chooserButton = chooserButton.enter().append("div").attr("class", "form-field-button colour-preview").append("div").style("background-color", (d2) => d2).attr("class", "colour-box");
62933       if (colour === "") {
62934         chooserButton = chooserButton.call(svgIcon("#iD-icon-edit"));
62935       }
62936       chooserButton.on("click", () => wrap2.select(".colour-selector").node().showPicker());
62937     }
62938     function updateDateField() {
62939       function isDateValid(date2) {
62940         return date2.match(/^[0-9]{4}(-[0-9]{2}(-[0-9]{2})?)?$/);
62941       }
62942       const date = utilGetSetValue(input);
62943       const now3 = /* @__PURE__ */ new Date();
62944       const today = new Date(now3.getTime() - now3.getTimezoneOffset() * 6e4).toISOString().split("T")[0];
62945       if ((field.key === "check_date" || field.key === "survey:date") && date !== today) {
62946         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", () => {
62947           utilGetSetValue(input, today);
62948           change()();
62949           updateDateField();
62950         });
62951       } else {
62952         wrap2.selectAll(".date-set-today").remove();
62953       }
62954       if (!isDateValid(date) && date !== "") {
62955         wrap2.selectAll("input.date-selector").remove();
62956         wrap2.selectAll(".date-calendar").remove();
62957         return;
62958       }
62959       if (utilDetect().browser !== "Safari") {
62960         var dateSelector = wrap2.selectAll(".date-selector").data([0]);
62961         dateSelector.enter().append("input").attr("type", "date").attr("class", "date-selector").on("input", debounce_default(function(d3_event) {
62962           d3_event.preventDefault();
62963           var date2 = this.value;
62964           if (!isDateValid(date2))
62965             return;
62966           utilGetSetValue(input, this.value);
62967           change()();
62968           updateDateField();
62969         }, 100));
62970         wrap2.selectAll("input.date-selector").attr("value", date);
62971         var calendarButton = wrap2.selectAll(".date-calendar").data([date]);
62972         calendarButton = calendarButton.enter().append("button").attr("class", "form-field-button date-calendar").call(svgIcon("#fas-calendar-days"));
62973         calendarButton.on("click", () => wrap2.select(".date-selector").node().showPicker());
62974       }
62975     }
62976     function updatePhonePlaceholder() {
62977       if (input.empty() || !Object.keys(_phoneFormats).length)
62978         return;
62979       var extent = combinedEntityExtent();
62980       var countryCode = extent && iso1A2Code(extent.center());
62981       var format2 = countryCode && _phoneFormats[countryCode.toLowerCase()];
62982       if (format2)
62983         input.attr("placeholder", format2);
62984     }
62985     function validIdentifierValueForLink() {
62986       const value = utilGetSetValue(input).trim();
62987       if (field.type === "url" && value) {
62988         try {
62989           return new URL(value).href;
62990         } catch (e3) {
62991           return null;
62992         }
62993       }
62994       if (field.type === "identifier" && field.pattern) {
62995         return value && value.match(new RegExp(field.pattern))?.[0];
62996       }
62997       return null;
62998     }
62999     function clamped(num) {
63000       if (field.minValue !== void 0) {
63001         num = Math.max(num, field.minValue);
63002       }
63003       if (field.maxValue !== void 0) {
63004         num = Math.min(num, field.maxValue);
63005       }
63006       return num;
63007     }
63008     function getVals(tags) {
63009       if (field.keys) {
63010         const multiSelection = context.selectedIDs();
63011         tags = multiSelection.length > 1 ? context.selectedIDs().map((id2) => context.graph().entity(id2)).map((entity) => entity.tags) : [tags];
63012         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]));
63013       } else {
63014         return new Set([].concat(tags[field.key]));
63015       }
63016     }
63017     function change(onInput) {
63018       return function() {
63019         var t2 = {};
63020         var val = utilGetSetValue(input);
63021         if (!onInput)
63022           val = context.cleanTagValue(val);
63023         if (!val && getVals(_tags).size > 1)
63024           return;
63025         var displayVal = val;
63026         if (field.type === "number" && val) {
63027           var numbers2 = val.split(";");
63028           numbers2 = numbers2.map(function(v2) {
63029             if (likelyRawNumberFormat.test(v2)) {
63030               return v2;
63031             }
63032             var num = parseLocaleFloat(v2);
63033             const fractionDigits = countDecimalPlaces(v2);
63034             return isFinite(num) ? clamped(num).toFixed(fractionDigits) : v2;
63035           });
63036           val = numbers2.join(";");
63037         }
63038         if (!onInput)
63039           utilGetSetValue(input, displayVal);
63040         t2[field.key] = val || void 0;
63041         if (field.keys) {
63042           dispatch14.call("change", this, (tags) => {
63043             if (field.keys.some((key) => tags[key])) {
63044               field.keys.filter((key) => tags[key]).forEach((key) => {
63045                 tags[key] = val || void 0;
63046               });
63047             } else {
63048               tags[field.key] = val || void 0;
63049             }
63050             return tags;
63051           }, onInput);
63052         } else {
63053           dispatch14.call("change", this, t2, onInput);
63054         }
63055       };
63056     }
63057     i3.entityIDs = function(val) {
63058       if (!arguments.length)
63059         return _entityIDs;
63060       _entityIDs = val;
63061       return i3;
63062     };
63063     i3.tags = function(tags) {
63064       _tags = tags;
63065       const vals = getVals(tags);
63066       const isMixed = vals.size > 1;
63067       var val = vals.size === 1 ? [...vals][0] ?? "" : "";
63068       var shouldUpdate;
63069       if (field.type === "number" && val) {
63070         var numbers2 = val.split(";");
63071         var oriNumbers = utilGetSetValue(input).split(";");
63072         if (numbers2.length !== oriNumbers.length)
63073           shouldUpdate = true;
63074         numbers2 = numbers2.map(function(v2) {
63075           v2 = v2.trim();
63076           var num = Number(v2);
63077           if (!isFinite(num) || v2 === "")
63078             return v2;
63079           const fractionDigits = v2.includes(".") ? v2.split(".")[1].length : 0;
63080           return formatFloat(num, fractionDigits);
63081         });
63082         val = numbers2.join(";");
63083         shouldUpdate = (inputValue, setValue) => {
63084           const inputNums = inputValue.split(";").map(
63085             (setVal) => likelyRawNumberFormat.test(setVal) ? parseFloat(setVal) : parseLocaleFloat(setVal)
63086           );
63087           const setNums = setValue.split(";").map(parseLocaleFloat);
63088           return !isEqual_default(inputNums, setNums);
63089         };
63090       }
63091       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);
63092       if (field.type === "number") {
63093         const buttons = wrap2.selectAll(".increment, .decrement");
63094         if (isMixed) {
63095           buttons.attr("disabled", "disabled").classed("disabled", true);
63096         } else {
63097           var raw_vals = tags[field.key] || "0";
63098           const canIncDec = raw_vals.split(";").some((val2) => isFinite(Number(val2)) || isDirectionField && cardinal[val2.trim().toLowerCase()]);
63099           buttons.attr("disabled", canIncDec ? null : "disabled").classed("disabled", !canIncDec);
63100         }
63101       }
63102       if (field.type === "tel")
63103         updatePhonePlaceholder();
63104       if (field.type === "colour")
63105         updateColourPreview();
63106       if (field.type === "date")
63107         updateDateField();
63108       if (outlinkButton && !outlinkButton.empty()) {
63109         var disabled = !validIdentifierValueForLink();
63110         outlinkButton.classed("disabled", disabled);
63111       }
63112       if (!isMixed) {
63113         _lengthIndicator.update(tags[field.key]);
63114       }
63115     };
63116     i3.focus = function() {
63117       var node = input.node();
63118       if (node)
63119         node.focus();
63120     };
63121     function combinedEntityExtent() {
63122       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
63123     }
63124     return utilRebind(i3, dispatch14, "on");
63125   }
63126
63127   // modules/ui/fields/access.js
63128   function uiFieldAccess(field, context) {
63129     var dispatch14 = dispatch_default("change");
63130     var items = select_default2(null);
63131     var _tags;
63132     function access(selection2) {
63133       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
63134       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
63135       var list = wrap2.selectAll("ul").data([0]);
63136       list = list.enter().append("ul").attr("class", "rows").merge(list);
63137       items = list.selectAll("li").data(field.keys);
63138       var enter = items.enter().append("li").attr("class", function(d2) {
63139         return "labeled-input preset-access-" + d2;
63140       });
63141       enter.append("span").attr("class", "label preset-label-access").attr("for", function(d2) {
63142         return "preset-input-access-" + d2;
63143       }).html(function(d2) {
63144         return field.t.html("types." + d2);
63145       });
63146       enter.append("div").attr("class", "preset-input-access-wrap").append("input").attr("type", "text").attr("class", function(d2) {
63147         return "preset-input-access preset-input-access-" + d2;
63148       }).call(utilNoAuto).each(function(d2) {
63149         select_default2(this).call(
63150           uiCombobox(context, "access-" + d2).data(access.options(d2))
63151         );
63152       });
63153       items = items.merge(enter);
63154       wrap2.selectAll(".preset-input-access").on("change", change).on("blur", change);
63155     }
63156     function change(d3_event, d2) {
63157       var tag = {};
63158       var value = context.cleanTagValue(utilGetSetValue(select_default2(this)));
63159       if (!value && typeof _tags[d2] !== "string")
63160         return;
63161       tag[d2] = value || void 0;
63162       dispatch14.call("change", this, tag);
63163     }
63164     access.options = function(type2) {
63165       var options2 = [
63166         "yes",
63167         "no",
63168         "designated",
63169         "permissive",
63170         "destination",
63171         "customers",
63172         "private",
63173         "permit",
63174         "unknown"
63175       ];
63176       if (type2 === "access") {
63177         options2 = options2.filter((v2) => v2 !== "yes" && v2 !== "designated");
63178       }
63179       if (type2 === "bicycle") {
63180         options2.splice(options2.length - 4, 0, "dismount");
63181       }
63182       var stringsField = field.resolveReference("stringsCrossReference");
63183       return options2.map(function(option) {
63184         return {
63185           title: stringsField.t("options." + option + ".description"),
63186           value: option
63187         };
63188       });
63189     };
63190     const placeholdersByTag = {
63191       highway: {
63192         footway: {
63193           foot: "designated",
63194           motor_vehicle: "no"
63195         },
63196         steps: {
63197           foot: "yes",
63198           motor_vehicle: "no",
63199           bicycle: "no",
63200           horse: "no"
63201         },
63202         pedestrian: {
63203           foot: "yes",
63204           motor_vehicle: "no"
63205         },
63206         cycleway: {
63207           motor_vehicle: "no",
63208           bicycle: "designated"
63209         },
63210         bridleway: {
63211           motor_vehicle: "no",
63212           horse: "designated"
63213         },
63214         path: {
63215           foot: "yes",
63216           motor_vehicle: "no",
63217           bicycle: "yes",
63218           horse: "yes"
63219         },
63220         motorway: {
63221           foot: "no",
63222           motor_vehicle: "yes",
63223           bicycle: "no",
63224           horse: "no"
63225         },
63226         trunk: {
63227           motor_vehicle: "yes"
63228         },
63229         primary: {
63230           foot: "yes",
63231           motor_vehicle: "yes",
63232           bicycle: "yes",
63233           horse: "yes"
63234         },
63235         secondary: {
63236           foot: "yes",
63237           motor_vehicle: "yes",
63238           bicycle: "yes",
63239           horse: "yes"
63240         },
63241         tertiary: {
63242           foot: "yes",
63243           motor_vehicle: "yes",
63244           bicycle: "yes",
63245           horse: "yes"
63246         },
63247         residential: {
63248           foot: "yes",
63249           motor_vehicle: "yes",
63250           bicycle: "yes",
63251           horse: "yes"
63252         },
63253         unclassified: {
63254           foot: "yes",
63255           motor_vehicle: "yes",
63256           bicycle: "yes",
63257           horse: "yes"
63258         },
63259         service: {
63260           foot: "yes",
63261           motor_vehicle: "yes",
63262           bicycle: "yes",
63263           horse: "yes"
63264         },
63265         motorway_link: {
63266           foot: "no",
63267           motor_vehicle: "yes",
63268           bicycle: "no",
63269           horse: "no"
63270         },
63271         trunk_link: {
63272           motor_vehicle: "yes"
63273         },
63274         primary_link: {
63275           foot: "yes",
63276           motor_vehicle: "yes",
63277           bicycle: "yes",
63278           horse: "yes"
63279         },
63280         secondary_link: {
63281           foot: "yes",
63282           motor_vehicle: "yes",
63283           bicycle: "yes",
63284           horse: "yes"
63285         },
63286         tertiary_link: {
63287           foot: "yes",
63288           motor_vehicle: "yes",
63289           bicycle: "yes",
63290           horse: "yes"
63291         },
63292         construction: {
63293           access: "no"
63294         }
63295       },
63296       barrier: {
63297         bollard: {
63298           access: "no",
63299           bicycle: "yes",
63300           foot: "yes"
63301         },
63302         bus_trap: {
63303           motor_vehicle: "no",
63304           psv: "yes",
63305           foot: "yes",
63306           bicycle: "yes"
63307         },
63308         city_wall: {
63309           access: "no"
63310         },
63311         coupure: {
63312           access: "yes"
63313         },
63314         cycle_barrier: {
63315           motor_vehicle: "no"
63316         },
63317         ditch: {
63318           access: "no"
63319         },
63320         entrance: {
63321           access: "yes"
63322         },
63323         fence: {
63324           access: "no"
63325         },
63326         hedge: {
63327           access: "no"
63328         },
63329         jersey_barrier: {
63330           access: "no"
63331         },
63332         motorcycle_barrier: {
63333           motor_vehicle: "no"
63334         },
63335         rail_guard: {
63336           access: "no"
63337         }
63338       }
63339     };
63340     access.tags = function(tags) {
63341       _tags = tags;
63342       utilGetSetValue(items.selectAll(".preset-input-access"), function(d2) {
63343         return typeof tags[d2] === "string" ? tags[d2] : "";
63344       }).classed("mixed", function(d2) {
63345         return tags[d2] && Array.isArray(tags[d2]);
63346       }).attr("title", function(d2) {
63347         return tags[d2] && Array.isArray(tags[d2]) && tags[d2].filter(Boolean).join("\n");
63348       }).attr("placeholder", function(d2) {
63349         if (tags[d2] && Array.isArray(tags[d2])) {
63350           return _t("inspector.multiple_values");
63351         }
63352         if (d2 === "bicycle" || d2 === "motor_vehicle") {
63353           if (tags.vehicle && typeof tags.vehicle === "string") {
63354             return tags.vehicle;
63355           }
63356         }
63357         if (tags.access && typeof tags.access === "string") {
63358           return tags.access;
63359         }
63360         function getPlaceholdersByTag(key, placeholdersByKey) {
63361           if (typeof tags[key] === "string") {
63362             if (placeholdersByKey[tags[key]] && placeholdersByKey[tags[key]][d2]) {
63363               return placeholdersByKey[tags[key]][d2];
63364             }
63365           } else {
63366             var impliedAccesses = tags[key].filter(Boolean).map(function(val) {
63367               return placeholdersByKey[val] && placeholdersByKey[val][d2];
63368             }).filter(Boolean);
63369             if (impliedAccesses.length === tags[key].length && new Set(impliedAccesses).size === 1) {
63370               return impliedAccesses[0];
63371             }
63372           }
63373         }
63374         for (const key in placeholdersByTag) {
63375           if (tags[key]) {
63376             const impliedAccess = getPlaceholdersByTag(key, placeholdersByTag[key]);
63377             if (impliedAccess) {
63378               return impliedAccess;
63379             }
63380           }
63381         }
63382         if (d2 === "access" && !tags.barrier) {
63383           return "yes";
63384         }
63385         return field.placeholder();
63386       });
63387     };
63388     access.focus = function() {
63389       items.selectAll(".preset-input-access").node().focus();
63390     };
63391     return utilRebind(access, dispatch14, "on");
63392   }
63393
63394   // modules/ui/fields/address.js
63395   function uiFieldAddress(field, context) {
63396     var dispatch14 = dispatch_default("change");
63397     var _selection = select_default2(null);
63398     var _wrap = select_default2(null);
63399     var addrField = _mainPresetIndex.field("address");
63400     var _entityIDs = [];
63401     var _tags;
63402     var _countryCode;
63403     var _addressFormats = [{
63404       format: [
63405         ["housenumber", "street"],
63406         ["city", "postcode"]
63407       ]
63408     }];
63409     _mainFileFetcher.get("address_formats").then(function(d2) {
63410       _addressFormats = d2;
63411       if (!_selection.empty()) {
63412         _selection.call(address);
63413       }
63414     }).catch(function() {
63415     });
63416     function getNear(isAddressable, type2, searchRadius, resultProp) {
63417       var extent = combinedEntityExtent();
63418       var l2 = extent.center();
63419       var box = geoExtent(l2).padByMeters(searchRadius);
63420       var features = context.history().intersects(box).filter(isAddressable).map((d2) => {
63421         let dist = geoSphericalDistance(d2.extent(context.graph()).center(), l2);
63422         if (d2.geometry(context.graph()) === "line") {
63423           var loc = context.projection([
63424             (extent[0][0] + extent[1][0]) / 2,
63425             (extent[0][1] + extent[1][1]) / 2
63426           ]);
63427           var choice = geoChooseEdge(context.graph().childNodes(d2), loc, context.projection);
63428           dist = geoSphericalDistance(choice.loc, l2);
63429         }
63430         const value = resultProp && d2.tags[resultProp] ? d2.tags[resultProp] : d2.tags.name;
63431         let title = value;
63432         if (type2 === "street") {
63433           title = `${addrField.t("placeholders.street")}: ${title}`;
63434         } else if (type2 === "place") {
63435           title = `${addrField.t("placeholders.place")}: ${title}`;
63436         }
63437         return {
63438           title,
63439           value,
63440           dist,
63441           type: type2,
63442           klass: `address-${type2}`
63443         };
63444       }).sort(function(a2, b2) {
63445         return a2.dist - b2.dist;
63446       });
63447       return utilArrayUniqBy(features, "value");
63448     }
63449     function getNearStreets() {
63450       function isAddressable(d2) {
63451         return d2.tags.highway && d2.tags.name && d2.type === "way";
63452       }
63453       return getNear(isAddressable, "street", 200);
63454     }
63455     function getNearPlaces() {
63456       function isAddressable(d2) {
63457         if (d2.tags.name) {
63458           if (d2.tags.place)
63459             return true;
63460           if (d2.tags.boundary === "administrative" && d2.tags.admin_level > 8)
63461             return true;
63462         }
63463         return false;
63464       }
63465       return getNear(isAddressable, "place", 200);
63466     }
63467     function getNearCities() {
63468       function isAddressable(d2) {
63469         if (d2.tags.name) {
63470           if (d2.tags.boundary === "administrative" && d2.tags.admin_level === "8")
63471             return true;
63472           if (d2.tags.border_type === "city")
63473             return true;
63474           if (d2.tags.place === "city" || d2.tags.place === "town" || d2.tags.place === "village")
63475             return true;
63476         }
63477         if (d2.tags[`${field.key}:city`])
63478           return true;
63479         return false;
63480       }
63481       return getNear(isAddressable, "city", 200, `${field.key}:city`);
63482     }
63483     function getNearPostcodes() {
63484       return [...new Set([].concat(getNearValues("postcode")).concat(getNear((d2) => d2.tags.postal_code, "postcode", 200, "postal_code")))];
63485     }
63486     function getNearValues(key) {
63487       const tagKey = `${field.key}:${key}`;
63488       function hasTag(d2) {
63489         return _entityIDs.indexOf(d2.id) === -1 && d2.tags[tagKey];
63490       }
63491       return getNear(hasTag, key, 200, tagKey);
63492     }
63493     function updateForCountryCode() {
63494       if (!_countryCode)
63495         return;
63496       var addressFormat;
63497       for (var i3 = 0; i3 < _addressFormats.length; i3++) {
63498         var format2 = _addressFormats[i3];
63499         if (!format2.countryCodes) {
63500           addressFormat = format2;
63501         } else if (format2.countryCodes.indexOf(_countryCode) !== -1) {
63502           addressFormat = format2;
63503           break;
63504         }
63505       }
63506       var dropdowns = addressFormat.dropdowns || [
63507         "city",
63508         "county",
63509         "country",
63510         "district",
63511         "hamlet",
63512         "neighbourhood",
63513         "place",
63514         "postcode",
63515         "province",
63516         "quarter",
63517         "state",
63518         "street",
63519         "street+place",
63520         "subdistrict",
63521         "suburb"
63522       ];
63523       var widths = addressFormat.widths || {
63524         housenumber: 1 / 5,
63525         unit: 1 / 5,
63526         street: 1 / 2,
63527         place: 1 / 2,
63528         city: 2 / 3,
63529         state: 1 / 4,
63530         postcode: 1 / 3
63531       };
63532       function row(r2) {
63533         var total = r2.reduce(function(sum, key) {
63534           return sum + (widths[key] || 0.5);
63535         }, 0);
63536         return r2.map(function(key) {
63537           return {
63538             id: key,
63539             width: (widths[key] || 0.5) / total
63540           };
63541         });
63542       }
63543       var rows = _wrap.selectAll(".addr-row").data(addressFormat.format, function(d2) {
63544         return d2.toString();
63545       });
63546       rows.exit().remove();
63547       rows.enter().append("div").attr("class", "addr-row").selectAll("input").data(row).enter().append("input").property("type", "text").call(updatePlaceholder).attr("class", function(d2) {
63548         return "addr-" + d2.id;
63549       }).call(utilNoAuto).each(addDropdown).style("width", function(d2) {
63550         return d2.width * 100 + "%";
63551       });
63552       function addDropdown(d2) {
63553         if (dropdowns.indexOf(d2.id) === -1)
63554           return;
63555         var nearValues;
63556         switch (d2.id) {
63557           case "street":
63558             nearValues = getNearStreets;
63559             break;
63560           case "place":
63561             nearValues = getNearPlaces;
63562             break;
63563           case "street+place":
63564             nearValues = () => [].concat(getNearStreets()).concat(getNearPlaces());
63565             d2.isAutoStreetPlace = true;
63566             d2.id = _tags[`${field.key}:place`] ? "place" : "street";
63567             break;
63568           case "city":
63569             nearValues = getNearCities;
63570             break;
63571           case "postcode":
63572             nearValues = getNearPostcodes;
63573             break;
63574           default:
63575             nearValues = getNearValues;
63576         }
63577         select_default2(this).call(
63578           uiCombobox(context, `address-${d2.isAutoStreetPlace ? "street-place" : d2.id}`).minItems(1).caseSensitive(true).fetcher(function(typedValue, callback) {
63579             typedValue = typedValue.toLowerCase();
63580             callback(nearValues(d2.id).filter((v2) => v2.value.toLowerCase().indexOf(typedValue) !== -1));
63581           }).on("accept", function(selected) {
63582             if (d2.isAutoStreetPlace) {
63583               d2.id = selected ? selected.type : "street";
63584             }
63585           })
63586         );
63587       }
63588       _wrap.selectAll("input").on("blur", change()).on("change", change());
63589       _wrap.selectAll("input:not(.combobox-input)").on("input", change(true));
63590       if (_tags)
63591         updateTags(_tags);
63592     }
63593     function address(selection2) {
63594       _selection = selection2;
63595       _wrap = selection2.selectAll(".form-field-input-wrap").data([0]);
63596       _wrap = _wrap.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(_wrap);
63597       var extent = combinedEntityExtent();
63598       if (extent) {
63599         var countryCode;
63600         if (context.inIntro()) {
63601           countryCode = _t("intro.graph.countrycode");
63602         } else {
63603           var center = extent.center();
63604           countryCode = iso1A2Code(center);
63605         }
63606         if (countryCode) {
63607           _countryCode = countryCode.toLowerCase();
63608           updateForCountryCode();
63609         }
63610       }
63611     }
63612     function change(onInput) {
63613       return function() {
63614         setTimeout(() => {
63615           var tags = {};
63616           _wrap.selectAll("input").each(function(subfield) {
63617             var key = field.key + ":" + subfield.id;
63618             var value = this.value;
63619             if (!onInput)
63620               value = context.cleanTagValue(value);
63621             if (Array.isArray(_tags[key]) && !value)
63622               return;
63623             if (subfield.isAutoStreetPlace) {
63624               if (subfield.id === "street") {
63625                 tags[`${field.key}:place`] = void 0;
63626               } else if (subfield.id === "place") {
63627                 tags[`${field.key}:street`] = void 0;
63628               }
63629             }
63630             tags[key] = value || void 0;
63631           });
63632           Object.keys(tags).filter((k2) => tags[k2]).forEach((k2) => _tags[k2] = tags[k2]);
63633           dispatch14.call("change", this, tags, onInput);
63634         }, 0);
63635       };
63636     }
63637     function updatePlaceholder(inputSelection) {
63638       return inputSelection.attr("placeholder", function(subfield) {
63639         if (_tags && Array.isArray(_tags[field.key + ":" + subfield.id])) {
63640           return _t("inspector.multiple_values");
63641         }
63642         if (subfield.isAutoStreetPlace) {
63643           return `${getLocalPlaceholder("street")} / ${getLocalPlaceholder("place")}`;
63644         }
63645         return getLocalPlaceholder(subfield.id);
63646       });
63647     }
63648     function getLocalPlaceholder(key) {
63649       if (_countryCode) {
63650         var localkey = key + "!" + _countryCode;
63651         var tkey = addrField.hasTextForStringId("placeholders." + localkey) ? localkey : key;
63652         return addrField.t("placeholders." + tkey);
63653       }
63654     }
63655     function updateTags(tags) {
63656       utilGetSetValue(_wrap.selectAll("input"), (subfield) => {
63657         var val;
63658         if (subfield.isAutoStreetPlace) {
63659           const streetKey = `${field.key}:street`;
63660           const placeKey = `${field.key}:place`;
63661           if (tags[streetKey] !== void 0 || tags[placeKey] === void 0) {
63662             val = tags[streetKey];
63663             subfield.id = "street";
63664           } else {
63665             val = tags[placeKey];
63666             subfield.id = "place";
63667           }
63668         } else {
63669           val = tags[`${field.key}:${subfield.id}`];
63670         }
63671         return typeof val === "string" ? val : "";
63672       }).attr("title", function(subfield) {
63673         var val = tags[field.key + ":" + subfield.id];
63674         return val && Array.isArray(val) ? val.filter(Boolean).join("\n") : void 0;
63675       }).classed("mixed", function(subfield) {
63676         return Array.isArray(tags[field.key + ":" + subfield.id]);
63677       }).call(updatePlaceholder);
63678     }
63679     function combinedEntityExtent() {
63680       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
63681     }
63682     address.entityIDs = function(val) {
63683       if (!arguments.length)
63684         return _entityIDs;
63685       _entityIDs = val;
63686       return address;
63687     };
63688     address.tags = function(tags) {
63689       _tags = tags;
63690       updateTags(tags);
63691     };
63692     address.focus = function() {
63693       var node = _wrap.selectAll("input").node();
63694       if (node)
63695         node.focus();
63696     };
63697     return utilRebind(address, dispatch14, "on");
63698   }
63699
63700   // modules/ui/fields/directional_combo.js
63701   function uiFieldDirectionalCombo(field, context) {
63702     var dispatch14 = dispatch_default("change");
63703     var items = select_default2(null);
63704     var wrap2 = select_default2(null);
63705     var _tags;
63706     var _combos = {};
63707     if (field.type === "cycleway") {
63708       field = {
63709         ...field,
63710         key: field.keys[0],
63711         keys: field.keys.slice(1)
63712       };
63713     }
63714     function directionalCombo(selection2) {
63715       function stripcolon(s2) {
63716         return s2.replace(":", "");
63717       }
63718       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
63719       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
63720       var div = wrap2.selectAll("ul").data([0]);
63721       div = div.enter().append("ul").attr("class", "rows").merge(div);
63722       items = div.selectAll("li").data(field.keys);
63723       var enter = items.enter().append("li").attr("class", function(d2) {
63724         return "labeled-input preset-directionalcombo-" + stripcolon(d2);
63725       });
63726       enter.append("span").attr("class", "label preset-label-directionalcombo").attr("for", function(d2) {
63727         return "preset-input-directionalcombo-" + stripcolon(d2);
63728       }).html(function(d2) {
63729         return field.t.html("types." + d2);
63730       });
63731       enter.append("div").attr("class", "preset-input-directionalcombo-wrap form-field-input-wrap").each(function(key) {
63732         const subField = {
63733           ...field,
63734           type: "combo",
63735           key
63736         };
63737         const combo = uiFieldCombo(subField, context);
63738         combo.on("change", (t2) => change(key, t2[key]));
63739         _combos[key] = combo;
63740         select_default2(this).call(combo);
63741       });
63742       items = items.merge(enter);
63743       wrap2.selectAll(".preset-input-directionalcombo").on("change", change).on("blur", change);
63744     }
63745     function change(key, newValue) {
63746       const commonKey = field.key;
63747       const otherKey = key === field.keys[0] ? field.keys[1] : field.keys[0];
63748       dispatch14.call("change", this, (tags) => {
63749         const otherValue = tags[otherKey] || tags[commonKey];
63750         if (newValue === otherValue) {
63751           tags[commonKey] = newValue;
63752           delete tags[key];
63753           delete tags[otherKey];
63754         } else {
63755           tags[key] = newValue;
63756           delete tags[commonKey];
63757           tags[otherKey] = otherValue;
63758         }
63759         return tags;
63760       });
63761     }
63762     directionalCombo.tags = function(tags) {
63763       _tags = tags;
63764       const commonKey = field.key;
63765       for (let key in _combos) {
63766         const uniqueValues = [...new Set([].concat(_tags[commonKey]).concat(_tags[key]).filter(Boolean))];
63767         _combos[key].tags({ [key]: uniqueValues.length > 1 ? uniqueValues : uniqueValues[0] });
63768       }
63769     };
63770     directionalCombo.focus = function() {
63771       var node = wrap2.selectAll("input").node();
63772       if (node)
63773         node.focus();
63774     };
63775     return utilRebind(directionalCombo, dispatch14, "on");
63776   }
63777
63778   // modules/ui/fields/lanes.js
63779   function uiFieldLanes(field, context) {
63780     var dispatch14 = dispatch_default("change");
63781     var LANE_WIDTH = 40;
63782     var LANE_HEIGHT = 200;
63783     var _entityIDs = [];
63784     function lanes(selection2) {
63785       var lanesData = context.entity(_entityIDs[0]).lanes();
63786       if (!context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode) {
63787         selection2.call(lanes.off);
63788         return;
63789       }
63790       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
63791       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
63792       var surface = wrap2.selectAll(".surface").data([0]);
63793       var d2 = utilGetDimensions(wrap2);
63794       var freeSpace = d2[0] - lanesData.lanes.length * LANE_WIDTH * 1.5 + LANE_WIDTH * 0.5;
63795       surface = surface.enter().append("svg").attr("width", d2[0]).attr("height", 300).attr("class", "surface").merge(surface);
63796       var lanesSelection = surface.selectAll(".lanes").data([0]);
63797       lanesSelection = lanesSelection.enter().append("g").attr("class", "lanes").merge(lanesSelection);
63798       lanesSelection.attr("transform", function() {
63799         return "translate(" + freeSpace / 2 + ", 0)";
63800       });
63801       var lane = lanesSelection.selectAll(".lane").data(lanesData.lanes);
63802       lane.exit().remove();
63803       var enter = lane.enter().append("g").attr("class", "lane");
63804       enter.append("g").append("rect").attr("y", 50).attr("width", LANE_WIDTH).attr("height", LANE_HEIGHT);
63805       enter.append("g").attr("class", "forward").append("text").attr("y", 40).attr("x", 14).text("\u25B2");
63806       enter.append("g").attr("class", "bothways").append("text").attr("y", 40).attr("x", 14).text("\u25B2\u25BC");
63807       enter.append("g").attr("class", "backward").append("text").attr("y", 40).attr("x", 14).text("\u25BC");
63808       lane = lane.merge(enter);
63809       lane.attr("transform", function(d4) {
63810         return "translate(" + LANE_WIDTH * d4.index * 1.5 + ", 0)";
63811       });
63812       lane.select(".forward").style("visibility", function(d4) {
63813         return d4.direction === "forward" ? "visible" : "hidden";
63814       });
63815       lane.select(".bothways").style("visibility", function(d4) {
63816         return d4.direction === "bothways" ? "visible" : "hidden";
63817       });
63818       lane.select(".backward").style("visibility", function(d4) {
63819         return d4.direction === "backward" ? "visible" : "hidden";
63820       });
63821     }
63822     lanes.entityIDs = function(val) {
63823       _entityIDs = val;
63824     };
63825     lanes.tags = function() {
63826     };
63827     lanes.focus = function() {
63828     };
63829     lanes.off = function() {
63830     };
63831     return utilRebind(lanes, dispatch14, "on");
63832   }
63833   uiFieldLanes.supportsMultiselection = false;
63834
63835   // modules/ui/fields/localized.js
63836   var _languagesArray = [];
63837   function uiFieldLocalized(field, context) {
63838     var dispatch14 = dispatch_default("change", "input");
63839     var wikipedia = services.wikipedia;
63840     var input = select_default2(null);
63841     var localizedInputs = select_default2(null);
63842     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
63843     var _countryCode;
63844     var _tags;
63845     _mainFileFetcher.get("languages").then(loadLanguagesArray).catch(function() {
63846     });
63847     var _territoryLanguages = {};
63848     _mainFileFetcher.get("territory_languages").then(function(d2) {
63849       _territoryLanguages = d2;
63850     }).catch(function() {
63851     });
63852     var langCombo = uiCombobox(context, "localized-lang").fetcher(fetchLanguages).minItems(0);
63853     var _selection = select_default2(null);
63854     var _multilingual = [];
63855     var _buttonTip = uiTooltip().title(() => _t.append("translate.translate")).placement("left");
63856     var _wikiTitles;
63857     var _entityIDs = [];
63858     function loadLanguagesArray(dataLanguages) {
63859       if (_languagesArray.length !== 0)
63860         return;
63861       var replacements = {
63862         sr: "sr-Cyrl",
63863         // in OSM, `sr` implies Cyrillic
63864         "sr-Cyrl": false
63865         // `sr-Cyrl` isn't used in OSM
63866       };
63867       for (var code in dataLanguages) {
63868         if (replacements[code] === false)
63869           continue;
63870         var metaCode = code;
63871         if (replacements[code])
63872           metaCode = replacements[code];
63873         _languagesArray.push({
63874           localName: _mainLocalizer.languageName(metaCode, { localOnly: true }),
63875           nativeName: dataLanguages[metaCode].nativeName,
63876           code,
63877           label: _mainLocalizer.languageName(metaCode)
63878         });
63879       }
63880     }
63881     function calcLocked() {
63882       var isLocked = field.id === "name" && _entityIDs.length && _entityIDs.some(function(entityID) {
63883         var entity = context.graph().hasEntity(entityID);
63884         if (!entity)
63885           return false;
63886         if (entity.tags.wikidata)
63887           return true;
63888         if (entity.tags["name:etymology:wikidata"])
63889           return true;
63890         var preset = _mainPresetIndex.match(entity, context.graph());
63891         if (preset) {
63892           var isSuggestion = preset.suggestion;
63893           var fields = preset.fields(entity.extent(context.graph()).center());
63894           var showsBrandField = fields.some(function(d2) {
63895             return d2.id === "brand";
63896           });
63897           var showsOperatorField = fields.some(function(d2) {
63898             return d2.id === "operator";
63899           });
63900           var setsName = preset.addTags.name;
63901           var setsBrandWikidata = preset.addTags["brand:wikidata"];
63902           var setsOperatorWikidata = preset.addTags["operator:wikidata"];
63903           return isSuggestion && setsName && (setsBrandWikidata && !showsBrandField || setsOperatorWikidata && !showsOperatorField);
63904         }
63905         return false;
63906       });
63907       field.locked(isLocked);
63908     }
63909     function calcMultilingual(tags) {
63910       var existingLangsOrdered = _multilingual.map(function(item2) {
63911         return item2.lang;
63912       });
63913       var existingLangs = new Set(existingLangsOrdered.filter(Boolean));
63914       for (var k2 in tags) {
63915         var m2 = k2.match(/^(.*):([a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-[A-Z]{2})?)$/);
63916         if (m2 && m2[1] === field.key && m2[2]) {
63917           var item = { lang: m2[2], value: tags[k2] };
63918           if (existingLangs.has(item.lang)) {
63919             _multilingual[existingLangsOrdered.indexOf(item.lang)].value = item.value;
63920             existingLangs.delete(item.lang);
63921           } else {
63922             _multilingual.push(item);
63923           }
63924         }
63925       }
63926       _multilingual.forEach(function(item2) {
63927         if (item2.lang && existingLangs.has(item2.lang)) {
63928           item2.value = "";
63929         }
63930       });
63931     }
63932     function localized(selection2) {
63933       _selection = selection2;
63934       calcLocked();
63935       var isLocked = field.locked();
63936       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
63937       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
63938       input = wrap2.selectAll(".localized-main").data([0]);
63939       input = input.enter().append("input").attr("type", "text").attr("id", field.domId).attr("class", "localized-main").call(utilNoAuto).merge(input);
63940       input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
63941       wrap2.call(_lengthIndicator);
63942       var translateButton = wrap2.selectAll(".localized-add").data([0]);
63943       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);
63944       translateButton.classed("disabled", !!isLocked).call(isLocked ? _buttonTip.destroy : _buttonTip).on("click", addNew);
63945       if (_tags && !_multilingual.length) {
63946         calcMultilingual(_tags);
63947       }
63948       localizedInputs = selection2.selectAll(".localized-multilingual").data([0]);
63949       localizedInputs = localizedInputs.enter().append("div").attr("class", "localized-multilingual").merge(localizedInputs);
63950       localizedInputs.call(renderMultilingual);
63951       localizedInputs.selectAll("button, input").classed("disabled", !!isLocked).attr("readonly", isLocked || null);
63952       selection2.selectAll(".combobox-caret").classed("nope", true);
63953       function addNew(d3_event) {
63954         d3_event.preventDefault();
63955         if (field.locked())
63956           return;
63957         var defaultLang = _mainLocalizer.languageCode().toLowerCase();
63958         var langExists = _multilingual.find(function(datum2) {
63959           return datum2.lang === defaultLang;
63960         });
63961         var isLangEn = defaultLang.indexOf("en") > -1;
63962         if (isLangEn || langExists) {
63963           defaultLang = "";
63964           langExists = _multilingual.find(function(datum2) {
63965             return datum2.lang === defaultLang;
63966           });
63967         }
63968         if (!langExists) {
63969           _multilingual.unshift({ lang: defaultLang, value: "" });
63970           localizedInputs.call(renderMultilingual);
63971         }
63972       }
63973       function change(onInput) {
63974         return function(d3_event) {
63975           if (field.locked()) {
63976             d3_event.preventDefault();
63977             return;
63978           }
63979           var val = utilGetSetValue(select_default2(this));
63980           if (!onInput)
63981             val = context.cleanTagValue(val);
63982           if (!val && Array.isArray(_tags[field.key]))
63983             return;
63984           var t2 = {};
63985           t2[field.key] = val || void 0;
63986           dispatch14.call("change", this, t2, onInput);
63987         };
63988       }
63989     }
63990     function key(lang) {
63991       return field.key + ":" + lang;
63992     }
63993     function changeLang(d3_event, d2) {
63994       var tags = {};
63995       var lang = utilGetSetValue(select_default2(this)).toLowerCase();
63996       var language = _languagesArray.find(function(d4) {
63997         return d4.label.toLowerCase() === lang || d4.localName && d4.localName.toLowerCase() === lang || d4.nativeName && d4.nativeName.toLowerCase() === lang;
63998       });
63999       if (language)
64000         lang = language.code;
64001       if (d2.lang && d2.lang !== lang) {
64002         tags[key(d2.lang)] = void 0;
64003       }
64004       var newKey = lang && context.cleanTagKey(key(lang));
64005       var value = utilGetSetValue(select_default2(this.parentNode).selectAll(".localized-value"));
64006       if (newKey && value) {
64007         tags[newKey] = value;
64008       } else if (newKey && _wikiTitles && _wikiTitles[d2.lang]) {
64009         tags[newKey] = _wikiTitles[d2.lang];
64010       }
64011       d2.lang = lang;
64012       dispatch14.call("change", this, tags);
64013     }
64014     function changeValue(d3_event, d2) {
64015       if (!d2.lang)
64016         return;
64017       var value = context.cleanTagValue(utilGetSetValue(select_default2(this))) || void 0;
64018       if (!value && Array.isArray(d2.value))
64019         return;
64020       var t2 = {};
64021       t2[key(d2.lang)] = value;
64022       d2.value = value;
64023       dispatch14.call("change", this, t2);
64024     }
64025     function fetchLanguages(value, cb) {
64026       var v2 = value.toLowerCase();
64027       var langCodes = [_mainLocalizer.localeCode(), _mainLocalizer.languageCode()];
64028       if (_countryCode && _territoryLanguages[_countryCode]) {
64029         langCodes = langCodes.concat(_territoryLanguages[_countryCode]);
64030       }
64031       var langItems = [];
64032       langCodes.forEach(function(code) {
64033         var langItem = _languagesArray.find(function(item) {
64034           return item.code === code;
64035         });
64036         if (langItem)
64037           langItems.push(langItem);
64038       });
64039       langItems = utilArrayUniq(langItems.concat(_languagesArray));
64040       cb(langItems.filter(function(d2) {
64041         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;
64042       }).map(function(d2) {
64043         return { value: d2.label };
64044       }));
64045     }
64046     function renderMultilingual(selection2) {
64047       var entries = selection2.selectAll("div.entry").data(_multilingual, function(d2) {
64048         return d2.lang;
64049       });
64050       entries.exit().style("top", "0").style("max-height", "240px").transition().duration(200).style("opacity", "0").style("max-height", "0px").remove();
64051       var entriesEnter = entries.enter().append("div").attr("class", "entry").each(function(_2, index) {
64052         var wrap2 = select_default2(this);
64053         var domId = utilUniqueDomId(index);
64054         var label = wrap2.append("label").attr("class", "field-label").attr("for", domId);
64055         var text2 = label.append("span").attr("class", "label-text");
64056         text2.append("span").attr("class", "label-textvalue").call(_t.append("translate.localized_translation_label"));
64057         text2.append("span").attr("class", "label-textannotation");
64058         label.append("button").attr("class", "remove-icon-multilingual").attr("title", _t("icons.remove")).on("click", function(d3_event, d2) {
64059           if (field.locked())
64060             return;
64061           d3_event.preventDefault();
64062           _multilingual.splice(_multilingual.indexOf(d2), 1);
64063           var langKey = d2.lang && key(d2.lang);
64064           if (langKey && langKey in _tags) {
64065             delete _tags[langKey];
64066             var t2 = {};
64067             t2[langKey] = void 0;
64068             dispatch14.call("change", this, t2);
64069             return;
64070           }
64071           renderMultilingual(selection2);
64072         }).call(svgIcon("#iD-operation-delete"));
64073         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);
64074         wrap2.append("input").attr("type", "text").attr("class", "localized-value").on("blur", changeValue).on("change", changeValue);
64075       });
64076       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() {
64077         select_default2(this).style("max-height", "").style("overflow", "visible");
64078       });
64079       entries = entries.merge(entriesEnter);
64080       entries.order();
64081       entries.classed("present", true);
64082       utilGetSetValue(entries.select(".localized-lang"), function(d2) {
64083         var langItem = _languagesArray.find(function(item) {
64084           return item.code === d2.lang;
64085         });
64086         if (langItem)
64087           return langItem.label;
64088         return d2.lang;
64089       });
64090       utilGetSetValue(entries.select(".localized-value"), function(d2) {
64091         return typeof d2.value === "string" ? d2.value : "";
64092       }).attr("title", function(d2) {
64093         return Array.isArray(d2.value) ? d2.value.filter(Boolean).join("\n") : null;
64094       }).attr("placeholder", function(d2) {
64095         return Array.isArray(d2.value) ? _t("inspector.multiple_values") : _t("translate.localized_translation_name");
64096       }).classed("mixed", function(d2) {
64097         return Array.isArray(d2.value);
64098       });
64099     }
64100     localized.tags = function(tags) {
64101       _tags = tags;
64102       if (typeof tags.wikipedia === "string" && !_wikiTitles) {
64103         _wikiTitles = {};
64104         var wm = tags.wikipedia.match(/([^:]+):(.+)/);
64105         if (wm && wm[0] && wm[1]) {
64106           wikipedia.translations(wm[1], wm[2], function(err, d2) {
64107             if (err || !d2)
64108               return;
64109             _wikiTitles = d2;
64110           });
64111         }
64112       }
64113       var isMixed = Array.isArray(tags[field.key]);
64114       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);
64115       calcMultilingual(tags);
64116       _selection.call(localized);
64117       if (!isMixed) {
64118         _lengthIndicator.update(tags[field.key]);
64119       }
64120     };
64121     localized.focus = function() {
64122       input.node().focus();
64123     };
64124     localized.entityIDs = function(val) {
64125       if (!arguments.length)
64126         return _entityIDs;
64127       _entityIDs = val;
64128       _multilingual = [];
64129       loadCountryCode();
64130       return localized;
64131     };
64132     function loadCountryCode() {
64133       var extent = combinedEntityExtent();
64134       var countryCode = extent && iso1A2Code(extent.center());
64135       _countryCode = countryCode && countryCode.toLowerCase();
64136     }
64137     function combinedEntityExtent() {
64138       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
64139     }
64140     return utilRebind(localized, dispatch14, "on");
64141   }
64142
64143   // modules/ui/fields/roadheight.js
64144   function uiFieldRoadheight(field, context) {
64145     var dispatch14 = dispatch_default("change");
64146     var primaryUnitInput = select_default2(null);
64147     var primaryInput = select_default2(null);
64148     var secondaryInput = select_default2(null);
64149     var secondaryUnitInput = select_default2(null);
64150     var _entityIDs = [];
64151     var _tags;
64152     var _isImperial;
64153     var formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
64154     var parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
64155     var primaryUnits = [
64156       {
64157         value: "m",
64158         title: _t("inspector.roadheight.meter")
64159       },
64160       {
64161         value: "ft",
64162         title: _t("inspector.roadheight.foot")
64163       }
64164     ];
64165     var unitCombo = uiCombobox(context, "roadheight-unit").data(primaryUnits);
64166     function roadheight(selection2) {
64167       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
64168       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
64169       primaryInput = wrap2.selectAll("input.roadheight-number").data([0]);
64170       primaryInput = primaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-number").attr("id", field.domId).call(utilNoAuto).merge(primaryInput);
64171       primaryInput.on("change", change).on("blur", change);
64172       var loc = combinedEntityExtent().center();
64173       _isImperial = roadHeightUnit(loc) === "ft";
64174       primaryUnitInput = wrap2.selectAll("input.roadheight-unit").data([0]);
64175       primaryUnitInput = primaryUnitInput.enter().append("input").attr("type", "text").attr("class", "roadheight-unit").call(unitCombo).merge(primaryUnitInput);
64176       primaryUnitInput.on("blur", changeUnits).on("change", changeUnits);
64177       secondaryInput = wrap2.selectAll("input.roadheight-secondary-number").data([0]);
64178       secondaryInput = secondaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-secondary-number").call(utilNoAuto).merge(secondaryInput);
64179       secondaryInput.on("change", change).on("blur", change);
64180       secondaryUnitInput = wrap2.selectAll("input.roadheight-secondary-unit").data([0]);
64181       secondaryUnitInput = secondaryUnitInput.enter().append("input").attr("type", "text").call(utilNoAuto).classed("disabled", true).classed("roadheight-secondary-unit", true).attr("readonly", "readonly").merge(secondaryUnitInput);
64182       function changeUnits() {
64183         var primaryUnit = utilGetSetValue(primaryUnitInput);
64184         if (primaryUnit === "m") {
64185           _isImperial = false;
64186         } else if (primaryUnit === "ft") {
64187           _isImperial = true;
64188         }
64189         utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
64190         setUnitSuggestions();
64191         change();
64192       }
64193     }
64194     function setUnitSuggestions() {
64195       utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
64196     }
64197     function change() {
64198       var tag = {};
64199       var primaryValue = utilGetSetValue(primaryInput).trim();
64200       var secondaryValue = utilGetSetValue(secondaryInput).trim();
64201       if (!primaryValue && !secondaryValue && Array.isArray(_tags[field.key]))
64202         return;
64203       if (!primaryValue && !secondaryValue) {
64204         tag[field.key] = void 0;
64205       } else {
64206         var rawPrimaryValue = likelyRawNumberFormat.test(primaryValue) ? parseFloat(primaryValue) : parseLocaleFloat(primaryValue);
64207         if (isNaN(rawPrimaryValue))
64208           rawPrimaryValue = primaryValue;
64209         var rawSecondaryValue = likelyRawNumberFormat.test(secondaryValue) ? parseFloat(secondaryValue) : parseLocaleFloat(secondaryValue);
64210         if (isNaN(rawSecondaryValue))
64211           rawSecondaryValue = secondaryValue;
64212         if (isNaN(rawPrimaryValue) || isNaN(rawSecondaryValue) || !_isImperial) {
64213           tag[field.key] = context.cleanTagValue(rawPrimaryValue);
64214         } else {
64215           if (rawPrimaryValue !== "") {
64216             rawPrimaryValue = rawPrimaryValue + "'";
64217           }
64218           if (rawSecondaryValue !== "") {
64219             rawSecondaryValue = rawSecondaryValue + '"';
64220           }
64221           tag[field.key] = context.cleanTagValue(rawPrimaryValue + rawSecondaryValue);
64222         }
64223       }
64224       dispatch14.call("change", this, tag);
64225     }
64226     roadheight.tags = function(tags) {
64227       _tags = tags;
64228       var primaryValue = tags[field.key];
64229       var secondaryValue;
64230       var isMixed = Array.isArray(primaryValue);
64231       if (!isMixed) {
64232         if (primaryValue && (primaryValue.indexOf("'") >= 0 || primaryValue.indexOf('"') >= 0)) {
64233           secondaryValue = primaryValue.match(/(-?[\d.]+)"/);
64234           if (secondaryValue !== null) {
64235             secondaryValue = formatFloat(parseFloat(secondaryValue[1]));
64236           }
64237           primaryValue = primaryValue.match(/(-?[\d.]+)'/);
64238           if (primaryValue !== null) {
64239             primaryValue = formatFloat(parseFloat(primaryValue[1]));
64240           }
64241           _isImperial = true;
64242         } else if (primaryValue) {
64243           var rawValue = primaryValue;
64244           primaryValue = parseFloat(rawValue);
64245           if (isNaN(primaryValue)) {
64246             primaryValue = rawValue;
64247           } else {
64248             primaryValue = formatFloat(primaryValue);
64249           }
64250           _isImperial = false;
64251         }
64252       }
64253       setUnitSuggestions();
64254       var inchesPlaceholder = formatFloat(0);
64255       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);
64256       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");
64257       secondaryUnitInput.attr("value", _isImperial ? _t("inspector.roadheight.inch") : null);
64258     };
64259     roadheight.focus = function() {
64260       primaryInput.node().focus();
64261     };
64262     roadheight.entityIDs = function(val) {
64263       _entityIDs = val;
64264     };
64265     function combinedEntityExtent() {
64266       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
64267     }
64268     return utilRebind(roadheight, dispatch14, "on");
64269   }
64270
64271   // modules/ui/fields/roadspeed.js
64272   function uiFieldRoadspeed(field, context) {
64273     var dispatch14 = dispatch_default("change");
64274     var unitInput = select_default2(null);
64275     var input = select_default2(null);
64276     var _entityIDs = [];
64277     var _tags;
64278     var _isImperial;
64279     var formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
64280     var parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
64281     var speedCombo = uiCombobox(context, "roadspeed");
64282     var unitCombo = uiCombobox(context, "roadspeed-unit").data(["km/h", "mph"].map(comboValues));
64283     var metricValues = [20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120];
64284     var imperialValues = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80];
64285     function roadspeed(selection2) {
64286       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
64287       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
64288       input = wrap2.selectAll("input.roadspeed-number").data([0]);
64289       input = input.enter().append("input").attr("type", "text").attr("class", "roadspeed-number").attr("id", field.domId).call(utilNoAuto).call(speedCombo).merge(input);
64290       input.on("change", change).on("blur", change);
64291       var loc = combinedEntityExtent().center();
64292       _isImperial = roadSpeedUnit(loc) === "mph";
64293       unitInput = wrap2.selectAll("input.roadspeed-unit").data([0]);
64294       unitInput = unitInput.enter().append("input").attr("type", "text").attr("class", "roadspeed-unit").attr("aria-label", _t("inspector.speed_unit")).call(unitCombo).merge(unitInput);
64295       unitInput.on("blur", changeUnits).on("change", changeUnits);
64296       function changeUnits() {
64297         var unit2 = utilGetSetValue(unitInput);
64298         if (unit2 === "km/h") {
64299           _isImperial = false;
64300         } else if (unit2 === "mph") {
64301           _isImperial = true;
64302         }
64303         utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
64304         setUnitSuggestions();
64305         change();
64306       }
64307     }
64308     function setUnitSuggestions() {
64309       speedCombo.data((_isImperial ? imperialValues : metricValues).map(comboValues));
64310       utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
64311     }
64312     function comboValues(d2) {
64313       return {
64314         value: formatFloat(d2),
64315         title: formatFloat(d2)
64316       };
64317     }
64318     function change() {
64319       var tag = {};
64320       var value = utilGetSetValue(input).trim();
64321       if (!value && Array.isArray(_tags[field.key]))
64322         return;
64323       if (!value) {
64324         tag[field.key] = void 0;
64325       } else {
64326         var rawValue = likelyRawNumberFormat.test(value) ? parseFloat(value) : parseLocaleFloat(value);
64327         if (isNaN(rawValue))
64328           rawValue = value;
64329         if (isNaN(rawValue) || !_isImperial) {
64330           tag[field.key] = context.cleanTagValue(rawValue);
64331         } else {
64332           tag[field.key] = context.cleanTagValue(rawValue + " mph");
64333         }
64334       }
64335       dispatch14.call("change", this, tag);
64336     }
64337     roadspeed.tags = function(tags) {
64338       _tags = tags;
64339       var rawValue = tags[field.key];
64340       var value = rawValue;
64341       var isMixed = Array.isArray(value);
64342       if (!isMixed) {
64343         if (rawValue && rawValue.indexOf("mph") >= 0) {
64344           _isImperial = true;
64345         } else if (rawValue) {
64346           _isImperial = false;
64347         }
64348         value = parseInt(value, 10);
64349         if (isNaN(value)) {
64350           value = rawValue;
64351         } else {
64352           value = formatFloat(value);
64353         }
64354       }
64355       setUnitSuggestions();
64356       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);
64357     };
64358     roadspeed.focus = function() {
64359       input.node().focus();
64360     };
64361     roadspeed.entityIDs = function(val) {
64362       _entityIDs = val;
64363     };
64364     function combinedEntityExtent() {
64365       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
64366     }
64367     return utilRebind(roadspeed, dispatch14, "on");
64368   }
64369
64370   // modules/ui/fields/radio.js
64371   function uiFieldRadio(field, context) {
64372     var dispatch14 = dispatch_default("change");
64373     var placeholder = select_default2(null);
64374     var wrap2 = select_default2(null);
64375     var labels = select_default2(null);
64376     var radios = select_default2(null);
64377     var radioData = (field.options || field.keys).slice();
64378     var typeField;
64379     var layerField;
64380     var _oldType = {};
64381     var _entityIDs = [];
64382     function selectedKey() {
64383       var node = wrap2.selectAll(".form-field-input-radio label.active input");
64384       return !node.empty() && node.datum();
64385     }
64386     function radio(selection2) {
64387       selection2.classed("preset-radio", true);
64388       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
64389       var enter = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-radio");
64390       enter.append("span").attr("class", "placeholder");
64391       wrap2 = wrap2.merge(enter);
64392       placeholder = wrap2.selectAll(".placeholder");
64393       labels = wrap2.selectAll("label").data(radioData);
64394       enter = labels.enter().append("label");
64395       var stringsField = field.resolveReference("stringsCrossReference");
64396       enter.append("input").attr("type", "radio").attr("name", field.id).attr("value", function(d2) {
64397         return stringsField.t("options." + d2, { "default": d2 });
64398       }).attr("checked", false);
64399       enter.append("span").each(function(d2) {
64400         stringsField.t.append("options." + d2, { "default": d2 })(select_default2(this));
64401       });
64402       labels = labels.merge(enter);
64403       radios = labels.selectAll("input").on("change", changeRadio);
64404     }
64405     function structureExtras(selection2, tags) {
64406       var selected = selectedKey() || tags.layer !== void 0;
64407       var type2 = _mainPresetIndex.field(selected);
64408       var layer = _mainPresetIndex.field("layer");
64409       var showLayer = selected === "bridge" || selected === "tunnel" || tags.layer !== void 0;
64410       var extrasWrap = selection2.selectAll(".structure-extras-wrap").data(selected ? [0] : []);
64411       extrasWrap.exit().remove();
64412       extrasWrap = extrasWrap.enter().append("div").attr("class", "structure-extras-wrap").merge(extrasWrap);
64413       var list = extrasWrap.selectAll("ul").data([0]);
64414       list = list.enter().append("ul").attr("class", "rows").merge(list);
64415       if (type2) {
64416         if (!typeField || typeField.id !== selected) {
64417           typeField = uiField(context, type2, _entityIDs, { wrap: false }).on("change", changeType);
64418         }
64419         typeField.tags(tags);
64420       } else {
64421         typeField = null;
64422       }
64423       var typeItem = list.selectAll(".structure-type-item").data(typeField ? [typeField] : [], function(d2) {
64424         return d2.id;
64425       });
64426       typeItem.exit().remove();
64427       var typeEnter = typeItem.enter().insert("li", ":first-child").attr("class", "labeled-input structure-type-item");
64428       typeEnter.append("span").attr("class", "label structure-label-type").attr("for", "preset-input-" + selected).call(_t.append("inspector.radio.structure.type"));
64429       typeEnter.append("div").attr("class", "structure-input-type-wrap");
64430       typeItem = typeItem.merge(typeEnter);
64431       if (typeField) {
64432         typeItem.selectAll(".structure-input-type-wrap").call(typeField.render);
64433       }
64434       if (layer && showLayer) {
64435         if (!layerField) {
64436           layerField = uiField(context, layer, _entityIDs, { wrap: false }).on("change", changeLayer);
64437         }
64438         layerField.tags(tags);
64439         field.keys = utilArrayUnion(field.keys, ["layer"]);
64440       } else {
64441         layerField = null;
64442         field.keys = field.keys.filter(function(k2) {
64443           return k2 !== "layer";
64444         });
64445       }
64446       var layerItem = list.selectAll(".structure-layer-item").data(layerField ? [layerField] : []);
64447       layerItem.exit().remove();
64448       var layerEnter = layerItem.enter().append("li").attr("class", "labeled-input structure-layer-item");
64449       layerEnter.append("span").attr("class", "label structure-label-layer").attr("for", "preset-input-layer").call(_t.append("inspector.radio.structure.layer"));
64450       layerEnter.append("div").attr("class", "structure-input-layer-wrap");
64451       layerItem = layerItem.merge(layerEnter);
64452       if (layerField) {
64453         layerItem.selectAll(".structure-input-layer-wrap").call(layerField.render);
64454       }
64455     }
64456     function changeType(t2, onInput) {
64457       var key = selectedKey();
64458       if (!key)
64459         return;
64460       var val = t2[key];
64461       if (val !== "no") {
64462         _oldType[key] = val;
64463       }
64464       if (field.type === "structureRadio") {
64465         if (val === "no" || key !== "bridge" && key !== "tunnel" || key === "tunnel" && val === "building_passage") {
64466           t2.layer = void 0;
64467         }
64468         if (t2.layer === void 0) {
64469           if (key === "bridge" && val !== "no") {
64470             t2.layer = "1";
64471           }
64472           if (key === "tunnel" && val !== "no" && val !== "building_passage") {
64473             t2.layer = "-1";
64474           }
64475         }
64476       }
64477       dispatch14.call("change", this, t2, onInput);
64478     }
64479     function changeLayer(t2, onInput) {
64480       if (t2.layer === "0") {
64481         t2.layer = void 0;
64482       }
64483       dispatch14.call("change", this, t2, onInput);
64484     }
64485     function changeRadio() {
64486       var t2 = {};
64487       var activeKey;
64488       if (field.key) {
64489         t2[field.key] = void 0;
64490       }
64491       radios.each(function(d2) {
64492         var active = select_default2(this).property("checked");
64493         if (active)
64494           activeKey = d2;
64495         if (field.key) {
64496           if (active)
64497             t2[field.key] = d2;
64498         } else {
64499           var val = _oldType[activeKey] || "yes";
64500           t2[d2] = active ? val : void 0;
64501         }
64502       });
64503       if (field.type === "structureRadio") {
64504         if (activeKey === "bridge") {
64505           t2.layer = "1";
64506         } else if (activeKey === "tunnel" && t2.tunnel !== "building_passage") {
64507           t2.layer = "-1";
64508         } else {
64509           t2.layer = void 0;
64510         }
64511       }
64512       dispatch14.call("change", this, t2);
64513     }
64514     radio.tags = function(tags) {
64515       function isOptionChecked(d2) {
64516         if (field.key) {
64517           return tags[field.key] === d2;
64518         }
64519         return !!(typeof tags[d2] === "string" && tags[d2].toLowerCase() !== "no");
64520       }
64521       function isMixed(d2) {
64522         if (field.key) {
64523           return Array.isArray(tags[field.key]) && tags[field.key].includes(d2);
64524         }
64525         return Array.isArray(tags[d2]);
64526       }
64527       radios.property("checked", function(d2) {
64528         return isOptionChecked(d2) && (field.key || field.options.filter(isOptionChecked).length === 1);
64529       });
64530       labels.classed("active", function(d2) {
64531         if (field.key) {
64532           return Array.isArray(tags[field.key]) && tags[field.key].includes(d2) || tags[field.key] === d2;
64533         }
64534         return Array.isArray(tags[d2]) && tags[d2].some((v2) => typeof v2 === "string" && v2.toLowerCase() !== "no") || !!(typeof tags[d2] === "string" && tags[d2].toLowerCase() !== "no");
64535       }).classed("mixed", isMixed).attr("title", function(d2) {
64536         return isMixed(d2) ? _t("inspector.unshared_value_tooltip") : null;
64537       });
64538       var selection2 = radios.filter(function() {
64539         return this.checked;
64540       });
64541       if (selection2.empty()) {
64542         placeholder.text("");
64543         placeholder.call(_t.append("inspector.none"));
64544       } else {
64545         placeholder.text(selection2.attr("value"));
64546         _oldType[selection2.datum()] = tags[selection2.datum()];
64547       }
64548       if (field.type === "structureRadio") {
64549         if (!!tags.waterway && !_oldType.tunnel) {
64550           _oldType.tunnel = "culvert";
64551         }
64552         wrap2.call(structureExtras, tags);
64553       }
64554     };
64555     radio.focus = function() {
64556       radios.node().focus();
64557     };
64558     radio.entityIDs = function(val) {
64559       if (!arguments.length)
64560         return _entityIDs;
64561       _entityIDs = val;
64562       _oldType = {};
64563       return radio;
64564     };
64565     radio.isAllowed = function() {
64566       return _entityIDs.length === 1;
64567     };
64568     return utilRebind(radio, dispatch14, "on");
64569   }
64570
64571   // modules/ui/fields/restrictions.js
64572   function uiFieldRestrictions(field, context) {
64573     var dispatch14 = dispatch_default("change");
64574     var breathe = behaviorBreathe(context);
64575     corePreferences("turn-restriction-via-way", null);
64576     var storedViaWay = corePreferences("turn-restriction-via-way0");
64577     var storedDistance = corePreferences("turn-restriction-distance");
64578     var _maxViaWay = storedViaWay !== null ? +storedViaWay : 0;
64579     var _maxDistance = storedDistance ? +storedDistance : 30;
64580     var _initialized3 = false;
64581     var _parent = select_default2(null);
64582     var _container = select_default2(null);
64583     var _oldTurns;
64584     var _graph;
64585     var _vertexID;
64586     var _intersection;
64587     var _fromWayID;
64588     var _lastXPos;
64589     function restrictions(selection2) {
64590       _parent = selection2;
64591       if (_vertexID && (context.graph() !== _graph || !_intersection)) {
64592         _graph = context.graph();
64593         _intersection = osmIntersection(_graph, _vertexID, _maxDistance);
64594       }
64595       var isOK = _intersection && _intersection.vertices.length && // has vertices
64596       _intersection.vertices.filter(function(vertex) {
64597         return vertex.id === _vertexID;
64598       }).length && _intersection.ways.length > 2 && // has more than 2 ways
64599       _intersection.ways.filter(function(way) {
64600         return way.__to;
64601       }).length > 1;
64602       select_default2(selection2.node().parentNode).classed("hide", !isOK);
64603       if (!isOK || !context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode || !selection2.node().parentNode.parentNode) {
64604         selection2.call(restrictions.off);
64605         return;
64606       }
64607       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
64608       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
64609       var container = wrap2.selectAll(".restriction-container").data([0]);
64610       var containerEnter = container.enter().append("div").attr("class", "restriction-container");
64611       containerEnter.append("div").attr("class", "restriction-help");
64612       _container = containerEnter.merge(container).call(renderViewer);
64613       var controls = wrap2.selectAll(".restriction-controls").data([0]);
64614       controls.enter().append("div").attr("class", "restriction-controls-container").append("div").attr("class", "restriction-controls").merge(controls).call(renderControls);
64615     }
64616     function renderControls(selection2) {
64617       var distControl = selection2.selectAll(".restriction-distance").data([0]);
64618       distControl.exit().remove();
64619       var distControlEnter = distControl.enter().append("div").attr("class", "restriction-control restriction-distance");
64620       distControlEnter.append("span").attr("class", "restriction-control-label restriction-distance-label").call(_t.append("restriction.controls.distance", { suffix: ":" }));
64621       distControlEnter.append("input").attr("class", "restriction-distance-input").attr("type", "range").attr("min", "20").attr("max", "50").attr("step", "5");
64622       distControlEnter.append("span").attr("class", "restriction-distance-text");
64623       selection2.selectAll(".restriction-distance-input").property("value", _maxDistance).on("input", function() {
64624         var val = select_default2(this).property("value");
64625         _maxDistance = +val;
64626         _intersection = null;
64627         _container.selectAll(".layer-osm .layer-turns *").remove();
64628         corePreferences("turn-restriction-distance", _maxDistance);
64629         _parent.call(restrictions);
64630       });
64631       selection2.selectAll(".restriction-distance-text").call(displayMaxDistance(_maxDistance));
64632       var viaControl = selection2.selectAll(".restriction-via-way").data([0]);
64633       viaControl.exit().remove();
64634       var viaControlEnter = viaControl.enter().append("div").attr("class", "restriction-control restriction-via-way");
64635       viaControlEnter.append("span").attr("class", "restriction-control-label restriction-via-way-label").call(_t.append("restriction.controls.via", { suffix: ":" }));
64636       viaControlEnter.append("input").attr("class", "restriction-via-way-input").attr("type", "range").attr("min", "0").attr("max", "2").attr("step", "1");
64637       viaControlEnter.append("span").attr("class", "restriction-via-way-text");
64638       selection2.selectAll(".restriction-via-way-input").property("value", _maxViaWay).on("input", function() {
64639         var val = select_default2(this).property("value");
64640         _maxViaWay = +val;
64641         _container.selectAll(".layer-osm .layer-turns *").remove();
64642         corePreferences("turn-restriction-via-way0", _maxViaWay);
64643         _parent.call(restrictions);
64644       });
64645       selection2.selectAll(".restriction-via-way-text").call(displayMaxVia(_maxViaWay));
64646     }
64647     function renderViewer(selection2) {
64648       if (!_intersection)
64649         return;
64650       var vgraph = _intersection.graph;
64651       var filter2 = utilFunctor(true);
64652       var projection2 = geoRawMercator();
64653       var sdims = utilGetDimensions(context.container().select(".sidebar"));
64654       var d2 = [sdims[0] - 50, 370];
64655       var c2 = geoVecScale(d2, 0.5);
64656       var z2 = 22;
64657       projection2.scale(geoZoomToScale(z2));
64658       var extent = geoExtent();
64659       for (var i3 = 0; i3 < _intersection.vertices.length; i3++) {
64660         extent._extend(_intersection.vertices[i3].extent());
64661       }
64662       var padTop = 35;
64663       if (_intersection.vertices.length > 1) {
64664         var hPadding = Math.min(160, Math.max(110, d2[0] * 0.4));
64665         var vPadding = 160;
64666         var tl = projection2([extent[0][0], extent[1][1]]);
64667         var br = projection2([extent[1][0], extent[0][1]]);
64668         var hFactor = (br[0] - tl[0]) / (d2[0] - hPadding);
64669         var vFactor = (br[1] - tl[1]) / (d2[1] - vPadding - padTop);
64670         var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
64671         var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
64672         z2 = z2 - Math.max(hZoomDiff, vZoomDiff);
64673         projection2.scale(geoZoomToScale(z2));
64674       }
64675       var extentCenter = projection2(extent.center());
64676       extentCenter[1] = extentCenter[1] - padTop / 2;
64677       projection2.translate(geoVecSubtract(c2, extentCenter)).clipExtent([[0, 0], d2]);
64678       var drawLayers = svgLayers(projection2, context).only(["osm", "touch"]).dimensions(d2);
64679       var drawVertices = svgVertices(projection2, context);
64680       var drawLines = svgLines(projection2, context);
64681       var drawTurns = svgTurns(projection2, context);
64682       var firstTime = selection2.selectAll(".surface").empty();
64683       selection2.call(drawLayers);
64684       var surface = selection2.selectAll(".surface").classed("tr", true);
64685       if (firstTime) {
64686         _initialized3 = true;
64687         surface.call(breathe);
64688       }
64689       if (_fromWayID && !vgraph.hasEntity(_fromWayID)) {
64690         _fromWayID = null;
64691         _oldTurns = null;
64692       }
64693       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));
64694       surface.on("click.restrictions", click).on("mouseover.restrictions", mouseover);
64695       surface.selectAll(".selected").classed("selected", false);
64696       surface.selectAll(".related").classed("related", false);
64697       var way;
64698       if (_fromWayID) {
64699         way = vgraph.entity(_fromWayID);
64700         surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
64701       }
64702       document.addEventListener("resizeWindow", function() {
64703         utilSetDimensions(_container, null);
64704         redraw(1);
64705       }, false);
64706       updateHints(null);
64707       function click(d3_event) {
64708         surface.call(breathe.off).call(breathe);
64709         var datum2 = d3_event.target.__data__;
64710         var entity = datum2 && datum2.properties && datum2.properties.entity;
64711         if (entity) {
64712           datum2 = entity;
64713         }
64714         if (datum2 instanceof osmWay && (datum2.__from || datum2.__via)) {
64715           _fromWayID = datum2.id;
64716           _oldTurns = null;
64717           redraw();
64718         } else if (datum2 instanceof osmTurn) {
64719           var actions, extraActions, turns, i4;
64720           var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
64721           if (datum2.restrictionID && !datum2.direct) {
64722             return;
64723           } else if (datum2.restrictionID && !datum2.only) {
64724             var seen = {};
64725             var datumOnly = JSON.parse(JSON.stringify(datum2));
64726             datumOnly.only = true;
64727             restrictionType = restrictionType.replace(/^no/, "only");
64728             turns = _intersection.turns(_fromWayID, 2);
64729             extraActions = [];
64730             _oldTurns = [];
64731             for (i4 = 0; i4 < turns.length; i4++) {
64732               var turn = turns[i4];
64733               if (seen[turn.restrictionID])
64734                 continue;
64735               if (turn.direct && turn.path[1] === datum2.path[1]) {
64736                 seen[turns[i4].restrictionID] = true;
64737                 turn.restrictionType = osmInferRestriction(vgraph, turn, projection2);
64738                 _oldTurns.push(turn);
64739                 extraActions.push(actionUnrestrictTurn(turn));
64740               }
64741             }
64742             actions = _intersection.actions.concat(extraActions, [
64743               actionRestrictTurn(datumOnly, restrictionType),
64744               _t("operations.restriction.annotation.create")
64745             ]);
64746           } else if (datum2.restrictionID) {
64747             turns = _oldTurns || [];
64748             extraActions = [];
64749             for (i4 = 0; i4 < turns.length; i4++) {
64750               if (turns[i4].key !== datum2.key) {
64751                 extraActions.push(actionRestrictTurn(turns[i4], turns[i4].restrictionType));
64752               }
64753             }
64754             _oldTurns = null;
64755             actions = _intersection.actions.concat(extraActions, [
64756               actionUnrestrictTurn(datum2),
64757               _t("operations.restriction.annotation.delete")
64758             ]);
64759           } else {
64760             actions = _intersection.actions.concat([
64761               actionRestrictTurn(datum2, restrictionType),
64762               _t("operations.restriction.annotation.create")
64763             ]);
64764           }
64765           context.perform.apply(context, actions);
64766           var s2 = surface.selectAll("." + datum2.key);
64767           datum2 = s2.empty() ? null : s2.datum();
64768           updateHints(datum2);
64769         } else {
64770           _fromWayID = null;
64771           _oldTurns = null;
64772           redraw();
64773         }
64774       }
64775       function mouseover(d3_event) {
64776         var datum2 = d3_event.target.__data__;
64777         updateHints(datum2);
64778       }
64779       _lastXPos = _lastXPos || sdims[0];
64780       function redraw(minChange) {
64781         var xPos = -1;
64782         if (minChange) {
64783           xPos = utilGetDimensions(context.container().select(".sidebar"))[0];
64784         }
64785         if (!minChange || minChange && Math.abs(xPos - _lastXPos) >= minChange) {
64786           if (context.hasEntity(_vertexID)) {
64787             _lastXPos = xPos;
64788             _container.call(renderViewer);
64789           }
64790         }
64791       }
64792       function highlightPathsFrom(wayID) {
64793         surface.selectAll(".related").classed("related", false).classed("allow", false).classed("restrict", false).classed("only", false);
64794         surface.selectAll("." + wayID).classed("related", true);
64795         if (wayID) {
64796           var turns = _intersection.turns(wayID, _maxViaWay);
64797           for (var i4 = 0; i4 < turns.length; i4++) {
64798             var turn = turns[i4];
64799             var ids = [turn.to.way];
64800             var klass = turn.no ? "restrict" : turn.only ? "only" : "allow";
64801             if (turn.only || turns.length === 1) {
64802               if (turn.via.ways) {
64803                 ids = ids.concat(turn.via.ways);
64804               }
64805             } else if (turn.to.way === wayID) {
64806               continue;
64807             }
64808             surface.selectAll(utilEntitySelector(ids)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
64809           }
64810         }
64811       }
64812       function updateHints(datum2) {
64813         var help = _container.selectAll(".restriction-help").html("");
64814         var placeholders = {};
64815         ["from", "via", "to"].forEach(function(k2) {
64816           placeholders[k2] = { html: '<span class="qualifier">' + _t("restriction.help." + k2) + "</span>" };
64817         });
64818         var entity = datum2 && datum2.properties && datum2.properties.entity;
64819         if (entity) {
64820           datum2 = entity;
64821         }
64822         if (_fromWayID) {
64823           way = vgraph.entity(_fromWayID);
64824           surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
64825         }
64826         if (datum2 instanceof osmWay && datum2.__from) {
64827           way = datum2;
64828           highlightPathsFrom(_fromWayID ? null : way.id);
64829           surface.selectAll("." + way.id).classed("related", true);
64830           var clickSelect = !_fromWayID || _fromWayID !== way.id;
64831           help.append("div").html(_t.html("restriction.help." + (clickSelect ? "select_from_name" : "from_name"), {
64832             from: placeholders.from,
64833             fromName: displayName(way.id, vgraph)
64834           }));
64835         } else if (datum2 instanceof osmTurn) {
64836           var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
64837           var turnType = restrictionType.replace(/^(only|no)\_/, "");
64838           var indirect = datum2.direct === false ? _t.html("restriction.help.indirect") : "";
64839           var klass, turnText, nextText;
64840           if (datum2.no) {
64841             klass = "restrict";
64842             turnText = _t.html("restriction.help.turn.no_" + turnType, { indirect: { html: indirect } });
64843             nextText = _t.html("restriction.help.turn.only_" + turnType, { indirect: "" });
64844           } else if (datum2.only) {
64845             klass = "only";
64846             turnText = _t.html("restriction.help.turn.only_" + turnType, { indirect: { html: indirect } });
64847             nextText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: "" });
64848           } else {
64849             klass = "allow";
64850             turnText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: { html: indirect } });
64851             nextText = _t.html("restriction.help.turn.no_" + turnType, { indirect: "" });
64852           }
64853           help.append("div").attr("class", "qualifier " + klass).html(turnText);
64854           help.append("div").html(_t.html("restriction.help.from_name_to_name", {
64855             from: placeholders.from,
64856             fromName: displayName(datum2.from.way, vgraph),
64857             to: placeholders.to,
64858             toName: displayName(datum2.to.way, vgraph)
64859           }));
64860           if (datum2.via.ways && datum2.via.ways.length) {
64861             var names = [];
64862             for (var i4 = 0; i4 < datum2.via.ways.length; i4++) {
64863               var prev = names[names.length - 1];
64864               var curr = displayName(datum2.via.ways[i4], vgraph);
64865               if (!prev || curr !== prev) {
64866                 names.push(curr);
64867               }
64868             }
64869             help.append("div").html(_t.html("restriction.help.via_names", {
64870               via: placeholders.via,
64871               viaNames: names.join(", ")
64872             }));
64873           }
64874           if (!indirect) {
64875             help.append("div").html(_t.html("restriction.help.toggle", { turn: { html: nextText.trim() } }));
64876           }
64877           highlightPathsFrom(null);
64878           var alongIDs = datum2.path.slice();
64879           surface.selectAll(utilEntitySelector(alongIDs)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
64880         } else {
64881           highlightPathsFrom(null);
64882           if (_fromWayID) {
64883             help.append("div").html(_t.html("restriction.help.from_name", {
64884               from: placeholders.from,
64885               fromName: displayName(_fromWayID, vgraph)
64886             }));
64887           } else {
64888             help.append("div").html(_t.html("restriction.help.select_from", {
64889               from: placeholders.from
64890             }));
64891           }
64892         }
64893       }
64894     }
64895     function displayMaxDistance(maxDist) {
64896       return (selection2) => {
64897         var isImperial = !_mainLocalizer.usesMetric();
64898         var opts;
64899         if (isImperial) {
64900           var distToFeet = {
64901             // imprecise conversion for prettier display
64902             20: 70,
64903             25: 85,
64904             30: 100,
64905             35: 115,
64906             40: 130,
64907             45: 145,
64908             50: 160
64909           }[maxDist];
64910           opts = { distance: _t("units.feet", { quantity: distToFeet }) };
64911         } else {
64912           opts = { distance: _t("units.meters", { quantity: maxDist }) };
64913         }
64914         return selection2.html("").call(_t.append("restriction.controls.distance_up_to", opts));
64915       };
64916     }
64917     function displayMaxVia(maxVia) {
64918       return (selection2) => {
64919         selection2 = selection2.html("");
64920         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"));
64921       };
64922     }
64923     function displayName(entityID, graph) {
64924       var entity = graph.entity(entityID);
64925       var name = utilDisplayName(entity) || "";
64926       var matched = _mainPresetIndex.match(entity, graph);
64927       var type2 = matched && matched.name() || utilDisplayType(entity.id);
64928       return name || type2;
64929     }
64930     restrictions.entityIDs = function(val) {
64931       _intersection = null;
64932       _fromWayID = null;
64933       _oldTurns = null;
64934       _vertexID = val[0];
64935     };
64936     restrictions.tags = function() {
64937     };
64938     restrictions.focus = function() {
64939     };
64940     restrictions.off = function(selection2) {
64941       if (!_initialized3)
64942         return;
64943       selection2.selectAll(".surface").call(breathe.off).on("click.restrictions", null).on("mouseover.restrictions", null);
64944       select_default2(window).on("resize.restrictions", null);
64945     };
64946     return utilRebind(restrictions, dispatch14, "on");
64947   }
64948   uiFieldRestrictions.supportsMultiselection = false;
64949
64950   // modules/ui/fields/textarea.js
64951   function uiFieldTextarea(field, context) {
64952     var dispatch14 = dispatch_default("change");
64953     var input = select_default2(null);
64954     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue()).silent(field.usage === "changeset" && field.key === "comment");
64955     var _tags;
64956     function textarea(selection2) {
64957       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
64958       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).style("position", "relative").merge(wrap2);
64959       input = wrap2.selectAll("textarea").data([0]);
64960       input = input.enter().append("textarea").attr("id", field.domId).call(utilNoAuto).on("input", change(true)).on("blur", change()).on("change", change()).merge(input);
64961       wrap2.call(_lengthIndicator);
64962       function change(onInput) {
64963         return function() {
64964           var val = utilGetSetValue(input);
64965           if (!onInput)
64966             val = context.cleanTagValue(val);
64967           if (!val && Array.isArray(_tags[field.key]))
64968             return;
64969           var t2 = {};
64970           t2[field.key] = val || void 0;
64971           dispatch14.call("change", this, t2, onInput);
64972         };
64973       }
64974     }
64975     textarea.tags = function(tags) {
64976       _tags = tags;
64977       var isMixed = Array.isArray(tags[field.key]);
64978       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);
64979       if (!isMixed) {
64980         _lengthIndicator.update(tags[field.key]);
64981       }
64982     };
64983     textarea.focus = function() {
64984       input.node().focus();
64985     };
64986     return utilRebind(textarea, dispatch14, "on");
64987   }
64988
64989   // modules/ui/fields/wikidata.js
64990   function uiFieldWikidata(field, context) {
64991     var wikidata = services.wikidata;
64992     var dispatch14 = dispatch_default("change");
64993     var _selection = select_default2(null);
64994     var _searchInput = select_default2(null);
64995     var _qid = null;
64996     var _wikidataEntity = null;
64997     var _wikiURL = "";
64998     var _entityIDs = [];
64999     var _wikipediaKey = field.keys && field.keys.find(function(key) {
65000       return key.includes("wikipedia");
65001     });
65002     var _hintKey = field.key === "wikidata" ? "name" : field.key.split(":")[0];
65003     var combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(true).minItems(1);
65004     function wiki(selection2) {
65005       _selection = selection2;
65006       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
65007       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
65008       var list = wrap2.selectAll("ul").data([0]);
65009       list = list.enter().append("ul").attr("class", "rows").merge(list);
65010       var searchRow = list.selectAll("li.wikidata-search").data([0]);
65011       var searchRowEnter = searchRow.enter().append("li").attr("class", "wikidata-search");
65012       searchRowEnter.append("input").attr("type", "text").attr("id", field.domId).style("flex", "1").call(utilNoAuto).on("focus", function() {
65013         var node = select_default2(this).node();
65014         node.setSelectionRange(0, node.value.length);
65015       }).on("blur", function() {
65016         setLabelForEntity();
65017       }).call(combobox.fetcher(fetchWikidataItems));
65018       combobox.on("accept", function(d2) {
65019         if (d2) {
65020           _qid = d2.id;
65021           change();
65022         }
65023       }).on("cancel", function() {
65024         setLabelForEntity();
65025       });
65026       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) {
65027         d3_event.preventDefault();
65028         if (_wikiURL)
65029           window.open(_wikiURL, "_blank");
65030       });
65031       searchRow = searchRow.merge(searchRowEnter);
65032       _searchInput = searchRow.select("input");
65033       var wikidataProperties = ["description", "identifier"];
65034       var items = list.selectAll("li.labeled-input").data(wikidataProperties);
65035       var enter = items.enter().append("li").attr("class", function(d2) {
65036         return "labeled-input preset-wikidata-" + d2;
65037       });
65038       enter.append("span").attr("class", "label").html(function(d2) {
65039         return _t.html("wikidata." + d2);
65040       });
65041       enter.append("input").attr("type", "text").call(utilNoAuto).classed("disabled", "true").attr("readonly", "true");
65042       enter.append("button").attr("class", "form-field-button").attr("title", _t("icons.copy")).call(svgIcon("#iD-operation-copy")).on("click", function(d3_event) {
65043         d3_event.preventDefault();
65044         select_default2(this.parentNode).select("input").node().select();
65045         document.execCommand("copy");
65046       });
65047     }
65048     function fetchWikidataItems(q2, callback) {
65049       if (!q2 && _hintKey) {
65050         for (var i3 in _entityIDs) {
65051           var entity = context.hasEntity(_entityIDs[i3]);
65052           if (entity.tags[_hintKey]) {
65053             q2 = entity.tags[_hintKey];
65054             break;
65055           }
65056         }
65057       }
65058       wikidata.itemsForSearchQuery(q2, function(err, data) {
65059         if (err) {
65060           if (err !== "No query")
65061             console.error(err);
65062           return;
65063         }
65064         var result = data.map(function(item) {
65065           return {
65066             id: item.id,
65067             value: item.display.label.value + " (" + item.id + ")",
65068             display: (selection2) => selection2.append("span").attr("class", "localized-text").attr("lang", item.display.label.language).text(item.display.label.value),
65069             title: item.display.description && item.display.description.value,
65070             terms: item.aliases
65071           };
65072         });
65073         if (callback)
65074           callback(result);
65075       });
65076     }
65077     function change() {
65078       var syncTags = {};
65079       syncTags[field.key] = _qid;
65080       dispatch14.call("change", this, syncTags);
65081       var initGraph = context.graph();
65082       var initEntityIDs = _entityIDs;
65083       wikidata.entityByQID(_qid, function(err, entity) {
65084         if (err)
65085           return;
65086         if (context.graph() !== initGraph)
65087           return;
65088         if (!entity.sitelinks)
65089           return;
65090         var langs = wikidata.languagesToQuery();
65091         ["labels", "descriptions"].forEach(function(key) {
65092           if (!entity[key])
65093             return;
65094           var valueLangs = Object.keys(entity[key]);
65095           if (valueLangs.length === 0)
65096             return;
65097           var valueLang = valueLangs[0];
65098           if (langs.indexOf(valueLang) === -1) {
65099             langs.push(valueLang);
65100           }
65101         });
65102         var newWikipediaValue;
65103         if (_wikipediaKey) {
65104           var foundPreferred;
65105           for (var i3 in langs) {
65106             var lang = langs[i3];
65107             var siteID = lang.replace("-", "_") + "wiki";
65108             if (entity.sitelinks[siteID]) {
65109               foundPreferred = true;
65110               newWikipediaValue = lang + ":" + entity.sitelinks[siteID].title;
65111               break;
65112             }
65113           }
65114           if (!foundPreferred) {
65115             var wikiSiteKeys = Object.keys(entity.sitelinks).filter(function(site) {
65116               return site.endsWith("wiki");
65117             });
65118             if (wikiSiteKeys.length === 0) {
65119               newWikipediaValue = null;
65120             } else {
65121               var wikiLang = wikiSiteKeys[0].slice(0, -4).replace("_", "-");
65122               var wikiTitle = entity.sitelinks[wikiSiteKeys[0]].title;
65123               newWikipediaValue = wikiLang + ":" + wikiTitle;
65124             }
65125           }
65126         }
65127         if (newWikipediaValue) {
65128           newWikipediaValue = context.cleanTagValue(newWikipediaValue);
65129         }
65130         if (typeof newWikipediaValue === "undefined")
65131           return;
65132         var actions = initEntityIDs.map(function(entityID) {
65133           var entity2 = context.hasEntity(entityID);
65134           if (!entity2)
65135             return null;
65136           var currTags = Object.assign({}, entity2.tags);
65137           if (newWikipediaValue === null) {
65138             if (!currTags[_wikipediaKey])
65139               return null;
65140             delete currTags[_wikipediaKey];
65141           } else {
65142             currTags[_wikipediaKey] = newWikipediaValue;
65143           }
65144           return actionChangeTags(entityID, currTags);
65145         }).filter(Boolean);
65146         if (!actions.length)
65147           return;
65148         context.overwrite(
65149           function actionUpdateWikipediaTags(graph) {
65150             actions.forEach(function(action) {
65151               graph = action(graph);
65152             });
65153             return graph;
65154           },
65155           context.history().undoAnnotation()
65156         );
65157       });
65158     }
65159     function setLabelForEntity() {
65160       var label = "";
65161       if (_wikidataEntity) {
65162         label = entityPropertyForDisplay(_wikidataEntity, "labels");
65163         if (label.length === 0) {
65164           label = _wikidataEntity.id.toString();
65165         }
65166       }
65167       utilGetSetValue(_searchInput, label);
65168     }
65169     wiki.tags = function(tags) {
65170       var isMixed = Array.isArray(tags[field.key]);
65171       _searchInput.attr("title", isMixed ? tags[field.key].filter(Boolean).join("\n") : null).attr("placeholder", isMixed ? _t("inspector.multiple_values") : "").classed("mixed", isMixed);
65172       _qid = typeof tags[field.key] === "string" && tags[field.key] || "";
65173       if (!/^Q[0-9]*$/.test(_qid)) {
65174         unrecognized();
65175         return;
65176       }
65177       _wikiURL = "https://wikidata.org/wiki/" + _qid;
65178       wikidata.entityByQID(_qid, function(err, entity) {
65179         if (err) {
65180           unrecognized();
65181           return;
65182         }
65183         _wikidataEntity = entity;
65184         setLabelForEntity();
65185         var description = entityPropertyForDisplay(entity, "descriptions");
65186         _selection.select("button.wiki-link").classed("disabled", false);
65187         _selection.select(".preset-wikidata-description").style("display", function() {
65188           return description.length > 0 ? "flex" : "none";
65189         }).select("input").attr("value", description);
65190         _selection.select(".preset-wikidata-identifier").style("display", function() {
65191           return entity.id ? "flex" : "none";
65192         }).select("input").attr("value", entity.id);
65193       });
65194       function unrecognized() {
65195         _wikidataEntity = null;
65196         setLabelForEntity();
65197         _selection.select(".preset-wikidata-description").style("display", "none");
65198         _selection.select(".preset-wikidata-identifier").style("display", "none");
65199         _selection.select("button.wiki-link").classed("disabled", true);
65200         if (_qid && _qid !== "") {
65201           _wikiURL = "https://wikidata.org/wiki/Special:Search?search=" + _qid;
65202         } else {
65203           _wikiURL = "";
65204         }
65205       }
65206     };
65207     function entityPropertyForDisplay(wikidataEntity, propKey) {
65208       if (!wikidataEntity[propKey])
65209         return "";
65210       var propObj = wikidataEntity[propKey];
65211       var langKeys = Object.keys(propObj);
65212       if (langKeys.length === 0)
65213         return "";
65214       var langs = wikidata.languagesToQuery();
65215       for (var i3 in langs) {
65216         var lang = langs[i3];
65217         var valueObj = propObj[lang];
65218         if (valueObj && valueObj.value && valueObj.value.length > 0)
65219           return valueObj.value;
65220       }
65221       return propObj[langKeys[0]].value;
65222     }
65223     wiki.entityIDs = function(val) {
65224       if (!arguments.length)
65225         return _entityIDs;
65226       _entityIDs = val;
65227       return wiki;
65228     };
65229     wiki.focus = function() {
65230       _searchInput.node().focus();
65231     };
65232     return utilRebind(wiki, dispatch14, "on");
65233   }
65234
65235   // modules/ui/fields/wikipedia.js
65236   function uiFieldWikipedia(field, context) {
65237     const dispatch14 = dispatch_default("change");
65238     const wikipedia = services.wikipedia;
65239     const wikidata = services.wikidata;
65240     let _langInput = select_default2(null);
65241     let _titleInput = select_default2(null);
65242     let _wikiURL = "";
65243     let _entityIDs;
65244     let _tags;
65245     let _dataWikipedia = [];
65246     _mainFileFetcher.get("wmf_sitematrix").then((d2) => {
65247       _dataWikipedia = d2;
65248       if (_tags)
65249         updateForTags(_tags);
65250     }).catch(() => {
65251     });
65252     const langCombo = uiCombobox(context, "wikipedia-lang").fetcher((value, callback) => {
65253       const v2 = value.toLowerCase();
65254       callback(
65255         _dataWikipedia.filter((d2) => {
65256           return d2[0].toLowerCase().indexOf(v2) >= 0 || d2[1].toLowerCase().indexOf(v2) >= 0 || d2[2].toLowerCase().indexOf(v2) >= 0;
65257         }).map((d2) => ({ value: d2[1] }))
65258       );
65259     });
65260     const titleCombo = uiCombobox(context, "wikipedia-title").fetcher((value, callback) => {
65261       if (!value) {
65262         value = "";
65263         for (let i3 in _entityIDs) {
65264           let entity = context.hasEntity(_entityIDs[i3]);
65265           if (entity.tags.name) {
65266             value = entity.tags.name;
65267             break;
65268           }
65269         }
65270       }
65271       const searchfn = value.length > 7 ? wikipedia.search : wikipedia.suggestions;
65272       searchfn(language()[2], value, (query, data) => {
65273         callback(data.map((d2) => ({ value: d2 })));
65274       });
65275     });
65276     function wiki(selection2) {
65277       let wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
65278       wrap2 = wrap2.enter().append("div").attr("class", `form-field-input-wrap form-field-input-${field.type}`).merge(wrap2);
65279       let langContainer = wrap2.selectAll(".wiki-lang-container").data([0]);
65280       langContainer = langContainer.enter().append("div").attr("class", "wiki-lang-container").merge(langContainer);
65281       _langInput = langContainer.selectAll("input.wiki-lang").data([0]);
65282       _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);
65283       _langInput.on("blur", changeLang).on("change", changeLang);
65284       let titleContainer = wrap2.selectAll(".wiki-title-container").data([0]);
65285       titleContainer = titleContainer.enter().append("div").attr("class", "wiki-title-container").merge(titleContainer);
65286       _titleInput = titleContainer.selectAll("input.wiki-title").data([0]);
65287       _titleInput = _titleInput.enter().append("input").attr("type", "text").attr("class", "wiki-title").attr("id", field.domId).call(utilNoAuto).call(titleCombo).merge(_titleInput);
65288       _titleInput.on("blur", function() {
65289         change(true);
65290       }).on("change", function() {
65291         change(false);
65292       });
65293       let link2 = titleContainer.selectAll(".wiki-link").data([0]);
65294       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);
65295       link2.on("click", (d3_event) => {
65296         d3_event.preventDefault();
65297         if (_wikiURL)
65298           window.open(_wikiURL, "_blank");
65299       });
65300     }
65301     function defaultLanguageInfo(skipEnglishFallback) {
65302       const langCode = _mainLocalizer.languageCode().toLowerCase();
65303       for (let i3 in _dataWikipedia) {
65304         let d2 = _dataWikipedia[i3];
65305         if (d2[2] === langCode)
65306           return d2;
65307       }
65308       return skipEnglishFallback ? ["", "", ""] : ["English", "English", "en"];
65309     }
65310     function language(skipEnglishFallback) {
65311       const value = utilGetSetValue(_langInput).toLowerCase();
65312       for (let i3 in _dataWikipedia) {
65313         let d2 = _dataWikipedia[i3];
65314         if (d2[0].toLowerCase() === value || d2[1].toLowerCase() === value || d2[2] === value)
65315           return d2;
65316       }
65317       return defaultLanguageInfo(skipEnglishFallback);
65318     }
65319     function changeLang() {
65320       utilGetSetValue(_langInput, language()[1]);
65321       change(true);
65322     }
65323     function change(skipWikidata) {
65324       let value = utilGetSetValue(_titleInput);
65325       const m2 = value.match(/https?:\/\/([-a-z]+)\.wikipedia\.org\/(?:wiki|\1-[-a-z]+)\/([^#]+)(?:#(.+))?/);
65326       const langInfo = m2 && _dataWikipedia.find((d2) => m2[1] === d2[2]);
65327       let syncTags = {};
65328       if (langInfo) {
65329         const nativeLangName = langInfo[1];
65330         value = decodeURIComponent(m2[2]).replace(/_/g, " ");
65331         if (m2[3]) {
65332           let anchor;
65333           anchor = decodeURIComponent(m2[3]);
65334           value += "#" + anchor.replace(/_/g, " ");
65335         }
65336         value = value.slice(0, 1).toUpperCase() + value.slice(1);
65337         utilGetSetValue(_langInput, nativeLangName);
65338         utilGetSetValue(_titleInput, value);
65339       }
65340       if (value) {
65341         syncTags.wikipedia = context.cleanTagValue(language()[2] + ":" + value);
65342       } else {
65343         syncTags.wikipedia = void 0;
65344       }
65345       dispatch14.call("change", this, syncTags);
65346       if (skipWikidata || !value || !language()[2])
65347         return;
65348       const initGraph = context.graph();
65349       const initEntityIDs = _entityIDs;
65350       wikidata.itemsByTitle(language()[2], value, (err, data) => {
65351         if (err || !data || !Object.keys(data).length)
65352           return;
65353         if (context.graph() !== initGraph)
65354           return;
65355         const qids = Object.keys(data);
65356         const value2 = qids && qids.find((id2) => id2.match(/^Q\d+$/));
65357         let actions = initEntityIDs.map((entityID) => {
65358           let entity = context.entity(entityID).tags;
65359           let currTags = Object.assign({}, entity);
65360           if (currTags.wikidata !== value2) {
65361             currTags.wikidata = value2;
65362             return actionChangeTags(entityID, currTags);
65363           }
65364           return null;
65365         }).filter(Boolean);
65366         if (!actions.length)
65367           return;
65368         context.overwrite(
65369           function actionUpdateWikidataTags(graph) {
65370             actions.forEach(function(action) {
65371               graph = action(graph);
65372             });
65373             return graph;
65374           },
65375           context.history().undoAnnotation()
65376         );
65377       });
65378     }
65379     wiki.tags = (tags) => {
65380       _tags = tags;
65381       updateForTags(tags);
65382     };
65383     function updateForTags(tags) {
65384       const value = typeof tags[field.key] === "string" ? tags[field.key] : "";
65385       const m2 = value.match(/([^:]+):([^#]+)(?:#(.+))?/);
65386       const tagLang = m2 && m2[1];
65387       const tagArticleTitle = m2 && m2[2];
65388       let anchor = m2 && m2[3];
65389       const tagLangInfo = tagLang && _dataWikipedia.find((d2) => tagLang === d2[2]);
65390       if (tagLangInfo) {
65391         const nativeLangName = tagLangInfo[1];
65392         utilGetSetValue(_langInput, nativeLangName);
65393         utilGetSetValue(_titleInput, tagArticleTitle + (anchor ? "#" + anchor : ""));
65394         if (anchor) {
65395           try {
65396             anchor = encodeURIComponent(anchor.replace(/ /g, "_")).replace(/%/g, ".");
65397           } catch (e3) {
65398             anchor = anchor.replace(/ /g, "_");
65399           }
65400         }
65401         _wikiURL = "https://" + tagLang + ".wikipedia.org/wiki/" + tagArticleTitle.replace(/ /g, "_") + (anchor ? "#" + anchor : "");
65402       } else {
65403         utilGetSetValue(_titleInput, value);
65404         if (value && value !== "") {
65405           utilGetSetValue(_langInput, "");
65406           const defaultLangInfo = defaultLanguageInfo();
65407           _wikiURL = `https://${defaultLangInfo[2]}.wikipedia.org/w/index.php?fulltext=1&search=${value}`;
65408         } else {
65409           const shownOrDefaultLangInfo = language(
65410             true
65411             /* skipEnglishFallback */
65412           );
65413           utilGetSetValue(_langInput, shownOrDefaultLangInfo[1]);
65414           _wikiURL = "";
65415         }
65416       }
65417     }
65418     wiki.entityIDs = (val) => {
65419       if (!arguments.length)
65420         return _entityIDs;
65421       _entityIDs = val;
65422       return wiki;
65423     };
65424     wiki.focus = () => {
65425       _titleInput.node().focus();
65426     };
65427     return utilRebind(wiki, dispatch14, "on");
65428   }
65429   uiFieldWikipedia.supportsMultiselection = false;
65430
65431   // modules/ui/fields/index.js
65432   var uiFields = {
65433     access: uiFieldAccess,
65434     address: uiFieldAddress,
65435     check: uiFieldCheck,
65436     colour: uiFieldText,
65437     combo: uiFieldCombo,
65438     cycleway: uiFieldDirectionalCombo,
65439     date: uiFieldText,
65440     defaultCheck: uiFieldCheck,
65441     directionalCombo: uiFieldDirectionalCombo,
65442     email: uiFieldText,
65443     identifier: uiFieldText,
65444     lanes: uiFieldLanes,
65445     localized: uiFieldLocalized,
65446     roadheight: uiFieldRoadheight,
65447     roadspeed: uiFieldRoadspeed,
65448     manyCombo: uiFieldCombo,
65449     multiCombo: uiFieldCombo,
65450     networkCombo: uiFieldCombo,
65451     number: uiFieldText,
65452     onewayCheck: uiFieldCheck,
65453     radio: uiFieldRadio,
65454     restrictions: uiFieldRestrictions,
65455     semiCombo: uiFieldCombo,
65456     structureRadio: uiFieldRadio,
65457     tel: uiFieldText,
65458     text: uiFieldText,
65459     textarea: uiFieldTextarea,
65460     typeCombo: uiFieldCombo,
65461     url: uiFieldText,
65462     wikidata: uiFieldWikidata,
65463     wikipedia: uiFieldWikipedia
65464   };
65465
65466   // modules/ui/field.js
65467   function uiField(context, presetField2, entityIDs, options2) {
65468     options2 = Object.assign({
65469       show: true,
65470       wrap: true,
65471       remove: true,
65472       revert: true,
65473       info: true
65474     }, options2);
65475     var dispatch14 = dispatch_default("change", "revert");
65476     var field = Object.assign({}, presetField2);
65477     field.domId = utilUniqueDomId("form-field-" + field.safeid);
65478     var _show = options2.show;
65479     var _state = "";
65480     var _tags = {};
65481     var _entityExtent;
65482     if (entityIDs && entityIDs.length) {
65483       _entityExtent = entityIDs.reduce(function(extent, entityID) {
65484         var entity = context.graph().entity(entityID);
65485         return extent.extend(entity.extent(context.graph()));
65486       }, geoExtent());
65487     }
65488     var _locked = false;
65489     var _lockedTip = uiTooltip().title(() => _t.append("inspector.lock.suggestion", { label: field.title })).placement("bottom");
65490     if (_show && !field.impl) {
65491       createField();
65492     }
65493     function createField() {
65494       field.impl = uiFields[field.type](field, context).on("change", function(t2, onInput) {
65495         dispatch14.call("change", field, t2, onInput);
65496       });
65497       if (entityIDs) {
65498         field.entityIDs = entityIDs;
65499         if (field.impl.entityIDs) {
65500           field.impl.entityIDs(entityIDs);
65501         }
65502       }
65503     }
65504     function allKeys() {
65505       let keys2 = field.keys || [field.key];
65506       if (field.type === "directionalCombo" && field.key) {
65507         keys2 = keys2.concat(field.key);
65508       }
65509       return keys2;
65510     }
65511     function isModified() {
65512       if (!entityIDs || !entityIDs.length)
65513         return false;
65514       return entityIDs.some(function(entityID) {
65515         var original = context.graph().base().entities[entityID];
65516         var latest = context.graph().entity(entityID);
65517         return allKeys().some(function(key) {
65518           return original ? latest.tags[key] !== original.tags[key] : latest.tags[key];
65519         });
65520       });
65521     }
65522     function tagsContainFieldKey() {
65523       return allKeys().some(function(key) {
65524         if (field.type === "multiCombo") {
65525           for (var tagKey in _tags) {
65526             if (tagKey.indexOf(key) === 0) {
65527               return true;
65528             }
65529           }
65530           return false;
65531         }
65532         return _tags[key] !== void 0;
65533       });
65534     }
65535     function revert(d3_event, d2) {
65536       d3_event.stopPropagation();
65537       d3_event.preventDefault();
65538       if (!entityIDs || _locked)
65539         return;
65540       dispatch14.call("revert", d2, allKeys());
65541     }
65542     function remove2(d3_event, d2) {
65543       d3_event.stopPropagation();
65544       d3_event.preventDefault();
65545       if (_locked)
65546         return;
65547       var t2 = {};
65548       allKeys().forEach(function(key) {
65549         t2[key] = void 0;
65550       });
65551       dispatch14.call("change", d2, t2);
65552     }
65553     field.render = function(selection2) {
65554       var container = selection2.selectAll(".form-field").data([field]);
65555       var enter = container.enter().append("div").attr("class", function(d2) {
65556         return "form-field form-field-" + d2.safeid;
65557       }).classed("nowrap", !options2.wrap);
65558       if (options2.wrap) {
65559         var labelEnter = enter.append("label").attr("class", "field-label").attr("for", function(d2) {
65560           return d2.domId;
65561         });
65562         var textEnter = labelEnter.append("span").attr("class", "label-text");
65563         textEnter.append("span").attr("class", "label-textvalue").each(function(d2) {
65564           d2.label()(select_default2(this));
65565         });
65566         textEnter.append("span").attr("class", "label-textannotation");
65567         if (options2.remove) {
65568           labelEnter.append("button").attr("class", "remove-icon").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
65569         }
65570         if (options2.revert) {
65571           labelEnter.append("button").attr("class", "modified-icon").attr("title", _t("icons.undo")).call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo"));
65572         }
65573       }
65574       container = container.merge(enter);
65575       container.select(".field-label > .remove-icon").on("click", remove2);
65576       container.select(".field-label > .modified-icon").on("click", revert);
65577       container.each(function(d2) {
65578         var selection3 = select_default2(this);
65579         if (!d2.impl) {
65580           createField();
65581         }
65582         var reference, help;
65583         if (options2.wrap && field.type === "restrictions") {
65584           help = uiFieldHelp(context, "restrictions");
65585         }
65586         if (options2.wrap && options2.info) {
65587           var referenceKey = d2.key || "";
65588           if (d2.type === "multiCombo") {
65589             referenceKey = referenceKey.replace(/:$/, "");
65590           }
65591           var referenceOptions = d2.reference || {
65592             key: referenceKey,
65593             value: _tags[referenceKey]
65594           };
65595           reference = uiTagReference(referenceOptions, context);
65596           if (_state === "hover") {
65597             reference.showing(false);
65598           }
65599         }
65600         selection3.call(d2.impl);
65601         if (help) {
65602           selection3.call(help.body).select(".field-label").call(help.button);
65603         }
65604         if (reference) {
65605           selection3.call(reference.body).select(".field-label").call(reference.button);
65606         }
65607         d2.impl.tags(_tags);
65608       });
65609       container.classed("locked", _locked).classed("modified", isModified()).classed("present", tagsContainFieldKey());
65610       var annotation = container.selectAll(".field-label .label-textannotation");
65611       var icon2 = annotation.selectAll(".icon").data(_locked ? [0] : []);
65612       icon2.exit().remove();
65613       icon2.enter().append("svg").attr("class", "icon").append("use").attr("xlink:href", "#fas-lock");
65614       container.call(_locked ? _lockedTip : _lockedTip.destroy);
65615     };
65616     field.state = function(val) {
65617       if (!arguments.length)
65618         return _state;
65619       _state = val;
65620       return field;
65621     };
65622     field.tags = function(val) {
65623       if (!arguments.length)
65624         return _tags;
65625       _tags = val;
65626       if (tagsContainFieldKey() && !_show) {
65627         _show = true;
65628         if (!field.impl) {
65629           createField();
65630         }
65631       }
65632       return field;
65633     };
65634     field.locked = function(val) {
65635       if (!arguments.length)
65636         return _locked;
65637       _locked = val;
65638       return field;
65639     };
65640     field.show = function() {
65641       _show = true;
65642       if (!field.impl) {
65643         createField();
65644       }
65645       if (field.default && field.key && _tags[field.key] !== field.default) {
65646         var t2 = {};
65647         t2[field.key] = field.default;
65648         dispatch14.call("change", this, t2);
65649       }
65650     };
65651     field.isShown = function() {
65652       return _show;
65653     };
65654     field.isAllowed = function() {
65655       if (entityIDs && entityIDs.length > 1 && uiFields[field.type].supportsMultiselection === false)
65656         return false;
65657       if (field.geometry && !entityIDs.every(function(entityID) {
65658         return field.matchGeometry(context.graph().geometry(entityID));
65659       }))
65660         return false;
65661       if (entityIDs && _entityExtent && field.locationSetID) {
65662         var validHere = _sharedLocationManager.locationSetsAt(_entityExtent.center());
65663         if (!validHere[field.locationSetID])
65664           return false;
65665       }
65666       var prerequisiteTag = field.prerequisiteTag;
65667       if (entityIDs && !tagsContainFieldKey() && // ignore tagging prerequisites if a value is already present
65668       prerequisiteTag) {
65669         if (!entityIDs.every(function(entityID) {
65670           var entity = context.graph().entity(entityID);
65671           if (prerequisiteTag.key) {
65672             var value = entity.tags[prerequisiteTag.key];
65673             if (!value)
65674               return false;
65675             if (prerequisiteTag.valueNot) {
65676               return prerequisiteTag.valueNot !== value;
65677             }
65678             if (prerequisiteTag.value) {
65679               return prerequisiteTag.value === value;
65680             }
65681           } else if (prerequisiteTag.keyNot) {
65682             if (entity.tags[prerequisiteTag.keyNot])
65683               return false;
65684           }
65685           return true;
65686         }))
65687           return false;
65688       }
65689       return true;
65690     };
65691     field.focus = function() {
65692       if (field.impl) {
65693         field.impl.focus();
65694       }
65695     };
65696     return utilRebind(field, dispatch14, "on");
65697   }
65698
65699   // modules/ui/form_fields.js
65700   function uiFormFields(context) {
65701     var moreCombo = uiCombobox(context, "more-fields").minItems(1);
65702     var _fieldsArr = [];
65703     var _lastPlaceholder = "";
65704     var _state = "";
65705     var _klass = "";
65706     function formFields(selection2) {
65707       var allowedFields = _fieldsArr.filter(function(field) {
65708         return field.isAllowed();
65709       });
65710       var shown = allowedFields.filter(function(field) {
65711         return field.isShown();
65712       });
65713       var notShown = allowedFields.filter(function(field) {
65714         return !field.isShown();
65715       });
65716       var container = selection2.selectAll(".form-fields-container").data([0]);
65717       container = container.enter().append("div").attr("class", "form-fields-container " + (_klass || "")).merge(container);
65718       var fields = container.selectAll(".wrap-form-field").data(shown, function(d2) {
65719         return d2.id + (d2.entityIDs ? d2.entityIDs.join() : "");
65720       });
65721       fields.exit().remove();
65722       var enter = fields.enter().append("div").attr("class", function(d2) {
65723         return "wrap-form-field wrap-form-field-" + d2.safeid;
65724       });
65725       fields = fields.merge(enter);
65726       fields.order().each(function(d2) {
65727         select_default2(this).call(d2.render);
65728       });
65729       var titles = [];
65730       var moreFields = notShown.map(function(field) {
65731         var title = field.title();
65732         titles.push(title);
65733         var terms = field.terms();
65734         if (field.key)
65735           terms.push(field.key);
65736         if (field.keys)
65737           terms = terms.concat(field.keys);
65738         return {
65739           display: field.label(),
65740           value: title,
65741           title,
65742           field,
65743           terms
65744         };
65745       });
65746       var placeholder = titles.slice(0, 3).join(", ") + (titles.length > 3 ? "\u2026" : "");
65747       var more = selection2.selectAll(".more-fields").data(_state === "hover" || moreFields.length === 0 ? [] : [0]);
65748       more.exit().remove();
65749       var moreEnter = more.enter().append("div").attr("class", "more-fields").append("label");
65750       moreEnter.append("span").call(_t.append("inspector.add_fields"));
65751       more = moreEnter.merge(more);
65752       var input = more.selectAll(".value").data([0]);
65753       input.exit().remove();
65754       input = input.enter().append("input").attr("class", "value").attr("type", "text").attr("placeholder", placeholder).call(utilNoAuto).merge(input);
65755       input.call(utilGetSetValue, "").call(
65756         moreCombo.data(moreFields).on("accept", function(d2) {
65757           if (!d2)
65758             return;
65759           var field = d2.field;
65760           field.show();
65761           selection2.call(formFields);
65762           field.focus();
65763         })
65764       );
65765       if (_lastPlaceholder !== placeholder) {
65766         input.attr("placeholder", placeholder);
65767         _lastPlaceholder = placeholder;
65768       }
65769     }
65770     formFields.fieldsArr = function(val) {
65771       if (!arguments.length)
65772         return _fieldsArr;
65773       _fieldsArr = val || [];
65774       return formFields;
65775     };
65776     formFields.state = function(val) {
65777       if (!arguments.length)
65778         return _state;
65779       _state = val;
65780       return formFields;
65781     };
65782     formFields.klass = function(val) {
65783       if (!arguments.length)
65784         return _klass;
65785       _klass = val;
65786       return formFields;
65787     };
65788     return formFields;
65789   }
65790
65791   // modules/ui/changeset_editor.js
65792   function uiChangesetEditor(context) {
65793     var dispatch14 = dispatch_default("change");
65794     var formFields = uiFormFields(context);
65795     var commentCombo = uiCombobox(context, "comment").caseSensitive(true);
65796     var _fieldsArr;
65797     var _tags;
65798     var _changesetID;
65799     function changesetEditor(selection2) {
65800       render(selection2);
65801     }
65802     function render(selection2) {
65803       var initial = false;
65804       if (!_fieldsArr) {
65805         initial = true;
65806         var presets = _mainPresetIndex;
65807         _fieldsArr = [
65808           uiField(context, presets.field("comment"), null, { show: true, revert: false }),
65809           uiField(context, presets.field("source"), null, { show: false, revert: false }),
65810           uiField(context, presets.field("hashtags"), null, { show: false, revert: false })
65811         ];
65812         _fieldsArr.forEach(function(field) {
65813           field.on("change", function(t2, onInput) {
65814             dispatch14.call("change", field, void 0, t2, onInput);
65815           });
65816         });
65817       }
65818       _fieldsArr.forEach(function(field) {
65819         field.tags(_tags);
65820       });
65821       selection2.call(formFields.fieldsArr(_fieldsArr));
65822       if (initial) {
65823         var commentField = selection2.select(".form-field-comment textarea");
65824         var commentNode = commentField.node();
65825         if (commentNode) {
65826           commentNode.focus();
65827           commentNode.select();
65828         }
65829         utilTriggerEvent(commentField, "blur");
65830         var osm = context.connection();
65831         if (osm) {
65832           osm.userChangesets(function(err, changesets) {
65833             if (err)
65834               return;
65835             var comments = changesets.map(function(changeset) {
65836               var comment = changeset.tags.comment;
65837               return comment ? { title: comment, value: comment } : null;
65838             }).filter(Boolean);
65839             commentField.call(
65840               commentCombo.data(utilArrayUniqBy(comments, "title"))
65841             );
65842           });
65843         }
65844       }
65845       const warnings = [];
65846       if (_tags.comment.match(/google/i)) {
65847         warnings.push({
65848           id: 'contains "google"',
65849           msg: _t.append("commit.google_warning"),
65850           link: _t("commit.google_warning_link")
65851         });
65852       }
65853       const maxChars = context.maxCharsForTagValue();
65854       const strLen = utilUnicodeCharsCount(utilCleanOsmString(_tags.comment, Number.POSITIVE_INFINITY));
65855       if (strLen > maxChars || false) {
65856         warnings.push({
65857           id: "message too long",
65858           msg: _t.append("commit.changeset_comment_length_warning", { maxChars })
65859         });
65860       }
65861       var commentWarning = selection2.select(".form-field-comment").selectAll(".comment-warning").data(warnings, (d2) => d2.id);
65862       commentWarning.exit().transition().duration(200).style("opacity", 0).remove();
65863       var commentEnter = commentWarning.enter().insert("div", ".comment-warning").attr("class", "comment-warning field-warning").style("opacity", 0);
65864       commentEnter.call(svgIcon("#iD-icon-alert", "inline")).append("span");
65865       commentEnter.transition().duration(200).style("opacity", 1);
65866       commentWarning.merge(commentEnter).selectAll("div > span").text("").each(function(d2) {
65867         let selection3 = select_default2(this);
65868         if (d2.link) {
65869           selection3 = selection3.append("a").attr("target", "_blank").attr("href", d2.link);
65870         }
65871         selection3.call(d2.msg);
65872       });
65873     }
65874     changesetEditor.tags = function(_2) {
65875       if (!arguments.length)
65876         return _tags;
65877       _tags = _2;
65878       return changesetEditor;
65879     };
65880     changesetEditor.changesetID = function(_2) {
65881       if (!arguments.length)
65882         return _changesetID;
65883       if (_changesetID === _2)
65884         return changesetEditor;
65885       _changesetID = _2;
65886       _fieldsArr = null;
65887       return changesetEditor;
65888     };
65889     return utilRebind(changesetEditor, dispatch14, "on");
65890   }
65891
65892   // modules/ui/commit.js
65893   var import_fast_deep_equal9 = __toESM(require_fast_deep_equal());
65894
65895   // modules/util/jxon.js
65896   var JXON = new function() {
65897     var sValueProp = "keyValue", sAttributesProp = "keyAttributes", sAttrPref = "@", aCache = [], rIsNull = /^\s*$/, rIsBool = /^(?:true|false)$/i;
65898     function parseText(sValue) {
65899       if (rIsNull.test(sValue)) {
65900         return null;
65901       }
65902       if (rIsBool.test(sValue)) {
65903         return sValue.toLowerCase() === "true";
65904       }
65905       if (isFinite(sValue)) {
65906         return parseFloat(sValue);
65907       }
65908       if (isFinite(Date.parse(sValue))) {
65909         return new Date(sValue);
65910       }
65911       return sValue;
65912     }
65913     function EmptyTree() {
65914     }
65915     EmptyTree.prototype.toString = function() {
65916       return "null";
65917     };
65918     EmptyTree.prototype.valueOf = function() {
65919       return null;
65920     };
65921     function objectify(vValue) {
65922       return vValue === null ? new EmptyTree() : vValue instanceof Object ? vValue : new vValue.constructor(vValue);
65923     }
65924     function createObjTree(oParentNode, nVerb, bFreeze, bNesteAttr) {
65925       var nLevelStart = aCache.length, bChildren = oParentNode.hasChildNodes(), bAttributes = oParentNode.hasAttributes(), bHighVerb = Boolean(nVerb & 2);
65926       var sProp, vContent, nLength = 0, sCollectedTxt = "", vResult = bHighVerb ? {} : (
65927         /* put here the default value for empty nodes: */
65928         true
65929       );
65930       if (bChildren) {
65931         for (var oNode, nItem = 0; nItem < oParentNode.childNodes.length; nItem++) {
65932           oNode = oParentNode.childNodes.item(nItem);
65933           if (oNode.nodeType === 4) {
65934             sCollectedTxt += oNode.nodeValue;
65935           } else if (oNode.nodeType === 3) {
65936             sCollectedTxt += oNode.nodeValue.trim();
65937           } else if (oNode.nodeType === 1 && !oNode.prefix) {
65938             aCache.push(oNode);
65939           }
65940         }
65941       }
65942       var nLevelEnd = aCache.length, vBuiltVal = parseText(sCollectedTxt);
65943       if (!bHighVerb && (bChildren || bAttributes)) {
65944         vResult = nVerb === 0 ? objectify(vBuiltVal) : {};
65945       }
65946       for (var nElId = nLevelStart; nElId < nLevelEnd; nElId++) {
65947         sProp = aCache[nElId].nodeName.toLowerCase();
65948         vContent = createObjTree(aCache[nElId], nVerb, bFreeze, bNesteAttr);
65949         if (vResult.hasOwnProperty(sProp)) {
65950           if (vResult[sProp].constructor !== Array) {
65951             vResult[sProp] = [vResult[sProp]];
65952           }
65953           vResult[sProp].push(vContent);
65954         } else {
65955           vResult[sProp] = vContent;
65956           nLength++;
65957         }
65958       }
65959       if (bAttributes) {
65960         var nAttrLen = oParentNode.attributes.length, sAPrefix = bNesteAttr ? "" : sAttrPref, oAttrParent = bNesteAttr ? {} : vResult;
65961         for (var oAttrib, nAttrib = 0; nAttrib < nAttrLen; nLength++, nAttrib++) {
65962           oAttrib = oParentNode.attributes.item(nAttrib);
65963           oAttrParent[sAPrefix + oAttrib.name.toLowerCase()] = parseText(oAttrib.value.trim());
65964         }
65965         if (bNesteAttr) {
65966           if (bFreeze) {
65967             Object.freeze(oAttrParent);
65968           }
65969           vResult[sAttributesProp] = oAttrParent;
65970           nLength -= nAttrLen - 1;
65971         }
65972       }
65973       if (nVerb === 3 || (nVerb === 2 || nVerb === 1 && nLength > 0) && sCollectedTxt) {
65974         vResult[sValueProp] = vBuiltVal;
65975       } else if (!bHighVerb && nLength === 0 && sCollectedTxt) {
65976         vResult = vBuiltVal;
65977       }
65978       if (bFreeze && (bHighVerb || nLength > 0)) {
65979         Object.freeze(vResult);
65980       }
65981       aCache.length = nLevelStart;
65982       return vResult;
65983     }
65984     function loadObjTree(oXMLDoc, oParentEl, oParentObj) {
65985       var vValue, oChild;
65986       if (oParentObj instanceof String || oParentObj instanceof Number || oParentObj instanceof Boolean) {
65987         oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toString()));
65988       } else if (oParentObj.constructor === Date) {
65989         oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toGMTString()));
65990       }
65991       for (var sName in oParentObj) {
65992         vValue = oParentObj[sName];
65993         if (isFinite(sName) || vValue instanceof Function) {
65994           continue;
65995         }
65996         if (sName === sValueProp) {
65997           if (vValue !== null && vValue !== true) {
65998             oParentEl.appendChild(oXMLDoc.createTextNode(vValue.constructor === Date ? vValue.toGMTString() : String(vValue)));
65999           }
66000         } else if (sName === sAttributesProp) {
66001           for (var sAttrib in vValue) {
66002             oParentEl.setAttribute(sAttrib, vValue[sAttrib]);
66003           }
66004         } else if (sName.charAt(0) === sAttrPref) {
66005           oParentEl.setAttribute(sName.slice(1), vValue);
66006         } else if (vValue.constructor === Array) {
66007           for (var nItem = 0; nItem < vValue.length; nItem++) {
66008             oChild = oXMLDoc.createElement(sName);
66009             loadObjTree(oXMLDoc, oChild, vValue[nItem]);
66010             oParentEl.appendChild(oChild);
66011           }
66012         } else {
66013           oChild = oXMLDoc.createElement(sName);
66014           if (vValue instanceof Object) {
66015             loadObjTree(oXMLDoc, oChild, vValue);
66016           } else if (vValue !== null && vValue !== true) {
66017             oChild.appendChild(oXMLDoc.createTextNode(vValue.toString()));
66018           }
66019           oParentEl.appendChild(oChild);
66020         }
66021       }
66022     }
66023     this.build = function(oXMLParent, nVerbosity, bFreeze, bNesteAttributes) {
66024       var _nVerb = arguments.length > 1 && typeof nVerbosity === "number" ? nVerbosity & 3 : (
66025         /* put here the default verbosity level: */
66026         1
66027       );
66028       return createObjTree(oXMLParent, _nVerb, bFreeze || false, arguments.length > 3 ? bNesteAttributes : _nVerb === 3);
66029     };
66030     this.unbuild = function(oObjTree) {
66031       var oNewDoc = document.implementation.createDocument("", "", null);
66032       loadObjTree(oNewDoc, oNewDoc, oObjTree);
66033       return oNewDoc;
66034     };
66035     this.stringify = function(oObjTree) {
66036       return new XMLSerializer().serializeToString(JXON.unbuild(oObjTree));
66037     };
66038   }();
66039
66040   // modules/ui/sections/changes.js
66041   function uiSectionChanges(context) {
66042     var _discardTags = {};
66043     _mainFileFetcher.get("discarded").then(function(d2) {
66044       _discardTags = d2;
66045     }).catch(function() {
66046     });
66047     var section = uiSection("changes-list", context).label(function() {
66048       var history = context.history();
66049       var summary = history.difference().summary();
66050       return _t.append("inspector.title_count", { title: _t("commit.changes"), count: summary.length });
66051     }).disclosureContent(renderDisclosureContent);
66052     function renderDisclosureContent(selection2) {
66053       var history = context.history();
66054       var summary = history.difference().summary();
66055       var container = selection2.selectAll(".commit-section").data([0]);
66056       var containerEnter = container.enter().append("div").attr("class", "commit-section");
66057       containerEnter.append("ul").attr("class", "changeset-list");
66058       container = containerEnter.merge(container);
66059       var items = container.select("ul").selectAll("li").data(summary);
66060       var itemsEnter = items.enter().append("li").attr("class", "change-item");
66061       var buttons = itemsEnter.append("button").on("mouseover", mouseover).on("mouseout", mouseout).on("click", click);
66062       buttons.each(function(d2) {
66063         select_default2(this).call(svgIcon("#iD-icon-" + d2.entity.geometry(d2.graph), "pre-text " + d2.changeType));
66064       });
66065       buttons.append("span").attr("class", "change-type").html(function(d2) {
66066         return _t.html("commit." + d2.changeType) + " ";
66067       });
66068       buttons.append("strong").attr("class", "entity-type").text(function(d2) {
66069         var matched = _mainPresetIndex.match(d2.entity, d2.graph);
66070         return matched && matched.name() || utilDisplayType(d2.entity.id);
66071       });
66072       buttons.append("span").attr("class", "entity-name").text(function(d2) {
66073         var name = utilDisplayName(d2.entity) || "", string = "";
66074         if (name !== "") {
66075           string += ":";
66076         }
66077         return string += " " + name;
66078       });
66079       items = itemsEnter.merge(items);
66080       var changeset = new osmChangeset().update({ id: void 0 });
66081       var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
66082       delete changeset.id;
66083       var data = JXON.stringify(changeset.osmChangeJXON(changes));
66084       var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
66085       var fileName = "changes.osc";
66086       var linkEnter = container.selectAll(".download-changes").data([0]).enter().append("a").attr("class", "download-changes");
66087       linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
66088       linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("commit.download_changes"));
66089       function mouseover(d2) {
66090         if (d2.entity) {
66091           context.surface().selectAll(
66092             utilEntityOrMemberSelector([d2.entity.id], context.graph())
66093           ).classed("hover", true);
66094         }
66095       }
66096       function mouseout() {
66097         context.surface().selectAll(".hover").classed("hover", false);
66098       }
66099       function click(d3_event, change) {
66100         if (change.changeType !== "deleted") {
66101           var entity = change.entity;
66102           context.map().zoomToEase(entity);
66103           context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
66104         }
66105       }
66106     }
66107     return section;
66108   }
66109
66110   // modules/ui/commit_warnings.js
66111   function uiCommitWarnings(context) {
66112     function commitWarnings(selection2) {
66113       var issuesBySeverity = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeDisabledRules: true });
66114       for (var severity in issuesBySeverity) {
66115         var issues = issuesBySeverity[severity];
66116         if (severity !== "error") {
66117           issues = issues.filter(function(issue) {
66118             return issue.type !== "help_request";
66119           });
66120         }
66121         var section = severity + "-section";
66122         var issueItem = severity + "-item";
66123         var container = selection2.selectAll("." + section).data(issues.length ? [0] : []);
66124         container.exit().remove();
66125         var containerEnter = container.enter().append("div").attr("class", "modal-section " + section + " fillL2");
66126         containerEnter.append("h3").call(severity === "warning" ? _t.append("commit.warnings") : _t.append("commit.errors"));
66127         containerEnter.append("ul").attr("class", "changeset-list");
66128         container = containerEnter.merge(container);
66129         var items = container.select("ul").selectAll("li").data(issues, function(d2) {
66130           return d2.key;
66131         });
66132         items.exit().remove();
66133         var itemsEnter = items.enter().append("li").attr("class", issueItem);
66134         var buttons = itemsEnter.append("button").on("mouseover", function(d3_event, d2) {
66135           if (d2.entityIds) {
66136             context.surface().selectAll(
66137               utilEntityOrMemberSelector(
66138                 d2.entityIds,
66139                 context.graph()
66140               )
66141             ).classed("hover", true);
66142           }
66143         }).on("mouseout", function() {
66144           context.surface().selectAll(".hover").classed("hover", false);
66145         }).on("click", function(d3_event, d2) {
66146           context.validator().focusIssue(d2);
66147         });
66148         buttons.call(svgIcon("#iD-icon-alert", "pre-text"));
66149         buttons.append("strong").attr("class", "issue-message");
66150         buttons.filter(function(d2) {
66151           return d2.tooltip;
66152         }).call(
66153           uiTooltip().title(function(d2) {
66154             return d2.tooltip;
66155           }).placement("top")
66156         );
66157         items = itemsEnter.merge(items);
66158         items.selectAll(".issue-message").text("").each(function(d2) {
66159           return d2.message(context)(select_default2(this));
66160         });
66161       }
66162     }
66163     return commitWarnings;
66164   }
66165
66166   // modules/ui/commit.js
66167   var readOnlyTags = [
66168     /^changesets_count$/,
66169     /^created_by$/,
66170     /^ideditor:/,
66171     /^imagery_used$/,
66172     /^host$/,
66173     /^locale$/,
66174     /^warnings:/,
66175     /^resolved:/,
66176     /^closed:note$/,
66177     /^closed:keepright$/,
66178     /^closed:improveosm:/,
66179     /^closed:osmose:/
66180   ];
66181   var hashtagRegex = /(#[^\u2000-\u206F\u2E00-\u2E7F\s\\'!"#$%()*,.\/:;<=>?@\[\]^`{|}~]+)/g;
66182   function uiCommit(context) {
66183     var dispatch14 = dispatch_default("cancel");
66184     var _userDetails2;
66185     var _selection;
66186     var changesetEditor = uiChangesetEditor(context).on("change", changeTags);
66187     var rawTagEditor = uiSectionRawTagEditor("changeset-tag-editor", context).on("change", changeTags).readOnlyTags(readOnlyTags);
66188     var commitChanges = uiSectionChanges(context);
66189     var commitWarnings = uiCommitWarnings(context);
66190     function commit(selection2) {
66191       _selection = selection2;
66192       if (!context.changeset)
66193         initChangeset();
66194       loadDerivedChangesetTags();
66195       selection2.call(render);
66196     }
66197     function initChangeset() {
66198       var commentDate = +corePreferences("commentDate") || 0;
66199       var currDate = Date.now();
66200       var cutoff = 2 * 86400 * 1e3;
66201       if (commentDate > currDate || currDate - commentDate > cutoff) {
66202         corePreferences("comment", null);
66203         corePreferences("hashtags", null);
66204         corePreferences("source", null);
66205       }
66206       if (context.defaultChangesetComment()) {
66207         corePreferences("comment", context.defaultChangesetComment());
66208         corePreferences("commentDate", Date.now());
66209       }
66210       if (context.defaultChangesetSource()) {
66211         corePreferences("source", context.defaultChangesetSource());
66212         corePreferences("commentDate", Date.now());
66213       }
66214       if (context.defaultChangesetHashtags()) {
66215         corePreferences("hashtags", context.defaultChangesetHashtags());
66216         corePreferences("commentDate", Date.now());
66217       }
66218       var detected = utilDetect();
66219       var tags = {
66220         comment: corePreferences("comment") || "",
66221         created_by: context.cleanTagValue("iD " + context.version),
66222         host: context.cleanTagValue(detected.host),
66223         locale: context.cleanTagValue(_mainLocalizer.localeCode())
66224       };
66225       findHashtags(tags, true);
66226       var hashtags = corePreferences("hashtags");
66227       if (hashtags) {
66228         tags.hashtags = hashtags;
66229       }
66230       var source = corePreferences("source");
66231       if (source) {
66232         tags.source = source;
66233       }
66234       var photoOverlaysUsed = context.history().photoOverlaysUsed();
66235       if (photoOverlaysUsed.length) {
66236         var sources = (tags.source || "").split(";");
66237         if (sources.indexOf("streetlevel imagery") === -1) {
66238           sources.push("streetlevel imagery");
66239         }
66240         photoOverlaysUsed.forEach(function(photoOverlay) {
66241           if (sources.indexOf(photoOverlay) === -1) {
66242             sources.push(photoOverlay);
66243           }
66244         });
66245         tags.source = context.cleanTagValue(sources.join(";"));
66246       }
66247       context.changeset = new osmChangeset({ tags });
66248     }
66249     function loadDerivedChangesetTags() {
66250       var osm = context.connection();
66251       if (!osm)
66252         return;
66253       var tags = Object.assign({}, context.changeset.tags);
66254       var imageryUsed = context.cleanTagValue(context.history().imageryUsed().join(";"));
66255       tags.imagery_used = imageryUsed || "None";
66256       var osmClosed = osm.getClosedIDs();
66257       var itemType;
66258       if (osmClosed.length) {
66259         tags["closed:note"] = context.cleanTagValue(osmClosed.join(";"));
66260       }
66261       if (services.keepRight) {
66262         var krClosed = services.keepRight.getClosedIDs();
66263         if (krClosed.length) {
66264           tags["closed:keepright"] = context.cleanTagValue(krClosed.join(";"));
66265         }
66266       }
66267       if (services.improveOSM) {
66268         var iOsmClosed = services.improveOSM.getClosedCounts();
66269         for (itemType in iOsmClosed) {
66270           tags["closed:improveosm:" + itemType] = context.cleanTagValue(iOsmClosed[itemType].toString());
66271         }
66272       }
66273       if (services.osmose) {
66274         var osmoseClosed = services.osmose.getClosedCounts();
66275         for (itemType in osmoseClosed) {
66276           tags["closed:osmose:" + itemType] = context.cleanTagValue(osmoseClosed[itemType].toString());
66277         }
66278       }
66279       for (var key in tags) {
66280         if (key.match(/(^warnings:)|(^resolved:)/)) {
66281           delete tags[key];
66282         }
66283       }
66284       function addIssueCounts(issues, prefix) {
66285         var issuesByType = utilArrayGroupBy(issues, "type");
66286         for (var issueType in issuesByType) {
66287           var issuesOfType = issuesByType[issueType];
66288           if (issuesOfType[0].subtype) {
66289             var issuesBySubtype = utilArrayGroupBy(issuesOfType, "subtype");
66290             for (var issueSubtype in issuesBySubtype) {
66291               var issuesOfSubtype = issuesBySubtype[issueSubtype];
66292               tags[prefix + ":" + issueType + ":" + issueSubtype] = context.cleanTagValue(issuesOfSubtype.length.toString());
66293             }
66294           } else {
66295             tags[prefix + ":" + issueType] = context.cleanTagValue(issuesOfType.length.toString());
66296           }
66297         }
66298       }
66299       var warnings = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeIgnored: true, includeDisabledRules: true }).warning.filter(function(issue) {
66300         return issue.type !== "help_request";
66301       });
66302       addIssueCounts(warnings, "warnings");
66303       var resolvedIssues = context.validator().getResolvedIssues();
66304       addIssueCounts(resolvedIssues, "resolved");
66305       context.changeset = context.changeset.update({ tags });
66306     }
66307     function render(selection2) {
66308       var osm = context.connection();
66309       if (!osm)
66310         return;
66311       var header = selection2.selectAll(".header").data([0]);
66312       var headerTitle = header.enter().append("div").attr("class", "header fillL");
66313       headerTitle.append("div").append("h2").call(_t.append("commit.title"));
66314       headerTitle.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
66315         dispatch14.call("cancel", this);
66316       }).call(svgIcon("#iD-icon-close"));
66317       var body = selection2.selectAll(".body").data([0]);
66318       body = body.enter().append("div").attr("class", "body").merge(body);
66319       var changesetSection = body.selectAll(".changeset-editor").data([0]);
66320       changesetSection = changesetSection.enter().append("div").attr("class", "modal-section changeset-editor").merge(changesetSection);
66321       changesetSection.call(
66322         changesetEditor.changesetID(context.changeset.id).tags(context.changeset.tags)
66323       );
66324       body.call(commitWarnings);
66325       var saveSection = body.selectAll(".save-section").data([0]);
66326       saveSection = saveSection.enter().append("div").attr("class", "modal-section save-section fillL").merge(saveSection);
66327       var prose = saveSection.selectAll(".commit-info").data([0]);
66328       if (prose.enter().size()) {
66329         _userDetails2 = null;
66330       }
66331       prose = prose.enter().append("p").attr("class", "commit-info").call(_t.append("commit.upload_explanation")).merge(prose);
66332       osm.userDetails(function(err, user) {
66333         if (err)
66334           return;
66335         if (_userDetails2 === user)
66336           return;
66337         _userDetails2 = user;
66338         var userLink = select_default2(document.createElement("div"));
66339         if (user.image_url) {
66340           userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
66341         }
66342         userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
66343         prose.html(_t.html("commit.upload_explanation_with_user", { user: { html: userLink.html() } }));
66344       });
66345       var requestReview = saveSection.selectAll(".request-review").data([0]);
66346       var requestReviewEnter = requestReview.enter().append("div").attr("class", "request-review");
66347       var requestReviewDomId = utilUniqueDomId("commit-input-request-review");
66348       var labelEnter = requestReviewEnter.append("label").attr("for", requestReviewDomId);
66349       if (!labelEnter.empty()) {
66350         labelEnter.call(uiTooltip().title(() => _t.append("commit.request_review_info")).placement("top"));
66351       }
66352       labelEnter.append("input").attr("type", "checkbox").attr("id", requestReviewDomId);
66353       labelEnter.append("span").call(_t.append("commit.request_review"));
66354       requestReview = requestReview.merge(requestReviewEnter);
66355       var requestReviewInput = requestReview.selectAll("input").property("checked", isReviewRequested(context.changeset.tags)).on("change", toggleRequestReview);
66356       var buttonSection = saveSection.selectAll(".buttons").data([0]);
66357       var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons fillL");
66358       buttonEnter.append("button").attr("class", "secondary-action button cancel-button").append("span").attr("class", "label").call(_t.append("commit.cancel"));
66359       var uploadButton = buttonEnter.append("button").attr("class", "action button save-button");
66360       uploadButton.append("span").attr("class", "label").call(_t.append("commit.save"));
66361       var uploadBlockerTooltipText = getUploadBlockerMessage();
66362       buttonSection = buttonSection.merge(buttonEnter);
66363       buttonSection.selectAll(".cancel-button").on("click.cancel", function() {
66364         dispatch14.call("cancel", this);
66365       });
66366       buttonSection.selectAll(".save-button").classed("disabled", uploadBlockerTooltipText !== null).on("click.save", function() {
66367         if (!select_default2(this).classed("disabled")) {
66368           this.blur();
66369           for (var key in context.changeset.tags) {
66370             if (!key)
66371               delete context.changeset.tags[key];
66372           }
66373           context.uploader().save(context.changeset);
66374         }
66375       });
66376       uiTooltip().destroyAny(buttonSection.selectAll(".save-button"));
66377       if (uploadBlockerTooltipText) {
66378         buttonSection.selectAll(".save-button").call(uiTooltip().title(() => uploadBlockerTooltipText).placement("top"));
66379       }
66380       var tagSection = body.selectAll(".tag-section.raw-tag-editor").data([0]);
66381       tagSection = tagSection.enter().append("div").attr("class", "modal-section tag-section raw-tag-editor").merge(tagSection);
66382       tagSection.call(
66383         rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render
66384       );
66385       var changesSection = body.selectAll(".commit-changes-section").data([0]);
66386       changesSection = changesSection.enter().append("div").attr("class", "modal-section commit-changes-section").merge(changesSection);
66387       changesSection.call(commitChanges.render);
66388       function toggleRequestReview() {
66389         var rr = requestReviewInput.property("checked");
66390         updateChangeset({ review_requested: rr ? "yes" : void 0 });
66391         tagSection.call(
66392           rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render
66393         );
66394       }
66395     }
66396     function getUploadBlockerMessage() {
66397       var errors = context.validator().getIssuesBySeverity({ what: "edited", where: "all" }).error;
66398       if (errors.length) {
66399         return _t.append("commit.outstanding_errors_message", { count: errors.length });
66400       } else {
66401         var hasChangesetComment = context.changeset && context.changeset.tags.comment && context.changeset.tags.comment.trim().length;
66402         if (!hasChangesetComment) {
66403           return _t.append("commit.comment_needed_message");
66404         }
66405       }
66406       return null;
66407     }
66408     function changeTags(_2, changed, onInput) {
66409       if (changed.hasOwnProperty("comment")) {
66410         if (changed.comment === void 0) {
66411           changed.comment = "";
66412         }
66413         if (!onInput) {
66414           corePreferences("comment", changed.comment);
66415           corePreferences("commentDate", Date.now());
66416         }
66417       }
66418       if (changed.hasOwnProperty("source")) {
66419         if (changed.source === void 0) {
66420           corePreferences("source", null);
66421         } else if (!onInput) {
66422           corePreferences("source", changed.source);
66423           corePreferences("commentDate", Date.now());
66424         }
66425       }
66426       updateChangeset(changed, onInput);
66427       if (_selection) {
66428         _selection.call(render);
66429       }
66430     }
66431     function findHashtags(tags, commentOnly) {
66432       var detectedHashtags = commentHashtags();
66433       if (detectedHashtags.length) {
66434         corePreferences("hashtags", null);
66435       }
66436       if (!detectedHashtags.length || !commentOnly) {
66437         detectedHashtags = detectedHashtags.concat(hashtagHashtags());
66438       }
66439       var allLowerCase = /* @__PURE__ */ new Set();
66440       return detectedHashtags.filter(function(hashtag) {
66441         var lowerCase = hashtag.toLowerCase();
66442         if (!allLowerCase.has(lowerCase)) {
66443           allLowerCase.add(lowerCase);
66444           return true;
66445         }
66446         return false;
66447       });
66448       function commentHashtags() {
66449         var matches = (tags.comment || "").replace(/http\S*/g, "").match(hashtagRegex);
66450         return matches || [];
66451       }
66452       function hashtagHashtags() {
66453         var matches = (tags.hashtags || "").split(/[,;\s]+/).map(function(s2) {
66454           if (s2[0] !== "#") {
66455             s2 = "#" + s2;
66456           }
66457           var matched = s2.match(hashtagRegex);
66458           return matched && matched[0];
66459         }).filter(Boolean);
66460         return matches || [];
66461       }
66462     }
66463     function isReviewRequested(tags) {
66464       var rr = tags.review_requested;
66465       if (rr === void 0)
66466         return false;
66467       rr = rr.trim().toLowerCase();
66468       return !(rr === "" || rr === "no");
66469     }
66470     function updateChangeset(changed, onInput) {
66471       var tags = Object.assign({}, context.changeset.tags);
66472       Object.keys(changed).forEach(function(k2) {
66473         var v2 = changed[k2];
66474         k2 = context.cleanTagKey(k2);
66475         if (readOnlyTags.indexOf(k2) !== -1)
66476           return;
66477         if (v2 === void 0) {
66478           delete tags[k2];
66479         } else if (onInput) {
66480           tags[k2] = v2;
66481         } else {
66482           tags[k2] = context.cleanTagValue(v2);
66483         }
66484       });
66485       if (!onInput) {
66486         var commentOnly = changed.hasOwnProperty("comment") && changed.comment !== "";
66487         var arr = findHashtags(tags, commentOnly);
66488         if (arr.length) {
66489           tags.hashtags = context.cleanTagValue(arr.join(";"));
66490           corePreferences("hashtags", tags.hashtags);
66491         } else {
66492           delete tags.hashtags;
66493           corePreferences("hashtags", null);
66494         }
66495       }
66496       if (_userDetails2 && _userDetails2.changesets_count !== void 0) {
66497         var changesetsCount = parseInt(_userDetails2.changesets_count, 10) + 1;
66498         tags.changesets_count = String(changesetsCount);
66499         if (changesetsCount <= 100) {
66500           var s2;
66501           s2 = corePreferences("walkthrough_completed");
66502           if (s2) {
66503             tags["ideditor:walkthrough_completed"] = s2;
66504           }
66505           s2 = corePreferences("walkthrough_progress");
66506           if (s2) {
66507             tags["ideditor:walkthrough_progress"] = s2;
66508           }
66509           s2 = corePreferences("walkthrough_started");
66510           if (s2) {
66511             tags["ideditor:walkthrough_started"] = s2;
66512           }
66513         }
66514       } else {
66515         delete tags.changesets_count;
66516       }
66517       if (!(0, import_fast_deep_equal9.default)(context.changeset.tags, tags)) {
66518         context.changeset = context.changeset.update({ tags });
66519       }
66520     }
66521     commit.reset = function() {
66522       context.changeset = null;
66523     };
66524     return utilRebind(commit, dispatch14, "on");
66525   }
66526
66527   // modules/ui/confirm.js
66528   function uiConfirm(selection2) {
66529     var modalSelection = uiModal(selection2);
66530     modalSelection.select(".modal").classed("modal-alert", true);
66531     var section = modalSelection.select(".content");
66532     section.append("div").attr("class", "modal-section header");
66533     section.append("div").attr("class", "modal-section message-text");
66534     var buttons = section.append("div").attr("class", "modal-section buttons cf");
66535     modalSelection.okButton = function() {
66536       buttons.append("button").attr("class", "button ok-button action").on("click.confirm", function() {
66537         modalSelection.remove();
66538       }).call(_t.append("confirm.okay")).node().focus();
66539       return modalSelection;
66540     };
66541     return modalSelection;
66542   }
66543
66544   // modules/ui/conflicts.js
66545   function uiConflicts(context) {
66546     var dispatch14 = dispatch_default("cancel", "save");
66547     var keybinding = utilKeybinding("conflicts");
66548     var _origChanges;
66549     var _conflictList;
66550     var _shownConflictIndex;
66551     function keybindingOn() {
66552       select_default2(document).call(keybinding.on("\u238B", cancel, true));
66553     }
66554     function keybindingOff() {
66555       select_default2(document).call(keybinding.unbind);
66556     }
66557     function tryAgain() {
66558       keybindingOff();
66559       dispatch14.call("save");
66560     }
66561     function cancel() {
66562       keybindingOff();
66563       dispatch14.call("cancel");
66564     }
66565     function conflicts(selection2) {
66566       keybindingOn();
66567       var headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
66568       headerEnter.append("button").attr("class", "fr").attr("title", _t("icons.close")).on("click", cancel).call(svgIcon("#iD-icon-close"));
66569       headerEnter.append("h2").call(_t.append("save.conflict.header"));
66570       var bodyEnter = selection2.selectAll(".body").data([0]).enter().append("div").attr("class", "body fillL");
66571       var conflictsHelpEnter = bodyEnter.append("div").attr("class", "conflicts-help").call(_t.append("save.conflict.help"));
66572       var changeset = new osmChangeset();
66573       delete changeset.id;
66574       var data = JXON.stringify(changeset.osmChangeJXON(_origChanges));
66575       var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
66576       var fileName = "changes.osc";
66577       var linkEnter = conflictsHelpEnter.selectAll(".download-changes").append("a").attr("class", "download-changes");
66578       linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
66579       linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("save.conflict.download_changes"));
66580       bodyEnter.append("div").attr("class", "conflict-container fillL3").call(showConflict, 0);
66581       bodyEnter.append("div").attr("class", "conflicts-done").attr("opacity", 0).style("display", "none").call(_t.append("save.conflict.done"));
66582       var buttonsEnter = bodyEnter.append("div").attr("class", "buttons col12 joined conflicts-buttons");
66583       buttonsEnter.append("button").attr("disabled", _conflictList.length > 1).attr("class", "action conflicts-button col6").call(_t.append("save.title")).on("click.try_again", tryAgain);
66584       buttonsEnter.append("button").attr("class", "secondary-action conflicts-button col6").call(_t.append("confirm.cancel")).on("click.cancel", cancel);
66585     }
66586     function showConflict(selection2, index) {
66587       index = utilWrap(index, _conflictList.length);
66588       _shownConflictIndex = index;
66589       var parent = select_default2(selection2.node().parentNode);
66590       if (index === _conflictList.length - 1) {
66591         window.setTimeout(function() {
66592           parent.select(".conflicts-button").attr("disabled", null);
66593           parent.select(".conflicts-done").transition().attr("opacity", 1).style("display", "block");
66594         }, 250);
66595       }
66596       var conflict = selection2.selectAll(".conflict").data([_conflictList[index]]);
66597       conflict.exit().remove();
66598       var conflictEnter = conflict.enter().append("div").attr("class", "conflict");
66599       conflictEnter.append("h4").attr("class", "conflict-count").call(_t.append("save.conflict.count", { num: index + 1, total: _conflictList.length }));
66600       conflictEnter.append("a").attr("class", "conflict-description").attr("href", "#").text(function(d2) {
66601         return d2.name;
66602       }).on("click", function(d3_event, d2) {
66603         d3_event.preventDefault();
66604         zoomToEntity(d2.id);
66605       });
66606       var details = conflictEnter.append("div").attr("class", "conflict-detail-container");
66607       details.append("ul").attr("class", "conflict-detail-list").selectAll("li").data(function(d2) {
66608         return d2.details || [];
66609       }).enter().append("li").attr("class", "conflict-detail-item").html(function(d2) {
66610         return d2;
66611       });
66612       details.append("div").attr("class", "conflict-choices").call(addChoices);
66613       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) {
66614         return i3 === 0 && index === 0 || i3 === 1 && index === _conflictList.length - 1 || null;
66615       }).on("click", function(d3_event, d2) {
66616         d3_event.preventDefault();
66617         var container = parent.selectAll(".conflict-container");
66618         var sign2 = d2 === "previous" ? -1 : 1;
66619         container.selectAll(".conflict").remove();
66620         container.call(showConflict, index + sign2);
66621       }).each(function(d2) {
66622         _t.append("save.conflict." + d2)(select_default2(this));
66623       });
66624     }
66625     function addChoices(selection2) {
66626       var choices = selection2.append("ul").attr("class", "layer-list").selectAll("li").data(function(d2) {
66627         return d2.choices || [];
66628       });
66629       var choicesEnter = choices.enter().append("li").attr("class", "layer");
66630       var labelEnter = choicesEnter.append("label");
66631       labelEnter.append("input").attr("type", "radio").attr("name", function(d2) {
66632         return d2.id;
66633       }).on("change", function(d3_event, d2) {
66634         var ul = this.parentNode.parentNode.parentNode;
66635         ul.__data__.chosen = d2.id;
66636         choose(d3_event, ul, d2);
66637       });
66638       labelEnter.append("span").text(function(d2) {
66639         return d2.text;
66640       });
66641       choicesEnter.merge(choices).each(function(d2) {
66642         var ul = this.parentNode;
66643         if (ul.__data__.chosen === d2.id) {
66644           choose(null, ul, d2);
66645         }
66646       });
66647     }
66648     function choose(d3_event, ul, datum2) {
66649       if (d3_event)
66650         d3_event.preventDefault();
66651       select_default2(ul).selectAll("li").classed("active", function(d2) {
66652         return d2 === datum2;
66653       }).selectAll("input").property("checked", function(d2) {
66654         return d2 === datum2;
66655       });
66656       var extent = geoExtent();
66657       var entity;
66658       entity = context.graph().hasEntity(datum2.id);
66659       if (entity)
66660         extent._extend(entity.extent(context.graph()));
66661       datum2.action();
66662       entity = context.graph().hasEntity(datum2.id);
66663       if (entity)
66664         extent._extend(entity.extent(context.graph()));
66665       zoomToEntity(datum2.id, extent);
66666     }
66667     function zoomToEntity(id2, extent) {
66668       context.surface().selectAll(".hover").classed("hover", false);
66669       var entity = context.graph().hasEntity(id2);
66670       if (entity) {
66671         if (extent) {
66672           context.map().trimmedExtent(extent);
66673         } else {
66674           context.map().zoomToEase(entity);
66675         }
66676         context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
66677       }
66678     }
66679     conflicts.conflictList = function(_2) {
66680       if (!arguments.length)
66681         return _conflictList;
66682       _conflictList = _2;
66683       return conflicts;
66684     };
66685     conflicts.origChanges = function(_2) {
66686       if (!arguments.length)
66687         return _origChanges;
66688       _origChanges = _2;
66689       return conflicts;
66690     };
66691     conflicts.shownEntityIds = function() {
66692       if (_conflictList && typeof _shownConflictIndex === "number") {
66693         return [_conflictList[_shownConflictIndex].id];
66694       }
66695       return [];
66696     };
66697     return utilRebind(conflicts, dispatch14, "on");
66698   }
66699
66700   // modules/ui/entity_editor.js
66701   var import_fast_deep_equal10 = __toESM(require_fast_deep_equal());
66702
66703   // modules/ui/sections/entity_issues.js
66704   function uiSectionEntityIssues(context) {
66705     var preference = corePreferences("entity-issues.reference.expanded");
66706     var _expanded = preference === null ? true : preference === "true";
66707     var _entityIDs = [];
66708     var _issues = [];
66709     var _activeIssueID;
66710     var section = uiSection("entity-issues", context).shouldDisplay(function() {
66711       return _issues.length > 0;
66712     }).label(function() {
66713       return _t.append("inspector.title_count", { title: _t("issues.list_title"), count: _issues.length });
66714     }).disclosureContent(renderDisclosureContent);
66715     context.validator().on("validated.entity_issues", function() {
66716       reloadIssues();
66717       section.reRender();
66718     }).on("focusedIssue.entity_issues", function(issue) {
66719       makeActiveIssue(issue.id);
66720     });
66721     function reloadIssues() {
66722       _issues = context.validator().getSharedEntityIssues(_entityIDs, { includeDisabledRules: true });
66723     }
66724     function makeActiveIssue(issueID) {
66725       _activeIssueID = issueID;
66726       section.selection().selectAll(".issue-container").classed("active", function(d2) {
66727         return d2.id === _activeIssueID;
66728       });
66729     }
66730     function renderDisclosureContent(selection2) {
66731       selection2.classed("grouped-items-area", true);
66732       _activeIssueID = _issues.length > 0 ? _issues[0].id : null;
66733       var containers = selection2.selectAll(".issue-container").data(_issues, function(d2) {
66734         return d2.key;
66735       });
66736       containers.exit().remove();
66737       var containersEnter = containers.enter().append("div").attr("class", "issue-container");
66738       var itemsEnter = containersEnter.append("div").attr("class", function(d2) {
66739         return "issue severity-" + d2.severity;
66740       }).on("mouseover.highlight", function(d3_event, d2) {
66741         var ids = d2.entityIds.filter(function(e3) {
66742           return _entityIDs.indexOf(e3) === -1;
66743         });
66744         utilHighlightEntities(ids, true, context);
66745       }).on("mouseout.highlight", function(d3_event, d2) {
66746         var ids = d2.entityIds.filter(function(e3) {
66747           return _entityIDs.indexOf(e3) === -1;
66748         });
66749         utilHighlightEntities(ids, false, context);
66750       });
66751       var labelsEnter = itemsEnter.append("div").attr("class", "issue-label");
66752       var textEnter = labelsEnter.append("button").attr("class", "issue-text").on("click", function(d3_event, d2) {
66753         makeActiveIssue(d2.id);
66754         var extent = d2.extent(context.graph());
66755         if (extent) {
66756           var setZoom = Math.max(context.map().zoom(), 19);
66757           context.map().unobscuredCenterZoomEase(extent.center(), setZoom);
66758         }
66759       });
66760       textEnter.each(function(d2) {
66761         var iconName = "#iD-icon-" + (d2.severity === "warning" ? "alert" : "error");
66762         select_default2(this).call(svgIcon(iconName, "issue-icon"));
66763       });
66764       textEnter.append("span").attr("class", "issue-message");
66765       var infoButton = labelsEnter.append("button").attr("class", "issue-info-button").attr("title", _t("icons.information")).call(svgIcon("#iD-icon-inspect"));
66766       infoButton.on("click", function(d3_event) {
66767         d3_event.stopPropagation();
66768         d3_event.preventDefault();
66769         this.blur();
66770         var container = select_default2(this.parentNode.parentNode.parentNode);
66771         var info = container.selectAll(".issue-info");
66772         var isExpanded = info.classed("expanded");
66773         _expanded = !isExpanded;
66774         corePreferences("entity-issues.reference.expanded", _expanded);
66775         if (isExpanded) {
66776           info.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
66777             info.classed("expanded", false);
66778           });
66779         } else {
66780           info.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1").on("end", function() {
66781             info.style("max-height", null);
66782           });
66783         }
66784       });
66785       itemsEnter.append("ul").attr("class", "issue-fix-list");
66786       containersEnter.append("div").attr("class", "issue-info" + (_expanded ? " expanded" : "")).style("max-height", _expanded ? null : "0").style("opacity", _expanded ? "1" : "0").each(function(d2) {
66787         if (typeof d2.reference === "function") {
66788           select_default2(this).call(d2.reference);
66789         } else {
66790           select_default2(this).call(_t.append("inspector.no_documentation_key"));
66791         }
66792       });
66793       containers = containers.merge(containersEnter).classed("active", function(d2) {
66794         return d2.id === _activeIssueID;
66795       });
66796       containers.selectAll(".issue-message").text("").each(function(d2) {
66797         return d2.message(context)(select_default2(this));
66798       });
66799       var fixLists = containers.selectAll(".issue-fix-list");
66800       var fixes = fixLists.selectAll(".issue-fix-item").data(function(d2) {
66801         return d2.fixes ? d2.fixes(context) : [];
66802       }, function(fix) {
66803         return fix.id;
66804       });
66805       fixes.exit().remove();
66806       var fixesEnter = fixes.enter().append("li").attr("class", "issue-fix-item");
66807       var buttons = fixesEnter.append("button").on("click", function(d3_event, d2) {
66808         if (select_default2(this).attr("disabled") || !d2.onClick)
66809           return;
66810         if (d2.issue.dateLastRanFix && /* @__PURE__ */ new Date() - d2.issue.dateLastRanFix < 1e3)
66811           return;
66812         d2.issue.dateLastRanFix = /* @__PURE__ */ new Date();
66813         utilHighlightEntities(d2.issue.entityIds.concat(d2.entityIds), false, context);
66814         new Promise(function(resolve, reject) {
66815           d2.onClick(context, resolve, reject);
66816           if (d2.onClick.length <= 1) {
66817             resolve();
66818           }
66819         }).then(function() {
66820           context.validator().validate();
66821         });
66822       }).on("mouseover.highlight", function(d3_event, d2) {
66823         utilHighlightEntities(d2.entityIds, true, context);
66824       }).on("mouseout.highlight", function(d3_event, d2) {
66825         utilHighlightEntities(d2.entityIds, false, context);
66826       });
66827       buttons.each(function(d2) {
66828         var iconName = d2.icon || "iD-icon-wrench";
66829         if (iconName.startsWith("maki")) {
66830           iconName += "-15";
66831         }
66832         select_default2(this).call(svgIcon("#" + iconName, "fix-icon"));
66833       });
66834       buttons.append("span").attr("class", "fix-message").each(function(d2) {
66835         return d2.title(select_default2(this));
66836       });
66837       fixesEnter.merge(fixes).selectAll("button").classed("actionable", function(d2) {
66838         return d2.onClick;
66839       }).attr("disabled", function(d2) {
66840         return d2.onClick ? null : "true";
66841       }).attr("title", function(d2) {
66842         if (d2.disabledReason) {
66843           return d2.disabledReason;
66844         }
66845         return null;
66846       });
66847     }
66848     section.entityIDs = function(val) {
66849       if (!arguments.length)
66850         return _entityIDs;
66851       if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
66852         _entityIDs = val;
66853         _activeIssueID = null;
66854         reloadIssues();
66855       }
66856       return section;
66857     };
66858     return section;
66859   }
66860
66861   // modules/ui/preset_icon.js
66862   function uiPresetIcon() {
66863     let _preset;
66864     let _geometry;
66865     function presetIcon(selection2) {
66866       selection2.each(render);
66867     }
66868     function getIcon(p2, geom) {
66869       if (p2.isFallback && p2.isFallback())
66870         return geom === "vertex" ? "" : "iD-icon-" + p2.id;
66871       if (p2.icon)
66872         return p2.icon;
66873       if (geom === "line")
66874         return "iD-other-line";
66875       if (geom === "vertex")
66876         return "temaki-vertex";
66877       return "maki-marker-stroked";
66878     }
66879     function renderPointBorder(container, drawPoint) {
66880       let pointBorder = container.selectAll(".preset-icon-point-border").data(drawPoint ? [0] : []);
66881       pointBorder.exit().remove();
66882       let pointBorderEnter = pointBorder.enter();
66883       const w2 = 40;
66884       const h2 = 40;
66885       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");
66886       pointBorder = pointBorderEnter.merge(pointBorder);
66887     }
66888     function renderCategoryBorder(container, category) {
66889       let categoryBorder = container.selectAll(".preset-icon-category-border").data(category ? [0] : []);
66890       categoryBorder.exit().remove();
66891       let categoryBorderEnter = categoryBorder.enter();
66892       const d2 = 60;
66893       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}`);
66894       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");
66895       categoryBorder = categoryBorderEnter.merge(categoryBorder);
66896       if (category) {
66897         categoryBorder.selectAll("path").attr("class", `area ${category.id}`);
66898       }
66899     }
66900     function renderCircleFill(container, drawVertex) {
66901       let vertexFill = container.selectAll(".preset-icon-fill-vertex").data(drawVertex ? [0] : []);
66902       vertexFill.exit().remove();
66903       let vertexFillEnter = vertexFill.enter();
66904       const w2 = 60;
66905       const h2 = 60;
66906       const d2 = 40;
66907       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);
66908       vertexFill = vertexFillEnter.merge(vertexFill);
66909     }
66910     function renderSquareFill(container, drawArea, tagClasses) {
66911       let fill = container.selectAll(".preset-icon-fill-area").data(drawArea ? [0] : []);
66912       fill.exit().remove();
66913       let fillEnter = fill.enter();
66914       const d2 = 60;
66915       const w2 = d2;
66916       const h2 = d2;
66917       const l2 = d2 * 2 / 3;
66918       const c1 = (w2 - l2) / 2;
66919       const c2 = c1 + l2;
66920       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}`);
66921       ["fill", "stroke"].forEach((klass) => {
66922         fillEnter.append("path").attr("d", `M${c1} ${c1} L${c1} ${c2} L${c2} ${c2} L${c2} ${c1} Z`).attr("class", `area ${klass}`);
66923       });
66924       const rVertex = 2.5;
66925       [[c1, c1], [c1, c2], [c2, c2], [c2, c1]].forEach((point2) => {
66926         fillEnter.append("circle").attr("class", "vertex").attr("cx", point2[0]).attr("cy", point2[1]).attr("r", rVertex);
66927       });
66928       const rMidpoint = 1.25;
66929       [[c1, w2 / 2], [c2, w2 / 2], [h2 / 2, c1], [h2 / 2, c2]].forEach((point2) => {
66930         fillEnter.append("circle").attr("class", "midpoint").attr("cx", point2[0]).attr("cy", point2[1]).attr("r", rMidpoint);
66931       });
66932       fill = fillEnter.merge(fill);
66933       fill.selectAll("path.stroke").attr("class", `area stroke ${tagClasses}`);
66934       fill.selectAll("path.fill").attr("class", `area fill ${tagClasses}`);
66935     }
66936     function renderLine(container, drawLine, tagClasses) {
66937       let line = container.selectAll(".preset-icon-line").data(drawLine ? [0] : []);
66938       line.exit().remove();
66939       let lineEnter = line.enter();
66940       const d2 = 60;
66941       const w2 = d2;
66942       const h2 = d2;
66943       const y2 = Math.round(d2 * 0.72);
66944       const l2 = Math.round(d2 * 0.6);
66945       const r2 = 2.5;
66946       const x12 = (w2 - l2) / 2;
66947       const x2 = x12 + l2;
66948       lineEnter = lineEnter.append("svg").attr("class", "preset-icon-line").attr("width", w2).attr("height", h2).attr("viewBox", `0 0 ${w2} ${h2}`);
66949       ["casing", "stroke"].forEach((klass) => {
66950         lineEnter.append("path").attr("d", `M${x12} ${y2} L${x2} ${y2}`).attr("class", `line ${klass}`);
66951       });
66952       [[x12 - 1, y2], [x2 + 1, y2]].forEach((point2) => {
66953         lineEnter.append("circle").attr("class", "vertex").attr("cx", point2[0]).attr("cy", point2[1]).attr("r", r2);
66954       });
66955       line = lineEnter.merge(line);
66956       line.selectAll("path.stroke").attr("class", `line stroke ${tagClasses}`);
66957       line.selectAll("path.casing").attr("class", `line casing ${tagClasses}`);
66958     }
66959     function renderRoute(container, drawRoute, p2) {
66960       let route = container.selectAll(".preset-icon-route").data(drawRoute ? [0] : []);
66961       route.exit().remove();
66962       let routeEnter = route.enter();
66963       const d2 = 60;
66964       const w2 = d2;
66965       const h2 = d2;
66966       const y12 = Math.round(d2 * 0.8);
66967       const y2 = Math.round(d2 * 0.68);
66968       const l2 = Math.round(d2 * 0.6);
66969       const r2 = 2;
66970       const x12 = (w2 - l2) / 2;
66971       const x2 = x12 + l2 / 3;
66972       const x3 = x2 + l2 / 3;
66973       const x4 = x3 + l2 / 3;
66974       routeEnter = routeEnter.append("svg").attr("class", "preset-icon-route").attr("width", w2).attr("height", h2).attr("viewBox", `0 0 ${w2} ${h2}`);
66975       ["casing", "stroke"].forEach((klass) => {
66976         routeEnter.append("path").attr("d", `M${x12} ${y12} L${x2} ${y2}`).attr("class", `segment0 line ${klass}`);
66977         routeEnter.append("path").attr("d", `M${x2} ${y2} L${x3} ${y12}`).attr("class", `segment1 line ${klass}`);
66978         routeEnter.append("path").attr("d", `M${x3} ${y12} L${x4} ${y2}`).attr("class", `segment2 line ${klass}`);
66979       });
66980       [[x12, y12], [x2, y2], [x3, y12], [x4, y2]].forEach((point2) => {
66981         routeEnter.append("circle").attr("class", "vertex").attr("cx", point2[0]).attr("cy", point2[1]).attr("r", r2);
66982       });
66983       route = routeEnter.merge(route);
66984       if (drawRoute) {
66985         let routeType = p2.tags.type === "waterway" ? "waterway" : p2.tags.route;
66986         const segmentPresetIDs = routeSegments[routeType];
66987         for (let i3 in segmentPresetIDs) {
66988           const segmentPreset = _mainPresetIndex.item(segmentPresetIDs[i3]);
66989           const segmentTagClasses = svgTagClasses().getClassesString(segmentPreset.tags, "");
66990           route.selectAll(`path.stroke.segment${i3}`).attr("class", `segment${i3} line stroke ${segmentTagClasses}`);
66991           route.selectAll(`path.casing.segment${i3}`).attr("class", `segment${i3} line casing ${segmentTagClasses}`);
66992         }
66993       }
66994     }
66995     function renderSvgIcon(container, picon, geom, isFramed, category, tagClasses) {
66996       const isMaki = picon && /^maki-/.test(picon);
66997       const isTemaki = picon && /^temaki-/.test(picon);
66998       const isFa = picon && /^fa[srb]-/.test(picon);
66999       const isR\u00F6ntgen = picon && /^roentgen-/.test(picon);
67000       const isiDIcon = picon && !(isMaki || isTemaki || isFa || isR\u00F6ntgen);
67001       let icon2 = container.selectAll(".preset-icon").data(picon ? [0] : []);
67002       icon2.exit().remove();
67003       icon2 = icon2.enter().append("div").attr("class", "preset-icon").call(svgIcon("")).merge(icon2);
67004       icon2.attr("class", "preset-icon " + (geom ? geom + "-geom" : "")).classed("category", category).classed("framed", isFramed).classed("preset-icon-iD", isiDIcon);
67005       icon2.selectAll("svg").attr("class", "icon " + picon + " " + (!isiDIcon && geom !== "line" ? "" : tagClasses));
67006       icon2.selectAll("use").attr("href", "#" + picon);
67007     }
67008     function renderImageIcon(container, imageURL) {
67009       let imageIcon = container.selectAll("img.image-icon").data(imageURL ? [0] : []);
67010       imageIcon.exit().remove();
67011       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);
67012       imageIcon.attr("src", imageURL);
67013     }
67014     const routeSegments = {
67015       bicycle: ["highway/cycleway", "highway/cycleway", "highway/cycleway"],
67016       bus: ["highway/unclassified", "highway/secondary", "highway/primary"],
67017       trolleybus: ["highway/unclassified", "highway/secondary", "highway/primary"],
67018       detour: ["highway/tertiary", "highway/residential", "highway/unclassified"],
67019       ferry: ["route/ferry", "route/ferry", "route/ferry"],
67020       foot: ["highway/footway", "highway/footway", "highway/footway"],
67021       hiking: ["highway/path", "highway/path", "highway/path"],
67022       horse: ["highway/bridleway", "highway/bridleway", "highway/bridleway"],
67023       light_rail: ["railway/light_rail", "railway/light_rail", "railway/light_rail"],
67024       monorail: ["railway/monorail", "railway/monorail", "railway/monorail"],
67025       mtb: ["highway/path", "highway/track", "highway/bridleway"],
67026       pipeline: ["man_made/pipeline", "man_made/pipeline", "man_made/pipeline"],
67027       piste: ["piste/downhill", "piste/hike", "piste/nordic"],
67028       power: ["power/line", "power/line", "power/line"],
67029       road: ["highway/secondary", "highway/primary", "highway/trunk"],
67030       subway: ["railway/subway", "railway/subway", "railway/subway"],
67031       train: ["railway/rail", "railway/rail", "railway/rail"],
67032       tram: ["railway/tram", "railway/tram", "railway/tram"],
67033       waterway: ["waterway/stream", "waterway/stream", "waterway/stream"]
67034     };
67035     function render() {
67036       let p2 = _preset.apply(this, arguments);
67037       let geom = _geometry ? _geometry.apply(this, arguments) : null;
67038       if (geom === "relation" && p2.tags && (p2.tags.type === "route" && p2.tags.route && routeSegments[p2.tags.route] || p2.tags.type === "waterway")) {
67039         geom = "route";
67040       }
67041       const showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
67042       const isFallback = p2.isFallback && p2.isFallback();
67043       const imageURL = showThirdPartyIcons === "true" && p2.imageURL;
67044       const picon = getIcon(p2, geom);
67045       const isCategory = !p2.setTags;
67046       const drawPoint = false;
67047       const drawVertex = picon !== null && geom === "vertex";
67048       const drawLine = picon && geom === "line" && !isFallback && !isCategory;
67049       const drawArea = picon && geom === "area" && !isFallback && !isCategory;
67050       const drawRoute = picon && geom === "route";
67051       const isFramed = drawVertex || drawArea || drawLine || drawRoute || isCategory;
67052       let tags = !isCategory ? p2.setTags({}, geom) : {};
67053       for (let k2 in tags) {
67054         if (tags[k2] === "*") {
67055           tags[k2] = "yes";
67056         }
67057       }
67058       let tagClasses = svgTagClasses().getClassesString(tags, "");
67059       let selection2 = select_default2(this);
67060       let container = selection2.selectAll(".preset-icon-container").data([0]);
67061       container = container.enter().append("div").attr("class", "preset-icon-container").merge(container);
67062       container.classed("showing-img", !!imageURL).classed("fallback", isFallback);
67063       renderCategoryBorder(container, isCategory && p2);
67064       renderPointBorder(container, drawPoint);
67065       renderCircleFill(container, drawVertex);
67066       renderSquareFill(container, drawArea, tagClasses);
67067       renderLine(container, drawLine, tagClasses);
67068       renderRoute(container, drawRoute, p2);
67069       renderSvgIcon(container, picon, geom, isFramed, isCategory, tagClasses);
67070       renderImageIcon(container, imageURL);
67071     }
67072     presetIcon.preset = function(val) {
67073       if (!arguments.length)
67074         return _preset;
67075       _preset = utilFunctor(val);
67076       return presetIcon;
67077     };
67078     presetIcon.geometry = function(val) {
67079       if (!arguments.length)
67080         return _geometry;
67081       _geometry = utilFunctor(val);
67082       return presetIcon;
67083     };
67084     return presetIcon;
67085   }
67086
67087   // modules/ui/sections/feature_type.js
67088   function uiSectionFeatureType(context) {
67089     var dispatch14 = dispatch_default("choose");
67090     var _entityIDs = [];
67091     var _presets = [];
67092     var _tagReference;
67093     var section = uiSection("feature-type", context).label(() => _t.append("inspector.feature_type")).disclosureContent(renderDisclosureContent);
67094     function renderDisclosureContent(selection2) {
67095       selection2.classed("preset-list-item", true);
67096       selection2.classed("mixed-types", _presets.length > 1);
67097       var presetButtonWrap = selection2.selectAll(".preset-list-button-wrap").data([0]).enter().append("div").attr("class", "preset-list-button-wrap");
67098       var presetButton = presetButtonWrap.append("button").attr("class", "preset-list-button preset-reset").call(
67099         uiTooltip().title(() => _t.append("inspector.back_tooltip")).placement("bottom")
67100       );
67101       presetButton.append("div").attr("class", "preset-icon-container");
67102       presetButton.append("div").attr("class", "label").append("div").attr("class", "label-inner");
67103       presetButtonWrap.append("div").attr("class", "accessory-buttons");
67104       var tagReferenceBodyWrap = selection2.selectAll(".tag-reference-body-wrap").data([0]);
67105       tagReferenceBodyWrap = tagReferenceBodyWrap.enter().append("div").attr("class", "tag-reference-body-wrap").merge(tagReferenceBodyWrap);
67106       if (_tagReference) {
67107         selection2.selectAll(".preset-list-button-wrap .accessory-buttons").style("display", _presets.length === 1 ? null : "none").call(_tagReference.button);
67108         tagReferenceBodyWrap.style("display", _presets.length === 1 ? null : "none").call(_tagReference.body);
67109       }
67110       selection2.selectAll(".preset-reset").on("click", function() {
67111         dispatch14.call("choose", this, _presets);
67112       }).on("pointerdown pointerup mousedown mouseup", function(d3_event) {
67113         d3_event.preventDefault();
67114         d3_event.stopPropagation();
67115       });
67116       var geometries = entityGeometries();
67117       selection2.select(".preset-list-item button").call(
67118         uiPresetIcon().geometry(_presets.length === 1 ? geometries.length === 1 && geometries[0] : null).preset(_presets.length === 1 ? _presets[0] : _mainPresetIndex.item("point"))
67119       );
67120       var names = _presets.length === 1 ? [
67121         _presets[0].nameLabel(),
67122         _presets[0].subtitleLabel()
67123       ].filter(Boolean) : [_t.append("inspector.multiple_types")];
67124       var label = selection2.select(".label-inner");
67125       var nameparts = label.selectAll(".namepart").data(names, (d2) => d2.stringId);
67126       nameparts.exit().remove();
67127       nameparts.enter().append("div").attr("class", "namepart").text("").each(function(d2) {
67128         d2(select_default2(this));
67129       });
67130     }
67131     section.entityIDs = function(val) {
67132       if (!arguments.length)
67133         return _entityIDs;
67134       _entityIDs = val;
67135       return section;
67136     };
67137     section.presets = function(val) {
67138       if (!arguments.length)
67139         return _presets;
67140       if (!utilArrayIdentical(val, _presets)) {
67141         _presets = val;
67142         if (_presets.length === 1) {
67143           _tagReference = uiTagReference(_presets[0].reference(), context).showing(false);
67144         }
67145       }
67146       return section;
67147     };
67148     function entityGeometries() {
67149       var counts = {};
67150       for (var i3 in _entityIDs) {
67151         var geometry = context.graph().geometry(_entityIDs[i3]);
67152         if (!counts[geometry])
67153           counts[geometry] = 0;
67154         counts[geometry] += 1;
67155       }
67156       return Object.keys(counts).sort(function(geom1, geom2) {
67157         return counts[geom2] - counts[geom1];
67158       });
67159     }
67160     return utilRebind(section, dispatch14, "on");
67161   }
67162
67163   // modules/ui/sections/preset_fields.js
67164   function uiSectionPresetFields(context) {
67165     var section = uiSection("preset-fields", context).label(() => _t.append("inspector.fields")).disclosureContent(renderDisclosureContent);
67166     var dispatch14 = dispatch_default("change", "revert");
67167     var formFields = uiFormFields(context);
67168     var _state;
67169     var _fieldsArr;
67170     var _presets = [];
67171     var _tags;
67172     var _entityIDs;
67173     function renderDisclosureContent(selection2) {
67174       if (!_fieldsArr) {
67175         var graph = context.graph();
67176         var geometries = Object.keys(_entityIDs.reduce(function(geoms, entityID) {
67177           geoms[graph.entity(entityID).geometry(graph)] = true;
67178           return geoms;
67179         }, {}));
67180         const loc = _entityIDs.reduce(function(extent, entityID) {
67181           var entity = context.graph().entity(entityID);
67182           return extent.extend(entity.extent(context.graph()));
67183         }, geoExtent()).center();
67184         var presetsManager = _mainPresetIndex;
67185         var allFields = [];
67186         var allMoreFields = [];
67187         var sharedTotalFields;
67188         _presets.forEach(function(preset) {
67189           var fields = preset.fields(loc);
67190           var moreFields = preset.moreFields(loc);
67191           allFields = utilArrayUnion(allFields, fields);
67192           allMoreFields = utilArrayUnion(allMoreFields, moreFields);
67193           if (!sharedTotalFields) {
67194             sharedTotalFields = utilArrayUnion(fields, moreFields);
67195           } else {
67196             sharedTotalFields = sharedTotalFields.filter(function(field) {
67197               return fields.indexOf(field) !== -1 || moreFields.indexOf(field) !== -1;
67198             });
67199           }
67200         });
67201         var sharedFields = allFields.filter(function(field) {
67202           return sharedTotalFields.indexOf(field) !== -1;
67203         });
67204         var sharedMoreFields = allMoreFields.filter(function(field) {
67205           return sharedTotalFields.indexOf(field) !== -1;
67206         });
67207         _fieldsArr = [];
67208         sharedFields.forEach(function(field) {
67209           if (field.matchAllGeometry(geometries)) {
67210             _fieldsArr.push(
67211               uiField(context, field, _entityIDs)
67212             );
67213           }
67214         });
67215         var singularEntity = _entityIDs.length === 1 && graph.hasEntity(_entityIDs[0]);
67216         if (singularEntity && singularEntity.isHighwayIntersection(graph) && presetsManager.field("restrictions")) {
67217           _fieldsArr.push(
67218             uiField(context, presetsManager.field("restrictions"), _entityIDs)
67219           );
67220         }
67221         var additionalFields = utilArrayUnion(sharedMoreFields, presetsManager.universal());
67222         additionalFields.sort(function(field1, field2) {
67223           return field1.title().localeCompare(field2.title(), _mainLocalizer.localeCode());
67224         });
67225         additionalFields.forEach(function(field) {
67226           if (sharedFields.indexOf(field) === -1 && field.matchAllGeometry(geometries)) {
67227             _fieldsArr.push(
67228               uiField(context, field, _entityIDs, { show: false })
67229             );
67230           }
67231         });
67232         _fieldsArr.forEach(function(field) {
67233           field.on("change", function(t2, onInput) {
67234             dispatch14.call("change", field, _entityIDs, t2, onInput);
67235           }).on("revert", function(keys2) {
67236             dispatch14.call("revert", field, keys2);
67237           });
67238         });
67239       }
67240       _fieldsArr.forEach(function(field) {
67241         field.state(_state).tags(_tags);
67242       });
67243       selection2.call(
67244         formFields.fieldsArr(_fieldsArr).state(_state).klass("grouped-items-area")
67245       );
67246     }
67247     section.presets = function(val) {
67248       if (!arguments.length)
67249         return _presets;
67250       if (!_presets || !val || !utilArrayIdentical(_presets, val)) {
67251         _presets = val;
67252         _fieldsArr = null;
67253       }
67254       return section;
67255     };
67256     section.state = function(val) {
67257       if (!arguments.length)
67258         return _state;
67259       _state = val;
67260       return section;
67261     };
67262     section.tags = function(val) {
67263       if (!arguments.length)
67264         return _tags;
67265       _tags = val;
67266       return section;
67267     };
67268     section.entityIDs = function(val) {
67269       if (!arguments.length)
67270         return _entityIDs;
67271       if (!val || !_entityIDs || !utilArrayIdentical(_entityIDs, val)) {
67272         _entityIDs = val;
67273         _fieldsArr = null;
67274       }
67275       return section;
67276     };
67277     return utilRebind(section, dispatch14, "on");
67278   }
67279
67280   // modules/ui/sections/raw_member_editor.js
67281   function uiSectionRawMemberEditor(context) {
67282     var section = uiSection("raw-member-editor", context).shouldDisplay(function() {
67283       if (!_entityIDs || _entityIDs.length !== 1)
67284         return false;
67285       var entity = context.hasEntity(_entityIDs[0]);
67286       return entity && entity.type === "relation";
67287     }).label(function() {
67288       var entity = context.hasEntity(_entityIDs[0]);
67289       if (!entity)
67290         return "";
67291       var gt2 = entity.members.length > _maxMembers ? ">" : "";
67292       var count = gt2 + entity.members.slice(0, _maxMembers).length;
67293       return _t.append("inspector.title_count", { title: _t("inspector.members"), count });
67294     }).disclosureContent(renderDisclosureContent);
67295     var taginfo = services.taginfo;
67296     var _entityIDs;
67297     var _maxMembers = 1e3;
67298     function downloadMember(d3_event, d2) {
67299       d3_event.preventDefault();
67300       select_default2(this.parentNode).classed("tag-reference-loading", true);
67301       context.loadEntity(d2.id, function() {
67302         section.reRender();
67303       });
67304     }
67305     function zoomToMember(d3_event, d2) {
67306       d3_event.preventDefault();
67307       var entity = context.entity(d2.id);
67308       context.map().zoomToEase(entity);
67309       utilHighlightEntities([d2.id], true, context);
67310     }
67311     function selectMember(d3_event, d2) {
67312       d3_event.preventDefault();
67313       utilHighlightEntities([d2.id], false, context);
67314       var entity = context.entity(d2.id);
67315       var mapExtent = context.map().extent();
67316       if (!entity.intersects(mapExtent, context.graph())) {
67317         context.map().zoomToEase(entity);
67318       }
67319       context.enter(modeSelect(context, [d2.id]));
67320     }
67321     function changeRole(d3_event, d2) {
67322       var oldRole = d2.role;
67323       var newRole = context.cleanRelationRole(select_default2(this).property("value"));
67324       if (oldRole !== newRole) {
67325         var member = { id: d2.id, type: d2.type, role: newRole };
67326         context.perform(
67327           actionChangeMember(d2.relation.id, member, d2.index),
67328           _t("operations.change_role.annotation", {
67329             n: 1
67330           })
67331         );
67332         context.validator().validate();
67333       }
67334     }
67335     function deleteMember(d3_event, d2) {
67336       utilHighlightEntities([d2.id], false, context);
67337       context.perform(
67338         actionDeleteMember(d2.relation.id, d2.index),
67339         _t("operations.delete_member.annotation", {
67340           n: 1
67341         })
67342       );
67343       if (!context.hasEntity(d2.relation.id)) {
67344         context.enter(modeBrowse(context));
67345       } else {
67346         context.validator().validate();
67347       }
67348     }
67349     function renderDisclosureContent(selection2) {
67350       var entityID = _entityIDs[0];
67351       var memberships = [];
67352       var entity = context.entity(entityID);
67353       entity.members.slice(0, _maxMembers).forEach(function(member, index) {
67354         memberships.push({
67355           index,
67356           id: member.id,
67357           type: member.type,
67358           role: member.role,
67359           relation: entity,
67360           member: context.hasEntity(member.id),
67361           domId: utilUniqueDomId(entityID + "-member-" + index)
67362         });
67363       });
67364       var list = selection2.selectAll(".member-list").data([0]);
67365       list = list.enter().append("ul").attr("class", "member-list").merge(list);
67366       var items = list.selectAll("li").data(memberships, function(d2) {
67367         return osmEntity.key(d2.relation) + "," + d2.index + "," + (d2.member ? osmEntity.key(d2.member) : "incomplete");
67368       });
67369       items.exit().each(unbind).remove();
67370       var itemsEnter = items.enter().append("li").attr("class", "member-row form-field").classed("member-incomplete", function(d2) {
67371         return !d2.member;
67372       });
67373       itemsEnter.each(function(d2) {
67374         var item = select_default2(this);
67375         var label = item.append("label").attr("class", "field-label").attr("for", d2.domId);
67376         if (d2.member) {
67377           item.on("mouseover", function() {
67378             utilHighlightEntities([d2.id], true, context);
67379           }).on("mouseout", function() {
67380             utilHighlightEntities([d2.id], false, context);
67381           });
67382           var labelLink = label.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectMember);
67383           labelLink.append("span").attr("class", "member-entity-type").text(function(d4) {
67384             var matched = _mainPresetIndex.match(d4.member, context.graph());
67385             return matched && matched.name() || utilDisplayType(d4.member.id);
67386           });
67387           labelLink.append("span").attr("class", "member-entity-name").text(function(d4) {
67388             return utilDisplayName(d4.member);
67389           });
67390           label.append("button").attr("title", _t("icons.remove")).attr("class", "remove member-delete").call(svgIcon("#iD-operation-delete"));
67391           label.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToMember);
67392         } else {
67393           var labelText = label.append("span").attr("class", "label-text");
67394           labelText.append("span").attr("class", "member-entity-type").call(_t.append("inspector." + d2.type, { id: d2.id }));
67395           labelText.append("span").attr("class", "member-entity-name").call(_t.append("inspector.incomplete", { id: d2.id }));
67396           label.append("button").attr("class", "member-download").attr("title", _t("icons.download")).call(svgIcon("#iD-icon-load")).on("click", downloadMember);
67397         }
67398       });
67399       var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
67400       wrapEnter.append("input").attr("class", "member-role").attr("id", function(d2) {
67401         return d2.domId;
67402       }).property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
67403       if (taginfo) {
67404         wrapEnter.each(bindTypeahead);
67405       }
67406       items = items.merge(itemsEnter).order();
67407       items.select("input.member-role").property("value", function(d2) {
67408         return d2.role;
67409       }).on("blur", changeRole).on("change", changeRole);
67410       items.select("button.member-delete").on("click", deleteMember);
67411       var dragOrigin, targetIndex;
67412       items.call(
67413         drag_default().on("start", function(d3_event) {
67414           dragOrigin = {
67415             x: d3_event.x,
67416             y: d3_event.y
67417           };
67418           targetIndex = null;
67419         }).on("drag", function(d3_event) {
67420           var x2 = d3_event.x - dragOrigin.x, y2 = d3_event.y - dragOrigin.y;
67421           if (!select_default2(this).classed("dragging") && // don't display drag until dragging beyond a distance threshold
67422           Math.sqrt(Math.pow(x2, 2) + Math.pow(y2, 2)) <= 5)
67423             return;
67424           var index = items.nodes().indexOf(this);
67425           select_default2(this).classed("dragging", true);
67426           targetIndex = null;
67427           selection2.selectAll("li.member-row").style("transform", function(d2, index2) {
67428             var node = select_default2(this).node();
67429             if (index === index2) {
67430               return "translate(" + x2 + "px, " + y2 + "px)";
67431             } else if (index2 > index && d3_event.y > node.offsetTop) {
67432               if (targetIndex === null || index2 > targetIndex) {
67433                 targetIndex = index2;
67434               }
67435               return "translateY(-100%)";
67436             } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
67437               if (targetIndex === null || index2 < targetIndex) {
67438                 targetIndex = index2;
67439               }
67440               return "translateY(100%)";
67441             }
67442             return null;
67443           });
67444         }).on("end", function(d3_event, d2) {
67445           if (!select_default2(this).classed("dragging"))
67446             return;
67447           var index = items.nodes().indexOf(this);
67448           select_default2(this).classed("dragging", false);
67449           selection2.selectAll("li.member-row").style("transform", null);
67450           if (targetIndex !== null) {
67451             context.perform(
67452               actionMoveMember(d2.relation.id, index, targetIndex),
67453               _t("operations.reorder_members.annotation")
67454             );
67455             context.validator().validate();
67456           }
67457         })
67458       );
67459       function bindTypeahead(d2) {
67460         var row = select_default2(this);
67461         var role = row.selectAll("input.member-role");
67462         var origValue = role.property("value");
67463         function sort(value, data) {
67464           var sameletter = [];
67465           var other = [];
67466           for (var i3 = 0; i3 < data.length; i3++) {
67467             if (data[i3].value.substring(0, value.length) === value) {
67468               sameletter.push(data[i3]);
67469             } else {
67470               other.push(data[i3]);
67471             }
67472           }
67473           return sameletter.concat(other);
67474         }
67475         role.call(
67476           uiCombobox(context, "member-role").fetcher(function(role2, callback) {
67477             var geometry;
67478             if (d2.member) {
67479               geometry = context.graph().geometry(d2.member.id);
67480             } else if (d2.type === "relation") {
67481               geometry = "relation";
67482             } else if (d2.type === "way") {
67483               geometry = "line";
67484             } else {
67485               geometry = "point";
67486             }
67487             var rtype = entity.tags.type;
67488             taginfo.roles({
67489               debounce: true,
67490               rtype: rtype || "",
67491               geometry,
67492               query: role2
67493             }, function(err, data) {
67494               if (!err)
67495                 callback(sort(role2, data));
67496             });
67497           }).on("cancel", function() {
67498             role.property("value", origValue);
67499           })
67500         );
67501       }
67502       function unbind() {
67503         var row = select_default2(this);
67504         row.selectAll("input.member-role").call(uiCombobox.off, context);
67505       }
67506     }
67507     section.entityIDs = function(val) {
67508       if (!arguments.length)
67509         return _entityIDs;
67510       _entityIDs = val;
67511       return section;
67512     };
67513     return section;
67514   }
67515
67516   // modules/actions/delete_members.js
67517   function actionDeleteMembers(relationId, memberIndexes) {
67518     return function(graph) {
67519       memberIndexes.sort((a2, b2) => b2 - a2);
67520       for (var i3 in memberIndexes) {
67521         graph = actionDeleteMember(relationId, memberIndexes[i3])(graph);
67522       }
67523       return graph;
67524     };
67525   }
67526
67527   // modules/ui/sections/raw_membership_editor.js
67528   function uiSectionRawMembershipEditor(context) {
67529     var section = uiSection("raw-membership-editor", context).shouldDisplay(function() {
67530       return _entityIDs && _entityIDs.length;
67531     }).label(function() {
67532       var parents = getSharedParentRelations();
67533       var gt2 = parents.length > _maxMemberships ? ">" : "";
67534       var count = gt2 + parents.slice(0, _maxMemberships).length;
67535       return _t.append("inspector.title_count", { title: _t("inspector.relations"), count });
67536     }).disclosureContent(renderDisclosureContent);
67537     var taginfo = services.taginfo;
67538     var nearbyCombo = uiCombobox(context, "parent-relation").minItems(1).fetcher(fetchNearbyRelations).itemsMouseEnter(function(d3_event, d2) {
67539       if (d2.relation)
67540         utilHighlightEntities([d2.relation.id], true, context);
67541     }).itemsMouseLeave(function(d3_event, d2) {
67542       if (d2.relation)
67543         utilHighlightEntities([d2.relation.id], false, context);
67544     });
67545     var _inChange = false;
67546     var _entityIDs = [];
67547     var _showBlank;
67548     var _maxMemberships = 1e3;
67549     function getSharedParentRelations() {
67550       var parents = [];
67551       for (var i3 = 0; i3 < _entityIDs.length; i3++) {
67552         var entity = context.graph().hasEntity(_entityIDs[i3]);
67553         if (!entity)
67554           continue;
67555         if (i3 === 0) {
67556           parents = context.graph().parentRelations(entity);
67557         } else {
67558           parents = utilArrayIntersection(parents, context.graph().parentRelations(entity));
67559         }
67560         if (!parents.length)
67561           break;
67562       }
67563       return parents;
67564     }
67565     function getMemberships() {
67566       var memberships = [];
67567       var relations = getSharedParentRelations().slice(0, _maxMemberships);
67568       var isMultiselect = _entityIDs.length > 1;
67569       var i3, relation, membership, index, member, indexedMember;
67570       for (i3 = 0; i3 < relations.length; i3++) {
67571         relation = relations[i3];
67572         membership = {
67573           relation,
67574           members: [],
67575           hash: osmEntity.key(relation)
67576         };
67577         for (index = 0; index < relation.members.length; index++) {
67578           member = relation.members[index];
67579           if (_entityIDs.indexOf(member.id) !== -1) {
67580             indexedMember = Object.assign({}, member, { index });
67581             membership.members.push(indexedMember);
67582             membership.hash += "," + index.toString();
67583             if (!isMultiselect) {
67584               memberships.push(membership);
67585               membership = {
67586                 relation,
67587                 members: [],
67588                 hash: osmEntity.key(relation)
67589               };
67590             }
67591           }
67592         }
67593         if (membership.members.length)
67594           memberships.push(membership);
67595       }
67596       memberships.forEach(function(membership2) {
67597         membership2.domId = utilUniqueDomId("membership-" + membership2.relation.id);
67598         var roles = [];
67599         membership2.members.forEach(function(member2) {
67600           if (roles.indexOf(member2.role) === -1)
67601             roles.push(member2.role);
67602         });
67603         membership2.role = roles.length === 1 ? roles[0] : roles;
67604       });
67605       return memberships;
67606     }
67607     function selectRelation(d3_event, d2) {
67608       d3_event.preventDefault();
67609       utilHighlightEntities([d2.relation.id], false, context);
67610       context.enter(modeSelect(context, [d2.relation.id]));
67611     }
67612     function zoomToRelation(d3_event, d2) {
67613       d3_event.preventDefault();
67614       var entity = context.entity(d2.relation.id);
67615       context.map().zoomToEase(entity);
67616       utilHighlightEntities([d2.relation.id], true, context);
67617     }
67618     function changeRole(d3_event, d2) {
67619       if (d2 === 0)
67620         return;
67621       if (_inChange)
67622         return;
67623       var newRole = context.cleanRelationRole(select_default2(this).property("value"));
67624       if (!newRole.trim() && typeof d2.role !== "string")
67625         return;
67626       var membersToUpdate = d2.members.filter(function(member) {
67627         return member.role !== newRole;
67628       });
67629       if (membersToUpdate.length) {
67630         _inChange = true;
67631         context.perform(
67632           function actionChangeMemberRoles(graph) {
67633             membersToUpdate.forEach(function(member) {
67634               var newMember = Object.assign({}, member, { role: newRole });
67635               delete newMember.index;
67636               graph = actionChangeMember(d2.relation.id, newMember, member.index)(graph);
67637             });
67638             return graph;
67639           },
67640           _t("operations.change_role.annotation", {
67641             n: membersToUpdate.length
67642           })
67643         );
67644         context.validator().validate();
67645       }
67646       _inChange = false;
67647     }
67648     function addMembership(d2, role) {
67649       this.blur();
67650       _showBlank = false;
67651       function actionAddMembers(relationId, ids, role2) {
67652         return function(graph) {
67653           for (var i3 in ids) {
67654             var member = { id: ids[i3], type: graph.entity(ids[i3]).type, role: role2 };
67655             graph = actionAddMember(relationId, member)(graph);
67656           }
67657           return graph;
67658         };
67659       }
67660       if (d2.relation) {
67661         context.perform(
67662           actionAddMembers(d2.relation.id, _entityIDs, role),
67663           _t("operations.add_member.annotation", {
67664             n: _entityIDs.length
67665           })
67666         );
67667         context.validator().validate();
67668       } else {
67669         var relation = osmRelation();
67670         context.perform(
67671           actionAddEntity(relation),
67672           actionAddMembers(relation.id, _entityIDs, role),
67673           _t("operations.add.annotation.relation")
67674         );
67675         context.enter(modeSelect(context, [relation.id]).newFeature(true));
67676       }
67677     }
67678     function deleteMembership(d3_event, d2) {
67679       this.blur();
67680       if (d2 === 0)
67681         return;
67682       utilHighlightEntities([d2.relation.id], false, context);
67683       var indexes = d2.members.map(function(member) {
67684         return member.index;
67685       });
67686       context.perform(
67687         actionDeleteMembers(d2.relation.id, indexes),
67688         _t("operations.delete_member.annotation", {
67689           n: _entityIDs.length
67690         })
67691       );
67692       context.validator().validate();
67693     }
67694     function fetchNearbyRelations(q2, callback) {
67695       var newRelation = {
67696         relation: null,
67697         value: _t("inspector.new_relation"),
67698         display: _t.append("inspector.new_relation")
67699       };
67700       var entityID = _entityIDs[0];
67701       var result = [];
67702       var graph = context.graph();
67703       function baseDisplayLabel(entity) {
67704         var matched = _mainPresetIndex.match(entity, graph);
67705         var presetName = matched && matched.name() || _t("inspector.relation");
67706         var entityName = utilDisplayName(entity) || "";
67707         return presetName + " " + entityName;
67708       }
67709       var explicitRelation = q2 && context.hasEntity(q2.toLowerCase());
67710       if (explicitRelation && explicitRelation.type === "relation" && explicitRelation.id !== entityID) {
67711         result.push({
67712           relation: explicitRelation,
67713           value: baseDisplayLabel(explicitRelation) + " " + explicitRelation.id
67714         });
67715       } else {
67716         context.history().intersects(context.map().extent()).forEach(function(entity) {
67717           if (entity.type !== "relation" || entity.id === entityID)
67718             return;
67719           var value = baseDisplayLabel(entity);
67720           if (q2 && (value + " " + entity.id).toLowerCase().indexOf(q2.toLowerCase()) === -1)
67721             return;
67722           result.push({ relation: entity, value });
67723         });
67724         result.sort(function(a2, b2) {
67725           return osmRelation.creationOrder(a2.relation, b2.relation);
67726         });
67727         var dupeGroups = Object.values(utilArrayGroupBy(result, "value")).filter(function(v2) {
67728           return v2.length > 1;
67729         });
67730         dupeGroups.forEach(function(group) {
67731           group.forEach(function(obj) {
67732             obj.value += " " + obj.relation.id;
67733           });
67734         });
67735       }
67736       result.forEach(function(obj) {
67737         obj.title = obj.value;
67738       });
67739       result.unshift(newRelation);
67740       callback(result);
67741     }
67742     function renderDisclosureContent(selection2) {
67743       var memberships = getMemberships();
67744       var list = selection2.selectAll(".member-list").data([0]);
67745       list = list.enter().append("ul").attr("class", "member-list").merge(list);
67746       var items = list.selectAll("li.member-row-normal").data(memberships, function(d2) {
67747         return d2.hash;
67748       });
67749       items.exit().each(unbind).remove();
67750       var itemsEnter = items.enter().append("li").attr("class", "member-row member-row-normal form-field");
67751       itemsEnter.on("mouseover", function(d3_event, d2) {
67752         utilHighlightEntities([d2.relation.id], true, context);
67753       }).on("mouseout", function(d3_event, d2) {
67754         utilHighlightEntities([d2.relation.id], false, context);
67755       });
67756       var labelEnter = itemsEnter.append("label").attr("class", "field-label").attr("for", function(d2) {
67757         return d2.domId;
67758       });
67759       var labelLink = labelEnter.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectRelation);
67760       labelLink.append("span").attr("class", "member-entity-type").text(function(d2) {
67761         var matched = _mainPresetIndex.match(d2.relation, context.graph());
67762         return matched && matched.name() || _t.html("inspector.relation");
67763       });
67764       labelLink.append("span").attr("class", "member-entity-name").text(function(d2) {
67765         return utilDisplayName(d2.relation);
67766       });
67767       labelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", deleteMembership);
67768       labelEnter.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToRelation);
67769       var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
67770       wrapEnter.append("input").attr("class", "member-role").attr("id", function(d2) {
67771         return d2.domId;
67772       }).property("type", "text").property("value", function(d2) {
67773         return typeof d2.role === "string" ? d2.role : "";
67774       }).attr("title", function(d2) {
67775         return Array.isArray(d2.role) ? d2.role.filter(Boolean).join("\n") : d2.role;
67776       }).attr("placeholder", function(d2) {
67777         return Array.isArray(d2.role) ? _t("inspector.multiple_roles") : _t("inspector.role");
67778       }).classed("mixed", function(d2) {
67779         return Array.isArray(d2.role);
67780       }).call(utilNoAuto).on("blur", changeRole).on("change", changeRole);
67781       if (taginfo) {
67782         wrapEnter.each(bindTypeahead);
67783       }
67784       var newMembership = list.selectAll(".member-row-new").data(_showBlank ? [0] : []);
67785       newMembership.exit().remove();
67786       var newMembershipEnter = newMembership.enter().append("li").attr("class", "member-row member-row-new form-field");
67787       var newLabelEnter = newMembershipEnter.append("label").attr("class", "field-label");
67788       newLabelEnter.append("input").attr("placeholder", _t("inspector.choose_relation")).attr("type", "text").attr("class", "member-entity-input").call(utilNoAuto);
67789       newLabelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", function() {
67790         list.selectAll(".member-row-new").remove();
67791       });
67792       var newWrapEnter = newMembershipEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
67793       newWrapEnter.append("input").attr("class", "member-role").property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
67794       newMembership = newMembership.merge(newMembershipEnter);
67795       newMembership.selectAll(".member-entity-input").on("blur", cancelEntity).call(
67796         nearbyCombo.on("accept", acceptEntity).on("cancel", cancelEntity)
67797       );
67798       var addRow = selection2.selectAll(".add-row").data([0]);
67799       var addRowEnter = addRow.enter().append("div").attr("class", "add-row");
67800       var addRelationButton = addRowEnter.append("button").attr("class", "add-relation").attr("aria-label", _t("inspector.add_to_relation"));
67801       addRelationButton.call(svgIcon("#iD-icon-plus", "light"));
67802       addRelationButton.call(uiTooltip().title(() => _t.append("inspector.add_to_relation")).placement(_mainLocalizer.textDirection() === "ltr" ? "right" : "left"));
67803       addRowEnter.append("div").attr("class", "space-value");
67804       addRowEnter.append("div").attr("class", "space-buttons");
67805       addRow = addRow.merge(addRowEnter);
67806       addRow.select(".add-relation").on("click", function() {
67807         _showBlank = true;
67808         section.reRender();
67809         list.selectAll(".member-entity-input").node().focus();
67810       });
67811       function acceptEntity(d2) {
67812         if (!d2) {
67813           cancelEntity();
67814           return;
67815         }
67816         if (d2.relation)
67817           utilHighlightEntities([d2.relation.id], false, context);
67818         var role = context.cleanRelationRole(list.selectAll(".member-row-new .member-role").property("value"));
67819         addMembership(d2, role);
67820       }
67821       function cancelEntity() {
67822         var input = newMembership.selectAll(".member-entity-input");
67823         input.property("value", "");
67824         context.surface().selectAll(".highlighted").classed("highlighted", false);
67825       }
67826       function bindTypeahead(d2) {
67827         var row = select_default2(this);
67828         var role = row.selectAll("input.member-role");
67829         var origValue = role.property("value");
67830         function sort(value, data) {
67831           var sameletter = [];
67832           var other = [];
67833           for (var i3 = 0; i3 < data.length; i3++) {
67834             if (data[i3].value.substring(0, value.length) === value) {
67835               sameletter.push(data[i3]);
67836             } else {
67837               other.push(data[i3]);
67838             }
67839           }
67840           return sameletter.concat(other);
67841         }
67842         role.call(
67843           uiCombobox(context, "member-role").fetcher(function(role2, callback) {
67844             var rtype = d2.relation.tags.type;
67845             taginfo.roles({
67846               debounce: true,
67847               rtype: rtype || "",
67848               geometry: context.graph().geometry(_entityIDs[0]),
67849               query: role2
67850             }, function(err, data) {
67851               if (!err)
67852                 callback(sort(role2, data));
67853             });
67854           }).on("cancel", function() {
67855             role.property("value", origValue);
67856           })
67857         );
67858       }
67859       function unbind() {
67860         var row = select_default2(this);
67861         row.selectAll("input.member-role").call(uiCombobox.off, context);
67862       }
67863     }
67864     section.entityIDs = function(val) {
67865       if (!arguments.length)
67866         return _entityIDs;
67867       _entityIDs = val;
67868       _showBlank = false;
67869       return section;
67870     };
67871     return section;
67872   }
67873
67874   // modules/ui/sections/selection_list.js
67875   function uiSectionSelectionList(context) {
67876     var _selectedIDs = [];
67877     var section = uiSection("selected-features", context).shouldDisplay(function() {
67878       return _selectedIDs.length > 1;
67879     }).label(function() {
67880       return _t.append("inspector.title_count", { title: _t("inspector.features"), count: _selectedIDs.length });
67881     }).disclosureContent(renderDisclosureContent);
67882     context.history().on("change.selectionList", function(difference) {
67883       if (difference) {
67884         section.reRender();
67885       }
67886     });
67887     section.entityIDs = function(val) {
67888       if (!arguments.length)
67889         return _selectedIDs;
67890       _selectedIDs = val;
67891       return section;
67892     };
67893     function selectEntity(d3_event, entity) {
67894       context.enter(modeSelect(context, [entity.id]));
67895     }
67896     function deselectEntity(d3_event, entity) {
67897       var selectedIDs = _selectedIDs.slice();
67898       var index = selectedIDs.indexOf(entity.id);
67899       if (index > -1) {
67900         selectedIDs.splice(index, 1);
67901         context.enter(modeSelect(context, selectedIDs));
67902       }
67903     }
67904     function renderDisclosureContent(selection2) {
67905       var list = selection2.selectAll(".feature-list").data([0]);
67906       list = list.enter().append("ul").attr("class", "feature-list").merge(list);
67907       var entities = _selectedIDs.map(function(id2) {
67908         return context.hasEntity(id2);
67909       }).filter(Boolean);
67910       var items = list.selectAll(".feature-list-item").data(entities, osmEntity.key);
67911       items.exit().remove();
67912       var enter = items.enter().append("li").attr("class", "feature-list-item").each(function(d2) {
67913         select_default2(this).on("mouseover", function() {
67914           utilHighlightEntities([d2.id], true, context);
67915         }).on("mouseout", function() {
67916           utilHighlightEntities([d2.id], false, context);
67917         });
67918       });
67919       var label = enter.append("button").attr("class", "label").on("click", selectEntity);
67920       label.append("span").attr("class", "entity-geom-icon").call(svgIcon("", "pre-text"));
67921       label.append("span").attr("class", "entity-type");
67922       label.append("span").attr("class", "entity-name");
67923       enter.append("button").attr("class", "close").attr("title", _t("icons.deselect")).on("click", deselectEntity).call(svgIcon("#iD-icon-close"));
67924       items = items.merge(enter);
67925       items.selectAll(".entity-geom-icon use").attr("href", function() {
67926         var entity = this.parentNode.parentNode.__data__;
67927         return "#iD-icon-" + entity.geometry(context.graph());
67928       });
67929       items.selectAll(".entity-type").text(function(entity) {
67930         return _mainPresetIndex.match(entity, context.graph()).name();
67931       });
67932       items.selectAll(".entity-name").text(function(d2) {
67933         var entity = context.entity(d2.id);
67934         return utilDisplayName(entity);
67935       });
67936     }
67937     return section;
67938   }
67939
67940   // modules/ui/entity_editor.js
67941   function uiEntityEditor(context) {
67942     var dispatch14 = dispatch_default("choose");
67943     var _state = "select";
67944     var _coalesceChanges = false;
67945     var _modified = false;
67946     var _base;
67947     var _entityIDs;
67948     var _activePresets = [];
67949     var _newFeature;
67950     var _sections;
67951     function entityEditor(selection2) {
67952       var combinedTags = utilCombinedTags(_entityIDs, context.graph());
67953       var header = selection2.selectAll(".header").data([0]);
67954       var headerEnter = header.enter().append("div").attr("class", "header fillL");
67955       var direction = _mainLocalizer.textDirection() === "rtl" ? "forward" : "backward";
67956       headerEnter.append("button").attr("class", "preset-reset preset-choose").attr("title", _t("inspector.back_tooltip")).call(svgIcon(`#iD-icon-${direction}`));
67957       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
67958         context.enter(modeBrowse(context));
67959       }).call(svgIcon(_modified ? "#iD-icon-apply" : "#iD-icon-close"));
67960       headerEnter.append("h2");
67961       header = header.merge(headerEnter);
67962       header.selectAll("h2").text("").call(_entityIDs.length === 1 ? _t.append("inspector.edit") : _t.append("inspector.edit_features"));
67963       header.selectAll(".preset-reset").on("click", function() {
67964         dispatch14.call("choose", this, _activePresets);
67965       });
67966       var body = selection2.selectAll(".inspector-body").data([0]);
67967       var bodyEnter = body.enter().append("div").attr("class", "entity-editor inspector-body sep-top");
67968       body = body.merge(bodyEnter);
67969       if (!_sections) {
67970         _sections = [
67971           uiSectionSelectionList(context),
67972           uiSectionFeatureType(context).on("choose", function(presets) {
67973             dispatch14.call("choose", this, presets);
67974           }),
67975           uiSectionEntityIssues(context),
67976           uiSectionPresetFields(context).on("change", changeTags).on("revert", revertTags),
67977           uiSectionRawTagEditor("raw-tag-editor", context).on("change", changeTags),
67978           uiSectionRawMemberEditor(context),
67979           uiSectionRawMembershipEditor(context)
67980         ];
67981       }
67982       _sections.forEach(function(section) {
67983         if (section.entityIDs) {
67984           section.entityIDs(_entityIDs);
67985         }
67986         if (section.presets) {
67987           section.presets(_activePresets);
67988         }
67989         if (section.tags) {
67990           section.tags(combinedTags);
67991         }
67992         if (section.state) {
67993           section.state(_state);
67994         }
67995         body.call(section.render);
67996       });
67997       context.history().on("change.entity-editor", historyChanged);
67998       function historyChanged(difference) {
67999         if (selection2.selectAll(".entity-editor").empty())
68000           return;
68001         if (_state === "hide")
68002           return;
68003         var significant = !difference || difference.didChange.properties || difference.didChange.addition || difference.didChange.deletion;
68004         if (!significant)
68005           return;
68006         _entityIDs = _entityIDs.filter(context.hasEntity);
68007         if (!_entityIDs.length)
68008           return;
68009         var priorActivePreset = _activePresets.length === 1 && _activePresets[0];
68010         loadActivePresets();
68011         var graph = context.graph();
68012         entityEditor.modified(_base !== graph);
68013         entityEditor(selection2);
68014         if (priorActivePreset && _activePresets.length === 1 && priorActivePreset !== _activePresets[0]) {
68015           context.container().selectAll(".entity-editor button.preset-reset .label").style("background-color", "#fff").transition().duration(750).style("background-color", null);
68016         }
68017       }
68018     }
68019     function changeTags(entityIDs, changed, onInput) {
68020       var actions = [];
68021       for (var i3 in entityIDs) {
68022         var entityID = entityIDs[i3];
68023         var entity = context.entity(entityID);
68024         var tags = Object.assign({}, entity.tags);
68025         if (typeof changed === "function") {
68026           tags = changed(tags);
68027         } else {
68028           for (var k2 in changed) {
68029             if (!k2)
68030               continue;
68031             var v2 = changed[k2];
68032             if (typeof v2 === "object") {
68033               tags[k2] = tags[v2.oldKey];
68034             } else if (v2 !== void 0 || tags.hasOwnProperty(k2)) {
68035               tags[k2] = v2;
68036             }
68037           }
68038         }
68039         if (!onInput) {
68040           tags = utilCleanTags(tags);
68041         }
68042         if (!(0, import_fast_deep_equal10.default)(entity.tags, tags)) {
68043           actions.push(actionChangeTags(entityID, tags));
68044         }
68045       }
68046       if (actions.length) {
68047         var combinedAction = function(graph) {
68048           actions.forEach(function(action) {
68049             graph = action(graph);
68050           });
68051           return graph;
68052         };
68053         var annotation = _t("operations.change_tags.annotation");
68054         if (_coalesceChanges) {
68055           context.overwrite(combinedAction, annotation);
68056         } else {
68057           context.perform(combinedAction, annotation);
68058           _coalesceChanges = !!onInput;
68059         }
68060       }
68061       if (!onInput) {
68062         context.validator().validate();
68063       }
68064     }
68065     function revertTags(keys2) {
68066       var actions = [];
68067       for (var i3 in _entityIDs) {
68068         var entityID = _entityIDs[i3];
68069         var original = context.graph().base().entities[entityID];
68070         var changed = {};
68071         for (var j3 in keys2) {
68072           var key = keys2[j3];
68073           changed[key] = original ? original.tags[key] : void 0;
68074         }
68075         var entity = context.entity(entityID);
68076         var tags = Object.assign({}, entity.tags);
68077         for (var k2 in changed) {
68078           if (!k2)
68079             continue;
68080           var v2 = changed[k2];
68081           if (v2 !== void 0 || tags.hasOwnProperty(k2)) {
68082             tags[k2] = v2;
68083           }
68084         }
68085         tags = utilCleanTags(tags);
68086         if (!(0, import_fast_deep_equal10.default)(entity.tags, tags)) {
68087           actions.push(actionChangeTags(entityID, tags));
68088         }
68089       }
68090       if (actions.length) {
68091         var combinedAction = function(graph) {
68092           actions.forEach(function(action) {
68093             graph = action(graph);
68094           });
68095           return graph;
68096         };
68097         var annotation = _t("operations.change_tags.annotation");
68098         if (_coalesceChanges) {
68099           context.overwrite(combinedAction, annotation);
68100         } else {
68101           context.perform(combinedAction, annotation);
68102           _coalesceChanges = false;
68103         }
68104       }
68105       context.validator().validate();
68106     }
68107     entityEditor.modified = function(val) {
68108       if (!arguments.length)
68109         return _modified;
68110       _modified = val;
68111       return entityEditor;
68112     };
68113     entityEditor.state = function(val) {
68114       if (!arguments.length)
68115         return _state;
68116       _state = val;
68117       return entityEditor;
68118     };
68119     entityEditor.entityIDs = function(val) {
68120       if (!arguments.length)
68121         return _entityIDs;
68122       _base = context.graph();
68123       _coalesceChanges = false;
68124       if (val && _entityIDs && utilArrayIdentical(_entityIDs, val))
68125         return entityEditor;
68126       _entityIDs = val;
68127       loadActivePresets(true);
68128       return entityEditor.modified(false);
68129     };
68130     entityEditor.newFeature = function(val) {
68131       if (!arguments.length)
68132         return _newFeature;
68133       _newFeature = val;
68134       return entityEditor;
68135     };
68136     function loadActivePresets(isForNewSelection) {
68137       var graph = context.graph();
68138       var counts = {};
68139       for (var i3 in _entityIDs) {
68140         var entity = graph.hasEntity(_entityIDs[i3]);
68141         if (!entity)
68142           return;
68143         var match = _mainPresetIndex.match(entity, graph);
68144         if (!counts[match.id])
68145           counts[match.id] = 0;
68146         counts[match.id] += 1;
68147       }
68148       var matches = Object.keys(counts).sort(function(p1, p2) {
68149         return counts[p2] - counts[p1];
68150       }).map(function(pID) {
68151         return _mainPresetIndex.item(pID);
68152       });
68153       if (!isForNewSelection) {
68154         var weakPreset = _activePresets.length === 1 && !_activePresets[0].isFallback() && Object.keys(_activePresets[0].addTags || {}).length === 0;
68155         if (weakPreset && matches.length === 1 && matches[0].isFallback())
68156           return;
68157       }
68158       entityEditor.presets(matches);
68159     }
68160     entityEditor.presets = function(val) {
68161       if (!arguments.length)
68162         return _activePresets;
68163       if (!utilArrayIdentical(val, _activePresets)) {
68164         _activePresets = val;
68165       }
68166       return entityEditor;
68167     };
68168     return utilRebind(entityEditor, dispatch14, "on");
68169   }
68170
68171   // modules/ui/feature_list.js
68172   var sexagesimal = __toESM(require_sexagesimal());
68173   function uiFeatureList(context) {
68174     var _geocodeResults;
68175     function featureList(selection2) {
68176       var header = selection2.append("div").attr("class", "header fillL");
68177       header.append("h2").call(_t.append("inspector.feature_list"));
68178       var searchWrap = selection2.append("div").attr("class", "search-header");
68179       searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
68180       var search = searchWrap.append("input").attr("placeholder", _t("inspector.search")).attr("type", "search").call(utilNoAuto).on("keypress", keypress).on("keydown", keydown).on("input", inputevent);
68181       var listWrap = selection2.append("div").attr("class", "inspector-body");
68182       var list = listWrap.append("div").attr("class", "feature-list");
68183       context.on("exit.feature-list", clearSearch);
68184       context.map().on("drawn.feature-list", mapDrawn);
68185       context.keybinding().on(uiCmd("\u2318F"), focusSearch);
68186       function focusSearch(d3_event) {
68187         var mode = context.mode() && context.mode().id;
68188         if (mode !== "browse")
68189           return;
68190         d3_event.preventDefault();
68191         search.node().focus();
68192       }
68193       function keydown(d3_event) {
68194         if (d3_event.keyCode === 27) {
68195           search.node().blur();
68196         }
68197       }
68198       function keypress(d3_event) {
68199         var q2 = search.property("value"), items = list.selectAll(".feature-list-item");
68200         if (d3_event.keyCode === 13 && // ↩ Return
68201         q2.length && items.size()) {
68202           click(d3_event, items.datum());
68203         }
68204       }
68205       function inputevent() {
68206         _geocodeResults = void 0;
68207         drawList();
68208       }
68209       function clearSearch() {
68210         search.property("value", "");
68211         drawList();
68212       }
68213       function mapDrawn(e3) {
68214         if (e3.full) {
68215           drawList();
68216         }
68217       }
68218       function features() {
68219         var result = [];
68220         var graph = context.graph();
68221         var visibleCenter = context.map().extent().center();
68222         var q2 = search.property("value").toLowerCase();
68223         if (!q2)
68224           return result;
68225         var locationMatch = sexagesimal.pair(q2.toUpperCase()) || q2.match(/^(-?\d+\.?\d*)\s+(-?\d+\.?\d*)$/);
68226         if (locationMatch) {
68227           var loc = [Number(locationMatch[0]), Number(locationMatch[1])];
68228           result.push({
68229             id: -1,
68230             geometry: "point",
68231             type: _t("inspector.location"),
68232             name: dmsCoordinatePair([loc[1], loc[0]]),
68233             location: loc
68234           });
68235         }
68236         var idMatch = !locationMatch && q2.match(/(?:^|\W)(node|way|relation|[nwr])\W{0,2}0*([1-9]\d*)(?:\W|$)/i);
68237         if (idMatch) {
68238           var elemType = idMatch[1].charAt(0);
68239           var elemId = idMatch[2];
68240           result.push({
68241             id: elemType + elemId,
68242             geometry: elemType === "n" ? "point" : elemType === "w" ? "line" : "relation",
68243             type: elemType === "n" ? _t("inspector.node") : elemType === "w" ? _t("inspector.way") : _t("inspector.relation"),
68244             name: elemId
68245           });
68246         }
68247         var allEntities = graph.entities;
68248         var localResults = [];
68249         for (var id2 in allEntities) {
68250           var entity = allEntities[id2];
68251           if (!entity)
68252             continue;
68253           var name = utilDisplayName(entity) || "";
68254           if (name.toLowerCase().indexOf(q2) < 0)
68255             continue;
68256           var matched = _mainPresetIndex.match(entity, graph);
68257           var type2 = matched && matched.name() || utilDisplayType(entity.id);
68258           var extent = entity.extent(graph);
68259           var distance = extent ? geoSphericalDistance(visibleCenter, extent.center()) : 0;
68260           localResults.push({
68261             id: entity.id,
68262             entity,
68263             geometry: entity.geometry(graph),
68264             type: type2,
68265             name,
68266             distance
68267           });
68268           if (localResults.length > 100)
68269             break;
68270         }
68271         localResults = localResults.sort(function byDistance(a2, b2) {
68272           return a2.distance - b2.distance;
68273         });
68274         result = result.concat(localResults);
68275         (_geocodeResults || []).forEach(function(d2) {
68276           if (d2.osm_type && d2.osm_id) {
68277             var id3 = osmEntity.id.fromOSM(d2.osm_type, d2.osm_id);
68278             var tags = {};
68279             tags[d2.class] = d2.type;
68280             var attrs = { id: id3, type: d2.osm_type, tags };
68281             if (d2.osm_type === "way") {
68282               attrs.nodes = ["a", "a"];
68283             }
68284             var tempEntity = osmEntity(attrs);
68285             var tempGraph = coreGraph([tempEntity]);
68286             var matched2 = _mainPresetIndex.match(tempEntity, tempGraph);
68287             var type3 = matched2 && matched2.name() || utilDisplayType(id3);
68288             result.push({
68289               id: tempEntity.id,
68290               geometry: tempEntity.geometry(tempGraph),
68291               type: type3,
68292               name: d2.display_name,
68293               extent: new geoExtent(
68294                 [Number(d2.boundingbox[3]), Number(d2.boundingbox[0])],
68295                 [Number(d2.boundingbox[2]), Number(d2.boundingbox[1])]
68296               )
68297             });
68298           }
68299         });
68300         if (q2.match(/^[0-9]+$/)) {
68301           result.push({
68302             id: "n" + q2,
68303             geometry: "point",
68304             type: _t("inspector.node"),
68305             name: q2
68306           });
68307           result.push({
68308             id: "w" + q2,
68309             geometry: "line",
68310             type: _t("inspector.way"),
68311             name: q2
68312           });
68313           result.push({
68314             id: "r" + q2,
68315             geometry: "relation",
68316             type: _t("inspector.relation"),
68317             name: q2
68318           });
68319         }
68320         return result;
68321       }
68322       function drawList() {
68323         var value = search.property("value");
68324         var results = features();
68325         list.classed("filtered", value.length);
68326         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"));
68327         resultsIndicator.append("span").attr("class", "entity-name");
68328         list.selectAll(".no-results-item .entity-name").html("").call(_t.append("geocoder.no_results_worldwide"));
68329         if (services.geocoder) {
68330           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"));
68331         }
68332         list.selectAll(".no-results-item").style("display", value.length && !results.length ? "block" : "none");
68333         list.selectAll(".geocode-item").style("display", value && _geocodeResults === void 0 ? "block" : "none");
68334         list.selectAll(".feature-list-item").data([-1]).remove();
68335         var items = list.selectAll(".feature-list-item").data(results, function(d2) {
68336           return d2.id;
68337         });
68338         var enter = items.enter().insert("button", ".geocode-item").attr("class", "feature-list-item").on("mouseover", mouseover).on("mouseout", mouseout).on("click", click);
68339         var label = enter.append("div").attr("class", "label");
68340         label.each(function(d2) {
68341           select_default2(this).call(svgIcon("#iD-icon-" + d2.geometry, "pre-text"));
68342         });
68343         label.append("span").attr("class", "entity-type").text(function(d2) {
68344           return d2.type;
68345         });
68346         label.append("span").attr("class", "entity-name").text(function(d2) {
68347           return d2.name;
68348         });
68349         enter.style("opacity", 0).transition().style("opacity", 1);
68350         items.order();
68351         items.exit().remove();
68352       }
68353       function mouseover(d3_event, d2) {
68354         if (d2.id === -1)
68355           return;
68356         utilHighlightEntities([d2.id], true, context);
68357       }
68358       function mouseout(d3_event, d2) {
68359         if (d2.id === -1)
68360           return;
68361         utilHighlightEntities([d2.id], false, context);
68362       }
68363       function click(d3_event, d2) {
68364         d3_event.preventDefault();
68365         if (d2.location) {
68366           context.map().centerZoomEase([d2.location[1], d2.location[0]], 19);
68367         } else if (d2.entity) {
68368           utilHighlightEntities([d2.id], false, context);
68369           context.enter(modeSelect(context, [d2.entity.id]));
68370           context.map().zoomToEase(d2.entity);
68371         } else {
68372           context.zoomToEntity(d2.id);
68373         }
68374       }
68375       function geocoderSearch() {
68376         services.geocoder.search(search.property("value"), function(err, resp) {
68377           _geocodeResults = resp || [];
68378           drawList();
68379         });
68380       }
68381     }
68382     return featureList;
68383   }
68384
68385   // modules/ui/improveOSM_comments.js
68386   function uiImproveOsmComments() {
68387     let _qaItem;
68388     function issueComments(selection2) {
68389       let comments = selection2.selectAll(".comments-container").data([0]);
68390       comments = comments.enter().append("div").attr("class", "comments-container").merge(comments);
68391       services.improveOSM.getComments(_qaItem).then((d2) => {
68392         if (!d2.comments)
68393           return;
68394         const commentEnter = comments.selectAll(".comment").data(d2.comments).enter().append("div").attr("class", "comment");
68395         commentEnter.append("div").attr("class", "comment-avatar").call(svgIcon("#iD-icon-avatar", "comment-avatar-icon"));
68396         const mainEnter = commentEnter.append("div").attr("class", "comment-main");
68397         const metadataEnter = mainEnter.append("div").attr("class", "comment-metadata");
68398         metadataEnter.append("div").attr("class", "comment-author").each(function(d4) {
68399           const osm = services.osm;
68400           let selection3 = select_default2(this);
68401           if (osm && d4.username) {
68402             selection3 = selection3.append("a").attr("class", "comment-author-link").attr("href", osm.userURL(d4.username)).attr("target", "_blank");
68403           }
68404           selection3.text((d5) => d5.username);
68405         });
68406         metadataEnter.append("div").attr("class", "comment-date").html((d4) => _t.html("note.status.commented", { when: localeDateString2(d4.timestamp) }));
68407         mainEnter.append("div").attr("class", "comment-text").append("p").text((d4) => d4.text);
68408       }).catch((err) => {
68409         console.log(err);
68410       });
68411     }
68412     function localeDateString2(s2) {
68413       if (!s2)
68414         return null;
68415       const options2 = { day: "numeric", month: "short", year: "numeric" };
68416       const d2 = new Date(s2 * 1e3);
68417       if (isNaN(d2.getTime()))
68418         return null;
68419       return d2.toLocaleDateString(_mainLocalizer.localeCode(), options2);
68420     }
68421     issueComments.issue = function(val) {
68422       if (!arguments.length)
68423         return _qaItem;
68424       _qaItem = val;
68425       return issueComments;
68426     };
68427     return issueComments;
68428   }
68429
68430   // modules/ui/improveOSM_details.js
68431   function uiImproveOsmDetails(context) {
68432     let _qaItem;
68433     function issueDetail(d2) {
68434       if (d2.desc)
68435         return d2.desc;
68436       const issueKey = d2.issueKey;
68437       d2.replacements = d2.replacements || {};
68438       d2.replacements.default = { html: _t.html("inspector.unknown") };
68439       return _t.html(`QA.improveOSM.error_types.${issueKey}.description`, d2.replacements);
68440     }
68441     function improveOsmDetails(selection2) {
68442       const details = selection2.selectAll(".error-details").data(
68443         _qaItem ? [_qaItem] : [],
68444         (d2) => `${d2.id}-${d2.status || 0}`
68445       );
68446       details.exit().remove();
68447       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
68448       const descriptionEnter = detailsEnter.append("div").attr("class", "qa-details-subsection");
68449       descriptionEnter.append("h4").call(_t.append("QA.keepRight.detail_description"));
68450       descriptionEnter.append("div").attr("class", "qa-details-description-text").html(issueDetail);
68451       let relatedEntities = [];
68452       descriptionEnter.selectAll(".error_entity_link, .error_object_link").attr("href", "#").each(function() {
68453         const link2 = select_default2(this);
68454         const isObjectLink = link2.classed("error_object_link");
68455         const entityID = isObjectLink ? utilEntityRoot(_qaItem.objectType) + _qaItem.objectId : this.textContent;
68456         const entity = context.hasEntity(entityID);
68457         relatedEntities.push(entityID);
68458         link2.on("mouseenter", () => {
68459           utilHighlightEntities([entityID], true, context);
68460         }).on("mouseleave", () => {
68461           utilHighlightEntities([entityID], false, context);
68462         }).on("click", (d3_event) => {
68463           d3_event.preventDefault();
68464           utilHighlightEntities([entityID], false, context);
68465           const osmlayer = context.layers().layer("osm");
68466           if (!osmlayer.enabled()) {
68467             osmlayer.enabled(true);
68468           }
68469           context.map().centerZoom(_qaItem.loc, 20);
68470           if (entity) {
68471             context.enter(modeSelect(context, [entityID]));
68472           } else {
68473             context.loadEntity(entityID, (err, result) => {
68474               if (err)
68475                 return;
68476               const entity2 = result.data.find((e3) => e3.id === entityID);
68477               if (entity2)
68478                 context.enter(modeSelect(context, [entityID]));
68479             });
68480           }
68481         });
68482         if (entity) {
68483           let name = utilDisplayName(entity);
68484           if (!name && !isObjectLink) {
68485             const preset = _mainPresetIndex.match(entity, context.graph());
68486             name = preset && !preset.isFallback() && preset.name();
68487           }
68488           if (name) {
68489             this.innerText = name;
68490           }
68491         }
68492       });
68493       context.features().forceVisible(relatedEntities);
68494       context.map().pan([0, 0]);
68495     }
68496     improveOsmDetails.issue = function(val) {
68497       if (!arguments.length)
68498         return _qaItem;
68499       _qaItem = val;
68500       return improveOsmDetails;
68501     };
68502     return improveOsmDetails;
68503   }
68504
68505   // modules/ui/improveOSM_header.js
68506   function uiImproveOsmHeader() {
68507     let _qaItem;
68508     function issueTitle(d2) {
68509       const issueKey = d2.issueKey;
68510       d2.replacements = d2.replacements || {};
68511       d2.replacements.default = { html: _t.html("inspector.unknown") };
68512       return _t.html(`QA.improveOSM.error_types.${issueKey}.title`, d2.replacements);
68513     }
68514     function improveOsmHeader(selection2) {
68515       const header = selection2.selectAll(".qa-header").data(
68516         _qaItem ? [_qaItem] : [],
68517         (d2) => `${d2.id}-${d2.status || 0}`
68518       );
68519       header.exit().remove();
68520       const headerEnter = header.enter().append("div").attr("class", "qa-header");
68521       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}`);
68522       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");
68523       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 : "");
68524       headerEnter.append("div").attr("class", "qa-header-label").html(issueTitle);
68525     }
68526     improveOsmHeader.issue = function(val) {
68527       if (!arguments.length)
68528         return _qaItem;
68529       _qaItem = val;
68530       return improveOsmHeader;
68531     };
68532     return improveOsmHeader;
68533   }
68534
68535   // modules/ui/improveOSM_editor.js
68536   function uiImproveOsmEditor(context) {
68537     const dispatch14 = dispatch_default("change");
68538     const qaDetails = uiImproveOsmDetails(context);
68539     const qaComments = uiImproveOsmComments(context);
68540     const qaHeader = uiImproveOsmHeader(context);
68541     let _qaItem;
68542     function improveOsmEditor(selection2) {
68543       const headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
68544       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
68545       headerEnter.append("h2").call(_t.append("QA.improveOSM.title"));
68546       let body = selection2.selectAll(".body").data([0]);
68547       body = body.enter().append("div").attr("class", "body").merge(body);
68548       const editor = body.selectAll(".qa-editor").data([0]);
68549       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);
68550     }
68551     function improveOsmSaveSection(selection2) {
68552       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
68553       const isShown = _qaItem && (isSelected || _qaItem.newComment || _qaItem.comment);
68554       let saveSection = selection2.selectAll(".qa-save").data(
68555         isShown ? [_qaItem] : [],
68556         (d2) => `${d2.id}-${d2.status || 0}`
68557       );
68558       saveSection.exit().remove();
68559       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
68560       saveSectionEnter.append("h4").attr("class", ".qa-save-header").call(_t.append("note.newComment"));
68561       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);
68562       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
68563       function changeInput() {
68564         const input = select_default2(this);
68565         let val = input.property("value").trim();
68566         if (val === "") {
68567           val = void 0;
68568         }
68569         _qaItem = _qaItem.update({ newComment: val });
68570         const qaService = services.improveOSM;
68571         if (qaService) {
68572           qaService.replaceItem(_qaItem);
68573         }
68574         saveSection.call(qaSaveButtons);
68575       }
68576     }
68577     function qaSaveButtons(selection2) {
68578       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
68579       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d2) => d2.status + d2.id);
68580       buttonSection.exit().remove();
68581       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
68582       buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("QA.keepRight.save_comment"));
68583       buttonEnter.append("button").attr("class", "button close-button action");
68584       buttonEnter.append("button").attr("class", "button ignore-button action");
68585       buttonSection = buttonSection.merge(buttonEnter);
68586       buttonSection.select(".comment-button").attr("disabled", (d2) => d2.newComment ? null : true).on("click.comment", function(d3_event, d2) {
68587         this.blur();
68588         const qaService = services.improveOSM;
68589         if (qaService) {
68590           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
68591         }
68592       });
68593       buttonSection.select(".close-button").html((d2) => {
68594         const andComment = d2.newComment ? "_comment" : "";
68595         return _t.html(`QA.keepRight.close${andComment}`);
68596       }).on("click.close", function(d3_event, d2) {
68597         this.blur();
68598         const qaService = services.improveOSM;
68599         if (qaService) {
68600           d2.newStatus = "SOLVED";
68601           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
68602         }
68603       });
68604       buttonSection.select(".ignore-button").html((d2) => {
68605         const andComment = d2.newComment ? "_comment" : "";
68606         return _t.html(`QA.keepRight.ignore${andComment}`);
68607       }).on("click.ignore", function(d3_event, d2) {
68608         this.blur();
68609         const qaService = services.improveOSM;
68610         if (qaService) {
68611           d2.newStatus = "INVALID";
68612           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
68613         }
68614       });
68615     }
68616     improveOsmEditor.error = function(val) {
68617       if (!arguments.length)
68618         return _qaItem;
68619       _qaItem = val;
68620       return improveOsmEditor;
68621     };
68622     return utilRebind(improveOsmEditor, dispatch14, "on");
68623   }
68624
68625   // modules/ui/preset_list.js
68626   function uiPresetList(context) {
68627     var dispatch14 = dispatch_default("cancel", "choose");
68628     var _entityIDs;
68629     var _currLoc;
68630     var _currentPresets;
68631     var _autofocus = false;
68632     function presetList(selection2) {
68633       if (!_entityIDs)
68634         return;
68635       var presets = _mainPresetIndex.matchAllGeometry(entityGeometries());
68636       selection2.html("");
68637       var messagewrap = selection2.append("div").attr("class", "header fillL");
68638       var message = messagewrap.append("h2").call(_t.append("inspector.choose"));
68639       var direction = _mainLocalizer.textDirection() === "rtl" ? "backward" : "forward";
68640       messagewrap.append("button").attr("class", "preset-choose").attr("title", _entityIDs.length === 1 ? _t("inspector.edit") : _t("inspector.edit_features")).on("click", function() {
68641         dispatch14.call("cancel", this);
68642       }).call(svgIcon(`#iD-icon-${direction}`));
68643       function initialKeydown(d3_event) {
68644         if (search.property("value").length === 0 && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
68645           d3_event.preventDefault();
68646           d3_event.stopPropagation();
68647           operationDelete(context, _entityIDs)();
68648         } else if (search.property("value").length === 0 && (d3_event.ctrlKey || d3_event.metaKey) && d3_event.keyCode === utilKeybinding.keyCodes.z) {
68649           d3_event.preventDefault();
68650           d3_event.stopPropagation();
68651           context.undo();
68652         } else if (!d3_event.ctrlKey && !d3_event.metaKey) {
68653           select_default2(this).on("keydown", keydown);
68654           keydown.call(this, d3_event);
68655         }
68656       }
68657       function keydown(d3_event) {
68658         if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"] && // if insertion point is at the end of the string
68659         search.node().selectionStart === search.property("value").length) {
68660           d3_event.preventDefault();
68661           d3_event.stopPropagation();
68662           var buttons = list.selectAll(".preset-list-button");
68663           if (!buttons.empty())
68664             buttons.nodes()[0].focus();
68665         }
68666       }
68667       function keypress(d3_event) {
68668         var value = search.property("value");
68669         if (d3_event.keyCode === 13 && // ↩ Return
68670         value.length) {
68671           list.selectAll(".preset-list-item:first-child").each(function(d2) {
68672             d2.choose.call(this);
68673           });
68674         }
68675       }
68676       function inputevent() {
68677         var value = search.property("value");
68678         list.classed("filtered", value.length);
68679         var results, messageText;
68680         if (value.length) {
68681           results = presets.search(value, entityGeometries()[0], _currLoc);
68682           messageText = _t.html("inspector.results", {
68683             n: results.collection.length,
68684             search: value
68685           });
68686         } else {
68687           var entityPresets2 = _entityIDs.map((entityID) => _mainPresetIndex.match(context.graph().entity(entityID), context.graph()));
68688           results = _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets2);
68689           messageText = _t.html("inspector.choose");
68690         }
68691         list.call(drawList, results);
68692         message.html(messageText);
68693       }
68694       var searchWrap = selection2.append("div").attr("class", "search-header");
68695       searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
68696       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));
68697       if (_autofocus) {
68698         search.node().focus();
68699         setTimeout(function() {
68700           search.node().focus();
68701         }, 0);
68702       }
68703       var listWrap = selection2.append("div").attr("class", "inspector-body");
68704       var entityPresets = _entityIDs.map((entityID) => _mainPresetIndex.match(context.graph().entity(entityID), context.graph()));
68705       var list = listWrap.append("div").attr("class", "preset-list").call(drawList, _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets));
68706       context.features().on("change.preset-list", updateForFeatureHiddenState);
68707     }
68708     function drawList(list, presets) {
68709       presets = presets.matchAllGeometry(entityGeometries());
68710       var collection = presets.collection.reduce(function(collection2, preset) {
68711         if (!preset)
68712           return collection2;
68713         if (preset.members) {
68714           if (preset.members.collection.filter(function(preset2) {
68715             return preset2.addable();
68716           }).length > 1) {
68717             collection2.push(CategoryItem(preset));
68718           }
68719         } else if (preset.addable()) {
68720           collection2.push(PresetItem(preset));
68721         }
68722         return collection2;
68723       }, []);
68724       var items = list.selectAll(".preset-list-item").data(collection, function(d2) {
68725         return d2.preset.id;
68726       });
68727       items.order();
68728       items.exit().remove();
68729       items.enter().append("div").attr("class", function(item) {
68730         return "preset-list-item preset-" + item.preset.id.replace("/", "-");
68731       }).classed("current", function(item) {
68732         return _currentPresets.indexOf(item.preset) !== -1;
68733       }).each(function(item) {
68734         select_default2(this).call(item);
68735       }).style("opacity", 0).transition().style("opacity", 1);
68736       updateForFeatureHiddenState();
68737     }
68738     function itemKeydown(d3_event) {
68739       var item = select_default2(this.closest(".preset-list-item"));
68740       var parentItem = select_default2(item.node().parentNode.closest(".preset-list-item"));
68741       if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"]) {
68742         d3_event.preventDefault();
68743         d3_event.stopPropagation();
68744         var nextItem = select_default2(item.node().nextElementSibling);
68745         if (nextItem.empty()) {
68746           if (!parentItem.empty()) {
68747             nextItem = select_default2(parentItem.node().nextElementSibling);
68748           }
68749         } else if (select_default2(this).classed("expanded")) {
68750           nextItem = item.select(".subgrid .preset-list-item:first-child");
68751         }
68752         if (!nextItem.empty()) {
68753           nextItem.select(".preset-list-button").node().focus();
68754         }
68755       } else if (d3_event.keyCode === utilKeybinding.keyCodes["\u2191"]) {
68756         d3_event.preventDefault();
68757         d3_event.stopPropagation();
68758         var previousItem = select_default2(item.node().previousElementSibling);
68759         if (previousItem.empty()) {
68760           if (!parentItem.empty()) {
68761             previousItem = parentItem;
68762           }
68763         } else if (previousItem.select(".preset-list-button").classed("expanded")) {
68764           previousItem = previousItem.select(".subgrid .preset-list-item:last-child");
68765         }
68766         if (!previousItem.empty()) {
68767           previousItem.select(".preset-list-button").node().focus();
68768         } else {
68769           var search = select_default2(this.closest(".preset-list-pane")).select(".preset-search-input");
68770           search.node().focus();
68771         }
68772       } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
68773         d3_event.preventDefault();
68774         d3_event.stopPropagation();
68775         if (!parentItem.empty()) {
68776           parentItem.select(".preset-list-button").node().focus();
68777         }
68778       } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
68779         d3_event.preventDefault();
68780         d3_event.stopPropagation();
68781         item.datum().choose.call(select_default2(this).node());
68782       }
68783     }
68784     function CategoryItem(preset) {
68785       var box, sublist, shown = false;
68786       function item(selection2) {
68787         var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap category");
68788         function click() {
68789           var isExpanded = select_default2(this).classed("expanded");
68790           var iconName = isExpanded ? _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward" : "#iD-icon-down";
68791           select_default2(this).classed("expanded", !isExpanded).attr("title", !isExpanded ? _t("icons.collapse") : _t("icons.expand"));
68792           select_default2(this).selectAll("div.label-inner svg.icon use").attr("href", iconName);
68793           item.choose();
68794         }
68795         var geometries = entityGeometries();
68796         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) {
68797           if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
68798             d3_event.preventDefault();
68799             d3_event.stopPropagation();
68800             if (!select_default2(this).classed("expanded")) {
68801               click.call(this, d3_event);
68802             }
68803           } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
68804             d3_event.preventDefault();
68805             d3_event.stopPropagation();
68806             if (select_default2(this).classed("expanded")) {
68807               click.call(this, d3_event);
68808             }
68809           } else {
68810             itemKeydown.call(this, d3_event);
68811           }
68812         });
68813         var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
68814         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");
68815         box = selection2.append("div").attr("class", "subgrid").style("max-height", "0px").style("opacity", 0);
68816         box.append("div").attr("class", "arrow");
68817         sublist = box.append("div").attr("class", "preset-list fillL3");
68818       }
68819       item.choose = function() {
68820         if (!box || !sublist)
68821           return;
68822         if (shown) {
68823           shown = false;
68824           box.transition().duration(200).style("opacity", "0").style("max-height", "0px").style("padding-bottom", "0px");
68825         } else {
68826           shown = true;
68827           var members = preset.members.matchAllGeometry(entityGeometries());
68828           sublist.call(drawList, members);
68829           box.transition().duration(200).style("opacity", "1").style("max-height", 200 + members.collection.length * 190 + "px").style("padding-bottom", "10px");
68830         }
68831       };
68832       item.preset = preset;
68833       return item;
68834     }
68835     function PresetItem(preset) {
68836       function item(selection2) {
68837         var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap");
68838         var geometries = entityGeometries();
68839         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);
68840         var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
68841         var nameparts = [
68842           preset.nameLabel(),
68843           preset.subtitleLabel()
68844         ].filter(Boolean);
68845         label.selectAll(".namepart").data(nameparts, (d2) => d2.stringId).enter().append("div").attr("class", "namepart").text("").each(function(d2) {
68846           d2(select_default2(this));
68847         });
68848         wrap2.call(item.reference.button);
68849         selection2.call(item.reference.body);
68850       }
68851       item.choose = function() {
68852         if (select_default2(this).classed("disabled"))
68853           return;
68854         if (!context.inIntro()) {
68855           _mainPresetIndex.setMostRecent(preset, entityGeometries()[0]);
68856         }
68857         context.perform(
68858           function(graph) {
68859             for (var i3 in _entityIDs) {
68860               var entityID = _entityIDs[i3];
68861               var oldPreset = _mainPresetIndex.match(graph.entity(entityID), graph);
68862               graph = actionChangePreset(entityID, oldPreset, preset)(graph);
68863             }
68864             return graph;
68865           },
68866           _t("operations.change_tags.annotation")
68867         );
68868         context.validator().validate();
68869         dispatch14.call("choose", this, preset);
68870       };
68871       item.help = function(d3_event) {
68872         d3_event.stopPropagation();
68873         item.reference.toggle();
68874       };
68875       item.preset = preset;
68876       item.reference = uiTagReference(preset.reference(), context);
68877       return item;
68878     }
68879     function updateForFeatureHiddenState() {
68880       if (!_entityIDs.every(context.hasEntity))
68881         return;
68882       var geometries = entityGeometries();
68883       var button = context.container().selectAll(".preset-list .preset-list-button");
68884       button.call(uiTooltip().destroyAny);
68885       button.each(function(item, index) {
68886         var hiddenPresetFeaturesId;
68887         for (var i3 in geometries) {
68888           hiddenPresetFeaturesId = context.features().isHiddenPreset(item.preset, geometries[i3]);
68889           if (hiddenPresetFeaturesId)
68890             break;
68891         }
68892         var isHiddenPreset = !context.inIntro() && !!hiddenPresetFeaturesId && (_currentPresets.length !== 1 || item.preset !== _currentPresets[0]);
68893         select_default2(this).classed("disabled", isHiddenPreset);
68894         if (isHiddenPreset) {
68895           var isAutoHidden = context.features().autoHidden(hiddenPresetFeaturesId);
68896           select_default2(this).call(
68897             uiTooltip().title(() => _t.append("inspector.hidden_preset." + (isAutoHidden ? "zoom" : "manual"), {
68898               features: _t("feature." + hiddenPresetFeaturesId + ".description")
68899             })).placement(index < 2 ? "bottom" : "top")
68900           );
68901         }
68902       });
68903     }
68904     presetList.autofocus = function(val) {
68905       if (!arguments.length)
68906         return _autofocus;
68907       _autofocus = val;
68908       return presetList;
68909     };
68910     presetList.entityIDs = function(val) {
68911       if (!arguments.length)
68912         return _entityIDs;
68913       _entityIDs = val;
68914       _currLoc = null;
68915       if (_entityIDs && _entityIDs.length) {
68916         const extent = _entityIDs.reduce(function(extent2, entityID) {
68917           var entity = context.graph().entity(entityID);
68918           return extent2.extend(entity.extent(context.graph()));
68919         }, geoExtent());
68920         _currLoc = extent.center();
68921         var presets = _entityIDs.map(function(entityID) {
68922           return _mainPresetIndex.match(context.entity(entityID), context.graph());
68923         });
68924         presetList.presets(presets);
68925       }
68926       return presetList;
68927     };
68928     presetList.presets = function(val) {
68929       if (!arguments.length)
68930         return _currentPresets;
68931       _currentPresets = val;
68932       return presetList;
68933     };
68934     function entityGeometries() {
68935       var counts = {};
68936       for (var i3 in _entityIDs) {
68937         var entityID = _entityIDs[i3];
68938         var entity = context.entity(entityID);
68939         var geometry = entity.geometry(context.graph());
68940         if (geometry === "vertex" && entity.isOnAddressLine(context.graph())) {
68941           geometry = "point";
68942         }
68943         if (!counts[geometry])
68944           counts[geometry] = 0;
68945         counts[geometry] += 1;
68946       }
68947       return Object.keys(counts).sort(function(geom1, geom2) {
68948         return counts[geom2] - counts[geom1];
68949       });
68950     }
68951     return utilRebind(presetList, dispatch14, "on");
68952   }
68953
68954   // modules/ui/view_on_osm.js
68955   function uiViewOnOSM(context) {
68956     var _what;
68957     function viewOnOSM(selection2) {
68958       var url;
68959       if (_what instanceof osmEntity) {
68960         url = context.connection().entityURL(_what);
68961       } else if (_what instanceof osmNote) {
68962         url = context.connection().noteURL(_what);
68963       }
68964       var data = !_what || _what.isNew() ? [] : [_what];
68965       var link2 = selection2.selectAll(".view-on-osm").data(data, function(d2) {
68966         return d2.id;
68967       });
68968       link2.exit().remove();
68969       var linkEnter = link2.enter().append("a").attr("class", "view-on-osm").attr("target", "_blank").attr("href", url).call(svgIcon("#iD-icon-out-link", "inline"));
68970       linkEnter.append("span").call(_t.append("inspector.view_on_osm"));
68971     }
68972     viewOnOSM.what = function(_2) {
68973       if (!arguments.length)
68974         return _what;
68975       _what = _2;
68976       return viewOnOSM;
68977     };
68978     return viewOnOSM;
68979   }
68980
68981   // modules/ui/inspector.js
68982   function uiInspector(context) {
68983     var presetList = uiPresetList(context);
68984     var entityEditor = uiEntityEditor(context);
68985     var wrap2 = select_default2(null), presetPane = select_default2(null), editorPane = select_default2(null);
68986     var _state = "select";
68987     var _entityIDs;
68988     var _newFeature = false;
68989     function inspector(selection2) {
68990       presetList.entityIDs(_entityIDs).autofocus(_newFeature).on("choose", inspector.setPreset).on("cancel", function() {
68991         inspector.setPreset();
68992       });
68993       entityEditor.state(_state).entityIDs(_entityIDs).on("choose", inspector.showList);
68994       wrap2 = selection2.selectAll(".panewrap").data([0]);
68995       var enter = wrap2.enter().append("div").attr("class", "panewrap");
68996       enter.append("div").attr("class", "preset-list-pane pane");
68997       enter.append("div").attr("class", "entity-editor-pane pane");
68998       wrap2 = wrap2.merge(enter);
68999       presetPane = wrap2.selectAll(".preset-list-pane");
69000       editorPane = wrap2.selectAll(".entity-editor-pane");
69001       function shouldDefaultToPresetList() {
69002         if (_state !== "select")
69003           return false;
69004         if (_entityIDs.length !== 1)
69005           return false;
69006         var entityID = _entityIDs[0];
69007         var entity = context.hasEntity(entityID);
69008         if (!entity)
69009           return false;
69010         if (entity.hasNonGeometryTags())
69011           return false;
69012         if (_newFeature)
69013           return true;
69014         if (entity.geometry(context.graph()) !== "vertex")
69015           return false;
69016         if (context.graph().parentRelations(entity).length)
69017           return false;
69018         if (context.validator().getEntityIssues(entityID).length)
69019           return false;
69020         if (entity.isHighwayIntersection(context.graph()))
69021           return false;
69022         return true;
69023       }
69024       if (shouldDefaultToPresetList()) {
69025         wrap2.style("right", "-100%");
69026         editorPane.classed("hide", true);
69027         presetPane.classed("hide", false).call(presetList);
69028       } else {
69029         wrap2.style("right", "0%");
69030         presetPane.classed("hide", true);
69031         editorPane.classed("hide", false).call(entityEditor);
69032       }
69033       var footer = selection2.selectAll(".footer").data([0]);
69034       footer = footer.enter().append("div").attr("class", "footer").merge(footer);
69035       footer.call(
69036         uiViewOnOSM(context).what(context.hasEntity(_entityIDs.length === 1 && _entityIDs[0]))
69037       );
69038     }
69039     inspector.showList = function(presets) {
69040       presetPane.classed("hide", false);
69041       wrap2.transition().styleTween("right", function() {
69042         return value_default("0%", "-100%");
69043       }).on("end", function() {
69044         editorPane.classed("hide", true);
69045       });
69046       if (presets) {
69047         presetList.presets(presets);
69048       }
69049       presetPane.call(presetList.autofocus(true));
69050     };
69051     inspector.setPreset = function(preset) {
69052       if (preset && preset.id === "type/multipolygon") {
69053         presetPane.call(presetList.autofocus(true));
69054       } else {
69055         editorPane.classed("hide", false);
69056         wrap2.transition().styleTween("right", function() {
69057           return value_default("-100%", "0%");
69058         }).on("end", function() {
69059           presetPane.classed("hide", true);
69060         });
69061         if (preset) {
69062           entityEditor.presets([preset]);
69063         }
69064         editorPane.call(entityEditor);
69065       }
69066     };
69067     inspector.state = function(val) {
69068       if (!arguments.length)
69069         return _state;
69070       _state = val;
69071       entityEditor.state(_state);
69072       context.container().selectAll(".field-help-body").remove();
69073       return inspector;
69074     };
69075     inspector.entityIDs = function(val) {
69076       if (!arguments.length)
69077         return _entityIDs;
69078       _entityIDs = val;
69079       return inspector;
69080     };
69081     inspector.newFeature = function(val) {
69082       if (!arguments.length)
69083         return _newFeature;
69084       _newFeature = val;
69085       return inspector;
69086     };
69087     return inspector;
69088   }
69089
69090   // modules/ui/keepRight_details.js
69091   function uiKeepRightDetails(context) {
69092     let _qaItem;
69093     function issueDetail(d2) {
69094       const { itemType, parentIssueType } = d2;
69095       const unknown = { html: _t.html("inspector.unknown") };
69096       let replacements = d2.replacements || {};
69097       replacements.default = unknown;
69098       if (_mainLocalizer.hasTextForStringId(`QA.keepRight.errorTypes.${itemType}.title`)) {
69099         return _t.html(`QA.keepRight.errorTypes.${itemType}.description`, replacements);
69100       } else {
69101         return _t.html(`QA.keepRight.errorTypes.${parentIssueType}.description`, replacements);
69102       }
69103     }
69104     function keepRightDetails(selection2) {
69105       const details = selection2.selectAll(".error-details").data(
69106         _qaItem ? [_qaItem] : [],
69107         (d2) => `${d2.id}-${d2.status || 0}`
69108       );
69109       details.exit().remove();
69110       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
69111       const descriptionEnter = detailsEnter.append("div").attr("class", "qa-details-subsection");
69112       descriptionEnter.append("h4").call(_t.append("QA.keepRight.detail_description"));
69113       descriptionEnter.append("div").attr("class", "qa-details-description-text").html(issueDetail);
69114       let relatedEntities = [];
69115       descriptionEnter.selectAll(".error_entity_link, .error_object_link").attr("href", "#").each(function() {
69116         const link2 = select_default2(this);
69117         const isObjectLink = link2.classed("error_object_link");
69118         const entityID = isObjectLink ? utilEntityRoot(_qaItem.objectType) + _qaItem.objectId : this.textContent;
69119         const entity = context.hasEntity(entityID);
69120         relatedEntities.push(entityID);
69121         link2.on("mouseenter", () => {
69122           utilHighlightEntities([entityID], true, context);
69123         }).on("mouseleave", () => {
69124           utilHighlightEntities([entityID], false, context);
69125         }).on("click", (d3_event) => {
69126           d3_event.preventDefault();
69127           utilHighlightEntities([entityID], false, context);
69128           const osmlayer = context.layers().layer("osm");
69129           if (!osmlayer.enabled()) {
69130             osmlayer.enabled(true);
69131           }
69132           context.map().centerZoomEase(_qaItem.loc, 20);
69133           if (entity) {
69134             context.enter(modeSelect(context, [entityID]));
69135           } else {
69136             context.loadEntity(entityID, (err, result) => {
69137               if (err)
69138                 return;
69139               const entity2 = result.data.find((e3) => e3.id === entityID);
69140               if (entity2)
69141                 context.enter(modeSelect(context, [entityID]));
69142             });
69143           }
69144         });
69145         if (entity) {
69146           let name = utilDisplayName(entity);
69147           if (!name && !isObjectLink) {
69148             const preset = _mainPresetIndex.match(entity, context.graph());
69149             name = preset && !preset.isFallback() && preset.name();
69150           }
69151           if (name) {
69152             this.innerText = name;
69153           }
69154         }
69155       });
69156       context.features().forceVisible(relatedEntities);
69157       context.map().pan([0, 0]);
69158     }
69159     keepRightDetails.issue = function(val) {
69160       if (!arguments.length)
69161         return _qaItem;
69162       _qaItem = val;
69163       return keepRightDetails;
69164     };
69165     return keepRightDetails;
69166   }
69167
69168   // modules/ui/keepRight_header.js
69169   function uiKeepRightHeader() {
69170     let _qaItem;
69171     function issueTitle(d2) {
69172       const { itemType, parentIssueType } = d2;
69173       const unknown = _t.html("inspector.unknown");
69174       let replacements = d2.replacements || {};
69175       replacements.default = { html: unknown };
69176       if (_mainLocalizer.hasTextForStringId(`QA.keepRight.errorTypes.${itemType}.title`)) {
69177         return _t.html(`QA.keepRight.errorTypes.${itemType}.title`, replacements);
69178       } else {
69179         return _t.html(`QA.keepRight.errorTypes.${parentIssueType}.title`, replacements);
69180       }
69181     }
69182     function keepRightHeader(selection2) {
69183       const header = selection2.selectAll(".qa-header").data(
69184         _qaItem ? [_qaItem] : [],
69185         (d2) => `${d2.id}-${d2.status || 0}`
69186       );
69187       header.exit().remove();
69188       const headerEnter = header.enter().append("div").attr("class", "qa-header");
69189       const iconEnter = headerEnter.append("div").attr("class", "qa-header-icon").classed("new", (d2) => d2.id < 0);
69190       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"));
69191       headerEnter.append("div").attr("class", "qa-header-label").html(issueTitle);
69192     }
69193     keepRightHeader.issue = function(val) {
69194       if (!arguments.length)
69195         return _qaItem;
69196       _qaItem = val;
69197       return keepRightHeader;
69198     };
69199     return keepRightHeader;
69200   }
69201
69202   // modules/ui/view_on_keepRight.js
69203   function uiViewOnKeepRight() {
69204     let _qaItem;
69205     function viewOnKeepRight(selection2) {
69206       let url;
69207       if (services.keepRight && _qaItem instanceof QAItem) {
69208         url = services.keepRight.issueURL(_qaItem);
69209       }
69210       const link2 = selection2.selectAll(".view-on-keepRight").data(url ? [url] : []);
69211       link2.exit().remove();
69212       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"));
69213       linkEnter.append("span").call(_t.append("inspector.view_on_keepRight"));
69214     }
69215     viewOnKeepRight.what = function(val) {
69216       if (!arguments.length)
69217         return _qaItem;
69218       _qaItem = val;
69219       return viewOnKeepRight;
69220     };
69221     return viewOnKeepRight;
69222   }
69223
69224   // modules/ui/keepRight_editor.js
69225   function uiKeepRightEditor(context) {
69226     const dispatch14 = dispatch_default("change");
69227     const qaDetails = uiKeepRightDetails(context);
69228     const qaHeader = uiKeepRightHeader(context);
69229     let _qaItem;
69230     function keepRightEditor(selection2) {
69231       const headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
69232       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
69233       headerEnter.append("h2").call(_t.append("QA.keepRight.title"));
69234       let body = selection2.selectAll(".body").data([0]);
69235       body = body.enter().append("div").attr("class", "body").merge(body);
69236       const editor = body.selectAll(".qa-editor").data([0]);
69237       editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(keepRightSaveSection);
69238       const footer = selection2.selectAll(".footer").data([0]);
69239       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnKeepRight(context).what(_qaItem));
69240     }
69241     function keepRightSaveSection(selection2) {
69242       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
69243       const isShown = _qaItem && (isSelected || _qaItem.newComment || _qaItem.comment);
69244       let saveSection = selection2.selectAll(".qa-save").data(
69245         isShown ? [_qaItem] : [],
69246         (d2) => `${d2.id}-${d2.status || 0}`
69247       );
69248       saveSection.exit().remove();
69249       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
69250       saveSectionEnter.append("h4").attr("class", ".qa-save-header").call(_t.append("QA.keepRight.comment"));
69251       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);
69252       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
69253       function changeInput() {
69254         const input = select_default2(this);
69255         let val = input.property("value").trim();
69256         if (val === _qaItem.comment) {
69257           val = void 0;
69258         }
69259         _qaItem = _qaItem.update({ newComment: val });
69260         const qaService = services.keepRight;
69261         if (qaService) {
69262           qaService.replaceItem(_qaItem);
69263         }
69264         saveSection.call(qaSaveButtons);
69265       }
69266     }
69267     function qaSaveButtons(selection2) {
69268       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
69269       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d2) => d2.status + d2.id);
69270       buttonSection.exit().remove();
69271       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
69272       buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("QA.keepRight.save_comment"));
69273       buttonEnter.append("button").attr("class", "button close-button action");
69274       buttonEnter.append("button").attr("class", "button ignore-button action");
69275       buttonSection = buttonSection.merge(buttonEnter);
69276       buttonSection.select(".comment-button").attr("disabled", (d2) => d2.newComment ? null : true).on("click.comment", function(d3_event, d2) {
69277         this.blur();
69278         const qaService = services.keepRight;
69279         if (qaService) {
69280           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
69281         }
69282       });
69283       buttonSection.select(".close-button").html((d2) => {
69284         const andComment = d2.newComment ? "_comment" : "";
69285         return _t.html(`QA.keepRight.close${andComment}`);
69286       }).on("click.close", function(d3_event, d2) {
69287         this.blur();
69288         const qaService = services.keepRight;
69289         if (qaService) {
69290           d2.newStatus = "ignore_t";
69291           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
69292         }
69293       });
69294       buttonSection.select(".ignore-button").html((d2) => {
69295         const andComment = d2.newComment ? "_comment" : "";
69296         return _t.html(`QA.keepRight.ignore${andComment}`);
69297       }).on("click.ignore", function(d3_event, d2) {
69298         this.blur();
69299         const qaService = services.keepRight;
69300         if (qaService) {
69301           d2.newStatus = "ignore";
69302           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
69303         }
69304       });
69305     }
69306     keepRightEditor.error = function(val) {
69307       if (!arguments.length)
69308         return _qaItem;
69309       _qaItem = val;
69310       return keepRightEditor;
69311     };
69312     return utilRebind(keepRightEditor, dispatch14, "on");
69313   }
69314
69315   // modules/ui/lasso.js
69316   function uiLasso(context) {
69317     var group, polygon2;
69318     lasso.coordinates = [];
69319     function lasso(selection2) {
69320       context.container().classed("lasso", true);
69321       group = selection2.append("g").attr("class", "lasso hide");
69322       polygon2 = group.append("path").attr("class", "lasso-path");
69323       group.call(uiToggle(true));
69324     }
69325     function draw() {
69326       if (polygon2) {
69327         polygon2.data([lasso.coordinates]).attr("d", function(d2) {
69328           return "M" + d2.join(" L") + " Z";
69329         });
69330       }
69331     }
69332     lasso.extent = function() {
69333       return lasso.coordinates.reduce(function(extent, point2) {
69334         return extent.extend(geoExtent(point2));
69335       }, geoExtent());
69336     };
69337     lasso.p = function(_2) {
69338       if (!arguments.length)
69339         return lasso;
69340       lasso.coordinates.push(_2);
69341       draw();
69342       return lasso;
69343     };
69344     lasso.close = function() {
69345       if (group) {
69346         group.call(uiToggle(false, function() {
69347           select_default2(this).remove();
69348         }));
69349       }
69350       context.container().classed("lasso", false);
69351     };
69352     return lasso;
69353   }
69354
69355   // modules/ui/note_comments.js
69356   function uiNoteComments() {
69357     var _note;
69358     function noteComments(selection2) {
69359       if (_note.isNew())
69360         return;
69361       var comments = selection2.selectAll(".comments-container").data([0]);
69362       comments = comments.enter().append("div").attr("class", "comments-container").merge(comments);
69363       var commentEnter = comments.selectAll(".comment").data(_note.comments).enter().append("div").attr("class", "comment");
69364       commentEnter.append("div").attr("class", function(d2) {
69365         return "comment-avatar user-" + d2.uid;
69366       }).call(svgIcon("#iD-icon-avatar", "comment-avatar-icon"));
69367       var mainEnter = commentEnter.append("div").attr("class", "comment-main");
69368       var metadataEnter = mainEnter.append("div").attr("class", "comment-metadata");
69369       metadataEnter.append("div").attr("class", "comment-author").each(function(d2) {
69370         var selection3 = select_default2(this);
69371         var osm = services.osm;
69372         if (osm && d2.user) {
69373           selection3 = selection3.append("a").attr("class", "comment-author-link").attr("href", osm.userURL(d2.user)).attr("target", "_blank");
69374         }
69375         if (d2.user) {
69376           selection3.text(d2.user);
69377         } else {
69378           selection3.call(_t.append("note.anonymous"));
69379         }
69380       });
69381       metadataEnter.append("div").attr("class", "comment-date").html(function(d2) {
69382         return _t.html("note.status." + d2.action, { when: localeDateString2(d2.date) });
69383       });
69384       mainEnter.append("div").attr("class", "comment-text").html(function(d2) {
69385         return d2.html;
69386       }).selectAll("a").attr("rel", "noopener nofollow").attr("target", "_blank");
69387       comments.call(replaceAvatars);
69388     }
69389     function replaceAvatars(selection2) {
69390       var showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
69391       var osm = services.osm;
69392       if (showThirdPartyIcons !== "true" || !osm)
69393         return;
69394       var uids = {};
69395       _note.comments.forEach(function(d2) {
69396         if (d2.uid)
69397           uids[d2.uid] = true;
69398       });
69399       Object.keys(uids).forEach(function(uid) {
69400         osm.loadUser(uid, function(err, user) {
69401           if (!user || !user.image_url)
69402             return;
69403           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);
69404         });
69405       });
69406     }
69407     function localeDateString2(s2) {
69408       if (!s2)
69409         return null;
69410       var options2 = { day: "numeric", month: "short", year: "numeric" };
69411       s2 = s2.replace(/-/g, "/");
69412       var d2 = new Date(s2);
69413       if (isNaN(d2.getTime()))
69414         return null;
69415       return d2.toLocaleDateString(_mainLocalizer.localeCode(), options2);
69416     }
69417     noteComments.note = function(val) {
69418       if (!arguments.length)
69419         return _note;
69420       _note = val;
69421       return noteComments;
69422     };
69423     return noteComments;
69424   }
69425
69426   // modules/ui/note_header.js
69427   function uiNoteHeader() {
69428     var _note;
69429     function noteHeader(selection2) {
69430       var header = selection2.selectAll(".note-header").data(
69431         _note ? [_note] : [],
69432         function(d2) {
69433           return d2.status + d2.id;
69434         }
69435       );
69436       header.exit().remove();
69437       var headerEnter = header.enter().append("div").attr("class", "note-header");
69438       var iconEnter = headerEnter.append("div").attr("class", function(d2) {
69439         return "note-header-icon " + d2.status;
69440       }).classed("new", function(d2) {
69441         return d2.id < 0;
69442       });
69443       iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-note", "note-fill"));
69444       iconEnter.each(function(d2) {
69445         var statusIcon;
69446         if (d2.id < 0) {
69447           statusIcon = "#iD-icon-plus";
69448         } else if (d2.status === "open") {
69449           statusIcon = "#iD-icon-close";
69450         } else {
69451           statusIcon = "#iD-icon-apply";
69452         }
69453         iconEnter.append("div").attr("class", "note-icon-annotation").attr("title", _t("icons.close")).call(svgIcon(statusIcon, "icon-annotation"));
69454       });
69455       headerEnter.append("div").attr("class", "note-header-label").html(function(d2) {
69456         if (_note.isNew()) {
69457           return _t.html("note.new");
69458         }
69459         return _t.html("note.note") + " " + d2.id + " " + (d2.status === "closed" ? _t.html("note.closed") : "");
69460       });
69461     }
69462     noteHeader.note = function(val) {
69463       if (!arguments.length)
69464         return _note;
69465       _note = val;
69466       return noteHeader;
69467     };
69468     return noteHeader;
69469   }
69470
69471   // modules/ui/note_report.js
69472   function uiNoteReport() {
69473     var _note;
69474     function noteReport(selection2) {
69475       var url;
69476       if (services.osm && _note instanceof osmNote && !_note.isNew()) {
69477         url = services.osm.noteReportURL(_note);
69478       }
69479       var link2 = selection2.selectAll(".note-report").data(url ? [url] : []);
69480       link2.exit().remove();
69481       var linkEnter = link2.enter().append("a").attr("class", "note-report").attr("target", "_blank").attr("href", function(d2) {
69482         return d2;
69483       }).call(svgIcon("#iD-icon-out-link", "inline"));
69484       linkEnter.append("span").call(_t.append("note.report"));
69485     }
69486     noteReport.note = function(val) {
69487       if (!arguments.length)
69488         return _note;
69489       _note = val;
69490       return noteReport;
69491     };
69492     return noteReport;
69493   }
69494
69495   // modules/ui/note_editor.js
69496   function uiNoteEditor(context) {
69497     var dispatch14 = dispatch_default("change");
69498     var noteComments = uiNoteComments(context);
69499     var noteHeader = uiNoteHeader();
69500     var _note;
69501     var _newNote;
69502     function noteEditor(selection2) {
69503       var header = selection2.selectAll(".header").data([0]);
69504       var headerEnter = header.enter().append("div").attr("class", "header fillL");
69505       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
69506         context.enter(modeBrowse(context));
69507       }).call(svgIcon("#iD-icon-close"));
69508       headerEnter.append("h2").call(_t.append("note.title"));
69509       var body = selection2.selectAll(".body").data([0]);
69510       body = body.enter().append("div").attr("class", "body").merge(body);
69511       var editor = body.selectAll(".note-editor").data([0]);
69512       editor.enter().append("div").attr("class", "modal-section note-editor").merge(editor).call(noteHeader.note(_note)).call(noteComments.note(_note)).call(noteSaveSection);
69513       var footer = selection2.selectAll(".footer").data([0]);
69514       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOSM(context).what(_note)).call(uiNoteReport(context).note(_note));
69515       var osm = services.osm;
69516       if (osm) {
69517         osm.on("change.note-save", function() {
69518           selection2.call(noteEditor);
69519         });
69520       }
69521     }
69522     function noteSaveSection(selection2) {
69523       var isSelected = _note && _note.id === context.selectedNoteID();
69524       var noteSave = selection2.selectAll(".note-save").data(isSelected ? [_note] : [], function(d2) {
69525         return d2.status + d2.id;
69526       });
69527       noteSave.exit().remove();
69528       var noteSaveEnter = noteSave.enter().append("div").attr("class", "note-save save-section cf");
69529       noteSaveEnter.append("h4").attr("class", ".note-save-header").html(function() {
69530         return _note.isNew() ? _t.html("note.newDescription") : _t.html("note.newComment");
69531       });
69532       var commentTextarea = noteSaveEnter.append("textarea").attr("class", "new-comment-input").attr("placeholder", _t("note.inputPlaceholder")).attr("maxlength", 1e3).property("value", function(d2) {
69533         return d2.newComment;
69534       }).call(utilNoAuto).on("keydown.note-input", keydown).on("input.note-input", changeInput).on("blur.note-input", changeInput);
69535       if (!commentTextarea.empty() && _newNote) {
69536         commentTextarea.node().focus();
69537       }
69538       noteSave = noteSaveEnter.merge(noteSave).call(userDetails).call(noteSaveButtons);
69539       function keydown(d3_event) {
69540         if (!(d3_event.keyCode === 13 && // ↩ Return
69541         d3_event.metaKey))
69542           return;
69543         var osm = services.osm;
69544         if (!osm)
69545           return;
69546         var hasAuth = osm.authenticated();
69547         if (!hasAuth)
69548           return;
69549         if (!_note.newComment)
69550           return;
69551         d3_event.preventDefault();
69552         select_default2(this).on("keydown.note-input", null);
69553         window.setTimeout(function() {
69554           if (_note.isNew()) {
69555             noteSave.selectAll(".save-button").node().focus();
69556             clickSave(_note);
69557           } else {
69558             noteSave.selectAll(".comment-button").node().focus();
69559             clickComment(_note);
69560           }
69561         }, 10);
69562       }
69563       function changeInput() {
69564         var input = select_default2(this);
69565         var val = input.property("value").trim() || void 0;
69566         _note = _note.update({ newComment: val });
69567         var osm = services.osm;
69568         if (osm) {
69569           osm.replaceNote(_note);
69570         }
69571         noteSave.call(noteSaveButtons);
69572       }
69573     }
69574     function userDetails(selection2) {
69575       var detailSection = selection2.selectAll(".detail-section").data([0]);
69576       detailSection = detailSection.enter().append("div").attr("class", "detail-section").merge(detailSection);
69577       var osm = services.osm;
69578       if (!osm)
69579         return;
69580       var hasAuth = osm.authenticated();
69581       var authWarning = detailSection.selectAll(".auth-warning").data(hasAuth ? [] : [0]);
69582       authWarning.exit().transition().duration(200).style("opacity", 0).remove();
69583       var authEnter = authWarning.enter().insert("div", ".tag-reference-body").attr("class", "field-warning auth-warning").style("opacity", 0);
69584       authEnter.call(svgIcon("#iD-icon-alert", "inline"));
69585       authEnter.append("span").call(_t.append("note.login"));
69586       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) {
69587         d3_event.preventDefault();
69588         osm.authenticate();
69589       });
69590       authEnter.transition().duration(200).style("opacity", 1);
69591       var prose = detailSection.selectAll(".note-save-prose").data(hasAuth ? [0] : []);
69592       prose.exit().remove();
69593       prose = prose.enter().append("p").attr("class", "note-save-prose").call(_t.append("note.upload_explanation")).merge(prose);
69594       osm.userDetails(function(err, user) {
69595         if (err)
69596           return;
69597         var userLink = select_default2(document.createElement("div"));
69598         if (user.image_url) {
69599           userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
69600         }
69601         userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
69602         prose.html(_t.html("note.upload_explanation_with_user", { user: { html: userLink.html() } }));
69603       });
69604     }
69605     function noteSaveButtons(selection2) {
69606       var osm = services.osm;
69607       var hasAuth = osm && osm.authenticated();
69608       var isSelected = _note && _note.id === context.selectedNoteID();
69609       var buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_note] : [], function(d2) {
69610         return d2.status + d2.id;
69611       });
69612       buttonSection.exit().remove();
69613       var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
69614       if (_note.isNew()) {
69615         buttonEnter.append("button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
69616         buttonEnter.append("button").attr("class", "button save-button action").call(_t.append("note.save"));
69617       } else {
69618         buttonEnter.append("button").attr("class", "button status-button action");
69619         buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("note.comment"));
69620       }
69621       buttonSection = buttonSection.merge(buttonEnter);
69622       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
69623       buttonSection.select(".save-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
69624       buttonSection.select(".status-button").attr("disabled", hasAuth ? null : true).html(function(d2) {
69625         var action = d2.status === "open" ? "close" : "open";
69626         var andComment = d2.newComment ? "_comment" : "";
69627         return _t.html("note." + action + andComment);
69628       }).on("click.status", clickStatus);
69629       buttonSection.select(".comment-button").attr("disabled", isSaveDisabled).on("click.comment", clickComment);
69630       function isSaveDisabled(d2) {
69631         return hasAuth && d2.status === "open" && d2.newComment ? null : true;
69632       }
69633     }
69634     function clickCancel(d3_event, d2) {
69635       this.blur();
69636       var osm = services.osm;
69637       if (osm) {
69638         osm.removeNote(d2);
69639       }
69640       context.enter(modeBrowse(context));
69641       dispatch14.call("change");
69642     }
69643     function clickSave(d3_event, d2) {
69644       this.blur();
69645       var osm = services.osm;
69646       if (osm) {
69647         osm.postNoteCreate(d2, function(err, note) {
69648           dispatch14.call("change", note);
69649         });
69650       }
69651     }
69652     function clickStatus(d3_event, d2) {
69653       this.blur();
69654       var osm = services.osm;
69655       if (osm) {
69656         var setStatus = d2.status === "open" ? "closed" : "open";
69657         osm.postNoteUpdate(d2, setStatus, function(err, note) {
69658           dispatch14.call("change", note);
69659         });
69660       }
69661     }
69662     function clickComment(d3_event, d2) {
69663       this.blur();
69664       var osm = services.osm;
69665       if (osm) {
69666         osm.postNoteUpdate(d2, d2.status, function(err, note) {
69667           dispatch14.call("change", note);
69668         });
69669       }
69670     }
69671     noteEditor.note = function(val) {
69672       if (!arguments.length)
69673         return _note;
69674       _note = val;
69675       return noteEditor;
69676     };
69677     noteEditor.newNote = function(val) {
69678       if (!arguments.length)
69679         return _newNote;
69680       _newNote = val;
69681       return noteEditor;
69682     };
69683     return utilRebind(noteEditor, dispatch14, "on");
69684   }
69685
69686   // modules/ui/source_switch.js
69687   function uiSourceSwitch(context) {
69688     var keys2;
69689     function click(d3_event) {
69690       d3_event.preventDefault();
69691       var osm = context.connection();
69692       if (!osm)
69693         return;
69694       if (context.inIntro())
69695         return;
69696       if (context.history().hasChanges() && !window.confirm(_t("source_switch.lose_changes")))
69697         return;
69698       var isLive = select_default2(this).classed("live");
69699       isLive = !isLive;
69700       context.enter(modeBrowse(context));
69701       context.history().clearSaved();
69702       context.flush();
69703       select_default2(this).html(isLive ? _t.html("source_switch.live") : _t.html("source_switch.dev")).classed("live", isLive).classed("chip", isLive);
69704       osm.switch(isLive ? keys2[0] : keys2[1]);
69705     }
69706     var sourceSwitch = function(selection2) {
69707       selection2.append("a").attr("href", "#").call(_t.append("source_switch.live")).attr("class", "live chip").on("click", click);
69708     };
69709     sourceSwitch.keys = function(_2) {
69710       if (!arguments.length)
69711         return keys2;
69712       keys2 = _2;
69713       return sourceSwitch;
69714     };
69715     return sourceSwitch;
69716   }
69717
69718   // modules/ui/spinner.js
69719   function uiSpinner(context) {
69720     var osm = context.connection();
69721     return function(selection2) {
69722       var img = selection2.append("img").attr("src", context.imagePath("loader-black.gif")).style("opacity", 0);
69723       if (osm) {
69724         osm.on("loading.spinner", function() {
69725           img.transition().style("opacity", 1);
69726         }).on("loaded.spinner", function() {
69727           img.transition().style("opacity", 0);
69728         });
69729       }
69730     };
69731   }
69732
69733   // modules/ui/sections/privacy.js
69734   function uiSectionPrivacy(context) {
69735     let section = uiSection("preferences-third-party", context).label(() => _t.append("preferences.privacy.title")).disclosureContent(renderDisclosureContent);
69736     function renderDisclosureContent(selection2) {
69737       selection2.selectAll(".privacy-options-list").data([0]).enter().append("ul").attr("class", "layer-list privacy-options-list");
69738       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(
69739         uiTooltip().title(() => _t.append("preferences.privacy.third_party_icons.tooltip")).placement("bottom")
69740       );
69741       thirdPartyIconsEnter.append("input").attr("type", "checkbox").on("change", (d3_event, d2) => {
69742         d3_event.preventDefault();
69743         corePreferences("preferences.privacy.thirdpartyicons", d2 === "true" ? "false" : "true");
69744       });
69745       thirdPartyIconsEnter.append("span").call(_t.append("preferences.privacy.third_party_icons.description"));
69746       selection2.selectAll(".privacy-third-party-icons-item").classed("active", (d2) => d2 === "true").select("input").property("checked", (d2) => d2 === "true");
69747       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"));
69748     }
69749     corePreferences.onChange("preferences.privacy.thirdpartyicons", section.reRender);
69750     return section;
69751   }
69752
69753   // modules/ui/splash.js
69754   function uiSplash(context) {
69755     return (selection2) => {
69756       if (context.history().hasRestorableChanges())
69757         return;
69758       let updateMessage = "";
69759       const sawPrivacyVersion = corePreferences("sawPrivacyVersion");
69760       let showSplash = !corePreferences("sawSplash");
69761       if (sawPrivacyVersion !== context.privacyVersion) {
69762         updateMessage = _t("splash.privacy_update");
69763         showSplash = true;
69764       }
69765       if (!showSplash)
69766         return;
69767       corePreferences("sawSplash", true);
69768       corePreferences("sawPrivacyVersion", context.privacyVersion);
69769       _mainFileFetcher.get("intro_graph");
69770       let modalSelection = uiModal(selection2);
69771       modalSelection.select(".modal").attr("class", "modal-splash modal");
69772       let introModal = modalSelection.select(".content").append("div").attr("class", "fillL");
69773       introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("splash.welcome"));
69774       let modalSection = introModal.append("div").attr("class", "modal-section");
69775       modalSection.append("p").html(_t.html("splash.text", {
69776         version: context.version,
69777         website: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/develop/CHANGELOG.md#whats-new">' + _t.html("splash.changelog") + "</a>" },
69778         github: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/issues">github.com</a>' }
69779       }));
69780       modalSection.append("p").html(_t.html("splash.privacy", {
69781         updateMessage,
69782         privacyLink: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/release/PRIVACY.md">' + _t("splash.privacy_policy") + "</a>" }
69783       }));
69784       uiSectionPrivacy(context).label(() => _t.append("splash.privacy_settings")).render(modalSection);
69785       let buttonWrap = introModal.append("div").attr("class", "modal-actions");
69786       let walkthrough = buttonWrap.append("button").attr("class", "walkthrough").on("click", () => {
69787         context.container().call(uiIntro(context));
69788         modalSelection.close();
69789       });
69790       walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
69791       walkthrough.append("div").call(_t.append("splash.walkthrough"));
69792       let startEditing = buttonWrap.append("button").attr("class", "start-editing").on("click", modalSelection.close);
69793       startEditing.append("svg").attr("class", "logo logo-features").append("use").attr("xlink:href", "#iD-logo-features");
69794       startEditing.append("div").call(_t.append("splash.start"));
69795       modalSelection.select("button.close").attr("class", "hide");
69796     };
69797   }
69798
69799   // modules/ui/status.js
69800   function uiStatus(context) {
69801     var osm = context.connection();
69802     return function(selection2) {
69803       if (!osm)
69804         return;
69805       function update(err, apiStatus) {
69806         selection2.html("");
69807         if (err) {
69808           if (apiStatus === "connectionSwitched") {
69809             return;
69810           } else if (apiStatus === "rateLimited") {
69811             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) {
69812               d3_event.preventDefault();
69813               osm.authenticate();
69814             });
69815           } else {
69816             var throttledRetry = throttle_default(function() {
69817               context.loadTiles(context.projection);
69818               osm.reloadApiStatus();
69819             }, 2e3);
69820             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) {
69821               d3_event.preventDefault();
69822               throttledRetry();
69823             });
69824           }
69825         } else if (apiStatus === "readonly") {
69826           selection2.call(_t.append("osm_api_status.message.readonly"));
69827         } else if (apiStatus === "offline") {
69828           selection2.call(_t.append("osm_api_status.message.offline"));
69829         }
69830         selection2.attr("class", "api-status " + (err ? "error" : apiStatus));
69831       }
69832       osm.on("apiStatusChange.uiStatus", update);
69833       context.history().on("storage_error", () => {
69834         selection2.selectAll("span.local-storage-full").remove();
69835         selection2.append("span").attr("class", "local-storage-full").call(_t.append("osm_api_status.message.local_storage_full"));
69836         selection2.classed("error", true);
69837       });
69838       window.setInterval(function() {
69839         osm.reloadApiStatus();
69840       }, 9e4);
69841       osm.reloadApiStatus();
69842     };
69843   }
69844
69845   // node_modules/osm-community-index/lib/simplify.js
69846   var import_diacritics2 = __toESM(require_diacritics(), 1);
69847   function simplify(str2) {
69848     if (typeof str2 !== "string")
69849       return "";
69850     return import_diacritics2.default.remove(
69851       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()
69852     );
69853   }
69854
69855   // node_modules/osm-community-index/lib/resolve_strings.js
69856   function resolveStrings(item, defaults, localizerFn) {
69857     let itemStrings = Object.assign({}, item.strings);
69858     let defaultStrings = Object.assign({}, defaults[item.type]);
69859     const anyToken = new RegExp(/(\{\w+\})/, "gi");
69860     if (localizerFn) {
69861       if (itemStrings.community) {
69862         const communityID = simplify(itemStrings.community);
69863         itemStrings.community = localizerFn(`_communities.${communityID}`);
69864       }
69865       ["name", "description", "extendedDescription"].forEach((prop) => {
69866         if (defaultStrings[prop])
69867           defaultStrings[prop] = localizerFn(`_defaults.${item.type}.${prop}`);
69868         if (itemStrings[prop])
69869           itemStrings[prop] = localizerFn(`${item.id}.${prop}`);
69870       });
69871     }
69872     let replacements = {
69873       account: item.account,
69874       community: itemStrings.community,
69875       signupUrl: itemStrings.signupUrl,
69876       url: itemStrings.url
69877     };
69878     if (!replacements.signupUrl) {
69879       replacements.signupUrl = resolve(itemStrings.signupUrl || defaultStrings.signupUrl);
69880     }
69881     if (!replacements.url) {
69882       replacements.url = resolve(itemStrings.url || defaultStrings.url);
69883     }
69884     let resolved = {
69885       name: resolve(itemStrings.name || defaultStrings.name),
69886       url: resolve(itemStrings.url || defaultStrings.url),
69887       signupUrl: resolve(itemStrings.signupUrl || defaultStrings.signupUrl),
69888       description: resolve(itemStrings.description || defaultStrings.description),
69889       extendedDescription: resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription)
69890     };
69891     resolved.nameHTML = linkify(resolved.url, resolved.name);
69892     resolved.urlHTML = linkify(resolved.url);
69893     resolved.signupUrlHTML = linkify(resolved.signupUrl);
69894     resolved.descriptionHTML = resolve(itemStrings.description || defaultStrings.description, true);
69895     resolved.extendedDescriptionHTML = resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription, true);
69896     return resolved;
69897     function resolve(s2, addLinks) {
69898       if (!s2)
69899         return void 0;
69900       let result = s2;
69901       for (let key in replacements) {
69902         const token = `{${key}}`;
69903         const regex = new RegExp(token, "g");
69904         if (regex.test(result)) {
69905           let replacement = replacements[key];
69906           if (!replacement) {
69907             throw new Error(`Cannot resolve token: ${token}`);
69908           } else {
69909             if (addLinks && (key === "signupUrl" || key === "url")) {
69910               replacement = linkify(replacement);
69911             }
69912             result = result.replace(regex, replacement);
69913           }
69914         }
69915       }
69916       const leftovers = result.match(anyToken);
69917       if (leftovers) {
69918         throw new Error(`Cannot resolve tokens: ${leftovers}`);
69919       }
69920       if (addLinks && item.type === "reddit") {
69921         result = result.replace(/(\/r\/\w+\/*)/i, (match) => linkify(resolved.url, match));
69922       }
69923       return result;
69924     }
69925     function linkify(url, text2) {
69926       if (!url)
69927         return void 0;
69928       text2 = text2 || url;
69929       return `<a target="_blank" href="${url}">${text2}</a>`;
69930     }
69931   }
69932
69933   // modules/ui/success.js
69934   var _oci = null;
69935   function uiSuccess(context) {
69936     const MAXEVENTS = 2;
69937     const dispatch14 = dispatch_default("cancel");
69938     let _changeset2;
69939     let _location;
69940     ensureOSMCommunityIndex();
69941     function ensureOSMCommunityIndex() {
69942       const data = _mainFileFetcher;
69943       return Promise.all([
69944         data.get("oci_features"),
69945         data.get("oci_resources"),
69946         data.get("oci_defaults")
69947       ]).then((vals) => {
69948         if (_oci)
69949           return _oci;
69950         if (vals[0] && Array.isArray(vals[0].features)) {
69951           _sharedLocationManager.mergeCustomGeoJSON(vals[0]);
69952         }
69953         let ociResources = Object.values(vals[1].resources);
69954         if (ociResources.length) {
69955           return _sharedLocationManager.mergeLocationSets(ociResources).then(() => {
69956             _oci = {
69957               resources: ociResources,
69958               defaults: vals[2].defaults
69959             };
69960             return _oci;
69961           });
69962         } else {
69963           _oci = {
69964             resources: [],
69965             // no resources?
69966             defaults: vals[2].defaults
69967           };
69968           return _oci;
69969         }
69970       });
69971     }
69972     function parseEventDate(when) {
69973       if (!when)
69974         return;
69975       let raw = when.trim();
69976       if (!raw)
69977         return;
69978       if (!/Z$/.test(raw)) {
69979         raw += "Z";
69980       }
69981       const parsed = new Date(raw);
69982       return new Date(parsed.toUTCString().slice(0, 25));
69983     }
69984     function success(selection2) {
69985       let header = selection2.append("div").attr("class", "header fillL");
69986       header.append("h2").call(_t.append("success.just_edited"));
69987       header.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => dispatch14.call("cancel")).call(svgIcon("#iD-icon-close"));
69988       let body = selection2.append("div").attr("class", "body save-success fillL");
69989       let summary = body.append("div").attr("class", "save-summary");
69990       summary.append("h3").call(_t.append("success.thank_you" + (_location ? "_location" : ""), { where: _location }));
69991       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"));
69992       let osm = context.connection();
69993       if (!osm)
69994         return;
69995       let changesetURL = osm.changesetURL(_changeset2.id);
69996       let table = summary.append("table").attr("class", "summary-table");
69997       let row = table.append("tr").attr("class", "summary-row");
69998       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");
69999       let summaryDetail = row.append("td").attr("class", "cell-detail summary-detail");
70000       summaryDetail.append("a").attr("class", "cell-detail summary-view-on-osm").attr("target", "_blank").attr("href", changesetURL).call(_t.append("success.view_on_osm"));
70001       summaryDetail.append("div").html(_t.html("success.changeset_id", {
70002         changeset_id: { html: `<a href="${changesetURL}" target="_blank">${_changeset2.id}</a>` }
70003       }));
70004       ensureOSMCommunityIndex().then((oci) => {
70005         const loc = context.map().center();
70006         const validHere = _sharedLocationManager.locationSetsAt(loc);
70007         let communities = [];
70008         oci.resources.forEach((resource) => {
70009           let area = validHere[resource.locationSetID];
70010           if (!area)
70011             return;
70012           const localizer = (stringID) => _t.html(`community.${stringID}`);
70013           resource.resolved = resolveStrings(resource, oci.defaults, localizer);
70014           communities.push({
70015             area,
70016             order: resource.order || 0,
70017             resource
70018           });
70019         });
70020         communities.sort((a2, b2) => a2.area - b2.area || b2.order - a2.order);
70021         body.call(showCommunityLinks, communities.map((c2) => c2.resource));
70022       });
70023     }
70024     function showCommunityLinks(selection2, resources) {
70025       let communityLinks = selection2.append("div").attr("class", "save-communityLinks");
70026       communityLinks.append("h3").call(_t.append("success.like_osm"));
70027       let table = communityLinks.append("table").attr("class", "community-table");
70028       let row = table.selectAll(".community-row").data(resources);
70029       let rowEnter = row.enter().append("tr").attr("class", "community-row");
70030       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}`);
70031       let communityDetail = rowEnter.append("td").attr("class", "cell-detail community-detail");
70032       communityDetail.each(showCommunityDetails);
70033       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"));
70034     }
70035     function showCommunityDetails(d2) {
70036       let selection2 = select_default2(this);
70037       let communityID = d2.id;
70038       selection2.append("div").attr("class", "community-name").html(d2.resolved.nameHTML);
70039       selection2.append("div").attr("class", "community-description").html(d2.resolved.descriptionHTML);
70040       if (d2.resolved.extendedDescriptionHTML || d2.languageCodes && d2.languageCodes.length) {
70041         selection2.append("div").call(
70042           uiDisclosure(context, `community-more-${d2.id}`, false).expanded(false).updatePreference(false).label(() => _t.append("success.more")).content(showMore)
70043         );
70044       }
70045       let nextEvents = (d2.events || []).map((event) => {
70046         event.date = parseEventDate(event.when);
70047         return event;
70048       }).filter((event) => {
70049         const t2 = event.date.getTime();
70050         const now3 = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0);
70051         return !isNaN(t2) && t2 >= now3;
70052       }).sort((a2, b2) => {
70053         return a2.date < b2.date ? -1 : a2.date > b2.date ? 1 : 0;
70054       }).slice(0, MAXEVENTS);
70055       if (nextEvents.length) {
70056         selection2.append("div").call(
70057           uiDisclosure(context, `community-events-${d2.id}`, false).expanded(false).updatePreference(false).label(_t.html("success.events")).content(showNextEvents)
70058         ).select(".hide-toggle").append("span").attr("class", "badge-text").text(nextEvents.length);
70059       }
70060       function showMore(selection3) {
70061         let more = selection3.selectAll(".community-more").data([0]);
70062         let moreEnter = more.enter().append("div").attr("class", "community-more");
70063         if (d2.resolved.extendedDescriptionHTML) {
70064           moreEnter.append("div").attr("class", "community-extended-description").html(d2.resolved.extendedDescriptionHTML);
70065         }
70066         if (d2.languageCodes && d2.languageCodes.length) {
70067           const languageList = d2.languageCodes.map((code) => _mainLocalizer.languageName(code)).join(", ");
70068           moreEnter.append("div").attr("class", "community-languages").call(_t.append("success.languages", { languages: languageList }));
70069         }
70070       }
70071       function showNextEvents(selection3) {
70072         let events = selection3.append("div").attr("class", "community-events");
70073         let item = events.selectAll(".community-event").data(nextEvents);
70074         let itemEnter = item.enter().append("div").attr("class", "community-event");
70075         itemEnter.append("div").attr("class", "community-event-name").append("a").attr("target", "_blank").attr("href", (d4) => d4.url).text((d4) => {
70076           let name = d4.name;
70077           if (d4.i18n && d4.id) {
70078             name = _t(`community.${communityID}.events.${d4.id}.name`, { default: name });
70079           }
70080           return name;
70081         });
70082         itemEnter.append("div").attr("class", "community-event-when").text((d4) => {
70083           let options2 = { weekday: "short", day: "numeric", month: "short", year: "numeric" };
70084           if (d4.date.getHours() || d4.date.getMinutes()) {
70085             options2.hour = "numeric";
70086             options2.minute = "numeric";
70087           }
70088           return d4.date.toLocaleString(_mainLocalizer.localeCode(), options2);
70089         });
70090         itemEnter.append("div").attr("class", "community-event-where").text((d4) => {
70091           let where = d4.where;
70092           if (d4.i18n && d4.id) {
70093             where = _t(`community.${communityID}.events.${d4.id}.where`, { default: where });
70094           }
70095           return where;
70096         });
70097         itemEnter.append("div").attr("class", "community-event-description").text((d4) => {
70098           let description = d4.description;
70099           if (d4.i18n && d4.id) {
70100             description = _t(`community.${communityID}.events.${d4.id}.description`, { default: description });
70101           }
70102           return description;
70103         });
70104       }
70105     }
70106     success.changeset = function(val) {
70107       if (!arguments.length)
70108         return _changeset2;
70109       _changeset2 = val;
70110       return success;
70111     };
70112     success.location = function(val) {
70113       if (!arguments.length)
70114         return _location;
70115       _location = val;
70116       return success;
70117     };
70118     return utilRebind(success, dispatch14, "on");
70119   }
70120
70121   // modules/ui/version.js
70122   var sawVersion = null;
70123   var isNewVersion = false;
70124   var isNewUser = false;
70125   function uiVersion(context) {
70126     var currVersion = context.version;
70127     var matchedVersion = currVersion.match(/\d+\.\d+\.\d+.*/);
70128     if (sawVersion === null && matchedVersion !== null) {
70129       if (corePreferences("sawVersion")) {
70130         isNewUser = false;
70131         isNewVersion = corePreferences("sawVersion") !== currVersion && currVersion.indexOf("-") === -1;
70132       } else {
70133         isNewUser = true;
70134         isNewVersion = true;
70135       }
70136       corePreferences("sawVersion", currVersion);
70137       sawVersion = currVersion;
70138     }
70139     return function(selection2) {
70140       selection2.append("a").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD").text(currVersion);
70141       if (isNewVersion && !isNewUser) {
70142         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(
70143           uiTooltip().title(() => _t.append("version.whats_new", { version: currVersion })).placement("top").scrollContainer(context.container().select(".main-footer-wrap"))
70144         );
70145       }
70146     };
70147   }
70148
70149   // modules/ui/zoom.js
70150   function uiZoom(context) {
70151     var zooms = [{
70152       id: "zoom-in",
70153       icon: "iD-icon-plus",
70154       title: _t.append("zoom.in"),
70155       action: zoomIn,
70156       disabled: function() {
70157         return !context.map().canZoomIn();
70158       },
70159       disabledTitle: _t.append("zoom.disabled.in"),
70160       key: "+"
70161     }, {
70162       id: "zoom-out",
70163       icon: "iD-icon-minus",
70164       title: _t.append("zoom.out"),
70165       action: zoomOut,
70166       disabled: function() {
70167         return !context.map().canZoomOut();
70168       },
70169       disabledTitle: _t.append("zoom.disabled.out"),
70170       key: "-"
70171     }];
70172     function zoomIn(d3_event) {
70173       if (d3_event.shiftKey)
70174         return;
70175       d3_event.preventDefault();
70176       context.map().zoomIn();
70177     }
70178     function zoomOut(d3_event) {
70179       if (d3_event.shiftKey)
70180         return;
70181       d3_event.preventDefault();
70182       context.map().zoomOut();
70183     }
70184     function zoomInFurther(d3_event) {
70185       if (d3_event.shiftKey)
70186         return;
70187       d3_event.preventDefault();
70188       context.map().zoomInFurther();
70189     }
70190     function zoomOutFurther(d3_event) {
70191       if (d3_event.shiftKey)
70192         return;
70193       d3_event.preventDefault();
70194       context.map().zoomOutFurther();
70195     }
70196     return function(selection2) {
70197       var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function(d2) {
70198         if (d2.disabled()) {
70199           return d2.disabledTitle;
70200         }
70201         return d2.title;
70202       }).keys(function(d2) {
70203         return [d2.key];
70204       });
70205       var lastPointerUpType;
70206       var buttons = selection2.selectAll("button").data(zooms).enter().append("button").attr("class", function(d2) {
70207         return d2.id;
70208       }).on("pointerup.editor", function(d3_event) {
70209         lastPointerUpType = d3_event.pointerType;
70210       }).on("click.editor", function(d3_event, d2) {
70211         if (!d2.disabled()) {
70212           d2.action(d3_event);
70213         } else if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
70214           context.ui().flash.duration(2e3).iconName("#" + d2.icon).iconClass("disabled").label(d2.disabledTitle)();
70215         }
70216         lastPointerUpType = null;
70217       }).call(tooltipBehavior);
70218       buttons.each(function(d2) {
70219         select_default2(this).call(svgIcon("#" + d2.icon, "light"));
70220       });
70221       utilKeybinding.plusKeys.forEach(function(key) {
70222         context.keybinding().on([key], zoomIn);
70223         context.keybinding().on([uiCmd("\u2325" + key)], zoomInFurther);
70224       });
70225       utilKeybinding.minusKeys.forEach(function(key) {
70226         context.keybinding().on([key], zoomOut);
70227         context.keybinding().on([uiCmd("\u2325" + key)], zoomOutFurther);
70228       });
70229       function updateButtonStates() {
70230         buttons.classed("disabled", function(d2) {
70231           return d2.disabled();
70232         }).each(function() {
70233           var selection3 = select_default2(this);
70234           if (!selection3.select(".tooltip.in").empty()) {
70235             selection3.call(tooltipBehavior.updateContent);
70236           }
70237         });
70238       }
70239       updateButtonStates();
70240       context.map().on("move.uiZoom", updateButtonStates);
70241     };
70242   }
70243
70244   // modules/ui/sections/raw_tag_editor.js
70245   function uiSectionRawTagEditor(id2, context) {
70246     var section = uiSection(id2, context).classes("raw-tag-editor").label(function() {
70247       var count = Object.keys(_tags).filter(function(d2) {
70248         return d2;
70249       }).length;
70250       return _t.append("inspector.title_count", { title: _t("inspector.tags"), count });
70251     }).expandedByDefault(false).disclosureContent(renderDisclosureContent);
70252     var taginfo = services.taginfo;
70253     var dispatch14 = dispatch_default("change");
70254     var availableViews = [
70255       { id: "list", icon: "#fas-th-list" },
70256       { id: "text", icon: "#fas-i-cursor" }
70257     ];
70258     let _discardTags = {};
70259     _mainFileFetcher.get("discarded").then((d2) => {
70260       _discardTags = d2;
70261     }).catch(() => {
70262     });
70263     var _tagView = corePreferences("raw-tag-editor-view") || "list";
70264     var _readOnlyTags = [];
70265     var _orderedKeys = [];
70266     var _showBlank = false;
70267     var _pendingChange = null;
70268     var _state;
70269     var _presets;
70270     var _tags;
70271     var _entityIDs;
70272     var _didInteract = false;
70273     function interacted() {
70274       _didInteract = true;
70275     }
70276     function renderDisclosureContent(wrap2) {
70277       _orderedKeys = _orderedKeys.filter(function(key) {
70278         return _tags[key] !== void 0;
70279       });
70280       var all = Object.keys(_tags).sort();
70281       var missingKeys = utilArrayDifference(all, _orderedKeys);
70282       for (var i3 in missingKeys) {
70283         _orderedKeys.push(missingKeys[i3]);
70284       }
70285       var rowData = _orderedKeys.map(function(key, i4) {
70286         return { index: i4, key, value: _tags[key] };
70287       });
70288       if (!rowData.length || _showBlank) {
70289         _showBlank = false;
70290         rowData.push({ index: rowData.length, key: "", value: "" });
70291       }
70292       var options2 = wrap2.selectAll(".raw-tag-options").data([0]);
70293       options2.exit().remove();
70294       var optionsEnter = options2.enter().insert("div", ":first-child").attr("class", "raw-tag-options").attr("role", "tablist");
70295       var optionEnter = optionsEnter.selectAll(".raw-tag-option").data(availableViews, function(d2) {
70296         return d2.id;
70297       }).enter();
70298       optionEnter.append("button").attr("class", function(d2) {
70299         return "raw-tag-option raw-tag-option-" + d2.id + (_tagView === d2.id ? " selected" : "");
70300       }).attr("aria-selected", function(d2) {
70301         return _tagView === d2.id;
70302       }).attr("role", "tab").attr("title", function(d2) {
70303         return _t("icons." + d2.id);
70304       }).on("click", function(d3_event, d2) {
70305         _tagView = d2.id;
70306         corePreferences("raw-tag-editor-view", d2.id);
70307         wrap2.selectAll(".raw-tag-option").classed("selected", function(datum2) {
70308           return datum2 === d2;
70309         }).attr("aria-selected", function(datum2) {
70310           return datum2 === d2;
70311         });
70312         wrap2.selectAll(".tag-text").classed("hide", d2.id !== "text").each(setTextareaHeight);
70313         wrap2.selectAll(".tag-list, .add-row").classed("hide", d2.id !== "list");
70314       }).each(function(d2) {
70315         select_default2(this).call(svgIcon(d2.icon));
70316       });
70317       var textData = rowsToText(rowData);
70318       var textarea = wrap2.selectAll(".tag-text").data([0]);
70319       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);
70320       textarea.call(utilGetSetValue, textData).each(setTextareaHeight).on("input", setTextareaHeight).on("focus", interacted).on("blur", textChanged).on("change", textChanged);
70321       var list = wrap2.selectAll(".tag-list").data([0]);
70322       list = list.enter().append("ul").attr("class", "tag-list" + (_tagView !== "list" ? " hide" : "")).merge(list);
70323       var addRowEnter = wrap2.selectAll(".add-row").data([0]).enter().append("div").attr("class", "add-row" + (_tagView !== "list" ? " hide" : ""));
70324       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);
70325       addRowEnter.append("div").attr("class", "space-value");
70326       addRowEnter.append("div").attr("class", "space-buttons");
70327       var items = list.selectAll(".tag-row").data(rowData, function(d2) {
70328         return d2.key;
70329       });
70330       items.exit().each(unbind).remove();
70331       var itemsEnter = items.enter().append("li").attr("class", "tag-row").classed("readonly", isReadOnly);
70332       var innerWrap = itemsEnter.append("div").attr("class", "inner-wrap");
70333       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);
70334       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);
70335       innerWrap.append("button").attr("class", "form-field-button remove").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
70336       items = items.merge(itemsEnter).sort(function(a2, b2) {
70337         return a2.index - b2.index;
70338       });
70339       items.each(function(d2) {
70340         var row = select_default2(this);
70341         var key = row.select("input.key");
70342         var value = row.select("input.value");
70343         if (_entityIDs && taginfo && _state !== "hover") {
70344           bindTypeahead(key, value);
70345         }
70346         var referenceOptions = { key: d2.key };
70347         if (typeof d2.value === "string") {
70348           referenceOptions.value = d2.value;
70349         }
70350         var reference = uiTagReference(referenceOptions, context);
70351         if (_state === "hover") {
70352           reference.showing(false);
70353         }
70354         row.select(".inner-wrap").call(reference.button);
70355         row.call(reference.body);
70356         row.select("button.remove");
70357       });
70358       items.selectAll("input.key").attr("title", function(d2) {
70359         return d2.key;
70360       }).call(utilGetSetValue, function(d2) {
70361         return d2.key;
70362       }).attr("readonly", function(d2) {
70363         return isReadOnly(d2) || null;
70364       });
70365       items.selectAll("input.value").attr("title", function(d2) {
70366         return Array.isArray(d2.value) ? d2.value.filter(Boolean).join("\n") : d2.value;
70367       }).classed("mixed", function(d2) {
70368         return Array.isArray(d2.value);
70369       }).attr("placeholder", function(d2) {
70370         return typeof d2.value === "string" ? null : _t("inspector.multiple_values");
70371       }).call(utilGetSetValue, function(d2) {
70372         return typeof d2.value === "string" ? d2.value : "";
70373       }).attr("readonly", function(d2) {
70374         return isReadOnly(d2) || null;
70375       });
70376       items.selectAll("button.remove").on(
70377         ("PointerEvent" in window ? "pointer" : "mouse") + "down",
70378         // 'click' fires too late - #5878
70379         (d3_event, d2) => {
70380           if (d3_event.button !== 0)
70381             return;
70382           removeTag(d3_event, d2);
70383         }
70384       );
70385     }
70386     function isReadOnly(d2) {
70387       for (var i3 = 0; i3 < _readOnlyTags.length; i3++) {
70388         if (d2.key.match(_readOnlyTags[i3]) !== null) {
70389           return true;
70390         }
70391       }
70392       return false;
70393     }
70394     function setTextareaHeight() {
70395       if (_tagView !== "text")
70396         return;
70397       var selection2 = select_default2(this);
70398       var matches = selection2.node().value.match(/\n/g);
70399       var lineCount = 2 + Number(matches && matches.length);
70400       var lineHeight = 20;
70401       selection2.style("height", lineCount * lineHeight + "px");
70402     }
70403     function stringify3(s2) {
70404       return JSON.stringify(s2).slice(1, -1);
70405     }
70406     function unstringify(s2) {
70407       var leading = "";
70408       var trailing = "";
70409       if (s2.length < 1 || s2.charAt(0) !== '"') {
70410         leading = '"';
70411       }
70412       if (s2.length < 2 || s2.charAt(s2.length - 1) !== '"' || s2.charAt(s2.length - 1) === '"' && s2.charAt(s2.length - 2) === "\\") {
70413         trailing = '"';
70414       }
70415       return JSON.parse(leading + s2 + trailing);
70416     }
70417     function rowsToText(rows) {
70418       var str2 = rows.filter(function(row) {
70419         return row.key && row.key.trim() !== "";
70420       }).map(function(row) {
70421         var rawVal = row.value;
70422         if (typeof rawVal !== "string")
70423           rawVal = "*";
70424         var val = rawVal ? stringify3(rawVal) : "";
70425         return stringify3(row.key) + "=" + val;
70426       }).join("\n");
70427       if (_state !== "hover" && str2.length) {
70428         return str2 + "\n";
70429       }
70430       return str2;
70431     }
70432     function textChanged() {
70433       var newText = this.value.trim();
70434       var newTags = {};
70435       newText.split("\n").forEach(function(row) {
70436         var m2 = row.match(/^\s*([^=]+)=(.*)$/);
70437         if (m2 !== null) {
70438           var k2 = context.cleanTagKey(unstringify(m2[1].trim()));
70439           var v2 = context.cleanTagValue(unstringify(m2[2].trim()));
70440           newTags[k2] = v2;
70441         }
70442       });
70443       var tagDiff = utilTagDiff(_tags, newTags);
70444       if (!tagDiff.length)
70445         return;
70446       _pendingChange = _pendingChange || {};
70447       tagDiff.forEach(function(change) {
70448         if (isReadOnly({ key: change.key }))
70449           return;
70450         if (change.newVal === "*" && typeof change.oldVal !== "string")
70451           return;
70452         if (change.type === "-") {
70453           _pendingChange[change.key] = void 0;
70454         } else if (change.type === "+") {
70455           _pendingChange[change.key] = change.newVal || "";
70456         }
70457       });
70458       if (Object.keys(_pendingChange).length === 0) {
70459         _pendingChange = null;
70460         return;
70461       }
70462       scheduleChange();
70463     }
70464     function pushMore(d3_event) {
70465       if (d3_event.keyCode === 9 && !d3_event.shiftKey && section.selection().selectAll(".tag-list li:last-child input.value").node() === this && utilGetSetValue(select_default2(this))) {
70466         addTag();
70467       }
70468     }
70469     function bindTypeahead(key, value) {
70470       if (isReadOnly(key.datum()))
70471         return;
70472       if (Array.isArray(value.datum().value)) {
70473         value.call(uiCombobox(context, "tag-value").minItems(1).fetcher(function(value2, callback) {
70474           var keyString = utilGetSetValue(key);
70475           if (!_tags[keyString])
70476             return;
70477           var data = _tags[keyString].filter(Boolean).map(function(tagValue) {
70478             return {
70479               value: tagValue,
70480               title: tagValue
70481             };
70482           });
70483           callback(data);
70484         }));
70485         return;
70486       }
70487       var geometry = context.graph().geometry(_entityIDs[0]);
70488       key.call(uiCombobox(context, "tag-key").fetcher(function(value2, callback) {
70489         taginfo.keys({
70490           debounce: true,
70491           geometry,
70492           query: value2
70493         }, function(err, data) {
70494           if (!err) {
70495             const filtered = data.filter((d2) => _tags[d2.value] === void 0).filter((d2) => !(d2.value in _discardTags)).filter((d2) => d2.value.toLowerCase().includes(value2.toLowerCase()));
70496             callback(sort(value2, filtered));
70497           }
70498         });
70499       }));
70500       value.call(uiCombobox(context, "tag-value").fetcher(function(value2, callback) {
70501         taginfo.values({
70502           debounce: true,
70503           key: utilGetSetValue(key),
70504           geometry,
70505           query: value2
70506         }, function(err, data) {
70507           if (!err) {
70508             const filtered = data.filter((d2) => d2.value.toLowerCase().includes(value2.toLowerCase()));
70509             callback(sort(value2, filtered));
70510           }
70511         });
70512       }).caseSensitive(allowUpperCaseTagValues.test(utilGetSetValue(key))));
70513       function sort(value2, data) {
70514         var sameletter = [];
70515         var other = [];
70516         for (var i3 = 0; i3 < data.length; i3++) {
70517           if (data[i3].value.substring(0, value2.length) === value2) {
70518             sameletter.push(data[i3]);
70519           } else {
70520             other.push(data[i3]);
70521           }
70522         }
70523         return sameletter.concat(other);
70524       }
70525     }
70526     function unbind() {
70527       var row = select_default2(this);
70528       row.selectAll("input.key").call(uiCombobox.off, context);
70529       row.selectAll("input.value").call(uiCombobox.off, context);
70530     }
70531     function keyChange(d3_event, d2) {
70532       if (select_default2(this).attr("readonly"))
70533         return;
70534       var kOld = d2.key;
70535       if (_pendingChange && _pendingChange.hasOwnProperty(kOld) && _pendingChange[kOld] === void 0)
70536         return;
70537       var kNew = context.cleanTagKey(this.value.trim());
70538       if (isReadOnly({ key: kNew })) {
70539         this.value = kOld;
70540         return;
70541       }
70542       if (kNew && kNew !== kOld && _tags[kNew] !== void 0) {
70543         this.value = kOld;
70544         section.selection().selectAll(".tag-list input.value").each(function(d4) {
70545           if (d4.key === kNew) {
70546             var input = select_default2(this).node();
70547             input.focus();
70548             input.select();
70549           }
70550         });
70551         return;
70552       }
70553       _pendingChange = _pendingChange || {};
70554       if (kOld) {
70555         if (kOld === kNew)
70556           return;
70557         _pendingChange[kNew] = _pendingChange[kOld] || { oldKey: kOld };
70558         _pendingChange[kOld] = void 0;
70559       } else {
70560         let row = this.parentNode.parentNode;
70561         let inputVal = select_default2(row).selectAll("input.value");
70562         let vNew = context.cleanTagValue(utilGetSetValue(inputVal));
70563         _pendingChange[kNew] = vNew;
70564         utilGetSetValue(inputVal, vNew);
70565       }
70566       var existingKeyIndex = _orderedKeys.indexOf(kOld);
70567       if (existingKeyIndex !== -1)
70568         _orderedKeys[existingKeyIndex] = kNew;
70569       d2.key = kNew;
70570       this.value = kNew;
70571       scheduleChange();
70572     }
70573     function valueChange(d3_event, d2) {
70574       if (isReadOnly(d2))
70575         return;
70576       if (typeof d2.value !== "string" && !this.value)
70577         return;
70578       if (_pendingChange && _pendingChange.hasOwnProperty(d2.key) && _pendingChange[d2.key] === void 0)
70579         return;
70580       _pendingChange = _pendingChange || {};
70581       _pendingChange[d2.key] = context.cleanTagValue(this.value);
70582       scheduleChange();
70583     }
70584     function removeTag(d3_event, d2) {
70585       if (isReadOnly(d2))
70586         return;
70587       if (d2.key === "") {
70588         _showBlank = false;
70589         section.reRender();
70590       } else {
70591         _orderedKeys = _orderedKeys.filter(function(key) {
70592           return key !== d2.key;
70593         });
70594         _pendingChange = _pendingChange || {};
70595         _pendingChange[d2.key] = void 0;
70596         scheduleChange();
70597       }
70598     }
70599     function addTag() {
70600       window.setTimeout(function() {
70601         _showBlank = true;
70602         section.reRender();
70603         section.selection().selectAll(".tag-list li:last-child input.key").node().focus();
70604       }, 20);
70605     }
70606     function scheduleChange() {
70607       var entityIDs = _entityIDs;
70608       window.setTimeout(function() {
70609         if (!_pendingChange)
70610           return;
70611         dispatch14.call("change", this, entityIDs, _pendingChange);
70612         _pendingChange = null;
70613       }, 10);
70614     }
70615     section.state = function(val) {
70616       if (!arguments.length)
70617         return _state;
70618       if (_state !== val) {
70619         _orderedKeys = [];
70620         _state = val;
70621       }
70622       return section;
70623     };
70624     section.presets = function(val) {
70625       if (!arguments.length)
70626         return _presets;
70627       _presets = val;
70628       if (_presets && _presets.length && _presets[0].isFallback()) {
70629         section.disclosureExpanded(true);
70630       } else if (!_didInteract) {
70631         section.disclosureExpanded(null);
70632       }
70633       return section;
70634     };
70635     section.tags = function(val) {
70636       if (!arguments.length)
70637         return _tags;
70638       _tags = val;
70639       return section;
70640     };
70641     section.entityIDs = function(val) {
70642       if (!arguments.length)
70643         return _entityIDs;
70644       if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
70645         _entityIDs = val;
70646         _orderedKeys = [];
70647       }
70648       return section;
70649     };
70650     section.readOnlyTags = function(val) {
70651       if (!arguments.length)
70652         return _readOnlyTags;
70653       _readOnlyTags = val;
70654       return section;
70655     };
70656     return utilRebind(section, dispatch14, "on");
70657   }
70658
70659   // modules/ui/data_editor.js
70660   function uiDataEditor(context) {
70661     var dataHeader = uiDataHeader();
70662     var rawTagEditor = uiSectionRawTagEditor("custom-data-tag-editor", context).expandedByDefault(true).readOnlyTags([/./]);
70663     var _datum;
70664     function dataEditor(selection2) {
70665       var header = selection2.selectAll(".header").data([0]);
70666       var headerEnter = header.enter().append("div").attr("class", "header fillL");
70667       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
70668         context.enter(modeBrowse(context));
70669       }).call(svgIcon("#iD-icon-close"));
70670       headerEnter.append("h2").call(_t.append("map_data.title"));
70671       var body = selection2.selectAll(".body").data([0]);
70672       body = body.enter().append("div").attr("class", "body").merge(body);
70673       var editor = body.selectAll(".data-editor").data([0]);
70674       editor.enter().append("div").attr("class", "modal-section data-editor").merge(editor).call(dataHeader.datum(_datum));
70675       var rte = body.selectAll(".raw-tag-editor").data([0]);
70676       rte.enter().append("div").attr("class", "raw-tag-editor data-editor").merge(rte).call(
70677         rawTagEditor.tags(_datum && _datum.properties || {}).state("hover").render
70678       ).selectAll("textarea.tag-text").attr("readonly", true).classed("readonly", true);
70679     }
70680     dataEditor.datum = function(val) {
70681       if (!arguments.length)
70682         return _datum;
70683       _datum = val;
70684       return this;
70685     };
70686     return dataEditor;
70687   }
70688
70689   // modules/ui/osmose_details.js
70690   function uiOsmoseDetails(context) {
70691     let _qaItem;
70692     function issueString(d2, type2) {
70693       if (!d2)
70694         return "";
70695       const s2 = services.osmose.getStrings(d2.itemType);
70696       return type2 in s2 ? s2[type2] : "";
70697     }
70698     function osmoseDetails(selection2) {
70699       const details = selection2.selectAll(".error-details").data(
70700         _qaItem ? [_qaItem] : [],
70701         (d2) => `${d2.id}-${d2.status || 0}`
70702       );
70703       details.exit().remove();
70704       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
70705       if (issueString(_qaItem, "detail")) {
70706         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
70707         div.append("h4").call(_t.append("QA.keepRight.detail_description"));
70708         div.append("p").attr("class", "qa-details-description-text").html((d2) => issueString(d2, "detail")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
70709       }
70710       const detailsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
70711       const elemsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
70712       if (issueString(_qaItem, "fix")) {
70713         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
70714         div.append("h4").call(_t.append("QA.osmose.fix_title"));
70715         div.append("p").html((d2) => issueString(d2, "fix")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
70716       }
70717       if (issueString(_qaItem, "trap")) {
70718         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
70719         div.append("h4").call(_t.append("QA.osmose.trap_title"));
70720         div.append("p").html((d2) => issueString(d2, "trap")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
70721       }
70722       const thisItem = _qaItem;
70723       services.osmose.loadIssueDetail(_qaItem).then((d2) => {
70724         if (!d2.elems || d2.elems.length === 0)
70725           return;
70726         if (context.selectedErrorID() !== thisItem.id && context.container().selectAll(`.qaItem.osmose.hover.itemId-${thisItem.id}`).empty())
70727           return;
70728         if (d2.detail) {
70729           detailsDiv.append("h4").call(_t.append("QA.osmose.detail_title"));
70730           detailsDiv.append("p").html((d4) => d4.detail).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
70731         }
70732         elemsDiv.append("h4").call(_t.append("QA.osmose.elems_title"));
70733         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() {
70734           const link2 = select_default2(this);
70735           const entityID = this.textContent;
70736           const entity = context.hasEntity(entityID);
70737           link2.on("mouseenter", () => {
70738             utilHighlightEntities([entityID], true, context);
70739           }).on("mouseleave", () => {
70740             utilHighlightEntities([entityID], false, context);
70741           }).on("click", (d3_event) => {
70742             d3_event.preventDefault();
70743             utilHighlightEntities([entityID], false, context);
70744             const osmlayer = context.layers().layer("osm");
70745             if (!osmlayer.enabled()) {
70746               osmlayer.enabled(true);
70747             }
70748             context.map().centerZoom(d2.loc, 20);
70749             if (entity) {
70750               context.enter(modeSelect(context, [entityID]));
70751             } else {
70752               context.loadEntity(entityID, (err, result) => {
70753                 if (err)
70754                   return;
70755                 const entity2 = result.data.find((e3) => e3.id === entityID);
70756                 if (entity2)
70757                   context.enter(modeSelect(context, [entityID]));
70758               });
70759             }
70760           });
70761           if (entity) {
70762             let name = utilDisplayName(entity);
70763             if (!name) {
70764               const preset = _mainPresetIndex.match(entity, context.graph());
70765               name = preset && !preset.isFallback() && preset.name();
70766             }
70767             if (name) {
70768               this.innerText = name;
70769             }
70770           }
70771         });
70772         context.features().forceVisible(d2.elems);
70773         context.map().pan([0, 0]);
70774       }).catch((err) => {
70775         console.log(err);
70776       });
70777     }
70778     osmoseDetails.issue = function(val) {
70779       if (!arguments.length)
70780         return _qaItem;
70781       _qaItem = val;
70782       return osmoseDetails;
70783     };
70784     return osmoseDetails;
70785   }
70786
70787   // modules/ui/osmose_header.js
70788   function uiOsmoseHeader() {
70789     let _qaItem;
70790     function issueTitle(d2) {
70791       const unknown = _t("inspector.unknown");
70792       if (!d2)
70793         return unknown;
70794       const s2 = services.osmose.getStrings(d2.itemType);
70795       return "title" in s2 ? s2.title : unknown;
70796     }
70797     function osmoseHeader(selection2) {
70798       const header = selection2.selectAll(".qa-header").data(
70799         _qaItem ? [_qaItem] : [],
70800         (d2) => `${d2.id}-${d2.status || 0}`
70801       );
70802       header.exit().remove();
70803       const headerEnter = header.enter().append("div").attr("class", "qa-header");
70804       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}`);
70805       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");
70806       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 : "");
70807       headerEnter.append("div").attr("class", "qa-header-label").text(issueTitle);
70808     }
70809     osmoseHeader.issue = function(val) {
70810       if (!arguments.length)
70811         return _qaItem;
70812       _qaItem = val;
70813       return osmoseHeader;
70814     };
70815     return osmoseHeader;
70816   }
70817
70818   // modules/ui/view_on_osmose.js
70819   function uiViewOnOsmose() {
70820     let _qaItem;
70821     function viewOnOsmose(selection2) {
70822       let url;
70823       if (services.osmose && _qaItem instanceof QAItem) {
70824         url = services.osmose.itemURL(_qaItem);
70825       }
70826       const link2 = selection2.selectAll(".view-on-osmose").data(url ? [url] : []);
70827       link2.exit().remove();
70828       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"));
70829       linkEnter.append("span").call(_t.append("inspector.view_on_osmose"));
70830     }
70831     viewOnOsmose.what = function(val) {
70832       if (!arguments.length)
70833         return _qaItem;
70834       _qaItem = val;
70835       return viewOnOsmose;
70836     };
70837     return viewOnOsmose;
70838   }
70839
70840   // modules/ui/osmose_editor.js
70841   function uiOsmoseEditor(context) {
70842     const dispatch14 = dispatch_default("change");
70843     const qaDetails = uiOsmoseDetails(context);
70844     const qaHeader = uiOsmoseHeader(context);
70845     let _qaItem;
70846     function osmoseEditor(selection2) {
70847       const header = selection2.selectAll(".header").data([0]);
70848       const headerEnter = header.enter().append("div").attr("class", "header fillL");
70849       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
70850       headerEnter.append("h2").call(_t.append("QA.osmose.title"));
70851       let body = selection2.selectAll(".body").data([0]);
70852       body = body.enter().append("div").attr("class", "body").merge(body);
70853       let editor = body.selectAll(".qa-editor").data([0]);
70854       editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(osmoseSaveSection);
70855       const footer = selection2.selectAll(".footer").data([0]);
70856       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOsmose(context).what(_qaItem));
70857     }
70858     function osmoseSaveSection(selection2) {
70859       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
70860       const isShown = _qaItem && isSelected;
70861       let saveSection = selection2.selectAll(".qa-save").data(
70862         isShown ? [_qaItem] : [],
70863         (d2) => `${d2.id}-${d2.status || 0}`
70864       );
70865       saveSection.exit().remove();
70866       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
70867       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
70868     }
70869     function qaSaveButtons(selection2) {
70870       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
70871       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d2) => d2.status + d2.id);
70872       buttonSection.exit().remove();
70873       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
70874       buttonEnter.append("button").attr("class", "button close-button action");
70875       buttonEnter.append("button").attr("class", "button ignore-button action");
70876       buttonSection = buttonSection.merge(buttonEnter);
70877       buttonSection.select(".close-button").call(_t.append("QA.keepRight.close")).on("click.close", function(d3_event, d2) {
70878         this.blur();
70879         const qaService = services.osmose;
70880         if (qaService) {
70881           d2.newStatus = "done";
70882           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
70883         }
70884       });
70885       buttonSection.select(".ignore-button").call(_t.append("QA.keepRight.ignore")).on("click.ignore", function(d3_event, d2) {
70886         this.blur();
70887         const qaService = services.osmose;
70888         if (qaService) {
70889           d2.newStatus = "false";
70890           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
70891         }
70892       });
70893     }
70894     osmoseEditor.error = function(val) {
70895       if (!arguments.length)
70896         return _qaItem;
70897       _qaItem = val;
70898       return osmoseEditor;
70899     };
70900     return utilRebind(osmoseEditor, dispatch14, "on");
70901   }
70902
70903   // modules/ui/sidebar.js
70904   function uiSidebar(context) {
70905     var inspector = uiInspector(context);
70906     var dataEditor = uiDataEditor(context);
70907     var noteEditor = uiNoteEditor(context);
70908     var improveOsmEditor = uiImproveOsmEditor(context);
70909     var keepRightEditor = uiKeepRightEditor(context);
70910     var osmoseEditor = uiOsmoseEditor(context);
70911     var _current;
70912     var _wasData = false;
70913     var _wasNote = false;
70914     var _wasQaItem = false;
70915     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
70916     function sidebar(selection2) {
70917       var container = context.container();
70918       var minWidth = 240;
70919       var sidebarWidth;
70920       var containerWidth;
70921       var dragOffset;
70922       selection2.style("min-width", minWidth + "px").style("max-width", "400px").style("width", "33.3333%");
70923       var resizer = selection2.append("div").attr("class", "sidebar-resizer").on(_pointerPrefix + "down.sidebar-resizer", pointerdown);
70924       var downPointerId, lastClientX, containerLocGetter;
70925       function pointerdown(d3_event) {
70926         if (downPointerId)
70927           return;
70928         if ("button" in d3_event && d3_event.button !== 0)
70929           return;
70930         downPointerId = d3_event.pointerId || "mouse";
70931         lastClientX = d3_event.clientX;
70932         containerLocGetter = utilFastMouse(container.node());
70933         dragOffset = utilFastMouse(resizer.node())(d3_event)[0] - 1;
70934         sidebarWidth = selection2.node().getBoundingClientRect().width;
70935         containerWidth = container.node().getBoundingClientRect().width;
70936         var widthPct = sidebarWidth / containerWidth * 100;
70937         selection2.style("width", widthPct + "%").style("max-width", "85%");
70938         resizer.classed("dragging", true);
70939         select_default2(window).on("touchmove.sidebar-resizer", function(d3_event2) {
70940           d3_event2.preventDefault();
70941         }, { passive: false }).on(_pointerPrefix + "move.sidebar-resizer", pointermove).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", pointerup);
70942       }
70943       function pointermove(d3_event) {
70944         if (downPointerId !== (d3_event.pointerId || "mouse"))
70945           return;
70946         d3_event.preventDefault();
70947         var dx = d3_event.clientX - lastClientX;
70948         lastClientX = d3_event.clientX;
70949         var isRTL = _mainLocalizer.textDirection() === "rtl";
70950         var scaleX = isRTL ? 0 : 1;
70951         var xMarginProperty = isRTL ? "margin-right" : "margin-left";
70952         var x2 = containerLocGetter(d3_event)[0] - dragOffset;
70953         sidebarWidth = isRTL ? containerWidth - x2 : x2;
70954         var isCollapsed = selection2.classed("collapsed");
70955         var shouldCollapse = sidebarWidth < minWidth;
70956         selection2.classed("collapsed", shouldCollapse);
70957         if (shouldCollapse) {
70958           if (!isCollapsed) {
70959             selection2.style(xMarginProperty, "-400px").style("width", "400px");
70960             context.ui().onResize([(sidebarWidth - dx) * scaleX, 0]);
70961           }
70962         } else {
70963           var widthPct = sidebarWidth / containerWidth * 100;
70964           selection2.style(xMarginProperty, null).style("width", widthPct + "%");
70965           if (isCollapsed) {
70966             context.ui().onResize([-sidebarWidth * scaleX, 0]);
70967           } else {
70968             context.ui().onResize([-dx * scaleX, 0]);
70969           }
70970         }
70971       }
70972       function pointerup(d3_event) {
70973         if (downPointerId !== (d3_event.pointerId || "mouse"))
70974           return;
70975         downPointerId = null;
70976         resizer.classed("dragging", false);
70977         select_default2(window).on("touchmove.sidebar-resizer", null).on(_pointerPrefix + "move.sidebar-resizer", null).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", null);
70978       }
70979       var featureListWrap = selection2.append("div").attr("class", "feature-list-pane").call(uiFeatureList(context));
70980       var inspectorWrap = selection2.append("div").attr("class", "inspector-hidden inspector-wrap");
70981       var hoverModeSelect = function(targets) {
70982         context.container().selectAll(".feature-list-item button").classed("hover", false);
70983         if (context.selectedIDs().length > 1 && targets && targets.length) {
70984           var elements = context.container().selectAll(".feature-list-item button").filter(function(node) {
70985             return targets.indexOf(node) !== -1;
70986           });
70987           if (!elements.empty()) {
70988             elements.classed("hover", true);
70989           }
70990         }
70991       };
70992       sidebar.hoverModeSelect = throttle_default(hoverModeSelect, 200);
70993       function hover(targets) {
70994         var datum2 = targets && targets.length && targets[0];
70995         if (datum2 && datum2.__featurehash__) {
70996           _wasData = true;
70997           sidebar.show(dataEditor.datum(datum2));
70998           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
70999         } else if (datum2 instanceof osmNote) {
71000           if (context.mode().id === "drag-note")
71001             return;
71002           _wasNote = true;
71003           var osm = services.osm;
71004           if (osm) {
71005             datum2 = osm.getNote(datum2.id);
71006           }
71007           sidebar.show(noteEditor.note(datum2));
71008           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
71009         } else if (datum2 instanceof QAItem) {
71010           _wasQaItem = true;
71011           var errService = services[datum2.service];
71012           if (errService) {
71013             datum2 = errService.getError(datum2.id);
71014           }
71015           var errEditor;
71016           if (datum2.service === "keepRight") {
71017             errEditor = keepRightEditor;
71018           } else if (datum2.service === "osmose") {
71019             errEditor = osmoseEditor;
71020           } else {
71021             errEditor = improveOsmEditor;
71022           }
71023           context.container().selectAll(".qaItem." + datum2.service).classed("hover", function(d2) {
71024             return d2.id === datum2.id;
71025           });
71026           sidebar.show(errEditor.error(datum2));
71027           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
71028         } else if (!_current && datum2 instanceof osmEntity) {
71029           featureListWrap.classed("inspector-hidden", true);
71030           inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", true);
71031           if (!inspector.entityIDs() || !utilArrayIdentical(inspector.entityIDs(), [datum2.id]) || inspector.state() !== "hover") {
71032             inspector.state("hover").entityIDs([datum2.id]).newFeature(false);
71033             inspectorWrap.call(inspector);
71034           }
71035         } else if (!_current) {
71036           featureListWrap.classed("inspector-hidden", false);
71037           inspectorWrap.classed("inspector-hidden", true);
71038           inspector.state("hide");
71039         } else if (_wasData || _wasNote || _wasQaItem) {
71040           _wasNote = false;
71041           _wasData = false;
71042           _wasQaItem = false;
71043           context.container().selectAll(".note").classed("hover", false);
71044           context.container().selectAll(".qaItem").classed("hover", false);
71045           sidebar.hide();
71046         }
71047       }
71048       sidebar.hover = throttle_default(hover, 200);
71049       sidebar.intersects = function(extent) {
71050         var rect = selection2.node().getBoundingClientRect();
71051         return extent.intersects([
71052           context.projection.invert([0, rect.height]),
71053           context.projection.invert([rect.width, 0])
71054         ]);
71055       };
71056       sidebar.select = function(ids, newFeature) {
71057         sidebar.hide();
71058         if (ids && ids.length) {
71059           var entity = ids.length === 1 && context.entity(ids[0]);
71060           if (entity && newFeature && selection2.classed("collapsed")) {
71061             var extent = entity.extent(context.graph());
71062             sidebar.expand(sidebar.intersects(extent));
71063           }
71064           featureListWrap.classed("inspector-hidden", true);
71065           inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", false);
71066           inspector.state("select").entityIDs(ids).newFeature(newFeature);
71067           inspectorWrap.call(inspector);
71068         } else {
71069           inspector.state("hide");
71070         }
71071       };
71072       sidebar.showPresetList = function() {
71073         inspector.showList();
71074       };
71075       sidebar.show = function(component, element) {
71076         featureListWrap.classed("inspector-hidden", true);
71077         inspectorWrap.classed("inspector-hidden", true);
71078         if (_current)
71079           _current.remove();
71080         _current = selection2.append("div").attr("class", "sidebar-component").call(component, element);
71081       };
71082       sidebar.hide = function() {
71083         featureListWrap.classed("inspector-hidden", false);
71084         inspectorWrap.classed("inspector-hidden", true);
71085         if (_current)
71086           _current.remove();
71087         _current = null;
71088       };
71089       sidebar.expand = function(moveMap) {
71090         if (selection2.classed("collapsed")) {
71091           sidebar.toggle(moveMap);
71092         }
71093       };
71094       sidebar.collapse = function(moveMap) {
71095         if (!selection2.classed("collapsed")) {
71096           sidebar.toggle(moveMap);
71097         }
71098       };
71099       sidebar.toggle = function(moveMap) {
71100         if (context.inIntro())
71101           return;
71102         var isCollapsed = selection2.classed("collapsed");
71103         var isCollapsing = !isCollapsed;
71104         var isRTL = _mainLocalizer.textDirection() === "rtl";
71105         var scaleX = isRTL ? 0 : 1;
71106         var xMarginProperty = isRTL ? "margin-right" : "margin-left";
71107         sidebarWidth = selection2.node().getBoundingClientRect().width;
71108         selection2.style("width", sidebarWidth + "px");
71109         var startMargin, endMargin, lastMargin;
71110         if (isCollapsing) {
71111           startMargin = lastMargin = 0;
71112           endMargin = -sidebarWidth;
71113         } else {
71114           startMargin = lastMargin = -sidebarWidth;
71115           endMargin = 0;
71116         }
71117         if (!isCollapsing) {
71118           selection2.classed("collapsed", isCollapsing);
71119         }
71120         selection2.transition().style(xMarginProperty, endMargin + "px").tween("panner", function() {
71121           var i3 = number_default(startMargin, endMargin);
71122           return function(t2) {
71123             var dx = lastMargin - Math.round(i3(t2));
71124             lastMargin = lastMargin - dx;
71125             context.ui().onResize(moveMap ? void 0 : [dx * scaleX, 0]);
71126           };
71127         }).on("end", function() {
71128           if (isCollapsing) {
71129             selection2.classed("collapsed", isCollapsing);
71130           }
71131           if (!isCollapsing) {
71132             var containerWidth2 = container.node().getBoundingClientRect().width;
71133             var widthPct = sidebarWidth / containerWidth2 * 100;
71134             selection2.style(xMarginProperty, null).style("width", widthPct + "%");
71135           }
71136         });
71137       };
71138       resizer.on("dblclick", function(d3_event) {
71139         d3_event.preventDefault();
71140         if (d3_event.sourceEvent) {
71141           d3_event.sourceEvent.preventDefault();
71142         }
71143         sidebar.toggle();
71144       });
71145       context.map().on("crossEditableZoom.sidebar", function(within) {
71146         if (!within && !selection2.select(".inspector-hover").empty()) {
71147           hover([]);
71148         }
71149       });
71150     }
71151     sidebar.showPresetList = function() {
71152     };
71153     sidebar.hover = function() {
71154     };
71155     sidebar.hover.cancel = function() {
71156     };
71157     sidebar.intersects = function() {
71158     };
71159     sidebar.select = function() {
71160     };
71161     sidebar.show = function() {
71162     };
71163     sidebar.hide = function() {
71164     };
71165     sidebar.expand = function() {
71166     };
71167     sidebar.collapse = function() {
71168     };
71169     sidebar.toggle = function() {
71170     };
71171     return sidebar;
71172   }
71173
71174   // modules/modes/draw_area.js
71175   function modeDrawArea(context, wayID, startGraph, button) {
71176     var mode = {
71177       button,
71178       id: "draw-area"
71179     };
71180     var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawArea", function() {
71181       context.ui().flash.iconName("#iD-icon-no").label(_t.append("self_intersection.error.areas"))();
71182     });
71183     mode.wayID = wayID;
71184     mode.enter = function() {
71185       context.install(behavior);
71186     };
71187     mode.exit = function() {
71188       context.uninstall(behavior);
71189     };
71190     mode.selectedIDs = function() {
71191       return [wayID];
71192     };
71193     mode.activeID = function() {
71194       return behavior && behavior.activeID() || [];
71195     };
71196     return mode;
71197   }
71198
71199   // modules/modes/add_area.js
71200   function modeAddArea(context, mode) {
71201     mode.id = "add-area";
71202     var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
71203     function defaultTags(loc) {
71204       var defaultTags2 = { area: "yes" };
71205       if (mode.preset)
71206         defaultTags2 = mode.preset.setTags(defaultTags2, "area", false, loc);
71207       return defaultTags2;
71208     }
71209     function actionClose(wayId) {
71210       return function(graph) {
71211         return graph.replace(graph.entity(wayId).close());
71212       };
71213     }
71214     function start2(loc) {
71215       var startGraph = context.graph();
71216       var node = osmNode({ loc });
71217       var way = osmWay({ tags: defaultTags(loc) });
71218       context.perform(
71219         actionAddEntity(node),
71220         actionAddEntity(way),
71221         actionAddVertex(way.id, node.id),
71222         actionClose(way.id)
71223       );
71224       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
71225     }
71226     function startFromWay(loc, edge) {
71227       var startGraph = context.graph();
71228       var node = osmNode({ loc });
71229       var way = osmWay({ tags: defaultTags(loc) });
71230       context.perform(
71231         actionAddEntity(node),
71232         actionAddEntity(way),
71233         actionAddVertex(way.id, node.id),
71234         actionClose(way.id),
71235         actionAddMidpoint({ loc, edge }, node)
71236       );
71237       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
71238     }
71239     function startFromNode(node) {
71240       var startGraph = context.graph();
71241       var way = osmWay({ tags: defaultTags(node.loc) });
71242       context.perform(
71243         actionAddEntity(way),
71244         actionAddVertex(way.id, node.id),
71245         actionClose(way.id)
71246       );
71247       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
71248     }
71249     mode.enter = function() {
71250       context.install(behavior);
71251     };
71252     mode.exit = function() {
71253       context.uninstall(behavior);
71254     };
71255     return mode;
71256   }
71257
71258   // modules/modes/add_line.js
71259   function modeAddLine(context, mode) {
71260     mode.id = "add-line";
71261     var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
71262     function defaultTags(loc) {
71263       var defaultTags2 = {};
71264       if (mode.preset)
71265         defaultTags2 = mode.preset.setTags(defaultTags2, "line", false, loc);
71266       return defaultTags2;
71267     }
71268     function start2(loc) {
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       );
71277       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
71278     }
71279     function startFromWay(loc, edge) {
71280       var startGraph = context.graph();
71281       var node = osmNode({ loc });
71282       var way = osmWay({ tags: defaultTags(loc) });
71283       context.perform(
71284         actionAddEntity(node),
71285         actionAddEntity(way),
71286         actionAddVertex(way.id, node.id),
71287         actionAddMidpoint({ loc, edge }, node)
71288       );
71289       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
71290     }
71291     function startFromNode(node) {
71292       var startGraph = context.graph();
71293       var way = osmWay({ tags: defaultTags(node.loc) });
71294       context.perform(
71295         actionAddEntity(way),
71296         actionAddVertex(way.id, node.id)
71297       );
71298       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
71299     }
71300     mode.enter = function() {
71301       context.install(behavior);
71302     };
71303     mode.exit = function() {
71304       context.uninstall(behavior);
71305     };
71306     return mode;
71307   }
71308
71309   // modules/modes/add_point.js
71310   function modeAddPoint(context, mode) {
71311     mode.id = "add-point";
71312     var behavior = behaviorDraw(context).on("click", add).on("clickWay", addWay).on("clickNode", addNode).on("cancel", cancel).on("finish", cancel);
71313     function defaultTags(loc) {
71314       var defaultTags2 = {};
71315       if (mode.preset)
71316         defaultTags2 = mode.preset.setTags(defaultTags2, "point", false, loc);
71317       return defaultTags2;
71318     }
71319     function add(loc) {
71320       var node = osmNode({ loc, tags: defaultTags(loc) });
71321       context.perform(
71322         actionAddEntity(node),
71323         _t("operations.add.annotation.point")
71324       );
71325       enterSelectMode(node);
71326     }
71327     function addWay(loc, edge) {
71328       var node = osmNode({ tags: defaultTags(loc) });
71329       context.perform(
71330         actionAddMidpoint({ loc, edge }, node),
71331         _t("operations.add.annotation.vertex")
71332       );
71333       enterSelectMode(node);
71334     }
71335     function enterSelectMode(node) {
71336       context.enter(
71337         modeSelect(context, [node.id]).newFeature(true)
71338       );
71339     }
71340     function addNode(node) {
71341       const _defaultTags = defaultTags(node.loc);
71342       if (Object.keys(_defaultTags).length === 0) {
71343         enterSelectMode(node);
71344         return;
71345       }
71346       var tags = Object.assign({}, node.tags);
71347       for (var key in _defaultTags) {
71348         tags[key] = _defaultTags[key];
71349       }
71350       context.perform(
71351         actionChangeTags(node.id, tags),
71352         _t("operations.add.annotation.point")
71353       );
71354       enterSelectMode(node);
71355     }
71356     function cancel() {
71357       context.enter(modeBrowse(context));
71358     }
71359     mode.enter = function() {
71360       context.install(behavior);
71361     };
71362     mode.exit = function() {
71363       context.uninstall(behavior);
71364     };
71365     return mode;
71366   }
71367
71368   // modules/modes/select_note.js
71369   function modeSelectNote(context, selectedNoteID) {
71370     var mode = {
71371       id: "select-note",
71372       button: "browse"
71373     };
71374     var _keybinding = utilKeybinding("select-note");
71375     var _noteEditor = uiNoteEditor(context).on("change", function() {
71376       context.map().pan([0, 0]);
71377       var note = checkSelectedID();
71378       if (!note)
71379         return;
71380       context.ui().sidebar.show(_noteEditor.note(note));
71381     });
71382     var _behaviors = [
71383       behaviorBreathe(context),
71384       behaviorHover(context),
71385       behaviorSelect(context),
71386       behaviorLasso(context),
71387       modeDragNode(context).behavior,
71388       modeDragNote(context).behavior
71389     ];
71390     var _newFeature = false;
71391     function checkSelectedID() {
71392       if (!services.osm)
71393         return;
71394       var note = services.osm.getNote(selectedNoteID);
71395       if (!note) {
71396         context.enter(modeBrowse(context));
71397       }
71398       return note;
71399     }
71400     function selectNote(d3_event, drawn) {
71401       if (!checkSelectedID())
71402         return;
71403       var selection2 = context.surface().selectAll(".layer-notes .note-" + selectedNoteID);
71404       if (selection2.empty()) {
71405         var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
71406         if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
71407           context.enter(modeBrowse(context));
71408         }
71409       } else {
71410         selection2.classed("selected", true);
71411         context.selectedNoteID(selectedNoteID);
71412       }
71413     }
71414     function esc() {
71415       if (context.container().select(".combobox").size())
71416         return;
71417       context.enter(modeBrowse(context));
71418     }
71419     mode.zoomToSelected = function() {
71420       if (!services.osm)
71421         return;
71422       var note = services.osm.getNote(selectedNoteID);
71423       if (note) {
71424         context.map().centerZoomEase(note.loc, 20);
71425       }
71426     };
71427     mode.newFeature = function(val) {
71428       if (!arguments.length)
71429         return _newFeature;
71430       _newFeature = val;
71431       return mode;
71432     };
71433     mode.enter = function() {
71434       var note = checkSelectedID();
71435       if (!note)
71436         return;
71437       _behaviors.forEach(context.install);
71438       _keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
71439       select_default2(document).call(_keybinding);
71440       selectNote();
71441       var sidebar = context.ui().sidebar;
71442       sidebar.show(_noteEditor.note(note).newNote(_newFeature));
71443       sidebar.expand(sidebar.intersects(note.extent()));
71444       context.map().on("drawn.select", selectNote);
71445     };
71446     mode.exit = function() {
71447       _behaviors.forEach(context.uninstall);
71448       select_default2(document).call(_keybinding.unbind);
71449       context.surface().selectAll(".layer-notes .selected").classed("selected hover", false);
71450       context.map().on("drawn.select", null);
71451       context.ui().sidebar.hide();
71452       context.selectedNoteID(null);
71453     };
71454     return mode;
71455   }
71456
71457   // modules/modes/add_note.js
71458   function modeAddNote(context) {
71459     var mode = {
71460       id: "add-note",
71461       button: "note",
71462       description: _t.append("modes.add_note.description"),
71463       key: _t("modes.add_note.key")
71464     };
71465     var behavior = behaviorDraw(context).on("click", add).on("cancel", cancel).on("finish", cancel);
71466     function add(loc) {
71467       var osm = services.osm;
71468       if (!osm)
71469         return;
71470       var note = osmNote({ loc, status: "open", comments: [] });
71471       osm.replaceNote(note);
71472       context.map().pan([0, 0]);
71473       context.selectedNoteID(note.id).enter(modeSelectNote(context, note.id).newFeature(true));
71474     }
71475     function cancel() {
71476       context.enter(modeBrowse(context));
71477     }
71478     mode.enter = function() {
71479       context.install(behavior);
71480     };
71481     mode.exit = function() {
71482       context.uninstall(behavior);
71483     };
71484     return mode;
71485   }
71486
71487   // modules/modes/save.js
71488   function modeSave(context) {
71489     var mode = { id: "save" };
71490     var keybinding = utilKeybinding("modeSave");
71491     var commit = uiCommit(context).on("cancel", cancel);
71492     var _conflictsUi;
71493     var _location;
71494     var _success;
71495     var uploader = context.uploader().on("saveStarted.modeSave", function() {
71496       keybindingOff();
71497     }).on("willAttemptUpload.modeSave", prepareForSuccess).on("progressChanged.modeSave", showProgress).on("resultNoChanges.modeSave", function() {
71498       cancel();
71499     }).on("resultErrors.modeSave", showErrors).on("resultConflicts.modeSave", showConflicts).on("resultSuccess.modeSave", showSuccess);
71500     function cancel() {
71501       context.enter(modeBrowse(context));
71502     }
71503     function showProgress(num, total) {
71504       var modal = context.container().select(".loading-modal .modal-section");
71505       var progress = modal.selectAll(".progress").data([0]);
71506       progress.enter().append("div").attr("class", "progress").merge(progress).text(_t("save.conflict_progress", { num, total }));
71507     }
71508     function showConflicts(changeset, conflicts, origChanges) {
71509       var selection2 = context.container().select(".sidebar").append("div").attr("class", "sidebar-component");
71510       context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
71511       _conflictsUi = uiConflicts(context).conflictList(conflicts).origChanges(origChanges).on("cancel", function() {
71512         context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
71513         selection2.remove();
71514         keybindingOn();
71515         uploader.cancelConflictResolution();
71516       }).on("save", function() {
71517         context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
71518         selection2.remove();
71519         uploader.processResolvedConflicts(changeset);
71520       });
71521       selection2.call(_conflictsUi);
71522     }
71523     function showErrors(errors) {
71524       keybindingOn();
71525       var selection2 = uiConfirm(context.container());
71526       selection2.select(".modal-section.header").append("h3").text(_t("save.error"));
71527       addErrors(selection2, errors);
71528       selection2.okButton();
71529     }
71530     function addErrors(selection2, data) {
71531       var message = selection2.select(".modal-section.message-text");
71532       var items = message.selectAll(".error-container").data(data);
71533       var enter = items.enter().append("div").attr("class", "error-container");
71534       enter.append("a").attr("class", "error-description").attr("href", "#").classed("hide-toggle", true).text(function(d2) {
71535         return d2.msg || _t("save.unknown_error_details");
71536       }).on("click", function(d3_event) {
71537         d3_event.preventDefault();
71538         var error = select_default2(this);
71539         var detail = select_default2(this.nextElementSibling);
71540         var exp2 = error.classed("expanded");
71541         detail.style("display", exp2 ? "none" : "block");
71542         error.classed("expanded", !exp2);
71543       });
71544       var details = enter.append("div").attr("class", "error-detail-container").style("display", "none");
71545       details.append("ul").attr("class", "error-detail-list").selectAll("li").data(function(d2) {
71546         return d2.details || [];
71547       }).enter().append("li").attr("class", "error-detail-item").text(function(d2) {
71548         return d2;
71549       });
71550       items.exit().remove();
71551     }
71552     function showSuccess(changeset) {
71553       commit.reset();
71554       var ui = _success.changeset(changeset).location(_location).on("cancel", function() {
71555         context.ui().sidebar.hide();
71556       });
71557       context.enter(modeBrowse(context).sidebar(ui));
71558     }
71559     function keybindingOn() {
71560       select_default2(document).call(keybinding.on("\u238B", cancel, true));
71561     }
71562     function keybindingOff() {
71563       select_default2(document).call(keybinding.unbind);
71564     }
71565     function prepareForSuccess() {
71566       _success = uiSuccess(context);
71567       _location = null;
71568       if (!services.geocoder)
71569         return;
71570       services.geocoder.reverse(context.map().center(), function(err, result) {
71571         if (err || !result || !result.address)
71572           return;
71573         var addr = result.address;
71574         var place = addr && (addr.town || addr.city || addr.county) || "";
71575         var region = addr && (addr.state || addr.country) || "";
71576         var separator = place && region ? _t("success.thank_you_where.separator") : "";
71577         _location = _t(
71578           "success.thank_you_where.format",
71579           { place, separator, region }
71580         );
71581       });
71582     }
71583     mode.selectedIDs = function() {
71584       return _conflictsUi ? _conflictsUi.shownEntityIds() : [];
71585     };
71586     mode.enter = function() {
71587       context.ui().sidebar.expand();
71588       function done() {
71589         context.ui().sidebar.show(commit);
71590       }
71591       keybindingOn();
71592       context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
71593       var osm = context.connection();
71594       if (!osm) {
71595         cancel();
71596         return;
71597       }
71598       if (osm.authenticated()) {
71599         done();
71600       } else {
71601         osm.authenticate(function(err) {
71602           if (err) {
71603             cancel();
71604           } else {
71605             done();
71606           }
71607         });
71608       }
71609     };
71610     mode.exit = function() {
71611       keybindingOff();
71612       context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
71613       context.ui().sidebar.hide();
71614     };
71615     return mode;
71616   }
71617
71618   // modules/modes/select_error.js
71619   function modeSelectError(context, selectedErrorID, selectedErrorService) {
71620     var mode = {
71621       id: "select-error",
71622       button: "browse"
71623     };
71624     var keybinding = utilKeybinding("select-error");
71625     var errorService = services[selectedErrorService];
71626     var errorEditor;
71627     switch (selectedErrorService) {
71628       case "improveOSM":
71629         errorEditor = uiImproveOsmEditor(context).on("change", function() {
71630           context.map().pan([0, 0]);
71631           var error = checkSelectedID();
71632           if (!error)
71633             return;
71634           context.ui().sidebar.show(errorEditor.error(error));
71635         });
71636         break;
71637       case "keepRight":
71638         errorEditor = uiKeepRightEditor(context).on("change", function() {
71639           context.map().pan([0, 0]);
71640           var error = checkSelectedID();
71641           if (!error)
71642             return;
71643           context.ui().sidebar.show(errorEditor.error(error));
71644         });
71645         break;
71646       case "osmose":
71647         errorEditor = uiOsmoseEditor(context).on("change", function() {
71648           context.map().pan([0, 0]);
71649           var error = checkSelectedID();
71650           if (!error)
71651             return;
71652           context.ui().sidebar.show(errorEditor.error(error));
71653         });
71654         break;
71655     }
71656     var behaviors = [
71657       behaviorBreathe(context),
71658       behaviorHover(context),
71659       behaviorSelect(context),
71660       behaviorLasso(context),
71661       modeDragNode(context).behavior,
71662       modeDragNote(context).behavior
71663     ];
71664     function checkSelectedID() {
71665       if (!errorService)
71666         return;
71667       var error = errorService.getError(selectedErrorID);
71668       if (!error) {
71669         context.enter(modeBrowse(context));
71670       }
71671       return error;
71672     }
71673     mode.zoomToSelected = function() {
71674       if (!errorService)
71675         return;
71676       var error = errorService.getError(selectedErrorID);
71677       if (error) {
71678         context.map().centerZoomEase(error.loc, 20);
71679       }
71680     };
71681     mode.enter = function() {
71682       var error = checkSelectedID();
71683       if (!error)
71684         return;
71685       behaviors.forEach(context.install);
71686       keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
71687       select_default2(document).call(keybinding);
71688       selectError();
71689       var sidebar = context.ui().sidebar;
71690       sidebar.show(errorEditor.error(error));
71691       context.map().on("drawn.select-error", selectError);
71692       function selectError(d3_event, drawn) {
71693         if (!checkSelectedID())
71694           return;
71695         var selection2 = context.surface().selectAll(".itemId-" + selectedErrorID + "." + selectedErrorService);
71696         if (selection2.empty()) {
71697           var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
71698           if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
71699             context.enter(modeBrowse(context));
71700           }
71701         } else {
71702           selection2.classed("selected", true);
71703           context.selectedErrorID(selectedErrorID);
71704         }
71705       }
71706       function esc() {
71707         if (context.container().select(".combobox").size())
71708           return;
71709         context.enter(modeBrowse(context));
71710       }
71711     };
71712     mode.exit = function() {
71713       behaviors.forEach(context.uninstall);
71714       select_default2(document).call(keybinding.unbind);
71715       context.surface().selectAll(".qaItem.selected").classed("selected hover", false);
71716       context.map().on("drawn.select-error", null);
71717       context.ui().sidebar.hide();
71718       context.selectedErrorID(null);
71719       context.features().forceVisible([]);
71720     };
71721     return mode;
71722   }
71723
71724   // modules/ui/tools/modes.js
71725   function uiToolDrawModes(context) {
71726     var tool = {
71727       id: "old_modes",
71728       label: _t.append("toolbar.add_feature")
71729     };
71730     var modes = [
71731       modeAddPoint(context, {
71732         title: _t.append("modes.add_point.title"),
71733         button: "point",
71734         description: _t.append("modes.add_point.description"),
71735         preset: _mainPresetIndex.item("point"),
71736         key: "1"
71737       }),
71738       modeAddLine(context, {
71739         title: _t.append("modes.add_line.title"),
71740         button: "line",
71741         description: _t.append("modes.add_line.description"),
71742         preset: _mainPresetIndex.item("line"),
71743         key: "2"
71744       }),
71745       modeAddArea(context, {
71746         title: _t.append("modes.add_area.title"),
71747         button: "area",
71748         description: _t.append("modes.add_area.description"),
71749         preset: _mainPresetIndex.item("area"),
71750         key: "3"
71751       })
71752     ];
71753     function enabled(_mode) {
71754       return osmEditable();
71755     }
71756     function osmEditable() {
71757       return context.editable();
71758     }
71759     modes.forEach(function(mode) {
71760       context.keybinding().on(mode.key, function() {
71761         if (!enabled(mode))
71762           return;
71763         if (mode.id === context.mode().id) {
71764           context.enter(modeBrowse(context));
71765         } else {
71766           context.enter(mode);
71767         }
71768       });
71769     });
71770     tool.render = function(selection2) {
71771       var wrap2 = selection2.append("div").attr("class", "joined").style("display", "flex");
71772       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
71773       context.map().on("move.modes", debouncedUpdate).on("drawn.modes", debouncedUpdate);
71774       context.on("enter.modes", update);
71775       update();
71776       function update() {
71777         var buttons = wrap2.selectAll("button.add-button").data(modes, function(d2) {
71778           return d2.id;
71779         });
71780         buttons.exit().remove();
71781         var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
71782           return d2.id + " add-button bar-button";
71783         }).on("click.mode-buttons", function(d3_event, d2) {
71784           if (!enabled(d2))
71785             return;
71786           var currMode = context.mode().id;
71787           if (/^draw/.test(currMode))
71788             return;
71789           if (d2.id === currMode) {
71790             context.enter(modeBrowse(context));
71791           } else {
71792             context.enter(d2);
71793           }
71794         }).call(
71795           uiTooltip().placement("bottom").title(function(d2) {
71796             return d2.description;
71797           }).keys(function(d2) {
71798             return [d2.key];
71799           }).scrollContainer(context.container().select(".top-toolbar"))
71800         );
71801         buttonsEnter.each(function(d2) {
71802           select_default2(this).call(svgIcon("#iD-icon-" + d2.button));
71803         });
71804         buttonsEnter.append("span").attr("class", "label").text("").each(function(mode) {
71805           mode.title(select_default2(this));
71806         });
71807         if (buttons.enter().size() || buttons.exit().size()) {
71808           context.ui().checkOverflow(".top-toolbar", true);
71809         }
71810         buttons = buttons.merge(buttonsEnter).attr("aria-disabled", function(d2) {
71811           return !enabled(d2);
71812         }).classed("disabled", function(d2) {
71813           return !enabled(d2);
71814         }).attr("aria-pressed", function(d2) {
71815           return context.mode() && context.mode().button === d2.button;
71816         }).classed("active", function(d2) {
71817           return context.mode() && context.mode().button === d2.button;
71818         });
71819       }
71820     };
71821     return tool;
71822   }
71823
71824   // modules/ui/tools/notes.js
71825   function uiToolNotes(context) {
71826     var tool = {
71827       id: "notes",
71828       label: _t.append("modes.add_note.label")
71829     };
71830     var mode = modeAddNote(context);
71831     function enabled() {
71832       return notesEnabled() && notesEditable();
71833     }
71834     function notesEnabled() {
71835       var noteLayer = context.layers().layer("notes");
71836       return noteLayer && noteLayer.enabled();
71837     }
71838     function notesEditable() {
71839       var mode2 = context.mode();
71840       return context.map().notesEditable() && mode2 && mode2.id !== "save";
71841     }
71842     context.keybinding().on(mode.key, function() {
71843       if (!enabled())
71844         return;
71845       if (mode.id === context.mode().id) {
71846         context.enter(modeBrowse(context));
71847       } else {
71848         context.enter(mode);
71849       }
71850     });
71851     tool.render = function(selection2) {
71852       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
71853       context.map().on("move.notes", debouncedUpdate).on("drawn.notes", debouncedUpdate);
71854       context.on("enter.notes", update);
71855       update();
71856       function update() {
71857         var showNotes = notesEnabled();
71858         var data = showNotes ? [mode] : [];
71859         var buttons = selection2.selectAll("button.add-button").data(data, function(d2) {
71860           return d2.id;
71861         });
71862         buttons.exit().remove();
71863         var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
71864           return d2.id + " add-button bar-button";
71865         }).on("click.notes", function(d3_event, d2) {
71866           if (!enabled())
71867             return;
71868           var currMode = context.mode().id;
71869           if (/^draw/.test(currMode))
71870             return;
71871           if (d2.id === currMode) {
71872             context.enter(modeBrowse(context));
71873           } else {
71874             context.enter(d2);
71875           }
71876         }).call(
71877           uiTooltip().placement("bottom").title(function(d2) {
71878             return d2.description;
71879           }).keys(function(d2) {
71880             return [d2.key];
71881           }).scrollContainer(context.container().select(".top-toolbar"))
71882         );
71883         buttonsEnter.each(function(d2) {
71884           select_default2(this).call(svgIcon(d2.icon || "#iD-icon-" + d2.button));
71885         });
71886         if (buttons.enter().size() || buttons.exit().size()) {
71887           context.ui().checkOverflow(".top-toolbar", true);
71888         }
71889         buttons = buttons.merge(buttonsEnter).classed("disabled", function() {
71890           return !enabled();
71891         }).attr("aria-disabled", function() {
71892           return !enabled();
71893         }).classed("active", function(d2) {
71894           return context.mode() && context.mode().button === d2.button;
71895         }).attr("aria-pressed", function(d2) {
71896           return context.mode() && context.mode().button === d2.button;
71897         });
71898       }
71899     };
71900     tool.uninstall = function() {
71901       context.on("enter.editor.notes", null).on("exit.editor.notes", null).on("enter.notes", null);
71902       context.map().on("move.notes", null).on("drawn.notes", null);
71903     };
71904     return tool;
71905   }
71906
71907   // modules/ui/tools/save.js
71908   function uiToolSave(context) {
71909     var tool = {
71910       id: "save",
71911       label: _t.append("save.title")
71912     };
71913     var button = null;
71914     var tooltipBehavior = null;
71915     var history = context.history();
71916     var key = uiCmd("\u2318S");
71917     var _numChanges = 0;
71918     function isSaving() {
71919       var mode = context.mode();
71920       return mode && mode.id === "save";
71921     }
71922     function isDisabled() {
71923       return _numChanges === 0 || isSaving();
71924     }
71925     function save(d3_event) {
71926       d3_event.preventDefault();
71927       if (!context.inIntro() && !isSaving() && history.hasChanges()) {
71928         context.enter(modeSave(context));
71929       }
71930     }
71931     function bgColor(numChanges) {
71932       var step;
71933       if (numChanges === 0) {
71934         return null;
71935       } else if (numChanges <= 50) {
71936         step = numChanges / 50;
71937         return rgb_default("#fff", "#ff8")(step);
71938       } else {
71939         step = Math.min((numChanges - 50) / 50, 1);
71940         return rgb_default("#ff8", "#f88")(step);
71941       }
71942     }
71943     function updateCount() {
71944       var val = history.difference().summary().length;
71945       if (val === _numChanges)
71946         return;
71947       _numChanges = val;
71948       if (tooltipBehavior) {
71949         tooltipBehavior.title(() => _t.append(_numChanges > 0 ? "save.help" : "save.no_changes")).keys([key]);
71950       }
71951       if (button) {
71952         button.classed("disabled", isDisabled()).style("background", bgColor(_numChanges));
71953         button.select("span.count").text(_numChanges);
71954       }
71955     }
71956     tool.render = function(selection2) {
71957       tooltipBehavior = uiTooltip().placement("bottom").title(() => _t.append("save.no_changes")).keys([key]).scrollContainer(context.container().select(".top-toolbar"));
71958       var lastPointerUpType;
71959       button = selection2.append("button").attr("class", "save disabled bar-button").on("pointerup", function(d3_event) {
71960         lastPointerUpType = d3_event.pointerType;
71961       }).on("click", function(d3_event) {
71962         save(d3_event);
71963         if (_numChanges === 0 && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
71964           context.ui().flash.duration(2e3).iconName("#iD-icon-save").iconClass("disabled").label(_t.append("save.no_changes"))();
71965         }
71966         lastPointerUpType = null;
71967       }).call(tooltipBehavior);
71968       button.call(svgIcon("#iD-icon-save"));
71969       button.append("span").attr("class", "count").attr("aria-hidden", "true").text("0");
71970       updateCount();
71971       context.keybinding().on(key, save, true);
71972       context.history().on("change.save", updateCount);
71973       context.on("enter.save", function() {
71974         if (button) {
71975           button.classed("disabled", isDisabled());
71976           if (isSaving()) {
71977             button.call(tooltipBehavior.hide);
71978           }
71979         }
71980       });
71981     };
71982     tool.uninstall = function() {
71983       context.keybinding().off(key, true);
71984       context.history().on("change.save", null);
71985       context.on("enter.save", null);
71986       button = null;
71987       tooltipBehavior = null;
71988     };
71989     return tool;
71990   }
71991
71992   // modules/ui/tools/sidebar_toggle.js
71993   function uiToolSidebarToggle(context) {
71994     var tool = {
71995       id: "sidebar_toggle",
71996       label: _t.append("toolbar.inspect")
71997     };
71998     tool.render = function(selection2) {
71999       selection2.append("button").attr("class", "bar-button").attr("aria-label", _t("sidebar.tooltip")).on("click", function() {
72000         context.ui().sidebar.toggle();
72001       }).call(
72002         uiTooltip().placement("bottom").title(() => _t.append("sidebar.tooltip")).keys([_t("sidebar.key")]).scrollContainer(context.container().select(".top-toolbar"))
72003       ).call(svgIcon("#iD-icon-sidebar-" + (_mainLocalizer.textDirection() === "rtl" ? "right" : "left")));
72004     };
72005     return tool;
72006   }
72007
72008   // modules/ui/tools/undo_redo.js
72009   function uiToolUndoRedo(context) {
72010     var tool = {
72011       id: "undo_redo",
72012       label: _t.append("toolbar.undo_redo")
72013     };
72014     var commands = [{
72015       id: "undo",
72016       cmd: uiCmd("\u2318Z"),
72017       action: function() {
72018         context.undo();
72019       },
72020       annotation: function() {
72021         return context.history().undoAnnotation();
72022       },
72023       icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")
72024     }, {
72025       id: "redo",
72026       cmd: uiCmd("\u2318\u21E7Z"),
72027       action: function() {
72028         context.redo();
72029       },
72030       annotation: function() {
72031         return context.history().redoAnnotation();
72032       },
72033       icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "undo" : "redo")
72034     }];
72035     function editable() {
72036       return context.mode() && context.mode().id !== "save" && context.map().editableDataEnabled(
72037         true
72038         /* ignore min zoom */
72039       );
72040     }
72041     tool.render = function(selection2) {
72042       var tooltipBehavior = uiTooltip().placement("bottom").title(function(d2) {
72043         return d2.annotation() ? _t.append(d2.id + ".tooltip", { action: d2.annotation() }) : _t.append(d2.id + ".nothing");
72044       }).keys(function(d2) {
72045         return [d2.cmd];
72046       }).scrollContainer(context.container().select(".top-toolbar"));
72047       var lastPointerUpType;
72048       var buttons = selection2.selectAll("button").data(commands).enter().append("button").attr("class", function(d2) {
72049         return "disabled " + d2.id + "-button bar-button";
72050       }).on("pointerup", function(d3_event) {
72051         lastPointerUpType = d3_event.pointerType;
72052       }).on("click", function(d3_event, d2) {
72053         d3_event.preventDefault();
72054         var annotation = d2.annotation();
72055         if (editable() && annotation) {
72056           d2.action();
72057         }
72058         if (editable() && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
72059           var label = annotation ? _t.append(d2.id + ".tooltip", { action: annotation }) : _t.append(d2.id + ".nothing");
72060           context.ui().flash.duration(2e3).iconName("#" + d2.icon).iconClass(annotation ? "" : "disabled").label(label)();
72061         }
72062         lastPointerUpType = null;
72063       }).call(tooltipBehavior);
72064       buttons.each(function(d2) {
72065         select_default2(this).call(svgIcon("#" + d2.icon));
72066       });
72067       context.keybinding().on(commands[0].cmd, function(d3_event) {
72068         d3_event.preventDefault();
72069         if (editable())
72070           commands[0].action();
72071       }).on(commands[1].cmd, function(d3_event) {
72072         d3_event.preventDefault();
72073         if (editable())
72074           commands[1].action();
72075       });
72076       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
72077       context.map().on("move.undo_redo", debouncedUpdate).on("drawn.undo_redo", debouncedUpdate);
72078       context.history().on("change.undo_redo", function(difference) {
72079         if (difference)
72080           update();
72081       });
72082       context.on("enter.undo_redo", update);
72083       function update() {
72084         buttons.classed("disabled", function(d2) {
72085           return !editable() || !d2.annotation();
72086         }).each(function() {
72087           var selection3 = select_default2(this);
72088           if (!selection3.select(".tooltip.in").empty()) {
72089             selection3.call(tooltipBehavior.updateContent);
72090           }
72091         });
72092       }
72093     };
72094     tool.uninstall = function() {
72095       context.keybinding().off(commands[0].cmd).off(commands[1].cmd);
72096       context.map().on("move.undo_redo", null).on("drawn.undo_redo", null);
72097       context.history().on("change.undo_redo", null);
72098       context.on("enter.undo_redo", null);
72099     };
72100     return tool;
72101   }
72102
72103   // modules/ui/top_toolbar.js
72104   function uiTopToolbar(context) {
72105     var sidebarToggle = uiToolSidebarToggle(context), modes = uiToolDrawModes(context), notes = uiToolNotes(context), undoRedo = uiToolUndoRedo(context), save = uiToolSave(context);
72106     function notesEnabled() {
72107       var noteLayer = context.layers().layer("notes");
72108       return noteLayer && noteLayer.enabled();
72109     }
72110     function topToolbar(bar) {
72111       bar.on("wheel.topToolbar", function(d3_event) {
72112         if (!d3_event.deltaX) {
72113           bar.node().scrollLeft += d3_event.deltaY;
72114         }
72115       });
72116       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
72117       context.layers().on("change.topToolbar", debouncedUpdate);
72118       update();
72119       function update() {
72120         var tools = [
72121           sidebarToggle,
72122           "spacer",
72123           modes
72124         ];
72125         tools.push("spacer");
72126         if (notesEnabled()) {
72127           tools = tools.concat([notes, "spacer"]);
72128         }
72129         tools = tools.concat([undoRedo, save]);
72130         var toolbarItems = bar.selectAll(".toolbar-item").data(tools, function(d2) {
72131           return d2.id || d2;
72132         });
72133         toolbarItems.exit().each(function(d2) {
72134           if (d2.uninstall) {
72135             d2.uninstall();
72136           }
72137         }).remove();
72138         var itemsEnter = toolbarItems.enter().append("div").attr("class", function(d2) {
72139           var classes = "toolbar-item " + (d2.id || d2).replace("_", "-");
72140           if (d2.klass)
72141             classes += " " + d2.klass;
72142           return classes;
72143         });
72144         var actionableItems = itemsEnter.filter(function(d2) {
72145           return d2 !== "spacer";
72146         });
72147         actionableItems.append("div").attr("class", "item-content").each(function(d2) {
72148           select_default2(this).call(d2.render, bar);
72149         });
72150         actionableItems.append("div").attr("class", "item-label").each(function(d2) {
72151           d2.label(select_default2(this));
72152         });
72153       }
72154     }
72155     return topToolbar;
72156   }
72157
72158   // modules/ui/zoom_to_selection.js
72159   function uiZoomToSelection(context) {
72160     function isDisabled() {
72161       var mode = context.mode();
72162       return !mode || !mode.zoomToSelected;
72163     }
72164     var _lastPointerUpType;
72165     function pointerup(d3_event) {
72166       _lastPointerUpType = d3_event.pointerType;
72167     }
72168     function click(d3_event) {
72169       d3_event.preventDefault();
72170       if (isDisabled()) {
72171         if (_lastPointerUpType === "touch" || _lastPointerUpType === "pen") {
72172           context.ui().flash.duration(2e3).iconName("#iD-icon-framed-dot").iconClass("disabled").label(_t.append("inspector.zoom_to.no_selection"))();
72173         }
72174       } else {
72175         var mode = context.mode();
72176         if (mode && mode.zoomToSelected) {
72177           mode.zoomToSelected();
72178         }
72179       }
72180       _lastPointerUpType = null;
72181     }
72182     return function(selection2) {
72183       var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function() {
72184         if (isDisabled()) {
72185           return _t.append("inspector.zoom_to.no_selection");
72186         }
72187         return _t.append("inspector.zoom_to.title");
72188       }).keys([_t("inspector.zoom_to.key")]);
72189       var button = selection2.append("button").on("pointerup", pointerup).on("click", click).call(svgIcon("#iD-icon-framed-dot", "light")).call(tooltipBehavior);
72190       function setEnabledState() {
72191         button.classed("disabled", isDisabled());
72192         if (!button.select(".tooltip.in").empty()) {
72193           button.call(tooltipBehavior.updateContent);
72194         }
72195       }
72196       context.on("enter.uiZoomToSelection", setEnabledState);
72197       setEnabledState();
72198     };
72199   }
72200
72201   // modules/ui/pane.js
72202   function uiPane(id2, context) {
72203     var _key;
72204     var _label = "";
72205     var _description = "";
72206     var _iconName = "";
72207     var _sections;
72208     var _paneSelection = select_default2(null);
72209     var _paneTooltip;
72210     var pane = {
72211       id: id2
72212     };
72213     pane.label = function(val) {
72214       if (!arguments.length)
72215         return _label;
72216       _label = val;
72217       return pane;
72218     };
72219     pane.key = function(val) {
72220       if (!arguments.length)
72221         return _key;
72222       _key = val;
72223       return pane;
72224     };
72225     pane.description = function(val) {
72226       if (!arguments.length)
72227         return _description;
72228       _description = val;
72229       return pane;
72230     };
72231     pane.iconName = function(val) {
72232       if (!arguments.length)
72233         return _iconName;
72234       _iconName = val;
72235       return pane;
72236     };
72237     pane.sections = function(val) {
72238       if (!arguments.length)
72239         return _sections;
72240       _sections = val;
72241       return pane;
72242     };
72243     pane.selection = function() {
72244       return _paneSelection;
72245     };
72246     function hidePane() {
72247       context.ui().togglePanes();
72248     }
72249     pane.togglePane = function(d3_event) {
72250       if (d3_event)
72251         d3_event.preventDefault();
72252       _paneTooltip.hide();
72253       context.ui().togglePanes(!_paneSelection.classed("shown") ? _paneSelection : void 0);
72254     };
72255     pane.renderToggleButton = function(selection2) {
72256       if (!_paneTooltip) {
72257         _paneTooltip = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(() => _description).keys([_key]);
72258       }
72259       selection2.append("button").on("click", pane.togglePane).call(svgIcon("#" + _iconName, "light")).call(_paneTooltip);
72260     };
72261     pane.renderContent = function(selection2) {
72262       if (_sections) {
72263         _sections.forEach(function(section) {
72264           selection2.call(section.render);
72265         });
72266       }
72267     };
72268     pane.renderPane = function(selection2) {
72269       _paneSelection = selection2.append("div").attr("class", "fillL map-pane hide " + id2 + "-pane").attr("pane", id2);
72270       var heading = _paneSelection.append("div").attr("class", "pane-heading");
72271       heading.append("h2").text("").call(_label);
72272       heading.append("button").attr("title", _t("icons.close")).on("click", hidePane).call(svgIcon("#iD-icon-close"));
72273       _paneSelection.append("div").attr("class", "pane-content").call(pane.renderContent);
72274       if (_key) {
72275         context.keybinding().on(_key, pane.togglePane);
72276       }
72277     };
72278     return pane;
72279   }
72280
72281   // modules/ui/sections/background_display_options.js
72282   function uiSectionBackgroundDisplayOptions(context) {
72283     var section = uiSection("background-display-options", context).label(() => _t.append("background.display_options")).disclosureContent(renderDisclosureContent);
72284     var _storedOpacity = corePreferences("background-opacity");
72285     var _minVal = 0;
72286     var _maxVal = 3;
72287     var _sliders = ["brightness", "contrast", "saturation", "sharpness"];
72288     var _options = {
72289       brightness: _storedOpacity !== null ? +_storedOpacity : 1,
72290       contrast: 1,
72291       saturation: 1,
72292       sharpness: 1
72293     };
72294     function clamp3(x2, min3, max3) {
72295       return Math.max(min3, Math.min(x2, max3));
72296     }
72297     function updateValue(d2, val) {
72298       val = clamp3(val, _minVal, _maxVal);
72299       _options[d2] = val;
72300       context.background()[d2](val);
72301       if (d2 === "brightness") {
72302         corePreferences("background-opacity", val);
72303       }
72304       section.reRender();
72305     }
72306     function renderDisclosureContent(selection2) {
72307       var container = selection2.selectAll(".display-options-container").data([0]);
72308       var containerEnter = container.enter().append("div").attr("class", "display-options-container controls-list");
72309       var slidersEnter = containerEnter.selectAll(".display-control").data(_sliders).enter().append("label").attr("class", function(d2) {
72310         return "display-control display-control-" + d2;
72311       });
72312       slidersEnter.html(function(d2) {
72313         return _t.html("background." + d2);
72314       }).append("span").attr("class", function(d2) {
72315         return "display-option-value display-option-value-" + d2;
72316       });
72317       var sildersControlEnter = slidersEnter.append("div").attr("class", "control-wrap");
72318       sildersControlEnter.append("input").attr("class", function(d2) {
72319         return "display-option-input display-option-input-" + d2;
72320       }).attr("type", "range").attr("min", _minVal).attr("max", _maxVal).attr("step", "0.05").on("input", function(d3_event, d2) {
72321         var val = select_default2(this).property("value");
72322         if (!val && d3_event && d3_event.target) {
72323           val = d3_event.target.value;
72324         }
72325         updateValue(d2, val);
72326       });
72327       sildersControlEnter.append("button").attr("title", function(d2) {
72328         return `${_t("background.reset")} ${_t("background." + d2)}`;
72329       }).attr("class", function(d2) {
72330         return "display-option-reset display-option-reset-" + d2;
72331       }).on("click", function(d3_event, d2) {
72332         if (d3_event.button !== 0)
72333           return;
72334         updateValue(d2, 1);
72335       }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
72336       containerEnter.append("a").attr("class", "display-option-resetlink").attr("role", "button").attr("href", "#").call(_t.append("background.reset_all")).on("click", function(d3_event) {
72337         d3_event.preventDefault();
72338         for (var i3 = 0; i3 < _sliders.length; i3++) {
72339           updateValue(_sliders[i3], 1);
72340         }
72341       });
72342       container = containerEnter.merge(container);
72343       container.selectAll(".display-option-input").property("value", function(d2) {
72344         return _options[d2];
72345       });
72346       container.selectAll(".display-option-value").text(function(d2) {
72347         return Math.floor(_options[d2] * 100) + "%";
72348       });
72349       container.selectAll(".display-option-reset").classed("disabled", function(d2) {
72350         return _options[d2] === 1;
72351       });
72352       if (containerEnter.size() && _options.brightness !== 1) {
72353         context.background().brightness(_options.brightness);
72354       }
72355     }
72356     return section;
72357   }
72358
72359   // modules/ui/settings/custom_background.js
72360   function uiSettingsCustomBackground() {
72361     var dispatch14 = dispatch_default("change");
72362     function render(selection2) {
72363       var _origSettings = {
72364         template: corePreferences("background-custom-template")
72365       };
72366       var _currSettings = {
72367         template: corePreferences("background-custom-template")
72368       };
72369       var example = "https://{switch:a,b,c}.tile.openstreetmap.org/{zoom}/{x}/{y}.png";
72370       var modal = uiConfirm(selection2).okButton();
72371       modal.classed("settings-modal settings-custom-background", true);
72372       modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_background.header"));
72373       var textSection = modal.select(".modal-section.message-text");
72374       var instructions = `${_t.html("settings.custom_background.instructions.info")}
72375
72376 #### ${_t.html("settings.custom_background.instructions.wms.tokens_label")}
72377 * ${_t.html("settings.custom_background.instructions.wms.tokens.proj")}
72378 * ${_t.html("settings.custom_background.instructions.wms.tokens.wkid")}
72379 * ${_t.html("settings.custom_background.instructions.wms.tokens.dimensions")}
72380 * ${_t.html("settings.custom_background.instructions.wms.tokens.bbox")}
72381
72382 #### ${_t.html("settings.custom_background.instructions.tms.tokens_label")}
72383 * ${_t.html("settings.custom_background.instructions.tms.tokens.xyz")}
72384 * ${_t.html("settings.custom_background.instructions.tms.tokens.flipped_y")}
72385 * ${_t.html("settings.custom_background.instructions.tms.tokens.switch")}
72386 * ${_t.html("settings.custom_background.instructions.tms.tokens.quadtile")}
72387 * ${_t.html("settings.custom_background.instructions.tms.tokens.scale_factor")}
72388
72389 #### ${_t.html("settings.custom_background.instructions.example")}
72390 \`${example}\``;
72391       textSection.append("div").attr("class", "instructions-template").html(marked(instructions));
72392       textSection.append("textarea").attr("class", "field-template").attr("placeholder", _t("settings.custom_background.template.placeholder")).call(utilNoAuto).property("value", _currSettings.template);
72393       var buttonSection = modal.select(".modal-section.buttons");
72394       buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
72395       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
72396       buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
72397       function isSaveDisabled() {
72398         return null;
72399       }
72400       function clickCancel() {
72401         textSection.select(".field-template").property("value", _origSettings.template);
72402         corePreferences("background-custom-template", _origSettings.template);
72403         this.blur();
72404         modal.close();
72405       }
72406       function clickSave() {
72407         _currSettings.template = textSection.select(".field-template").property("value");
72408         corePreferences("background-custom-template", _currSettings.template);
72409         this.blur();
72410         modal.close();
72411         dispatch14.call("change", this, _currSettings);
72412       }
72413     }
72414     return utilRebind(render, dispatch14, "on");
72415   }
72416
72417   // modules/ui/sections/background_list.js
72418   function uiSectionBackgroundList(context) {
72419     var _backgroundList = select_default2(null);
72420     var _customSource = context.background().findSource("custom");
72421     var _settingsCustomBackground = uiSettingsCustomBackground(context).on("change", customChanged);
72422     var section = uiSection("background-list", context).label(() => _t.append("background.backgrounds")).disclosureContent(renderDisclosureContent);
72423     function previousBackgroundID() {
72424       return corePreferences("background-last-used-toggle");
72425     }
72426     function renderDisclosureContent(selection2) {
72427       var container = selection2.selectAll(".layer-background-list").data([0]);
72428       _backgroundList = container.enter().append("ul").attr("class", "layer-list layer-background-list").attr("dir", "auto").merge(container);
72429       var bgExtrasListEnter = selection2.selectAll(".bg-extras-list").data([0]).enter().append("ul").attr("class", "layer-list bg-extras-list");
72430       var minimapLabelEnter = bgExtrasListEnter.append("li").attr("class", "minimap-toggle-item").append("label").call(
72431         uiTooltip().title(() => _t.append("background.minimap.tooltip")).keys([_t("background.minimap.key")]).placement("top")
72432       );
72433       minimapLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
72434         d3_event.preventDefault();
72435         uiMapInMap.toggle();
72436       });
72437       minimapLabelEnter.append("span").call(_t.append("background.minimap.description"));
72438       var panelLabelEnter = bgExtrasListEnter.append("li").attr("class", "background-panel-toggle-item").append("label").call(
72439         uiTooltip().title(() => _t.append("background.panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.background.key"))]).placement("top")
72440       );
72441       panelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
72442         d3_event.preventDefault();
72443         context.ui().info.toggle("background");
72444       });
72445       panelLabelEnter.append("span").call(_t.append("background.panel.description"));
72446       var locPanelLabelEnter = bgExtrasListEnter.append("li").attr("class", "location-panel-toggle-item").append("label").call(
72447         uiTooltip().title(() => _t.append("background.location_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.location.key"))]).placement("top")
72448       );
72449       locPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
72450         d3_event.preventDefault();
72451         context.ui().info.toggle("location");
72452       });
72453       locPanelLabelEnter.append("span").call(_t.append("background.location_panel.description"));
72454       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"));
72455       _backgroundList.call(drawListItems, "radio", function(d3_event, d2) {
72456         chooseBackground(d2);
72457       }, function(d2) {
72458         return !d2.isHidden() && !d2.overlay;
72459       });
72460     }
72461     function setTooltips(selection2) {
72462       selection2.each(function(d2, i3, nodes) {
72463         var item = select_default2(this).select("label");
72464         var span = item.select("span");
72465         var placement = i3 < nodes.length / 2 ? "bottom" : "top";
72466         var hasDescription = d2.hasDescription();
72467         var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
72468         item.call(uiTooltip().destroyAny);
72469         if (d2.id === previousBackgroundID()) {
72470           item.call(
72471             uiTooltip().placement(placement).title(() => _t.append("background.switch")).keys([uiCmd("\u2318" + _t("background.key"))])
72472           );
72473         } else if (hasDescription || isOverflowing) {
72474           item.call(
72475             uiTooltip().placement(placement).title(() => hasDescription ? d2.description() : d2.label())
72476           );
72477         }
72478       });
72479     }
72480     function drawListItems(layerList, type2, change, filter2) {
72481       var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2).sort(function(a2, b2) {
72482         return a2.best() && !b2.best() ? -1 : b2.best() && !a2.best() ? 1 : descending(a2.area(), b2.area()) || ascending(a2.name(), b2.name()) || 0;
72483       });
72484       var layerLinks = layerList.selectAll("li").data(sources, function(d2, i3) {
72485         return d2.id + "---" + i3;
72486       });
72487       layerLinks.exit().remove();
72488       var enter = layerLinks.enter().append("li").classed("layer-custom", function(d2) {
72489         return d2.id === "custom";
72490       }).classed("best", function(d2) {
72491         return d2.best();
72492       });
72493       var label = enter.append("label");
72494       label.append("input").attr("type", type2).attr("name", "background-layer").attr("value", function(d2) {
72495         return d2.id;
72496       }).on("change", change);
72497       label.append("span").each(function(d2) {
72498         d2.label()(select_default2(this));
72499       });
72500       enter.filter(function(d2) {
72501         return d2.id === "custom";
72502       }).append("button").attr("class", "layer-browse").call(
72503         uiTooltip().title(() => _t.append("settings.custom_background.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
72504       ).on("click", function(d3_event) {
72505         d3_event.preventDefault();
72506         editCustom();
72507       }).call(svgIcon("#iD-icon-more"));
72508       enter.filter(function(d2) {
72509         return d2.best();
72510       }).append("div").attr("class", "best").call(
72511         uiTooltip().title(() => _t.append("background.best_imagery")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
72512       ).append("span").text("\u2605");
72513       layerList.call(updateLayerSelections);
72514     }
72515     function updateLayerSelections(selection2) {
72516       function active(d2) {
72517         return context.background().showsLayer(d2);
72518       }
72519       selection2.selectAll("li").classed("active", active).classed("switch", function(d2) {
72520         return d2.id === previousBackgroundID();
72521       }).call(setTooltips).selectAll("input").property("checked", active);
72522     }
72523     function chooseBackground(d2) {
72524       if (d2.id === "custom" && !d2.template()) {
72525         return editCustom();
72526       }
72527       var previousBackground = context.background().baseLayerSource();
72528       corePreferences("background-last-used-toggle", previousBackground.id);
72529       corePreferences("background-last-used", d2.id);
72530       context.background().baseLayerSource(d2);
72531     }
72532     function customChanged(d2) {
72533       if (d2 && d2.template) {
72534         _customSource.template(d2.template);
72535         chooseBackground(_customSource);
72536       } else {
72537         _customSource.template("");
72538         chooseBackground(context.background().findSource("none"));
72539       }
72540     }
72541     function editCustom() {
72542       context.container().call(_settingsCustomBackground);
72543     }
72544     context.background().on("change.background_list", function() {
72545       _backgroundList.call(updateLayerSelections);
72546     });
72547     context.map().on(
72548       "move.background_list",
72549       debounce_default(function() {
72550         window.requestIdleCallback(section.reRender);
72551       }, 1e3)
72552     );
72553     return section;
72554   }
72555
72556   // modules/ui/sections/background_offset.js
72557   function uiSectionBackgroundOffset(context) {
72558     var section = uiSection("background-offset", context).label(() => _t.append("background.fix_misalignment")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
72559     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
72560     var _directions = [
72561       ["top", [0, -0.5]],
72562       ["left", [-0.5, 0]],
72563       ["right", [0.5, 0]],
72564       ["bottom", [0, 0.5]]
72565     ];
72566     function updateValue() {
72567       var meters = geoOffsetToMeters(context.background().offset());
72568       var x2 = +meters[0].toFixed(2);
72569       var y2 = +meters[1].toFixed(2);
72570       context.container().selectAll(".nudge-inner-rect").select("input").classed("error", false).property("value", x2 + ", " + y2);
72571       context.container().selectAll(".nudge-reset").classed("disabled", function() {
72572         return x2 === 0 && y2 === 0;
72573       });
72574     }
72575     function resetOffset() {
72576       context.background().offset([0, 0]);
72577       updateValue();
72578     }
72579     function nudge(d2) {
72580       context.background().nudge(d2, context.map().zoom());
72581       updateValue();
72582     }
72583     function inputOffset() {
72584       var input = select_default2(this);
72585       var d2 = input.node().value;
72586       if (d2 === "")
72587         return resetOffset();
72588       d2 = d2.replace(/;/g, ",").split(",").map(function(n3) {
72589         return !isNaN(n3) && n3;
72590       });
72591       if (d2.length !== 2 || !d2[0] || !d2[1]) {
72592         input.classed("error", true);
72593         return;
72594       }
72595       context.background().offset(geoMetersToOffset(d2));
72596       updateValue();
72597     }
72598     function dragOffset(d3_event) {
72599       if (d3_event.button !== 0)
72600         return;
72601       var origin = [d3_event.clientX, d3_event.clientY];
72602       var pointerId = d3_event.pointerId || "mouse";
72603       context.container().append("div").attr("class", "nudge-surface");
72604       select_default2(window).on(_pointerPrefix + "move.drag-bg-offset", pointermove).on(_pointerPrefix + "up.drag-bg-offset", pointerup);
72605       if (_pointerPrefix === "pointer") {
72606         select_default2(window).on("pointercancel.drag-bg-offset", pointerup);
72607       }
72608       function pointermove(d3_event2) {
72609         if (pointerId !== (d3_event2.pointerId || "mouse"))
72610           return;
72611         var latest = [d3_event2.clientX, d3_event2.clientY];
72612         var d2 = [
72613           -(origin[0] - latest[0]) / 4,
72614           -(origin[1] - latest[1]) / 4
72615         ];
72616         origin = latest;
72617         nudge(d2);
72618       }
72619       function pointerup(d3_event2) {
72620         if (pointerId !== (d3_event2.pointerId || "mouse"))
72621           return;
72622         if (d3_event2.button !== 0)
72623           return;
72624         context.container().selectAll(".nudge-surface").remove();
72625         select_default2(window).on(".drag-bg-offset", null);
72626       }
72627     }
72628     function renderDisclosureContent(selection2) {
72629       var container = selection2.selectAll(".nudge-container").data([0]);
72630       var containerEnter = container.enter().append("div").attr("class", "nudge-container");
72631       containerEnter.append("div").attr("class", "nudge-instructions").call(_t.append("background.offset"));
72632       var nudgeWrapEnter = containerEnter.append("div").attr("class", "nudge-controls-wrap");
72633       var nudgeEnter = nudgeWrapEnter.append("div").attr("class", "nudge-outer-rect").on(_pointerPrefix + "down", dragOffset);
72634       nudgeEnter.append("div").attr("class", "nudge-inner-rect").append("input").attr("type", "text").attr("aria-label", _t("background.offset_label")).on("change", inputOffset);
72635       nudgeWrapEnter.append("div").selectAll("button").data(_directions).enter().append("button").attr("title", function(d2) {
72636         return _t(`background.nudge.${d2[0]}`);
72637       }).attr("class", function(d2) {
72638         return d2[0] + " nudge";
72639       }).on("click", function(d3_event, d2) {
72640         nudge(d2[1]);
72641       });
72642       nudgeWrapEnter.append("button").attr("title", _t("background.reset")).attr("class", "nudge-reset disabled").on("click", function(d3_event) {
72643         d3_event.preventDefault();
72644         resetOffset();
72645       }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
72646       updateValue();
72647     }
72648     context.background().on("change.backgroundOffset-update", updateValue);
72649     return section;
72650   }
72651
72652   // modules/ui/sections/overlay_list.js
72653   function uiSectionOverlayList(context) {
72654     var section = uiSection("overlay-list", context).label(() => _t.append("background.overlays")).disclosureContent(renderDisclosureContent);
72655     var _overlayList = select_default2(null);
72656     function setTooltips(selection2) {
72657       selection2.each(function(d2, i3, nodes) {
72658         var item = select_default2(this).select("label");
72659         var span = item.select("span");
72660         var placement = i3 < nodes.length / 2 ? "bottom" : "top";
72661         var description = d2.description();
72662         var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
72663         item.call(uiTooltip().destroyAny);
72664         if (description || isOverflowing) {
72665           item.call(
72666             uiTooltip().placement(placement).title(() => description || d2.name())
72667           );
72668         }
72669       });
72670     }
72671     function updateLayerSelections(selection2) {
72672       function active(d2) {
72673         return context.background().showsLayer(d2);
72674       }
72675       selection2.selectAll("li").classed("active", active).call(setTooltips).selectAll("input").property("checked", active);
72676     }
72677     function chooseOverlay(d3_event, d2) {
72678       d3_event.preventDefault();
72679       context.background().toggleOverlayLayer(d2);
72680       _overlayList.call(updateLayerSelections);
72681       document.activeElement.blur();
72682     }
72683     function drawListItems(layerList, type2, change, filter2) {
72684       var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2);
72685       var layerLinks = layerList.selectAll("li").data(sources, function(d2) {
72686         return d2.name();
72687       });
72688       layerLinks.exit().remove();
72689       var enter = layerLinks.enter().append("li");
72690       var label = enter.append("label");
72691       label.append("input").attr("type", type2).attr("name", "layers").on("change", change);
72692       label.append("span").each(function(d2) {
72693         d2.label()(select_default2(this));
72694       });
72695       layerList.selectAll("li").sort(sortSources);
72696       layerList.call(updateLayerSelections);
72697       function sortSources(a2, b2) {
72698         return a2.best() && !b2.best() ? -1 : b2.best() && !a2.best() ? 1 : descending(a2.area(), b2.area()) || ascending(a2.name(), b2.name()) || 0;
72699       }
72700     }
72701     function renderDisclosureContent(selection2) {
72702       var container = selection2.selectAll(".layer-overlay-list").data([0]);
72703       _overlayList = container.enter().append("ul").attr("class", "layer-list layer-overlay-list").attr("dir", "auto").merge(container);
72704       _overlayList.call(drawListItems, "checkbox", chooseOverlay, function(d2) {
72705         return !d2.isHidden() && d2.overlay;
72706       });
72707     }
72708     context.map().on(
72709       "move.overlay_list",
72710       debounce_default(function() {
72711         window.requestIdleCallback(section.reRender);
72712       }, 1e3)
72713     );
72714     return section;
72715   }
72716
72717   // modules/ui/panes/background.js
72718   function uiPaneBackground(context) {
72719     var backgroundPane = uiPane("background", context).key(_t("background.key")).label(_t.append("background.title")).description(_t.append("background.description")).iconName("iD-icon-layers").sections([
72720       uiSectionBackgroundList(context),
72721       uiSectionOverlayList(context),
72722       uiSectionBackgroundDisplayOptions(context),
72723       uiSectionBackgroundOffset(context)
72724     ]);
72725     return backgroundPane;
72726   }
72727
72728   // modules/ui/panes/help.js
72729   function uiPaneHelp(context) {
72730     var docKeys = [
72731       ["help", [
72732         "welcome",
72733         "open_data_h",
72734         "open_data",
72735         "before_start_h",
72736         "before_start",
72737         "open_source_h",
72738         "open_source",
72739         "open_source_attribution",
72740         "open_source_help"
72741       ]],
72742       ["overview", [
72743         "navigation_h",
72744         "navigation_drag",
72745         "navigation_zoom",
72746         "features_h",
72747         "features",
72748         "nodes_ways"
72749       ]],
72750       ["editing", [
72751         "select_h",
72752         "select_left_click",
72753         "select_right_click",
72754         "select_space",
72755         "multiselect_h",
72756         "multiselect",
72757         "multiselect_shift_click",
72758         "multiselect_lasso",
72759         "undo_redo_h",
72760         "undo_redo",
72761         "save_h",
72762         "save",
72763         "save_validation",
72764         "upload_h",
72765         "upload",
72766         "backups_h",
72767         "backups",
72768         "keyboard_h",
72769         "keyboard"
72770       ]],
72771       ["feature_editor", [
72772         "intro",
72773         "definitions",
72774         "type_h",
72775         "type",
72776         "type_picker",
72777         "fields_h",
72778         "fields_all_fields",
72779         "fields_example",
72780         "fields_add_field",
72781         "tags_h",
72782         "tags_all_tags",
72783         "tags_resources"
72784       ]],
72785       ["points", [
72786         "intro",
72787         "add_point_h",
72788         "add_point",
72789         "add_point_finish",
72790         "move_point_h",
72791         "move_point",
72792         "delete_point_h",
72793         "delete_point",
72794         "delete_point_command"
72795       ]],
72796       ["lines", [
72797         "intro",
72798         "add_line_h",
72799         "add_line",
72800         "add_line_draw",
72801         "add_line_continue",
72802         "add_line_finish",
72803         "modify_line_h",
72804         "modify_line_dragnode",
72805         "modify_line_addnode",
72806         "connect_line_h",
72807         "connect_line",
72808         "connect_line_display",
72809         "connect_line_drag",
72810         "connect_line_tag",
72811         "disconnect_line_h",
72812         "disconnect_line_command",
72813         "move_line_h",
72814         "move_line_command",
72815         "move_line_connected",
72816         "delete_line_h",
72817         "delete_line",
72818         "delete_line_command"
72819       ]],
72820       ["areas", [
72821         "intro",
72822         "point_or_area_h",
72823         "point_or_area",
72824         "add_area_h",
72825         "add_area_command",
72826         "add_area_draw",
72827         "add_area_continue",
72828         "add_area_finish",
72829         "square_area_h",
72830         "square_area_command",
72831         "modify_area_h",
72832         "modify_area_dragnode",
72833         "modify_area_addnode",
72834         "delete_area_h",
72835         "delete_area",
72836         "delete_area_command"
72837       ]],
72838       ["relations", [
72839         "intro",
72840         "edit_relation_h",
72841         "edit_relation",
72842         "edit_relation_add",
72843         "edit_relation_delete",
72844         "maintain_relation_h",
72845         "maintain_relation",
72846         "relation_types_h",
72847         "multipolygon_h",
72848         "multipolygon",
72849         "multipolygon_create",
72850         "multipolygon_merge",
72851         "turn_restriction_h",
72852         "turn_restriction",
72853         "turn_restriction_field",
72854         "turn_restriction_editing",
72855         "route_h",
72856         "route",
72857         "route_add",
72858         "boundary_h",
72859         "boundary",
72860         "boundary_add"
72861       ]],
72862       ["operations", [
72863         "intro",
72864         "intro_2",
72865         "straighten",
72866         "orthogonalize",
72867         "circularize",
72868         "move",
72869         "rotate",
72870         "reflect",
72871         "continue",
72872         "reverse",
72873         "disconnect",
72874         "split",
72875         "extract",
72876         "merge",
72877         "delete",
72878         "downgrade",
72879         "copy_paste"
72880       ]],
72881       ["notes", [
72882         "intro",
72883         "add_note_h",
72884         "add_note",
72885         "place_note",
72886         "move_note",
72887         "update_note_h",
72888         "update_note",
72889         "save_note_h",
72890         "save_note"
72891       ]],
72892       ["imagery", [
72893         "intro",
72894         "sources_h",
72895         "choosing",
72896         "sources",
72897         "offsets_h",
72898         "offset",
72899         "offset_change"
72900       ]],
72901       ["streetlevel", [
72902         "intro",
72903         "using_h",
72904         "using",
72905         "photos",
72906         "viewer"
72907       ]],
72908       ["gps", [
72909         "intro",
72910         "survey",
72911         "using_h",
72912         "using",
72913         "tracing",
72914         "upload"
72915       ]],
72916       ["qa", [
72917         "intro",
72918         "tools_h",
72919         "tools",
72920         "issues_h",
72921         "issues"
72922       ]]
72923     ];
72924     var headings = {
72925       "help.help.open_data_h": 3,
72926       "help.help.before_start_h": 3,
72927       "help.help.open_source_h": 3,
72928       "help.overview.navigation_h": 3,
72929       "help.overview.features_h": 3,
72930       "help.editing.select_h": 3,
72931       "help.editing.multiselect_h": 3,
72932       "help.editing.undo_redo_h": 3,
72933       "help.editing.save_h": 3,
72934       "help.editing.upload_h": 3,
72935       "help.editing.backups_h": 3,
72936       "help.editing.keyboard_h": 3,
72937       "help.feature_editor.type_h": 3,
72938       "help.feature_editor.fields_h": 3,
72939       "help.feature_editor.tags_h": 3,
72940       "help.points.add_point_h": 3,
72941       "help.points.move_point_h": 3,
72942       "help.points.delete_point_h": 3,
72943       "help.lines.add_line_h": 3,
72944       "help.lines.modify_line_h": 3,
72945       "help.lines.connect_line_h": 3,
72946       "help.lines.disconnect_line_h": 3,
72947       "help.lines.move_line_h": 3,
72948       "help.lines.delete_line_h": 3,
72949       "help.areas.point_or_area_h": 3,
72950       "help.areas.add_area_h": 3,
72951       "help.areas.square_area_h": 3,
72952       "help.areas.modify_area_h": 3,
72953       "help.areas.delete_area_h": 3,
72954       "help.relations.edit_relation_h": 3,
72955       "help.relations.maintain_relation_h": 3,
72956       "help.relations.relation_types_h": 2,
72957       "help.relations.multipolygon_h": 3,
72958       "help.relations.turn_restriction_h": 3,
72959       "help.relations.route_h": 3,
72960       "help.relations.boundary_h": 3,
72961       "help.notes.add_note_h": 3,
72962       "help.notes.update_note_h": 3,
72963       "help.notes.save_note_h": 3,
72964       "help.imagery.sources_h": 3,
72965       "help.imagery.offsets_h": 3,
72966       "help.streetlevel.using_h": 3,
72967       "help.gps.using_h": 3,
72968       "help.qa.tools_h": 3,
72969       "help.qa.issues_h": 3
72970     };
72971     var docs = docKeys.map(function(key) {
72972       var helpkey = "help." + key[0];
72973       var helpPaneReplacements = { version: context.version };
72974       var text2 = key[1].reduce(function(all, part) {
72975         var subkey = helpkey + "." + part;
72976         var depth = headings[subkey];
72977         var hhh = depth ? Array(depth + 1).join("#") + " " : "";
72978         return all + hhh + helpHtml(subkey, helpPaneReplacements) + "\n\n";
72979       }, "");
72980       return {
72981         title: _t.html(helpkey + ".title"),
72982         content: marked(text2.trim()).replace(/<code>/g, "<kbd>").replace(/<\/code>/g, "</kbd>")
72983       };
72984     });
72985     var helpPane = uiPane("help", context).key(_t("help.key")).label(_t.append("help.title")).description(_t.append("help.title")).iconName("iD-icon-help");
72986     helpPane.renderContent = function(content) {
72987       function clickHelp(d2, i3) {
72988         var rtl = _mainLocalizer.textDirection() === "rtl";
72989         content.property("scrollTop", 0);
72990         helpPane.selection().select(".pane-heading h2").html(d2.title);
72991         body.html(d2.content);
72992         body.selectAll("a").attr("target", "_blank");
72993         menuItems.classed("selected", function(m2) {
72994           return m2.title === d2.title;
72995         });
72996         nav.html("");
72997         if (rtl) {
72998           nav.call(drawNext).call(drawPrevious);
72999         } else {
73000           nav.call(drawPrevious).call(drawNext);
73001         }
73002         function drawNext(selection2) {
73003           if (i3 < docs.length - 1) {
73004             var nextLink = selection2.append("a").attr("href", "#").attr("class", "next").on("click", function(d3_event) {
73005               d3_event.preventDefault();
73006               clickHelp(docs[i3 + 1], i3 + 1);
73007             });
73008             nextLink.append("span").html(docs[i3 + 1].title).call(svgIcon(rtl ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
73009           }
73010         }
73011         function drawPrevious(selection2) {
73012           if (i3 > 0) {
73013             var prevLink = selection2.append("a").attr("href", "#").attr("class", "previous").on("click", function(d3_event) {
73014               d3_event.preventDefault();
73015               clickHelp(docs[i3 - 1], i3 - 1);
73016             });
73017             prevLink.call(svgIcon(rtl ? "#iD-icon-forward" : "#iD-icon-backward", "inline")).append("span").html(docs[i3 - 1].title);
73018           }
73019         }
73020       }
73021       function clickWalkthrough(d3_event) {
73022         d3_event.preventDefault();
73023         if (context.inIntro())
73024           return;
73025         context.container().call(uiIntro(context));
73026         context.ui().togglePanes();
73027       }
73028       function clickShortcuts(d3_event) {
73029         d3_event.preventDefault();
73030         context.container().call(context.ui().shortcuts, true);
73031       }
73032       var toc = content.append("ul").attr("class", "toc");
73033       var menuItems = toc.selectAll("li").data(docs).enter().append("li").append("a").attr("role", "button").attr("href", "#").html(function(d2) {
73034         return d2.title;
73035       }).on("click", function(d3_event, d2) {
73036         d3_event.preventDefault();
73037         clickHelp(d2, docs.indexOf(d2));
73038       });
73039       var shortcuts = toc.append("li").attr("class", "shortcuts").call(
73040         uiTooltip().title(() => _t.append("shortcuts.tooltip")).keys(["?"]).placement("top")
73041       ).append("a").attr("href", "#").on("click", clickShortcuts);
73042       shortcuts.append("div").call(_t.append("shortcuts.title"));
73043       var walkthrough = toc.append("li").attr("class", "walkthrough").append("a").attr("href", "#").on("click", clickWalkthrough);
73044       walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
73045       walkthrough.append("div").call(_t.append("splash.walkthrough"));
73046       var helpContent = content.append("div").attr("class", "left-content");
73047       var body = helpContent.append("div").attr("class", "body");
73048       var nav = helpContent.append("div").attr("class", "nav");
73049       clickHelp(docs[0], 0);
73050     };
73051     return helpPane;
73052   }
73053
73054   // modules/ui/sections/validation_issues.js
73055   function uiSectionValidationIssues(id2, severity, context) {
73056     var _issues = [];
73057     var section = uiSection(id2, context).label(function() {
73058       if (!_issues)
73059         return "";
73060       var issueCountText = _issues.length > 1e3 ? "1000+" : String(_issues.length);
73061       return _t.append("inspector.title_count", { title: _t("issues." + severity + "s.list_title"), count: issueCountText });
73062     }).disclosureContent(renderDisclosureContent).shouldDisplay(function() {
73063       return _issues && _issues.length;
73064     });
73065     function getOptions() {
73066       return {
73067         what: corePreferences("validate-what") || "edited",
73068         where: corePreferences("validate-where") || "all"
73069       };
73070     }
73071     function reloadIssues() {
73072       _issues = context.validator().getIssuesBySeverity(getOptions())[severity];
73073     }
73074     function renderDisclosureContent(selection2) {
73075       var center = context.map().center();
73076       var graph = context.graph();
73077       var issues = _issues.map(function withDistance(issue) {
73078         var extent = issue.extent(graph);
73079         var dist = extent ? geoSphericalDistance(center, extent.center()) : 0;
73080         return Object.assign(issue, { dist });
73081       }).sort(function byDistance(a2, b2) {
73082         return a2.dist - b2.dist;
73083       });
73084       issues = issues.slice(0, 1e3);
73085       selection2.call(drawIssuesList, issues);
73086     }
73087     function drawIssuesList(selection2, issues) {
73088       var list = selection2.selectAll(".issues-list").data([0]);
73089       list = list.enter().append("ul").attr("class", "layer-list issues-list " + severity + "s-list").merge(list);
73090       var items = list.selectAll("li").data(issues, function(d2) {
73091         return d2.key;
73092       });
73093       items.exit().remove();
73094       var itemsEnter = items.enter().append("li").attr("class", function(d2) {
73095         return "issue severity-" + d2.severity;
73096       });
73097       var labelsEnter = itemsEnter.append("button").attr("class", "issue-label").on("click", function(d3_event, d2) {
73098         context.validator().focusIssue(d2);
73099       }).on("mouseover", function(d3_event, d2) {
73100         utilHighlightEntities(d2.entityIds, true, context);
73101       }).on("mouseout", function(d3_event, d2) {
73102         utilHighlightEntities(d2.entityIds, false, context);
73103       });
73104       var textEnter = labelsEnter.append("span").attr("class", "issue-text");
73105       textEnter.append("span").attr("class", "issue-icon").each(function(d2) {
73106         var iconName = "#iD-icon-" + (d2.severity === "warning" ? "alert" : "error");
73107         select_default2(this).call(svgIcon(iconName));
73108       });
73109       textEnter.append("span").attr("class", "issue-message");
73110       items = items.merge(itemsEnter).order();
73111       items.selectAll(".issue-message").text("").each(function(d2) {
73112         return d2.message(context)(select_default2(this));
73113       });
73114     }
73115     context.validator().on("validated.uiSectionValidationIssues" + id2, function() {
73116       window.requestIdleCallback(function() {
73117         reloadIssues();
73118         section.reRender();
73119       });
73120     });
73121     context.map().on(
73122       "move.uiSectionValidationIssues" + id2,
73123       debounce_default(function() {
73124         window.requestIdleCallback(function() {
73125           if (getOptions().where === "visible") {
73126             reloadIssues();
73127           }
73128           section.reRender();
73129         });
73130       }, 1e3)
73131     );
73132     return section;
73133   }
73134
73135   // modules/ui/sections/validation_options.js
73136   function uiSectionValidationOptions(context) {
73137     var section = uiSection("issues-options", context).content(renderContent);
73138     function renderContent(selection2) {
73139       var container = selection2.selectAll(".issues-options-container").data([0]);
73140       container = container.enter().append("div").attr("class", "issues-options-container").merge(container);
73141       var data = [
73142         { key: "what", values: ["edited", "all"] },
73143         { key: "where", values: ["visible", "all"] }
73144       ];
73145       var options2 = container.selectAll(".issues-option").data(data, function(d2) {
73146         return d2.key;
73147       });
73148       var optionsEnter = options2.enter().append("div").attr("class", function(d2) {
73149         return "issues-option issues-option-" + d2.key;
73150       });
73151       optionsEnter.append("div").attr("class", "issues-option-title").html(function(d2) {
73152         return _t.html("issues.options." + d2.key + ".title");
73153       });
73154       var valuesEnter = optionsEnter.selectAll("label").data(function(d2) {
73155         return d2.values.map(function(val) {
73156           return { value: val, key: d2.key };
73157         });
73158       }).enter().append("label");
73159       valuesEnter.append("input").attr("type", "radio").attr("name", function(d2) {
73160         return "issues-option-" + d2.key;
73161       }).attr("value", function(d2) {
73162         return d2.value;
73163       }).property("checked", function(d2) {
73164         return getOptions()[d2.key] === d2.value;
73165       }).on("change", function(d3_event, d2) {
73166         updateOptionValue(d3_event, d2.key, d2.value);
73167       });
73168       valuesEnter.append("span").html(function(d2) {
73169         return _t.html("issues.options." + d2.key + "." + d2.value);
73170       });
73171     }
73172     function getOptions() {
73173       return {
73174         what: corePreferences("validate-what") || "edited",
73175         // 'all', 'edited'
73176         where: corePreferences("validate-where") || "all"
73177         // 'all', 'visible'
73178       };
73179     }
73180     function updateOptionValue(d3_event, d2, val) {
73181       if (!val && d3_event && d3_event.target) {
73182         val = d3_event.target.value;
73183       }
73184       corePreferences("validate-" + d2, val);
73185       context.validator().validate();
73186     }
73187     return section;
73188   }
73189
73190   // modules/ui/sections/validation_rules.js
73191   function uiSectionValidationRules(context) {
73192     var MINSQUARE = 0;
73193     var MAXSQUARE = 20;
73194     var DEFAULTSQUARE = 5;
73195     var section = uiSection("issues-rules", context).disclosureContent(renderDisclosureContent).label(() => _t.append("issues.rules.title"));
73196     var _ruleKeys = context.validator().getRuleKeys().filter(function(key) {
73197       return key !== "maprules";
73198     }).sort(function(key1, key2) {
73199       return _t("issues." + key1 + ".title") < _t("issues." + key2 + ".title") ? -1 : 1;
73200     });
73201     function renderDisclosureContent(selection2) {
73202       var container = selection2.selectAll(".issues-rulelist-container").data([0]);
73203       var containerEnter = container.enter().append("div").attr("class", "issues-rulelist-container");
73204       containerEnter.append("ul").attr("class", "layer-list issue-rules-list");
73205       var ruleLinks = containerEnter.append("div").attr("class", "issue-rules-links section-footer");
73206       ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
73207         d3_event.preventDefault();
73208         context.validator().disableRules(_ruleKeys);
73209       });
73210       ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
73211         d3_event.preventDefault();
73212         context.validator().disableRules([]);
73213       });
73214       container = container.merge(containerEnter);
73215       container.selectAll(".issue-rules-list").call(drawListItems, _ruleKeys, "checkbox", "rule", toggleRule, isRuleEnabled);
73216     }
73217     function drawListItems(selection2, data, type2, name, change, active) {
73218       var items = selection2.selectAll("li").data(data);
73219       items.exit().remove();
73220       var enter = items.enter().append("li");
73221       if (name === "rule") {
73222         enter.call(
73223           uiTooltip().title(function(d2) {
73224             return _t.append("issues." + d2 + ".tip");
73225           }).placement("top")
73226         );
73227       }
73228       var label = enter.append("label");
73229       label.append("input").attr("type", type2).attr("name", name).on("change", change);
73230       label.append("span").html(function(d2) {
73231         var params = {};
73232         if (d2 === "unsquare_way") {
73233           params.val = { html: '<span class="square-degrees"></span>' };
73234         }
73235         return _t.html("issues." + d2 + ".title", params);
73236       });
73237       items = items.merge(enter);
73238       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
73239       var degStr = corePreferences("validate-square-degrees");
73240       if (degStr === null) {
73241         degStr = DEFAULTSQUARE.toString();
73242       }
73243       var span = items.selectAll(".square-degrees");
73244       var input = span.selectAll(".square-degrees-input").data([0]);
73245       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) {
73246         d3_event.preventDefault();
73247         d3_event.stopPropagation();
73248         this.select();
73249       }).on("keyup", function(d3_event) {
73250         if (d3_event.keyCode === 13) {
73251           this.blur();
73252           this.select();
73253         }
73254       }).on("blur", changeSquare).merge(input).property("value", degStr);
73255     }
73256     function changeSquare() {
73257       var input = select_default2(this);
73258       var degStr = utilGetSetValue(input).trim();
73259       var degNum = Number(degStr);
73260       if (!isFinite(degNum)) {
73261         degNum = DEFAULTSQUARE;
73262       } else if (degNum > MAXSQUARE) {
73263         degNum = MAXSQUARE;
73264       } else if (degNum < MINSQUARE) {
73265         degNum = MINSQUARE;
73266       }
73267       degNum = Math.round(degNum * 10) / 10;
73268       degStr = degNum.toString();
73269       input.property("value", degStr);
73270       corePreferences("validate-square-degrees", degStr);
73271       context.validator().revalidateUnsquare();
73272     }
73273     function isRuleEnabled(d2) {
73274       return context.validator().isRuleEnabled(d2);
73275     }
73276     function toggleRule(d3_event, d2) {
73277       context.validator().toggleRule(d2);
73278     }
73279     context.validator().on("validated.uiSectionValidationRules", function() {
73280       window.requestIdleCallback(section.reRender);
73281     });
73282     return section;
73283   }
73284
73285   // modules/ui/sections/validation_status.js
73286   function uiSectionValidationStatus(context) {
73287     var section = uiSection("issues-status", context).content(renderContent).shouldDisplay(function() {
73288       var issues = context.validator().getIssues(getOptions());
73289       return issues.length === 0;
73290     });
73291     function getOptions() {
73292       return {
73293         what: corePreferences("validate-what") || "edited",
73294         where: corePreferences("validate-where") || "all"
73295       };
73296     }
73297     function renderContent(selection2) {
73298       var box = selection2.selectAll(".box").data([0]);
73299       var boxEnter = box.enter().append("div").attr("class", "box");
73300       boxEnter.append("div").call(svgIcon("#iD-icon-apply", "pre-text"));
73301       var noIssuesMessage = boxEnter.append("span");
73302       noIssuesMessage.append("strong").attr("class", "message");
73303       noIssuesMessage.append("br");
73304       noIssuesMessage.append("span").attr("class", "details");
73305       renderIgnoredIssuesReset(selection2);
73306       setNoIssuesText(selection2);
73307     }
73308     function renderIgnoredIssuesReset(selection2) {
73309       var ignoredIssues = context.validator().getIssues({ what: "all", where: "all", includeDisabledRules: true, includeIgnored: "only" });
73310       var resetIgnored = selection2.selectAll(".reset-ignored").data(ignoredIssues.length ? [0] : []);
73311       resetIgnored.exit().remove();
73312       var resetIgnoredEnter = resetIgnored.enter().append("div").attr("class", "reset-ignored section-footer");
73313       resetIgnoredEnter.append("a").attr("href", "#");
73314       resetIgnored = resetIgnored.merge(resetIgnoredEnter);
73315       resetIgnored.select("a").html(_t.html("inspector.title_count", { title: { html: _t.html("issues.reset_ignored") }, count: ignoredIssues.length }));
73316       resetIgnored.on("click", function(d3_event) {
73317         d3_event.preventDefault();
73318         context.validator().resetIgnoredIssues();
73319       });
73320     }
73321     function setNoIssuesText(selection2) {
73322       var opts = getOptions();
73323       function checkForHiddenIssues(cases) {
73324         for (var type2 in cases) {
73325           var hiddenOpts = cases[type2];
73326           var hiddenIssues = context.validator().getIssues(hiddenOpts);
73327           if (hiddenIssues.length) {
73328             selection2.select(".box .details").html("").call(_t.append(
73329               "issues.no_issues.hidden_issues." + type2,
73330               { count: hiddenIssues.length.toString() }
73331             ));
73332             return;
73333           }
73334         }
73335         selection2.select(".box .details").html("").call(_t.append("issues.no_issues.hidden_issues.none"));
73336       }
73337       var messageType;
73338       if (opts.what === "edited" && opts.where === "visible") {
73339         messageType = "edits_in_view";
73340         checkForHiddenIssues({
73341           elsewhere: { what: "edited", where: "all" },
73342           everything_else: { what: "all", where: "visible" },
73343           disabled_rules: { what: "edited", where: "visible", includeDisabledRules: "only" },
73344           everything_else_elsewhere: { what: "all", where: "all" },
73345           disabled_rules_elsewhere: { what: "edited", where: "all", includeDisabledRules: "only" },
73346           ignored_issues: { what: "edited", where: "visible", includeIgnored: "only" },
73347           ignored_issues_elsewhere: { what: "edited", where: "all", includeIgnored: "only" }
73348         });
73349       } else if (opts.what === "edited" && opts.where === "all") {
73350         messageType = "edits";
73351         checkForHiddenIssues({
73352           everything_else: { what: "all", where: "all" },
73353           disabled_rules: { what: "edited", where: "all", includeDisabledRules: "only" },
73354           ignored_issues: { what: "edited", where: "all", includeIgnored: "only" }
73355         });
73356       } else if (opts.what === "all" && opts.where === "visible") {
73357         messageType = "everything_in_view";
73358         checkForHiddenIssues({
73359           elsewhere: { what: "all", where: "all" },
73360           disabled_rules: { what: "all", where: "visible", includeDisabledRules: "only" },
73361           disabled_rules_elsewhere: { what: "all", where: "all", includeDisabledRules: "only" },
73362           ignored_issues: { what: "all", where: "visible", includeIgnored: "only" },
73363           ignored_issues_elsewhere: { what: "all", where: "all", includeIgnored: "only" }
73364         });
73365       } else if (opts.what === "all" && opts.where === "all") {
73366         messageType = "everything";
73367         checkForHiddenIssues({
73368           disabled_rules: { what: "all", where: "all", includeDisabledRules: "only" },
73369           ignored_issues: { what: "all", where: "all", includeIgnored: "only" }
73370         });
73371       }
73372       if (opts.what === "edited" && context.history().difference().summary().length === 0) {
73373         messageType = "no_edits";
73374       }
73375       selection2.select(".box .message").html("").call(_t.append("issues.no_issues.message." + messageType));
73376     }
73377     context.validator().on("validated.uiSectionValidationStatus", function() {
73378       window.requestIdleCallback(section.reRender);
73379     });
73380     context.map().on(
73381       "move.uiSectionValidationStatus",
73382       debounce_default(function() {
73383         window.requestIdleCallback(section.reRender);
73384       }, 1e3)
73385     );
73386     return section;
73387   }
73388
73389   // modules/ui/panes/issues.js
73390   function uiPaneIssues(context) {
73391     var issuesPane = uiPane("issues", context).key(_t("issues.key")).label(_t.append("issues.title")).description(_t.append("issues.title")).iconName("iD-icon-alert").sections([
73392       uiSectionValidationOptions(context),
73393       uiSectionValidationStatus(context),
73394       uiSectionValidationIssues("issues-errors", "error", context),
73395       uiSectionValidationIssues("issues-warnings", "warning", context),
73396       uiSectionValidationRules(context)
73397     ]);
73398     return issuesPane;
73399   }
73400
73401   // modules/ui/settings/custom_data.js
73402   function uiSettingsCustomData(context) {
73403     var dispatch14 = dispatch_default("change");
73404     function render(selection2) {
73405       var dataLayer = context.layers().layer("data");
73406       var _origSettings = {
73407         fileList: dataLayer && dataLayer.fileList() || null,
73408         url: corePreferences("settings-custom-data-url")
73409       };
73410       var _currSettings = {
73411         fileList: dataLayer && dataLayer.fileList() || null
73412         // url: prefs('settings-custom-data-url')
73413       };
73414       var modal = uiConfirm(selection2).okButton();
73415       modal.classed("settings-modal settings-custom-data", true);
73416       modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_data.header"));
73417       var textSection = modal.select(".modal-section.message-text");
73418       textSection.append("pre").attr("class", "instructions-file").call(_t.append("settings.custom_data.file.instructions"));
73419       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) {
73420         var files = d3_event.target.files;
73421         if (files && files.length) {
73422           _currSettings.url = "";
73423           textSection.select(".field-url").property("value", "");
73424           _currSettings.fileList = files;
73425         } else {
73426           _currSettings.fileList = null;
73427         }
73428       });
73429       textSection.append("h4").call(_t.append("settings.custom_data.or"));
73430       textSection.append("pre").attr("class", "instructions-url").call(_t.append("settings.custom_data.url.instructions"));
73431       textSection.append("textarea").attr("class", "field-url").attr("placeholder", _t("settings.custom_data.url.placeholder")).call(utilNoAuto).property("value", _currSettings.url);
73432       var buttonSection = modal.select(".modal-section.buttons");
73433       buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
73434       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
73435       buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
73436       function isSaveDisabled() {
73437         return null;
73438       }
73439       function clickCancel() {
73440         textSection.select(".field-url").property("value", _origSettings.url);
73441         corePreferences("settings-custom-data-url", _origSettings.url);
73442         this.blur();
73443         modal.close();
73444       }
73445       function clickSave() {
73446         _currSettings.url = textSection.select(".field-url").property("value").trim();
73447         if (_currSettings.url) {
73448           _currSettings.fileList = null;
73449         }
73450         if (_currSettings.fileList) {
73451           _currSettings.url = "";
73452         }
73453         corePreferences("settings-custom-data-url", _currSettings.url);
73454         this.blur();
73455         modal.close();
73456         dispatch14.call("change", this, _currSettings);
73457       }
73458     }
73459     return utilRebind(render, dispatch14, "on");
73460   }
73461
73462   // modules/ui/sections/data_layers.js
73463   function uiSectionDataLayers(context) {
73464     var settingsCustomData = uiSettingsCustomData(context).on("change", customChanged);
73465     var layers = context.layers();
73466     var section = uiSection("data-layers", context).label(() => _t.append("map_data.data_layers")).disclosureContent(renderDisclosureContent);
73467     function renderDisclosureContent(selection2) {
73468       var container = selection2.selectAll(".data-layer-container").data([0]);
73469       container.enter().append("div").attr("class", "data-layer-container").merge(container).call(drawOsmItems).call(drawQAItems).call(drawCustomDataItems).call(drawVectorItems).call(drawPanelItems);
73470     }
73471     function showsLayer(which) {
73472       var layer = layers.layer(which);
73473       if (layer) {
73474         return layer.enabled();
73475       }
73476       return false;
73477     }
73478     function setLayer(which, enabled) {
73479       var mode = context.mode();
73480       if (mode && /^draw/.test(mode.id))
73481         return;
73482       var layer = layers.layer(which);
73483       if (layer) {
73484         layer.enabled(enabled);
73485         if (!enabled && (which === "osm" || which === "notes")) {
73486           context.enter(modeBrowse(context));
73487         }
73488       }
73489     }
73490     function toggleLayer(which) {
73491       setLayer(which, !showsLayer(which));
73492     }
73493     function drawOsmItems(selection2) {
73494       var osmKeys = ["osm", "notes"];
73495       var osmLayers = layers.all().filter(function(obj) {
73496         return osmKeys.indexOf(obj.id) !== -1;
73497       });
73498       var ul = selection2.selectAll(".layer-list-osm").data([0]);
73499       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-osm").merge(ul);
73500       var li = ul.selectAll(".list-item").data(osmLayers);
73501       li.exit().remove();
73502       var liEnter = li.enter().append("li").attr("class", function(d2) {
73503         return "list-item list-item-" + d2.id;
73504       });
73505       var labelEnter = liEnter.append("label").each(function(d2) {
73506         if (d2.id === "osm") {
73507           select_default2(this).call(
73508             uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).keys([uiCmd("\u2325" + _t("area_fill.wireframe.key"))]).placement("bottom")
73509           );
73510         } else {
73511           select_default2(this).call(
73512             uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).placement("bottom")
73513           );
73514         }
73515       });
73516       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
73517         toggleLayer(d2.id);
73518       });
73519       labelEnter.append("span").html(function(d2) {
73520         return _t.html("map_data.layers." + d2.id + ".title");
73521       });
73522       li.merge(liEnter).classed("active", function(d2) {
73523         return d2.layer.enabled();
73524       }).selectAll("input").property("checked", function(d2) {
73525         return d2.layer.enabled();
73526       });
73527     }
73528     function drawQAItems(selection2) {
73529       var qaKeys = ["keepRight", "improveOSM", "osmose"];
73530       var qaLayers = layers.all().filter(function(obj) {
73531         return qaKeys.indexOf(obj.id) !== -1;
73532       });
73533       var ul = selection2.selectAll(".layer-list-qa").data([0]);
73534       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-qa").merge(ul);
73535       var li = ul.selectAll(".list-item").data(qaLayers);
73536       li.exit().remove();
73537       var liEnter = li.enter().append("li").attr("class", function(d2) {
73538         return "list-item list-item-" + d2.id;
73539       });
73540       var labelEnter = liEnter.append("label").each(function(d2) {
73541         select_default2(this).call(
73542           uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).placement("bottom")
73543         );
73544       });
73545       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
73546         toggleLayer(d2.id);
73547       });
73548       labelEnter.append("span").each(function(d2) {
73549         _t.append("map_data.layers." + d2.id + ".title")(select_default2(this));
73550       });
73551       li.merge(liEnter).classed("active", function(d2) {
73552         return d2.layer.enabled();
73553       }).selectAll("input").property("checked", function(d2) {
73554         return d2.layer.enabled();
73555       });
73556     }
73557     function drawVectorItems(selection2) {
73558       var dataLayer = layers.layer("data");
73559       var vtData = [
73560         {
73561           name: "Detroit Neighborhoods/Parks",
73562           src: "neighborhoods-parks",
73563           tooltip: "Neighborhood boundaries and parks as compiled by City of Detroit in concert with community groups.",
73564           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"
73565         },
73566         {
73567           name: "Detroit Composite POIs",
73568           src: "composite-poi",
73569           tooltip: "Fire Inspections, Business Licenses, and other public location data collated from the City of Detroit.",
73570           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"
73571         },
73572         {
73573           name: "Detroit All-The-Places POIs",
73574           src: "alltheplaces-poi",
73575           tooltip: "Public domain business location data created by web scrapers.",
73576           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"
73577         }
73578       ];
73579       var detroit = geoExtent([-83.5, 42.1], [-82.8, 42.5]);
73580       var showVectorItems = context.map().zoom() > 9 && detroit.contains(context.map().center());
73581       var container = selection2.selectAll(".vectortile-container").data(showVectorItems ? [0] : []);
73582       container.exit().remove();
73583       var containerEnter = container.enter().append("div").attr("class", "vectortile-container");
73584       containerEnter.append("h4").attr("class", "vectortile-header").text("Detroit Vector Tiles (Beta)");
73585       containerEnter.append("ul").attr("class", "layer-list layer-list-vectortile");
73586       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");
73587       container = container.merge(containerEnter);
73588       var ul = container.selectAll(".layer-list-vectortile");
73589       var li = ul.selectAll(".list-item").data(vtData);
73590       li.exit().remove();
73591       var liEnter = li.enter().append("li").attr("class", function(d2) {
73592         return "list-item list-item-" + d2.src;
73593       });
73594       var labelEnter = liEnter.append("label").each(function(d2) {
73595         select_default2(this).call(
73596           uiTooltip().title(d2.tooltip).placement("top")
73597         );
73598       });
73599       labelEnter.append("input").attr("type", "radio").attr("name", "vectortile").on("change", selectVTLayer);
73600       labelEnter.append("span").text(function(d2) {
73601         return d2.name;
73602       });
73603       li.merge(liEnter).classed("active", isVTLayerSelected).selectAll("input").property("checked", isVTLayerSelected);
73604       function isVTLayerSelected(d2) {
73605         return dataLayer && dataLayer.template() === d2.template;
73606       }
73607       function selectVTLayer(d3_event, d2) {
73608         corePreferences("settings-custom-data-url", d2.template);
73609         if (dataLayer) {
73610           dataLayer.template(d2.template, d2.src);
73611           dataLayer.enabled(true);
73612         }
73613       }
73614     }
73615     function drawCustomDataItems(selection2) {
73616       var dataLayer = layers.layer("data");
73617       var hasData = dataLayer && dataLayer.hasData();
73618       var showsData = hasData && dataLayer.enabled();
73619       var ul = selection2.selectAll(".layer-list-data").data(dataLayer ? [0] : []);
73620       ul.exit().remove();
73621       var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-data");
73622       var liEnter = ulEnter.append("li").attr("class", "list-item-data");
73623       var labelEnter = liEnter.append("label").call(
73624         uiTooltip().title(() => _t.append("map_data.layers.custom.tooltip")).placement("top")
73625       );
73626       labelEnter.append("input").attr("type", "checkbox").on("change", function() {
73627         toggleLayer("data");
73628       });
73629       labelEnter.append("span").call(_t.append("map_data.layers.custom.title"));
73630       liEnter.append("button").attr("class", "open-data-options").call(
73631         uiTooltip().title(() => _t.append("settings.custom_data.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
73632       ).on("click", function(d3_event) {
73633         d3_event.preventDefault();
73634         editCustom();
73635       }).call(svgIcon("#iD-icon-more"));
73636       liEnter.append("button").attr("class", "zoom-to-data").call(
73637         uiTooltip().title(() => _t.append("map_data.layers.custom.zoom")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
73638       ).on("click", function(d3_event) {
73639         if (select_default2(this).classed("disabled"))
73640           return;
73641         d3_event.preventDefault();
73642         d3_event.stopPropagation();
73643         dataLayer.fitZoom();
73644       }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
73645       ul = ul.merge(ulEnter);
73646       ul.selectAll(".list-item-data").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
73647       ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
73648     }
73649     function editCustom() {
73650       context.container().call(settingsCustomData);
73651     }
73652     function customChanged(d2) {
73653       var dataLayer = layers.layer("data");
73654       if (d2 && d2.url) {
73655         dataLayer.url(d2.url);
73656       } else if (d2 && d2.fileList) {
73657         dataLayer.fileList(d2.fileList);
73658       }
73659     }
73660     function drawPanelItems(selection2) {
73661       var panelsListEnter = selection2.selectAll(".md-extras-list").data([0]).enter().append("ul").attr("class", "layer-list md-extras-list");
73662       var historyPanelLabelEnter = panelsListEnter.append("li").attr("class", "history-panel-toggle-item").append("label").call(
73663         uiTooltip().title(() => _t.append("map_data.history_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.history.key"))]).placement("top")
73664       );
73665       historyPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
73666         d3_event.preventDefault();
73667         context.ui().info.toggle("history");
73668       });
73669       historyPanelLabelEnter.append("span").call(_t.append("map_data.history_panel.title"));
73670       var measurementPanelLabelEnter = panelsListEnter.append("li").attr("class", "measurement-panel-toggle-item").append("label").call(
73671         uiTooltip().title(() => _t.append("map_data.measurement_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.measurement.key"))]).placement("top")
73672       );
73673       measurementPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
73674         d3_event.preventDefault();
73675         context.ui().info.toggle("measurement");
73676       });
73677       measurementPanelLabelEnter.append("span").call(_t.append("map_data.measurement_panel.title"));
73678     }
73679     context.layers().on("change.uiSectionDataLayers", section.reRender);
73680     context.map().on(
73681       "move.uiSectionDataLayers",
73682       debounce_default(function() {
73683         window.requestIdleCallback(section.reRender);
73684       }, 1e3)
73685     );
73686     return section;
73687   }
73688
73689   // modules/ui/sections/map_features.js
73690   function uiSectionMapFeatures(context) {
73691     var _features = context.features().keys();
73692     var section = uiSection("map-features", context).label(() => _t.append("map_data.map_features")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
73693     function renderDisclosureContent(selection2) {
73694       var container = selection2.selectAll(".layer-feature-list-container").data([0]);
73695       var containerEnter = container.enter().append("div").attr("class", "layer-feature-list-container");
73696       containerEnter.append("ul").attr("class", "layer-list layer-feature-list");
73697       var footer = containerEnter.append("div").attr("class", "feature-list-links section-footer");
73698       footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
73699         d3_event.preventDefault();
73700         context.features().disableAll();
73701       });
73702       footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
73703         d3_event.preventDefault();
73704         context.features().enableAll();
73705       });
73706       container = container.merge(containerEnter);
73707       container.selectAll(".layer-feature-list").call(drawListItems, _features, "checkbox", "feature", clickFeature, showsFeature);
73708     }
73709     function drawListItems(selection2, data, type2, name, change, active) {
73710       var items = selection2.selectAll("li").data(data);
73711       items.exit().remove();
73712       var enter = items.enter().append("li").call(
73713         uiTooltip().title(function(d2) {
73714           var tip = _t.append(name + "." + d2 + ".tooltip");
73715           if (autoHiddenFeature(d2)) {
73716             var msg = showsLayer("osm") ? _t.append("map_data.autohidden") : _t.append("map_data.osmhidden");
73717             return (selection3) => {
73718               selection3.call(tip);
73719               selection3.append("div").call(msg);
73720             };
73721           }
73722           return tip;
73723         }).placement("top")
73724       );
73725       var label = enter.append("label");
73726       label.append("input").attr("type", type2).attr("name", name).on("change", change);
73727       label.append("span").html(function(d2) {
73728         return _t.html(name + "." + d2 + ".description");
73729       });
73730       items = items.merge(enter);
73731       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", autoHiddenFeature);
73732     }
73733     function autoHiddenFeature(d2) {
73734       return context.features().autoHidden(d2);
73735     }
73736     function showsFeature(d2) {
73737       return context.features().enabled(d2);
73738     }
73739     function clickFeature(d3_event, d2) {
73740       context.features().toggle(d2);
73741     }
73742     function showsLayer(id2) {
73743       var layer = context.layers().layer(id2);
73744       return layer && layer.enabled();
73745     }
73746     context.features().on("change.map_features", section.reRender);
73747     return section;
73748   }
73749
73750   // modules/ui/sections/map_style_options.js
73751   function uiSectionMapStyleOptions(context) {
73752     var section = uiSection("fill-area", context).label(() => _t.append("map_data.style_options")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
73753     function renderDisclosureContent(selection2) {
73754       var container = selection2.selectAll(".layer-fill-list").data([0]);
73755       container.enter().append("ul").attr("class", "layer-list layer-fill-list").merge(container).call(drawListItems, context.map().areaFillOptions, "radio", "area_fill", setFill, isActiveFill);
73756       var container2 = selection2.selectAll(".layer-visual-diff-list").data([0]);
73757       container2.enter().append("ul").attr("class", "layer-list layer-visual-diff-list").merge(container2).call(drawListItems, ["highlight_edits"], "checkbox", "visual_diff", toggleHighlightEdited, function() {
73758         return context.surface().classed("highlight-edited");
73759       });
73760     }
73761     function drawListItems(selection2, data, type2, name, change, active) {
73762       var items = selection2.selectAll("li").data(data);
73763       items.exit().remove();
73764       var enter = items.enter().append("li").call(
73765         uiTooltip().title(function(d2) {
73766           return _t.append(name + "." + d2 + ".tooltip");
73767         }).keys(function(d2) {
73768           var key = d2 === "wireframe" ? _t("area_fill.wireframe.key") : null;
73769           if (d2 === "highlight_edits")
73770             key = _t("map_data.highlight_edits.key");
73771           return key ? [key] : null;
73772         }).placement("top")
73773       );
73774       var label = enter.append("label");
73775       label.append("input").attr("type", type2).attr("name", name).on("change", change);
73776       label.append("span").html(function(d2) {
73777         return _t.html(name + "." + d2 + ".description");
73778       });
73779       items = items.merge(enter);
73780       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
73781     }
73782     function isActiveFill(d2) {
73783       return context.map().activeAreaFill() === d2;
73784     }
73785     function toggleHighlightEdited(d3_event) {
73786       d3_event.preventDefault();
73787       context.map().toggleHighlightEdited();
73788     }
73789     function setFill(d3_event, d2) {
73790       context.map().activeAreaFill(d2);
73791     }
73792     context.map().on("changeHighlighting.ui_style, changeAreaFill.ui_style", section.reRender);
73793     return section;
73794   }
73795
73796   // modules/ui/settings/local_photos.js
73797   function uiSettingsLocalPhotos(context) {
73798     var dispatch14 = dispatch_default("change");
73799     var photoLayer = context.layers().layer("local-photos");
73800     var modal;
73801     function render(selection2) {
73802       modal = uiConfirm(selection2).okButton();
73803       modal.classed("settings-modal settings-local-photos", true);
73804       modal.select(".modal-section.header").append("h3").call(_t.append("local_photos.header"));
73805       modal.select(".modal-section.message-text").append("div").classed("local-photos", true);
73806       var instructionsSection = modal.select(".modal-section.message-text .local-photos").append("div").classed("instructions", true);
73807       instructionsSection.append("p").classed("instructions-local-photos", true).call(_t.append("local_photos.file.instructions"));
73808       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) {
73809         var files = d3_event.target.files;
73810         if (files && files.length) {
73811           photoList.select("ul").append("li").classed("placeholder", true).append("div");
73812           dispatch14.call("change", this, files);
73813         }
73814         d3_event.target.value = null;
73815       });
73816       instructionsSection.append("label").attr("for", "local-photo-files").classed("button", true).call(_t.append("local_photos.file.label"));
73817       const photoList = modal.select(".modal-section.message-text .local-photos").append("div").append("div").classed("list-local-photos", true);
73818       photoList.append("ul");
73819       updatePhotoList(photoList.select("ul"));
73820       context.layers().on("change", () => updatePhotoList(photoList.select("ul")));
73821     }
73822     function updatePhotoList(container) {
73823       function locationUnavailable(d2) {
73824         return !(isArray_default(d2.loc) && isNumber_default(d2.loc[0]) && isNumber_default(d2.loc[1]));
73825       }
73826       container.selectAll("li.placeholder").remove();
73827       let selection2 = container.selectAll("li").data(photoLayer.getPhotos() ?? [], (d2) => d2.id);
73828       selection2.exit().remove();
73829       const selectionEnter = selection2.enter().append("li");
73830       selectionEnter.append("span").classed("filename", true);
73831       selectionEnter.append("button").classed("form-field-button zoom-to-data", true).attr("title", _t("local_photos.zoom_single")).call(svgIcon("#iD-icon-framed-dot"));
73832       selectionEnter.append("button").classed("form-field-button no-geolocation", true).call(svgIcon("#iD-icon-alert")).call(
73833         uiTooltip().title(() => _t.append("local_photos.no_geolocation.tooltip")).placement("left")
73834       );
73835       selectionEnter.append("button").classed("form-field-button remove", true).attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
73836       selection2 = selection2.merge(selectionEnter);
73837       selection2.classed("invalid", locationUnavailable);
73838       selection2.select("span.filename").text((d2) => d2.name).attr("title", (d2) => d2.name);
73839       selection2.select("span.filename").on("click", (d3_event, d2) => {
73840         photoLayer.openPhoto(d3_event, d2, false);
73841       });
73842       selection2.select("button.zoom-to-data").on("click", (d3_event, d2) => {
73843         photoLayer.openPhoto(d3_event, d2, true);
73844       });
73845       selection2.select("button.remove").on("click", (d3_event, d2) => {
73846         photoLayer.removePhoto(d2.id);
73847         updatePhotoList(container);
73848       });
73849     }
73850     return utilRebind(render, dispatch14, "on");
73851   }
73852
73853   // modules/ui/sections/photo_overlays.js
73854   function uiSectionPhotoOverlays(context) {
73855     var settingsLocalPhotos = uiSettingsLocalPhotos(context).on("change", localPhotosChanged);
73856     var layers = context.layers();
73857     var section = uiSection("photo-overlays", context).label(() => _t.append("photo_overlays.title")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
73858     function renderDisclosureContent(selection2) {
73859       var container = selection2.selectAll(".photo-overlay-container").data([0]);
73860       container.enter().append("div").attr("class", "photo-overlay-container").merge(container).call(drawPhotoItems).call(drawPhotoTypeItems).call(drawDateFilter).call(drawUsernameFilter).call(drawLocalPhotos);
73861     }
73862     function drawPhotoItems(selection2) {
73863       var photoKeys = context.photos().overlayLayerIDs();
73864       var photoLayers = layers.all().filter(function(obj) {
73865         return photoKeys.indexOf(obj.id) !== -1;
73866       });
73867       var data = photoLayers.filter(function(obj) {
73868         if (!obj.layer.supported())
73869           return false;
73870         if (layerEnabled(obj))
73871           return true;
73872         if (typeof obj.layer.validHere === "function") {
73873           return obj.layer.validHere(context.map().extent(), context.map().zoom());
73874         }
73875         return true;
73876       });
73877       function layerSupported(d2) {
73878         return d2.layer && d2.layer.supported();
73879       }
73880       function layerEnabled(d2) {
73881         return layerSupported(d2) && d2.layer.enabled();
73882       }
73883       function layerRendered(d2) {
73884         return d2.layer.rendered?.(context.map().zoom()) ?? true;
73885       }
73886       var ul = selection2.selectAll(".layer-list-photos").data([0]);
73887       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photos").merge(ul);
73888       var li = ul.selectAll(".list-item-photos").data(data);
73889       li.exit().remove();
73890       var liEnter = li.enter().append("li").attr("class", function(d2) {
73891         var classes = "list-item-photos list-item-" + d2.id;
73892         if (d2.id === "mapillary-signs" || d2.id === "mapillary-map-features") {
73893           classes += " indented";
73894         }
73895         return classes;
73896       });
73897       var labelEnter = liEnter.append("label").each(function(d2) {
73898         var titleID;
73899         if (d2.id === "mapillary-signs")
73900           titleID = "mapillary.signs.tooltip";
73901         else if (d2.id === "mapillary")
73902           titleID = "mapillary_images.tooltip";
73903         else if (d2.id === "kartaview")
73904           titleID = "kartaview_images.tooltip";
73905         else
73906           titleID = d2.id.replace(/-/g, "_") + ".tooltip";
73907         select_default2(this).call(
73908           uiTooltip().title(() => {
73909             if (!layerRendered(d2)) {
73910               return _t.append("street_side.minzoom_tooltip");
73911             } else {
73912               return _t.append(titleID);
73913             }
73914           }).placement("top")
73915         );
73916       });
73917       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
73918         toggleLayer(d2.id);
73919       });
73920       labelEnter.append("span").html(function(d2) {
73921         var id2 = d2.id;
73922         if (id2 === "mapillary-signs")
73923           id2 = "photo_overlays.traffic_signs";
73924         return _t.html(id2.replace(/-/g, "_") + ".title");
73925       });
73926       li.merge(liEnter).classed("active", layerEnabled).selectAll("input").property("disabled", (d2) => !layerRendered(d2)).property("checked", layerEnabled);
73927     }
73928     function drawPhotoTypeItems(selection2) {
73929       var data = context.photos().allPhotoTypes();
73930       function typeEnabled(d2) {
73931         return context.photos().showsPhotoType(d2);
73932       }
73933       var ul = selection2.selectAll(".layer-list-photo-types").data([0]);
73934       ul.exit().remove();
73935       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photo-types").merge(ul);
73936       var li = ul.selectAll(".list-item-photo-types").data(context.photos().shouldFilterByPhotoType() ? data : []);
73937       li.exit().remove();
73938       var liEnter = li.enter().append("li").attr("class", function(d2) {
73939         return "list-item-photo-types list-item-" + d2;
73940       });
73941       var labelEnter = liEnter.append("label").each(function(d2) {
73942         select_default2(this).call(
73943           uiTooltip().title(() => _t.append("photo_overlays.photo_type." + d2 + ".tooltip")).placement("top")
73944         );
73945       });
73946       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
73947         context.photos().togglePhotoType(d2);
73948       });
73949       labelEnter.append("span").html(function(d2) {
73950         return _t.html("photo_overlays.photo_type." + d2 + ".title");
73951       });
73952       li.merge(liEnter).classed("active", typeEnabled).selectAll("input").property("checked", typeEnabled);
73953     }
73954     function drawDateFilter(selection2) {
73955       var data = context.photos().dateFilters();
73956       function filterEnabled(d2) {
73957         return context.photos().dateFilterValue(d2);
73958       }
73959       var ul = selection2.selectAll(".layer-list-date-filter").data([0]);
73960       ul.exit().remove();
73961       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-date-filter").merge(ul);
73962       var li = ul.selectAll(".list-item-date-filter").data(context.photos().shouldFilterByDate() ? data : []);
73963       li.exit().remove();
73964       var liEnter = li.enter().append("li").attr("class", "list-item-date-filter");
73965       var labelEnter = liEnter.append("label").each(function(d2) {
73966         select_default2(this).call(
73967           uiTooltip().title(() => _t.append("photo_overlays.date_filter." + d2 + ".tooltip")).placement("top")
73968         );
73969       });
73970       labelEnter.append("span").each(function(d2) {
73971         _t.append("photo_overlays.date_filter." + d2 + ".title")(select_default2(this));
73972       });
73973       labelEnter.append("input").attr("type", "date").attr("class", "list-item-input").attr("placeholder", _t("units.year_month_day")).call(utilNoAuto).each(function(d2) {
73974         utilGetSetValue(select_default2(this), context.photos().dateFilterValue(d2) || "");
73975       }).on("change", function(d3_event, d2) {
73976         var value = utilGetSetValue(select_default2(this)).trim();
73977         context.photos().setDateFilter(d2, value, true);
73978         li.selectAll("input").each(function(d4) {
73979           utilGetSetValue(select_default2(this), context.photos().dateFilterValue(d4) || "");
73980         });
73981       });
73982       li = li.merge(liEnter).classed("active", filterEnabled);
73983     }
73984     function drawUsernameFilter(selection2) {
73985       function filterEnabled() {
73986         return context.photos().usernames();
73987       }
73988       var ul = selection2.selectAll(".layer-list-username-filter").data([0]);
73989       ul.exit().remove();
73990       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-username-filter").merge(ul);
73991       var li = ul.selectAll(".list-item-username-filter").data(context.photos().shouldFilterByUsername() ? ["username-filter"] : []);
73992       li.exit().remove();
73993       var liEnter = li.enter().append("li").attr("class", "list-item-username-filter");
73994       var labelEnter = liEnter.append("label").each(function() {
73995         select_default2(this).call(
73996           uiTooltip().title(() => _t.append("photo_overlays.username_filter.tooltip")).placement("top")
73997         );
73998       });
73999       labelEnter.append("span").call(_t.append("photo_overlays.username_filter.title"));
74000       labelEnter.append("input").attr("type", "text").attr("class", "list-item-input").call(utilNoAuto).property("value", usernameValue).on("change", function() {
74001         var value = select_default2(this).property("value");
74002         context.photos().setUsernameFilter(value, true);
74003         select_default2(this).property("value", usernameValue);
74004       });
74005       li.merge(liEnter).classed("active", filterEnabled);
74006       function usernameValue() {
74007         var usernames = context.photos().usernames();
74008         if (usernames)
74009           return usernames.join("; ");
74010         return usernames;
74011       }
74012     }
74013     function toggleLayer(which) {
74014       setLayer(which, !showsLayer(which));
74015     }
74016     function showsLayer(which) {
74017       var layer = layers.layer(which);
74018       if (layer) {
74019         return layer.enabled();
74020       }
74021       return false;
74022     }
74023     function setLayer(which, enabled) {
74024       var layer = layers.layer(which);
74025       if (layer) {
74026         layer.enabled(enabled);
74027       }
74028     }
74029     function drawLocalPhotos(selection2) {
74030       var photoLayer = layers.layer("local-photos");
74031       var hasData = photoLayer && photoLayer.hasData();
74032       var showsData = hasData && photoLayer.enabled();
74033       var ul = selection2.selectAll(".layer-list-local-photos").data(photoLayer ? [0] : []);
74034       ul.exit().remove();
74035       var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-local-photos");
74036       var localPhotosEnter = ulEnter.append("li").attr("class", "list-item-local-photos");
74037       var localPhotosLabelEnter = localPhotosEnter.append("label").call(uiTooltip().title(() => _t.append("local_photos.tooltip")));
74038       localPhotosLabelEnter.append("input").attr("type", "checkbox").on("change", function() {
74039         toggleLayer("local-photos");
74040       });
74041       localPhotosLabelEnter.call(_t.append("local_photos.header"));
74042       localPhotosEnter.append("button").attr("class", "open-data-options").call(
74043         uiTooltip().title(() => _t.append("local_photos.tooltip_edit")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
74044       ).on("click", function(d3_event) {
74045         d3_event.preventDefault();
74046         editLocalPhotos();
74047       }).call(svgIcon("#iD-icon-more"));
74048       localPhotosEnter.append("button").attr("class", "zoom-to-data").call(
74049         uiTooltip().title(() => _t.append("local_photos.zoom")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
74050       ).on("click", function(d3_event) {
74051         if (select_default2(this).classed("disabled"))
74052           return;
74053         d3_event.preventDefault();
74054         d3_event.stopPropagation();
74055         photoLayer.fitZoom();
74056       }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
74057       ul = ul.merge(ulEnter);
74058       ul.selectAll(".list-item-local-photos").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
74059       ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
74060     }
74061     function editLocalPhotos() {
74062       context.container().call(settingsLocalPhotos);
74063     }
74064     function localPhotosChanged(d2) {
74065       var localPhotosLayer = layers.layer("local-photos");
74066       localPhotosLayer.fileList(d2);
74067     }
74068     context.layers().on("change.uiSectionPhotoOverlays", section.reRender);
74069     context.photos().on("change.uiSectionPhotoOverlays", section.reRender);
74070     context.map().on(
74071       "move.photo_overlays",
74072       debounce_default(function() {
74073         window.requestIdleCallback(section.reRender);
74074       }, 1e3)
74075     );
74076     return section;
74077   }
74078
74079   // modules/ui/panes/map_data.js
74080   function uiPaneMapData(context) {
74081     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([
74082       uiSectionDataLayers(context),
74083       uiSectionPhotoOverlays(context),
74084       uiSectionMapStyleOptions(context),
74085       uiSectionMapFeatures(context)
74086     ]);
74087     return mapDataPane;
74088   }
74089
74090   // modules/ui/panes/preferences.js
74091   function uiPanePreferences(context) {
74092     let preferencesPane = uiPane("preferences", context).key(_t("preferences.key")).label(_t.append("preferences.title")).description(_t.append("preferences.description")).iconName("fas-user-cog").sections([
74093       uiSectionPrivacy(context)
74094     ]);
74095     return preferencesPane;
74096   }
74097
74098   // modules/ui/init.js
74099   function uiInit(context) {
74100     var _initCounter = 0;
74101     var _needWidth = {};
74102     var _lastPointerType;
74103     function render(container) {
74104       container.on("click.ui", function(d3_event) {
74105         if (d3_event.button !== 0)
74106           return;
74107         if (!d3_event.composedPath)
74108           return;
74109         var isOkayTarget = d3_event.composedPath().some(function(node) {
74110           return node.nodeType === 1 && // clicking <input> focuses it and/or changes a value
74111           (node.nodeName === "INPUT" || // clicking <label> affects its <input> by default
74112           node.nodeName === "LABEL" || // clicking <a> opens a hyperlink by default
74113           node.nodeName === "A");
74114         });
74115         if (isOkayTarget)
74116           return;
74117         d3_event.preventDefault();
74118       });
74119       var detected = utilDetect();
74120       if ("GestureEvent" in window && // Listening for gesture events on iOS 13.4+ breaks double-tapping,
74121       // but we only need to do this on desktop Safari anyway. – #7694
74122       !detected.isMobileWebKit) {
74123         container.on("gesturestart.ui gesturechange.ui gestureend.ui", function(d3_event) {
74124           d3_event.preventDefault();
74125         });
74126       }
74127       if ("PointerEvent" in window) {
74128         select_default2(window).on("pointerdown.ui pointerup.ui", function(d3_event) {
74129           var pointerType = d3_event.pointerType || "mouse";
74130           if (_lastPointerType !== pointerType) {
74131             _lastPointerType = pointerType;
74132             container.attr("pointer", pointerType);
74133           }
74134         }, true);
74135       } else {
74136         _lastPointerType = "mouse";
74137         container.attr("pointer", "mouse");
74138       }
74139       container.attr("lang", _mainLocalizer.localeCode()).attr("dir", _mainLocalizer.textDirection());
74140       container.call(uiFullScreen(context));
74141       var map2 = context.map();
74142       map2.redrawEnable(false);
74143       map2.on("hitMinZoom.ui", function() {
74144         ui.flash.iconName("#iD-icon-no").label(_t.append("cannot_zoom"))();
74145       });
74146       container.append("svg").attr("id", "ideditor-defs").call(ui.svgDefs);
74147       container.append("div").attr("class", "sidebar").call(ui.sidebar);
74148       var content = container.append("div").attr("class", "main-content active");
74149       content.append("div").attr("class", "top-toolbar-wrap").append("div").attr("class", "top-toolbar fillD").call(uiTopToolbar(context));
74150       content.append("div").attr("class", "main-map").attr("dir", "ltr").call(map2);
74151       var overMap = content.append("div").attr("class", "over-map");
74152       overMap.append("div").attr("class", "select-trap").text("t");
74153       overMap.call(uiMapInMap(context)).call(uiNotice(context));
74154       overMap.append("div").attr("class", "spinner").call(uiSpinner(context));
74155       var controlsWrap = overMap.append("div").attr("class", "map-controls-wrap");
74156       var controls = controlsWrap.append("div").attr("class", "map-controls");
74157       controls.append("div").attr("class", "map-control zoombuttons").call(uiZoom(context));
74158       controls.append("div").attr("class", "map-control zoom-to-selection-control").call(uiZoomToSelection(context));
74159       controls.append("div").attr("class", "map-control geolocate-control").call(uiGeolocate(context));
74160       controlsWrap.on("wheel.mapControls", function(d3_event) {
74161         if (!d3_event.deltaX) {
74162           controlsWrap.node().scrollTop += d3_event.deltaY;
74163         }
74164       });
74165       var panes = overMap.append("div").attr("class", "map-panes");
74166       var uiPanes = [
74167         uiPaneBackground(context),
74168         uiPaneMapData(context),
74169         uiPaneIssues(context),
74170         uiPanePreferences(context),
74171         uiPaneHelp(context)
74172       ];
74173       uiPanes.forEach(function(pane) {
74174         controls.append("div").attr("class", "map-control map-pane-control " + pane.id + "-control").call(pane.renderToggleButton);
74175         panes.call(pane.renderPane);
74176       });
74177       ui.info = uiInfo(context);
74178       overMap.call(ui.info);
74179       overMap.append("div").attr("class", "photoviewer").classed("al", true).classed("hide", true).call(ui.photoviewer);
74180       overMap.append("div").attr("class", "attribution-wrap").attr("dir", "ltr").call(uiAttribution(context));
74181       var about = content.append("div").attr("class", "map-footer");
74182       about.append("div").attr("class", "api-status").call(uiStatus(context));
74183       var footer = about.append("div").attr("class", "map-footer-bar fillD");
74184       footer.append("div").attr("class", "flash-wrap footer-hide");
74185       var footerWrap = footer.append("div").attr("class", "main-footer-wrap footer-show");
74186       footerWrap.append("div").attr("class", "scale-block").call(uiScale(context));
74187       var aboutList = footerWrap.append("div").attr("class", "info-block").append("ul").attr("class", "map-footer-list");
74188       aboutList.append("li").attr("class", "user-list").call(uiContributors(context));
74189       var apiConnections = context.connection().apiConnections();
74190       if (apiConnections && apiConnections.length > 1) {
74191         aboutList.append("li").attr("class", "source-switch").call(
74192           uiSourceSwitch(context).keys(apiConnections)
74193         );
74194       }
74195       aboutList.append("li").attr("class", "issues-info").call(uiIssuesInfo(context));
74196       aboutList.append("li").attr("class", "feature-warning").call(uiFeatureInfo(context));
74197       var issueLinks = aboutList.append("li");
74198       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"));
74199       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"));
74200       aboutList.append("li").attr("class", "version").call(uiVersion(context));
74201       if (!context.embed()) {
74202         aboutList.call(uiAccount(context));
74203       }
74204       ui.onResize();
74205       map2.redrawEnable(true);
74206       ui.hash = behaviorHash(context);
74207       ui.hash();
74208       if (!ui.hash.hadLocation) {
74209         map2.centerZoom([0, 0], 2);
74210       }
74211       window.onbeforeunload = function() {
74212         return context.save();
74213       };
74214       window.onunload = function() {
74215         context.history().unlock();
74216       };
74217       select_default2(window).on("resize.editor", function() {
74218         ui.onResize();
74219       });
74220       var panPixels = 80;
74221       context.keybinding().on("\u232B", function(d3_event) {
74222         d3_event.preventDefault();
74223       }).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) {
74224         if (d3_event) {
74225           d3_event.stopImmediatePropagation();
74226           d3_event.preventDefault();
74227         }
74228         var previousBackground = context.background().findSource(corePreferences("background-last-used-toggle"));
74229         if (previousBackground) {
74230           var currentBackground = context.background().baseLayerSource();
74231           corePreferences("background-last-used-toggle", currentBackground.id);
74232           corePreferences("background-last-used", previousBackground.id);
74233           context.background().baseLayerSource(previousBackground);
74234         }
74235       }).on(_t("area_fill.wireframe.key"), function toggleWireframe(d3_event) {
74236         d3_event.preventDefault();
74237         d3_event.stopPropagation();
74238         context.map().toggleWireframe();
74239       }).on(uiCmd("\u2325" + _t("area_fill.wireframe.key")), function toggleOsmData(d3_event) {
74240         d3_event.preventDefault();
74241         d3_event.stopPropagation();
74242         var mode = context.mode();
74243         if (mode && /^draw/.test(mode.id))
74244           return;
74245         var layer = context.layers().layer("osm");
74246         if (layer) {
74247           layer.enabled(!layer.enabled());
74248           if (!layer.enabled()) {
74249             context.enter(modeBrowse(context));
74250           }
74251         }
74252       }).on(_t("map_data.highlight_edits.key"), function toggleHighlightEdited(d3_event) {
74253         d3_event.preventDefault();
74254         context.map().toggleHighlightEdited();
74255       });
74256       context.on("enter.editor", function(entered) {
74257         container.classed("mode-" + entered.id, true);
74258       }).on("exit.editor", function(exited) {
74259         container.classed("mode-" + exited.id, false);
74260       });
74261       context.enter(modeBrowse(context));
74262       if (!_initCounter++) {
74263         if (!ui.hash.startWalkthrough) {
74264           context.container().call(uiSplash(context)).call(uiRestore(context));
74265         }
74266         context.container().call(ui.shortcuts);
74267       }
74268       var osm = context.connection();
74269       var auth = uiLoading(context).message(_t.html("loading_auth")).blocking(true);
74270       if (osm && auth) {
74271         osm.on("authLoading.ui", function() {
74272           context.container().call(auth);
74273         }).on("authDone.ui", function() {
74274           auth.close();
74275         });
74276       }
74277       _initCounter++;
74278       if (ui.hash.startWalkthrough) {
74279         ui.hash.startWalkthrough = false;
74280         context.container().call(uiIntro(context));
74281       }
74282       function pan(d2) {
74283         return function(d3_event) {
74284           if (d3_event.shiftKey)
74285             return;
74286           if (context.container().select(".combobox").size())
74287             return;
74288           d3_event.preventDefault();
74289           context.map().pan(d2, 100);
74290         };
74291       }
74292     }
74293     let ui = {};
74294     let _loadPromise;
74295     ui.ensureLoaded = () => {
74296       if (_loadPromise)
74297         return _loadPromise;
74298       return _loadPromise = Promise.all([
74299         // must have strings and presets before loading the UI
74300         _mainLocalizer.ensureLoaded(),
74301         _mainPresetIndex.ensureLoaded()
74302       ]).then(() => {
74303         if (!context.container().empty())
74304           render(context.container());
74305       }).catch((err) => console.error(err));
74306     };
74307     ui.restart = function() {
74308       context.keybinding().clear();
74309       _loadPromise = null;
74310       context.container().selectAll("*").remove();
74311       ui.ensureLoaded();
74312     };
74313     ui.lastPointerType = function() {
74314       return _lastPointerType;
74315     };
74316     ui.svgDefs = svgDefs(context);
74317     ui.flash = uiFlash(context);
74318     ui.sidebar = uiSidebar(context);
74319     ui.photoviewer = uiPhotoviewer(context);
74320     ui.shortcuts = uiShortcuts(context);
74321     ui.onResize = function(withPan) {
74322       var map2 = context.map();
74323       var mapDimensions = utilGetDimensions(context.container().select(".main-content"), true);
74324       utilGetDimensions(context.container().select(".sidebar"), true);
74325       if (withPan !== void 0) {
74326         map2.redrawEnable(false);
74327         map2.pan(withPan);
74328         map2.redrawEnable(true);
74329       }
74330       map2.dimensions(mapDimensions);
74331       ui.photoviewer.onMapResize();
74332       ui.checkOverflow(".top-toolbar");
74333       ui.checkOverflow(".map-footer-bar");
74334       var resizeWindowEvent = document.createEvent("Event");
74335       resizeWindowEvent.initEvent("resizeWindow", true, true);
74336       document.dispatchEvent(resizeWindowEvent);
74337     };
74338     ui.checkOverflow = function(selector, reset) {
74339       if (reset) {
74340         delete _needWidth[selector];
74341       }
74342       var selection2 = context.container().select(selector);
74343       if (selection2.empty())
74344         return;
74345       var scrollWidth = selection2.property("scrollWidth");
74346       var clientWidth = selection2.property("clientWidth");
74347       var needed = _needWidth[selector] || scrollWidth;
74348       if (scrollWidth > clientWidth) {
74349         selection2.classed("narrow", true);
74350         if (!_needWidth[selector]) {
74351           _needWidth[selector] = scrollWidth;
74352         }
74353       } else if (scrollWidth >= needed) {
74354         selection2.classed("narrow", false);
74355       }
74356     };
74357     ui.togglePanes = function(showPane) {
74358       var hidePanes = context.container().selectAll(".map-pane.shown");
74359       var side = _mainLocalizer.textDirection() === "ltr" ? "right" : "left";
74360       hidePanes.classed("shown", false).classed("hide", true);
74361       context.container().selectAll(".map-pane-control button").classed("active", false);
74362       if (showPane) {
74363         hidePanes.classed("shown", false).classed("hide", true).style(side, "-500px");
74364         context.container().selectAll("." + showPane.attr("pane") + "-control button").classed("active", true);
74365         showPane.classed("shown", true).classed("hide", false);
74366         if (hidePanes.empty()) {
74367           showPane.style(side, "-500px").transition().duration(200).style(side, "0px");
74368         } else {
74369           showPane.style(side, "0px");
74370         }
74371       } else {
74372         hidePanes.classed("shown", true).classed("hide", false).style(side, "0px").transition().duration(200).style(side, "-500px").on("end", function() {
74373           select_default2(this).classed("shown", false).classed("hide", true);
74374         });
74375       }
74376     };
74377     var _editMenu = uiEditMenu(context);
74378     ui.editMenu = function() {
74379       return _editMenu;
74380     };
74381     ui.showEditMenu = function(anchorPoint, triggerType, operations) {
74382       ui.closeEditMenu();
74383       if (!operations && context.mode().operations)
74384         operations = context.mode().operations();
74385       if (!operations || !operations.length)
74386         return;
74387       if (!context.map().editableDataEnabled())
74388         return;
74389       var surfaceNode = context.surface().node();
74390       if (surfaceNode.focus) {
74391         surfaceNode.focus();
74392       }
74393       operations.forEach(function(operation) {
74394         if (operation.point)
74395           operation.point(anchorPoint);
74396       });
74397       _editMenu.anchorLoc(anchorPoint).triggerType(triggerType).operations(operations);
74398       context.map().supersurface.call(_editMenu);
74399     };
74400     ui.closeEditMenu = function() {
74401       context.map().supersurface.select(".edit-menu").remove();
74402     };
74403     var _saveLoading = select_default2(null);
74404     context.uploader().on("saveStarted.ui", function() {
74405       _saveLoading = uiLoading(context).message(_t.html("save.uploading")).blocking(true);
74406       context.container().call(_saveLoading);
74407     }).on("saveEnded.ui", function() {
74408       _saveLoading.close();
74409       _saveLoading = select_default2(null);
74410     });
74411     marked.use({
74412       mangle: false,
74413       headerIds: false
74414     });
74415     return ui;
74416   }
74417
74418   // modules/core/context.js
74419   function coreContext() {
74420     const dispatch14 = dispatch_default("enter", "exit", "change");
74421     let context = utilRebind({}, dispatch14, "on");
74422     let _deferred2 = /* @__PURE__ */ new Set();
74423     context.version = package_default.version;
74424     context.privacyVersion = "20201202";
74425     context.initialHashParams = window.location.hash ? utilStringQs(window.location.hash) : {};
74426     context.changeset = null;
74427     let _defaultChangesetComment = context.initialHashParams.comment;
74428     let _defaultChangesetSource = context.initialHashParams.source;
74429     let _defaultChangesetHashtags = context.initialHashParams.hashtags;
74430     context.defaultChangesetComment = function(val) {
74431       if (!arguments.length)
74432         return _defaultChangesetComment;
74433       _defaultChangesetComment = val;
74434       return context;
74435     };
74436     context.defaultChangesetSource = function(val) {
74437       if (!arguments.length)
74438         return _defaultChangesetSource;
74439       _defaultChangesetSource = val;
74440       return context;
74441     };
74442     context.defaultChangesetHashtags = function(val) {
74443       if (!arguments.length)
74444         return _defaultChangesetHashtags;
74445       _defaultChangesetHashtags = val;
74446       return context;
74447     };
74448     let _setsDocumentTitle = true;
74449     context.setsDocumentTitle = function(val) {
74450       if (!arguments.length)
74451         return _setsDocumentTitle;
74452       _setsDocumentTitle = val;
74453       return context;
74454     };
74455     let _documentTitleBase = document.title;
74456     context.documentTitleBase = function(val) {
74457       if (!arguments.length)
74458         return _documentTitleBase;
74459       _documentTitleBase = val;
74460       return context;
74461     };
74462     let _ui;
74463     context.ui = () => _ui;
74464     context.lastPointerType = () => _ui.lastPointerType();
74465     let _keybinding = utilKeybinding("context");
74466     context.keybinding = () => _keybinding;
74467     select_default2(document).call(_keybinding);
74468     let _connection = services.osm;
74469     let _history;
74470     let _validator;
74471     let _uploader;
74472     context.connection = () => _connection;
74473     context.history = () => _history;
74474     context.validator = () => _validator;
74475     context.uploader = () => _uploader;
74476     context.preauth = (options2) => {
74477       if (_connection) {
74478         _connection.switch(options2);
74479       }
74480       return context;
74481     };
74482     context.locale = function(locale2) {
74483       if (!arguments.length)
74484         return _mainLocalizer.localeCode();
74485       _mainLocalizer.preferredLocaleCodes(locale2);
74486       return context;
74487     };
74488     function afterLoad(cid, callback) {
74489       return (err, result) => {
74490         if (err) {
74491           if (err.status === 400 || err.status === 401 || err.status === 403) {
74492             if (_connection) {
74493               _connection.logout();
74494             }
74495           }
74496           if (typeof callback === "function") {
74497             callback(err);
74498           }
74499           return;
74500         } else if (_connection && _connection.getConnectionId() !== cid) {
74501           if (typeof callback === "function") {
74502             callback({ message: "Connection Switched", status: -1 });
74503           }
74504           return;
74505         } else {
74506           _history.merge(result.data, result.extent);
74507           if (typeof callback === "function") {
74508             callback(err, result);
74509           }
74510           return;
74511         }
74512       };
74513     }
74514     context.loadTiles = (projection2, callback) => {
74515       const handle = window.requestIdleCallback(() => {
74516         _deferred2.delete(handle);
74517         if (_connection && context.editableDataEnabled()) {
74518           const cid = _connection.getConnectionId();
74519           _connection.loadTiles(projection2, afterLoad(cid, callback));
74520         }
74521       });
74522       _deferred2.add(handle);
74523     };
74524     context.loadTileAtLoc = (loc, callback) => {
74525       const handle = window.requestIdleCallback(() => {
74526         _deferred2.delete(handle);
74527         if (_connection && context.editableDataEnabled()) {
74528           const cid = _connection.getConnectionId();
74529           _connection.loadTileAtLoc(loc, afterLoad(cid, callback));
74530         }
74531       });
74532       _deferred2.add(handle);
74533     };
74534     context.loadEntity = (entityID, callback) => {
74535       if (_connection) {
74536         const cid = _connection.getConnectionId();
74537         _connection.loadEntity(entityID, afterLoad(cid, callback));
74538         _connection.loadEntityRelations(entityID, afterLoad(cid, callback));
74539       }
74540     };
74541     context.zoomToEntity = (entityID, zoomTo) => {
74542       context.loadEntity(entityID, (err, result) => {
74543         if (err)
74544           return;
74545         if (zoomTo !== false) {
74546           const entity = result.data.find((e3) => e3.id === entityID);
74547           if (entity) {
74548             _map.zoomTo(entity);
74549           }
74550         }
74551       });
74552       _map.on("drawn.zoomToEntity", () => {
74553         if (!context.hasEntity(entityID))
74554           return;
74555         _map.on("drawn.zoomToEntity", null);
74556         context.on("enter.zoomToEntity", null);
74557         context.enter(modeSelect(context, [entityID]));
74558       });
74559       context.on("enter.zoomToEntity", () => {
74560         if (_mode.id !== "browse") {
74561           _map.on("drawn.zoomToEntity", null);
74562           context.on("enter.zoomToEntity", null);
74563         }
74564       });
74565     };
74566     let _minEditableZoom = 16;
74567     context.minEditableZoom = function(val) {
74568       if (!arguments.length)
74569         return _minEditableZoom;
74570       _minEditableZoom = val;
74571       if (_connection) {
74572         _connection.tileZoom(val);
74573       }
74574       return context;
74575     };
74576     context.maxCharsForTagKey = () => 255;
74577     context.maxCharsForTagValue = () => 255;
74578     context.maxCharsForRelationRole = () => 255;
74579     context.cleanTagKey = (val) => utilCleanOsmString(val, context.maxCharsForTagKey());
74580     context.cleanTagValue = (val) => utilCleanOsmString(val, context.maxCharsForTagValue());
74581     context.cleanRelationRole = (val) => utilCleanOsmString(val, context.maxCharsForRelationRole());
74582     let _inIntro = false;
74583     context.inIntro = function(val) {
74584       if (!arguments.length)
74585         return _inIntro;
74586       _inIntro = val;
74587       return context;
74588     };
74589     context.save = () => {
74590       if (_inIntro || context.container().select(".modal").size())
74591         return;
74592       let canSave;
74593       if (_mode && _mode.id === "save") {
74594         canSave = false;
74595         if (services.osm && services.osm.isChangesetInflight()) {
74596           _history.clearSaved();
74597           return;
74598         }
74599       } else {
74600         canSave = context.selectedIDs().every((id2) => {
74601           const entity = context.hasEntity(id2);
74602           return entity && !entity.isDegenerate();
74603         });
74604       }
74605       if (canSave) {
74606         _history.save();
74607       }
74608       if (_history.hasChanges()) {
74609         return _t("save.unsaved_changes");
74610       }
74611     };
74612     context.debouncedSave = debounce_default(context.save, 350);
74613     function withDebouncedSave(fn) {
74614       return function() {
74615         const result = fn.apply(_history, arguments);
74616         context.debouncedSave();
74617         return result;
74618       };
74619     }
74620     context.hasEntity = (id2) => _history.graph().hasEntity(id2);
74621     context.entity = (id2) => _history.graph().entity(id2);
74622     let _mode;
74623     context.mode = () => _mode;
74624     context.enter = (newMode) => {
74625       if (_mode) {
74626         _mode.exit();
74627         dispatch14.call("exit", this, _mode);
74628       }
74629       _mode = newMode;
74630       _mode.enter();
74631       dispatch14.call("enter", this, _mode);
74632     };
74633     context.selectedIDs = () => _mode && _mode.selectedIDs && _mode.selectedIDs() || [];
74634     context.activeID = () => _mode && _mode.activeID && _mode.activeID();
74635     let _selectedNoteID;
74636     context.selectedNoteID = function(noteID) {
74637       if (!arguments.length)
74638         return _selectedNoteID;
74639       _selectedNoteID = noteID;
74640       return context;
74641     };
74642     let _selectedErrorID;
74643     context.selectedErrorID = function(errorID) {
74644       if (!arguments.length)
74645         return _selectedErrorID;
74646       _selectedErrorID = errorID;
74647       return context;
74648     };
74649     context.install = (behavior) => context.surface().call(behavior);
74650     context.uninstall = (behavior) => context.surface().call(behavior.off);
74651     let _copyGraph;
74652     context.copyGraph = () => _copyGraph;
74653     let _copyIDs = [];
74654     context.copyIDs = function(val) {
74655       if (!arguments.length)
74656         return _copyIDs;
74657       _copyIDs = val;
74658       _copyGraph = _history.graph();
74659       return context;
74660     };
74661     let _copyLonLat;
74662     context.copyLonLat = function(val) {
74663       if (!arguments.length)
74664         return _copyLonLat;
74665       _copyLonLat = val;
74666       return context;
74667     };
74668     let _background;
74669     context.background = () => _background;
74670     let _features;
74671     context.features = () => _features;
74672     context.hasHiddenConnections = (id2) => {
74673       const graph = _history.graph();
74674       const entity = graph.entity(id2);
74675       return _features.hasHiddenConnections(entity, graph);
74676     };
74677     let _photos;
74678     context.photos = () => _photos;
74679     let _map;
74680     context.map = () => _map;
74681     context.layers = () => _map.layers();
74682     context.surface = () => _map.surface;
74683     context.editableDataEnabled = () => _map.editableDataEnabled();
74684     context.surfaceRect = () => _map.surface.node().getBoundingClientRect();
74685     context.editable = () => {
74686       const mode = context.mode();
74687       if (!mode || mode.id === "save")
74688         return false;
74689       return _map.editableDataEnabled();
74690     };
74691     let _debugFlags = {
74692       tile: false,
74693       // tile boundaries
74694       collision: false,
74695       // label collision bounding boxes
74696       imagery: false,
74697       // imagery bounding polygons
74698       target: false,
74699       // touch targets
74700       downloaded: false
74701       // downloaded data from osm
74702     };
74703     context.debugFlags = () => _debugFlags;
74704     context.getDebug = (flag) => flag && _debugFlags[flag];
74705     context.setDebug = function(flag, val) {
74706       if (arguments.length === 1)
74707         val = true;
74708       _debugFlags[flag] = val;
74709       dispatch14.call("change");
74710       return context;
74711     };
74712     let _container = select_default2(null);
74713     context.container = function(val) {
74714       if (!arguments.length)
74715         return _container;
74716       _container = val;
74717       _container.classed("ideditor", true);
74718       return context;
74719     };
74720     context.containerNode = function(val) {
74721       if (!arguments.length)
74722         return context.container().node();
74723       context.container(select_default2(val));
74724       return context;
74725     };
74726     let _embed;
74727     context.embed = function(val) {
74728       if (!arguments.length)
74729         return _embed;
74730       _embed = val;
74731       return context;
74732     };
74733     let _assetPath = "";
74734     context.assetPath = function(val) {
74735       if (!arguments.length)
74736         return _assetPath;
74737       _assetPath = val;
74738       _mainFileFetcher.assetPath(val);
74739       return context;
74740     };
74741     let _assetMap = {};
74742     context.assetMap = function(val) {
74743       if (!arguments.length)
74744         return _assetMap;
74745       _assetMap = val;
74746       _mainFileFetcher.assetMap(val);
74747       return context;
74748     };
74749     context.asset = (val) => {
74750       if (/^http(s)?:\/\//i.test(val))
74751         return val;
74752       const filename = _assetPath + val;
74753       return _assetMap[filename] || filename;
74754     };
74755     context.imagePath = (val) => context.asset(`img/${val}`);
74756     context.reset = context.flush = () => {
74757       context.debouncedSave.cancel();
74758       Array.from(_deferred2).forEach((handle) => {
74759         window.cancelIdleCallback(handle);
74760         _deferred2.delete(handle);
74761       });
74762       Object.values(services).forEach((service) => {
74763         if (service && typeof service.reset === "function") {
74764           service.reset(context);
74765         }
74766       });
74767       context.changeset = null;
74768       _validator.reset();
74769       _features.reset();
74770       _history.reset();
74771       _uploader.reset();
74772       context.container().select(".inspector-wrap *").remove();
74773       return context;
74774     };
74775     context.projection = geoRawMercator();
74776     context.curtainProjection = geoRawMercator();
74777     context.init = () => {
74778       instantiateInternal();
74779       initializeDependents();
74780       return context;
74781       function instantiateInternal() {
74782         _history = coreHistory(context);
74783         context.graph = _history.graph;
74784         context.pauseChangeDispatch = _history.pauseChangeDispatch;
74785         context.resumeChangeDispatch = _history.resumeChangeDispatch;
74786         context.perform = withDebouncedSave(_history.perform);
74787         context.replace = withDebouncedSave(_history.replace);
74788         context.pop = withDebouncedSave(_history.pop);
74789         context.overwrite = withDebouncedSave(_history.overwrite);
74790         context.undo = withDebouncedSave(_history.undo);
74791         context.redo = withDebouncedSave(_history.redo);
74792         _validator = coreValidator(context);
74793         _uploader = coreUploader(context);
74794         _background = rendererBackground(context);
74795         _features = rendererFeatures(context);
74796         _map = rendererMap(context);
74797         _photos = rendererPhotos(context);
74798         _ui = uiInit(context);
74799       }
74800       function initializeDependents() {
74801         if (context.initialHashParams.presets) {
74802           _mainPresetIndex.addablePresetIDs(new Set(context.initialHashParams.presets.split(",")));
74803         }
74804         if (context.initialHashParams.locale) {
74805           _mainLocalizer.preferredLocaleCodes(context.initialHashParams.locale);
74806         }
74807         _mainLocalizer.ensureLoaded();
74808         _mainPresetIndex.ensureLoaded();
74809         _background.ensureLoaded();
74810         Object.values(services).forEach((service) => {
74811           if (service && typeof service.init === "function") {
74812             service.init();
74813           }
74814         });
74815         _map.init();
74816         _validator.init();
74817         _features.init();
74818         if (services.maprules && context.initialHashParams.maprules) {
74819           json_default(context.initialHashParams.maprules).then((mapcss) => {
74820             services.maprules.init();
74821             mapcss.forEach((mapcssSelector) => services.maprules.addRule(mapcssSelector));
74822           }).catch(() => {
74823           });
74824         }
74825         if (!context.container().empty()) {
74826           _ui.ensureLoaded().then(() => {
74827             _background.init();
74828             _photos.init();
74829           });
74830         }
74831       }
74832     };
74833     return context;
74834   }
74835
74836   // modules/services/nominatim.js
74837   var apibase = nominatimApiUrl;
74838   var _inflight = {};
74839   var _nominatimCache;
74840   var nominatim_default = {
74841     init: function() {
74842       _inflight = {};
74843       _nominatimCache = new import_rbush7.default();
74844     },
74845     reset: function() {
74846       Object.values(_inflight).forEach(function(controller) {
74847         controller.abort();
74848       });
74849       _inflight = {};
74850       _nominatimCache = new import_rbush7.default();
74851     },
74852     countryCode: function(location, callback) {
74853       this.reverse(location, function(err, result) {
74854         if (err) {
74855           return callback(err);
74856         } else if (result.address) {
74857           return callback(null, result.address.country_code);
74858         } else {
74859           return callback("Unable to geocode", null);
74860         }
74861       });
74862     },
74863     reverse: function(loc, callback) {
74864       var cached = _nominatimCache.search(
74865         { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] }
74866       );
74867       if (cached.length > 0) {
74868         if (callback)
74869           callback(null, cached[0].data);
74870         return;
74871       }
74872       var params = { zoom: 13, format: "json", addressdetails: 1, lat: loc[1], lon: loc[0] };
74873       var url = apibase + "reverse?" + utilQsString(params);
74874       if (_inflight[url])
74875         return;
74876       var controller = new AbortController();
74877       _inflight[url] = controller;
74878       json_default(url, {
74879         signal: controller.signal,
74880         headers: {
74881           "Accept-Language": _mainLocalizer.localeCodes().join(",")
74882         }
74883       }).then(function(result) {
74884         delete _inflight[url];
74885         if (result && result.error) {
74886           throw new Error(result.error);
74887         }
74888         var extent = geoExtent(loc).padByMeters(200);
74889         _nominatimCache.insert(Object.assign(extent.bbox(), { data: result }));
74890         if (callback)
74891           callback(null, result);
74892       }).catch(function(err) {
74893         delete _inflight[url];
74894         if (err.name === "AbortError")
74895           return;
74896         if (callback)
74897           callback(err.message);
74898       });
74899     },
74900     search: function(val, callback) {
74901       const params = {
74902         q: val,
74903         limit: 10,
74904         format: "json"
74905       };
74906       var url = apibase + "search?" + utilQsString(params);
74907       if (_inflight[url])
74908         return;
74909       var controller = new AbortController();
74910       _inflight[url] = controller;
74911       json_default(url, {
74912         signal: controller.signal,
74913         headers: {
74914           "Accept-Language": _mainLocalizer.localeCodes().join(",")
74915         }
74916       }).then(function(result) {
74917         delete _inflight[url];
74918         if (result && result.error) {
74919           throw new Error(result.error);
74920         }
74921         if (callback)
74922           callback(null, result);
74923       }).catch(function(err) {
74924         delete _inflight[url];
74925         if (err.name === "AbortError")
74926           return;
74927         if (callback)
74928           callback(err.message);
74929       });
74930     }
74931   };
74932
74933   // node_modules/name-suggestion-index/lib/matcher.js
74934   var import_which_polygon4 = __toESM(require_which_polygon(), 1);
74935
74936   // node_modules/name-suggestion-index/lib/simplify.js
74937   var import_diacritics3 = __toESM(require_diacritics(), 1);
74938   function simplify2(str2) {
74939     if (typeof str2 !== "string")
74940       return "";
74941     return import_diacritics3.default.remove(
74942       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()
74943     );
74944   }
74945
74946   // node_modules/name-suggestion-index/config/matchGroups.json
74947   var matchGroups_default = {
74948     matchGroups: {
74949       adult_gaming_centre: [
74950         "amenity/casino",
74951         "amenity/gambling",
74952         "leisure/adult_gaming_centre"
74953       ],
74954       beauty: [
74955         "shop/beauty",
74956         "shop/hairdresser_supply"
74957       ],
74958       bed: [
74959         "shop/bed",
74960         "shop/furniture"
74961       ],
74962       beverages: [
74963         "shop/alcohol",
74964         "shop/beer",
74965         "shop/beverages",
74966         "shop/kiosk",
74967         "shop/wine"
74968       ],
74969       camping: [
74970         "tourism/camp_site",
74971         "tourism/caravan_site"
74972       ],
74973       car_parts: [
74974         "shop/car_parts",
74975         "shop/car_repair",
74976         "shop/tires",
74977         "shop/tyres"
74978       ],
74979       clinic: [
74980         "amenity/clinic",
74981         "amenity/doctors",
74982         "healthcare/clinic",
74983         "healthcare/laboratory",
74984         "healthcare/physiotherapist",
74985         "healthcare/sample_collection",
74986         "healthcare/dialysis"
74987       ],
74988       convenience: [
74989         "shop/beauty",
74990         "shop/chemist",
74991         "shop/convenience",
74992         "shop/cosmetics",
74993         "shop/grocery",
74994         "shop/kiosk",
74995         "shop/newsagent",
74996         "shop/perfumery"
74997       ],
74998       coworking: [
74999         "amenity/coworking_space",
75000         "office/coworking",
75001         "office/coworking_space"
75002       ],
75003       dentist: [
75004         "amenity/dentist",
75005         "amenity/doctors",
75006         "healthcare/dentist"
75007       ],
75008       electronics: [
75009         "office/telecommunication",
75010         "shop/computer",
75011         "shop/electronics",
75012         "shop/hifi",
75013         "shop/kiosk",
75014         "shop/mobile",
75015         "shop/mobile_phone",
75016         "shop/telecommunication"
75017       ],
75018       fabric: [
75019         "shop/fabric",
75020         "shop/haberdashery",
75021         "shop/sewing"
75022       ],
75023       fashion: [
75024         "shop/accessories",
75025         "shop/bag",
75026         "shop/boutique",
75027         "shop/clothes",
75028         "shop/department_store",
75029         "shop/fashion",
75030         "shop/fashion_accessories",
75031         "shop/sports",
75032         "shop/shoes"
75033       ],
75034       financial: [
75035         "amenity/bank",
75036         "office/accountant",
75037         "office/financial",
75038         "office/financial_advisor",
75039         "office/tax_advisor",
75040         "shop/tax"
75041       ],
75042       fitness: [
75043         "leisure/fitness_centre",
75044         "leisure/fitness_center",
75045         "leisure/sports_centre",
75046         "leisure/sports_center"
75047       ],
75048       food: [
75049         "amenity/bar",
75050         "amenity/cafe",
75051         "amenity/fast_food",
75052         "amenity/ice_cream",
75053         "amenity/pub",
75054         "amenity/restaurant",
75055         "shop/bakery",
75056         "shop/candy",
75057         "shop/chocolate",
75058         "shop/coffee",
75059         "shop/confectionary",
75060         "shop/confectionery",
75061         "shop/food",
75062         "shop/kiosk",
75063         "shop/ice_cream",
75064         "shop/pastry",
75065         "shop/tea"
75066       ],
75067       fuel: [
75068         "amenity/fuel",
75069         "shop/gas",
75070         "shop/convenience;gas",
75071         "shop/gas;convenience"
75072       ],
75073       gift: [
75074         "shop/gift",
75075         "shop/card",
75076         "shop/cards",
75077         "shop/kiosk",
75078         "shop/stationery"
75079       ],
75080       hardware: [
75081         "shop/bathroom_furnishing",
75082         "shop/carpet",
75083         "shop/diy",
75084         "shop/doityourself",
75085         "shop/doors",
75086         "shop/electrical",
75087         "shop/flooring",
75088         "shop/hardware",
75089         "shop/hardware_store",
75090         "shop/power_tools",
75091         "shop/tool_hire",
75092         "shop/tools",
75093         "shop/trade"
75094       ],
75095       health_food: [
75096         "shop/health",
75097         "shop/health_food",
75098         "shop/herbalist",
75099         "shop/nutrition_supplements"
75100       ],
75101       hobby: [
75102         "shop/electronics",
75103         "shop/hobby",
75104         "shop/books",
75105         "shop/games",
75106         "shop/collector",
75107         "shop/toys",
75108         "shop/model",
75109         "shop/video_games",
75110         "shop/anime"
75111       ],
75112       hospital: [
75113         "amenity/doctors",
75114         "amenity/hospital",
75115         "healthcare/hospital"
75116       ],
75117       houseware: [
75118         "shop/houseware",
75119         "shop/interior_decoration"
75120       ],
75121       lifeboat_station: [
75122         "amenity/lifeboat_station",
75123         "emergency/lifeboat_station",
75124         "emergency/marine_rescue"
75125       ],
75126       lodging: [
75127         "tourism/hotel",
75128         "tourism/motel"
75129       ],
75130       money_transfer: [
75131         "amenity/money_transfer",
75132         "shop/money_transfer"
75133       ],
75134       office_supplies: [
75135         "shop/office_supplies",
75136         "shop/stationary",
75137         "shop/stationery"
75138       ],
75139       outdoor: [
75140         "shop/clothes",
75141         "shop/outdoor",
75142         "shop/sports"
75143       ],
75144       parcel_locker: [
75145         "amenity/parcel_locker",
75146         "amenity/vending_machine"
75147       ],
75148       pharmacy: [
75149         "amenity/doctors",
75150         "amenity/pharmacy",
75151         "healthcare/pharmacy"
75152       ],
75153       playground: [
75154         "amenity/theme_park",
75155         "leisure/amusement_arcade",
75156         "leisure/playground"
75157       ],
75158       rental: [
75159         "amenity/bicycle_rental",
75160         "amenity/boat_rental",
75161         "amenity/car_rental",
75162         "amenity/truck_rental",
75163         "amenity/vehicle_rental",
75164         "shop/kiosk",
75165         "shop/rental"
75166       ],
75167       school: [
75168         "amenity/childcare",
75169         "amenity/college",
75170         "amenity/kindergarten",
75171         "amenity/language_school",
75172         "amenity/prep_school",
75173         "amenity/school",
75174         "amenity/university"
75175       ],
75176       storage: [
75177         "shop/storage_units",
75178         "shop/storage_rental"
75179       ],
75180       substation: [
75181         "power/station",
75182         "power/substation",
75183         "power/sub_station"
75184       ],
75185       supermarket: [
75186         "shop/food",
75187         "shop/frozen_food",
75188         "shop/greengrocer",
75189         "shop/grocery",
75190         "shop/supermarket",
75191         "shop/wholesale"
75192       ],
75193       variety_store: [
75194         "shop/variety_store",
75195         "shop/discount",
75196         "shop/convenience"
75197       ],
75198       vending: [
75199         "amenity/vending_machine",
75200         "shop/kiosk",
75201         "shop/vending_machine"
75202       ],
75203       weight_loss: [
75204         "amenity/clinic",
75205         "amenity/doctors",
75206         "amenity/weight_clinic",
75207         "healthcare/counselling",
75208         "leisure/fitness_centre",
75209         "office/therapist",
75210         "shop/beauty",
75211         "shop/diet",
75212         "shop/food",
75213         "shop/health_food",
75214         "shop/herbalist",
75215         "shop/nutrition",
75216         "shop/nutrition_supplements",
75217         "shop/weight_loss"
75218       ],
75219       wholesale: [
75220         "shop/wholesale",
75221         "shop/supermarket",
75222         "shop/department_store"
75223       ]
75224     }
75225   };
75226
75227   // node_modules/name-suggestion-index/config/genericWords.json
75228   var genericWords_default = {
75229     genericWords: [
75230       "^(barn|bazaa?r|bench|bou?tique|building|casa|church)$",
75231       "^(baseball|basketball|football|soccer|softball|tennis(halle)?)\\s?(field|court)?$",
75232       "^(club|green|out|ware)\\s?house$",
75233       "^(driveway|el \xE1rbol|fountain|generic|golf|government|graveyard)$",
75234       "^(fixme|n\\s?\\/?\\s?a|name|no\\s?name|none|null|temporary|test|unknown)$",
75235       "^(hofladen|librairie|magazine?|maison)$",
75236       "^(mobile home|skate)?\\s?park$",
75237       "^(obuwie|pond|pool|sale|shops?|sklep|stores?)$",
75238       "^\\?+$",
75239       "^private$",
75240       "^tattoo( studio)?$",
75241       "^windmill$",
75242       "^\u0446\u0435\u0440\u043A\u043E\u0432\u043D\u0430\u044F( \u043B\u0430\u0432\u043A\u0430)?$"
75243     ]
75244   };
75245
75246   // node_modules/name-suggestion-index/config/trees.json
75247   var trees_default = {
75248     trees: {
75249       brands: {
75250         emoji: "\u{1F354}",
75251         mainTag: "brand:wikidata",
75252         sourceTags: ["brand", "name"],
75253         nameTags: {
75254           primary: "^(name|name:\\w+)$",
75255           alternate: "^(brand|brand:\\w+|operator|operator:\\w+|\\w+_name|\\w+_name:\\w+)$"
75256         }
75257       },
75258       flags: {
75259         emoji: "\u{1F6A9}",
75260         mainTag: "flag:wikidata",
75261         nameTags: {
75262           primary: "^(flag:name|flag:name:\\w+)$",
75263           alternate: "^(country|country:\\w+|flag|flag:\\w+|subject|subject:\\w+)$"
75264         }
75265       },
75266       operators: {
75267         emoji: "\u{1F4BC}",
75268         mainTag: "operator:wikidata",
75269         sourceTags: ["operator"],
75270         nameTags: {
75271           primary: "^(name|name:\\w+|operator|operator:\\w+)$",
75272           alternate: "^(brand|brand:\\w+|\\w+_name|\\w+_name:\\w+)$"
75273         }
75274       },
75275       transit: {
75276         emoji: "\u{1F687}",
75277         mainTag: "network:wikidata",
75278         sourceTags: ["network"],
75279         nameTags: {
75280           primary: "^network$",
75281           alternate: "^(operator|operator:\\w+|network:\\w+|\\w+_name|\\w+_name:\\w+)$"
75282         }
75283       }
75284     }
75285   };
75286
75287   // node_modules/name-suggestion-index/lib/matcher.js
75288   var matchGroups = matchGroups_default.matchGroups;
75289   var trees = trees_default.trees;
75290   var Matcher = class {
75291     //
75292     // `constructor`
75293     // initialize the genericWords regexes
75294     constructor() {
75295       this.matchIndex = void 0;
75296       this.genericWords = /* @__PURE__ */ new Map();
75297       (genericWords_default.genericWords || []).forEach((s2) => this.genericWords.set(s2, new RegExp(s2, "i")));
75298       this.itemLocation = void 0;
75299       this.locationSets = void 0;
75300       this.locationIndex = void 0;
75301       this.warnings = [];
75302     }
75303     //
75304     // `buildMatchIndex()`
75305     // Call this to prepare the matcher for use
75306     //
75307     // `data` needs to be an Object indexed on a 'tree/key/value' path.
75308     // (e.g. cache filled by `fileTree.read` or data found in `dist/nsi.json`)
75309     // {
75310     //    'brands/amenity/bank': { properties: {}, items: [ {}, {}, … ] },
75311     //    'brands/amenity/bar':  { properties: {}, items: [ {}, {}, … ] },
75312     //    …
75313     // }
75314     //
75315     buildMatchIndex(data) {
75316       const that = this;
75317       if (that.matchIndex)
75318         return;
75319       that.matchIndex = /* @__PURE__ */ new Map();
75320       const seenTree = /* @__PURE__ */ new Map();
75321       Object.keys(data).forEach((tkv) => {
75322         const category = data[tkv];
75323         const parts = tkv.split("/", 3);
75324         const t2 = parts[0];
75325         const k2 = parts[1];
75326         const v2 = parts[2];
75327         const thiskv = `${k2}/${v2}`;
75328         const tree = trees[t2];
75329         let branch = that.matchIndex.get(thiskv);
75330         if (!branch) {
75331           branch = {
75332             primary: /* @__PURE__ */ new Map(),
75333             alternate: /* @__PURE__ */ new Map(),
75334             excludeGeneric: /* @__PURE__ */ new Map(),
75335             excludeNamed: /* @__PURE__ */ new Map()
75336           };
75337           that.matchIndex.set(thiskv, branch);
75338         }
75339         const properties = category.properties || {};
75340         const exclude = properties.exclude || {};
75341         (exclude.generic || []).forEach((s2) => branch.excludeGeneric.set(s2, new RegExp(s2, "i")));
75342         (exclude.named || []).forEach((s2) => branch.excludeNamed.set(s2, new RegExp(s2, "i")));
75343         const excludeRegexes = [...branch.excludeGeneric.values(), ...branch.excludeNamed.values()];
75344         let items = category.items;
75345         if (!Array.isArray(items) || !items.length)
75346           return;
75347         const primaryName = new RegExp(tree.nameTags.primary, "i");
75348         const alternateName = new RegExp(tree.nameTags.alternate, "i");
75349         const notName = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
75350         const skipGenericKV = skipGenericKVMatches(t2, k2, v2);
75351         const genericKV = /* @__PURE__ */ new Set([`${k2}/yes`, `building/yes`]);
75352         const matchGroupKV = /* @__PURE__ */ new Set();
75353         Object.values(matchGroups).forEach((matchGroup) => {
75354           const inGroup = matchGroup.some((otherkv) => otherkv === thiskv);
75355           if (!inGroup)
75356             return;
75357           matchGroup.forEach((otherkv) => {
75358             if (otherkv === thiskv)
75359               return;
75360             matchGroupKV.add(otherkv);
75361             const otherk = otherkv.split("/", 2)[0];
75362             genericKV.add(`${otherk}/yes`);
75363           });
75364         });
75365         items.forEach((item) => {
75366           if (!item.id)
75367             return;
75368           if (Array.isArray(item.matchTags) && item.matchTags.length) {
75369             item.matchTags = item.matchTags.filter((matchTag) => !matchGroupKV.has(matchTag) && !genericKV.has(matchTag));
75370             if (!item.matchTags.length)
75371               delete item.matchTags;
75372           }
75373           let kvTags = [`${thiskv}`].concat(item.matchTags || []);
75374           if (!skipGenericKV) {
75375             kvTags = kvTags.concat(Array.from(genericKV));
75376           }
75377           Object.keys(item.tags).forEach((osmkey) => {
75378             if (notName.test(osmkey))
75379               return;
75380             const osmvalue = item.tags[osmkey];
75381             if (!osmvalue || excludeRegexes.some((regex) => regex.test(osmvalue)))
75382               return;
75383             if (primaryName.test(osmkey)) {
75384               kvTags.forEach((kv) => insertName("primary", t2, kv, simplify2(osmvalue), item.id));
75385             } else if (alternateName.test(osmkey)) {
75386               kvTags.forEach((kv) => insertName("alternate", t2, kv, simplify2(osmvalue), item.id));
75387             }
75388           });
75389           let keepMatchNames = /* @__PURE__ */ new Set();
75390           (item.matchNames || []).forEach((matchName) => {
75391             const nsimple = simplify2(matchName);
75392             kvTags.forEach((kv) => {
75393               const branch2 = that.matchIndex.get(kv);
75394               const primaryLeaf = branch2 && branch2.primary.get(nsimple);
75395               const alternateLeaf = branch2 && branch2.alternate.get(nsimple);
75396               const inPrimary = primaryLeaf && primaryLeaf.has(item.id);
75397               const inAlternate = alternateLeaf && alternateLeaf.has(item.id);
75398               if (!inPrimary && !inAlternate) {
75399                 insertName("alternate", t2, kv, nsimple, item.id);
75400                 keepMatchNames.add(matchName);
75401               }
75402             });
75403           });
75404           if (keepMatchNames.size) {
75405             item.matchNames = Array.from(keepMatchNames);
75406           } else {
75407             delete item.matchNames;
75408           }
75409         });
75410       });
75411       function insertName(which, t2, kv, nsimple, itemID) {
75412         if (!nsimple) {
75413           that.warnings.push(`Warning: skipping empty ${which} name for item ${t2}/${kv}: ${itemID}`);
75414           return;
75415         }
75416         let branch = that.matchIndex.get(kv);
75417         if (!branch) {
75418           branch = {
75419             primary: /* @__PURE__ */ new Map(),
75420             alternate: /* @__PURE__ */ new Map(),
75421             excludeGeneric: /* @__PURE__ */ new Map(),
75422             excludeNamed: /* @__PURE__ */ new Map()
75423           };
75424           that.matchIndex.set(kv, branch);
75425         }
75426         let leaf = branch[which].get(nsimple);
75427         if (!leaf) {
75428           leaf = /* @__PURE__ */ new Set();
75429           branch[which].set(nsimple, leaf);
75430         }
75431         leaf.add(itemID);
75432         if (!/yes$/.test(kv)) {
75433           const kvnsimple = `${kv}/${nsimple}`;
75434           const existing = seenTree.get(kvnsimple);
75435           if (existing && existing !== t2) {
75436             const items = Array.from(leaf);
75437             that.warnings.push(`Duplicate cache key "${kvnsimple}" in trees "${t2}" and "${existing}", check items: ${items}`);
75438             return;
75439           }
75440           seenTree.set(kvnsimple, t2);
75441         }
75442       }
75443       function skipGenericKVMatches(t2, k2, v2) {
75444         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";
75445       }
75446     }
75447     //
75448     // `buildLocationIndex()`
75449     // Call this to prepare a which-polygon location index.
75450     // This *resolves* all the locationSets into GeoJSON, which takes some time.
75451     // You can skip this step if you don't care about matching within a location.
75452     //
75453     // `data` needs to be an Object indexed on a 'tree/key/value' path.
75454     // (e.g. cache filled by `fileTree.read` or data found in `dist/nsi.json`)
75455     // {
75456     //    'brands/amenity/bank': { properties: {}, items: [ {}, {}, … ] },
75457     //    'brands/amenity/bar':  { properties: {}, items: [ {}, {}, … ] },
75458     //    …
75459     // }
75460     //
75461     buildLocationIndex(data, loco) {
75462       const that = this;
75463       if (that.locationIndex)
75464         return;
75465       that.itemLocation = /* @__PURE__ */ new Map();
75466       that.locationSets = /* @__PURE__ */ new Map();
75467       Object.keys(data).forEach((tkv) => {
75468         const items = data[tkv].items;
75469         if (!Array.isArray(items) || !items.length)
75470           return;
75471         items.forEach((item) => {
75472           if (that.itemLocation.has(item.id))
75473             return;
75474           let resolved;
75475           try {
75476             resolved = loco.resolveLocationSet(item.locationSet);
75477           } catch (err) {
75478             console.warn(`buildLocationIndex: ${err.message}`);
75479           }
75480           if (!resolved || !resolved.id)
75481             return;
75482           that.itemLocation.set(item.id, resolved.id);
75483           if (that.locationSets.has(resolved.id))
75484             return;
75485           let feature3 = _cloneDeep2(resolved.feature);
75486           feature3.id = resolved.id;
75487           feature3.properties.id = resolved.id;
75488           if (!feature3.geometry.coordinates.length || !feature3.properties.area) {
75489             console.warn(`buildLocationIndex: locationSet ${resolved.id} for ${item.id} resolves to an empty feature:`);
75490             console.warn(JSON.stringify(feature3));
75491             return;
75492           }
75493           that.locationSets.set(resolved.id, feature3);
75494         });
75495       });
75496       that.locationIndex = (0, import_which_polygon4.default)({ type: "FeatureCollection", features: [...that.locationSets.values()] });
75497       function _cloneDeep2(obj) {
75498         return JSON.parse(JSON.stringify(obj));
75499       }
75500     }
75501     //
75502     // `match()`
75503     // Pass parts and return an Array of matches.
75504     // `k` - key
75505     // `v` - value
75506     // `n` - namelike
75507     // `loc` - optional - [lon,lat] location to search
75508     //
75509     // 1. If the [k,v,n] tuple matches a canonical item…
75510     // Return an Array of match results.
75511     // Each result will include the area in km² that the item is valid.
75512     //
75513     // Order of results:
75514     // Primary ordering will be on the "match" column:
75515     //   "primary" - where the query matches the `name` tag, followed by
75516     //   "alternate" - where the query matches an alternate name tag (e.g. short_name, brand, operator, etc)
75517     // Secondary ordering will be on the "area" column:
75518     //   "area descending" if no location was provided, (worldwide before local)
75519     //   "area ascending" if location was provided (local before worldwide)
75520     //
75521     // [
75522     //   { match: 'primary',   itemID: String,  area: Number,  kv: String,  nsimple: String },
75523     //   { match: 'primary',   itemID: String,  area: Number,  kv: String,  nsimple: String },
75524     //   { match: 'alternate', itemID: String,  area: Number,  kv: String,  nsimple: String },
75525     //   { match: 'alternate', itemID: String,  area: Number,  kv: String,  nsimple: String },
75526     //   …
75527     // ]
75528     //
75529     // -or-
75530     //
75531     // 2. If the [k,v,n] tuple matches an exclude pattern…
75532     // Return an Array with a single exclude result, either
75533     //
75534     // [ { match: 'excludeGeneric', pattern: String,  kv: String } ]  // "generic" e.g. "Food Court"
75535     //   or
75536     // [ { match: 'excludeNamed', pattern: String,  kv: String } ]    // "named", e.g. "Kebabai"
75537     //
75538     // About results
75539     //   "generic" - a generic word that is probably not really a name.
75540     //     For these, iD should warn the user "Hey don't put 'food court' in the name tag".
75541     //   "named" - a real name like "Kebabai" that is just common, but not a brand.
75542     //     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.
75543     //
75544     // -or-
75545     //
75546     // 3. If the [k,v,n] tuple matches nothing of any kind, return `null`
75547     //
75548     //
75549     match(k2, v2, n3, loc) {
75550       const that = this;
75551       if (!that.matchIndex) {
75552         throw new Error("match:  matchIndex not built.");
75553       }
75554       let matchLocations;
75555       if (Array.isArray(loc) && that.locationIndex) {
75556         matchLocations = that.locationIndex([loc[0], loc[1], loc[0], loc[1]], true);
75557       }
75558       const nsimple = simplify2(n3);
75559       let seen = /* @__PURE__ */ new Set();
75560       let results = [];
75561       gatherResults("primary");
75562       gatherResults("alternate");
75563       if (results.length)
75564         return results;
75565       gatherResults("exclude");
75566       return results.length ? results : null;
75567       function gatherResults(which) {
75568         const kv = `${k2}/${v2}`;
75569         let didMatch = tryMatch(which, kv);
75570         if (didMatch)
75571           return;
75572         for (let mg in matchGroups) {
75573           const matchGroup = matchGroups[mg];
75574           const inGroup = matchGroup.some((otherkv) => otherkv === kv);
75575           if (!inGroup)
75576             continue;
75577           for (let i3 = 0; i3 < matchGroup.length; i3++) {
75578             const otherkv = matchGroup[i3];
75579             if (otherkv === kv)
75580               continue;
75581             didMatch = tryMatch(which, otherkv);
75582             if (didMatch)
75583               return;
75584           }
75585         }
75586         if (which === "exclude") {
75587           const regex = [...that.genericWords.values()].find((regex2) => regex2.test(n3));
75588           if (regex) {
75589             results.push({ match: "excludeGeneric", pattern: String(regex) });
75590             return;
75591           }
75592         }
75593       }
75594       function tryMatch(which, kv) {
75595         const branch = that.matchIndex.get(kv);
75596         if (!branch)
75597           return;
75598         if (which === "exclude") {
75599           let regex = [...branch.excludeNamed.values()].find((regex2) => regex2.test(n3));
75600           if (regex) {
75601             results.push({ match: "excludeNamed", pattern: String(regex), kv });
75602             return;
75603           }
75604           regex = [...branch.excludeGeneric.values()].find((regex2) => regex2.test(n3));
75605           if (regex) {
75606             results.push({ match: "excludeGeneric", pattern: String(regex), kv });
75607             return;
75608           }
75609           return;
75610         }
75611         const leaf = branch[which].get(nsimple);
75612         if (!leaf || !leaf.size)
75613           return;
75614         let hits = Array.from(leaf).map((itemID) => {
75615           let area = Infinity;
75616           if (that.itemLocation && that.locationSets) {
75617             const location = that.locationSets.get(that.itemLocation.get(itemID));
75618             area = location && location.properties.area || Infinity;
75619           }
75620           return { match: which, itemID, area, kv, nsimple };
75621         });
75622         let sortFn = byAreaDescending;
75623         if (matchLocations) {
75624           hits = hits.filter(isValidLocation);
75625           sortFn = byAreaAscending;
75626         }
75627         if (!hits.length)
75628           return;
75629         hits.sort(sortFn).forEach((hit) => {
75630           if (seen.has(hit.itemID))
75631             return;
75632           seen.add(hit.itemID);
75633           results.push(hit);
75634         });
75635         return true;
75636         function isValidLocation(hit) {
75637           if (!that.itemLocation)
75638             return true;
75639           return matchLocations.find((props) => props.id === that.itemLocation.get(hit.itemID));
75640         }
75641         function byAreaAscending(hitA, hitB) {
75642           return hitA.area - hitB.area;
75643         }
75644         function byAreaDescending(hitA, hitB) {
75645           return hitB.area - hitA.area;
75646         }
75647       }
75648     }
75649     //
75650     // `getWarnings()`
75651     // Return any warnings discovered when buiding the index.
75652     // (currently this does nothing)
75653     //
75654     getWarnings() {
75655       return this.warnings;
75656     }
75657   };
75658
75659   // modules/services/nsi.js
75660   var import_vparse2 = __toESM(require_vparse());
75661   var _nsiStatus = "loading";
75662   var _nsi = {};
75663   var buildingPreset = {
75664     "building/commercial": true,
75665     "building/government": true,
75666     "building/hotel": true,
75667     "building/retail": true,
75668     "building/office": true,
75669     "building/supermarket": true,
75670     "building/yes": true
75671   };
75672   var notNames = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
75673   var notBranches = /(coop|express|wireless|factory|outlet)/i;
75674   function setNsiSources() {
75675     const nsiVersion = package_default.dependencies["name-suggestion-index"] || package_default.devDependencies["name-suggestion-index"];
75676     const v2 = (0, import_vparse2.default)(nsiVersion);
75677     const vMinor = `${v2.major}.${v2.minor}`;
75678     const cdn = nsiCdnUrl.replace("{version}", vMinor);
75679     const sources = {
75680       "nsi_data": cdn + "dist/nsi.min.json",
75681       "nsi_dissolved": cdn + "dist/dissolved.min.json",
75682       "nsi_features": cdn + "dist/featureCollection.min.json",
75683       "nsi_generics": cdn + "dist/genericWords.min.json",
75684       "nsi_presets": cdn + "dist/presets/nsi-id-presets.min.json",
75685       "nsi_replacements": cdn + "dist/replacements.min.json",
75686       "nsi_trees": cdn + "dist/trees.min.json"
75687     };
75688     let fileMap = _mainFileFetcher.fileMap();
75689     for (const k2 in sources) {
75690       if (!fileMap[k2])
75691         fileMap[k2] = sources[k2];
75692     }
75693   }
75694   function loadNsiPresets() {
75695     return Promise.all([
75696       _mainFileFetcher.get("nsi_presets"),
75697       _mainFileFetcher.get("nsi_features")
75698     ]).then((vals) => {
75699       Object.values(vals[0].presets).forEach((preset) => preset.suggestion = true);
75700       _mainPresetIndex.merge({
75701         presets: vals[0].presets,
75702         featureCollection: vals[1]
75703       });
75704     });
75705   }
75706   function loadNsiData() {
75707     return Promise.all([
75708       _mainFileFetcher.get("nsi_data"),
75709       _mainFileFetcher.get("nsi_dissolved"),
75710       _mainFileFetcher.get("nsi_replacements"),
75711       _mainFileFetcher.get("nsi_trees")
75712     ]).then((vals) => {
75713       _nsi = {
75714         data: vals[0].nsi,
75715         // the raw name-suggestion-index data
75716         dissolved: vals[1].dissolved,
75717         // list of dissolved items
75718         replacements: vals[2].replacements,
75719         // trivial old->new qid replacements
75720         trees: vals[3].trees,
75721         // metadata about trees, main tags
75722         kvt: /* @__PURE__ */ new Map(),
75723         // Map (k -> Map (v -> t) )
75724         qids: /* @__PURE__ */ new Map(),
75725         // Map (wd/wp tag values -> qids)
75726         ids: /* @__PURE__ */ new Map()
75727         // Map (id -> NSI item)
75728       };
75729       const matcher = _nsi.matcher = new Matcher();
75730       matcher.buildMatchIndex(_nsi.data);
75731       matcher.itemLocation = /* @__PURE__ */ new Map();
75732       matcher.locationSets = /* @__PURE__ */ new Map();
75733       Object.keys(_nsi.data).forEach((tkv) => {
75734         const items = _nsi.data[tkv].items;
75735         if (!Array.isArray(items) || !items.length)
75736           return;
75737         items.forEach((item) => {
75738           if (matcher.itemLocation.has(item.id))
75739             return;
75740           const locationSetID = _sharedLocationManager.locationSetID(item.locationSet);
75741           matcher.itemLocation.set(item.id, locationSetID);
75742           if (matcher.locationSets.has(locationSetID))
75743             return;
75744           const fakeFeature = { id: locationSetID, properties: { id: locationSetID, area: 1 } };
75745           matcher.locationSets.set(locationSetID, fakeFeature);
75746         });
75747       });
75748       matcher.locationIndex = (bbox2) => {
75749         const validHere = _sharedLocationManager.locationSetsAt([bbox2[0], bbox2[1]]);
75750         const results = [];
75751         for (const [locationSetID, area] of Object.entries(validHere)) {
75752           const fakeFeature = matcher.locationSets.get(locationSetID);
75753           if (fakeFeature) {
75754             fakeFeature.properties.area = area;
75755             results.push(fakeFeature);
75756           }
75757         }
75758         return results;
75759       };
75760       Object.keys(_nsi.data).forEach((tkv) => {
75761         const category = _nsi.data[tkv];
75762         const parts = tkv.split("/", 3);
75763         const t2 = parts[0];
75764         const k2 = parts[1];
75765         const v2 = parts[2];
75766         let vmap = _nsi.kvt.get(k2);
75767         if (!vmap) {
75768           vmap = /* @__PURE__ */ new Map();
75769           _nsi.kvt.set(k2, vmap);
75770         }
75771         vmap.set(v2, t2);
75772         const tree = _nsi.trees[t2];
75773         const mainTag = tree.mainTag;
75774         const items = category.items || [];
75775         items.forEach((item) => {
75776           item.tkv = tkv;
75777           item.mainTag = mainTag;
75778           _nsi.ids.set(item.id, item);
75779           const wd = item.tags[mainTag];
75780           const wp = item.tags[mainTag.replace("wikidata", "wikipedia")];
75781           if (wd)
75782             _nsi.qids.set(wd, wd);
75783           if (wp && wd)
75784             _nsi.qids.set(wp, wd);
75785         });
75786       });
75787     });
75788   }
75789   function gatherKVs(tags) {
75790     let primary = /* @__PURE__ */ new Set();
75791     let alternate = /* @__PURE__ */ new Set();
75792     Object.keys(tags).forEach((osmkey) => {
75793       const osmvalue = tags[osmkey];
75794       if (!osmvalue)
75795         return;
75796       if (osmkey === "route_master")
75797         osmkey = "route";
75798       const vmap = _nsi.kvt.get(osmkey);
75799       if (!vmap)
75800         return;
75801       if (vmap.get(osmvalue)) {
75802         primary.add(`${osmkey}/${osmvalue}`);
75803       } else if (osmvalue === "yes") {
75804         alternate.add(`${osmkey}/${osmvalue}`);
75805       }
75806     });
75807     const preset = _mainPresetIndex.matchTags(tags, "area");
75808     if (buildingPreset[preset.id]) {
75809       alternate.add("building/yes");
75810     }
75811     return { primary, alternate };
75812   }
75813   function identifyTree(tags) {
75814     let unknown;
75815     let t2;
75816     Object.keys(tags).forEach((osmkey) => {
75817       if (t2)
75818         return;
75819       const osmvalue = tags[osmkey];
75820       if (!osmvalue)
75821         return;
75822       if (osmkey === "route_master")
75823         osmkey = "route";
75824       const vmap = _nsi.kvt.get(osmkey);
75825       if (!vmap)
75826         return;
75827       if (osmvalue === "yes") {
75828         unknown = "unknown";
75829       } else {
75830         t2 = vmap.get(osmvalue);
75831       }
75832     });
75833     return t2 || unknown || null;
75834   }
75835   function gatherNames(tags) {
75836     const empty2 = { primary: /* @__PURE__ */ new Set(), alternate: /* @__PURE__ */ new Set() };
75837     let primary = /* @__PURE__ */ new Set();
75838     let alternate = /* @__PURE__ */ new Set();
75839     let foundSemi = false;
75840     let testNameFragments = false;
75841     let patterns2;
75842     let t2 = identifyTree(tags);
75843     if (!t2)
75844       return empty2;
75845     if (t2 === "transit") {
75846       patterns2 = {
75847         primary: /^network$/i,
75848         alternate: /^(operator|operator:\w+|network:\w+|\w+_name|\w+_name:\w+)$/i
75849       };
75850     } else if (t2 === "flags") {
75851       patterns2 = {
75852         primary: /^(flag:name|flag:name:\w+)$/i,
75853         alternate: /^(flag|flag:\w+|subject|subject:\w+)$/i
75854         // note: no `country`, we special-case it below
75855       };
75856     } else if (t2 === "brands") {
75857       testNameFragments = true;
75858       patterns2 = {
75859         primary: /^(name|name:\w+)$/i,
75860         alternate: /^(brand|brand:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
75861       };
75862     } else if (t2 === "operators") {
75863       testNameFragments = true;
75864       patterns2 = {
75865         primary: /^(name|name:\w+|operator|operator:\w+)$/i,
75866         alternate: /^(brand|brand:\w+|\w+_name|\w+_name:\w+)/i
75867       };
75868     } else {
75869       testNameFragments = true;
75870       patterns2 = {
75871         primary: /^(name|name:\w+)$/i,
75872         alternate: /^(brand|brand:\w+|network|network:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
75873       };
75874     }
75875     if (tags.name && testNameFragments) {
75876       const nameParts = tags.name.split(/[\s\-\/,.]/);
75877       for (let split = nameParts.length; split > 0; split--) {
75878         const name = nameParts.slice(0, split).join(" ");
75879         primary.add(name);
75880       }
75881     }
75882     Object.keys(tags).forEach((osmkey) => {
75883       const osmvalue = tags[osmkey];
75884       if (!osmvalue)
75885         return;
75886       if (isNamelike(osmkey, "primary")) {
75887         if (/;/.test(osmvalue)) {
75888           foundSemi = true;
75889         } else {
75890           primary.add(osmvalue);
75891           alternate.delete(osmvalue);
75892         }
75893       } else if (!primary.has(osmvalue) && isNamelike(osmkey, "alternate")) {
75894         if (/;/.test(osmvalue)) {
75895           foundSemi = true;
75896         } else {
75897           alternate.add(osmvalue);
75898         }
75899       }
75900     });
75901     if (tags.man_made === "flagpole" && !primary.size && !alternate.size && !!tags.country) {
75902       const osmvalue = tags.country;
75903       if (/;/.test(osmvalue)) {
75904         foundSemi = true;
75905       } else {
75906         alternate.add(osmvalue);
75907       }
75908     }
75909     if (foundSemi) {
75910       return empty2;
75911     } else {
75912       return { primary, alternate };
75913     }
75914     function isNamelike(osmkey, which) {
75915       if (osmkey === "old_name")
75916         return false;
75917       return patterns2[which].test(osmkey) && !notNames.test(osmkey);
75918     }
75919   }
75920   function gatherTuples(tryKVs, tryNames) {
75921     let tuples = [];
75922     ["primary", "alternate"].forEach((whichName) => {
75923       const arr = Array.from(tryNames[whichName]).sort((a2, b2) => b2.length - a2.length);
75924       arr.forEach((n3) => {
75925         ["primary", "alternate"].forEach((whichKV) => {
75926           tryKVs[whichKV].forEach((kv) => {
75927             const parts = kv.split("/", 2);
75928             const k2 = parts[0];
75929             const v2 = parts[1];
75930             tuples.push({ k: k2, v: v2, n: n3 });
75931           });
75932         });
75933       });
75934     });
75935     return tuples;
75936   }
75937   function _upgradeTags(tags, loc) {
75938     let newTags = Object.assign({}, tags);
75939     let changed = false;
75940     Object.keys(newTags).forEach((osmkey) => {
75941       const matchTag = osmkey.match(/^(\w+:)?wikidata$/);
75942       if (matchTag) {
75943         const prefix = matchTag[1] || "";
75944         const wd = newTags[osmkey];
75945         const replace = _nsi.replacements[wd];
75946         if (replace && replace.wikidata !== void 0) {
75947           changed = true;
75948           if (replace.wikidata) {
75949             newTags[osmkey] = replace.wikidata;
75950           } else {
75951             delete newTags[osmkey];
75952           }
75953         }
75954         if (replace && replace.wikipedia !== void 0) {
75955           changed = true;
75956           const wpkey = `${prefix}wikipedia`;
75957           if (replace.wikipedia) {
75958             newTags[wpkey] = replace.wikipedia;
75959           } else {
75960             delete newTags[wpkey];
75961           }
75962         }
75963       }
75964     });
75965     const isRouteMaster = tags.type === "route_master";
75966     const tryKVs = gatherKVs(tags);
75967     if (!tryKVs.primary.size && !tryKVs.alternate.size) {
75968       return changed ? { newTags, matched: null } : null;
75969     }
75970     const tryNames = gatherNames(tags);
75971     const foundQID = _nsi.qids.get(tags.wikidata) || _nsi.qids.get(tags.wikipedia);
75972     if (foundQID)
75973       tryNames.primary.add(foundQID);
75974     if (!tryNames.primary.size && !tryNames.alternate.size) {
75975       return changed ? { newTags, matched: null } : null;
75976     }
75977     const tuples = gatherTuples(tryKVs, tryNames);
75978     for (let i3 = 0; i3 < tuples.length; i3++) {
75979       const tuple = tuples[i3];
75980       const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n, loc);
75981       if (!hits || !hits.length)
75982         continue;
75983       if (hits[0].match !== "primary" && hits[0].match !== "alternate")
75984         break;
75985       let itemID, item;
75986       for (let j3 = 0; j3 < hits.length; j3++) {
75987         const hit = hits[j3];
75988         itemID = hit.itemID;
75989         if (_nsi.dissolved[itemID])
75990           continue;
75991         item = _nsi.ids.get(itemID);
75992         if (!item)
75993           continue;
75994         const mainTag = item.mainTag;
75995         const itemQID = item.tags[mainTag];
75996         const notQID = newTags[`not:${mainTag}`];
75997         if (
75998           // Exceptions, skip this hit
75999           !itemQID || itemQID === notQID || // No `*:wikidata` or matched a `not:*:wikidata`
76000           newTags.office && !item.tags.office
76001         ) {
76002           item = null;
76003           continue;
76004         } else {
76005           break;
76006         }
76007       }
76008       if (!item)
76009         continue;
76010       item = JSON.parse(JSON.stringify(item));
76011       const tkv = item.tkv;
76012       const parts = tkv.split("/", 3);
76013       const k2 = parts[1];
76014       const v2 = parts[2];
76015       const category = _nsi.data[tkv];
76016       const properties = category.properties || {};
76017       let preserveTags = item.preserveTags || properties.preserveTags || [];
76018       ["building", "emergency", "internet_access", "takeaway"].forEach((osmkey) => {
76019         if (k2 !== osmkey)
76020           preserveTags.push(`^${osmkey}$`);
76021       });
76022       const regexes = preserveTags.map((s2) => new RegExp(s2, "i"));
76023       let keepTags = {};
76024       Object.keys(newTags).forEach((osmkey) => {
76025         if (regexes.some((regex) => regex.test(osmkey))) {
76026           keepTags[osmkey] = newTags[osmkey];
76027         }
76028       });
76029       _nsi.kvt.forEach((vmap, k3) => {
76030         if (newTags[k3] === "yes")
76031           delete newTags[k3];
76032       });
76033       if (foundQID) {
76034         delete newTags.wikipedia;
76035         delete newTags.wikidata;
76036       }
76037       Object.assign(newTags, item.tags, keepTags);
76038       if (isRouteMaster) {
76039         newTags.route_master = newTags.route;
76040         delete newTags.route;
76041       }
76042       const origName = tags.name;
76043       const newName = newTags.name;
76044       if (newName && origName && newName !== origName && !newTags.branch) {
76045         const newNames = gatherNames(newTags);
76046         const newSet = /* @__PURE__ */ new Set([...newNames.primary, ...newNames.alternate]);
76047         const isMoved = newSet.has(origName);
76048         if (!isMoved) {
76049           const nameParts = origName.split(/[\s\-\/,.]/);
76050           for (let split = nameParts.length; split > 0; split--) {
76051             const name = nameParts.slice(0, split).join(" ");
76052             const branch = nameParts.slice(split).join(" ");
76053             const nameHits = _nsi.matcher.match(k2, v2, name, loc);
76054             if (!nameHits || !nameHits.length)
76055               continue;
76056             if (nameHits.some((hit) => hit.itemID === itemID)) {
76057               if (branch) {
76058                 if (notBranches.test(branch)) {
76059                   newTags.name = origName;
76060                 } else {
76061                   const branchHits = _nsi.matcher.match(k2, v2, branch, loc);
76062                   if (branchHits && branchHits.length) {
76063                     if (branchHits[0].match === "primary" || branchHits[0].match === "alternate") {
76064                       return null;
76065                     }
76066                   } else {
76067                     newTags.branch = branch;
76068                   }
76069                 }
76070               }
76071               break;
76072             }
76073           }
76074         }
76075       }
76076       return { newTags, matched: item };
76077     }
76078     return changed ? { newTags, matched: null } : null;
76079   }
76080   function _isGenericName(tags) {
76081     const n3 = tags.name;
76082     if (!n3)
76083       return false;
76084     const tryNames = { primary: /* @__PURE__ */ new Set([n3]), alternate: /* @__PURE__ */ new Set() };
76085     const tryKVs = gatherKVs(tags);
76086     if (!tryKVs.primary.size && !tryKVs.alternate.size)
76087       return false;
76088     const tuples = gatherTuples(tryKVs, tryNames);
76089     for (let i3 = 0; i3 < tuples.length; i3++) {
76090       const tuple = tuples[i3];
76091       const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n);
76092       if (hits && hits.length && hits[0].match === "excludeGeneric")
76093         return true;
76094     }
76095     return false;
76096   }
76097   var nsi_default = {
76098     // `init()`
76099     // On init, start preparing the name-suggestion-index
76100     //
76101     init: () => {
76102       setNsiSources();
76103       _mainPresetIndex.ensureLoaded().then(() => loadNsiPresets()).then(() => loadNsiData()).then(() => _nsiStatus = "ok").catch(() => _nsiStatus = "failed");
76104     },
76105     // `reset()`
76106     // Reset is called when user saves data to OSM (does nothing here)
76107     //
76108     reset: () => {
76109     },
76110     // `status()`
76111     // To let other code know how it's going...
76112     //
76113     // Returns
76114     //   `String`: 'loading', 'ok', 'failed'
76115     //
76116     status: () => _nsiStatus,
76117     // `isGenericName()`
76118     // Is the `name` tag generic?
76119     //
76120     // Arguments
76121     //   `tags`: `Object` containing the feature's OSM tags
76122     // Returns
76123     //   `true` if it is generic, `false` if not
76124     //
76125     isGenericName: (tags) => _isGenericName(tags),
76126     // `upgradeTags()`
76127     // Suggest tag upgrades.
76128     // This function will not modify the input tags, it makes a copy.
76129     //
76130     // Arguments
76131     //   `tags`: `Object` containing the feature's OSM tags
76132     //   `loc`: Location where this feature exists, as a [lon, lat]
76133     // Returns
76134     //   `Object` containing the result, or `null` if no changes needed:
76135     //   {
76136     //     'newTags': `Object` - The tags the the feature should have
76137     //     'matched': `Object` - The matched item
76138     //   }
76139     //
76140     upgradeTags: (tags, loc) => _upgradeTags(tags, loc),
76141     // `cache()`
76142     // Direct access to the NSI cache, useful for testing or breaking things
76143     //
76144     // Returns
76145     //   `Object`: the internal NSI cache
76146     //
76147     cache: () => _nsi
76148   };
76149
76150   // modules/services/kartaview.js
76151   var import_rbush8 = __toESM(require_rbush_min());
76152   var apibase2 = "https://kartaview.org";
76153   var maxResults = 1e3;
76154   var tileZoom = 14;
76155   var tiler4 = utilTiler().zoomExtent([tileZoom, tileZoom]).skipNullIsland(true);
76156   var dispatch7 = dispatch_default("loadedImages");
76157   var imgZoom2 = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
76158   var _oscCache;
76159   var _oscSelectedImage;
76160   var _loadViewerPromise2;
76161   function abortRequest4(controller) {
76162     controller.abort();
76163   }
76164   function maxPageAtZoom(z2) {
76165     if (z2 < 15)
76166       return 2;
76167     if (z2 === 15)
76168       return 5;
76169     if (z2 === 16)
76170       return 10;
76171     if (z2 === 17)
76172       return 20;
76173     if (z2 === 18)
76174       return 40;
76175     if (z2 > 18)
76176       return 80;
76177   }
76178   function loadTiles2(which, url, projection2) {
76179     var currZoom = Math.floor(geoScaleToZoom(projection2.scale()));
76180     var tiles = tiler4.getTiles(projection2);
76181     var cache = _oscCache[which];
76182     Object.keys(cache.inflight).forEach(function(k2) {
76183       var wanted = tiles.find(function(tile) {
76184         return k2.indexOf(tile.id + ",") === 0;
76185       });
76186       if (!wanted) {
76187         abortRequest4(cache.inflight[k2]);
76188         delete cache.inflight[k2];
76189       }
76190     });
76191     tiles.forEach(function(tile) {
76192       loadNextTilePage(which, currZoom, url, tile);
76193     });
76194   }
76195   function loadNextTilePage(which, currZoom, url, tile) {
76196     var cache = _oscCache[which];
76197     var bbox2 = tile.extent.bbox();
76198     var maxPages = maxPageAtZoom(currZoom);
76199     var nextPage = cache.nextPage[tile.id] || 1;
76200     var params = utilQsString({
76201       ipp: maxResults,
76202       page: nextPage,
76203       // client_id: clientId,
76204       bbTopLeft: [bbox2.maxY, bbox2.minX].join(","),
76205       bbBottomRight: [bbox2.minY, bbox2.maxX].join(",")
76206     }, true);
76207     if (nextPage > maxPages)
76208       return;
76209     var id2 = tile.id + "," + String(nextPage);
76210     if (cache.loaded[id2] || cache.inflight[id2])
76211       return;
76212     var controller = new AbortController();
76213     cache.inflight[id2] = controller;
76214     var options2 = {
76215       method: "POST",
76216       signal: controller.signal,
76217       body: params,
76218       headers: { "Content-Type": "application/x-www-form-urlencoded" }
76219     };
76220     json_default(url, options2).then(function(data) {
76221       cache.loaded[id2] = true;
76222       delete cache.inflight[id2];
76223       if (!data || !data.currentPageItems || !data.currentPageItems.length) {
76224         throw new Error("No Data");
76225       }
76226       var features = data.currentPageItems.map(function(item) {
76227         var loc = [+item.lng, +item.lat];
76228         var d2;
76229         if (which === "images") {
76230           d2 = {
76231             loc,
76232             key: item.id,
76233             ca: +item.heading,
76234             captured_at: item.shot_date || item.date_added,
76235             captured_by: item.username,
76236             imagePath: item.lth_name,
76237             sequence_id: item.sequence_id,
76238             sequence_index: +item.sequence_index
76239           };
76240           var seq = _oscCache.sequences[d2.sequence_id];
76241           if (!seq) {
76242             seq = { rotation: 0, images: [] };
76243             _oscCache.sequences[d2.sequence_id] = seq;
76244           }
76245           seq.images[d2.sequence_index] = d2;
76246           _oscCache.images.forImageKey[d2.key] = d2;
76247         }
76248         return {
76249           minX: loc[0],
76250           minY: loc[1],
76251           maxX: loc[0],
76252           maxY: loc[1],
76253           data: d2
76254         };
76255       });
76256       cache.rtree.load(features);
76257       if (data.currentPageItems.length === maxResults) {
76258         cache.nextPage[tile.id] = nextPage + 1;
76259         loadNextTilePage(which, currZoom, url, tile);
76260       } else {
76261         cache.nextPage[tile.id] = Infinity;
76262       }
76263       if (which === "images") {
76264         dispatch7.call("loadedImages");
76265       }
76266     }).catch(function() {
76267       cache.loaded[id2] = true;
76268       delete cache.inflight[id2];
76269     });
76270   }
76271   function partitionViewport2(projection2) {
76272     var z2 = geoScaleToZoom(projection2.scale());
76273     var z22 = Math.ceil(z2 * 2) / 2 + 2.5;
76274     var tiler9 = utilTiler().zoomExtent([z22, z22]);
76275     return tiler9.getTiles(projection2).map(function(tile) {
76276       return tile.extent;
76277     });
76278   }
76279   function searchLimited2(limit, projection2, rtree) {
76280     limit = limit || 5;
76281     return partitionViewport2(projection2).reduce(function(result, extent) {
76282       var found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
76283         return d2.data;
76284       });
76285       return found.length ? result.concat(found) : result;
76286     }, []);
76287   }
76288   var kartaview_default = {
76289     init: function() {
76290       if (!_oscCache) {
76291         this.reset();
76292       }
76293       this.event = utilRebind(this, dispatch7, "on");
76294     },
76295     reset: function() {
76296       if (_oscCache) {
76297         Object.values(_oscCache.images.inflight).forEach(abortRequest4);
76298       }
76299       _oscCache = {
76300         images: { inflight: {}, loaded: {}, nextPage: {}, rtree: new import_rbush8.default(), forImageKey: {} },
76301         sequences: {}
76302       };
76303       _oscSelectedImage = null;
76304     },
76305     images: function(projection2) {
76306       var limit = 5;
76307       return searchLimited2(limit, projection2, _oscCache.images.rtree);
76308     },
76309     sequences: function(projection2) {
76310       var viewport = projection2.clipExtent();
76311       var min3 = [viewport[0][0], viewport[1][1]];
76312       var max3 = [viewport[1][0], viewport[0][1]];
76313       var bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
76314       var sequenceKeys = {};
76315       _oscCache.images.rtree.search(bbox2).forEach(function(d2) {
76316         sequenceKeys[d2.data.sequence_id] = true;
76317       });
76318       var lineStrings = [];
76319       Object.keys(sequenceKeys).forEach(function(sequenceKey) {
76320         var seq = _oscCache.sequences[sequenceKey];
76321         var images = seq && seq.images;
76322         if (images) {
76323           lineStrings.push({
76324             type: "LineString",
76325             coordinates: images.map(function(d2) {
76326               return d2.loc;
76327             }).filter(Boolean),
76328             properties: {
76329               captured_at: images[0] ? images[0].captured_at : null,
76330               captured_by: images[0] ? images[0].captured_by : null,
76331               key: sequenceKey
76332             }
76333           });
76334         }
76335       });
76336       return lineStrings;
76337     },
76338     cachedImage: function(imageKey) {
76339       return _oscCache.images.forImageKey[imageKey];
76340     },
76341     loadImages: function(projection2) {
76342       var url = apibase2 + "/1.0/list/nearby-photos/";
76343       loadTiles2("images", url, projection2);
76344     },
76345     ensureViewerLoaded: function(context) {
76346       if (_loadViewerPromise2)
76347         return _loadViewerPromise2;
76348       var wrap2 = context.container().select(".photoviewer").selectAll(".kartaview-wrapper").data([0]);
76349       var that = this;
76350       var wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper kartaview-wrapper").classed("hide", true).call(imgZoom2.on("zoom", zoomPan2)).on("dblclick.zoom", null);
76351       wrapEnter.append("div").attr("class", "photo-attribution fillD");
76352       var controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
76353       controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
76354       controlsEnter.append("button").on("click.rotate-ccw", rotate(-90)).text("\u293F");
76355       controlsEnter.append("button").on("click.rotate-cw", rotate(90)).text("\u293E");
76356       controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
76357       wrapEnter.append("div").attr("class", "kartaview-image-wrap");
76358       context.ui().photoviewer.on("resize.kartaview", function(dimensions) {
76359         imgZoom2.extent([[0, 0], dimensions]).translateExtent([[0, 0], dimensions]);
76360       });
76361       function zoomPan2(d3_event) {
76362         var t2 = d3_event.transform;
76363         context.container().select(".photoviewer .kartaview-image-wrap").call(utilSetTransform, t2.x, t2.y, t2.k);
76364       }
76365       function rotate(deg) {
76366         return function() {
76367           if (!_oscSelectedImage)
76368             return;
76369           var sequenceKey = _oscSelectedImage.sequence_id;
76370           var sequence = _oscCache.sequences[sequenceKey];
76371           if (!sequence)
76372             return;
76373           var r2 = sequence.rotation || 0;
76374           r2 += deg;
76375           if (r2 > 180)
76376             r2 -= 360;
76377           if (r2 < -180)
76378             r2 += 360;
76379           sequence.rotation = r2;
76380           var wrap3 = context.container().select(".photoviewer .kartaview-wrapper");
76381           wrap3.transition().duration(100).call(imgZoom2.transform, identity2);
76382           wrap3.selectAll(".kartaview-image").transition().duration(100).style("transform", "rotate(" + r2 + "deg)");
76383         };
76384       }
76385       function step(stepBy) {
76386         return function() {
76387           if (!_oscSelectedImage)
76388             return;
76389           var sequenceKey = _oscSelectedImage.sequence_id;
76390           var sequence = _oscCache.sequences[sequenceKey];
76391           if (!sequence)
76392             return;
76393           var nextIndex = _oscSelectedImage.sequence_index + stepBy;
76394           var nextImage = sequence.images[nextIndex];
76395           if (!nextImage)
76396             return;
76397           context.map().centerEase(nextImage.loc);
76398           that.selectImage(context, nextImage.key);
76399         };
76400       }
76401       _loadViewerPromise2 = Promise.resolve();
76402       return _loadViewerPromise2;
76403     },
76404     showViewer: function(context) {
76405       var viewer = context.container().select(".photoviewer").classed("hide", false);
76406       var isHidden = viewer.selectAll(".photo-wrapper.kartaview-wrapper.hide").size();
76407       if (isHidden) {
76408         viewer.selectAll(".photo-wrapper:not(.kartaview-wrapper)").classed("hide", true);
76409         viewer.selectAll(".photo-wrapper.kartaview-wrapper").classed("hide", false);
76410       }
76411       return this;
76412     },
76413     hideViewer: function(context) {
76414       _oscSelectedImage = null;
76415       this.updateUrlImage(null);
76416       var viewer = context.container().select(".photoviewer");
76417       if (!viewer.empty())
76418         viewer.datum(null);
76419       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
76420       context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
76421       return this.setStyles(context, null, true);
76422     },
76423     selectImage: function(context, imageKey) {
76424       var d2 = this.cachedImage(imageKey);
76425       _oscSelectedImage = d2;
76426       this.updateUrlImage(imageKey);
76427       var viewer = context.container().select(".photoviewer");
76428       if (!viewer.empty())
76429         viewer.datum(d2);
76430       this.setStyles(context, null, true);
76431       context.container().selectAll(".icon-sign").classed("currentView", false);
76432       if (!d2)
76433         return this;
76434       var wrap2 = context.container().select(".photoviewer .kartaview-wrapper");
76435       var imageWrap = wrap2.selectAll(".kartaview-image-wrap");
76436       var attribution = wrap2.selectAll(".photo-attribution").text("");
76437       wrap2.transition().duration(100).call(imgZoom2.transform, identity2);
76438       imageWrap.selectAll(".kartaview-image").remove();
76439       if (d2) {
76440         var sequence = _oscCache.sequences[d2.sequence_id];
76441         var r2 = sequence && sequence.rotation || 0;
76442         imageWrap.append("img").attr("class", "kartaview-image").attr("src", apibase2 + "/" + d2.imagePath).style("transform", "rotate(" + r2 + "deg)");
76443         if (d2.captured_by) {
76444           attribution.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://kartaview.org/user/" + encodeURIComponent(d2.captured_by)).text("@" + d2.captured_by);
76445           attribution.append("span").text("|");
76446         }
76447         if (d2.captured_at) {
76448           attribution.append("span").attr("class", "captured_at").text(localeDateString2(d2.captured_at));
76449           attribution.append("span").text("|");
76450         }
76451         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");
76452       }
76453       return this;
76454       function localeDateString2(s2) {
76455         if (!s2)
76456           return null;
76457         var options2 = { day: "numeric", month: "short", year: "numeric" };
76458         var d4 = new Date(s2);
76459         if (isNaN(d4.getTime()))
76460           return null;
76461         return d4.toLocaleDateString(_mainLocalizer.localeCode(), options2);
76462       }
76463     },
76464     getSelectedImage: function() {
76465       return _oscSelectedImage;
76466     },
76467     getSequenceKeyForImage: function(d2) {
76468       return d2 && d2.sequence_id;
76469     },
76470     // Updates the currently highlighted sequence and selected bubble.
76471     // Reset is only necessary when interacting with the viewport because
76472     // this implicitly changes the currently selected bubble/sequence
76473     setStyles: function(context, hovered, reset) {
76474       if (reset) {
76475         context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
76476         context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
76477       }
76478       var hoveredImageKey = hovered && hovered.key;
76479       var hoveredSequenceKey = this.getSequenceKeyForImage(hovered);
76480       var hoveredSequence = hoveredSequenceKey && _oscCache.sequences[hoveredSequenceKey];
76481       var hoveredImageKeys = hoveredSequence && hoveredSequence.images.map(function(d2) {
76482         return d2.key;
76483       }) || [];
76484       var viewer = context.container().select(".photoviewer");
76485       var selected = viewer.empty() ? void 0 : viewer.datum();
76486       var selectedImageKey = selected && selected.key;
76487       var selectedSequenceKey = this.getSequenceKeyForImage(selected);
76488       var selectedSequence = selectedSequenceKey && _oscCache.sequences[selectedSequenceKey];
76489       var selectedImageKeys = selectedSequence && selectedSequence.images.map(function(d2) {
76490         return d2.key;
76491       }) || [];
76492       var highlightedImageKeys = utilArrayUnion(hoveredImageKeys, selectedImageKeys);
76493       context.container().selectAll(".layer-kartaview .viewfield-group").classed("highlighted", function(d2) {
76494         return highlightedImageKeys.indexOf(d2.key) !== -1;
76495       }).classed("hovered", function(d2) {
76496         return d2.key === hoveredImageKey;
76497       }).classed("currentView", function(d2) {
76498         return d2.key === selectedImageKey;
76499       });
76500       context.container().selectAll(".layer-kartaview .sequence").classed("highlighted", function(d2) {
76501         return d2.properties.key === hoveredSequenceKey;
76502       }).classed("currentView", function(d2) {
76503         return d2.properties.key === selectedSequenceKey;
76504       });
76505       context.container().selectAll(".layer-kartaview .viewfield-group .viewfield").attr("d", viewfieldPath);
76506       function viewfieldPath() {
76507         var d2 = this.parentNode.__data__;
76508         if (d2.pano && d2.key !== selectedImageKey) {
76509           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
76510         } else {
76511           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
76512         }
76513       }
76514       return this;
76515     },
76516     updateUrlImage: function(imageKey) {
76517       if (!window.mocha) {
76518         var hash = utilStringQs(window.location.hash);
76519         if (imageKey) {
76520           hash.photo = "kartaview/" + imageKey;
76521         } else {
76522           delete hash.photo;
76523         }
76524         window.location.replace("#" + utilQsString(hash, true));
76525       }
76526     },
76527     cache: function() {
76528       return _oscCache;
76529     }
76530   };
76531
76532   // modules/services/vegbilder.js
76533   var import_rbush9 = __toESM(require_rbush_min());
76534
76535   // modules/services/pannellum_photo.js
76536   var pannellumViewerCSS = "pannellum/pannellum.css";
76537   var pannellumViewerJS = "pannellum/pannellum.js";
76538   var dispatch8 = dispatch_default("viewerChanged");
76539   var _currScenes = [];
76540   var _pannellumViewer;
76541   var pannellum_photo_default = {
76542     init: async function(context, selection2) {
76543       selection2.append("div").attr("class", "photo-frame pannellum-frame").attr("id", "ideditor-pannellum-viewer").classed("hide", true);
76544       if (!window.pannellum) {
76545         await this.loadPannellum(context);
76546       }
76547       const options2 = {
76548         "default": { firstScene: "" },
76549         scenes: {}
76550       };
76551       _pannellumViewer = window.pannellum.viewer("ideditor-pannellum-viewer", options2);
76552       _pannellumViewer.on("mousedown", () => {
76553         select_default2(window).on("pointermove.pannellum mousemove.pannellum", () => {
76554           dispatch8.call("viewerChanged");
76555         });
76556       }).on("mouseup", () => {
76557         select_default2(window).on("pointermove.pannellum mousemove.pannellum", null);
76558       }).on("animatefinished", () => {
76559         dispatch8.call("viewerChanged");
76560       });
76561       context.ui().photoviewer.on("resize.pannellum", () => {
76562         _pannellumViewer.resize();
76563       });
76564       this.event = utilRebind(this, dispatch8, "on");
76565       return this;
76566     },
76567     loadPannellum: function(context) {
76568       const head = select_default2("head");
76569       return Promise.all([
76570         new Promise((resolve, reject) => {
76571           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);
76572         }),
76573         new Promise((resolve, reject) => {
76574           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);
76575         })
76576       ]);
76577     },
76578     showPhotoFrame: function(context) {
76579       const isHidden = context.selectAll(".photo-frame.pannellum-frame.hide").size();
76580       if (isHidden) {
76581         context.selectAll(".photo-frame:not(.pannellum-frame)").classed("hide", true);
76582         context.selectAll(".photo-frame.pannellum-frame").classed("hide", false);
76583       }
76584       return this;
76585     },
76586     hidePhotoFrame: function(viewerContext) {
76587       viewerContext.select("photo-frame.pannellum-frame").classed("hide", false);
76588       return this;
76589     },
76590     selectPhoto: function(data, keepOrientation) {
76591       const { key } = data;
76592       if (!(key in _currScenes)) {
76593         let newSceneOptions = {
76594           showFullscreenCtrl: false,
76595           autoLoad: false,
76596           compass: true,
76597           yaw: 0,
76598           type: "equirectangular",
76599           preview: data.preview_path,
76600           panorama: data.image_path,
76601           northOffset: data.ca
76602         };
76603         _currScenes.push(key);
76604         _pannellumViewer.addScene(key, newSceneOptions);
76605       }
76606       let yaw = 0;
76607       let pitch = 0;
76608       if (keepOrientation) {
76609         yaw = this.getYaw();
76610         pitch = _pannellumViewer.getPitch();
76611       }
76612       _pannellumViewer.loadScene(key, pitch, yaw);
76613       dispatch8.call("viewerChanged");
76614       if (_currScenes.length > 3) {
76615         const old_key = _currScenes.shift();
76616         _pannellumViewer.removeScene(old_key);
76617       }
76618       return this;
76619     },
76620     getYaw: function() {
76621       return _pannellumViewer.getYaw();
76622     }
76623   };
76624
76625   // modules/services/vegbilder.js
76626   var owsEndpoint = "https://www.vegvesen.no/kart/ogc/vegbilder_1_0/ows?";
76627   var tileZoom2 = 14;
76628   var tiler5 = utilTiler().zoomExtent([tileZoom2, tileZoom2]).skipNullIsland(true);
76629   var dispatch9 = dispatch_default("loadedImages", "viewerChanged");
76630   var directionEnum = Object.freeze({
76631     forward: Symbol(0),
76632     backward: Symbol(1)
76633   });
76634   var _planeFrame;
76635   var _pannellumFrame;
76636   var _currentFrame;
76637   var _loadViewerPromise3;
76638   var _vegbilderCache;
76639   async function fetchAvailableLayers() {
76640     const params = {
76641       service: "WFS",
76642       request: "GetCapabilities",
76643       version: "2.0.0"
76644     };
76645     const urlForRequest = owsEndpoint + utilQsString(params);
76646     const response = await xml_default(urlForRequest);
76647     const xPathSelector = "/wfs:WFS_Capabilities/wfs:FeatureTypeList/wfs:FeatureType/wfs:Name";
76648     const regexMatcher = /^vegbilder_1_0:Vegbilder(?<image_type>_360)?_(?<year>\d{4})$/;
76649     const NSResolver = response.createNSResolver(response);
76650     const l2 = response.evaluate(
76651       xPathSelector,
76652       response,
76653       NSResolver,
76654       XPathResult.ANY_TYPE
76655     );
76656     let node;
76657     const availableLayers = [];
76658     while ((node = l2.iterateNext()) !== null) {
76659       const match = node.textContent?.match(regexMatcher);
76660       if (match) {
76661         availableLayers.push({
76662           name: match[0],
76663           is_sphere: !!match.groups?.image_type,
76664           year: parseInt(match.groups?.year, 10)
76665         });
76666       }
76667     }
76668     return availableLayers;
76669   }
76670   function filterAvailableLayers(photoContex) {
76671     const fromDateString = photoContex.fromDate();
76672     const toDateString = photoContex.toDate();
76673     const fromYear = fromDateString ? new Date(fromDateString).getFullYear() : 2016;
76674     const toYear = toDateString ? new Date(toDateString).getFullYear() : null;
76675     const showsFlat = photoContex.showsFlat();
76676     const showsPano = photoContex.showsPanoramic();
76677     return Array.from(_vegbilderCache.wfslayers.values()).filter(({ layerInfo }) => layerInfo.year >= fromYear && (!toYear || layerInfo.year <= toYear) && (!layerInfo.is_sphere && showsFlat || layerInfo.is_sphere && showsPano));
76678   }
76679   function loadWFSLayers(projection2, margin, wfslayers) {
76680     const tiles = tiler5.margin(margin).getTiles(projection2);
76681     for (const cache of wfslayers) {
76682       loadWFSLayer(projection2, cache, tiles);
76683     }
76684   }
76685   function loadWFSLayer(projection2, cache, tiles) {
76686     for (const [key, controller] of cache.inflight.entries()) {
76687       const wanted = tiles.some((tile) => key === tile.id);
76688       if (!wanted) {
76689         controller.abort();
76690         cache.inflight.delete(key);
76691       }
76692     }
76693     Promise.all(tiles.map(
76694       (tile) => loadTile2(cache, cache.layerInfo.name, tile)
76695     )).then(() => orderSequences(projection2, cache));
76696   }
76697   async function loadTile2(cache, typename, tile) {
76698     const bbox2 = tile.extent.bbox();
76699     const tileid = tile.id;
76700     if (cache.loaded.get(tileid) === true || cache.inflight.has(tileid))
76701       return;
76702     const params = {
76703       service: "WFS",
76704       request: "GetFeature",
76705       version: "2.0.0",
76706       typenames: typename,
76707       bbox: [bbox2.minY, bbox2.minX, bbox2.maxY, bbox2.maxX].join(","),
76708       outputFormat: "json"
76709     };
76710     const controller = new AbortController();
76711     cache.inflight.set(tileid, controller);
76712     const options2 = {
76713       method: "GET",
76714       signal: controller.signal
76715     };
76716     const urlForRequest = owsEndpoint + utilQsString(params);
76717     let featureCollection;
76718     try {
76719       featureCollection = await json_default(urlForRequest, options2);
76720     } catch {
76721       cache.loaded.set(tileid, false);
76722       return;
76723     } finally {
76724       cache.inflight.delete(tileid);
76725     }
76726     cache.loaded.set(tileid, true);
76727     if (featureCollection.features.length === 0) {
76728       return;
76729     }
76730     const features = featureCollection.features.map((feature3) => {
76731       const loc = feature3.geometry.coordinates;
76732       const key = feature3.id;
76733       const properties = feature3.properties;
76734       const {
76735         RETNING: ca,
76736         TIDSPUNKT: captured_at,
76737         URL: image_path,
76738         URLPREVIEW: preview_path,
76739         BILDETYPE: image_type,
76740         METER: metering,
76741         FELTKODE: lane_code
76742       } = properties;
76743       const lane_number = parseInt(lane_code.match(/^[0-9]+/)[0], 10);
76744       const direction = lane_number % 2 === 0 ? directionEnum.backward : directionEnum.forward;
76745       const data = {
76746         loc,
76747         key,
76748         ca,
76749         image_path,
76750         preview_path,
76751         road_reference: roadReference(properties),
76752         metering,
76753         lane_code,
76754         direction,
76755         captured_at: new Date(captured_at),
76756         is_sphere: image_type === "360"
76757       };
76758       cache.points.set(key, data);
76759       return {
76760         minX: loc[0],
76761         minY: loc[1],
76762         maxX: loc[0],
76763         maxY: loc[1],
76764         data
76765       };
76766     });
76767     _vegbilderCache.rtree.load(features);
76768     dispatch9.call("loadedImages");
76769   }
76770   function orderSequences(projection2, cache) {
76771     const { points } = cache;
76772     const grouped = Array.from(points.values()).reduce((grouped2, image) => {
76773       const key = image.road_reference;
76774       if (grouped2.has(key)) {
76775         grouped2.get(key).push(image);
76776       } else {
76777         grouped2.set(key, [image]);
76778       }
76779       return grouped2;
76780     }, /* @__PURE__ */ new Map());
76781     const imageSequences = Array.from(grouped.values()).reduce((imageSequences2, imageGroup) => {
76782       imageGroup.sort((a2, b2) => {
76783         if (a2.captured_at.valueOf() > b2.captured_at.valueOf()) {
76784           return 1;
76785         } else if (a2.captured_at.valueOf() < b2.captured_at.valueOf()) {
76786           return -1;
76787         } else {
76788           const { direction } = a2;
76789           if (direction === directionEnum.forward) {
76790             return a2.metering - b2.metering;
76791           } else {
76792             return b2.metering - a2.metering;
76793           }
76794         }
76795       });
76796       let imageSequence = [imageGroup[0]];
76797       let angle2 = null;
76798       for (const [lastImage, image] of pairs(imageGroup)) {
76799         if (lastImage.ca === null) {
76800           const b2 = projection2(lastImage.loc);
76801           const a2 = projection2(image.loc);
76802           if (!geoVecEqual(a2, b2)) {
76803             angle2 = geoVecAngle(a2, b2);
76804             angle2 *= 180 / Math.PI;
76805             angle2 -= 90;
76806             angle2 = angle2 >= 0 ? angle2 : angle2 + 360;
76807           }
76808           lastImage.ca = angle2;
76809         }
76810         if (image.direction === lastImage.direction && image.captured_at.valueOf() - lastImage.captured_at.valueOf() <= 2e4) {
76811           imageSequence.push(image);
76812         } else {
76813           imageSequences2.push(imageSequence);
76814           imageSequence = [image];
76815         }
76816       }
76817       imageSequences2.push(imageSequence);
76818       return imageSequences2;
76819     }, []);
76820     cache.sequences = imageSequences.map((images) => {
76821       const sequence = {
76822         images,
76823         key: images[0].key,
76824         geometry: {
76825           type: "LineString",
76826           coordinates: images.map((image) => image.loc)
76827         }
76828       };
76829       for (const image of images) {
76830         _vegbilderCache.image2sequence_map.set(image.key, sequence);
76831       }
76832       return sequence;
76833     });
76834   }
76835   function roadReference(properties) {
76836     const {
76837       FYLKENUMMER: county_number,
76838       VEGKATEGORI: road_class,
76839       VEGSTATUS: road_status,
76840       VEGNUMMER: road_number,
76841       STREKNING: section,
76842       DELSTREKNING: subsection,
76843       HP: parcel,
76844       KRYSSDEL: junction_part,
76845       SIDEANLEGGSDEL: services_part,
76846       ANKERPUNKT: anker_point,
76847       AAR: year
76848     } = properties;
76849     let reference;
76850     if (year >= 2020) {
76851       reference = `${road_class}${road_status}${road_number} S${section}D${subsection}`;
76852       if (junction_part) {
76853         reference = `${reference} M${anker_point} KD${junction_part}`;
76854       } else if (services_part) {
76855         reference = `${reference} M${anker_point} SD${services_part}`;
76856       }
76857     } else {
76858       reference = `${county_number}${road_class}${road_status}${road_number} HP${parcel}`;
76859     }
76860     return reference;
76861   }
76862   function localeTimestamp(date) {
76863     const options2 = {
76864       day: "2-digit",
76865       month: "2-digit",
76866       year: "numeric",
76867       hour: "numeric",
76868       minute: "numeric",
76869       second: "numeric"
76870     };
76871     return date.toLocaleString(_mainLocalizer.localeCode(), options2);
76872   }
76873   function partitionViewport3(projection2) {
76874     const zoom = geoScaleToZoom(projection2.scale());
76875     const roundZoom = Math.ceil(zoom * 2) / 2 + 2.5;
76876     const tiler9 = utilTiler().zoomExtent([roundZoom, roundZoom]);
76877     return tiler9.getTiles(projection2).map((tile) => tile.extent);
76878   }
76879   function searchLimited3(limit, projection2, rtree) {
76880     limit ??= 5;
76881     return partitionViewport3(projection2).reduce((result, extent) => {
76882       const found = rtree.search(extent.bbox()).slice(0, limit).map((d2) => d2.data);
76883       return result.concat(found);
76884     }, []);
76885   }
76886   var vegbilder_default = {
76887     init: function() {
76888       this.event = utilRebind(this, dispatch9, "on");
76889     },
76890     reset: async function() {
76891       if (_vegbilderCache) {
76892         for (const layer of _vegbilderCache.wfslayers.values()) {
76893           for (const controller of layer.inflight.values()) {
76894             controller.abort();
76895           }
76896         }
76897       }
76898       _vegbilderCache = {
76899         wfslayers: /* @__PURE__ */ new Map(),
76900         rtree: new import_rbush9.default(),
76901         image2sequence_map: /* @__PURE__ */ new Map()
76902       };
76903       const availableLayers = await fetchAvailableLayers();
76904       const { wfslayers } = _vegbilderCache;
76905       for (const layerInfo of availableLayers) {
76906         const cache = {
76907           layerInfo,
76908           loaded: /* @__PURE__ */ new Map(),
76909           inflight: /* @__PURE__ */ new Map(),
76910           points: /* @__PURE__ */ new Map(),
76911           sequences: []
76912         };
76913         wfslayers.set(layerInfo.name, cache);
76914       }
76915     },
76916     images: function(projection2) {
76917       const limit = 5;
76918       return searchLimited3(limit, projection2, _vegbilderCache.rtree);
76919     },
76920     sequences: function(projection2) {
76921       const viewport = projection2.clipExtent();
76922       const min3 = [viewport[0][0], viewport[1][1]];
76923       const max3 = [viewport[1][0], viewport[0][1]];
76924       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
76925       const seen = /* @__PURE__ */ new Set();
76926       const line_strings = [];
76927       for (const { data } of _vegbilderCache.rtree.search(bbox2)) {
76928         const sequence = _vegbilderCache.image2sequence_map.get(data.key);
76929         if (!sequence)
76930           continue;
76931         const { key, geometry, images } = sequence;
76932         if (seen.has(key))
76933           continue;
76934         seen.add(key);
76935         const line = {
76936           type: "LineString",
76937           coordinates: geometry.coordinates,
76938           key,
76939           images
76940         };
76941         line_strings.push(line);
76942       }
76943       return line_strings;
76944     },
76945     cachedImage: function(key) {
76946       for (const { points } of _vegbilderCache.wfslayers.values()) {
76947         if (points.has(key))
76948           return points.get(key);
76949       }
76950     },
76951     getSequenceForImage: function(image) {
76952       return _vegbilderCache?.image2sequence_map.get(image?.key);
76953     },
76954     loadImages: async function(context, margin) {
76955       if (!_vegbilderCache) {
76956         await this.reset();
76957       }
76958       margin ??= 1;
76959       const wfslayers = filterAvailableLayers(context.photos());
76960       loadWFSLayers(context.projection, margin, wfslayers);
76961     },
76962     photoFrame: function() {
76963       return _currentFrame;
76964     },
76965     ensureViewerLoaded: function(context) {
76966       if (_loadViewerPromise3)
76967         return _loadViewerPromise3;
76968       const step = (stepBy) => () => {
76969         const viewer = context.container().select(".photoviewer");
76970         const selected = viewer.empty() ? void 0 : viewer.datum();
76971         if (!selected)
76972           return;
76973         const sequence = this.getSequenceForImage(selected);
76974         const nextIndex = sequence.images.indexOf(selected) + stepBy;
76975         const nextImage = sequence.images[nextIndex];
76976         if (!nextImage)
76977           return;
76978         context.map().centerEase(nextImage.loc);
76979         this.selectImage(context, nextImage.key, true);
76980       };
76981       const wrap2 = context.container().select(".photoviewer").selectAll(".vegbilder-wrapper").data([0]);
76982       const wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper vegbilder-wrapper").classed("hide", true);
76983       wrapEnter.append("div").attr("class", "photo-attribution fillD");
76984       const controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
76985       controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
76986       controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
76987       _loadViewerPromise3 = Promise.all([
76988         pannellum_photo_default.init(context, wrapEnter),
76989         plane_photo_default.init(context, wrapEnter)
76990       ]).then(([pannellumPhotoFrame, planePhotoFrame]) => {
76991         _pannellumFrame = pannellumPhotoFrame;
76992         _pannellumFrame.event.on("viewerChanged", () => dispatch9.call("viewerChanged"));
76993         _planeFrame = planePhotoFrame;
76994         _planeFrame.event.on("viewerChanged", () => dispatch9.call("viewerChanged"));
76995       });
76996       return _loadViewerPromise3;
76997     },
76998     selectImage: function(context, key, keepOrientation) {
76999       const d2 = this.cachedImage(key);
77000       this.updateUrlImage(key);
77001       const viewer = context.container().select(".photoviewer");
77002       if (!viewer.empty()) {
77003         viewer.datum(d2);
77004       }
77005       this.setStyles(context, null, true);
77006       if (!d2)
77007         return this;
77008       const wrap2 = context.container().select(".photoviewer .vegbilder-wrapper");
77009       const attribution = wrap2.selectAll(".photo-attribution").text("");
77010       if (d2.captured_at) {
77011         attribution.append("span").attr("class", "captured_at").text(localeTimestamp(d2.captured_at));
77012       }
77013       attribution.append("a").attr("target", "_blank").attr("href", "https://vegvesen.no").call(_t.append("vegbilder.publisher"));
77014       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"));
77015       _currentFrame = d2.is_sphere ? _pannellumFrame : _planeFrame;
77016       _currentFrame.selectPhoto(d2, keepOrientation).showPhotoFrame(wrap2);
77017       return this;
77018     },
77019     showViewer: function(context) {
77020       const viewer = context.container().select(".photoviewer").classed("hide", false);
77021       const isHidden = viewer.selectAll(".photo-wrapper.vegbilder-wrapper.hide").size();
77022       if (isHidden) {
77023         viewer.selectAll(".photo-wrapper:not(.vegbilder-wrapper)").classed("hide", true);
77024         viewer.selectAll(".photo-wrapper.vegbilder-wrapper").classed("hide", false);
77025       }
77026       return this;
77027     },
77028     hideViewer: function(context) {
77029       this.updateUrlImage(null);
77030       const viewer = context.container().select(".photoviewer");
77031       if (!viewer.empty())
77032         viewer.datum(null);
77033       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
77034       context.container().selectAll(".viewfield-group, .sequence").classed("currentView", false);
77035       return this.setStyles(context, null, true);
77036     },
77037     // Updates the currently highlighted sequence and selected bubble.
77038     // Reset is only necessary when interacting with the viewport because
77039     // this implicitly changes the currently selected bubble/sequence
77040     setStyles: function(context, hovered, reset) {
77041       if (reset) {
77042         context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
77043         context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
77044       }
77045       const hoveredImageKey = hovered?.key;
77046       const hoveredSequence = this.getSequenceForImage(hovered);
77047       const hoveredSequenceKey = hoveredSequence?.key;
77048       const hoveredImageKeys = hoveredSequence?.images.map((d2) => d2.key) ?? [];
77049       const viewer = context.container().select(".photoviewer");
77050       const selected = viewer.empty() ? void 0 : viewer.datum();
77051       const selectedImageKey = selected?.key;
77052       const selectedSequence = this.getSequenceForImage(selected);
77053       const selectedSequenceKey = selectedSequence?.key;
77054       const selectedImageKeys = selectedSequence?.images.map((d2) => d2.key) ?? [];
77055       const highlightedImageKeys = utilArrayUnion(hoveredImageKeys, selectedImageKeys);
77056       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);
77057       context.container().selectAll(".layer-vegbilder .sequence").classed("highlighted", (d2) => d2.key === hoveredSequenceKey).classed("currentView", (d2) => d2.key === selectedSequenceKey);
77058       context.container().selectAll(".layer-vegbilder .viewfield-group .viewfield").attr("d", viewfieldPath);
77059       function viewfieldPath() {
77060         const d2 = this.parentNode.__data__;
77061         if (d2.is_sphere && d2.key !== selectedImageKey) {
77062           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
77063         } else {
77064           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
77065         }
77066       }
77067       return this;
77068     },
77069     updateUrlImage: function(key) {
77070       if (!window.mocha) {
77071         const hash = utilStringQs(window.location.hash);
77072         if (key) {
77073           hash.photo = "vegbilder/" + key;
77074         } else {
77075           delete hash.photo;
77076         }
77077         window.location.replace("#" + utilQsString(hash, true));
77078       }
77079     },
77080     validHere: function(extent) {
77081       const bbox2 = Object.values(extent.bbox());
77082       return iso1A2Codes(bbox2).includes("NO");
77083     },
77084     cache: function() {
77085       return _vegbilderCache;
77086     }
77087   };
77088
77089   // node_modules/osm-auth/src/osm-auth.mjs
77090   var import_store = __toESM(require_store_legacy(), 1);
77091   function osmAuth(o2) {
77092     var oauth2 = {};
77093     oauth2.authenticated = function() {
77094       return !!token("oauth2_access_token");
77095     };
77096     oauth2.logout = function() {
77097       token("oauth2_access_token", "");
77098       token("oauth_token", "");
77099       token("oauth_token_secret", "");
77100       token("oauth_request_token_secret", "");
77101       return oauth2;
77102     };
77103     oauth2.authenticate = function(callback) {
77104       if (oauth2.authenticated()) {
77105         callback(null, oauth2);
77106         return;
77107       }
77108       oauth2.logout();
77109       _generatePkceChallenge(function(pkce) {
77110         _authenticate(pkce, callback);
77111       });
77112     };
77113     oauth2.authenticateAsync = function() {
77114       if (oauth2.authenticated()) {
77115         return Promise.resolve(oauth2);
77116       }
77117       oauth2.logout();
77118       return new Promise((resolve, reject) => {
77119         var errback = (err, result) => {
77120           if (err) {
77121             reject(new Error(err));
77122           } else {
77123             resolve(result);
77124           }
77125         };
77126         _generatePkceChallenge((pkce) => _authenticate(pkce, errback));
77127       });
77128     };
77129     function _authenticate(pkce, callback) {
77130       var state = generateState();
77131       var url = o2.url + "/oauth2/authorize?" + utilQsString2({
77132         client_id: o2.client_id,
77133         redirect_uri: o2.redirect_uri,
77134         response_type: "code",
77135         scope: o2.scope,
77136         state,
77137         code_challenge: pkce.code_challenge,
77138         code_challenge_method: pkce.code_challenge_method
77139       });
77140       if (o2.singlepage) {
77141         if (!import_store.default.enabled) {
77142           var error = new Error("local storage unavailable, but require in singlepage mode");
77143           error.status = "pkce-localstorage-unavailable";
77144           callback(error);
77145           return;
77146         }
77147         var params = utilStringQs2(window.location.search.slice(1));
77148         if (params.code) {
77149           oauth2.bootstrapToken(params.code, callback);
77150         } else {
77151           token("oauth2_state", state);
77152           token("oauth2_pkce_code_verifier", pkce.code_verifier);
77153           window.location = url;
77154         }
77155       } else {
77156         var w2 = 600;
77157         var h2 = 550;
77158         var settings = [
77159           ["width", w2],
77160           ["height", h2],
77161           ["left", window.screen.width / 2 - w2 / 2],
77162           ["top", window.screen.height / 2 - h2 / 2]
77163         ].map(function(x2) {
77164           return x2.join("=");
77165         }).join(",");
77166         var popup = window.open("about:blank", "oauth_window", settings);
77167         oauth2.popupWindow = popup;
77168         popup.location = url;
77169         if (!popup) {
77170           error = new Error("Popup was blocked");
77171           error.status = "popup-blocked";
77172           callback(error);
77173         }
77174       }
77175       window.authComplete = function(url2) {
77176         var params2 = utilStringQs2(url2.split("?")[1]);
77177         if (params2.state !== state) {
77178           error = new Error("Invalid state");
77179           error.status = "invalid-state";
77180           callback(error);
77181           return;
77182         }
77183         _getAccessToken(params2.code, pkce.code_verifier, accessTokenDone);
77184         delete window.authComplete;
77185       };
77186       function accessTokenDone(err, xhr) {
77187         o2.done();
77188         if (err) {
77189           callback(err);
77190           return;
77191         }
77192         var access_token = JSON.parse(xhr.response);
77193         token("oauth2_access_token", access_token.access_token);
77194         callback(null, oauth2);
77195       }
77196     }
77197     function _getAccessToken(auth_code, code_verifier, accessTokenDone) {
77198       var url = o2.url + "/oauth2/token?" + utilQsString2({
77199         client_id: o2.client_id,
77200         redirect_uri: o2.redirect_uri,
77201         grant_type: "authorization_code",
77202         code: auth_code,
77203         code_verifier
77204       });
77205       oauth2.rawxhr("POST", url, null, null, null, accessTokenDone);
77206       o2.loading();
77207     }
77208     oauth2.bringPopupWindowToFront = function() {
77209       var broughtPopupToFront = false;
77210       try {
77211         if (oauth2.popupWindow && !oauth2.popupWindow.closed) {
77212           oauth2.popupWindow.focus();
77213           broughtPopupToFront = true;
77214         }
77215       } catch (err) {
77216       }
77217       return broughtPopupToFront;
77218     };
77219     oauth2.bootstrapToken = function(auth_code, callback) {
77220       var state = token("oauth2_state");
77221       token("oauth2_state", "");
77222       var params = utilStringQs2(window.location.search.slice(1));
77223       if (params.state !== state) {
77224         var error = new Error("Invalid state");
77225         error.status = "invalid-state";
77226         callback(error);
77227         return;
77228       }
77229       var code_verifier = token("oauth2_pkce_code_verifier");
77230       token("oauth2_pkce_code_verifier", "");
77231       _getAccessToken(auth_code, code_verifier, accessTokenDone);
77232       function accessTokenDone(err, xhr) {
77233         o2.done();
77234         if (err) {
77235           callback(err);
77236           return;
77237         }
77238         var access_token = JSON.parse(xhr.response);
77239         token("oauth2_access_token", access_token.access_token);
77240         callback(null, oauth2);
77241       }
77242     };
77243     oauth2.fetch = function(resource, options2) {
77244       if (oauth2.authenticated()) {
77245         return _doFetch();
77246       } else {
77247         if (o2.auto) {
77248           return oauth2.authenticateAsync().then(_doFetch);
77249         } else {
77250           return Promise.reject(new Error("not authenticated"));
77251         }
77252       }
77253       function _doFetch() {
77254         options2 = options2 || {};
77255         if (!options2.headers) {
77256           options2.headers = { "Content-Type": "application/x-www-form-urlencoded" };
77257         }
77258         options2.headers.Authorization = "Bearer " + token("oauth2_access_token");
77259         return fetch(resource, options2);
77260       }
77261     };
77262     oauth2.xhr = function(options2, callback) {
77263       if (oauth2.authenticated()) {
77264         return _doXHR();
77265       } else {
77266         if (o2.auto) {
77267           oauth2.authenticate(_doXHR);
77268           return;
77269         } else {
77270           callback("not authenticated", null);
77271           return;
77272         }
77273       }
77274       function _doXHR() {
77275         var url = options2.prefix !== false ? o2.url + options2.path : options2.path;
77276         return oauth2.rawxhr(
77277           options2.method,
77278           url,
77279           token("oauth2_access_token"),
77280           options2.content,
77281           options2.headers,
77282           done
77283         );
77284       }
77285       function done(err, xhr) {
77286         if (err) {
77287           callback(err);
77288         } else if (xhr.responseXML) {
77289           callback(err, xhr.responseXML);
77290         } else {
77291           callback(err, xhr.response);
77292         }
77293       }
77294     };
77295     oauth2.rawxhr = function(method, url, access_token, data, headers, callback) {
77296       headers = headers || { "Content-Type": "application/x-www-form-urlencoded" };
77297       if (access_token) {
77298         headers.Authorization = "Bearer " + access_token;
77299       }
77300       var xhr = new XMLHttpRequest();
77301       xhr.onreadystatechange = function() {
77302         if (4 === xhr.readyState && 0 !== xhr.status) {
77303           if (/^20\d$/.test(xhr.status)) {
77304             callback(null, xhr);
77305           } else {
77306             callback(xhr, null);
77307           }
77308         }
77309       };
77310       xhr.onerror = function(e3) {
77311         callback(e3, null);
77312       };
77313       xhr.open(method, url, true);
77314       for (var h2 in headers)
77315         xhr.setRequestHeader(h2, headers[h2]);
77316       xhr.send(data);
77317       return xhr;
77318     };
77319     oauth2.preauth = function(val) {
77320       if (val && val.access_token) {
77321         token("oauth2_access_token", val.access_token);
77322       }
77323       return oauth2;
77324     };
77325     oauth2.options = function(val) {
77326       if (!arguments.length)
77327         return o2;
77328       o2 = val;
77329       o2.url = o2.url || "https://www.openstreetmap.org";
77330       o2.auto = o2.auto || false;
77331       o2.singlepage = o2.singlepage || false;
77332       o2.loading = o2.loading || function() {
77333       };
77334       o2.done = o2.done || function() {
77335       };
77336       return oauth2.preauth(o2);
77337     };
77338     var token;
77339     if (import_store.default.enabled) {
77340       token = function(x2, y2) {
77341         if (arguments.length === 1)
77342           return import_store.default.get(o2.url + x2);
77343         else if (arguments.length === 2)
77344           return import_store.default.set(o2.url + x2, y2);
77345       };
77346     } else {
77347       var storage = {};
77348       token = function(x2, y2) {
77349         if (arguments.length === 1)
77350           return storage[o2.url + x2];
77351         else if (arguments.length === 2)
77352           return storage[o2.url + x2] = y2;
77353       };
77354     }
77355     oauth2.options(o2);
77356     return oauth2;
77357   }
77358   function utilQsString2(obj) {
77359     return Object.keys(obj).filter(function(key) {
77360       return obj[key] !== void 0;
77361     }).sort().map(function(key) {
77362       return encodeURIComponent(key) + "=" + encodeURIComponent(obj[key]);
77363     }).join("&");
77364   }
77365   function utilStringQs2(str2) {
77366     var i3 = 0;
77367     while (i3 < str2.length && (str2[i3] === "?" || str2[i3] === "#"))
77368       i3++;
77369     str2 = str2.slice(i3);
77370     return str2.split("&").reduce(function(obj, pair3) {
77371       var parts = pair3.split("=");
77372       if (parts.length === 2) {
77373         obj[parts[0]] = decodeURIComponent(parts[1]);
77374       }
77375       return obj;
77376     }, {});
77377   }
77378   function supportsWebCryptoAPI() {
77379     return window && window.crypto && window.crypto.getRandomValues && window.crypto.subtle && window.crypto.subtle.digest;
77380   }
77381   function _generatePkceChallenge(callback) {
77382     var code_verifier;
77383     if (supportsWebCryptoAPI()) {
77384       var random = window.crypto.getRandomValues(new Uint8Array(32));
77385       code_verifier = base64(random.buffer);
77386       var verifier = Uint8Array.from(Array.from(code_verifier).map(function(char) {
77387         return char.charCodeAt(0);
77388       }));
77389       window.crypto.subtle.digest("SHA-256", verifier).then(function(hash) {
77390         var code_challenge = base64(hash);
77391         callback({
77392           code_challenge,
77393           code_verifier,
77394           code_challenge_method: "S256"
77395         });
77396       });
77397     } else {
77398       var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
77399       code_verifier = "";
77400       for (var i3 = 0; i3 < 64; i3++) {
77401         code_verifier += chars[Math.floor(Math.random() * chars.length)];
77402       }
77403       callback({
77404         code_verifier,
77405         code_challenge: code_verifier,
77406         code_challenge_method: "plain"
77407       });
77408     }
77409   }
77410   function generateState() {
77411     var state;
77412     if (supportsWebCryptoAPI()) {
77413       var random = window.crypto.getRandomValues(new Uint8Array(32));
77414       state = base64(random.buffer);
77415     } else {
77416       var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
77417       state = "";
77418       for (var i3 = 0; i3 < 64; i3++) {
77419         state += chars[Math.floor(Math.random() * chars.length)];
77420       }
77421     }
77422     return state;
77423   }
77424   function base64(buffer) {
77425     return btoa(String.fromCharCode.apply(null, new Uint8Array(buffer))).replace(/\//g, "_").replace(/\+/g, "-").replace(/[=]/g, "");
77426   }
77427
77428   // modules/services/osm.js
77429   var import_rbush10 = __toESM(require_rbush_min());
77430   var tiler6 = utilTiler();
77431   var dispatch10 = dispatch_default("apiStatusChange", "authLoading", "authDone", "change", "loading", "loaded", "loadedNotes");
77432   var urlroot = osmApiConnections[0].url;
77433   var redirectPath = window.location.origin + window.location.pathname;
77434   var oauth = osmAuth({
77435     url: urlroot,
77436     client_id: osmApiConnections[0].client_id,
77437     client_secret: osmApiConnections[0].client_secret,
77438     scope: "read_prefs write_prefs write_api read_gpx write_notes",
77439     redirect_uri: redirectPath + "land.html",
77440     loading: authLoading,
77441     done: authDone
77442   });
77443   var _apiConnections = osmApiConnections;
77444   var _imageryBlocklists = [/.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/];
77445   var _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new import_rbush10.default() };
77446   var _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new import_rbush10.default() };
77447   var _userCache = { toLoad: {}, user: {} };
77448   var _cachedApiStatus;
77449   var _changeset = {};
77450   var _deferred = /* @__PURE__ */ new Set();
77451   var _connectionID = 1;
77452   var _tileZoom4 = 16;
77453   var _noteZoom = 12;
77454   var _rateLimitError;
77455   var _userChangesets;
77456   var _userDetails;
77457   var _off;
77458   var _maxWayNodes = 2e3;
77459   function authLoading() {
77460     dispatch10.call("authLoading");
77461   }
77462   function authDone() {
77463     dispatch10.call("authDone");
77464   }
77465   function abortRequest5(controllerOrXHR) {
77466     if (controllerOrXHR) {
77467       controllerOrXHR.abort();
77468     }
77469   }
77470   function hasInflightRequests(cache) {
77471     return Object.keys(cache.inflight).length;
77472   }
77473   function abortUnwantedRequests4(cache, visibleTiles) {
77474     Object.keys(cache.inflight).forEach(function(k2) {
77475       if (cache.toLoad[k2])
77476         return;
77477       if (visibleTiles.find(function(tile) {
77478         return k2 === tile.id;
77479       }))
77480         return;
77481       abortRequest5(cache.inflight[k2]);
77482       delete cache.inflight[k2];
77483     });
77484   }
77485   function getLoc(attrs) {
77486     var lon = attrs.lon && attrs.lon.value;
77487     var lat = attrs.lat && attrs.lat.value;
77488     return [Number(lon), Number(lat)];
77489   }
77490   function getNodes(obj) {
77491     var elems = obj.getElementsByTagName("nd");
77492     var nodes = new Array(elems.length);
77493     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
77494       nodes[i3] = "n" + elems[i3].attributes.ref.value;
77495     }
77496     return nodes;
77497   }
77498   function getNodesJSON(obj) {
77499     var elems = obj.nodes;
77500     var nodes = new Array(elems.length);
77501     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
77502       nodes[i3] = "n" + elems[i3];
77503     }
77504     return nodes;
77505   }
77506   function getTags(obj) {
77507     var elems = obj.getElementsByTagName("tag");
77508     var tags = {};
77509     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
77510       var attrs = elems[i3].attributes;
77511       tags[attrs.k.value] = attrs.v.value;
77512     }
77513     return tags;
77514   }
77515   function getMembers(obj) {
77516     var elems = obj.getElementsByTagName("member");
77517     var members = new Array(elems.length);
77518     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
77519       var attrs = elems[i3].attributes;
77520       members[i3] = {
77521         id: attrs.type.value[0] + attrs.ref.value,
77522         type: attrs.type.value,
77523         role: attrs.role.value
77524       };
77525     }
77526     return members;
77527   }
77528   function getMembersJSON(obj) {
77529     var elems = obj.members;
77530     var members = new Array(elems.length);
77531     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
77532       var attrs = elems[i3];
77533       members[i3] = {
77534         id: attrs.type[0] + attrs.ref,
77535         type: attrs.type,
77536         role: attrs.role
77537       };
77538     }
77539     return members;
77540   }
77541   function getVisible(attrs) {
77542     return !attrs.visible || attrs.visible.value !== "false";
77543   }
77544   function parseComments(comments) {
77545     var parsedComments = [];
77546     for (var i3 = 0; i3 < comments.length; i3++) {
77547       var comment = comments[i3];
77548       if (comment.nodeName === "comment") {
77549         var childNodes = comment.childNodes;
77550         var parsedComment = {};
77551         for (var j3 = 0; j3 < childNodes.length; j3++) {
77552           var node = childNodes[j3];
77553           var nodeName = node.nodeName;
77554           if (nodeName === "#text")
77555             continue;
77556           parsedComment[nodeName] = node.textContent;
77557           if (nodeName === "uid") {
77558             var uid = node.textContent;
77559             if (uid && !_userCache.user[uid]) {
77560               _userCache.toLoad[uid] = true;
77561             }
77562           }
77563         }
77564         if (parsedComment) {
77565           parsedComments.push(parsedComment);
77566         }
77567       }
77568     }
77569     return parsedComments;
77570   }
77571   function encodeNoteRtree(note) {
77572     return {
77573       minX: note.loc[0],
77574       minY: note.loc[1],
77575       maxX: note.loc[0],
77576       maxY: note.loc[1],
77577       data: note
77578     };
77579   }
77580   var jsonparsers = {
77581     node: function nodeData(obj, uid) {
77582       return new osmNode({
77583         id: uid,
77584         visible: typeof obj.visible === "boolean" ? obj.visible : true,
77585         version: obj.version && obj.version.toString(),
77586         changeset: obj.changeset && obj.changeset.toString(),
77587         timestamp: obj.timestamp,
77588         user: obj.user,
77589         uid: obj.uid && obj.uid.toString(),
77590         loc: [Number(obj.lon), Number(obj.lat)],
77591         tags: obj.tags
77592       });
77593     },
77594     way: function wayData(obj, uid) {
77595       return new osmWay({
77596         id: uid,
77597         visible: typeof obj.visible === "boolean" ? obj.visible : true,
77598         version: obj.version && obj.version.toString(),
77599         changeset: obj.changeset && obj.changeset.toString(),
77600         timestamp: obj.timestamp,
77601         user: obj.user,
77602         uid: obj.uid && obj.uid.toString(),
77603         tags: obj.tags,
77604         nodes: getNodesJSON(obj)
77605       });
77606     },
77607     relation: function relationData(obj, uid) {
77608       return new osmRelation({
77609         id: uid,
77610         visible: typeof obj.visible === "boolean" ? obj.visible : true,
77611         version: obj.version && obj.version.toString(),
77612         changeset: obj.changeset && obj.changeset.toString(),
77613         timestamp: obj.timestamp,
77614         user: obj.user,
77615         uid: obj.uid && obj.uid.toString(),
77616         tags: obj.tags,
77617         members: getMembersJSON(obj)
77618       });
77619     },
77620     user: function parseUser(obj, uid) {
77621       return {
77622         id: uid,
77623         display_name: obj.display_name,
77624         account_created: obj.account_created,
77625         image_url: obj.img && obj.img.href,
77626         changesets_count: obj.changesets && obj.changesets.count && obj.changesets.count.toString() || "0",
77627         active_blocks: obj.blocks && obj.blocks.received && obj.blocks.received.active && obj.blocks.received.active.toString() || "0"
77628       };
77629     }
77630   };
77631   function parseJSON(payload, callback, options2) {
77632     options2 = Object.assign({ skipSeen: true }, options2);
77633     if (!payload) {
77634       return callback({ message: "No JSON", status: -1 });
77635     }
77636     var json = payload;
77637     if (typeof json !== "object")
77638       json = JSON.parse(payload);
77639     if (!json.elements)
77640       return callback({ message: "No JSON", status: -1 });
77641     var children2 = json.elements;
77642     var handle = window.requestIdleCallback(function() {
77643       _deferred.delete(handle);
77644       var results = [];
77645       var result;
77646       for (var i3 = 0; i3 < children2.length; i3++) {
77647         result = parseChild(children2[i3]);
77648         if (result)
77649           results.push(result);
77650       }
77651       callback(null, results);
77652     });
77653     _deferred.add(handle);
77654     function parseChild(child) {
77655       var parser3 = jsonparsers[child.type];
77656       if (!parser3)
77657         return null;
77658       var uid;
77659       uid = osmEntity.id.fromOSM(child.type, child.id);
77660       if (options2.skipSeen) {
77661         if (_tileCache.seen[uid])
77662           return null;
77663         _tileCache.seen[uid] = true;
77664       }
77665       return parser3(child, uid);
77666     }
77667   }
77668   function parseUserJSON(payload, callback, options2) {
77669     options2 = Object.assign({ skipSeen: true }, options2);
77670     if (!payload) {
77671       return callback({ message: "No JSON", status: -1 });
77672     }
77673     var json = payload;
77674     if (typeof json !== "object")
77675       json = JSON.parse(payload);
77676     if (!json.users && !json.user)
77677       return callback({ message: "No JSON", status: -1 });
77678     var objs = json.users || [json];
77679     var handle = window.requestIdleCallback(function() {
77680       _deferred.delete(handle);
77681       var results = [];
77682       var result;
77683       for (var i3 = 0; i3 < objs.length; i3++) {
77684         result = parseObj(objs[i3]);
77685         if (result)
77686           results.push(result);
77687       }
77688       callback(null, results);
77689     });
77690     _deferred.add(handle);
77691     function parseObj(obj) {
77692       var uid = obj.user.id && obj.user.id.toString();
77693       if (options2.skipSeen && _userCache.user[uid]) {
77694         delete _userCache.toLoad[uid];
77695         return null;
77696       }
77697       var user = jsonparsers.user(obj.user, uid);
77698       _userCache.user[uid] = user;
77699       delete _userCache.toLoad[uid];
77700       return user;
77701     }
77702   }
77703   var parsers = {
77704     node: function nodeData2(obj, uid) {
77705       var attrs = obj.attributes;
77706       return new osmNode({
77707         id: uid,
77708         visible: getVisible(attrs),
77709         version: attrs.version.value,
77710         changeset: attrs.changeset && attrs.changeset.value,
77711         timestamp: attrs.timestamp && attrs.timestamp.value,
77712         user: attrs.user && attrs.user.value,
77713         uid: attrs.uid && attrs.uid.value,
77714         loc: getLoc(attrs),
77715         tags: getTags(obj)
77716       });
77717     },
77718     way: function wayData2(obj, uid) {
77719       var attrs = obj.attributes;
77720       return new osmWay({
77721         id: uid,
77722         visible: getVisible(attrs),
77723         version: attrs.version.value,
77724         changeset: attrs.changeset && attrs.changeset.value,
77725         timestamp: attrs.timestamp && attrs.timestamp.value,
77726         user: attrs.user && attrs.user.value,
77727         uid: attrs.uid && attrs.uid.value,
77728         tags: getTags(obj),
77729         nodes: getNodes(obj)
77730       });
77731     },
77732     relation: function relationData2(obj, uid) {
77733       var attrs = obj.attributes;
77734       return new osmRelation({
77735         id: uid,
77736         visible: getVisible(attrs),
77737         version: attrs.version.value,
77738         changeset: attrs.changeset && attrs.changeset.value,
77739         timestamp: attrs.timestamp && attrs.timestamp.value,
77740         user: attrs.user && attrs.user.value,
77741         uid: attrs.uid && attrs.uid.value,
77742         tags: getTags(obj),
77743         members: getMembers(obj)
77744       });
77745     },
77746     note: function parseNote(obj, uid) {
77747       var attrs = obj.attributes;
77748       var childNodes = obj.childNodes;
77749       var props = {};
77750       props.id = uid;
77751       props.loc = getLoc(attrs);
77752       var coincident = false;
77753       var epsilon3 = 1e-5;
77754       do {
77755         if (coincident) {
77756           props.loc = geoVecAdd(props.loc, [epsilon3, epsilon3]);
77757         }
77758         var bbox2 = geoExtent(props.loc).bbox();
77759         coincident = _noteCache.rtree.search(bbox2).length;
77760       } while (coincident);
77761       for (var i3 = 0; i3 < childNodes.length; i3++) {
77762         var node = childNodes[i3];
77763         var nodeName = node.nodeName;
77764         if (nodeName === "#text")
77765           continue;
77766         if (nodeName === "comments") {
77767           props[nodeName] = parseComments(node.childNodes);
77768         } else {
77769           props[nodeName] = node.textContent;
77770         }
77771       }
77772       var note = new osmNote(props);
77773       var item = encodeNoteRtree(note);
77774       _noteCache.note[note.id] = note;
77775       _noteCache.rtree.insert(item);
77776       return note;
77777     },
77778     user: function parseUser2(obj, uid) {
77779       var attrs = obj.attributes;
77780       var user = {
77781         id: uid,
77782         display_name: attrs.display_name && attrs.display_name.value,
77783         account_created: attrs.account_created && attrs.account_created.value,
77784         changesets_count: "0",
77785         active_blocks: "0"
77786       };
77787       var img = obj.getElementsByTagName("img");
77788       if (img && img[0] && img[0].getAttribute("href")) {
77789         user.image_url = img[0].getAttribute("href");
77790       }
77791       var changesets = obj.getElementsByTagName("changesets");
77792       if (changesets && changesets[0] && changesets[0].getAttribute("count")) {
77793         user.changesets_count = changesets[0].getAttribute("count");
77794       }
77795       var blocks = obj.getElementsByTagName("blocks");
77796       if (blocks && blocks[0]) {
77797         var received = blocks[0].getElementsByTagName("received");
77798         if (received && received[0] && received[0].getAttribute("active")) {
77799           user.active_blocks = received[0].getAttribute("active");
77800         }
77801       }
77802       _userCache.user[uid] = user;
77803       delete _userCache.toLoad[uid];
77804       return user;
77805     }
77806   };
77807   function parseXML(xml, callback, options2) {
77808     options2 = Object.assign({ skipSeen: true }, options2);
77809     if (!xml || !xml.childNodes) {
77810       return callback({ message: "No XML", status: -1 });
77811     }
77812     var root3 = xml.childNodes[0];
77813     var children2 = root3.childNodes;
77814     var handle = window.requestIdleCallback(function() {
77815       _deferred.delete(handle);
77816       var results = [];
77817       var result;
77818       for (var i3 = 0; i3 < children2.length; i3++) {
77819         result = parseChild(children2[i3]);
77820         if (result)
77821           results.push(result);
77822       }
77823       callback(null, results);
77824     });
77825     _deferred.add(handle);
77826     function parseChild(child) {
77827       var parser3 = parsers[child.nodeName];
77828       if (!parser3)
77829         return null;
77830       var uid;
77831       if (child.nodeName === "user") {
77832         uid = child.attributes.id.value;
77833         if (options2.skipSeen && _userCache.user[uid]) {
77834           delete _userCache.toLoad[uid];
77835           return null;
77836         }
77837       } else if (child.nodeName === "note") {
77838         uid = child.getElementsByTagName("id")[0].textContent;
77839       } else {
77840         uid = osmEntity.id.fromOSM(child.nodeName, child.attributes.id.value);
77841         if (options2.skipSeen) {
77842           if (_tileCache.seen[uid])
77843             return null;
77844           _tileCache.seen[uid] = true;
77845         }
77846       }
77847       return parser3(child, uid);
77848     }
77849   }
77850   function updateRtree4(item, replace) {
77851     _noteCache.rtree.remove(item, function isEql(a2, b2) {
77852       return a2.data.id === b2.data.id;
77853     });
77854     if (replace) {
77855       _noteCache.rtree.insert(item);
77856     }
77857   }
77858   function wrapcb(thisArg, callback, cid) {
77859     return function(err, result) {
77860       if (err) {
77861         if (err.status === 400 || err.status === 401 || err.status === 403) {
77862           thisArg.logout();
77863         }
77864         return callback.call(thisArg, err);
77865       } else if (thisArg.getConnectionId() !== cid) {
77866         return callback.call(thisArg, { message: "Connection Switched", status: -1 });
77867       } else {
77868         return callback.call(thisArg, err, result);
77869       }
77870     };
77871   }
77872   var osm_default = {
77873     init: function() {
77874       utilRebind(this, dispatch10, "on");
77875     },
77876     reset: function() {
77877       Array.from(_deferred).forEach(function(handle) {
77878         window.cancelIdleCallback(handle);
77879         _deferred.delete(handle);
77880       });
77881       _connectionID++;
77882       _userChangesets = void 0;
77883       _userDetails = void 0;
77884       _rateLimitError = void 0;
77885       Object.values(_tileCache.inflight).forEach(abortRequest5);
77886       Object.values(_noteCache.inflight).forEach(abortRequest5);
77887       Object.values(_noteCache.inflightPost).forEach(abortRequest5);
77888       if (_changeset.inflight)
77889         abortRequest5(_changeset.inflight);
77890       _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new import_rbush10.default() };
77891       _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new import_rbush10.default() };
77892       _userCache = { toLoad: {}, user: {} };
77893       _cachedApiStatus = void 0;
77894       _changeset = {};
77895       return this;
77896     },
77897     getConnectionId: function() {
77898       return _connectionID;
77899     },
77900     getUrlRoot: function() {
77901       return urlroot;
77902     },
77903     changesetURL: function(changesetID) {
77904       return urlroot + "/changeset/" + changesetID;
77905     },
77906     changesetsURL: function(center, zoom) {
77907       var precision2 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
77908       return urlroot + "/history#map=" + Math.floor(zoom) + "/" + center[1].toFixed(precision2) + "/" + center[0].toFixed(precision2);
77909     },
77910     entityURL: function(entity) {
77911       return urlroot + "/" + entity.type + "/" + entity.osmId();
77912     },
77913     historyURL: function(entity) {
77914       return urlroot + "/" + entity.type + "/" + entity.osmId() + "/history";
77915     },
77916     userURL: function(username) {
77917       return urlroot + "/user/" + encodeURIComponent(username);
77918     },
77919     noteURL: function(note) {
77920       return urlroot + "/note/" + note.id;
77921     },
77922     noteReportURL: function(note) {
77923       return urlroot + "/reports/new?reportable_type=Note&reportable_id=" + note.id;
77924     },
77925     // Generic method to load data from the OSM API
77926     // Can handle either auth or unauth calls.
77927     loadFromAPI: function(path, callback, options2) {
77928       options2 = Object.assign({ skipSeen: true }, options2);
77929       var that = this;
77930       var cid = _connectionID;
77931       function done(err, payload) {
77932         if (that.getConnectionId() !== cid) {
77933           if (callback)
77934             callback({ message: "Connection Switched", status: -1 });
77935           return;
77936         }
77937         var isAuthenticated = that.authenticated();
77938         if (isAuthenticated && err && err.status && (err.status === 400 || err.status === 401 || err.status === 403)) {
77939           that.logout();
77940           that.loadFromAPI(path, callback, options2);
77941         } else {
77942           if (!isAuthenticated && !_rateLimitError && err && err.status && (err.status === 509 || err.status === 429)) {
77943             _rateLimitError = err;
77944             dispatch10.call("change");
77945             that.reloadApiStatus();
77946           } else if (err && _cachedApiStatus === "online" || !err && _cachedApiStatus !== "online") {
77947             that.reloadApiStatus();
77948           }
77949           if (callback) {
77950             if (err) {
77951               return callback(err);
77952             } else {
77953               if (path.indexOf(".json") !== -1) {
77954                 return parseJSON(payload, callback, options2);
77955               } else {
77956                 return parseXML(payload, callback, options2);
77957               }
77958             }
77959           }
77960         }
77961       }
77962       if (this.authenticated()) {
77963         return oauth.xhr({ method: "GET", path }, done);
77964       } else {
77965         var url = urlroot + path;
77966         var controller = new AbortController();
77967         var fn;
77968         if (path.indexOf(".json") !== -1) {
77969           fn = json_default;
77970         } else {
77971           fn = xml_default;
77972         }
77973         fn(url, { signal: controller.signal }).then(function(data) {
77974           done(null, data);
77975         }).catch(function(err) {
77976           if (err.name === "AbortError")
77977             return;
77978           var match = err.message.match(/^\d{3}/);
77979           if (match) {
77980             done({ status: +match[0], statusText: err.message });
77981           } else {
77982             done(err.message);
77983           }
77984         });
77985         return controller;
77986       }
77987     },
77988     // Load a single entity by id (ways and relations use the `/full` call to include
77989     // nodes and members). Parent relations are not included, see `loadEntityRelations`.
77990     // GET /api/0.6/node/#id
77991     // GET /api/0.6/[way|relation]/#id/full
77992     loadEntity: function(id2, callback) {
77993       var type2 = osmEntity.id.type(id2);
77994       var osmID = osmEntity.id.toOSM(id2);
77995       var options2 = { skipSeen: false };
77996       this.loadFromAPI(
77997         "/api/0.6/" + type2 + "/" + osmID + (type2 !== "node" ? "/full" : "") + ".json",
77998         function(err, entities) {
77999           if (callback)
78000             callback(err, { data: entities });
78001         },
78002         options2
78003       );
78004     },
78005     // Load a single entity with a specific version
78006     // GET /api/0.6/[node|way|relation]/#id/#version
78007     loadEntityVersion: function(id2, version, callback) {
78008       var type2 = osmEntity.id.type(id2);
78009       var osmID = osmEntity.id.toOSM(id2);
78010       var options2 = { skipSeen: false };
78011       this.loadFromAPI(
78012         "/api/0.6/" + type2 + "/" + osmID + "/" + version + ".json",
78013         function(err, entities) {
78014           if (callback)
78015             callback(err, { data: entities });
78016         },
78017         options2
78018       );
78019     },
78020     // Load the relations of a single entity with the given.
78021     // GET /api/0.6/[node|way|relation]/#id/relations
78022     loadEntityRelations: function(id2, callback) {
78023       var type2 = osmEntity.id.type(id2);
78024       var osmID = osmEntity.id.toOSM(id2);
78025       var options2 = { skipSeen: false };
78026       this.loadFromAPI(
78027         "/api/0.6/" + type2 + "/" + osmID + "/relations.json",
78028         function(err, entities) {
78029           if (callback)
78030             callback(err, { data: entities });
78031         },
78032         options2
78033       );
78034     },
78035     // Load multiple entities in chunks
78036     // (note: callback may be called multiple times)
78037     // Unlike `loadEntity`, child nodes and members are not fetched
78038     // GET /api/0.6/[nodes|ways|relations]?#parameters
78039     loadMultiple: function(ids, callback) {
78040       var that = this;
78041       var groups = utilArrayGroupBy(utilArrayUniq(ids), osmEntity.id.type);
78042       Object.keys(groups).forEach(function(k2) {
78043         var type2 = k2 + "s";
78044         var osmIDs = groups[k2].map(function(id2) {
78045           return osmEntity.id.toOSM(id2);
78046         });
78047         var options2 = { skipSeen: false };
78048         utilArrayChunk(osmIDs, 150).forEach(function(arr) {
78049           that.loadFromAPI(
78050             "/api/0.6/" + type2 + ".json?" + type2 + "=" + arr.join(),
78051             function(err, entities) {
78052               if (callback)
78053                 callback(err, { data: entities });
78054             },
78055             options2
78056           );
78057         });
78058       });
78059     },
78060     // Create, upload, and close a changeset
78061     // PUT /api/0.6/changeset/create
78062     // POST /api/0.6/changeset/#id/upload
78063     // PUT /api/0.6/changeset/#id/close
78064     putChangeset: function(changeset, changes, callback) {
78065       var cid = _connectionID;
78066       if (_changeset.inflight) {
78067         return callback({ message: "Changeset already inflight", status: -2 }, changeset);
78068       } else if (_changeset.open) {
78069         return createdChangeset.call(this, null, _changeset.open);
78070       } else {
78071         var options2 = {
78072           method: "PUT",
78073           path: "/api/0.6/changeset/create",
78074           headers: { "Content-Type": "text/xml" },
78075           content: JXON.stringify(changeset.asJXON())
78076         };
78077         _changeset.inflight = oauth.xhr(
78078           options2,
78079           wrapcb(this, createdChangeset, cid)
78080         );
78081       }
78082       function createdChangeset(err, changesetID) {
78083         _changeset.inflight = null;
78084         if (err) {
78085           return callback(err, changeset);
78086         }
78087         _changeset.open = changesetID;
78088         changeset = changeset.update({ id: changesetID });
78089         var options3 = {
78090           method: "POST",
78091           path: "/api/0.6/changeset/" + changesetID + "/upload",
78092           headers: { "Content-Type": "text/xml" },
78093           content: JXON.stringify(changeset.osmChangeJXON(changes))
78094         };
78095         _changeset.inflight = oauth.xhr(
78096           options3,
78097           wrapcb(this, uploadedChangeset, cid)
78098         );
78099       }
78100       function uploadedChangeset(err) {
78101         _changeset.inflight = null;
78102         if (err)
78103           return callback(err, changeset);
78104         window.setTimeout(function() {
78105           callback(null, changeset);
78106         }, 2500);
78107         _changeset.open = null;
78108         if (this.getConnectionId() === cid) {
78109           oauth.xhr({
78110             method: "PUT",
78111             path: "/api/0.6/changeset/" + changeset.id + "/close",
78112             headers: { "Content-Type": "text/xml" }
78113           }, function() {
78114             return true;
78115           });
78116         }
78117       }
78118     },
78119     // Load multiple users in chunks
78120     // (note: callback may be called multiple times)
78121     // GET /api/0.6/users?users=#id1,#id2,...,#idn
78122     loadUsers: function(uids, callback) {
78123       var toLoad = [];
78124       var cached = [];
78125       utilArrayUniq(uids).forEach(function(uid) {
78126         if (_userCache.user[uid]) {
78127           delete _userCache.toLoad[uid];
78128           cached.push(_userCache.user[uid]);
78129         } else {
78130           toLoad.push(uid);
78131         }
78132       });
78133       if (cached.length || !this.authenticated()) {
78134         callback(void 0, cached);
78135         if (!this.authenticated())
78136           return;
78137       }
78138       utilArrayChunk(toLoad, 150).forEach(function(arr) {
78139         oauth.xhr(
78140           { method: "GET", path: "/api/0.6/users.json?users=" + arr.join() },
78141           wrapcb(this, done, _connectionID)
78142         );
78143       }.bind(this));
78144       function done(err, payload) {
78145         if (err)
78146           return callback(err);
78147         var options2 = { skipSeen: true };
78148         return parseUserJSON(payload, function(err2, results) {
78149           if (err2)
78150             return callback(err2);
78151           return callback(void 0, results);
78152         }, options2);
78153       }
78154     },
78155     // Load a given user by id
78156     // GET /api/0.6/user/#id
78157     loadUser: function(uid, callback) {
78158       if (_userCache.user[uid] || !this.authenticated()) {
78159         delete _userCache.toLoad[uid];
78160         return callback(void 0, _userCache.user[uid]);
78161       }
78162       oauth.xhr(
78163         { method: "GET", path: "/api/0.6/user/" + uid + ".json" },
78164         wrapcb(this, done, _connectionID)
78165       );
78166       function done(err, payload) {
78167         if (err)
78168           return callback(err);
78169         var options2 = { skipSeen: true };
78170         return parseUserJSON(payload, function(err2, results) {
78171           if (err2)
78172             return callback(err2);
78173           return callback(void 0, results[0]);
78174         }, options2);
78175       }
78176     },
78177     // Load the details of the logged-in user
78178     // GET /api/0.6/user/details
78179     userDetails: function(callback) {
78180       if (_userDetails) {
78181         return callback(void 0, _userDetails);
78182       }
78183       oauth.xhr(
78184         { method: "GET", path: "/api/0.6/user/details.json" },
78185         wrapcb(this, done, _connectionID)
78186       );
78187       function done(err, payload) {
78188         if (err)
78189           return callback(err);
78190         var options2 = { skipSeen: false };
78191         return parseUserJSON(payload, function(err2, results) {
78192           if (err2)
78193             return callback(err2);
78194           _userDetails = results[0];
78195           return callback(void 0, _userDetails);
78196         }, options2);
78197       }
78198     },
78199     // Load previous changesets for the logged in user
78200     // GET /api/0.6/changesets?user=#id
78201     userChangesets: function(callback) {
78202       if (_userChangesets) {
78203         return callback(void 0, _userChangesets);
78204       }
78205       this.userDetails(
78206         wrapcb(this, gotDetails, _connectionID)
78207       );
78208       function gotDetails(err, user) {
78209         if (err) {
78210           return callback(err);
78211         }
78212         oauth.xhr(
78213           { method: "GET", path: "/api/0.6/changesets?user=" + user.id },
78214           wrapcb(this, done, _connectionID)
78215         );
78216       }
78217       function done(err, xml) {
78218         if (err) {
78219           return callback(err);
78220         }
78221         _userChangesets = Array.prototype.map.call(
78222           xml.getElementsByTagName("changeset"),
78223           function(changeset) {
78224             return { tags: getTags(changeset) };
78225           }
78226         ).filter(function(changeset) {
78227           var comment = changeset.tags.comment;
78228           return comment && comment !== "";
78229         });
78230         return callback(void 0, _userChangesets);
78231       }
78232     },
78233     // Fetch the status of the OSM API
78234     // GET /api/capabilities
78235     status: function(callback) {
78236       var url = urlroot + "/api/capabilities";
78237       var errback = wrapcb(this, done, _connectionID);
78238       xml_default(url).then(function(data) {
78239         errback(null, data);
78240       }).catch(function(err) {
78241         errback(err.message);
78242       });
78243       function done(err, xml) {
78244         if (err) {
78245           return callback(err, null);
78246         }
78247         var elements = xml.getElementsByTagName("blacklist");
78248         var regexes = [];
78249         for (var i3 = 0; i3 < elements.length; i3++) {
78250           var regexString = elements[i3].getAttribute("regex");
78251           if (regexString) {
78252             try {
78253               var regex = new RegExp(regexString);
78254               regexes.push(regex);
78255             } catch (e3) {
78256             }
78257           }
78258         }
78259         if (regexes.length) {
78260           _imageryBlocklists = regexes;
78261         }
78262         if (_rateLimitError) {
78263           return callback(_rateLimitError, "rateLimited");
78264         } else {
78265           var waynodes = xml.getElementsByTagName("waynodes");
78266           var maxWayNodes = waynodes.length && parseInt(waynodes[0].getAttribute("maximum"), 10);
78267           if (maxWayNodes && isFinite(maxWayNodes))
78268             _maxWayNodes = maxWayNodes;
78269           var apiStatus = xml.getElementsByTagName("status");
78270           var val = apiStatus[0].getAttribute("api");
78271           return callback(void 0, val);
78272         }
78273       }
78274     },
78275     // Calls `status` and dispatches an `apiStatusChange` event if the returned
78276     // status differs from the cached status.
78277     reloadApiStatus: function() {
78278       if (!this.throttledReloadApiStatus) {
78279         var that = this;
78280         this.throttledReloadApiStatus = throttle_default(function() {
78281           that.status(function(err, status) {
78282             if (status !== _cachedApiStatus) {
78283               _cachedApiStatus = status;
78284               dispatch10.call("apiStatusChange", that, err, status);
78285             }
78286           });
78287         }, 500);
78288       }
78289       this.throttledReloadApiStatus();
78290     },
78291     // Returns the maximum number of nodes a single way can have
78292     maxWayNodes: function() {
78293       return _maxWayNodes;
78294     },
78295     // Load data (entities) from the API in tiles
78296     // GET /api/0.6/map?bbox=
78297     loadTiles: function(projection2, callback) {
78298       if (_off)
78299         return;
78300       var tiles = tiler6.zoomExtent([_tileZoom4, _tileZoom4]).getTiles(projection2);
78301       var hadRequests = hasInflightRequests(_tileCache);
78302       abortUnwantedRequests4(_tileCache, tiles);
78303       if (hadRequests && !hasInflightRequests(_tileCache)) {
78304         dispatch10.call("loaded");
78305       }
78306       tiles.forEach(function(tile) {
78307         this.loadTile(tile, callback);
78308       }, this);
78309     },
78310     // Load a single data tile
78311     // GET /api/0.6/map?bbox=
78312     loadTile: function(tile, callback) {
78313       if (_off)
78314         return;
78315       if (_tileCache.loaded[tile.id] || _tileCache.inflight[tile.id])
78316         return;
78317       if (!hasInflightRequests(_tileCache)) {
78318         dispatch10.call("loading");
78319       }
78320       var path = "/api/0.6/map.json?bbox=";
78321       var options2 = { skipSeen: true };
78322       _tileCache.inflight[tile.id] = this.loadFromAPI(
78323         path + tile.extent.toParam(),
78324         tileCallback,
78325         options2
78326       );
78327       function tileCallback(err, parsed) {
78328         delete _tileCache.inflight[tile.id];
78329         if (!err) {
78330           delete _tileCache.toLoad[tile.id];
78331           _tileCache.loaded[tile.id] = true;
78332           var bbox2 = tile.extent.bbox();
78333           bbox2.id = tile.id;
78334           _tileCache.rtree.insert(bbox2);
78335         }
78336         if (callback) {
78337           callback(err, Object.assign({ data: parsed }, tile));
78338         }
78339         if (!hasInflightRequests(_tileCache)) {
78340           dispatch10.call("loaded");
78341         }
78342       }
78343     },
78344     isDataLoaded: function(loc) {
78345       var bbox2 = { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] };
78346       return _tileCache.rtree.collides(bbox2);
78347     },
78348     // load the tile that covers the given `loc`
78349     loadTileAtLoc: function(loc, callback) {
78350       if (Object.keys(_tileCache.toLoad).length > 50)
78351         return;
78352       var k2 = geoZoomToScale(_tileZoom4 + 1);
78353       var offset = geoRawMercator().scale(k2)(loc);
78354       var projection2 = geoRawMercator().transform({ k: k2, x: -offset[0], y: -offset[1] });
78355       var tiles = tiler6.zoomExtent([_tileZoom4, _tileZoom4]).getTiles(projection2);
78356       tiles.forEach(function(tile) {
78357         if (_tileCache.toLoad[tile.id] || _tileCache.loaded[tile.id] || _tileCache.inflight[tile.id])
78358           return;
78359         _tileCache.toLoad[tile.id] = true;
78360         this.loadTile(tile, callback);
78361       }, this);
78362     },
78363     // Load notes from the API in tiles
78364     // GET /api/0.6/notes?bbox=
78365     loadNotes: function(projection2, noteOptions) {
78366       noteOptions = Object.assign({ limit: 1e4, closed: 7 }, noteOptions);
78367       if (_off)
78368         return;
78369       var that = this;
78370       var path = "/api/0.6/notes?limit=" + noteOptions.limit + "&closed=" + noteOptions.closed + "&bbox=";
78371       var throttleLoadUsers = throttle_default(function() {
78372         var uids = Object.keys(_userCache.toLoad);
78373         if (!uids.length)
78374           return;
78375         that.loadUsers(uids, function() {
78376         });
78377       }, 750);
78378       var tiles = tiler6.zoomExtent([_noteZoom, _noteZoom]).getTiles(projection2);
78379       abortUnwantedRequests4(_noteCache, tiles);
78380       tiles.forEach(function(tile) {
78381         if (_noteCache.loaded[tile.id] || _noteCache.inflight[tile.id])
78382           return;
78383         var options2 = { skipSeen: false };
78384         _noteCache.inflight[tile.id] = that.loadFromAPI(
78385           path + tile.extent.toParam(),
78386           function(err) {
78387             delete _noteCache.inflight[tile.id];
78388             if (!err) {
78389               _noteCache.loaded[tile.id] = true;
78390             }
78391             throttleLoadUsers();
78392             dispatch10.call("loadedNotes");
78393           },
78394           options2
78395         );
78396       });
78397     },
78398     // Create a note
78399     // POST /api/0.6/notes?params
78400     postNoteCreate: function(note, callback) {
78401       if (!this.authenticated()) {
78402         return callback({ message: "Not Authenticated", status: -3 }, note);
78403       }
78404       if (_noteCache.inflightPost[note.id]) {
78405         return callback({ message: "Note update already inflight", status: -2 }, note);
78406       }
78407       if (!note.loc[0] || !note.loc[1] || !note.newComment)
78408         return;
78409       var comment = note.newComment;
78410       if (note.newCategory && note.newCategory !== "None") {
78411         comment += " #" + note.newCategory;
78412       }
78413       var path = "/api/0.6/notes?" + utilQsString({ lon: note.loc[0], lat: note.loc[1], text: comment });
78414       _noteCache.inflightPost[note.id] = oauth.xhr(
78415         { method: "POST", path },
78416         wrapcb(this, done, _connectionID)
78417       );
78418       function done(err, xml) {
78419         delete _noteCache.inflightPost[note.id];
78420         if (err) {
78421           return callback(err);
78422         }
78423         this.removeNote(note);
78424         var options2 = { skipSeen: false };
78425         return parseXML(xml, function(err2, results) {
78426           if (err2) {
78427             return callback(err2);
78428           } else {
78429             return callback(void 0, results[0]);
78430           }
78431         }, options2);
78432       }
78433     },
78434     // Update a note
78435     // POST /api/0.6/notes/#id/comment?text=comment
78436     // POST /api/0.6/notes/#id/close?text=comment
78437     // POST /api/0.6/notes/#id/reopen?text=comment
78438     postNoteUpdate: function(note, newStatus, callback) {
78439       if (!this.authenticated()) {
78440         return callback({ message: "Not Authenticated", status: -3 }, note);
78441       }
78442       if (_noteCache.inflightPost[note.id]) {
78443         return callback({ message: "Note update already inflight", status: -2 }, note);
78444       }
78445       var action;
78446       if (note.status !== "closed" && newStatus === "closed") {
78447         action = "close";
78448       } else if (note.status !== "open" && newStatus === "open") {
78449         action = "reopen";
78450       } else {
78451         action = "comment";
78452         if (!note.newComment)
78453           return;
78454       }
78455       var path = "/api/0.6/notes/" + note.id + "/" + action;
78456       if (note.newComment) {
78457         path += "?" + utilQsString({ text: note.newComment });
78458       }
78459       _noteCache.inflightPost[note.id] = oauth.xhr(
78460         { method: "POST", path },
78461         wrapcb(this, done, _connectionID)
78462       );
78463       function done(err, xml) {
78464         delete _noteCache.inflightPost[note.id];
78465         if (err) {
78466           return callback(err);
78467         }
78468         this.removeNote(note);
78469         if (action === "close") {
78470           _noteCache.closed[note.id] = true;
78471         } else if (action === "reopen") {
78472           delete _noteCache.closed[note.id];
78473         }
78474         var options2 = { skipSeen: false };
78475         return parseXML(xml, function(err2, results) {
78476           if (err2) {
78477             return callback(err2);
78478           } else {
78479             return callback(void 0, results[0]);
78480           }
78481         }, options2);
78482       }
78483     },
78484     /* connection options for source switcher (optional) */
78485     apiConnections: function(val) {
78486       if (!arguments.length)
78487         return _apiConnections;
78488       _apiConnections = val;
78489       return this;
78490     },
78491     switch: function(newOptions) {
78492       urlroot = newOptions.url;
78493       var oldOptions = utilObjectOmit(oauth.options(), "access_token");
78494       oauth.options(Object.assign(oldOptions, newOptions));
78495       this.reset();
78496       this.userChangesets(function() {
78497       });
78498       dispatch10.call("change");
78499       return this;
78500     },
78501     toggle: function(val) {
78502       _off = !val;
78503       return this;
78504     },
78505     isChangesetInflight: function() {
78506       return !!_changeset.inflight;
78507     },
78508     // get/set cached data
78509     // This is used to save/restore the state when entering/exiting the walkthrough
78510     // Also used for testing purposes.
78511     caches: function(obj) {
78512       function cloneCache(source) {
78513         var target = {};
78514         Object.keys(source).forEach(function(k2) {
78515           if (k2 === "rtree") {
78516             target.rtree = new import_rbush10.default().fromJSON(source.rtree.toJSON());
78517           } else if (k2 === "note") {
78518             target.note = {};
78519             Object.keys(source.note).forEach(function(id2) {
78520               target.note[id2] = osmNote(source.note[id2]);
78521             });
78522           } else {
78523             target[k2] = JSON.parse(JSON.stringify(source[k2]));
78524           }
78525         });
78526         return target;
78527       }
78528       if (!arguments.length) {
78529         return {
78530           tile: cloneCache(_tileCache),
78531           note: cloneCache(_noteCache),
78532           user: cloneCache(_userCache)
78533         };
78534       }
78535       if (obj === "get") {
78536         return {
78537           tile: _tileCache,
78538           note: _noteCache,
78539           user: _userCache
78540         };
78541       }
78542       if (obj.tile) {
78543         _tileCache = obj.tile;
78544         _tileCache.inflight = {};
78545       }
78546       if (obj.note) {
78547         _noteCache = obj.note;
78548         _noteCache.inflight = {};
78549         _noteCache.inflightPost = {};
78550       }
78551       if (obj.user) {
78552         _userCache = obj.user;
78553       }
78554       return this;
78555     },
78556     logout: function() {
78557       _userChangesets = void 0;
78558       _userDetails = void 0;
78559       oauth.logout();
78560       dispatch10.call("change");
78561       return this;
78562     },
78563     authenticated: function() {
78564       return oauth.authenticated();
78565     },
78566     authenticate: function(callback) {
78567       var that = this;
78568       var cid = _connectionID;
78569       _userChangesets = void 0;
78570       _userDetails = void 0;
78571       function done(err, res) {
78572         if (err) {
78573           if (callback)
78574             callback(err);
78575           return;
78576         }
78577         if (that.getConnectionId() !== cid) {
78578           if (callback)
78579             callback({ message: "Connection Switched", status: -1 });
78580           return;
78581         }
78582         _rateLimitError = void 0;
78583         dispatch10.call("change");
78584         if (callback)
78585           callback(err, res);
78586         that.userChangesets(function() {
78587         });
78588       }
78589       oauth.authenticate(done);
78590     },
78591     imageryBlocklists: function() {
78592       return _imageryBlocklists;
78593     },
78594     tileZoom: function(val) {
78595       if (!arguments.length)
78596         return _tileZoom4;
78597       _tileZoom4 = val;
78598       return this;
78599     },
78600     // get all cached notes covering the viewport
78601     notes: function(projection2) {
78602       var viewport = projection2.clipExtent();
78603       var min3 = [viewport[0][0], viewport[1][1]];
78604       var max3 = [viewport[1][0], viewport[0][1]];
78605       var bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
78606       return _noteCache.rtree.search(bbox2).map(function(d2) {
78607         return d2.data;
78608       });
78609     },
78610     // get a single note from the cache
78611     getNote: function(id2) {
78612       return _noteCache.note[id2];
78613     },
78614     // remove a single note from the cache
78615     removeNote: function(note) {
78616       if (!(note instanceof osmNote) || !note.id)
78617         return;
78618       delete _noteCache.note[note.id];
78619       updateRtree4(encodeNoteRtree(note), false);
78620     },
78621     // replace a single note in the cache
78622     replaceNote: function(note) {
78623       if (!(note instanceof osmNote) || !note.id)
78624         return;
78625       _noteCache.note[note.id] = note;
78626       updateRtree4(encodeNoteRtree(note), true);
78627       return note;
78628     },
78629     // Get an array of note IDs closed during this session.
78630     // Used to populate `closed:note` changeset tag
78631     getClosedIDs: function() {
78632       return Object.keys(_noteCache.closed).sort();
78633     }
78634   };
78635
78636   // modules/services/osm_wikibase.js
78637   var apibase3 = "https://wiki.openstreetmap.org/w/api.php";
78638   var _inflight2 = {};
78639   var _wikibaseCache = {};
78640   var _localeIDs = { en: false };
78641   var debouncedRequest = debounce_default(request, 500, { leading: false });
78642   function request(url, callback) {
78643     if (_inflight2[url])
78644       return;
78645     var controller = new AbortController();
78646     _inflight2[url] = controller;
78647     json_default(url, { signal: controller.signal }).then(function(result) {
78648       delete _inflight2[url];
78649       if (callback)
78650         callback(null, result);
78651     }).catch(function(err) {
78652       delete _inflight2[url];
78653       if (err.name === "AbortError")
78654         return;
78655       if (callback)
78656         callback(err.message);
78657     });
78658   }
78659   var osm_wikibase_default = {
78660     init: function() {
78661       _inflight2 = {};
78662       _wikibaseCache = {};
78663       _localeIDs = {};
78664     },
78665     reset: function() {
78666       Object.values(_inflight2).forEach(function(controller) {
78667         controller.abort();
78668       });
78669       _inflight2 = {};
78670     },
78671     /**
78672      * Get the best value for the property, or undefined if not found
78673      * @param entity object from wikibase
78674      * @param property string e.g. 'P4' for image
78675      * @param langCode string e.g. 'fr' for French
78676      */
78677     claimToValue: function(entity, property, langCode) {
78678       if (!entity.claims[property])
78679         return void 0;
78680       var locale2 = _localeIDs[langCode];
78681       var preferredPick, localePick;
78682       entity.claims[property].forEach(function(stmt) {
78683         if (!preferredPick && stmt.rank === "preferred") {
78684           preferredPick = stmt;
78685         }
78686         if (locale2 && stmt.qualifiers && stmt.qualifiers.P26 && stmt.qualifiers.P26[0].datavalue.value.id === locale2) {
78687           localePick = stmt;
78688         }
78689       });
78690       var result = localePick || preferredPick;
78691       if (result) {
78692         var datavalue = result.mainsnak.datavalue;
78693         return datavalue.type === "wikibase-entityid" ? datavalue.value.id : datavalue.value;
78694       } else {
78695         return void 0;
78696       }
78697     },
78698     /**
78699      * Convert monolingual property into a key-value object (language -> value)
78700      * @param entity object from wikibase
78701      * @param property string e.g. 'P31' for monolingual wiki page title
78702      */
78703     monolingualClaimToValueObj: function(entity, property) {
78704       if (!entity || !entity.claims[property])
78705         return void 0;
78706       return entity.claims[property].reduce(function(acc, obj) {
78707         var value = obj.mainsnak.datavalue.value;
78708         acc[value.language] = value.text;
78709         return acc;
78710       }, {});
78711     },
78712     toSitelink: function(key, value) {
78713       var result = value ? "Tag:" + key + "=" + value : "Key:" + key;
78714       return result.replace(/_/g, " ").trim();
78715     },
78716     //
78717     // Pass params object of the form:
78718     // {
78719     //   key: 'string',
78720     //   value: 'string',
78721     //   langCode: 'string'
78722     // }
78723     //
78724     getEntity: function(params, callback) {
78725       var doRequest = params.debounce ? debouncedRequest : request;
78726       var that = this;
78727       var titles = [];
78728       var result = {};
78729       var rtypeSitelink = params.key === "type" && params.value ? ("Relation:" + params.value).replace(/_/g, " ").trim() : false;
78730       var keySitelink = params.key ? this.toSitelink(params.key) : false;
78731       var tagSitelink = params.key && params.value ? this.toSitelink(params.key, params.value) : false;
78732       var localeSitelink;
78733       if (params.langCodes) {
78734         params.langCodes.forEach(function(langCode) {
78735           if (_localeIDs[langCode] === void 0) {
78736             localeSitelink = ("Locale:" + langCode).replace(/_/g, " ").trim();
78737             titles.push(localeSitelink);
78738           }
78739         });
78740       }
78741       if (rtypeSitelink) {
78742         if (_wikibaseCache[rtypeSitelink]) {
78743           result.rtype = _wikibaseCache[rtypeSitelink];
78744         } else {
78745           titles.push(rtypeSitelink);
78746         }
78747       }
78748       if (keySitelink) {
78749         if (_wikibaseCache[keySitelink]) {
78750           result.key = _wikibaseCache[keySitelink];
78751         } else {
78752           titles.push(keySitelink);
78753         }
78754       }
78755       if (tagSitelink) {
78756         if (_wikibaseCache[tagSitelink]) {
78757           result.tag = _wikibaseCache[tagSitelink];
78758         } else {
78759           titles.push(tagSitelink);
78760         }
78761       }
78762       if (!titles.length) {
78763         return callback(null, result);
78764       }
78765       var obj = {
78766         action: "wbgetentities",
78767         sites: "wiki",
78768         titles: titles.join("|"),
78769         languages: params.langCodes.join("|"),
78770         languagefallback: 1,
78771         origin: "*",
78772         format: "json"
78773         // There is an MW Wikibase API bug https://phabricator.wikimedia.org/T212069
78774         // We shouldn't use v1 until it gets fixed, but should switch to it afterwards
78775         // formatversion: 2,
78776       };
78777       var url = apibase3 + "?" + utilQsString(obj);
78778       doRequest(url, function(err, d2) {
78779         if (err) {
78780           callback(err);
78781         } else if (!d2.success || d2.error) {
78782           callback(d2.error.messages.map(function(v2) {
78783             return v2.html["*"];
78784           }).join("<br>"));
78785         } else {
78786           var localeID = false;
78787           Object.values(d2.entities).forEach(function(res) {
78788             if (res.missing !== "") {
78789               var title = res.sitelinks.wiki.title;
78790               if (title === rtypeSitelink) {
78791                 _wikibaseCache[rtypeSitelink] = res;
78792                 result.rtype = res;
78793               } else if (title === keySitelink) {
78794                 _wikibaseCache[keySitelink] = res;
78795                 result.key = res;
78796               } else if (title === tagSitelink) {
78797                 _wikibaseCache[tagSitelink] = res;
78798                 result.tag = res;
78799               } else if (title === localeSitelink) {
78800                 localeID = res.id;
78801               } else {
78802                 console.log("Unexpected title " + title);
78803               }
78804             }
78805           });
78806           if (localeSitelink) {
78807             that.addLocale(params.langCodes[0], localeID);
78808           }
78809           callback(null, result);
78810         }
78811       });
78812     },
78813     //
78814     // Pass params object of the form:
78815     // {
78816     //   key: 'string',     // required
78817     //   value: 'string'    // optional
78818     // }
78819     //
78820     // Get an result object used to display tag documentation
78821     // {
78822     //   title:        'string',
78823     //   description:  'string',
78824     //   editURL:      'string',
78825     //   imageURL:     'string',
78826     //   wiki:         { title: 'string', text: 'string', url: 'string' }
78827     // }
78828     //
78829     getDocs: function(params, callback) {
78830       var that = this;
78831       var langCodes = _mainLocalizer.localeCodes().map(function(code) {
78832         return code.toLowerCase();
78833       });
78834       params.langCodes = langCodes;
78835       this.getEntity(params, function(err, data) {
78836         if (err) {
78837           callback(err);
78838           return;
78839         }
78840         var entity = data.rtype || data.tag || data.key;
78841         if (!entity) {
78842           callback("No entity");
78843           return;
78844         }
78845         var i3;
78846         var description;
78847         for (i3 in langCodes) {
78848           let code2 = langCodes[i3];
78849           if (entity.descriptions[code2] && entity.descriptions[code2].language === code2) {
78850             description = entity.descriptions[code2];
78851             break;
78852           }
78853         }
78854         if (!description && Object.values(entity.descriptions).length)
78855           description = Object.values(entity.descriptions)[0];
78856         var result = {
78857           title: entity.title,
78858           description: description ? description.value : "",
78859           descriptionLocaleCode: description ? description.language : "",
78860           editURL: "https://wiki.openstreetmap.org/wiki/" + entity.title
78861         };
78862         if (entity.claims) {
78863           var imageroot;
78864           var image = that.claimToValue(entity, "P4", langCodes[0]);
78865           if (image) {
78866             imageroot = "https://commons.wikimedia.org/w/index.php";
78867           } else {
78868             image = that.claimToValue(entity, "P28", langCodes[0]);
78869             if (image) {
78870               imageroot = "https://wiki.openstreetmap.org/w/index.php";
78871             }
78872           }
78873           if (imageroot && image) {
78874             result.imageURL = imageroot + "?" + utilQsString({
78875               title: "Special:Redirect/file/" + image,
78876               width: 400
78877             });
78878           }
78879         }
78880         var rtypeWiki = that.monolingualClaimToValueObj(data.rtype, "P31");
78881         var tagWiki = that.monolingualClaimToValueObj(data.tag, "P31");
78882         var keyWiki = that.monolingualClaimToValueObj(data.key, "P31");
78883         var wikis = [rtypeWiki, tagWiki, keyWiki];
78884         for (i3 in wikis) {
78885           var wiki = wikis[i3];
78886           for (var j3 in langCodes) {
78887             var code = langCodes[j3];
78888             var referenceId = langCodes[0].split("-")[0] !== "en" && code.split("-")[0] === "en" ? "inspector.wiki_en_reference" : "inspector.wiki_reference";
78889             var info = getWikiInfo(wiki, code, referenceId);
78890             if (info) {
78891               result.wiki = info;
78892               break;
78893             }
78894           }
78895           if (result.wiki)
78896             break;
78897         }
78898         callback(null, result);
78899         function getWikiInfo(wiki2, langCode, tKey) {
78900           if (wiki2 && wiki2[langCode]) {
78901             return {
78902               title: wiki2[langCode],
78903               text: tKey,
78904               url: "https://wiki.openstreetmap.org/wiki/" + wiki2[langCode]
78905             };
78906           }
78907         }
78908       });
78909     },
78910     addLocale: function(langCode, qid) {
78911       _localeIDs[langCode] = qid;
78912     },
78913     apibase: function(val) {
78914       if (!arguments.length)
78915         return apibase3;
78916       apibase3 = val;
78917       return this;
78918     }
78919   };
78920
78921   // modules/services/streetside.js
78922   var import_rbush11 = __toESM(require_rbush_min());
78923
78924   // modules/util/jsonp_request.js
78925   var jsonpCache = {};
78926   window.jsonpCache = jsonpCache;
78927   function jsonpRequest(url, callback) {
78928     var request3 = {
78929       abort: function() {
78930       }
78931     };
78932     if (window.JSONP_FIX) {
78933       if (window.JSONP_DELAY === 0) {
78934         callback(window.JSONP_FIX);
78935       } else {
78936         var t2 = window.setTimeout(function() {
78937           callback(window.JSONP_FIX);
78938         }, window.JSONP_DELAY || 0);
78939         request3.abort = function() {
78940           window.clearTimeout(t2);
78941         };
78942       }
78943       return request3;
78944     }
78945     function rand() {
78946       var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
78947       var c2 = "";
78948       var i3 = -1;
78949       while (++i3 < 15)
78950         c2 += chars.charAt(Math.floor(Math.random() * 52));
78951       return c2;
78952     }
78953     function create2(url2) {
78954       var e3 = url2.match(/callback=(\w+)/);
78955       var c2 = e3 ? e3[1] : rand();
78956       jsonpCache[c2] = function(data) {
78957         if (jsonpCache[c2]) {
78958           callback(data);
78959         }
78960         finalize();
78961       };
78962       function finalize() {
78963         delete jsonpCache[c2];
78964         script.remove();
78965       }
78966       request3.abort = finalize;
78967       return "jsonpCache." + c2;
78968     }
78969     var cb = create2(url);
78970     var script = select_default2("head").append("script").attr("type", "text/javascript").attr("src", url.replace(/(\{|%7B)callback(\}|%7D)/, cb));
78971     return request3;
78972   }
78973
78974   // modules/services/streetside.js
78975   var bubbleApi = "https://dev.virtualearth.net/mapcontrol/HumanScaleServices/GetBubbles.ashx?";
78976   var streetsideImagesApi = "https://t.ssl.ak.tiles.virtualearth.net/tiles/";
78977   var bubbleAppKey = "AuftgJsO0Xs8Ts4M1xZUQJQXJNsvmh3IV8DkNieCiy3tCwCUMq76-WpkrBtNAuEm";
78978   var pannellumViewerCSS2 = "pannellum/pannellum.css";
78979   var pannellumViewerJS2 = "pannellum/pannellum.js";
78980   var maxResults2 = 2e3;
78981   var tileZoom3 = 16.5;
78982   var tiler7 = utilTiler().zoomExtent([tileZoom3, tileZoom3]).skipNullIsland(true);
78983   var dispatch11 = dispatch_default("loadedImages", "viewerChanged");
78984   var minHfov = 10;
78985   var maxHfov = 90;
78986   var defaultHfov = 45;
78987   var _hires = false;
78988   var _resolution = 512;
78989   var _currScene = 0;
78990   var _ssCache;
78991   var _pannellumViewer2;
78992   var _sceneOptions = {
78993     showFullscreenCtrl: false,
78994     autoLoad: true,
78995     compass: true,
78996     yaw: 0,
78997     minHfov,
78998     maxHfov,
78999     hfov: defaultHfov,
79000     type: "cubemap",
79001     cubeMap: []
79002   };
79003   var _loadViewerPromise4;
79004   function abortRequest6(i3) {
79005     i3.abort();
79006   }
79007   function localeTimestamp2(s2) {
79008     if (!s2)
79009       return null;
79010     const options2 = { day: "numeric", month: "short", year: "numeric" };
79011     const d2 = new Date(s2);
79012     if (isNaN(d2.getTime()))
79013       return null;
79014     return d2.toLocaleString(_mainLocalizer.localeCode(), options2);
79015   }
79016   function loadTiles3(which, url, projection2, margin) {
79017     const tiles = tiler7.margin(margin).getTiles(projection2);
79018     const cache = _ssCache[which];
79019     Object.keys(cache.inflight).forEach((k2) => {
79020       const wanted = tiles.find((tile) => k2.indexOf(tile.id + ",") === 0);
79021       if (!wanted) {
79022         abortRequest6(cache.inflight[k2]);
79023         delete cache.inflight[k2];
79024       }
79025     });
79026     tiles.forEach((tile) => loadNextTilePage2(which, url, tile));
79027   }
79028   function loadNextTilePage2(which, url, tile) {
79029     const cache = _ssCache[which];
79030     const nextPage = cache.nextPage[tile.id] || 0;
79031     const id2 = tile.id + "," + String(nextPage);
79032     if (cache.loaded[id2] || cache.inflight[id2])
79033       return;
79034     cache.inflight[id2] = getBubbles(url, tile, (bubbles) => {
79035       cache.loaded[id2] = true;
79036       delete cache.inflight[id2];
79037       if (!bubbles)
79038         return;
79039       bubbles.shift();
79040       const features = bubbles.map((bubble) => {
79041         if (cache.points[bubble.id])
79042           return null;
79043         const loc = [bubble.lo, bubble.la];
79044         const d2 = {
79045           loc,
79046           key: bubble.id,
79047           ca: bubble.he,
79048           captured_at: bubble.cd,
79049           captured_by: "microsoft",
79050           // nbn: bubble.nbn,
79051           // pbn: bubble.pbn,
79052           // ad: bubble.ad,
79053           // rn: bubble.rn,
79054           pr: bubble.pr,
79055           // previous
79056           ne: bubble.ne,
79057           // next
79058           pano: true,
79059           sequenceKey: null
79060         };
79061         cache.points[bubble.id] = d2;
79062         if (bubble.pr === void 0) {
79063           cache.leaders.push(bubble.id);
79064         }
79065         return {
79066           minX: loc[0],
79067           minY: loc[1],
79068           maxX: loc[0],
79069           maxY: loc[1],
79070           data: d2
79071         };
79072       }).filter(Boolean);
79073       cache.rtree.load(features);
79074       connectSequences();
79075       if (which === "bubbles") {
79076         dispatch11.call("loadedImages");
79077       }
79078     });
79079   }
79080   function connectSequences() {
79081     let cache = _ssCache.bubbles;
79082     let keepLeaders = [];
79083     for (let i3 = 0; i3 < cache.leaders.length; i3++) {
79084       let bubble = cache.points[cache.leaders[i3]];
79085       let seen = {};
79086       let sequence = { key: bubble.key, bubbles: [] };
79087       let complete = false;
79088       do {
79089         sequence.bubbles.push(bubble);
79090         seen[bubble.key] = true;
79091         if (bubble.ne === void 0) {
79092           complete = true;
79093         } else {
79094           bubble = cache.points[bubble.ne];
79095         }
79096       } while (bubble && !seen[bubble.key] && !complete);
79097       if (complete) {
79098         _ssCache.sequences[sequence.key] = sequence;
79099         for (let j3 = 0; j3 < sequence.bubbles.length; j3++) {
79100           sequence.bubbles[j3].sequenceKey = sequence.key;
79101         }
79102         sequence.geojson = {
79103           type: "LineString",
79104           properties: {
79105             captured_at: sequence.bubbles[0] ? sequence.bubbles[0].captured_at : null,
79106             captured_by: sequence.bubbles[0] ? sequence.bubbles[0].captured_by : null,
79107             key: sequence.key
79108           },
79109           coordinates: sequence.bubbles.map((d2) => d2.loc)
79110         };
79111       } else {
79112         keepLeaders.push(cache.leaders[i3]);
79113       }
79114     }
79115     cache.leaders = keepLeaders;
79116   }
79117   function getBubbles(url, tile, callback) {
79118     let rect = tile.extent.rectangle();
79119     let urlForRequest = url + utilQsString({
79120       n: rect[3],
79121       s: rect[1],
79122       e: rect[2],
79123       w: rect[0],
79124       c: maxResults2,
79125       appkey: bubbleAppKey,
79126       jsCallback: "{callback}"
79127     });
79128     return jsonpRequest(urlForRequest, (data) => {
79129       if (!data || data.error) {
79130         callback(null);
79131       } else {
79132         callback(data);
79133       }
79134     });
79135   }
79136   function partitionViewport4(projection2) {
79137     let z2 = geoScaleToZoom(projection2.scale());
79138     let z22 = Math.ceil(z2 * 2) / 2 + 2.5;
79139     let tiler9 = utilTiler().zoomExtent([z22, z22]);
79140     return tiler9.getTiles(projection2).map((tile) => tile.extent);
79141   }
79142   function searchLimited4(limit, projection2, rtree) {
79143     limit = limit || 5;
79144     return partitionViewport4(projection2).reduce((result, extent) => {
79145       let found = rtree.search(extent.bbox()).slice(0, limit).map((d2) => d2.data);
79146       return found.length ? result.concat(found) : result;
79147     }, []);
79148   }
79149   function loadImage2(imgInfo) {
79150     return new Promise((resolve) => {
79151       let img = new Image();
79152       img.onload = () => {
79153         let canvas = document.getElementById("ideditor-canvas" + imgInfo.face);
79154         let ctx = canvas.getContext("2d");
79155         ctx.drawImage(img, imgInfo.x, imgInfo.y);
79156         resolve({ imgInfo, status: "ok" });
79157       };
79158       img.onerror = () => {
79159         resolve({ data: imgInfo, status: "error" });
79160       };
79161       img.setAttribute("crossorigin", "");
79162       img.src = imgInfo.url;
79163     });
79164   }
79165   function loadCanvas(imageGroup) {
79166     return Promise.all(imageGroup.map(loadImage2)).then((data) => {
79167       let canvas = document.getElementById("ideditor-canvas" + data[0].imgInfo.face);
79168       const which = { "01": 0, "02": 1, "03": 2, "10": 3, "11": 4, "12": 5 };
79169       let face = data[0].imgInfo.face;
79170       _sceneOptions.cubeMap[which[face]] = canvas.toDataURL("image/jpeg", 1);
79171       return { status: "loadCanvas for face " + data[0].imgInfo.face + "ok" };
79172     });
79173   }
79174   function loadFaces(faceGroup) {
79175     return Promise.all(faceGroup.map(loadCanvas)).then(() => {
79176       return { status: "loadFaces done" };
79177     });
79178   }
79179   function setupCanvas(selection2, reset) {
79180     if (reset) {
79181       selection2.selectAll("#ideditor-stitcher-canvases").remove();
79182     }
79183     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);
79184   }
79185   function qkToXY(qk) {
79186     let x2 = 0;
79187     let y2 = 0;
79188     let scale = 256;
79189     for (let i3 = qk.length; i3 > 0; i3--) {
79190       const key = qk[i3 - 1];
79191       x2 += +(key === "1" || key === "3") * scale;
79192       y2 += +(key === "2" || key === "3") * scale;
79193       scale *= 2;
79194     }
79195     return [x2, y2];
79196   }
79197   function getQuadKeys() {
79198     let dim = _resolution / 256;
79199     let quadKeys;
79200     if (dim === 16) {
79201       quadKeys = [
79202         "0000",
79203         "0001",
79204         "0010",
79205         "0011",
79206         "0100",
79207         "0101",
79208         "0110",
79209         "0111",
79210         "1000",
79211         "1001",
79212         "1010",
79213         "1011",
79214         "1100",
79215         "1101",
79216         "1110",
79217         "1111",
79218         "0002",
79219         "0003",
79220         "0012",
79221         "0013",
79222         "0102",
79223         "0103",
79224         "0112",
79225         "0113",
79226         "1002",
79227         "1003",
79228         "1012",
79229         "1013",
79230         "1102",
79231         "1103",
79232         "1112",
79233         "1113",
79234         "0020",
79235         "0021",
79236         "0030",
79237         "0031",
79238         "0120",
79239         "0121",
79240         "0130",
79241         "0131",
79242         "1020",
79243         "1021",
79244         "1030",
79245         "1031",
79246         "1120",
79247         "1121",
79248         "1130",
79249         "1131",
79250         "0022",
79251         "0023",
79252         "0032",
79253         "0033",
79254         "0122",
79255         "0123",
79256         "0132",
79257         "0133",
79258         "1022",
79259         "1023",
79260         "1032",
79261         "1033",
79262         "1122",
79263         "1123",
79264         "1132",
79265         "1133",
79266         "0200",
79267         "0201",
79268         "0210",
79269         "0211",
79270         "0300",
79271         "0301",
79272         "0310",
79273         "0311",
79274         "1200",
79275         "1201",
79276         "1210",
79277         "1211",
79278         "1300",
79279         "1301",
79280         "1310",
79281         "1311",
79282         "0202",
79283         "0203",
79284         "0212",
79285         "0213",
79286         "0302",
79287         "0303",
79288         "0312",
79289         "0313",
79290         "1202",
79291         "1203",
79292         "1212",
79293         "1213",
79294         "1302",
79295         "1303",
79296         "1312",
79297         "1313",
79298         "0220",
79299         "0221",
79300         "0230",
79301         "0231",
79302         "0320",
79303         "0321",
79304         "0330",
79305         "0331",
79306         "1220",
79307         "1221",
79308         "1230",
79309         "1231",
79310         "1320",
79311         "1321",
79312         "1330",
79313         "1331",
79314         "0222",
79315         "0223",
79316         "0232",
79317         "0233",
79318         "0322",
79319         "0323",
79320         "0332",
79321         "0333",
79322         "1222",
79323         "1223",
79324         "1232",
79325         "1233",
79326         "1322",
79327         "1323",
79328         "1332",
79329         "1333",
79330         "2000",
79331         "2001",
79332         "2010",
79333         "2011",
79334         "2100",
79335         "2101",
79336         "2110",
79337         "2111",
79338         "3000",
79339         "3001",
79340         "3010",
79341         "3011",
79342         "3100",
79343         "3101",
79344         "3110",
79345         "3111",
79346         "2002",
79347         "2003",
79348         "2012",
79349         "2013",
79350         "2102",
79351         "2103",
79352         "2112",
79353         "2113",
79354         "3002",
79355         "3003",
79356         "3012",
79357         "3013",
79358         "3102",
79359         "3103",
79360         "3112",
79361         "3113",
79362         "2020",
79363         "2021",
79364         "2030",
79365         "2031",
79366         "2120",
79367         "2121",
79368         "2130",
79369         "2131",
79370         "3020",
79371         "3021",
79372         "3030",
79373         "3031",
79374         "3120",
79375         "3121",
79376         "3130",
79377         "3131",
79378         "2022",
79379         "2023",
79380         "2032",
79381         "2033",
79382         "2122",
79383         "2123",
79384         "2132",
79385         "2133",
79386         "3022",
79387         "3023",
79388         "3032",
79389         "3033",
79390         "3122",
79391         "3123",
79392         "3132",
79393         "3133",
79394         "2200",
79395         "2201",
79396         "2210",
79397         "2211",
79398         "2300",
79399         "2301",
79400         "2310",
79401         "2311",
79402         "3200",
79403         "3201",
79404         "3210",
79405         "3211",
79406         "3300",
79407         "3301",
79408         "3310",
79409         "3311",
79410         "2202",
79411         "2203",
79412         "2212",
79413         "2213",
79414         "2302",
79415         "2303",
79416         "2312",
79417         "2313",
79418         "3202",
79419         "3203",
79420         "3212",
79421         "3213",
79422         "3302",
79423         "3303",
79424         "3312",
79425         "3313",
79426         "2220",
79427         "2221",
79428         "2230",
79429         "2231",
79430         "2320",
79431         "2321",
79432         "2330",
79433         "2331",
79434         "3220",
79435         "3221",
79436         "3230",
79437         "3231",
79438         "3320",
79439         "3321",
79440         "3330",
79441         "3331",
79442         "2222",
79443         "2223",
79444         "2232",
79445         "2233",
79446         "2322",
79447         "2323",
79448         "2332",
79449         "2333",
79450         "3222",
79451         "3223",
79452         "3232",
79453         "3233",
79454         "3322",
79455         "3323",
79456         "3332",
79457         "3333"
79458       ];
79459     } else if (dim === 8) {
79460       quadKeys = [
79461         "000",
79462         "001",
79463         "010",
79464         "011",
79465         "100",
79466         "101",
79467         "110",
79468         "111",
79469         "002",
79470         "003",
79471         "012",
79472         "013",
79473         "102",
79474         "103",
79475         "112",
79476         "113",
79477         "020",
79478         "021",
79479         "030",
79480         "031",
79481         "120",
79482         "121",
79483         "130",
79484         "131",
79485         "022",
79486         "023",
79487         "032",
79488         "033",
79489         "122",
79490         "123",
79491         "132",
79492         "133",
79493         "200",
79494         "201",
79495         "210",
79496         "211",
79497         "300",
79498         "301",
79499         "310",
79500         "311",
79501         "202",
79502         "203",
79503         "212",
79504         "213",
79505         "302",
79506         "303",
79507         "312",
79508         "313",
79509         "220",
79510         "221",
79511         "230",
79512         "231",
79513         "320",
79514         "321",
79515         "330",
79516         "331",
79517         "222",
79518         "223",
79519         "232",
79520         "233",
79521         "322",
79522         "323",
79523         "332",
79524         "333"
79525       ];
79526     } else if (dim === 4) {
79527       quadKeys = [
79528         "00",
79529         "01",
79530         "10",
79531         "11",
79532         "02",
79533         "03",
79534         "12",
79535         "13",
79536         "20",
79537         "21",
79538         "30",
79539         "31",
79540         "22",
79541         "23",
79542         "32",
79543         "33"
79544       ];
79545     } else {
79546       quadKeys = [
79547         "0",
79548         "1",
79549         "2",
79550         "3"
79551       ];
79552     }
79553     return quadKeys;
79554   }
79555   var streetside_default = {
79556     /**
79557      * init() initialize streetside.
79558      */
79559     init: function() {
79560       if (!_ssCache) {
79561         this.reset();
79562       }
79563       this.event = utilRebind(this, dispatch11, "on");
79564     },
79565     /**
79566      * reset() reset the cache.
79567      */
79568     reset: function() {
79569       if (_ssCache) {
79570         Object.values(_ssCache.bubbles.inflight).forEach(abortRequest6);
79571       }
79572       _ssCache = {
79573         bubbles: { inflight: {}, loaded: {}, nextPage: {}, rtree: new import_rbush11.default(), points: {}, leaders: [] },
79574         sequences: {}
79575       };
79576     },
79577     /**
79578      * bubbles()
79579      */
79580     bubbles: function(projection2) {
79581       const limit = 5;
79582       return searchLimited4(limit, projection2, _ssCache.bubbles.rtree);
79583     },
79584     cachedImage: function(imageKey) {
79585       return _ssCache.bubbles.points[imageKey];
79586     },
79587     sequences: function(projection2) {
79588       const viewport = projection2.clipExtent();
79589       const min3 = [viewport[0][0], viewport[1][1]];
79590       const max3 = [viewport[1][0], viewport[0][1]];
79591       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
79592       let seen = {};
79593       let results = [];
79594       _ssCache.bubbles.rtree.search(bbox2).forEach((d2) => {
79595         const key = d2.data.sequenceKey;
79596         if (key && !seen[key]) {
79597           seen[key] = true;
79598           results.push(_ssCache.sequences[key].geojson);
79599         }
79600       });
79601       return results;
79602     },
79603     /**
79604      * loadBubbles()
79605      */
79606     loadBubbles: function(projection2, margin) {
79607       if (margin === void 0)
79608         margin = 2;
79609       loadTiles3("bubbles", bubbleApi, projection2, margin);
79610     },
79611     viewer: function() {
79612       return _pannellumViewer2;
79613     },
79614     initViewer: function() {
79615       if (!window.pannellum)
79616         return;
79617       if (_pannellumViewer2)
79618         return;
79619       _currScene += 1;
79620       const sceneID = _currScene.toString();
79621       const options2 = {
79622         "default": { firstScene: sceneID },
79623         scenes: {}
79624       };
79625       options2.scenes[sceneID] = _sceneOptions;
79626       _pannellumViewer2 = window.pannellum.viewer("ideditor-viewer-streetside", options2);
79627     },
79628     ensureViewerLoaded: function(context) {
79629       if (_loadViewerPromise4)
79630         return _loadViewerPromise4;
79631       let wrap2 = context.container().select(".photoviewer").selectAll(".ms-wrapper").data([0]);
79632       let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper ms-wrapper").classed("hide", true);
79633       let that = this;
79634       let pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
79635       wrapEnter.append("div").attr("id", "ideditor-viewer-streetside").on(pointerPrefix + "down.streetside", () => {
79636         select_default2(window).on(pointerPrefix + "move.streetside", () => {
79637           dispatch11.call("viewerChanged");
79638         }, true);
79639       }).on(pointerPrefix + "up.streetside pointercancel.streetside", () => {
79640         select_default2(window).on(pointerPrefix + "move.streetside", null);
79641         let t2 = timer((elapsed) => {
79642           dispatch11.call("viewerChanged");
79643           if (elapsed > 2e3) {
79644             t2.stop();
79645           }
79646         });
79647       }).append("div").attr("class", "photo-attribution fillD");
79648       let controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
79649       controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
79650       controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
79651       wrap2 = wrap2.merge(wrapEnter).call(setupCanvas, true);
79652       context.ui().photoviewer.on("resize.streetside", () => {
79653         if (_pannellumViewer2) {
79654           _pannellumViewer2.resize();
79655         }
79656       });
79657       _loadViewerPromise4 = new Promise((resolve, reject) => {
79658         let loadedCount = 0;
79659         function loaded() {
79660           loadedCount += 1;
79661           if (loadedCount === 2)
79662             resolve();
79663         }
79664         const head = select_default2("head");
79665         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() {
79666           reject();
79667         });
79668         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() {
79669           reject();
79670         });
79671       }).catch(function() {
79672         _loadViewerPromise4 = null;
79673       });
79674       return _loadViewerPromise4;
79675       function step(stepBy) {
79676         return () => {
79677           let viewer = context.container().select(".photoviewer");
79678           let selected = viewer.empty() ? void 0 : viewer.datum();
79679           if (!selected)
79680             return;
79681           let nextID = stepBy === 1 ? selected.ne : selected.pr;
79682           let yaw = _pannellumViewer2.getYaw();
79683           let ca = selected.ca + yaw;
79684           let origin = selected.loc;
79685           const meters = 35;
79686           let p1 = [
79687             origin[0] + geoMetersToLon(meters / 5, origin[1]),
79688             origin[1]
79689           ];
79690           let p2 = [
79691             origin[0] + geoMetersToLon(meters / 2, origin[1]),
79692             origin[1] + geoMetersToLat(meters)
79693           ];
79694           let p3 = [
79695             origin[0] - geoMetersToLon(meters / 2, origin[1]),
79696             origin[1] + geoMetersToLat(meters)
79697           ];
79698           let p4 = [
79699             origin[0] - geoMetersToLon(meters / 5, origin[1]),
79700             origin[1]
79701           ];
79702           let poly = [p1, p2, p3, p4, p1];
79703           let angle2 = (stepBy === 1 ? ca : ca + 180) * (Math.PI / 180);
79704           poly = geoRotate(poly, -angle2, origin);
79705           let extent = poly.reduce((extent2, point2) => {
79706             return extent2.extend(geoExtent(point2));
79707           }, geoExtent());
79708           let minDist = Infinity;
79709           _ssCache.bubbles.rtree.search(extent.bbox()).forEach((d2) => {
79710             if (d2.data.key === selected.key)
79711               return;
79712             if (!geoPointInPolygon(d2.data.loc, poly))
79713               return;
79714             let dist = geoVecLength(d2.data.loc, selected.loc);
79715             let theta = selected.ca - d2.data.ca;
79716             let minTheta = Math.min(Math.abs(theta), 360 - Math.abs(theta));
79717             if (minTheta > 20) {
79718               dist += 5;
79719             }
79720             if (dist < minDist) {
79721               nextID = d2.data.key;
79722               minDist = dist;
79723             }
79724           });
79725           let nextBubble = nextID && that.cachedImage(nextID);
79726           if (!nextBubble)
79727             return;
79728           context.map().centerEase(nextBubble.loc);
79729           that.selectImage(context, nextBubble.key).yaw(yaw).showViewer(context);
79730         };
79731       }
79732     },
79733     yaw: function(yaw) {
79734       if (typeof yaw !== "number")
79735         return yaw;
79736       _sceneOptions.yaw = yaw;
79737       return this;
79738     },
79739     /**
79740      * showViewer()
79741      */
79742     showViewer: function(context) {
79743       let wrap2 = context.container().select(".photoviewer").classed("hide", false);
79744       let isHidden = wrap2.selectAll(".photo-wrapper.ms-wrapper.hide").size();
79745       if (isHidden) {
79746         wrap2.selectAll(".photo-wrapper:not(.ms-wrapper)").classed("hide", true);
79747         wrap2.selectAll(".photo-wrapper.ms-wrapper").classed("hide", false);
79748       }
79749       return this;
79750     },
79751     /**
79752      * hideViewer()
79753      */
79754     hideViewer: function(context) {
79755       let viewer = context.container().select(".photoviewer");
79756       if (!viewer.empty())
79757         viewer.datum(null);
79758       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
79759       context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
79760       this.updateUrlImage(null);
79761       return this.setStyles(context, null, true);
79762     },
79763     /**
79764      * selectImage().
79765      */
79766     selectImage: function(context, key) {
79767       let that = this;
79768       let d2 = this.cachedImage(key);
79769       let viewer = context.container().select(".photoviewer");
79770       if (!viewer.empty())
79771         viewer.datum(d2);
79772       this.setStyles(context, null, true);
79773       let wrap2 = context.container().select(".photoviewer .ms-wrapper");
79774       let attribution = wrap2.selectAll(".photo-attribution").html("");
79775       wrap2.selectAll(".pnlm-load-box").style("display", "block");
79776       if (!d2)
79777         return this;
79778       this.updateUrlImage(key);
79779       _sceneOptions.northOffset = d2.ca;
79780       let line1 = attribution.append("div").attr("class", "attribution-row");
79781       const hiresDomId = utilUniqueDomId("streetside-hires");
79782       let label = line1.append("label").attr("for", hiresDomId).attr("class", "streetside-hires");
79783       label.append("input").attr("type", "checkbox").attr("id", hiresDomId).property("checked", _hires).on("click", (d3_event) => {
79784         d3_event.stopPropagation();
79785         _hires = !_hires;
79786         _resolution = _hires ? 1024 : 512;
79787         wrap2.call(setupCanvas, true);
79788         let viewstate = {
79789           yaw: _pannellumViewer2.getYaw(),
79790           pitch: _pannellumViewer2.getPitch(),
79791           hfov: _pannellumViewer2.getHfov()
79792         };
79793         _sceneOptions = Object.assign(_sceneOptions, viewstate);
79794         that.selectImage(context, d2.key).showViewer(context);
79795       });
79796       label.append("span").call(_t.append("streetside.hires"));
79797       let captureInfo = line1.append("div").attr("class", "attribution-capture-info");
79798       if (d2.captured_by) {
79799         const yyyy = (/* @__PURE__ */ new Date()).getFullYear();
79800         captureInfo.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://www.microsoft.com/en-us/maps/streetside").text("\xA9" + yyyy + " Microsoft");
79801         captureInfo.append("span").text("|");
79802       }
79803       if (d2.captured_at) {
79804         captureInfo.append("span").attr("class", "captured_at").text(localeTimestamp2(d2.captured_at));
79805       }
79806       let line2 = attribution.append("div").attr("class", "attribution-row");
79807       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"));
79808       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"));
79809       let bubbleIdQuadKey = d2.key.toString(4);
79810       const paddingNeeded = 16 - bubbleIdQuadKey.length;
79811       for (let i3 = 0; i3 < paddingNeeded; i3++) {
79812         bubbleIdQuadKey = "0" + bubbleIdQuadKey;
79813       }
79814       const imgUrlPrefix = streetsideImagesApi + "hs" + bubbleIdQuadKey;
79815       const imgUrlSuffix = ".jpg?g=13515&n=z";
79816       const faceKeys = ["01", "02", "03", "10", "11", "12"];
79817       let quadKeys = getQuadKeys();
79818       let faces = faceKeys.map((faceKey) => {
79819         return quadKeys.map((quadKey) => {
79820           const xy = qkToXY(quadKey);
79821           return {
79822             face: faceKey,
79823             url: imgUrlPrefix + faceKey + quadKey + imgUrlSuffix,
79824             x: xy[0],
79825             y: xy[1]
79826           };
79827         });
79828       });
79829       loadFaces(faces).then(function() {
79830         if (!_pannellumViewer2) {
79831           that.initViewer();
79832         } else {
79833           _currScene += 1;
79834           let sceneID = _currScene.toString();
79835           _pannellumViewer2.addScene(sceneID, _sceneOptions).loadScene(sceneID);
79836           if (_currScene > 2) {
79837             sceneID = (_currScene - 1).toString();
79838             _pannellumViewer2.removeScene(sceneID);
79839           }
79840         }
79841       });
79842       return this;
79843     },
79844     getSequenceKeyForBubble: function(d2) {
79845       return d2 && d2.sequenceKey;
79846     },
79847     // Updates the currently highlighted sequence and selected bubble.
79848     // Reset is only necessary when interacting with the viewport because
79849     // this implicitly changes the currently selected bubble/sequence
79850     setStyles: function(context, hovered, reset) {
79851       if (reset) {
79852         context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
79853         context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
79854       }
79855       let hoveredBubbleKey = hovered && hovered.key;
79856       let hoveredSequenceKey = this.getSequenceKeyForBubble(hovered);
79857       let hoveredSequence = hoveredSequenceKey && _ssCache.sequences[hoveredSequenceKey];
79858       let hoveredBubbleKeys = hoveredSequence && hoveredSequence.bubbles.map((d2) => d2.key) || [];
79859       let viewer = context.container().select(".photoviewer");
79860       let selected = viewer.empty() ? void 0 : viewer.datum();
79861       let selectedBubbleKey = selected && selected.key;
79862       let selectedSequenceKey = this.getSequenceKeyForBubble(selected);
79863       let selectedSequence = selectedSequenceKey && _ssCache.sequences[selectedSequenceKey];
79864       let selectedBubbleKeys = selectedSequence && selectedSequence.bubbles.map((d2) => d2.key) || [];
79865       let highlightedBubbleKeys = utilArrayUnion(hoveredBubbleKeys, selectedBubbleKeys);
79866       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);
79867       context.container().selectAll(".layer-streetside-images .sequence").classed("highlighted", (d2) => d2.properties.key === hoveredSequenceKey).classed("currentView", (d2) => d2.properties.key === selectedSequenceKey);
79868       context.container().selectAll(".layer-streetside-images .viewfield-group .viewfield").attr("d", viewfieldPath);
79869       function viewfieldPath() {
79870         let d2 = this.parentNode.__data__;
79871         if (d2.pano && d2.key !== selectedBubbleKey) {
79872           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
79873         } else {
79874           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
79875         }
79876       }
79877       return this;
79878     },
79879     updateUrlImage: function(imageKey) {
79880       if (!window.mocha) {
79881         var hash = utilStringQs(window.location.hash);
79882         if (imageKey) {
79883           hash.photo = "streetside/" + imageKey;
79884         } else {
79885           delete hash.photo;
79886         }
79887         window.location.replace("#" + utilQsString(hash, true));
79888       }
79889     },
79890     /**
79891      * cache().
79892      */
79893     cache: function() {
79894       return _ssCache;
79895     }
79896   };
79897
79898   // modules/services/taginfo.js
79899   var apibase4 = taginfoApiUrl;
79900   var _inflight3 = {};
79901   var _popularKeys = {};
79902   var _taginfoCache = {};
79903   var tag_sorts = {
79904     point: "count_nodes",
79905     vertex: "count_nodes",
79906     area: "count_ways",
79907     line: "count_ways"
79908   };
79909   var tag_sort_members = {
79910     point: "count_node_members",
79911     vertex: "count_node_members",
79912     area: "count_way_members",
79913     line: "count_way_members",
79914     relation: "count_relation_members"
79915   };
79916   var tag_filters = {
79917     point: "nodes",
79918     vertex: "nodes",
79919     area: "ways",
79920     line: "ways"
79921   };
79922   var tag_members_fractions = {
79923     point: "count_node_members_fraction",
79924     vertex: "count_node_members_fraction",
79925     area: "count_way_members_fraction",
79926     line: "count_way_members_fraction",
79927     relation: "count_relation_members_fraction"
79928   };
79929   function sets(params, n3, o2) {
79930     if (params.geometry && o2[params.geometry]) {
79931       params[n3] = o2[params.geometry];
79932     }
79933     return params;
79934   }
79935   function setFilter(params) {
79936     return sets(params, "filter", tag_filters);
79937   }
79938   function setSort(params) {
79939     return sets(params, "sortname", tag_sorts);
79940   }
79941   function setSortMembers(params) {
79942     return sets(params, "sortname", tag_sort_members);
79943   }
79944   function clean(params) {
79945     return utilObjectOmit(params, ["geometry", "debounce"]);
79946   }
79947   function filterKeys(type2) {
79948     var count_type = type2 ? "count_" + type2 : "count_all";
79949     return function(d2) {
79950       return Number(d2[count_type]) > 2500 || d2.in_wiki;
79951     };
79952   }
79953   function filterMultikeys(prefix) {
79954     return function(d2) {
79955       var re3 = new RegExp("^" + prefix + "(.*)$", "i");
79956       var matches = d2.key.match(re3) || [];
79957       return matches.length === 2 && matches[1].indexOf(":") === -1;
79958     };
79959   }
79960   function filterValues(allowUpperCase) {
79961     return function(d2) {
79962       if (d2.value.match(/[;,]/) !== null)
79963         return false;
79964       if (!allowUpperCase && d2.value.match(/[A-Z*]/) !== null)
79965         return false;
79966       return d2.count > 100 || d2.in_wiki;
79967     };
79968   }
79969   function filterRoles(geometry) {
79970     return function(d2) {
79971       if (d2.role === "")
79972         return false;
79973       if (d2.role.match(/[A-Z*;,]/) !== null)
79974         return false;
79975       return Number(d2[tag_members_fractions[geometry]]) > 0;
79976     };
79977   }
79978   function valKey(d2) {
79979     return {
79980       value: d2.key,
79981       title: d2.key
79982     };
79983   }
79984   function valKeyDescription(d2) {
79985     var obj = {
79986       value: d2.value,
79987       title: d2.description || d2.value
79988     };
79989     return obj;
79990   }
79991   function roleKey(d2) {
79992     return {
79993       value: d2.role,
79994       title: d2.role
79995     };
79996   }
79997   function sortKeys(a2, b2) {
79998     return a2.key.indexOf(":") === -1 && b2.key.indexOf(":") !== -1 ? -1 : a2.key.indexOf(":") !== -1 && b2.key.indexOf(":") === -1 ? 1 : 0;
79999   }
80000   var debouncedRequest2 = debounce_default(request2, 300, { leading: false });
80001   function request2(url, params, exactMatch, callback, loaded) {
80002     if (_inflight3[url])
80003       return;
80004     if (checkCache(url, params, exactMatch, callback))
80005       return;
80006     var controller = new AbortController();
80007     _inflight3[url] = controller;
80008     json_default(url, { signal: controller.signal }).then(function(result) {
80009       delete _inflight3[url];
80010       if (loaded)
80011         loaded(null, result);
80012     }).catch(function(err) {
80013       delete _inflight3[url];
80014       if (err.name === "AbortError")
80015         return;
80016       if (loaded)
80017         loaded(err.message);
80018     });
80019   }
80020   function checkCache(url, params, exactMatch, callback) {
80021     var rp = params.rp || 25;
80022     var testQuery = params.query || "";
80023     var testUrl = url;
80024     do {
80025       var hit = _taginfoCache[testUrl];
80026       if (hit && (url === testUrl || hit.length < rp)) {
80027         callback(null, hit);
80028         return true;
80029       }
80030       if (exactMatch || !testQuery.length)
80031         return false;
80032       testQuery = testQuery.slice(0, -1);
80033       testUrl = url.replace(/&query=(.*?)&/, "&query=" + testQuery + "&");
80034     } while (testQuery.length >= 0);
80035     return false;
80036   }
80037   var taginfo_default = {
80038     init: function() {
80039       _inflight3 = {};
80040       _taginfoCache = {};
80041       _popularKeys = {
80042         // manually exclude some keys – #5377, #7485
80043         postal_code: true,
80044         full_name: true,
80045         loc_name: true,
80046         reg_name: true,
80047         short_name: true,
80048         sorting_name: true,
80049         artist_name: true,
80050         nat_name: true,
80051         long_name: true,
80052         via: true,
80053         "bridge:name": true
80054       };
80055       var params = {
80056         rp: 100,
80057         sortname: "values_all",
80058         sortorder: "desc",
80059         page: 1,
80060         debounce: false,
80061         lang: _mainLocalizer.languageCode()
80062       };
80063       this.keys(params, function(err, data) {
80064         if (err)
80065           return;
80066         data.forEach(function(d2) {
80067           if (d2.value === "opening_hours")
80068             return;
80069           _popularKeys[d2.value] = true;
80070         });
80071       });
80072     },
80073     reset: function() {
80074       Object.values(_inflight3).forEach(function(controller) {
80075         controller.abort();
80076       });
80077       _inflight3 = {};
80078     },
80079     keys: function(params, callback) {
80080       var doRequest = params.debounce ? debouncedRequest2 : request2;
80081       params = clean(setSort(params));
80082       params = Object.assign({
80083         rp: 10,
80084         sortname: "count_all",
80085         sortorder: "desc",
80086         page: 1,
80087         lang: _mainLocalizer.languageCode()
80088       }, params);
80089       var url = apibase4 + "keys/all?" + utilQsString(params);
80090       doRequest(url, params, false, callback, function(err, d2) {
80091         if (err) {
80092           callback(err);
80093         } else {
80094           var f3 = filterKeys(params.filter);
80095           var result = d2.data.filter(f3).sort(sortKeys).map(valKey);
80096           _taginfoCache[url] = result;
80097           callback(null, result);
80098         }
80099       });
80100     },
80101     multikeys: function(params, callback) {
80102       var doRequest = params.debounce ? debouncedRequest2 : request2;
80103       params = clean(setSort(params));
80104       params = Object.assign({
80105         rp: 25,
80106         sortname: "count_all",
80107         sortorder: "desc",
80108         page: 1,
80109         lang: _mainLocalizer.languageCode()
80110       }, params);
80111       var prefix = params.query;
80112       var url = apibase4 + "keys/all?" + utilQsString(params);
80113       doRequest(url, params, true, callback, function(err, d2) {
80114         if (err) {
80115           callback(err);
80116         } else {
80117           var f3 = filterMultikeys(prefix);
80118           var result = d2.data.filter(f3).map(valKey);
80119           _taginfoCache[url] = result;
80120           callback(null, result);
80121         }
80122       });
80123     },
80124     values: function(params, callback) {
80125       var key = params.key;
80126       if (key && _popularKeys[key]) {
80127         callback(null, []);
80128         return;
80129       }
80130       var doRequest = params.debounce ? debouncedRequest2 : request2;
80131       params = clean(setSort(setFilter(params)));
80132       params = Object.assign({
80133         rp: 25,
80134         sortname: "count_all",
80135         sortorder: "desc",
80136         page: 1,
80137         lang: _mainLocalizer.languageCode()
80138       }, params);
80139       var url = apibase4 + "key/values?" + utilQsString(params);
80140       doRequest(url, params, false, callback, function(err, d2) {
80141         if (err) {
80142           callback(err);
80143         } else {
80144           var allowUpperCase = allowUpperCaseTagValues.test(params.key);
80145           var f3 = filterValues(allowUpperCase);
80146           var result = d2.data.filter(f3).map(valKeyDescription);
80147           _taginfoCache[url] = result;
80148           callback(null, result);
80149         }
80150       });
80151     },
80152     roles: function(params, callback) {
80153       var doRequest = params.debounce ? debouncedRequest2 : request2;
80154       var geometry = params.geometry;
80155       params = clean(setSortMembers(params));
80156       params = Object.assign({
80157         rp: 25,
80158         sortname: "count_all_members",
80159         sortorder: "desc",
80160         page: 1,
80161         lang: _mainLocalizer.languageCode()
80162       }, params);
80163       var url = apibase4 + "relation/roles?" + utilQsString(params);
80164       doRequest(url, params, true, callback, function(err, d2) {
80165         if (err) {
80166           callback(err);
80167         } else {
80168           var f3 = filterRoles(geometry);
80169           var result = d2.data.filter(f3).map(roleKey);
80170           _taginfoCache[url] = result;
80171           callback(null, result);
80172         }
80173       });
80174     },
80175     docs: function(params, callback) {
80176       var doRequest = params.debounce ? debouncedRequest2 : request2;
80177       params = clean(setSort(params));
80178       var path = "key/wiki_pages?";
80179       if (params.value) {
80180         path = "tag/wiki_pages?";
80181       } else if (params.rtype) {
80182         path = "relation/wiki_pages?";
80183       }
80184       var url = apibase4 + path + utilQsString(params);
80185       doRequest(url, params, true, callback, function(err, d2) {
80186         if (err) {
80187           callback(err);
80188         } else {
80189           _taginfoCache[url] = d2.data;
80190           callback(null, d2.data);
80191         }
80192       });
80193     },
80194     apibase: function(_2) {
80195       if (!arguments.length)
80196         return apibase4;
80197       apibase4 = _2;
80198       return this;
80199     }
80200   };
80201
80202   // modules/services/vector_tile.js
80203   var import_fast_deep_equal11 = __toESM(require_fast_deep_equal());
80204   var import_fast_json_stable_stringify2 = __toESM(require_fast_json_stable_stringify());
80205   var import_polygon_clipping2 = __toESM(require_polygon_clipping_umd());
80206   var import_pbf2 = __toESM(require_pbf());
80207   var import_vector_tile2 = __toESM(require_vector_tile());
80208   var tiler8 = utilTiler().tileSize(512).margin(1);
80209   var dispatch12 = dispatch_default("loadedData");
80210   var _vtCache;
80211   function abortRequest7(controller) {
80212     controller.abort();
80213   }
80214   function vtToGeoJSON(data, tile, mergeCache) {
80215     var vectorTile = new import_vector_tile2.default.VectorTile(new import_pbf2.default(data));
80216     var layers = Object.keys(vectorTile.layers);
80217     if (!Array.isArray(layers)) {
80218       layers = [layers];
80219     }
80220     var features = [];
80221     layers.forEach(function(layerID) {
80222       var layer = vectorTile.layers[layerID];
80223       if (layer) {
80224         for (var i3 = 0; i3 < layer.length; i3++) {
80225           var feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
80226           var geometry = feature3.geometry;
80227           if (geometry.type === "Polygon") {
80228             geometry.type = "MultiPolygon";
80229             geometry.coordinates = [geometry.coordinates];
80230           }
80231           var isClipped = false;
80232           if (geometry.type === "MultiPolygon") {
80233             var featureClip = bboxClip(feature3, tile.extent.rectangle());
80234             if (!(0, import_fast_deep_equal11.default)(feature3.geometry, featureClip.geometry)) {
80235               isClipped = true;
80236             }
80237             if (!feature3.geometry.coordinates.length)
80238               continue;
80239             if (!feature3.geometry.coordinates[0].length)
80240               continue;
80241           }
80242           var featurehash = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3));
80243           var propertyhash = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3.properties || {}));
80244           feature3.__layerID__ = layerID.replace(/[^_a-zA-Z0-9\-]/g, "_");
80245           feature3.__featurehash__ = featurehash;
80246           feature3.__propertyhash__ = propertyhash;
80247           features.push(feature3);
80248           if (isClipped && geometry.type === "MultiPolygon") {
80249             var merged = mergeCache[propertyhash];
80250             if (merged && merged.length) {
80251               var other = merged[0];
80252               var coords = import_polygon_clipping2.default.union(
80253                 feature3.geometry.coordinates,
80254                 other.geometry.coordinates
80255               );
80256               if (!coords || !coords.length) {
80257                 continue;
80258               }
80259               merged.push(feature3);
80260               for (var j3 = 0; j3 < merged.length; j3++) {
80261                 merged[j3].geometry.coordinates = coords;
80262                 merged[j3].__featurehash__ = featurehash;
80263               }
80264             } else {
80265               mergeCache[propertyhash] = [feature3];
80266             }
80267           }
80268         }
80269       }
80270     });
80271     return features;
80272   }
80273   function loadTile3(source, tile) {
80274     if (source.loaded[tile.id] || source.inflight[tile.id])
80275       return;
80276     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) {
80277       var subdomains = r2.split(",");
80278       return subdomains[(tile.xyz[0] + tile.xyz[1]) % subdomains.length];
80279     });
80280     var controller = new AbortController();
80281     source.inflight[tile.id] = controller;
80282     fetch(url, { signal: controller.signal }).then(function(response) {
80283       if (!response.ok) {
80284         throw new Error(response.status + " " + response.statusText);
80285       }
80286       source.loaded[tile.id] = [];
80287       delete source.inflight[tile.id];
80288       return response.arrayBuffer();
80289     }).then(function(data) {
80290       if (!data) {
80291         throw new Error("No Data");
80292       }
80293       var z2 = tile.xyz[2];
80294       if (!source.canMerge[z2]) {
80295         source.canMerge[z2] = {};
80296       }
80297       source.loaded[tile.id] = vtToGeoJSON(data, tile, source.canMerge[z2]);
80298       dispatch12.call("loadedData");
80299     }).catch(function() {
80300       source.loaded[tile.id] = [];
80301       delete source.inflight[tile.id];
80302     });
80303   }
80304   var vector_tile_default = {
80305     init: function() {
80306       if (!_vtCache) {
80307         this.reset();
80308       }
80309       this.event = utilRebind(this, dispatch12, "on");
80310     },
80311     reset: function() {
80312       for (var sourceID in _vtCache) {
80313         var source = _vtCache[sourceID];
80314         if (source && source.inflight) {
80315           Object.values(source.inflight).forEach(abortRequest7);
80316         }
80317       }
80318       _vtCache = {};
80319     },
80320     addSource: function(sourceID, template) {
80321       _vtCache[sourceID] = { template, inflight: {}, loaded: {}, canMerge: {} };
80322       return _vtCache[sourceID];
80323     },
80324     data: function(sourceID, projection2) {
80325       var source = _vtCache[sourceID];
80326       if (!source)
80327         return [];
80328       var tiles = tiler8.getTiles(projection2);
80329       var seen = {};
80330       var results = [];
80331       for (var i3 = 0; i3 < tiles.length; i3++) {
80332         var features = source.loaded[tiles[i3].id];
80333         if (!features || !features.length)
80334           continue;
80335         for (var j3 = 0; j3 < features.length; j3++) {
80336           var feature3 = features[j3];
80337           var hash = feature3.__featurehash__;
80338           if (seen[hash])
80339             continue;
80340           seen[hash] = true;
80341           results.push(Object.assign({}, feature3));
80342         }
80343       }
80344       return results;
80345     },
80346     loadTiles: function(sourceID, template, projection2) {
80347       var source = _vtCache[sourceID];
80348       if (!source) {
80349         source = this.addSource(sourceID, template);
80350       }
80351       var tiles = tiler8.getTiles(projection2);
80352       Object.keys(source.inflight).forEach(function(k2) {
80353         var wanted = tiles.find(function(tile) {
80354           return k2 === tile.id;
80355         });
80356         if (!wanted) {
80357           abortRequest7(source.inflight[k2]);
80358           delete source.inflight[k2];
80359         }
80360       });
80361       tiles.forEach(function(tile) {
80362         loadTile3(source, tile);
80363       });
80364     },
80365     cache: function() {
80366       return _vtCache;
80367     }
80368   };
80369
80370   // modules/services/wikidata.js
80371   var apibase5 = "https://www.wikidata.org/w/api.php?";
80372   var _wikidataCache = {};
80373   var wikidata_default = {
80374     init: function() {
80375     },
80376     reset: function() {
80377       _wikidataCache = {};
80378     },
80379     // Search for Wikidata items matching the query
80380     itemsForSearchQuery: function(query, callback, language) {
80381       if (!query) {
80382         if (callback)
80383           callback("No query", {});
80384         return;
80385       }
80386       var lang = this.languagesToQuery()[0];
80387       var url = apibase5 + utilQsString({
80388         action: "wbsearchentities",
80389         format: "json",
80390         formatversion: 2,
80391         search: query,
80392         type: "item",
80393         // the language to search
80394         language: language || lang,
80395         // the language for the label and description in the result
80396         uselang: lang,
80397         limit: 10,
80398         origin: "*"
80399       });
80400       json_default(url).then((result) => {
80401         if (result && result.error) {
80402           if (result.error.code === "badvalue" && result.error.info.includes(lang) && !language && lang.includes("-")) {
80403             this.itemsForSearchQuery(query, callback, lang.split("-")[0]);
80404             return;
80405           } else {
80406             throw new Error(result.error);
80407           }
80408         }
80409         if (callback)
80410           callback(null, result.search || {});
80411       }).catch(function(err) {
80412         if (callback)
80413           callback(err.message, {});
80414       });
80415     },
80416     // Given a Wikipedia language and article title,
80417     // return an array of corresponding Wikidata entities.
80418     itemsByTitle: function(lang, title, callback) {
80419       if (!title) {
80420         if (callback)
80421           callback("No title", {});
80422         return;
80423       }
80424       lang = lang || "en";
80425       var url = apibase5 + utilQsString({
80426         action: "wbgetentities",
80427         format: "json",
80428         formatversion: 2,
80429         sites: lang.replace(/-/g, "_") + "wiki",
80430         titles: title,
80431         languages: "en",
80432         // shrink response by filtering to one language
80433         origin: "*"
80434       });
80435       json_default(url).then(function(result) {
80436         if (result && result.error) {
80437           throw new Error(result.error);
80438         }
80439         if (callback)
80440           callback(null, result.entities || {});
80441       }).catch(function(err) {
80442         if (callback)
80443           callback(err.message, {});
80444       });
80445     },
80446     languagesToQuery: function() {
80447       return _mainLocalizer.localeCodes().map(function(code) {
80448         return code.toLowerCase();
80449       }).filter(function(code) {
80450         return code !== "en-us";
80451       });
80452     },
80453     entityByQID: function(qid, callback) {
80454       if (!qid) {
80455         callback("No qid", {});
80456         return;
80457       }
80458       if (_wikidataCache[qid]) {
80459         if (callback)
80460           callback(null, _wikidataCache[qid]);
80461         return;
80462       }
80463       var langs = this.languagesToQuery();
80464       var url = apibase5 + utilQsString({
80465         action: "wbgetentities",
80466         format: "json",
80467         formatversion: 2,
80468         ids: qid,
80469         props: "labels|descriptions|claims|sitelinks",
80470         sitefilter: langs.map(function(d2) {
80471           return d2 + "wiki";
80472         }).join("|"),
80473         languages: langs.join("|"),
80474         languagefallback: 1,
80475         origin: "*"
80476       });
80477       json_default(url).then(function(result) {
80478         if (result && result.error) {
80479           throw new Error(result.error);
80480         }
80481         if (callback)
80482           callback(null, result.entities[qid] || {});
80483       }).catch(function(err) {
80484         if (callback)
80485           callback(err.message, {});
80486       });
80487     },
80488     // Pass `params` object of the form:
80489     // {
80490     //   qid: 'string'      // brand wikidata  (e.g. 'Q37158')
80491     // }
80492     //
80493     // Get an result object used to display tag documentation
80494     // {
80495     //   title:        'string',
80496     //   description:  'string',
80497     //   editURL:      'string',
80498     //   imageURL:     'string',
80499     //   wiki:         { title: 'string', text: 'string', url: 'string' }
80500     // }
80501     //
80502     getDocs: function(params, callback) {
80503       var langs = this.languagesToQuery();
80504       this.entityByQID(params.qid, function(err, entity) {
80505         if (err || !entity) {
80506           callback(err || "No entity");
80507           return;
80508         }
80509         var i3;
80510         var description;
80511         for (i3 in langs) {
80512           let code = langs[i3];
80513           if (entity.descriptions[code] && entity.descriptions[code].language === code) {
80514             description = entity.descriptions[code];
80515             break;
80516           }
80517         }
80518         if (!description && Object.values(entity.descriptions).length)
80519           description = Object.values(entity.descriptions)[0];
80520         var result = {
80521           title: entity.id,
80522           description: description ? description.value : "",
80523           descriptionLocaleCode: description ? description.language : "",
80524           editURL: "https://www.wikidata.org/wiki/" + entity.id
80525         };
80526         if (entity.claims) {
80527           var imageroot = "https://commons.wikimedia.org/w/index.php";
80528           var props = ["P154", "P18"];
80529           var prop, image;
80530           for (i3 = 0; i3 < props.length; i3++) {
80531             prop = entity.claims[props[i3]];
80532             if (prop && Object.keys(prop).length > 0) {
80533               image = prop[Object.keys(prop)[0]].mainsnak.datavalue.value;
80534               if (image) {
80535                 result.imageURL = imageroot + "?" + utilQsString({
80536                   title: "Special:Redirect/file/" + image,
80537                   width: 400
80538                 });
80539                 break;
80540               }
80541             }
80542           }
80543         }
80544         if (entity.sitelinks) {
80545           var englishLocale = _mainLocalizer.languageCode().toLowerCase() === "en";
80546           for (i3 = 0; i3 < langs.length; i3++) {
80547             var w2 = langs[i3] + "wiki";
80548             if (entity.sitelinks[w2]) {
80549               var title = entity.sitelinks[w2].title;
80550               var tKey = "inspector.wiki_reference";
80551               if (!englishLocale && langs[i3] === "en") {
80552                 tKey = "inspector.wiki_en_reference";
80553               }
80554               result.wiki = {
80555                 title,
80556                 text: tKey,
80557                 url: "https://" + langs[i3] + ".wikipedia.org/wiki/" + title.replace(/ /g, "_")
80558               };
80559               break;
80560             }
80561           }
80562         }
80563         callback(null, result);
80564       });
80565     }
80566   };
80567
80568   // modules/services/wikipedia.js
80569   var endpoint = "https://en.wikipedia.org/w/api.php?";
80570   var wikipedia_default = {
80571     init: function() {
80572     },
80573     reset: function() {
80574     },
80575     search: function(lang, query, callback) {
80576       if (!query) {
80577         if (callback)
80578           callback("No Query", []);
80579         return;
80580       }
80581       lang = lang || "en";
80582       var url = endpoint.replace("en", lang) + utilQsString({
80583         action: "query",
80584         list: "search",
80585         srlimit: "10",
80586         srinfo: "suggestion",
80587         format: "json",
80588         origin: "*",
80589         srsearch: query
80590       });
80591       json_default(url).then(function(result) {
80592         if (result && result.error) {
80593           throw new Error(result.error);
80594         } else if (!result || !result.query || !result.query.search) {
80595           throw new Error("No Results");
80596         }
80597         if (callback) {
80598           var titles = result.query.search.map(function(d2) {
80599             return d2.title;
80600           });
80601           callback(null, titles);
80602         }
80603       }).catch(function(err) {
80604         if (callback)
80605           callback(err, []);
80606       });
80607     },
80608     suggestions: function(lang, query, callback) {
80609       if (!query) {
80610         if (callback)
80611           callback("", []);
80612         return;
80613       }
80614       lang = lang || "en";
80615       var url = endpoint.replace("en", lang) + utilQsString({
80616         action: "opensearch",
80617         namespace: 0,
80618         suggest: "",
80619         format: "json",
80620         origin: "*",
80621         search: query
80622       });
80623       json_default(url).then(function(result) {
80624         if (result && result.error) {
80625           throw new Error(result.error);
80626         } else if (!result || result.length < 2) {
80627           throw new Error("No Results");
80628         }
80629         if (callback)
80630           callback(null, result[1] || []);
80631       }).catch(function(err) {
80632         if (callback)
80633           callback(err.message, []);
80634       });
80635     },
80636     translations: function(lang, title, callback) {
80637       if (!title) {
80638         if (callback)
80639           callback("No Title");
80640         return;
80641       }
80642       var url = endpoint.replace("en", lang) + utilQsString({
80643         action: "query",
80644         prop: "langlinks",
80645         format: "json",
80646         origin: "*",
80647         lllimit: 500,
80648         titles: title
80649       });
80650       json_default(url).then(function(result) {
80651         if (result && result.error) {
80652           throw new Error(result.error);
80653         } else if (!result || !result.query || !result.query.pages) {
80654           throw new Error("No Results");
80655         }
80656         if (callback) {
80657           var list = result.query.pages[Object.keys(result.query.pages)[0]];
80658           var translations = {};
80659           if (list && list.langlinks) {
80660             list.langlinks.forEach(function(d2) {
80661               translations[d2.lang] = d2["*"];
80662             });
80663           }
80664           callback(null, translations);
80665         }
80666       }).catch(function(err) {
80667         if (callback)
80668           callback(err.message);
80669       });
80670     }
80671   };
80672
80673   // modules/services/mapilio.js
80674   var import_pbf3 = __toESM(require_pbf());
80675   var import_rbush12 = __toESM(require_rbush_min());
80676   var import_vector_tile3 = __toESM(require_vector_tile());
80677   var apiUrl2 = "https://end.mapilio.com";
80678   var imageBaseUrl = "https://cdn.mapilio.com/im";
80679   var baseTileUrl2 = "https://geo.mapilio.com/geoserver/gwc/service/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&LAYER=mapilio:";
80680   var pointLayer = "map_points";
80681   var lineLayer = "map_roads_line";
80682   var tileStyle = "&STYLE=&TILEMATRIX=EPSG:900913:{z}&TILEMATRIXSET=EPSG:900913&FORMAT=application/vnd.mapbox-vector-tile&TILECOL={x}&TILEROW={y}";
80683   var minZoom3 = 14;
80684   var dispatch13 = dispatch_default("loadedImages", "loadedLines");
80685   var imgZoom3 = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
80686   var pannellumViewerCSS3 = "pannellum/pannellum.css";
80687   var pannellumViewerJS3 = "pannellum/pannellum.js";
80688   var resolution = 1080;
80689   var _mlyActiveImage2;
80690   var _mlyCache2;
80691   var _loadViewerPromise5;
80692   var _pannellumViewer3;
80693   var _mlySceneOptions = {
80694     showFullscreenCtrl: false,
80695     autoLoad: true,
80696     yaw: 0,
80697     minHfov: 10,
80698     maxHfov: 90,
80699     hfov: 60
80700   };
80701   var _currScene2 = 0;
80702   function partitionViewport5(projection2) {
80703     const z2 = geoScaleToZoom(projection2.scale());
80704     const z22 = Math.ceil(z2 * 2) / 2 + 2.5;
80705     const tiler9 = utilTiler().zoomExtent([z22, z22]);
80706     return tiler9.getTiles(projection2).map(function(tile) {
80707       return tile.extent;
80708     });
80709   }
80710   function searchLimited5(limit, projection2, rtree) {
80711     limit = limit || 5;
80712     return partitionViewport5(projection2).reduce(function(result, extent) {
80713       const found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
80714         return d2.data;
80715       });
80716       return found.length ? result.concat(found) : result;
80717     }, []);
80718   }
80719   function loadTiles4(which, url, maxZoom2, projection2) {
80720     const tiler9 = utilTiler().zoomExtent([minZoom3, maxZoom2]).skipNullIsland(true);
80721     const tiles = tiler9.getTiles(projection2);
80722     tiles.forEach(function(tile) {
80723       loadTile4(which, url, tile);
80724     });
80725   }
80726   function loadTile4(which, url, tile) {
80727     const cache = _mlyCache2.requests;
80728     const tileId = `${tile.id}-${which}`;
80729     if (cache.loaded[tileId] || cache.inflight[tileId])
80730       return;
80731     const controller = new AbortController();
80732     cache.inflight[tileId] = controller;
80733     const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
80734     fetch(requestUrl, { signal: controller.signal }).then(function(response) {
80735       if (!response.ok) {
80736         throw new Error(response.status + " " + response.statusText);
80737       }
80738       cache.loaded[tileId] = true;
80739       delete cache.inflight[tileId];
80740       return response.arrayBuffer();
80741     }).then(function(data) {
80742       if (data.byteLength === 0) {
80743         throw new Error("No Data");
80744       }
80745       loadTileDataToCache2(data, tile, which);
80746       if (which === "images") {
80747         dispatch13.call("loadedImages");
80748       } else {
80749         dispatch13.call("loadedLines");
80750       }
80751     }).catch(function(e3) {
80752       if (e3.message === "No Data") {
80753         cache.loaded[tileId] = true;
80754       } else {
80755         console.error(e3);
80756       }
80757     });
80758   }
80759   function loadTileDataToCache2(data, tile) {
80760     const vectorTile = new import_vector_tile3.VectorTile(new import_pbf3.default(data));
80761     let features, cache, layer, i3, feature3, loc, d2;
80762     if (vectorTile.layers.hasOwnProperty(pointLayer)) {
80763       features = [];
80764       cache = _mlyCache2.images;
80765       layer = vectorTile.layers[pointLayer];
80766       for (i3 = 0; i3 < layer.length; i3++) {
80767         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
80768         loc = feature3.geometry.coordinates;
80769         let resolutionArr = feature3.properties.resolution.split("x");
80770         let sourceWidth = Math.max(resolutionArr[0], resolutionArr[1]);
80771         let sourceHeight = Math.min(resolutionArr[0], resolutionArr[1]);
80772         let isPano = sourceWidth % sourceHeight === 0;
80773         d2 = {
80774           loc,
80775           capture_time: feature3.properties.capture_time,
80776           id: feature3.properties.id,
80777           sequence_id: feature3.properties.sequence_uuid,
80778           heading: feature3.properties.heading,
80779           resolution: feature3.properties.resolution,
80780           isPano
80781         };
80782         cache.forImageId[d2.id] = d2;
80783         features.push({
80784           minX: loc[0],
80785           minY: loc[1],
80786           maxX: loc[0],
80787           maxY: loc[1],
80788           data: d2
80789         });
80790       }
80791       if (cache.rtree) {
80792         cache.rtree.load(features);
80793       }
80794     }
80795     if (vectorTile.layers.hasOwnProperty(lineLayer)) {
80796       cache = _mlyCache2.sequences;
80797       layer = vectorTile.layers[lineLayer];
80798       for (i3 = 0; i3 < layer.length; i3++) {
80799         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
80800         if (cache.lineString[feature3.properties.sequence_uuid]) {
80801           cache.lineString[feature3.properties.sequence_uuid].push(feature3);
80802         } else {
80803           cache.lineString[feature3.properties.sequence_uuid] = [feature3];
80804         }
80805       }
80806     }
80807   }
80808   function getImageData(imageId, sequenceId) {
80809     return fetch(apiUrl2 + `/api/sequence-detail?sequence_uuid=${sequenceId}`, { method: "GET" }).then(function(response) {
80810       if (!response.ok) {
80811         throw new Error(response.status + " " + response.statusText);
80812       }
80813       return response.json();
80814     }).then(function(data) {
80815       let index = data.data.findIndex((feature3) => feature3.id === imageId);
80816       const { filename, uploaded_hash } = data.data[index];
80817       _mlySceneOptions.panorama = imageBaseUrl + "/" + uploaded_hash + "/" + filename + "/" + resolution;
80818     });
80819   }
80820   var mapilio_default = {
80821     // Initialize Mapilio
80822     init: function() {
80823       if (!_mlyCache2) {
80824         this.reset();
80825       }
80826       this.event = utilRebind(this, dispatch13, "on");
80827     },
80828     // Reset cache and state
80829     reset: function() {
80830       if (_mlyCache2) {
80831         Object.values(_mlyCache2.requests.inflight).forEach(function(request3) {
80832           request3.abort();
80833         });
80834       }
80835       _mlyCache2 = {
80836         images: { rtree: new import_rbush12.default(), forImageId: {} },
80837         sequences: { rtree: new import_rbush12.default(), lineString: {} },
80838         requests: { loaded: {}, inflight: {} }
80839       };
80840       _mlyActiveImage2 = null;
80841     },
80842     // Get visible images
80843     images: function(projection2) {
80844       const limit = 5;
80845       return searchLimited5(limit, projection2, _mlyCache2.images.rtree);
80846     },
80847     cachedImage: function(imageKey) {
80848       return _mlyCache2.images.forImageId[imageKey];
80849     },
80850     // Load images in the visible area
80851     loadImages: function(projection2) {
80852       let url = baseTileUrl2 + pointLayer + tileStyle;
80853       loadTiles4("images", url, 14, projection2);
80854     },
80855     // Load line in the visible area
80856     loadLines: function(projection2) {
80857       let url = baseTileUrl2 + lineLayer + tileStyle;
80858       loadTiles4("line", url, 14, projection2);
80859     },
80860     // Get visible sequences
80861     sequences: function(projection2) {
80862       const viewport = projection2.clipExtent();
80863       const min3 = [viewport[0][0], viewport[1][1]];
80864       const max3 = [viewport[1][0], viewport[0][1]];
80865       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
80866       const sequenceIds = {};
80867       let lineStrings = [];
80868       _mlyCache2.images.rtree.search(bbox2).forEach(function(d2) {
80869         if (d2.data.sequence_id) {
80870           sequenceIds[d2.data.sequence_id] = true;
80871         }
80872       });
80873       Object.keys(sequenceIds).forEach(function(sequenceId) {
80874         if (_mlyCache2.sequences.lineString[sequenceId]) {
80875           lineStrings = lineStrings.concat(_mlyCache2.sequences.lineString[sequenceId]);
80876         }
80877       });
80878       return lineStrings;
80879     },
80880     // Set the currently visible image
80881     setActiveImage: function(image) {
80882       if (image) {
80883         _mlyActiveImage2 = {
80884           id: image.id,
80885           sequence_id: image.sequence_id
80886         };
80887       } else {
80888         _mlyActiveImage2 = null;
80889       }
80890     },
80891     // Update the currently highlighted sequence and selected bubble.
80892     setStyles: function(context, hovered) {
80893       const hoveredImageId = hovered && hovered.id;
80894       const hoveredSequenceId = hovered && hovered.sequence_id;
80895       const selectedSequenceId = _mlyActiveImage2 && _mlyActiveImage2.sequence_id;
80896       const selectedImageId = _mlyActiveImage2 && _mlyActiveImage2.id;
80897       const markers = context.container().selectAll(".layer-mapilio .viewfield-group");
80898       const sequences = context.container().selectAll(".layer-mapilio .sequence");
80899       markers.classed("highlighted", function(d2) {
80900         return d2.id === hoveredImageId;
80901       }).classed("hovered", function(d2) {
80902         return d2.id === hoveredImageId;
80903       }).classed("currentView", function(d2) {
80904         return d2.id === selectedImageId;
80905       });
80906       sequences.classed("highlighted", function(d2) {
80907         return d2.properties.sequence_uuid === hoveredSequenceId;
80908       }).classed("currentView", function(d2) {
80909         return d2.properties.sequence_uuid === selectedSequenceId;
80910       });
80911       return this;
80912     },
80913     updateUrlImage: function(imageKey) {
80914       if (!window.mocha) {
80915         var hash = utilStringQs(window.location.hash);
80916         if (imageKey) {
80917           hash.photo = "mapilio/" + imageKey;
80918         } else {
80919           delete hash.photo;
80920         }
80921         window.location.replace("#" + utilQsString(hash, true));
80922       }
80923     },
80924     initViewer: function() {
80925       if (!window.pannellum)
80926         return;
80927       if (_pannellumViewer3)
80928         return;
80929       _currScene2 += 1;
80930       const sceneID = _currScene2.toString();
80931       const options2 = {
80932         "default": { firstScene: sceneID },
80933         scenes: {}
80934       };
80935       options2.scenes[sceneID] = _mlySceneOptions;
80936       _pannellumViewer3 = window.pannellum.viewer("ideditor-viewer-mapilio-pnlm", options2);
80937     },
80938     selectImage: function(context, id2) {
80939       let that = this;
80940       let d2 = this.cachedImage(id2);
80941       this.setActiveImage(d2);
80942       this.updateUrlImage(d2.id);
80943       let viewer = context.container().select(".photoviewer");
80944       if (!viewer.empty())
80945         viewer.datum(d2);
80946       this.setStyles(context, null);
80947       if (!d2)
80948         return this;
80949       let wrap2 = context.container().select(".photoviewer .mapilio-wrapper");
80950       let attribution = wrap2.selectAll(".photo-attribution").text("");
80951       if (d2.capture_time) {
80952         attribution.append("span").attr("class", "captured_at").text(localeDateString2(d2.capture_time));
80953         attribution.append("span").text("|");
80954       }
80955       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");
80956       wrap2.transition().duration(100).call(imgZoom3.transform, identity2);
80957       wrap2.selectAll("img").remove();
80958       getImageData(d2.id, d2.sequence_id).then(function() {
80959         if (d2.isPano) {
80960           if (!_pannellumViewer3) {
80961             that.initViewer();
80962           } else {
80963             _currScene2 += 1;
80964             let sceneID = _currScene2.toString();
80965             _pannellumViewer3.addScene(sceneID, _mlySceneOptions).loadScene(sceneID);
80966             if (_currScene2 > 2) {
80967               sceneID = (_currScene2 - 1).toString();
80968               _pannellumViewer3.removeScene(sceneID);
80969             }
80970           }
80971         } else {
80972           that.initOnlyPhoto(context);
80973         }
80974       });
80975       function localeDateString2(s2) {
80976         if (!s2)
80977           return null;
80978         var options2 = { day: "numeric", month: "short", year: "numeric" };
80979         var d4 = new Date(s2);
80980         if (isNaN(d4.getTime()))
80981           return null;
80982         return d4.toLocaleDateString(_mainLocalizer.localeCode(), options2);
80983       }
80984       return this;
80985     },
80986     initOnlyPhoto: function(context) {
80987       if (_pannellumViewer3) {
80988         _pannellumViewer3.destroy();
80989         _pannellumViewer3 = null;
80990       }
80991       let wrap2 = context.container().select("#ideditor-viewer-mapilio-simple");
80992       let imgWrap = wrap2.select("img");
80993       if (!imgWrap.empty()) {
80994         imgWrap.attr("src", _mlySceneOptions.panorama);
80995       } else {
80996         wrap2.append("img").attr("src", _mlySceneOptions.panorama);
80997       }
80998     },
80999     ensureViewerLoaded: function(context) {
81000       let that = this;
81001       let imgWrap = context.container().select("#ideditor-viewer-mapilio-simple > img");
81002       if (!imgWrap.empty()) {
81003         imgWrap.remove();
81004       }
81005       if (_loadViewerPromise5)
81006         return _loadViewerPromise5;
81007       let wrap2 = context.container().select(".photoviewer").selectAll(".mapilio-wrapper").data([0]);
81008       let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper mapilio-wrapper").classed("hide", true).on("dblclick.zoom", null);
81009       wrapEnter.append("div").attr("class", "photo-attribution fillD");
81010       const controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls-mapilio");
81011       controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
81012       controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
81013       wrapEnter.append("div").attr("id", "ideditor-viewer-mapilio-pnlm");
81014       wrapEnter.append("div").attr("id", "ideditor-viewer-mapilio-simple-wrap").call(imgZoom3.on("zoom", zoomPan2)).append("div").attr("id", "ideditor-viewer-mapilio-simple");
81015       context.ui().photoviewer.on("resize.mapilio", () => {
81016         if (_pannellumViewer3) {
81017           _pannellumViewer3.resize();
81018         }
81019       });
81020       _loadViewerPromise5 = new Promise((resolve, reject) => {
81021         let loadedCount = 0;
81022         function loaded() {
81023           loadedCount += 1;
81024           if (loadedCount === 2)
81025             resolve();
81026         }
81027         const head = select_default2("head");
81028         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() {
81029           reject();
81030         });
81031         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() {
81032           reject();
81033         });
81034       }).catch(function() {
81035         _loadViewerPromise5 = null;
81036       });
81037       function step(stepBy) {
81038         return function() {
81039           if (!_mlyActiveImage2)
81040             return;
81041           const imageId = _mlyActiveImage2.id;
81042           const nextIndex = imageId + stepBy;
81043           if (!nextIndex)
81044             return;
81045           const nextImage = _mlyCache2.images.forImageId[nextIndex];
81046           context.map().centerEase(nextImage.loc);
81047           that.selectImage(context, nextImage.id);
81048         };
81049       }
81050       function zoomPan2(d3_event) {
81051         var t2 = d3_event.transform;
81052         context.container().select(".photoviewer #ideditor-viewer-mapilio-simple").call(utilSetTransform, t2.x, t2.y, t2.k);
81053       }
81054       return _loadViewerPromise5;
81055     },
81056     showViewer: function(context) {
81057       let wrap2 = context.container().select(".photoviewer").classed("hide", false);
81058       let isHidden = wrap2.selectAll(".photo-wrapper.mapilio-wrapper.hide").size();
81059       if (isHidden) {
81060         wrap2.selectAll(".photo-wrapper:not(.mapilio-wrapper)").classed("hide", true);
81061         wrap2.selectAll(".photo-wrapper.mapilio-wrapper").classed("hide", false);
81062       }
81063       return this;
81064     },
81065     /**
81066      * hideViewer()
81067      */
81068     hideViewer: function(context) {
81069       let viewer = context.container().select(".photoviewer");
81070       if (!viewer.empty())
81071         viewer.datum(null);
81072       this.updateUrlImage(null);
81073       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
81074       context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
81075       this.setActiveImage();
81076       return this.setStyles(context, null);
81077     },
81078     // Return the current cache
81079     cache: function() {
81080       return _mlyCache2;
81081     }
81082   };
81083
81084   // modules/services/index.js
81085   var services = {
81086     geocoder: nominatim_default,
81087     keepRight: keepRight_default,
81088     improveOSM: improveOSM_default,
81089     osmose: osmose_default,
81090     mapillary: mapillary_default,
81091     nsi: nsi_default,
81092     kartaview: kartaview_default,
81093     vegbilder: vegbilder_default,
81094     osm: osm_default,
81095     osmWikibase: osm_wikibase_default,
81096     maprules: maprules_default,
81097     streetside: streetside_default,
81098     taginfo: taginfo_default,
81099     vectorTile: vector_tile_default,
81100     wikidata: wikidata_default,
81101     wikipedia: wikipedia_default,
81102     mapilio: mapilio_default
81103   };
81104
81105   // modules/modes/drag_note.js
81106   function modeDragNote(context) {
81107     var mode = {
81108       id: "drag-note",
81109       button: "browse"
81110     };
81111     var edit2 = behaviorEdit(context);
81112     var _nudgeInterval;
81113     var _lastLoc;
81114     var _note;
81115     function startNudge(d3_event, nudge) {
81116       if (_nudgeInterval)
81117         window.clearInterval(_nudgeInterval);
81118       _nudgeInterval = window.setInterval(function() {
81119         context.map().pan(nudge);
81120         doMove(d3_event, nudge);
81121       }, 50);
81122     }
81123     function stopNudge() {
81124       if (_nudgeInterval) {
81125         window.clearInterval(_nudgeInterval);
81126         _nudgeInterval = null;
81127       }
81128     }
81129     function origin(note) {
81130       return context.projection(note.loc);
81131     }
81132     function start2(d3_event, note) {
81133       _note = note;
81134       var osm = services.osm;
81135       if (osm) {
81136         _note = osm.getNote(_note.id);
81137       }
81138       context.surface().selectAll(".note-" + _note.id).classed("active", true);
81139       context.perform(actionNoop());
81140       context.enter(mode);
81141       context.selectedNoteID(_note.id);
81142     }
81143     function move(d3_event, entity, point2) {
81144       d3_event.stopPropagation();
81145       _lastLoc = context.projection.invert(point2);
81146       doMove(d3_event);
81147       var nudge = geoViewportEdge(point2, context.map().dimensions());
81148       if (nudge) {
81149         startNudge(d3_event, nudge);
81150       } else {
81151         stopNudge();
81152       }
81153     }
81154     function doMove(d3_event, nudge) {
81155       nudge = nudge || [0, 0];
81156       var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
81157       var currMouse = geoVecSubtract(currPoint, nudge);
81158       var loc = context.projection.invert(currMouse);
81159       _note = _note.move(loc);
81160       var osm = services.osm;
81161       if (osm) {
81162         osm.replaceNote(_note);
81163       }
81164       context.replace(actionNoop());
81165     }
81166     function end() {
81167       context.replace(actionNoop());
81168       context.selectedNoteID(_note.id).enter(modeSelectNote(context, _note.id));
81169     }
81170     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);
81171     mode.enter = function() {
81172       context.install(edit2);
81173     };
81174     mode.exit = function() {
81175       context.ui().sidebar.hover.cancel();
81176       context.uninstall(edit2);
81177       context.surface().selectAll(".active").classed("active", false);
81178       stopNudge();
81179     };
81180     mode.behavior = drag;
81181     return mode;
81182   }
81183
81184   // modules/modes/select_data.js
81185   function modeSelectData(context, selectedDatum) {
81186     var mode = {
81187       id: "select-data",
81188       button: "browse"
81189     };
81190     var keybinding = utilKeybinding("select-data");
81191     var dataEditor = uiDataEditor(context);
81192     var behaviors = [
81193       behaviorBreathe(context),
81194       behaviorHover(context),
81195       behaviorSelect(context),
81196       behaviorLasso(context),
81197       modeDragNode(context).behavior,
81198       modeDragNote(context).behavior
81199     ];
81200     function selectData(d3_event, drawn) {
81201       var selection2 = context.surface().selectAll(".layer-mapdata .data" + selectedDatum.__featurehash__);
81202       if (selection2.empty()) {
81203         var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
81204         if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
81205           context.enter(modeBrowse(context));
81206         }
81207       } else {
81208         selection2.classed("selected", true);
81209       }
81210     }
81211     function esc() {
81212       if (context.container().select(".combobox").size())
81213         return;
81214       context.enter(modeBrowse(context));
81215     }
81216     mode.zoomToSelected = function() {
81217       var extent = geoExtent(bounds_default(selectedDatum));
81218       context.map().centerZoomEase(extent.center(), context.map().trimmedExtentZoom(extent));
81219     };
81220     mode.enter = function() {
81221       behaviors.forEach(context.install);
81222       keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
81223       select_default2(document).call(keybinding);
81224       selectData();
81225       var sidebar = context.ui().sidebar;
81226       sidebar.show(dataEditor.datum(selectedDatum));
81227       var extent = geoExtent(bounds_default(selectedDatum));
81228       sidebar.expand(sidebar.intersects(extent));
81229       context.map().on("drawn.select-data", selectData);
81230     };
81231     mode.exit = function() {
81232       behaviors.forEach(context.uninstall);
81233       select_default2(document).call(keybinding.unbind);
81234       context.surface().selectAll(".layer-mapdata .selected").classed("selected hover", false);
81235       context.map().on("drawn.select-data", null);
81236       context.ui().sidebar.hide();
81237     };
81238     return mode;
81239   }
81240
81241   // modules/behavior/select.js
81242   function behaviorSelect(context) {
81243     var _tolerancePx = 4;
81244     var _lastMouseEvent = null;
81245     var _showMenu = false;
81246     var _downPointers = {};
81247     var _longPressTimeout = null;
81248     var _lastInteractionType = null;
81249     var _multiselectionPointerId = null;
81250     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
81251     function keydown(d3_event) {
81252       if (d3_event.keyCode === 32) {
81253         var activeNode = document.activeElement;
81254         if (activeNode && (/* @__PURE__ */ new Set(["INPUT", "TEXTAREA"])).has(activeNode.nodeName))
81255           return;
81256       }
81257       if (d3_event.keyCode === 93 || // context menu key
81258       d3_event.keyCode === 32) {
81259         d3_event.preventDefault();
81260       }
81261       if (d3_event.repeat)
81262         return;
81263       cancelLongPress();
81264       if (d3_event.shiftKey) {
81265         context.surface().classed("behavior-multiselect", true);
81266       }
81267       if (d3_event.keyCode === 32) {
81268         if (!_downPointers.spacebar && _lastMouseEvent) {
81269           cancelLongPress();
81270           _longPressTimeout = window.setTimeout(didLongPress, 500, "spacebar", "spacebar");
81271           _downPointers.spacebar = {
81272             firstEvent: _lastMouseEvent,
81273             lastEvent: _lastMouseEvent
81274           };
81275         }
81276       }
81277     }
81278     function keyup(d3_event) {
81279       cancelLongPress();
81280       if (!d3_event.shiftKey) {
81281         context.surface().classed("behavior-multiselect", false);
81282       }
81283       if (d3_event.keyCode === 93) {
81284         d3_event.preventDefault();
81285         _lastInteractionType = "menukey";
81286         contextmenu(d3_event);
81287       } else if (d3_event.keyCode === 32) {
81288         var pointer = _downPointers.spacebar;
81289         if (pointer) {
81290           delete _downPointers.spacebar;
81291           if (pointer.done)
81292             return;
81293           d3_event.preventDefault();
81294           _lastInteractionType = "spacebar";
81295           click(pointer.firstEvent, pointer.lastEvent, "spacebar");
81296         }
81297       }
81298     }
81299     function pointerdown(d3_event) {
81300       var id2 = (d3_event.pointerId || "mouse").toString();
81301       cancelLongPress();
81302       if (d3_event.buttons && d3_event.buttons !== 1)
81303         return;
81304       context.ui().closeEditMenu();
81305       if (d3_event.pointerType !== "mouse") {
81306         _longPressTimeout = window.setTimeout(didLongPress, 500, id2, "longdown-" + (d3_event.pointerType || "mouse"));
81307       }
81308       _downPointers[id2] = {
81309         firstEvent: d3_event,
81310         lastEvent: d3_event
81311       };
81312     }
81313     function didLongPress(id2, interactionType) {
81314       var pointer = _downPointers[id2];
81315       if (!pointer)
81316         return;
81317       for (var i3 in _downPointers) {
81318         _downPointers[i3].done = true;
81319       }
81320       _longPressTimeout = null;
81321       _lastInteractionType = interactionType;
81322       _showMenu = true;
81323       click(pointer.firstEvent, pointer.lastEvent, id2);
81324     }
81325     function pointermove(d3_event) {
81326       var id2 = (d3_event.pointerId || "mouse").toString();
81327       if (_downPointers[id2]) {
81328         _downPointers[id2].lastEvent = d3_event;
81329       }
81330       if (!d3_event.pointerType || d3_event.pointerType === "mouse") {
81331         _lastMouseEvent = d3_event;
81332         if (_downPointers.spacebar) {
81333           _downPointers.spacebar.lastEvent = d3_event;
81334         }
81335       }
81336     }
81337     function pointerup(d3_event) {
81338       var id2 = (d3_event.pointerId || "mouse").toString();
81339       var pointer = _downPointers[id2];
81340       if (!pointer)
81341         return;
81342       delete _downPointers[id2];
81343       if (_multiselectionPointerId === id2) {
81344         _multiselectionPointerId = null;
81345       }
81346       if (pointer.done)
81347         return;
81348       click(pointer.firstEvent, d3_event, id2);
81349     }
81350     function pointercancel(d3_event) {
81351       var id2 = (d3_event.pointerId || "mouse").toString();
81352       if (!_downPointers[id2])
81353         return;
81354       delete _downPointers[id2];
81355       if (_multiselectionPointerId === id2) {
81356         _multiselectionPointerId = null;
81357       }
81358     }
81359     function contextmenu(d3_event) {
81360       d3_event.preventDefault();
81361       if (!+d3_event.clientX && !+d3_event.clientY) {
81362         if (_lastMouseEvent) {
81363           d3_event = _lastMouseEvent;
81364         } else {
81365           return;
81366         }
81367       } else {
81368         _lastMouseEvent = d3_event;
81369         if (d3_event.pointerType === "touch" || d3_event.pointerType === "pen" || d3_event.mozInputSource && // firefox doesn't give a pointerType on contextmenu events
81370         (d3_event.mozInputSource === MouseEvent.MOZ_SOURCE_TOUCH || d3_event.mozInputSource === MouseEvent.MOZ_SOURCE_PEN)) {
81371           _lastInteractionType = "touch";
81372         } else {
81373           _lastInteractionType = "rightclick";
81374         }
81375       }
81376       _showMenu = true;
81377       click(d3_event, d3_event);
81378     }
81379     function click(firstEvent, lastEvent, pointerId) {
81380       cancelLongPress();
81381       var mapNode = context.container().select(".main-map").node();
81382       var pointGetter = utilFastMouse(mapNode);
81383       var p1 = pointGetter(firstEvent);
81384       var p2 = pointGetter(lastEvent);
81385       var dist = geoVecLength(p1, p2);
81386       if (dist > _tolerancePx || !mapContains(lastEvent)) {
81387         resetProperties();
81388         return;
81389       }
81390       var targetDatum = lastEvent.target.__data__;
81391       var multiselectEntityId;
81392       if (!_multiselectionPointerId) {
81393         var selectPointerInfo = pointerDownOnSelection(pointerId);
81394         if (selectPointerInfo) {
81395           _multiselectionPointerId = selectPointerInfo.pointerId;
81396           multiselectEntityId = !selectPointerInfo.selected && selectPointerInfo.entityId;
81397           _downPointers[selectPointerInfo.pointerId].done = true;
81398         }
81399       }
81400       var isMultiselect = context.mode().id === "select" && // and shift key is down
81401       (lastEvent && lastEvent.shiftKey || // or we're lasso-selecting
81402       context.surface().select(".lasso").node() || // or a pointer is down over a selected feature
81403       _multiselectionPointerId && !multiselectEntityId);
81404       processClick(targetDatum, isMultiselect, p2, multiselectEntityId);
81405       function mapContains(event) {
81406         var rect = mapNode.getBoundingClientRect();
81407         return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
81408       }
81409       function pointerDownOnSelection(skipPointerId) {
81410         var mode = context.mode();
81411         var selectedIDs = mode.id === "select" ? mode.selectedIDs() : [];
81412         for (var pointerId2 in _downPointers) {
81413           if (pointerId2 === "spacebar" || pointerId2 === skipPointerId)
81414             continue;
81415           var pointerInfo = _downPointers[pointerId2];
81416           var p12 = pointGetter(pointerInfo.firstEvent);
81417           var p22 = pointGetter(pointerInfo.lastEvent);
81418           if (geoVecLength(p12, p22) > _tolerancePx)
81419             continue;
81420           var datum2 = pointerInfo.firstEvent.target.__data__;
81421           var entity = datum2 && datum2.properties && datum2.properties.entity || datum2;
81422           if (context.graph().hasEntity(entity.id)) {
81423             return {
81424               pointerId: pointerId2,
81425               entityId: entity.id,
81426               selected: selectedIDs.indexOf(entity.id) !== -1
81427             };
81428           }
81429         }
81430         return null;
81431       }
81432     }
81433     function processClick(datum2, isMultiselect, point2, alsoSelectId) {
81434       var mode = context.mode();
81435       var showMenu = _showMenu;
81436       var interactionType = _lastInteractionType;
81437       var entity = datum2 && datum2.properties && datum2.properties.entity;
81438       if (entity)
81439         datum2 = entity;
81440       if (datum2 && datum2.type === "midpoint") {
81441         datum2 = datum2.parents[0];
81442       }
81443       var newMode;
81444       if (datum2 instanceof osmEntity) {
81445         var selectedIDs = context.selectedIDs();
81446         context.selectedNoteID(null);
81447         context.selectedErrorID(null);
81448         if (!isMultiselect) {
81449           if (!showMenu || selectedIDs.length <= 1 || selectedIDs.indexOf(datum2.id) === -1) {
81450             if (alsoSelectId === datum2.id)
81451               alsoSelectId = null;
81452             selectedIDs = (alsoSelectId ? [alsoSelectId] : []).concat([datum2.id]);
81453             newMode = mode.id === "select" ? mode.selectedIDs(selectedIDs) : modeSelect(context, selectedIDs).selectBehavior(behavior);
81454             context.enter(newMode);
81455           }
81456         } else {
81457           if (selectedIDs.indexOf(datum2.id) !== -1) {
81458             if (!showMenu) {
81459               selectedIDs = selectedIDs.filter(function(id2) {
81460                 return id2 !== datum2.id;
81461               });
81462               newMode = selectedIDs.length ? mode.selectedIDs(selectedIDs) : modeBrowse(context).selectBehavior(behavior);
81463               context.enter(newMode);
81464             }
81465           } else {
81466             selectedIDs = selectedIDs.concat([datum2.id]);
81467             newMode = mode.selectedIDs(selectedIDs);
81468             context.enter(newMode);
81469           }
81470         }
81471       } else if (datum2 && datum2.__featurehash__ && !isMultiselect) {
81472         context.selectedNoteID(null).enter(modeSelectData(context, datum2));
81473       } else if (datum2 instanceof osmNote && !isMultiselect) {
81474         context.selectedNoteID(datum2.id).enter(modeSelectNote(context, datum2.id));
81475       } else if (datum2 instanceof QAItem && !isMultiselect) {
81476         context.selectedErrorID(datum2.id).enter(modeSelectError(context, datum2.id, datum2.service));
81477       } else {
81478         context.selectedNoteID(null);
81479         context.selectedErrorID(null);
81480         if (!isMultiselect && mode.id !== "browse") {
81481           context.enter(modeBrowse(context));
81482         }
81483       }
81484       context.ui().closeEditMenu();
81485       if (showMenu)
81486         context.ui().showEditMenu(point2, interactionType);
81487       resetProperties();
81488     }
81489     function cancelLongPress() {
81490       if (_longPressTimeout)
81491         window.clearTimeout(_longPressTimeout);
81492       _longPressTimeout = null;
81493     }
81494     function resetProperties() {
81495       cancelLongPress();
81496       _showMenu = false;
81497       _lastInteractionType = null;
81498     }
81499     function behavior(selection2) {
81500       resetProperties();
81501       _lastMouseEvent = context.map().lastPointerEvent();
81502       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) {
81503         var e3 = d3_event;
81504         if (+e3.clientX === 0 && +e3.clientY === 0) {
81505           d3_event.preventDefault();
81506         }
81507       });
81508       selection2.on(_pointerPrefix + "down.select", pointerdown).on("contextmenu.select", contextmenu);
81509     }
81510     behavior.off = function(selection2) {
81511       cancelLongPress();
81512       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);
81513       selection2.on(_pointerPrefix + "down.select", null).on("contextmenu.select", null);
81514       context.surface().classed("behavior-multiselect", false);
81515     };
81516     return behavior;
81517   }
81518
81519   // modules/operations/index.js
81520   var operations_exports = {};
81521   __export(operations_exports, {
81522     operationCircularize: () => operationCircularize,
81523     operationContinue: () => operationContinue,
81524     operationCopy: () => operationCopy,
81525     operationDelete: () => operationDelete,
81526     operationDisconnect: () => operationDisconnect,
81527     operationDowngrade: () => operationDowngrade,
81528     operationExtract: () => operationExtract,
81529     operationMerge: () => operationMerge,
81530     operationMove: () => operationMove,
81531     operationOrthogonalize: () => operationOrthogonalize,
81532     operationPaste: () => operationPaste,
81533     operationReflectLong: () => operationReflectLong,
81534     operationReflectShort: () => operationReflectShort,
81535     operationReverse: () => operationReverse,
81536     operationRotate: () => operationRotate,
81537     operationSplit: () => operationSplit,
81538     operationStraighten: () => operationStraighten
81539   });
81540
81541   // modules/operations/continue.js
81542   function operationContinue(context, selectedIDs) {
81543     var _entities = selectedIDs.map(function(id2) {
81544       return context.graph().entity(id2);
81545     });
81546     var _geometries = Object.assign(
81547       { line: [], vertex: [] },
81548       utilArrayGroupBy(_entities, function(entity) {
81549         return entity.geometry(context.graph());
81550       })
81551     );
81552     var _vertex = _geometries.vertex.length && _geometries.vertex[0];
81553     function candidateWays() {
81554       return _vertex ? context.graph().parentWays(_vertex).filter(function(parent) {
81555         return parent.geometry(context.graph()) === "line" && !parent.isClosed() && parent.affix(_vertex.id) && (_geometries.line.length === 0 || _geometries.line[0] === parent);
81556       }) : [];
81557     }
81558     var _candidates = candidateWays();
81559     var operation = function() {
81560       var candidate = _candidates[0];
81561       context.enter(
81562         modeDrawLine(context, candidate.id, context.graph(), "line", candidate.affix(_vertex.id), true)
81563       );
81564     };
81565     operation.relatedEntityIds = function() {
81566       return _candidates.length ? [_candidates[0].id] : [];
81567     };
81568     operation.available = function() {
81569       return _geometries.vertex.length === 1 && _geometries.line.length <= 1 && !context.features().hasHiddenConnections(_vertex, context.graph());
81570     };
81571     operation.disabled = function() {
81572       if (_candidates.length === 0) {
81573         return "not_eligible";
81574       } else if (_candidates.length > 1) {
81575         return "multiple";
81576       }
81577       return false;
81578     };
81579     operation.tooltip = function() {
81580       var disable = operation.disabled();
81581       return disable ? _t.append("operations.continue." + disable) : _t.append("operations.continue.description");
81582     };
81583     operation.annotation = function() {
81584       return _t("operations.continue.annotation.line");
81585     };
81586     operation.id = "continue";
81587     operation.keys = [_t("operations.continue.key")];
81588     operation.title = _t.append("operations.continue.title");
81589     operation.behavior = behaviorOperation(context).which(operation);
81590     return operation;
81591   }
81592
81593   // modules/operations/copy.js
81594   function operationCopy(context, selectedIDs) {
81595     function getFilteredIdsToCopy() {
81596       return selectedIDs.filter(function(selectedID) {
81597         var entity = context.graph().hasEntity(selectedID);
81598         return entity.hasInterestingTags() || entity.geometry(context.graph()) !== "vertex";
81599       });
81600     }
81601     var operation = function() {
81602       var graph = context.graph();
81603       var selected = groupEntities(getFilteredIdsToCopy(), graph);
81604       var canCopy = [];
81605       var skip = {};
81606       var entity;
81607       var i3;
81608       for (i3 = 0; i3 < selected.relation.length; i3++) {
81609         entity = selected.relation[i3];
81610         if (!skip[entity.id] && entity.isComplete(graph)) {
81611           canCopy.push(entity.id);
81612           skip = getDescendants(entity.id, graph, skip);
81613         }
81614       }
81615       for (i3 = 0; i3 < selected.way.length; i3++) {
81616         entity = selected.way[i3];
81617         if (!skip[entity.id]) {
81618           canCopy.push(entity.id);
81619           skip = getDescendants(entity.id, graph, skip);
81620         }
81621       }
81622       for (i3 = 0; i3 < selected.node.length; i3++) {
81623         entity = selected.node[i3];
81624         if (!skip[entity.id]) {
81625           canCopy.push(entity.id);
81626         }
81627       }
81628       context.copyIDs(canCopy);
81629       if (_point && (canCopy.length !== 1 || graph.entity(canCopy[0]).type !== "node")) {
81630         context.copyLonLat(context.projection.invert(_point));
81631       } else {
81632         context.copyLonLat(null);
81633       }
81634     };
81635     function groupEntities(ids, graph) {
81636       var entities = ids.map(function(id2) {
81637         return graph.entity(id2);
81638       });
81639       return Object.assign(
81640         { relation: [], way: [], node: [] },
81641         utilArrayGroupBy(entities, "type")
81642       );
81643     }
81644     function getDescendants(id2, graph, descendants) {
81645       var entity = graph.entity(id2);
81646       var children2;
81647       descendants = descendants || {};
81648       if (entity.type === "relation") {
81649         children2 = entity.members.map(function(m2) {
81650           return m2.id;
81651         });
81652       } else if (entity.type === "way") {
81653         children2 = entity.nodes;
81654       } else {
81655         children2 = [];
81656       }
81657       for (var i3 = 0; i3 < children2.length; i3++) {
81658         if (!descendants[children2[i3]]) {
81659           descendants[children2[i3]] = true;
81660           descendants = getDescendants(children2[i3], graph, descendants);
81661         }
81662       }
81663       return descendants;
81664     }
81665     operation.available = function() {
81666       return getFilteredIdsToCopy().length > 0;
81667     };
81668     operation.disabled = function() {
81669       var extent = utilTotalExtent(getFilteredIdsToCopy(), context.graph());
81670       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
81671         return "too_large";
81672       }
81673       return false;
81674     };
81675     operation.availableForKeypress = function() {
81676       var selection2 = window.getSelection && window.getSelection();
81677       return !selection2 || !selection2.toString();
81678     };
81679     operation.tooltip = function() {
81680       var disable = operation.disabled();
81681       return disable ? _t.append("operations.copy." + disable, { n: selectedIDs.length }) : _t.append("operations.copy.description", { n: selectedIDs.length });
81682     };
81683     operation.annotation = function() {
81684       return _t("operations.copy.annotation", { n: selectedIDs.length });
81685     };
81686     var _point;
81687     operation.point = function(val) {
81688       _point = val;
81689       return operation;
81690     };
81691     operation.id = "copy";
81692     operation.keys = [uiCmd("\u2318C")];
81693     operation.title = _t.append("operations.copy.title");
81694     operation.behavior = behaviorOperation(context).which(operation);
81695     return operation;
81696   }
81697
81698   // modules/operations/disconnect.js
81699   function operationDisconnect(context, selectedIDs) {
81700     var _vertexIDs = [];
81701     var _wayIDs = [];
81702     var _otherIDs = [];
81703     var _actions = [];
81704     selectedIDs.forEach(function(id2) {
81705       var entity = context.entity(id2);
81706       if (entity.type === "way") {
81707         _wayIDs.push(id2);
81708       } else if (entity.geometry(context.graph()) === "vertex") {
81709         _vertexIDs.push(id2);
81710       } else {
81711         _otherIDs.push(id2);
81712       }
81713     });
81714     var _coords, _descriptionID = "", _annotationID = "features";
81715     var _disconnectingVertexIds = [];
81716     var _disconnectingWayIds = [];
81717     if (_vertexIDs.length > 0) {
81718       _disconnectingVertexIds = _vertexIDs;
81719       _vertexIDs.forEach(function(vertexID) {
81720         var action = actionDisconnect(vertexID);
81721         if (_wayIDs.length > 0) {
81722           var waysIDsForVertex = _wayIDs.filter(function(wayID) {
81723             var way = context.entity(wayID);
81724             return way.nodes.indexOf(vertexID) !== -1;
81725           });
81726           action.limitWays(waysIDsForVertex);
81727         }
81728         _actions.push(action);
81729         _disconnectingWayIds = _disconnectingWayIds.concat(context.graph().parentWays(context.graph().entity(vertexID)).map((d2) => d2.id));
81730       });
81731       _disconnectingWayIds = utilArrayUniq(_disconnectingWayIds).filter(function(id2) {
81732         return _wayIDs.indexOf(id2) === -1;
81733       });
81734       _descriptionID += _actions.length === 1 ? "single_point." : "multiple_points.";
81735       if (_wayIDs.length === 1) {
81736         _descriptionID += "single_way." + context.graph().geometry(_wayIDs[0]);
81737       } else {
81738         _descriptionID += _wayIDs.length === 0 ? "no_ways" : "multiple_ways";
81739       }
81740     } else if (_wayIDs.length > 0) {
81741       var ways = _wayIDs.map(function(id2) {
81742         return context.entity(id2);
81743       });
81744       var nodes = utilGetAllNodes(_wayIDs, context.graph());
81745       _coords = nodes.map(function(n3) {
81746         return n3.loc;
81747       });
81748       var sharedActions = [];
81749       var sharedNodes = [];
81750       var unsharedActions = [];
81751       var unsharedNodes = [];
81752       nodes.forEach(function(node) {
81753         var action = actionDisconnect(node.id).limitWays(_wayIDs);
81754         if (action.disabled(context.graph()) !== "not_connected") {
81755           var count = 0;
81756           for (var i3 in ways) {
81757             var way = ways[i3];
81758             if (way.nodes.indexOf(node.id) !== -1) {
81759               count += 1;
81760             }
81761             if (count > 1)
81762               break;
81763           }
81764           if (count > 1) {
81765             sharedActions.push(action);
81766             sharedNodes.push(node);
81767           } else {
81768             unsharedActions.push(action);
81769             unsharedNodes.push(node);
81770           }
81771         }
81772       });
81773       _descriptionID += "no_points.";
81774       _descriptionID += _wayIDs.length === 1 ? "single_way." : "multiple_ways.";
81775       if (sharedActions.length) {
81776         _actions = sharedActions;
81777         _disconnectingVertexIds = sharedNodes.map((node) => node.id);
81778         _descriptionID += "conjoined";
81779         _annotationID = "from_each_other";
81780       } else {
81781         _actions = unsharedActions;
81782         _disconnectingVertexIds = unsharedNodes.map((node) => node.id);
81783         if (_wayIDs.length === 1) {
81784           _descriptionID += context.graph().geometry(_wayIDs[0]);
81785         } else {
81786           _descriptionID += "separate";
81787         }
81788       }
81789     }
81790     var _extent = utilTotalExtent(_disconnectingVertexIds, context.graph());
81791     var operation = function() {
81792       context.perform(function(graph) {
81793         return _actions.reduce(function(graph2, action) {
81794           return action(graph2);
81795         }, graph);
81796       }, operation.annotation());
81797       context.validator().validate();
81798     };
81799     operation.relatedEntityIds = function() {
81800       if (_vertexIDs.length) {
81801         return _disconnectingWayIds;
81802       }
81803       return _disconnectingVertexIds;
81804     };
81805     operation.available = function() {
81806       if (_actions.length === 0)
81807         return false;
81808       if (_otherIDs.length !== 0)
81809         return false;
81810       if (_vertexIDs.length !== 0 && _wayIDs.length !== 0 && !_wayIDs.every(function(wayID) {
81811         return _vertexIDs.some(function(vertexID) {
81812           var way = context.entity(wayID);
81813           return way.nodes.indexOf(vertexID) !== -1;
81814         });
81815       }))
81816         return false;
81817       return true;
81818     };
81819     operation.disabled = function() {
81820       var reason;
81821       for (var actionIndex in _actions) {
81822         reason = _actions[actionIndex].disabled(context.graph());
81823         if (reason)
81824           return reason;
81825       }
81826       if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
81827         return "too_large." + ((_vertexIDs.length ? _vertexIDs : _wayIDs).length === 1 ? "single" : "multiple");
81828       } else if (_coords && someMissing()) {
81829         return "not_downloaded";
81830       } else if (selectedIDs.some(context.hasHiddenConnections)) {
81831         return "connected_to_hidden";
81832       }
81833       return false;
81834       function someMissing() {
81835         if (context.inIntro())
81836           return false;
81837         var osm = context.connection();
81838         if (osm) {
81839           var missing = _coords.filter(function(loc) {
81840             return !osm.isDataLoaded(loc);
81841           });
81842           if (missing.length) {
81843             missing.forEach(function(loc) {
81844               context.loadTileAtLoc(loc);
81845             });
81846             return true;
81847           }
81848         }
81849         return false;
81850       }
81851     };
81852     operation.tooltip = function() {
81853       var disable = operation.disabled();
81854       return disable ? _t.append("operations.disconnect." + disable) : _t.append("operations.disconnect.description." + _descriptionID);
81855     };
81856     operation.annotation = function() {
81857       return _t("operations.disconnect.annotation." + _annotationID);
81858     };
81859     operation.id = "disconnect";
81860     operation.keys = [_t("operations.disconnect.key")];
81861     operation.title = _t.append("operations.disconnect.title");
81862     operation.behavior = behaviorOperation(context).which(operation);
81863     return operation;
81864   }
81865
81866   // modules/operations/downgrade.js
81867   function operationDowngrade(context, selectedIDs) {
81868     var _affectedFeatureCount = 0;
81869     var _downgradeType = downgradeTypeForEntityIDs(selectedIDs);
81870     var _multi = _affectedFeatureCount === 1 ? "single" : "multiple";
81871     function downgradeTypeForEntityIDs(entityIds) {
81872       var downgradeType;
81873       _affectedFeatureCount = 0;
81874       for (var i3 in entityIds) {
81875         var entityID = entityIds[i3];
81876         var type2 = downgradeTypeForEntityID(entityID);
81877         if (type2) {
81878           _affectedFeatureCount += 1;
81879           if (downgradeType && type2 !== downgradeType) {
81880             if (downgradeType !== "generic" && type2 !== "generic") {
81881               downgradeType = "building_address";
81882             } else {
81883               downgradeType = "generic";
81884             }
81885           } else {
81886             downgradeType = type2;
81887           }
81888         }
81889       }
81890       return downgradeType;
81891     }
81892     function downgradeTypeForEntityID(entityID) {
81893       var graph = context.graph();
81894       var entity = graph.entity(entityID);
81895       var preset = _mainPresetIndex.match(entity, graph);
81896       if (!preset || preset.isFallback())
81897         return null;
81898       if (entity.type === "node" && preset.id !== "address" && Object.keys(entity.tags).some(function(key) {
81899         return key.match(/^addr:.{1,}/);
81900       })) {
81901         return "address";
81902       }
81903       var geometry = entity.geometry(graph);
81904       if (geometry === "area" && entity.tags.building && !preset.tags.building) {
81905         return "building";
81906       }
81907       if (geometry === "vertex" && Object.keys(entity.tags).length) {
81908         return "generic";
81909       }
81910       return null;
81911     }
81912     var buildingKeysToKeep = ["architect", "building", "height", "layer", "source", "type", "wheelchair"];
81913     var addressKeysToKeep = ["source"];
81914     var operation = function() {
81915       context.perform(function(graph) {
81916         for (var i3 in selectedIDs) {
81917           var entityID = selectedIDs[i3];
81918           var type2 = downgradeTypeForEntityID(entityID);
81919           if (!type2)
81920             continue;
81921           var tags = Object.assign({}, graph.entity(entityID).tags);
81922           for (var key in tags) {
81923             if (type2 === "address" && addressKeysToKeep.indexOf(key) !== -1)
81924               continue;
81925             if (type2 === "building") {
81926               if (buildingKeysToKeep.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/))
81927                 continue;
81928             }
81929             if (type2 !== "generic") {
81930               if (key.match(/^addr:.{1,}/) || key.match(/^source:.{1,}/))
81931                 continue;
81932             }
81933             delete tags[key];
81934           }
81935           graph = actionChangeTags(entityID, tags)(graph);
81936         }
81937         return graph;
81938       }, operation.annotation());
81939       context.validator().validate();
81940       context.enter(modeSelect(context, selectedIDs));
81941     };
81942     operation.available = function() {
81943       return _downgradeType;
81944     };
81945     operation.disabled = function() {
81946       if (selectedIDs.some(hasWikidataTag)) {
81947         return "has_wikidata_tag";
81948       }
81949       return false;
81950       function hasWikidataTag(id2) {
81951         var entity = context.entity(id2);
81952         return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
81953       }
81954     };
81955     operation.tooltip = function() {
81956       var disable = operation.disabled();
81957       return disable ? _t.append("operations.downgrade." + disable + "." + _multi) : _t.append("operations.downgrade.description." + _downgradeType);
81958     };
81959     operation.annotation = function() {
81960       var suffix;
81961       if (_downgradeType === "building_address") {
81962         suffix = "generic";
81963       } else {
81964         suffix = _downgradeType;
81965       }
81966       return _t("operations.downgrade.annotation." + suffix, { n: _affectedFeatureCount });
81967     };
81968     operation.id = "downgrade";
81969     operation.keys = [uiCmd("\u232B")];
81970     operation.title = _t.append("operations.downgrade.title");
81971     operation.behavior = behaviorOperation(context).which(operation);
81972     return operation;
81973   }
81974
81975   // modules/operations/extract.js
81976   function operationExtract(context, selectedIDs) {
81977     var _amount = selectedIDs.length === 1 ? "single" : "multiple";
81978     var _geometries = utilArrayUniq(selectedIDs.map(function(entityID) {
81979       return context.graph().hasEntity(entityID) && context.graph().geometry(entityID);
81980     }).filter(Boolean));
81981     var _geometryID = _geometries.length === 1 ? _geometries[0] : "feature";
81982     var _extent;
81983     var _actions = selectedIDs.map(function(entityID) {
81984       var graph = context.graph();
81985       var entity = graph.hasEntity(entityID);
81986       if (!entity || !entity.hasInterestingTags())
81987         return null;
81988       if (entity.type === "node" && graph.parentWays(entity).length === 0)
81989         return null;
81990       if (entity.type !== "node") {
81991         var preset = _mainPresetIndex.match(entity, graph);
81992         if (preset.geometry.indexOf("point") === -1)
81993           return null;
81994       }
81995       _extent = _extent ? _extent.extend(entity.extent(graph)) : entity.extent(graph);
81996       return actionExtract(entityID, context.projection);
81997     }).filter(Boolean);
81998     var operation = function() {
81999       var combinedAction = function(graph) {
82000         _actions.forEach(function(action) {
82001           graph = action(graph);
82002         });
82003         return graph;
82004       };
82005       context.perform(combinedAction, operation.annotation());
82006       var extractedNodeIDs = _actions.map(function(action) {
82007         return action.getExtractedNodeID();
82008       });
82009       context.enter(modeSelect(context, extractedNodeIDs));
82010     };
82011     operation.available = function() {
82012       return _actions.length && selectedIDs.length === _actions.length;
82013     };
82014     operation.disabled = function() {
82015       if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
82016         return "too_large";
82017       } else if (selectedIDs.some(function(entityID) {
82018         return context.graph().geometry(entityID) === "vertex" && context.hasHiddenConnections(entityID);
82019       })) {
82020         return "connected_to_hidden";
82021       }
82022       return false;
82023     };
82024     operation.tooltip = function() {
82025       var disableReason = operation.disabled();
82026       if (disableReason) {
82027         return _t.append("operations.extract." + disableReason + "." + _amount);
82028       } else {
82029         return _t.append("operations.extract.description." + _geometryID + "." + _amount);
82030       }
82031     };
82032     operation.annotation = function() {
82033       return _t("operations.extract.annotation", { n: selectedIDs.length });
82034     };
82035     operation.id = "extract";
82036     operation.keys = [_t("operations.extract.key")];
82037     operation.title = _t.append("operations.extract.title");
82038     operation.behavior = behaviorOperation(context).which(operation);
82039     return operation;
82040   }
82041
82042   // modules/operations/merge.js
82043   function operationMerge(context, selectedIDs) {
82044     var _action = getAction();
82045     function getAction() {
82046       var join = actionJoin(selectedIDs);
82047       if (!join.disabled(context.graph()))
82048         return join;
82049       var merge2 = actionMerge(selectedIDs);
82050       if (!merge2.disabled(context.graph()))
82051         return merge2;
82052       var mergePolygon = actionMergePolygon(selectedIDs);
82053       if (!mergePolygon.disabled(context.graph()))
82054         return mergePolygon;
82055       var mergeNodes = actionMergeNodes(selectedIDs);
82056       if (!mergeNodes.disabled(context.graph()))
82057         return mergeNodes;
82058       if (join.disabled(context.graph()) !== "not_eligible")
82059         return join;
82060       if (merge2.disabled(context.graph()) !== "not_eligible")
82061         return merge2;
82062       if (mergePolygon.disabled(context.graph()) !== "not_eligible")
82063         return mergePolygon;
82064       return mergeNodes;
82065     }
82066     var operation = function() {
82067       if (operation.disabled())
82068         return;
82069       context.perform(_action, operation.annotation());
82070       context.validator().validate();
82071       var resultIDs = selectedIDs.filter(context.hasEntity);
82072       if (resultIDs.length > 1) {
82073         var interestingIDs = resultIDs.filter(function(id2) {
82074           return context.entity(id2).hasInterestingTags();
82075         });
82076         if (interestingIDs.length)
82077           resultIDs = interestingIDs;
82078       }
82079       context.enter(modeSelect(context, resultIDs));
82080     };
82081     operation.available = function() {
82082       return selectedIDs.length >= 2;
82083     };
82084     operation.disabled = function() {
82085       var actionDisabled = _action.disabled(context.graph());
82086       if (actionDisabled)
82087         return actionDisabled;
82088       var osm = context.connection();
82089       if (osm && _action.resultingWayNodesLength && _action.resultingWayNodesLength(context.graph()) > osm.maxWayNodes()) {
82090         return "too_many_vertices";
82091       }
82092       return false;
82093     };
82094     operation.tooltip = function() {
82095       var disabled = operation.disabled();
82096       if (disabled) {
82097         if (disabled === "conflicting_relations") {
82098           return _t.append("operations.merge.conflicting_relations");
82099         }
82100         if (disabled === "restriction" || disabled === "connectivity") {
82101           return _t.append(
82102             "operations.merge.damage_relation",
82103             { relation: _mainPresetIndex.item("type/" + disabled).name() }
82104           );
82105         }
82106         return _t.append("operations.merge." + disabled);
82107       }
82108       return _t.append("operations.merge.description");
82109     };
82110     operation.annotation = function() {
82111       return _t("operations.merge.annotation", { n: selectedIDs.length });
82112     };
82113     operation.id = "merge";
82114     operation.keys = [_t("operations.merge.key")];
82115     operation.title = _t.append("operations.merge.title");
82116     operation.behavior = behaviorOperation(context).which(operation);
82117     return operation;
82118   }
82119
82120   // modules/operations/paste.js
82121   function operationPaste(context) {
82122     var _pastePoint;
82123     var operation = function() {
82124       if (!_pastePoint)
82125         return;
82126       var oldIDs = context.copyIDs();
82127       if (!oldIDs.length)
82128         return;
82129       var projection2 = context.projection;
82130       var extent = geoExtent();
82131       var oldGraph = context.copyGraph();
82132       var newIDs = [];
82133       var action = actionCopyEntities(oldIDs, oldGraph);
82134       context.perform(action);
82135       var copies = action.copies();
82136       var originals = /* @__PURE__ */ new Set();
82137       Object.values(copies).forEach(function(entity) {
82138         originals.add(entity.id);
82139       });
82140       for (var id2 in copies) {
82141         var oldEntity = oldGraph.entity(id2);
82142         var newEntity = copies[id2];
82143         extent._extend(oldEntity.extent(oldGraph));
82144         var parents = context.graph().parentWays(newEntity);
82145         var parentCopied = parents.some(function(parent) {
82146           return originals.has(parent.id);
82147         });
82148         if (!parentCopied) {
82149           newIDs.push(newEntity.id);
82150         }
82151       }
82152       var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
82153       var delta = geoVecSubtract(_pastePoint, copyPoint);
82154       context.replace(actionMove(newIDs, delta, projection2), operation.annotation());
82155       context.enter(modeSelect(context, newIDs));
82156     };
82157     operation.point = function(val) {
82158       _pastePoint = val;
82159       return operation;
82160     };
82161     operation.available = function() {
82162       return context.mode().id === "browse";
82163     };
82164     operation.disabled = function() {
82165       return !context.copyIDs().length;
82166     };
82167     operation.tooltip = function() {
82168       var oldGraph = context.copyGraph();
82169       var ids = context.copyIDs();
82170       if (!ids.length) {
82171         return _t.append("operations.paste.nothing_copied");
82172       }
82173       return _t.append("operations.paste.description", { feature: utilDisplayLabel(oldGraph.entity(ids[0]), oldGraph), n: ids.length });
82174     };
82175     operation.annotation = function() {
82176       var ids = context.copyIDs();
82177       return _t("operations.paste.annotation", { n: ids.length });
82178     };
82179     operation.id = "paste";
82180     operation.keys = [uiCmd("\u2318V")];
82181     operation.title = _t.append("operations.paste.title");
82182     return operation;
82183   }
82184
82185   // modules/operations/reverse.js
82186   function operationReverse(context, selectedIDs) {
82187     var operation = function() {
82188       context.perform(function combinedReverseAction(graph) {
82189         actions().forEach(function(action) {
82190           graph = action(graph);
82191         });
82192         return graph;
82193       }, operation.annotation());
82194       context.validator().validate();
82195     };
82196     function actions(situation) {
82197       return selectedIDs.map(function(entityID) {
82198         var entity = context.hasEntity(entityID);
82199         if (!entity)
82200           return null;
82201         if (situation === "toolbar") {
82202           if (entity.type === "way" && (!entity.isOneWay() && !entity.isSided()))
82203             return null;
82204         }
82205         var geometry = entity.geometry(context.graph());
82206         if (entity.type !== "node" && geometry !== "line")
82207           return null;
82208         var action = actionReverse(entityID);
82209         if (action.disabled(context.graph()))
82210           return null;
82211         return action;
82212       }).filter(Boolean);
82213     }
82214     function reverseTypeID() {
82215       var acts = actions();
82216       var nodeActionCount = acts.filter(function(act) {
82217         var entity = context.hasEntity(act.entityID());
82218         return entity && entity.type === "node";
82219       }).length;
82220       if (nodeActionCount === 0)
82221         return "line";
82222       if (nodeActionCount === acts.length)
82223         return "point";
82224       return "feature";
82225     }
82226     operation.available = function(situation) {
82227       return actions(situation).length > 0;
82228     };
82229     operation.disabled = function() {
82230       return false;
82231     };
82232     operation.tooltip = function() {
82233       return _t.append("operations.reverse.description." + reverseTypeID());
82234     };
82235     operation.annotation = function() {
82236       var acts = actions();
82237       return _t("operations.reverse.annotation." + reverseTypeID(), { n: acts.length });
82238     };
82239     operation.id = "reverse";
82240     operation.keys = [_t("operations.reverse.key")];
82241     operation.title = _t.append("operations.reverse.title");
82242     operation.behavior = behaviorOperation(context).which(operation);
82243     return operation;
82244   }
82245
82246   // modules/operations/split.js
82247   function operationSplit(context, selectedIDs) {
82248     var _vertexIds = selectedIDs.filter(function(id2) {
82249       return context.graph().geometry(id2) === "vertex";
82250     });
82251     var _selectedWayIds = selectedIDs.filter(function(id2) {
82252       var entity = context.graph().hasEntity(id2);
82253       return entity && entity.type === "way";
82254     });
82255     var _isAvailable = _vertexIds.length > 0 && _vertexIds.length + _selectedWayIds.length === selectedIDs.length;
82256     var _action = actionSplit(_vertexIds);
82257     var _ways = [];
82258     var _geometry = "feature";
82259     var _waysAmount = "single";
82260     var _nodesAmount = _vertexIds.length === 1 ? "single" : "multiple";
82261     if (_isAvailable) {
82262       if (_selectedWayIds.length)
82263         _action.limitWays(_selectedWayIds);
82264       _ways = _action.ways(context.graph());
82265       var geometries = {};
82266       _ways.forEach(function(way) {
82267         geometries[way.geometry(context.graph())] = true;
82268       });
82269       if (Object.keys(geometries).length === 1) {
82270         _geometry = Object.keys(geometries)[0];
82271       }
82272       _waysAmount = _ways.length === 1 ? "single" : "multiple";
82273     }
82274     var operation = function() {
82275       var difference = context.perform(_action, operation.annotation());
82276       var idsToSelect = _vertexIds.concat(difference.extantIDs().filter(function(id2) {
82277         return context.entity(id2).type === "way";
82278       }));
82279       context.enter(modeSelect(context, idsToSelect));
82280     };
82281     operation.relatedEntityIds = function() {
82282       return _selectedWayIds.length ? [] : _ways.map((way) => way.id);
82283     };
82284     operation.available = function() {
82285       return _isAvailable;
82286     };
82287     operation.disabled = function() {
82288       var reason = _action.disabled(context.graph());
82289       if (reason) {
82290         return reason;
82291       } else if (selectedIDs.some(context.hasHiddenConnections)) {
82292         return "connected_to_hidden";
82293       }
82294       return false;
82295     };
82296     operation.tooltip = function() {
82297       var disable = operation.disabled();
82298       return disable ? _t.append("operations.split." + disable) : _t.append("operations.split.description." + _geometry + "." + _waysAmount + "." + _nodesAmount + "_node");
82299     };
82300     operation.annotation = function() {
82301       return _t("operations.split.annotation." + _geometry, { n: _ways.length });
82302     };
82303     operation.icon = function() {
82304       if (_waysAmount === "multiple") {
82305         return "#iD-operation-split-multiple";
82306       } else {
82307         return "#iD-operation-split";
82308       }
82309     };
82310     operation.id = "split";
82311     operation.keys = [_t("operations.split.key")];
82312     operation.title = _t.append("operations.split.title");
82313     operation.behavior = behaviorOperation(context).which(operation);
82314     return operation;
82315   }
82316
82317   // modules/operations/straighten.js
82318   function operationStraighten(context, selectedIDs) {
82319     var _wayIDs = selectedIDs.filter(function(id2) {
82320       return id2.charAt(0) === "w";
82321     });
82322     var _nodeIDs = selectedIDs.filter(function(id2) {
82323       return id2.charAt(0) === "n";
82324     });
82325     var _amount = (_wayIDs.length ? _wayIDs : _nodeIDs).length === 1 ? "single" : "multiple";
82326     var _nodes = utilGetAllNodes(selectedIDs, context.graph());
82327     var _coords = _nodes.map(function(n3) {
82328       return n3.loc;
82329     });
82330     var _extent = utilTotalExtent(selectedIDs, context.graph());
82331     var _action = chooseAction();
82332     var _geometry;
82333     function chooseAction() {
82334       if (_wayIDs.length === 0 && _nodeIDs.length > 2) {
82335         _geometry = "point";
82336         return actionStraightenNodes(_nodeIDs, context.projection);
82337       } else if (_wayIDs.length > 0 && (_nodeIDs.length === 0 || _nodeIDs.length === 2)) {
82338         var startNodeIDs = [];
82339         var endNodeIDs = [];
82340         for (var i3 = 0; i3 < selectedIDs.length; i3++) {
82341           var entity = context.entity(selectedIDs[i3]);
82342           if (entity.type === "node") {
82343             continue;
82344           } else if (entity.type !== "way" || entity.isClosed()) {
82345             return null;
82346           }
82347           startNodeIDs.push(entity.first());
82348           endNodeIDs.push(entity.last());
82349         }
82350         startNodeIDs = startNodeIDs.filter(function(n3) {
82351           return startNodeIDs.indexOf(n3) === startNodeIDs.lastIndexOf(n3);
82352         });
82353         endNodeIDs = endNodeIDs.filter(function(n3) {
82354           return endNodeIDs.indexOf(n3) === endNodeIDs.lastIndexOf(n3);
82355         });
82356         if (utilArrayDifference(startNodeIDs, endNodeIDs).length + utilArrayDifference(endNodeIDs, startNodeIDs).length !== 2)
82357           return null;
82358         var wayNodeIDs = utilGetAllNodes(_wayIDs, context.graph()).map(function(node) {
82359           return node.id;
82360         });
82361         if (wayNodeIDs.length <= 2)
82362           return null;
82363         if (_nodeIDs.length === 2 && (wayNodeIDs.indexOf(_nodeIDs[0]) === -1 || wayNodeIDs.indexOf(_nodeIDs[1]) === -1))
82364           return null;
82365         if (_nodeIDs.length) {
82366           _extent = utilTotalExtent(_nodeIDs, context.graph());
82367         }
82368         _geometry = "line";
82369         return actionStraightenWay(selectedIDs, context.projection);
82370       }
82371       return null;
82372     }
82373     function operation() {
82374       if (!_action)
82375         return;
82376       context.perform(_action, operation.annotation());
82377       window.setTimeout(function() {
82378         context.validator().validate();
82379       }, 300);
82380     }
82381     operation.available = function() {
82382       return Boolean(_action);
82383     };
82384     operation.disabled = function() {
82385       var reason = _action.disabled(context.graph());
82386       if (reason) {
82387         return reason;
82388       } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
82389         return "too_large";
82390       } else if (someMissing()) {
82391         return "not_downloaded";
82392       } else if (selectedIDs.some(context.hasHiddenConnections)) {
82393         return "connected_to_hidden";
82394       }
82395       return false;
82396       function someMissing() {
82397         if (context.inIntro())
82398           return false;
82399         var osm = context.connection();
82400         if (osm) {
82401           var missing = _coords.filter(function(loc) {
82402             return !osm.isDataLoaded(loc);
82403           });
82404           if (missing.length) {
82405             missing.forEach(function(loc) {
82406               context.loadTileAtLoc(loc);
82407             });
82408             return true;
82409           }
82410         }
82411         return false;
82412       }
82413     };
82414     operation.tooltip = function() {
82415       var disable = operation.disabled();
82416       return disable ? _t.append("operations.straighten." + disable + "." + _amount) : _t.append("operations.straighten.description." + _geometry + (_wayIDs.length === 1 ? "" : "s"));
82417     };
82418     operation.annotation = function() {
82419       return _t("operations.straighten.annotation." + _geometry, { n: _wayIDs.length ? _wayIDs.length : _nodeIDs.length });
82420     };
82421     operation.id = "straighten";
82422     operation.keys = [_t("operations.straighten.key")];
82423     operation.title = _t.append("operations.straighten.title");
82424     operation.behavior = behaviorOperation(context).which(operation);
82425     return operation;
82426   }
82427
82428   // modules/modes/select.js
82429   function modeSelect(context, selectedIDs) {
82430     var mode = {
82431       id: "select",
82432       button: "browse"
82433     };
82434     var keybinding = utilKeybinding("select");
82435     var _breatheBehavior = behaviorBreathe(context);
82436     var _modeDragNode = modeDragNode(context);
82437     var _selectBehavior;
82438     var _behaviors = [];
82439     var _operations = [];
82440     var _newFeature = false;
82441     var _follow = false;
82442     var _focusedParentWayId;
82443     var _focusedVertexIds;
82444     function singular() {
82445       if (selectedIDs && selectedIDs.length === 1) {
82446         return context.hasEntity(selectedIDs[0]);
82447       }
82448     }
82449     function selectedEntities() {
82450       return selectedIDs.map(function(id2) {
82451         return context.hasEntity(id2);
82452       }).filter(Boolean);
82453     }
82454     function checkSelectedIDs() {
82455       var ids = [];
82456       if (Array.isArray(selectedIDs)) {
82457         ids = selectedIDs.filter(function(id2) {
82458           return context.hasEntity(id2);
82459         });
82460       }
82461       if (!ids.length) {
82462         context.enter(modeBrowse(context));
82463         return false;
82464       } else if (selectedIDs.length > 1 && ids.length === 1 || selectedIDs.length === 1 && ids.length > 1) {
82465         context.enter(modeSelect(context, ids));
82466         return false;
82467       }
82468       selectedIDs = ids;
82469       return true;
82470     }
82471     function parentWaysIdsOfSelection(onlyCommonParents) {
82472       var graph = context.graph();
82473       var parents = [];
82474       for (var i3 = 0; i3 < selectedIDs.length; i3++) {
82475         var entity = context.hasEntity(selectedIDs[i3]);
82476         if (!entity || entity.geometry(graph) !== "vertex") {
82477           return [];
82478         }
82479         var currParents = graph.parentWays(entity).map(function(w2) {
82480           return w2.id;
82481         });
82482         if (!parents.length) {
82483           parents = currParents;
82484           continue;
82485         }
82486         parents = (onlyCommonParents ? utilArrayIntersection : utilArrayUnion)(parents, currParents);
82487         if (!parents.length) {
82488           return [];
82489         }
82490       }
82491       return parents;
82492     }
82493     function childNodeIdsOfSelection(onlyCommon) {
82494       var graph = context.graph();
82495       var childs = [];
82496       for (var i3 = 0; i3 < selectedIDs.length; i3++) {
82497         var entity = context.hasEntity(selectedIDs[i3]);
82498         if (!entity || !["area", "line"].includes(entity.geometry(graph))) {
82499           return [];
82500         }
82501         var currChilds = graph.childNodes(entity).map(function(node) {
82502           return node.id;
82503         });
82504         if (!childs.length) {
82505           childs = currChilds;
82506           continue;
82507         }
82508         childs = (onlyCommon ? utilArrayIntersection : utilArrayUnion)(childs, currChilds);
82509         if (!childs.length) {
82510           return [];
82511         }
82512       }
82513       return childs;
82514     }
82515     function checkFocusedParent() {
82516       if (_focusedParentWayId) {
82517         var parents = parentWaysIdsOfSelection(true);
82518         if (parents.indexOf(_focusedParentWayId) === -1)
82519           _focusedParentWayId = null;
82520       }
82521     }
82522     function parentWayIdForVertexNavigation() {
82523       var parentIds = parentWaysIdsOfSelection(true);
82524       if (_focusedParentWayId && parentIds.indexOf(_focusedParentWayId) !== -1) {
82525         return _focusedParentWayId;
82526       }
82527       return parentIds.length ? parentIds[0] : null;
82528     }
82529     mode.selectedIDs = function(val) {
82530       if (!arguments.length)
82531         return selectedIDs;
82532       selectedIDs = val;
82533       return mode;
82534     };
82535     mode.zoomToSelected = function() {
82536       context.map().zoomToEase(selectedEntities());
82537     };
82538     mode.newFeature = function(val) {
82539       if (!arguments.length)
82540         return _newFeature;
82541       _newFeature = val;
82542       return mode;
82543     };
82544     mode.selectBehavior = function(val) {
82545       if (!arguments.length)
82546         return _selectBehavior;
82547       _selectBehavior = val;
82548       return mode;
82549     };
82550     mode.follow = function(val) {
82551       if (!arguments.length)
82552         return _follow;
82553       _follow = val;
82554       return mode;
82555     };
82556     function loadOperations() {
82557       _operations.forEach(function(operation) {
82558         if (operation.behavior) {
82559           context.uninstall(operation.behavior);
82560         }
82561       });
82562       _operations = Object.values(operations_exports).map(function(o2) {
82563         return o2(context, selectedIDs);
82564       }).filter(function(o2) {
82565         return o2.id !== "delete" && o2.id !== "downgrade" && o2.id !== "copy";
82566       }).concat([
82567         // group copy/downgrade/delete operation together at the end of the list
82568         operationCopy(context, selectedIDs),
82569         operationDowngrade(context, selectedIDs),
82570         operationDelete(context, selectedIDs)
82571       ]).filter(function(operation) {
82572         return operation.available();
82573       });
82574       _operations.forEach(function(operation) {
82575         if (operation.behavior) {
82576           context.install(operation.behavior);
82577         }
82578       });
82579       context.ui().closeEditMenu();
82580     }
82581     mode.operations = function() {
82582       return _operations;
82583     };
82584     mode.enter = function() {
82585       if (!checkSelectedIDs())
82586         return;
82587       context.features().forceVisible(selectedIDs);
82588       _modeDragNode.restoreSelectedIDs(selectedIDs);
82589       loadOperations();
82590       if (!_behaviors.length) {
82591         if (!_selectBehavior)
82592           _selectBehavior = behaviorSelect(context);
82593         _behaviors = [
82594           behaviorPaste(context),
82595           _breatheBehavior,
82596           behaviorHover(context).on("hover", context.ui().sidebar.hoverModeSelect),
82597           _selectBehavior,
82598           behaviorLasso(context),
82599           _modeDragNode.behavior,
82600           modeDragNote(context).behavior
82601         ];
82602       }
82603       _behaviors.forEach(context.install);
82604       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);
82605       select_default2(document).call(keybinding);
82606       context.ui().sidebar.select(selectedIDs, _newFeature);
82607       context.history().on("change.select", function() {
82608         loadOperations();
82609         selectElements();
82610       }).on("undone.select", checkSelectedIDs).on("redone.select", checkSelectedIDs);
82611       context.map().on("drawn.select", selectElements).on("crossEditableZoom.select", function() {
82612         selectElements();
82613         _breatheBehavior.restartIfNeeded(context.surface());
82614       });
82615       context.map().doubleUpHandler().on("doubleUp.modeSelect", didDoubleUp);
82616       selectElements();
82617       if (_follow) {
82618         var extent = geoExtent();
82619         var graph = context.graph();
82620         selectedIDs.forEach(function(id2) {
82621           var entity = context.entity(id2);
82622           extent._extend(entity.extent(graph));
82623         });
82624         var loc = extent.center();
82625         context.map().centerEase(loc);
82626         _follow = false;
82627       }
82628       function nudgeSelection(delta) {
82629         return function() {
82630           if (!context.map().withinEditableZoom())
82631             return;
82632           var moveOp = operationMove(context, selectedIDs);
82633           if (moveOp.disabled()) {
82634             context.ui().flash.duration(4e3).iconName("#iD-operation-" + moveOp.id).iconClass("operation disabled").label(moveOp.tooltip())();
82635           } else {
82636             context.perform(actionMove(selectedIDs, delta, context.projection), moveOp.annotation());
82637             context.validator().validate();
82638           }
82639         };
82640       }
82641       function scaleSelection(factor) {
82642         return function() {
82643           if (!context.map().withinEditableZoom())
82644             return;
82645           let nodes = utilGetAllNodes(selectedIDs, context.graph());
82646           let isUp = factor > 1;
82647           if (nodes.length <= 1)
82648             return;
82649           let extent2 = utilTotalExtent(selectedIDs, context.graph());
82650           function scalingDisabled() {
82651             if (tooSmall()) {
82652               return "too_small";
82653             } else if (extent2.percentContainedIn(context.map().extent()) < 0.8) {
82654               return "too_large";
82655             } else if (someMissing() || selectedIDs.some(incompleteRelation)) {
82656               return "not_downloaded";
82657             } else if (selectedIDs.some(context.hasHiddenConnections)) {
82658               return "connected_to_hidden";
82659             }
82660             return false;
82661             function tooSmall() {
82662               if (isUp)
82663                 return false;
82664               let dLon = Math.abs(extent2[1][0] - extent2[0][0]);
82665               let dLat = Math.abs(extent2[1][1] - extent2[0][1]);
82666               return dLon < geoMetersToLon(1, extent2[1][1]) && dLat < geoMetersToLat(1);
82667             }
82668             function someMissing() {
82669               if (context.inIntro())
82670                 return false;
82671               let osm = context.connection();
82672               if (osm) {
82673                 let missing = nodes.filter(function(n3) {
82674                   return !osm.isDataLoaded(n3.loc);
82675                 });
82676                 if (missing.length) {
82677                   missing.forEach(function(loc2) {
82678                     context.loadTileAtLoc(loc2);
82679                   });
82680                   return true;
82681                 }
82682               }
82683               return false;
82684             }
82685             function incompleteRelation(id2) {
82686               let entity = context.entity(id2);
82687               return entity.type === "relation" && !entity.isComplete(context.graph());
82688             }
82689           }
82690           const disabled = scalingDisabled();
82691           if (disabled) {
82692             let multi = selectedIDs.length === 1 ? "single" : "multiple";
82693             context.ui().flash.duration(4e3).iconName("#iD-icon-no").iconClass("operation disabled").label(_t.append("operations.scale." + disabled + "." + multi))();
82694           } else {
82695             const pivot = context.projection(extent2.center());
82696             const annotation = _t("operations.scale.annotation." + (isUp ? "up" : "down") + ".feature", { n: selectedIDs.length });
82697             context.perform(actionScale(selectedIDs, pivot, factor, context.projection), annotation);
82698             context.validator().validate();
82699           }
82700         };
82701       }
82702       function didDoubleUp(d3_event, loc2) {
82703         if (!context.map().withinEditableZoom())
82704           return;
82705         var target = select_default2(d3_event.target);
82706         var datum2 = target.datum();
82707         var entity = datum2 && datum2.properties && datum2.properties.entity;
82708         if (!entity)
82709           return;
82710         if (entity instanceof osmWay && target.classed("target")) {
82711           var choice = geoChooseEdge(context.graph().childNodes(entity), loc2, context.projection);
82712           var prev = entity.nodes[choice.index - 1];
82713           var next = entity.nodes[choice.index];
82714           context.perform(
82715             actionAddMidpoint({ loc: choice.loc, edge: [prev, next] }, osmNode()),
82716             _t("operations.add.annotation.vertex")
82717           );
82718           context.validator().validate();
82719         } else if (entity.type === "midpoint") {
82720           context.perform(
82721             actionAddMidpoint({ loc: entity.loc, edge: entity.edge }, osmNode()),
82722             _t("operations.add.annotation.vertex")
82723           );
82724           context.validator().validate();
82725         }
82726       }
82727       function selectElements() {
82728         if (!checkSelectedIDs())
82729           return;
82730         var surface = context.surface();
82731         surface.selectAll(".selected-member").classed("selected-member", false);
82732         surface.selectAll(".selected").classed("selected", false);
82733         surface.selectAll(".related").classed("related", false);
82734         checkFocusedParent();
82735         if (_focusedParentWayId) {
82736           surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
82737         }
82738         if (context.map().withinEditableZoom()) {
82739           surface.selectAll(utilDeepMemberSelector(
82740             selectedIDs,
82741             context.graph(),
82742             true
82743             /* skipMultipolgonMembers */
82744           )).classed("selected-member", true);
82745           surface.selectAll(utilEntityOrDeepMemberSelector(selectedIDs, context.graph())).classed("selected", true);
82746         }
82747       }
82748       function esc() {
82749         if (context.container().select(".combobox").size())
82750           return;
82751         context.enter(modeBrowse(context));
82752       }
82753       function firstVertex(d3_event) {
82754         d3_event.preventDefault();
82755         var entity = singular();
82756         var parentId = parentWayIdForVertexNavigation();
82757         var way;
82758         if (entity && entity.type === "way") {
82759           way = entity;
82760         } else if (parentId) {
82761           way = context.entity(parentId);
82762         }
82763         _focusedParentWayId = way && way.id;
82764         if (way) {
82765           context.enter(
82766             mode.selectedIDs([way.first()]).follow(true)
82767           );
82768         }
82769       }
82770       function lastVertex(d3_event) {
82771         d3_event.preventDefault();
82772         var entity = singular();
82773         var parentId = parentWayIdForVertexNavigation();
82774         var way;
82775         if (entity && entity.type === "way") {
82776           way = entity;
82777         } else if (parentId) {
82778           way = context.entity(parentId);
82779         }
82780         _focusedParentWayId = way && way.id;
82781         if (way) {
82782           context.enter(
82783             mode.selectedIDs([way.last()]).follow(true)
82784           );
82785         }
82786       }
82787       function previousVertex(d3_event) {
82788         d3_event.preventDefault();
82789         var parentId = parentWayIdForVertexNavigation();
82790         _focusedParentWayId = parentId;
82791         if (!parentId)
82792           return;
82793         var way = context.entity(parentId);
82794         var length = way.nodes.length;
82795         var curr = way.nodes.indexOf(selectedIDs[0]);
82796         var index = -1;
82797         if (curr > 0) {
82798           index = curr - 1;
82799         } else if (way.isClosed()) {
82800           index = length - 2;
82801         }
82802         if (index !== -1) {
82803           context.enter(
82804             mode.selectedIDs([way.nodes[index]]).follow(true)
82805           );
82806         }
82807       }
82808       function nextVertex(d3_event) {
82809         d3_event.preventDefault();
82810         var parentId = parentWayIdForVertexNavigation();
82811         _focusedParentWayId = parentId;
82812         if (!parentId)
82813           return;
82814         var way = context.entity(parentId);
82815         var length = way.nodes.length;
82816         var curr = way.nodes.indexOf(selectedIDs[0]);
82817         var index = -1;
82818         if (curr < length - 1) {
82819           index = curr + 1;
82820         } else if (way.isClosed()) {
82821           index = 0;
82822         }
82823         if (index !== -1) {
82824           context.enter(
82825             mode.selectedIDs([way.nodes[index]]).follow(true)
82826           );
82827         }
82828       }
82829       function focusNextParent(d3_event) {
82830         d3_event.preventDefault();
82831         var parents = parentWaysIdsOfSelection(true);
82832         if (!parents || parents.length < 2)
82833           return;
82834         var index = parents.indexOf(_focusedParentWayId);
82835         if (index < 0 || index > parents.length - 2) {
82836           _focusedParentWayId = parents[0];
82837         } else {
82838           _focusedParentWayId = parents[index + 1];
82839         }
82840         var surface = context.surface();
82841         surface.selectAll(".related").classed("related", false);
82842         if (_focusedParentWayId) {
82843           surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
82844         }
82845       }
82846       function selectParent(d3_event) {
82847         d3_event.preventDefault();
82848         var currentSelectedIds = mode.selectedIDs();
82849         var parentIds = _focusedParentWayId ? [_focusedParentWayId] : parentWaysIdsOfSelection(false);
82850         if (!parentIds.length)
82851           return;
82852         context.enter(
82853           mode.selectedIDs(parentIds)
82854         );
82855         _focusedVertexIds = currentSelectedIds;
82856       }
82857       function selectChild(d3_event) {
82858         d3_event.preventDefault();
82859         var currentSelectedIds = mode.selectedIDs();
82860         var childIds = _focusedVertexIds ? _focusedVertexIds.filter((id2) => context.hasEntity(id2)) : childNodeIdsOfSelection(true);
82861         if (!childIds || !childIds.length)
82862           return;
82863         if (currentSelectedIds.length === 1)
82864           _focusedParentWayId = currentSelectedIds[0];
82865         context.enter(
82866           mode.selectedIDs(childIds)
82867         );
82868       }
82869     };
82870     mode.exit = function() {
82871       _newFeature = false;
82872       _focusedVertexIds = null;
82873       _operations.forEach(function(operation) {
82874         if (operation.behavior) {
82875           context.uninstall(operation.behavior);
82876         }
82877       });
82878       _operations = [];
82879       _behaviors.forEach(context.uninstall);
82880       select_default2(document).call(keybinding.unbind);
82881       context.ui().closeEditMenu();
82882       context.history().on("change.select", null).on("undone.select", null).on("redone.select", null);
82883       var surface = context.surface();
82884       surface.selectAll(".selected-member").classed("selected-member", false);
82885       surface.selectAll(".selected").classed("selected", false);
82886       surface.selectAll(".highlighted").classed("highlighted", false);
82887       surface.selectAll(".related").classed("related", false);
82888       context.map().on("drawn.select", null);
82889       context.ui().sidebar.hide();
82890       context.features().forceVisible([]);
82891       var entity = singular();
82892       if (_newFeature && entity && entity.type === "relation" && // no tags
82893       Object.keys(entity.tags).length === 0 && // no parent relations
82894       context.graph().parentRelations(entity).length === 0 && // no members or one member with no role
82895       (entity.members.length === 0 || entity.members.length === 1 && !entity.members[0].role)) {
82896         var deleteAction = actionDeleteRelation(
82897           entity.id,
82898           true
82899           /* don't delete untagged members */
82900         );
82901         context.perform(deleteAction, _t("operations.delete.annotation.relation"));
82902         context.validator().validate();
82903       }
82904     };
82905     return mode;
82906   }
82907
82908   // modules/behavior/lasso.js
82909   function behaviorLasso(context) {
82910     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
82911     var behavior = function(selection2) {
82912       var lasso;
82913       function pointerdown(d3_event) {
82914         var button = 0;
82915         if (d3_event.button === button && d3_event.shiftKey === true) {
82916           lasso = null;
82917           select_default2(window).on(_pointerPrefix + "move.lasso", pointermove).on(_pointerPrefix + "up.lasso", pointerup);
82918           d3_event.stopPropagation();
82919         }
82920       }
82921       function pointermove() {
82922         if (!lasso) {
82923           lasso = uiLasso(context);
82924           context.surface().call(lasso);
82925         }
82926         lasso.p(context.map().mouse());
82927       }
82928       function normalize2(a2, b2) {
82929         return [
82930           [Math.min(a2[0], b2[0]), Math.min(a2[1], b2[1])],
82931           [Math.max(a2[0], b2[0]), Math.max(a2[1], b2[1])]
82932         ];
82933       }
82934       function lassoed() {
82935         if (!lasso)
82936           return [];
82937         var graph = context.graph();
82938         var limitToNodes;
82939         if (context.map().editableDataEnabled(
82940           true
82941           /* skipZoomCheck */
82942         ) && context.map().isInWideSelection()) {
82943           limitToNodes = new Set(utilGetAllNodes(context.selectedIDs(), graph));
82944         } else if (!context.map().editableDataEnabled()) {
82945           return [];
82946         }
82947         var bounds = lasso.extent().map(context.projection.invert);
82948         var extent = geoExtent(normalize2(bounds[0], bounds[1]));
82949         var intersects = context.history().intersects(extent).filter(function(entity) {
82950           return entity.type === "node" && (!limitToNodes || limitToNodes.has(entity)) && geoPointInPolygon(context.projection(entity.loc), lasso.coordinates) && !context.features().isHidden(entity, graph, entity.geometry(graph));
82951         });
82952         intersects.sort(function(node1, node2) {
82953           var parents1 = graph.parentWays(node1);
82954           var parents2 = graph.parentWays(node2);
82955           if (parents1.length && parents2.length) {
82956             var sharedParents = utilArrayIntersection(parents1, parents2);
82957             if (sharedParents.length) {
82958               var sharedParentNodes = sharedParents[0].nodes;
82959               return sharedParentNodes.indexOf(node1.id) - sharedParentNodes.indexOf(node2.id);
82960             } else {
82961               return Number(parents1[0].id.slice(1)) - Number(parents2[0].id.slice(1));
82962             }
82963           } else if (parents1.length || parents2.length) {
82964             return parents1.length - parents2.length;
82965           }
82966           return node1.loc[0] - node2.loc[0];
82967         });
82968         return intersects.map(function(entity) {
82969           return entity.id;
82970         });
82971       }
82972       function pointerup() {
82973         select_default2(window).on(_pointerPrefix + "move.lasso", null).on(_pointerPrefix + "up.lasso", null);
82974         if (!lasso)
82975           return;
82976         var ids = lassoed();
82977         lasso.close();
82978         if (ids.length) {
82979           context.enter(modeSelect(context, ids));
82980         }
82981       }
82982       selection2.on(_pointerPrefix + "down.lasso", pointerdown);
82983     };
82984     behavior.off = function(selection2) {
82985       selection2.on(_pointerPrefix + "down.lasso", null);
82986     };
82987     return behavior;
82988   }
82989
82990   // modules/modes/browse.js
82991   function modeBrowse(context) {
82992     var mode = {
82993       button: "browse",
82994       id: "browse",
82995       title: _t.append("modes.browse.title"),
82996       description: _t.append("modes.browse.description")
82997     };
82998     var sidebar;
82999     var _selectBehavior;
83000     var _behaviors = [];
83001     mode.selectBehavior = function(val) {
83002       if (!arguments.length)
83003         return _selectBehavior;
83004       _selectBehavior = val;
83005       return mode;
83006     };
83007     mode.enter = function() {
83008       if (!_behaviors.length) {
83009         if (!_selectBehavior)
83010           _selectBehavior = behaviorSelect(context);
83011         _behaviors = [
83012           behaviorPaste(context),
83013           behaviorHover(context).on("hover", context.ui().sidebar.hover),
83014           _selectBehavior,
83015           behaviorLasso(context),
83016           modeDragNode(context).behavior,
83017           modeDragNote(context).behavior
83018         ];
83019       }
83020       _behaviors.forEach(context.install);
83021       if (document.activeElement && document.activeElement.blur) {
83022         document.activeElement.blur();
83023       }
83024       if (sidebar) {
83025         context.ui().sidebar.show(sidebar);
83026       } else {
83027         context.ui().sidebar.select(null);
83028       }
83029     };
83030     mode.exit = function() {
83031       context.ui().sidebar.hover.cancel();
83032       _behaviors.forEach(context.uninstall);
83033       if (sidebar) {
83034         context.ui().sidebar.hide();
83035       }
83036     };
83037     mode.sidebar = function(_2) {
83038       if (!arguments.length)
83039         return sidebar;
83040       sidebar = _2;
83041       return mode;
83042     };
83043     mode.operations = function() {
83044       return [operationPaste(context)];
83045     };
83046     return mode;
83047   }
83048
83049   // modules/behavior/add_way.js
83050   function behaviorAddWay(context) {
83051     var dispatch14 = dispatch_default("start", "startFromWay", "startFromNode");
83052     var draw = behaviorDraw(context);
83053     function behavior(surface) {
83054       draw.on("click", function() {
83055         dispatch14.apply("start", this, arguments);
83056       }).on("clickWay", function() {
83057         dispatch14.apply("startFromWay", this, arguments);
83058       }).on("clickNode", function() {
83059         dispatch14.apply("startFromNode", this, arguments);
83060       }).on("cancel", behavior.cancel).on("finish", behavior.cancel);
83061       context.map().dblclickZoomEnable(false);
83062       surface.call(draw);
83063     }
83064     behavior.off = function(surface) {
83065       surface.call(draw.off);
83066     };
83067     behavior.cancel = function() {
83068       window.setTimeout(function() {
83069         context.map().dblclickZoomEnable(true);
83070       }, 1e3);
83071       context.enter(modeBrowse(context));
83072     };
83073     return utilRebind(behavior, dispatch14, "on");
83074   }
83075
83076   // modules/behavior/hash.js
83077   function behaviorHash(context) {
83078     var _cachedHash = null;
83079     var _latitudeLimit = 90 - 1e-8;
83080     function computedHashParameters() {
83081       var map2 = context.map();
83082       var center = map2.center();
83083       var zoom = map2.zoom();
83084       var precision2 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
83085       var oldParams = utilObjectOmit(
83086         utilStringQs(window.location.hash),
83087         ["comment", "source", "hashtags", "walkthrough"]
83088       );
83089       var newParams = {};
83090       delete oldParams.id;
83091       var selected = context.selectedIDs().filter(function(id2) {
83092         return context.hasEntity(id2);
83093       });
83094       if (selected.length) {
83095         newParams.id = selected.join(",");
83096       }
83097       newParams.map = zoom.toFixed(2) + "/" + center[1].toFixed(precision2) + "/" + center[0].toFixed(precision2);
83098       return Object.assign(oldParams, newParams);
83099     }
83100     function computedHash() {
83101       return "#" + utilQsString(computedHashParameters(), true);
83102     }
83103     function computedTitle(includeChangeCount) {
83104       var baseTitle = context.documentTitleBase() || "iD";
83105       var contextual;
83106       var changeCount;
83107       var titleID;
83108       var selected = context.selectedIDs().filter(function(id2) {
83109         return context.hasEntity(id2);
83110       });
83111       if (selected.length) {
83112         var firstLabel = utilDisplayLabel(context.entity(selected[0]), context.graph());
83113         if (selected.length > 1) {
83114           contextual = _t("title.labeled_and_more", {
83115             labeled: firstLabel,
83116             count: selected.length - 1
83117           });
83118         } else {
83119           contextual = firstLabel;
83120         }
83121         titleID = "context";
83122       }
83123       if (includeChangeCount) {
83124         changeCount = context.history().difference().summary().length;
83125         if (changeCount > 0) {
83126           titleID = contextual ? "changes_context" : "changes";
83127         }
83128       }
83129       if (titleID) {
83130         return _t("title.format." + titleID, {
83131           changes: changeCount,
83132           base: baseTitle,
83133           context: contextual
83134         });
83135       }
83136       return baseTitle;
83137     }
83138     function updateTitle(includeChangeCount) {
83139       if (!context.setsDocumentTitle())
83140         return;
83141       var newTitle = computedTitle(includeChangeCount);
83142       if (document.title !== newTitle) {
83143         document.title = newTitle;
83144       }
83145     }
83146     function updateHashIfNeeded() {
83147       if (context.inIntro())
83148         return;
83149       var latestHash = computedHash();
83150       if (_cachedHash !== latestHash) {
83151         _cachedHash = latestHash;
83152         window.history.replaceState(null, computedTitle(
83153           false
83154           /* includeChangeCount */
83155         ), latestHash);
83156         updateTitle(
83157           true
83158           /* includeChangeCount */
83159         );
83160         const q2 = utilStringQs(latestHash);
83161         if (q2.map) {
83162           corePreferences("map-location", q2.map);
83163         }
83164       }
83165     }
83166     var _throttledUpdate = throttle_default(updateHashIfNeeded, 500);
83167     var _throttledUpdateTitle = throttle_default(function() {
83168       updateTitle(
83169         true
83170         /* includeChangeCount */
83171       );
83172     }, 500);
83173     function hashchange() {
83174       if (window.location.hash === _cachedHash)
83175         return;
83176       _cachedHash = window.location.hash;
83177       var q2 = utilStringQs(_cachedHash);
83178       var mapArgs = (q2.map || "").split("/").map(Number);
83179       if (mapArgs.length < 3 || mapArgs.some(isNaN)) {
83180         updateHashIfNeeded();
83181       } else {
83182         if (_cachedHash === computedHash())
83183           return;
83184         var mode = context.mode();
83185         context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
83186         if (q2.id && mode) {
83187           var ids = q2.id.split(",").filter(function(id2) {
83188             return context.hasEntity(id2);
83189           });
83190           if (ids.length && (mode.id === "browse" || mode.id === "select" && !utilArrayIdentical(mode.selectedIDs(), ids))) {
83191             context.enter(modeSelect(context, ids));
83192             return;
83193           }
83194         }
83195         var center = context.map().center();
83196         var dist = geoSphericalDistance(center, [mapArgs[2], mapArgs[1]]);
83197         var maxdist = 500;
83198         if (mode && mode.id.match(/^draw/) !== null && dist > maxdist) {
83199           context.enter(modeBrowse(context));
83200           return;
83201         }
83202       }
83203     }
83204     function behavior() {
83205       context.map().on("move.behaviorHash", _throttledUpdate);
83206       context.history().on("change.behaviorHash", _throttledUpdateTitle);
83207       context.on("enter.behaviorHash", _throttledUpdate);
83208       select_default2(window).on("hashchange.behaviorHash", hashchange);
83209       var q2 = utilStringQs(window.location.hash);
83210       if (q2.id) {
83211         context.zoomToEntity(q2.id.split(",")[0], !q2.map);
83212       }
83213       if (q2.walkthrough === "true") {
83214         behavior.startWalkthrough = true;
83215       }
83216       if (q2.map) {
83217         behavior.hadLocation = true;
83218       } else if (!q2.id && corePreferences("map-location")) {
83219         const mapArgs = corePreferences("map-location").split("/").map(Number);
83220         context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
83221         updateHashIfNeeded();
83222         behavior.hadLocation = true;
83223       }
83224       hashchange();
83225       updateTitle(false);
83226     }
83227     behavior.off = function() {
83228       _throttledUpdate.cancel();
83229       _throttledUpdateTitle.cancel();
83230       context.map().on("move.behaviorHash", null);
83231       context.on("enter.behaviorHash", null);
83232       select_default2(window).on("hashchange.behaviorHash", null);
83233       window.location.hash = "";
83234     };
83235     return behavior;
83236   }
83237
83238   // node_modules/d3-brush/src/brush.js
83239   var { abs: abs2, max: max2, min: min2 } = Math;
83240   function number1(e3) {
83241     return [+e3[0], +e3[1]];
83242   }
83243   function number22(e3) {
83244     return [number1(e3[0]), number1(e3[1])];
83245   }
83246   var X3 = {
83247     name: "x",
83248     handles: ["w", "e"].map(type),
83249     input: function(x2, e3) {
83250       return x2 == null ? null : [[+x2[0], e3[0][1]], [+x2[1], e3[1][1]]];
83251     },
83252     output: function(xy) {
83253       return xy && [xy[0][0], xy[1][0]];
83254     }
83255   };
83256   var Y3 = {
83257     name: "y",
83258     handles: ["n", "s"].map(type),
83259     input: function(y2, e3) {
83260       return y2 == null ? null : [[e3[0][0], +y2[0]], [e3[1][0], +y2[1]]];
83261     },
83262     output: function(xy) {
83263       return xy && [xy[0][1], xy[1][1]];
83264     }
83265   };
83266   var XY = {
83267     name: "xy",
83268     handles: ["n", "w", "e", "s", "nw", "ne", "sw", "se"].map(type),
83269     input: function(xy) {
83270       return xy == null ? null : number22(xy);
83271     },
83272     output: function(xy) {
83273       return xy;
83274     }
83275   };
83276   function type(t2) {
83277     return { type: t2 };
83278   }
83279
83280   // modules/index.js
83281   var debug = false;
83282   var d3 = {
83283     dispatch: dispatch_default,
83284     geoMercator: mercator_default,
83285     geoProjection: projection,
83286     polygonArea: area_default3,
83287     polygonCentroid: centroid_default2,
83288     select: select_default2,
83289     selectAll: selectAll_default2,
83290     timerFlush
83291   };
83292
83293   // modules/id.js
83294   window.requestIdleCallback = window.requestIdleCallback || function(cb) {
83295     var start2 = Date.now();
83296     return window.requestAnimationFrame(function() {
83297       cb({
83298         didTimeout: false,
83299         timeRemaining: function() {
83300           return Math.max(0, 50 - (Date.now() - start2));
83301         }
83302       });
83303     });
83304   };
83305   window.cancelIdleCallback = window.cancelIdleCallback || function(id2) {
83306     window.cancelAnimationFrame(id2);
83307   };
83308   window.iD = modules_exports;
83309 })();
83310 //# sourceMappingURL=iD.js.map