]> git.openstreetmap.org Git - rails.git/blob - vendor/assets/iD/iD.js
Merge remote-tracking branch 'upstream/pull/5064'
[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 __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9   var __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, {
10     get: (a2, b2) => (typeof require !== "undefined" ? require : a2)[b2]
11   }) : x2)(function(x2) {
12     if (typeof require !== "undefined") return require.apply(this, arguments);
13     throw Error('Dynamic require of "' + x2 + '" is not supported');
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   var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
39
40   // node_modules/diacritics/index.js
41   var require_diacritics = __commonJS({
42     "node_modules/diacritics/index.js"(exports2) {
43       exports2.remove = removeDiacritics2;
44       var replacementList = [
45         {
46           base: " ",
47           chars: "\xA0"
48         },
49         {
50           base: "0",
51           chars: "\u07C0"
52         },
53         {
54           base: "A",
55           chars: "\u24B6\uFF21\xC0\xC1\xC2\u1EA6\u1EA4\u1EAA\u1EA8\xC3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\xC4\u01DE\u1EA2\xC5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F"
56         },
57         {
58           base: "AA",
59           chars: "\uA732"
60         },
61         {
62           base: "AE",
63           chars: "\xC6\u01FC\u01E2"
64         },
65         {
66           base: "AO",
67           chars: "\uA734"
68         },
69         {
70           base: "AU",
71           chars: "\uA736"
72         },
73         {
74           base: "AV",
75           chars: "\uA738\uA73A"
76         },
77         {
78           base: "AY",
79           chars: "\uA73C"
80         },
81         {
82           base: "B",
83           chars: "\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0181"
84         },
85         {
86           base: "C",
87           chars: "\u24B8\uFF23\uA73E\u1E08\u0106C\u0108\u010A\u010C\xC7\u0187\u023B"
88         },
89         {
90           base: "D",
91           chars: "\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018A\u0189\u1D05\uA779"
92         },
93         {
94           base: "Dh",
95           chars: "\xD0"
96         },
97         {
98           base: "DZ",
99           chars: "\u01F1\u01C4"
100         },
101         {
102           base: "Dz",
103           chars: "\u01F2\u01C5"
104         },
105         {
106           base: "E",
107           chars: "\u025B\u24BA\uFF25\xC8\xC9\xCA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\xCB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E\u1D07"
108         },
109         {
110           base: "F",
111           chars: "\uA77C\u24BB\uFF26\u1E1E\u0191\uA77B"
112         },
113         {
114           base: "G",
115           chars: "\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E\u0262"
116         },
117         {
118           base: "H",
119           chars: "\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D"
120         },
121         {
122           base: "I",
123           chars: "\u24BE\uFF29\xCC\xCD\xCE\u0128\u012A\u012C\u0130\xCF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197"
124         },
125         {
126           base: "J",
127           chars: "\u24BF\uFF2A\u0134\u0248\u0237"
128         },
129         {
130           base: "K",
131           chars: "\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2"
132         },
133         {
134           base: "L",
135           chars: "\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780"
136         },
137         {
138           base: "LJ",
139           chars: "\u01C7"
140         },
141         {
142           base: "Lj",
143           chars: "\u01C8"
144         },
145         {
146           base: "M",
147           chars: "\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C\u03FB"
148         },
149         {
150           base: "N",
151           chars: "\uA7A4\u0220\u24C3\uFF2E\u01F8\u0143\xD1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u019D\uA790\u1D0E"
152         },
153         {
154           base: "NJ",
155           chars: "\u01CA"
156         },
157         {
158           base: "Nj",
159           chars: "\u01CB"
160         },
161         {
162           base: "O",
163           chars: "\u24C4\uFF2F\xD2\xD3\xD4\u1ED2\u1ED0\u1ED6\u1ED4\xD5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\xD6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\xD8\u01FE\u0186\u019F\uA74A\uA74C"
164         },
165         {
166           base: "OE",
167           chars: "\u0152"
168         },
169         {
170           base: "OI",
171           chars: "\u01A2"
172         },
173         {
174           base: "OO",
175           chars: "\uA74E"
176         },
177         {
178           base: "OU",
179           chars: "\u0222"
180         },
181         {
182           base: "P",
183           chars: "\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754"
184         },
185         {
186           base: "Q",
187           chars: "\u24C6\uFF31\uA756\uA758\u024A"
188         },
189         {
190           base: "R",
191           chars: "\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782"
192         },
193         {
194           base: "S",
195           chars: "\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784"
196         },
197         {
198           base: "T",
199           chars: "\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786"
200         },
201         {
202           base: "Th",
203           chars: "\xDE"
204         },
205         {
206           base: "TZ",
207           chars: "\uA728"
208         },
209         {
210           base: "U",
211           chars: "\u24CA\uFF35\xD9\xDA\xDB\u0168\u1E78\u016A\u1E7A\u016C\xDC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244"
212         },
213         {
214           base: "V",
215           chars: "\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245"
216         },
217         {
218           base: "VY",
219           chars: "\uA760"
220         },
221         {
222           base: "W",
223           chars: "\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72"
224         },
225         {
226           base: "X",
227           chars: "\u24CD\uFF38\u1E8A\u1E8C"
228         },
229         {
230           base: "Y",
231           chars: "\u24CE\uFF39\u1EF2\xDD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE"
232         },
233         {
234           base: "Z",
235           chars: "\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762"
236         },
237         {
238           base: "a",
239           chars: "\u24D0\uFF41\u1E9A\xE0\xE1\xE2\u1EA7\u1EA5\u1EAB\u1EA9\xE3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\xE4\u01DF\u1EA3\xE5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250\u0251"
240         },
241         {
242           base: "aa",
243           chars: "\uA733"
244         },
245         {
246           base: "ae",
247           chars: "\xE6\u01FD\u01E3"
248         },
249         {
250           base: "ao",
251           chars: "\uA735"
252         },
253         {
254           base: "au",
255           chars: "\uA737"
256         },
257         {
258           base: "av",
259           chars: "\uA739\uA73B"
260         },
261         {
262           base: "ay",
263           chars: "\uA73D"
264         },
265         {
266           base: "b",
267           chars: "\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253\u0182"
268         },
269         {
270           base: "c",
271           chars: "\uFF43\u24D2\u0107\u0109\u010B\u010D\xE7\u1E09\u0188\u023C\uA73F\u2184"
272         },
273         {
274           base: "d",
275           chars: "\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\u018B\u13E7\u0501\uA7AA"
276         },
277         {
278           base: "dh",
279           chars: "\xF0"
280         },
281         {
282           base: "dz",
283           chars: "\u01F3\u01C6"
284         },
285         {
286           base: "e",
287           chars: "\u24D4\uFF45\xE8\xE9\xEA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\xEB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u01DD"
288         },
289         {
290           base: "f",
291           chars: "\u24D5\uFF46\u1E1F\u0192"
292         },
293         {
294           base: "ff",
295           chars: "\uFB00"
296         },
297         {
298           base: "fi",
299           chars: "\uFB01"
300         },
301         {
302           base: "fl",
303           chars: "\uFB02"
304         },
305         {
306           base: "ffi",
307           chars: "\uFB03"
308         },
309         {
310           base: "ffl",
311           chars: "\uFB04"
312         },
313         {
314           base: "g",
315           chars: "\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\uA77F\u1D79"
316         },
317         {
318           base: "h",
319           chars: "\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265"
320         },
321         {
322           base: "hv",
323           chars: "\u0195"
324         },
325         {
326           base: "i",
327           chars: "\u24D8\uFF49\xEC\xED\xEE\u0129\u012B\u012D\xEF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131"
328         },
329         {
330           base: "j",
331           chars: "\u24D9\uFF4A\u0135\u01F0\u0249"
332         },
333         {
334           base: "k",
335           chars: "\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3"
336         },
337         {
338           base: "l",
339           chars: "\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747\u026D"
340         },
341         {
342           base: "lj",
343           chars: "\u01C9"
344         },
345         {
346           base: "m",
347           chars: "\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F"
348         },
349         {
350           base: "n",
351           chars: "\u24DD\uFF4E\u01F9\u0144\xF1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5\u043B\u0509"
352         },
353         {
354           base: "nj",
355           chars: "\u01CC"
356         },
357         {
358           base: "o",
359           chars: "\u24DE\uFF4F\xF2\xF3\xF4\u1ED3\u1ED1\u1ED7\u1ED5\xF5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\xF6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\xF8\u01FF\uA74B\uA74D\u0275\u0254\u1D11"
360         },
361         {
362           base: "oe",
363           chars: "\u0153"
364         },
365         {
366           base: "oi",
367           chars: "\u01A3"
368         },
369         {
370           base: "oo",
371           chars: "\uA74F"
372         },
373         {
374           base: "ou",
375           chars: "\u0223"
376         },
377         {
378           base: "p",
379           chars: "\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755\u03C1"
380         },
381         {
382           base: "q",
383           chars: "\u24E0\uFF51\u024B\uA757\uA759"
384         },
385         {
386           base: "r",
387           chars: "\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783"
388         },
389         {
390           base: "s",
391           chars: "\u24E2\uFF53\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B\u0282"
392         },
393         {
394           base: "ss",
395           chars: "\xDF"
396         },
397         {
398           base: "t",
399           chars: "\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787"
400         },
401         {
402           base: "th",
403           chars: "\xFE"
404         },
405         {
406           base: "tz",
407           chars: "\uA729"
408         },
409         {
410           base: "u",
411           chars: "\u24E4\uFF55\xF9\xFA\xFB\u0169\u1E79\u016B\u1E7B\u016D\xFC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289"
412         },
413         {
414           base: "v",
415           chars: "\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C"
416         },
417         {
418           base: "vy",
419           chars: "\uA761"
420         },
421         {
422           base: "w",
423           chars: "\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73"
424         },
425         {
426           base: "x",
427           chars: "\u24E7\uFF58\u1E8B\u1E8D"
428         },
429         {
430           base: "y",
431           chars: "\u24E8\uFF59\u1EF3\xFD\u0177\u1EF9\u0233\u1E8F\xFF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF"
432         },
433         {
434           base: "z",
435           chars: "\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763"
436         }
437       ];
438       var diacriticsMap = {};
439       for (i3 = 0; i3 < replacementList.length; i3 += 1) {
440         chars = replacementList[i3].chars;
441         for (j2 = 0; j2 < chars.length; j2 += 1) {
442           diacriticsMap[chars[j2]] = replacementList[i3].base;
443         }
444       }
445       var chars;
446       var j2;
447       var i3;
448       function removeDiacritics2(str) {
449         return str.replace(/[^\u0000-\u007e]/g, function(c2) {
450           return diacriticsMap[c2] || c2;
451         });
452       }
453       exports2.replacementList = replacementList;
454       exports2.diacriticsMap = diacriticsMap;
455     }
456   });
457
458   // node_modules/alif-toolkit/lib/isArabic.js
459   var require_isArabic = __commonJS({
460     "node_modules/alif-toolkit/lib/isArabic.js"(exports2) {
461       "use strict";
462       Object.defineProperty(exports2, "__esModule", { value: true });
463       exports2.isArabic = isArabic;
464       exports2.isMath = isMath;
465       var arabicBlocks = [
466         [1536, 1791],
467         // Arabic https://www.unicode.org/charts/PDF/U0600.pdf
468         [1872, 1919],
469         // supplement https://www.unicode.org/charts/PDF/U0750.pdf
470         [2208, 2303],
471         // Extended-A https://www.unicode.org/charts/PDF/U08A0.pdf
472         [64336, 65023],
473         // Presentation Forms-A https://www.unicode.org/charts/PDF/UFB50.pdf
474         [65136, 65279],
475         // Presentation Forms-B https://www.unicode.org/charts/PDF/UFE70.pdf
476         [69216, 69247],
477         // Rumi numerals https://www.unicode.org/charts/PDF/U10E60.pdf
478         [126064, 126143],
479         // Indic Siyaq numerals https://www.unicode.org/charts/PDF/U1EC70.pdf
480         [126464, 126719]
481         // Mathematical Alphabetic symbols https://www.unicode.org/charts/PDF/U1EE00.pdf
482       ];
483       function isArabic(char) {
484         if (char.length > 1) {
485           throw new Error("isArabic works on only one-character strings");
486         }
487         let code = char.charCodeAt(0);
488         for (let i3 = 0; i3 < arabicBlocks.length; i3++) {
489           let block2 = arabicBlocks[i3];
490           if (code >= block2[0] && code <= block2[1]) {
491             return true;
492           }
493         }
494         return false;
495       }
496       function isMath(char) {
497         if (char.length > 2) {
498           throw new Error("isMath works on only one-character strings");
499         }
500         let code = char.charCodeAt(0);
501         return code >= 1632 && code <= 1644 || code >= 1776 && code <= 1785;
502       }
503     }
504   });
505
506   // node_modules/alif-toolkit/lib/unicode-arabic.js
507   var require_unicode_arabic = __commonJS({
508     "node_modules/alif-toolkit/lib/unicode-arabic.js"(exports2) {
509       "use strict";
510       Object.defineProperty(exports2, "__esModule", { value: true });
511       var arabicReference = {
512         "alef": {
513           "normal": [
514             "\u0627"
515           ],
516           "madda_above": {
517             "normal": [
518               "\u0627\u0653",
519               "\u0622"
520             ],
521             "isolated": "\uFE81",
522             "final": "\uFE82"
523           },
524           "hamza_above": {
525             "normal": [
526               "\u0627\u0654",
527               "\u0623"
528             ],
529             "isolated": "\uFE83",
530             "final": "\uFE84"
531           },
532           "hamza_below": {
533             "normal": [
534               "\u0627\u0655",
535               "\u0625"
536             ],
537             "isolated": "\uFE87",
538             "final": "\uFE88"
539           },
540           "wasla": {
541             "normal": "\u0671",
542             "isolated": "\uFB50",
543             "final": "\uFB51"
544           },
545           "wavy_hamza_above": [
546             "\u0672"
547           ],
548           "wavy_hamza_below": [
549             "\u0627\u065F",
550             "\u0673"
551           ],
552           "high_hamza": [
553             "\u0675",
554             "\u0627\u0674"
555           ],
556           "indic_two_above": [
557             "\u0773"
558           ],
559           "indic_three_above": [
560             "\u0774"
561           ],
562           "fathatan": {
563             "normal": [
564               "\u0627\u064B"
565             ],
566             "final": "\uFD3C",
567             "isolated": "\uFD3D"
568           },
569           "isolated": "\uFE8D",
570           "final": "\uFE8E"
571         },
572         "beh": {
573           "normal": [
574             "\u0628"
575           ],
576           "dotless": [
577             "\u066E"
578           ],
579           "three_dots_horizontally_below": [
580             "\u0750"
581           ],
582           "dot_below_three_dots_above": [
583             "\u0751"
584           ],
585           "three_dots_pointing_upwards_below": [
586             "\u0752"
587           ],
588           "three_dots_pointing_upwards_below_two_dots_above": [
589             "\u0753"
590           ],
591           "two_dots_below_dot_above": [
592             "\u0754"
593           ],
594           "inverted_small_v_below": [
595             "\u0755"
596           ],
597           "small_v": [
598             "\u0756"
599           ],
600           "small_v_below": [
601             "\u08A0"
602           ],
603           "hamza_above": [
604             "\u08A1"
605           ],
606           "small_meem_above": [
607             "\u08B6"
608           ],
609           "isolated": "\uFE8F",
610           "final": "\uFE90",
611           "initial": "\uFE91",
612           "medial": "\uFE92"
613         },
614         "teh marbuta": {
615           "normal": [
616             "\u0629"
617           ],
618           "isolated": "\uFE93",
619           "final": "\uFE94"
620         },
621         "teh": {
622           "normal": [
623             "\u062A"
624           ],
625           "ring": [
626             "\u067C"
627           ],
628           "three_dots_above_downwards": [
629             "\u067D"
630           ],
631           "small_teh_above": [
632             "\u08B8"
633           ],
634           "isolated": "\uFE95",
635           "final": "\uFE96",
636           "initial": "\uFE97",
637           "medial": "\uFE98"
638         },
639         "theh": {
640           "normal": [
641             "\u062B"
642           ],
643           "isolated": "\uFE99",
644           "final": "\uFE9A",
645           "initial": "\uFE9B",
646           "medial": "\uFE9C"
647         },
648         "jeem": {
649           "normal": [
650             "\u062C"
651           ],
652           "two_dots_above": [
653             "\u08A2"
654           ],
655           "isolated": "\uFE9D",
656           "final": "\uFE9E",
657           "initial": "\uFE9F",
658           "medial": "\uFEA0"
659         },
660         "hah": {
661           "normal": [
662             "\u062D"
663           ],
664           "hamza_above": [
665             "\u0681"
666           ],
667           "two_dots_vertical_above": [
668             "\u0682"
669           ],
670           "three_dots_above": [
671             "\u0685"
672           ],
673           "two_dots_above": [
674             "\u0757"
675           ],
676           "three_dots_pointing_upwards_below": [
677             "\u0758"
678           ],
679           "small_tah_below": [
680             "\u076E"
681           ],
682           "small_tah_two_dots": [
683             "\u076F"
684           ],
685           "small_tah_above": [
686             "\u0772"
687           ],
688           "indic_four_below": [
689             "\u077C"
690           ],
691           "isolated": "\uFEA1",
692           "final": "\uFEA2",
693           "initial": "\uFEA3",
694           "medial": "\uFEA4"
695         },
696         "khah": {
697           "normal": [
698             "\u062E"
699           ],
700           "isolated": "\uFEA5",
701           "final": "\uFEA6",
702           "initial": "\uFEA7",
703           "medial": "\uFEA8"
704         },
705         "dal": {
706           "normal": [
707             "\u062F"
708           ],
709           "ring": [
710             "\u0689"
711           ],
712           "dot_below": [
713             "\u068A"
714           ],
715           "dot_below_small_tah": [
716             "\u068B"
717           ],
718           "three_dots_above_downwards": [
719             "\u068F"
720           ],
721           "four_dots_above": [
722             "\u0690"
723           ],
724           "inverted_v": [
725             "\u06EE"
726           ],
727           "two_dots_vertically_below_small_tah": [
728             "\u0759"
729           ],
730           "inverted_small_v_below": [
731             "\u075A"
732           ],
733           "three_dots_below": [
734             "\u08AE"
735           ],
736           "isolated": "\uFEA9",
737           "final": "\uFEAA"
738         },
739         "thal": {
740           "normal": [
741             "\u0630"
742           ],
743           "isolated": "\uFEAB",
744           "final": "\uFEAC"
745         },
746         "reh": {
747           "normal": [
748             "\u0631"
749           ],
750           "small_v": [
751             "\u0692"
752           ],
753           "ring": [
754             "\u0693"
755           ],
756           "dot_below": [
757             "\u0694"
758           ],
759           "small_v_below": [
760             "\u0695"
761           ],
762           "dot_below_dot_above": [
763             "\u0696"
764           ],
765           "two_dots_above": [
766             "\u0697"
767           ],
768           "four_dots_above": [
769             "\u0699"
770           ],
771           "inverted_v": [
772             "\u06EF"
773           ],
774           "stroke": [
775             "\u075B"
776           ],
777           "two_dots_vertically_above": [
778             "\u076B"
779           ],
780           "hamza_above": [
781             "\u076C"
782           ],
783           "small_tah_two_dots": [
784             "\u0771"
785           ],
786           "loop": [
787             "\u08AA"
788           ],
789           "small_noon_above": [
790             "\u08B9"
791           ],
792           "isolated": "\uFEAD",
793           "final": "\uFEAE"
794         },
795         "zain": {
796           "normal": [
797             "\u0632"
798           ],
799           "inverted_v_above": [
800             "\u08B2"
801           ],
802           "isolated": "\uFEAF",
803           "final": "\uFEB0"
804         },
805         "seen": {
806           "normal": [
807             "\u0633"
808           ],
809           "dot_below_dot_above": [
810             "\u069A"
811           ],
812           "three_dots_below": [
813             "\u069B"
814           ],
815           "three_dots_below_three_dots_above": [
816             "\u069C"
817           ],
818           "four_dots_above": [
819             "\u075C"
820           ],
821           "two_dots_vertically_above": [
822             "\u076D"
823           ],
824           "small_tah_two_dots": [
825             "\u0770"
826           ],
827           "indic_four_above": [
828             "\u077D"
829           ],
830           "inverted_v": [
831             "\u077E"
832           ],
833           "isolated": "\uFEB1",
834           "final": "\uFEB2",
835           "initial": "\uFEB3",
836           "medial": "\uFEB4"
837         },
838         "sheen": {
839           "normal": [
840             "\u0634"
841           ],
842           "dot_below": [
843             "\u06FA"
844           ],
845           "isolated": "\uFEB5",
846           "final": "\uFEB6",
847           "initial": "\uFEB7",
848           "medial": "\uFEB8"
849         },
850         "sad": {
851           "normal": [
852             "\u0635"
853           ],
854           "two_dots_below": [
855             "\u069D"
856           ],
857           "three_dots_above": [
858             "\u069E"
859           ],
860           "three_dots_below": [
861             "\u08AF"
862           ],
863           "isolated": "\uFEB9",
864           "final": "\uFEBA",
865           "initial": "\uFEBB",
866           "medial": "\uFEBC"
867         },
868         "dad": {
869           "normal": [
870             "\u0636"
871           ],
872           "dot_below": [
873             "\u06FB"
874           ],
875           "isolated": "\uFEBD",
876           "final": "\uFEBE",
877           "initial": "\uFEBF",
878           "medial": "\uFEC0"
879         },
880         "tah": {
881           "normal": [
882             "\u0637"
883           ],
884           "three_dots_above": [
885             "\u069F"
886           ],
887           "two_dots_above": [
888             "\u08A3"
889           ],
890           "isolated": "\uFEC1",
891           "final": "\uFEC2",
892           "initial": "\uFEC3",
893           "medial": "\uFEC4"
894         },
895         "zah": {
896           "normal": [
897             "\u0638"
898           ],
899           "isolated": "\uFEC5",
900           "final": "\uFEC6",
901           "initial": "\uFEC7",
902           "medial": "\uFEC8"
903         },
904         "ain": {
905           "normal": [
906             "\u0639"
907           ],
908           "three_dots_above": [
909             "\u06A0"
910           ],
911           "two_dots_above": [
912             "\u075D"
913           ],
914           "three_dots_pointing_downwards_above": [
915             "\u075E"
916           ],
917           "two_dots_vertically_above": [
918             "\u075F"
919           ],
920           "three_dots_below": [
921             "\u08B3"
922           ],
923           "isolated": "\uFEC9",
924           "final": "\uFECA",
925           "initial": "\uFECB",
926           "medial": "\uFECC"
927         },
928         "ghain": {
929           "normal": [
930             "\u063A"
931           ],
932           "dot_below": [
933             "\u06FC"
934           ],
935           "isolated": "\uFECD",
936           "final": "\uFECE",
937           "initial": "\uFECF",
938           "medial": "\uFED0"
939         },
940         "feh": {
941           "normal": [
942             "\u0641"
943           ],
944           "dotless": [
945             "\u06A1"
946           ],
947           "dot_moved_below": [
948             "\u06A2"
949           ],
950           "dot_below": [
951             "\u06A3"
952           ],
953           "three_dots_below": [
954             "\u06A5"
955           ],
956           "two_dots_below": [
957             "\u0760"
958           ],
959           "three_dots_pointing_upwards_below": [
960             "\u0761"
961           ],
962           "dot_below_three_dots_above": [
963             "\u08A4"
964           ],
965           "isolated": "\uFED1",
966           "final": "\uFED2",
967           "initial": "\uFED3",
968           "medial": "\uFED4"
969         },
970         "qaf": {
971           "normal": [
972             "\u0642"
973           ],
974           "dotless": [
975             "\u066F"
976           ],
977           "dot_above": [
978             "\u06A7"
979           ],
980           "three_dots_above": [
981             "\u06A8"
982           ],
983           "dot_below": [
984             "\u08A5"
985           ],
986           "isolated": "\uFED5",
987           "final": "\uFED6",
988           "initial": "\uFED7",
989           "medial": "\uFED8"
990         },
991         "kaf": {
992           "normal": [
993             "\u0643"
994           ],
995           "swash": [
996             "\u06AA"
997           ],
998           "ring": [
999             "\u06AB"
1000           ],
1001           "dot_above": [
1002             "\u06AC"
1003           ],
1004           "three_dots_below": [
1005             "\u06AE"
1006           ],
1007           "two_dots_above": [
1008             "\u077F"
1009           ],
1010           "dot_below": [
1011             "\u08B4"
1012           ],
1013           "isolated": "\uFED9",
1014           "final": "\uFEDA",
1015           "initial": "\uFEDB",
1016           "medial": "\uFEDC"
1017         },
1018         "lam": {
1019           "normal": [
1020             "\u0644"
1021           ],
1022           "small_v": [
1023             "\u06B5"
1024           ],
1025           "dot_above": [
1026             "\u06B6"
1027           ],
1028           "three_dots_above": [
1029             "\u06B7"
1030           ],
1031           "three_dots_below": [
1032             "\u06B8"
1033           ],
1034           "bar": [
1035             "\u076A"
1036           ],
1037           "double_bar": [
1038             "\u08A6"
1039           ],
1040           "isolated": "\uFEDD",
1041           "final": "\uFEDE",
1042           "initial": "\uFEDF",
1043           "medial": "\uFEE0"
1044         },
1045         "meem": {
1046           "normal": [
1047             "\u0645"
1048           ],
1049           "dot_above": [
1050             "\u0765"
1051           ],
1052           "dot_below": [
1053             "\u0766"
1054           ],
1055           "three_dots_above": [
1056             "\u08A7"
1057           ],
1058           "isolated": "\uFEE1",
1059           "final": "\uFEE2",
1060           "initial": "\uFEE3",
1061           "medial": "\uFEE4"
1062         },
1063         "noon": {
1064           "normal": [
1065             "\u0646"
1066           ],
1067           "dot_below": [
1068             "\u06B9"
1069           ],
1070           "ring": [
1071             "\u06BC"
1072           ],
1073           "three_dots_above": [
1074             "\u06BD"
1075           ],
1076           "two_dots_below": [
1077             "\u0767"
1078           ],
1079           "small_tah": [
1080             "\u0768"
1081           ],
1082           "small_v": [
1083             "\u0769"
1084           ],
1085           "isolated": "\uFEE5",
1086           "final": "\uFEE6",
1087           "initial": "\uFEE7",
1088           "medial": "\uFEE8"
1089         },
1090         "heh": {
1091           "normal": [
1092             "\u0647"
1093           ],
1094           "isolated": "\uFEE9",
1095           "final": "\uFEEA",
1096           "initial": "\uFEEB",
1097           "medial": "\uFEEC"
1098         },
1099         "waw": {
1100           "normal": [
1101             "\u0648"
1102           ],
1103           "hamza_above": {
1104             "normal": [
1105               "\u0624",
1106               "\u0648\u0654"
1107             ],
1108             "isolated": "\uFE85",
1109             "final": "\uFE86"
1110           },
1111           "high_hamza": [
1112             "\u0676",
1113             "\u0648\u0674"
1114           ],
1115           "ring": [
1116             "\u06C4"
1117           ],
1118           "two_dots_above": [
1119             "\u06CA"
1120           ],
1121           "dot_above": [
1122             "\u06CF"
1123           ],
1124           "indic_two_above": [
1125             "\u0778"
1126           ],
1127           "indic_three_above": [
1128             "\u0779"
1129           ],
1130           "dot_within": [
1131             "\u08AB"
1132           ],
1133           "isolated": "\uFEED",
1134           "final": "\uFEEE"
1135         },
1136         "alef_maksura": {
1137           "normal": [
1138             "\u0649"
1139           ],
1140           "hamza_above": [
1141             "\u0626",
1142             "\u064A\u0654"
1143           ],
1144           "initial": "\uFBE8",
1145           "medial": "\uFBE9",
1146           "isolated": "\uFEEF",
1147           "final": "\uFEF0"
1148         },
1149         "yeh": {
1150           "normal": [
1151             "\u064A"
1152           ],
1153           "hamza_above": {
1154             "normal": [
1155               "\u0626",
1156               "\u0649\u0654"
1157             ],
1158             "isolated": "\uFE89",
1159             "final": "\uFE8A",
1160             "initial": "\uFE8B",
1161             "medial": "\uFE8C"
1162           },
1163           "two_dots_below_hamza_above": [
1164             "\u08A8"
1165           ],
1166           "high_hamza": [
1167             "\u0678",
1168             "\u064A\u0674"
1169           ],
1170           "tail": [
1171             "\u06CD"
1172           ],
1173           "small_v": [
1174             "\u06CE"
1175           ],
1176           "three_dots_below": [
1177             "\u06D1"
1178           ],
1179           "two_dots_below_dot_above": [
1180             "\u08A9"
1181           ],
1182           "two_dots_below_small_noon_above": [
1183             "\u08BA"
1184           ],
1185           "isolated": "\uFEF1",
1186           "final": "\uFEF2",
1187           "initial": "\uFEF3",
1188           "medial": "\uFEF4"
1189         },
1190         "tteh": {
1191           "normal": [
1192             "\u0679"
1193           ],
1194           "isolated": "\uFB66",
1195           "final": "\uFB67",
1196           "initial": "\uFB68",
1197           "medial": "\uFB69"
1198         },
1199         "tteheh": {
1200           "normal": [
1201             "\u067A"
1202           ],
1203           "isolated": "\uFB5E",
1204           "final": "\uFB5F",
1205           "initial": "\uFB60",
1206           "medial": "\uFB61"
1207         },
1208         "beeh": {
1209           "normal": [
1210             "\u067B"
1211           ],
1212           "isolated": "\uFB52",
1213           "final": "\uFB53",
1214           "initial": "\uFB54",
1215           "medial": "\uFB55"
1216         },
1217         "peh": {
1218           "normal": [
1219             "\u067E"
1220           ],
1221           "small_meem_above": [
1222             "\u08B7"
1223           ],
1224           "isolated": "\uFB56",
1225           "final": "\uFB57",
1226           "initial": "\uFB58",
1227           "medial": "\uFB59"
1228         },
1229         "teheh": {
1230           "normal": [
1231             "\u067F"
1232           ],
1233           "isolated": "\uFB62",
1234           "final": "\uFB63",
1235           "initial": "\uFB64",
1236           "medial": "\uFB65"
1237         },
1238         "beheh": {
1239           "normal": [
1240             "\u0680"
1241           ],
1242           "isolated": "\uFB5A",
1243           "final": "\uFB5B",
1244           "initial": "\uFB5C",
1245           "medial": "\uFB5D"
1246         },
1247         "nyeh": {
1248           "normal": [
1249             "\u0683"
1250           ],
1251           "isolated": "\uFB76",
1252           "final": "\uFB77",
1253           "initial": "\uFB78",
1254           "medial": "\uFB79"
1255         },
1256         "dyeh": {
1257           "normal": [
1258             "\u0684"
1259           ],
1260           "isolated": "\uFB72",
1261           "final": "\uFB73",
1262           "initial": "\uFB74",
1263           "medial": "\uFB75"
1264         },
1265         "tcheh": {
1266           "normal": [
1267             "\u0686"
1268           ],
1269           "dot_above": [
1270             "\u06BF"
1271           ],
1272           "isolated": "\uFB7A",
1273           "final": "\uFB7B",
1274           "initial": "\uFB7C",
1275           "medial": "\uFB7D"
1276         },
1277         "tcheheh": {
1278           "normal": [
1279             "\u0687"
1280           ],
1281           "isolated": "\uFB7E",
1282           "final": "\uFB7F",
1283           "initial": "\uFB80",
1284           "medial": "\uFB81"
1285         },
1286         "ddal": {
1287           "normal": [
1288             "\u0688"
1289           ],
1290           "isolated": "\uFB88",
1291           "final": "\uFB89"
1292         },
1293         "dahal": {
1294           "normal": [
1295             "\u068C"
1296           ],
1297           "isolated": "\uFB84",
1298           "final": "\uFB85"
1299         },
1300         "ddahal": {
1301           "normal": [
1302             "\u068D"
1303           ],
1304           "isolated": "\uFB82",
1305           "final": "\uFB83"
1306         },
1307         "dul": {
1308           "normal": [
1309             "\u068F",
1310             "\u068E"
1311           ],
1312           "isolated": "\uFB86",
1313           "final": "\uFB87"
1314         },
1315         "rreh": {
1316           "normal": [
1317             "\u0691"
1318           ],
1319           "isolated": "\uFB8C",
1320           "final": "\uFB8D"
1321         },
1322         "jeh": {
1323           "normal": [
1324             "\u0698"
1325           ],
1326           "isolated": "\uFB8A",
1327           "final": "\uFB8B"
1328         },
1329         "veh": {
1330           "normal": [
1331             "\u06A4"
1332           ],
1333           "isolated": "\uFB6A",
1334           "final": "\uFB6B",
1335           "initial": "\uFB6C",
1336           "medial": "\uFB6D"
1337         },
1338         "peheh": {
1339           "normal": [
1340             "\u06A6"
1341           ],
1342           "isolated": "\uFB6E",
1343           "final": "\uFB6F",
1344           "initial": "\uFB70",
1345           "medial": "\uFB71"
1346         },
1347         "keheh": {
1348           "normal": [
1349             "\u06A9"
1350           ],
1351           "dot_above": [
1352             "\u0762"
1353           ],
1354           "three_dots_above": [
1355             "\u0763"
1356           ],
1357           "three_dots_pointing_upwards_below": [
1358             "\u0764"
1359           ],
1360           "isolated": "\uFB8E",
1361           "final": "\uFB8F",
1362           "initial": "\uFB90",
1363           "medial": "\uFB91"
1364         },
1365         "ng": {
1366           "normal": [
1367             "\u06AD"
1368           ],
1369           "isolated": "\uFBD3",
1370           "final": "\uFBD4",
1371           "initial": "\uFBD5",
1372           "medial": "\uFBD6"
1373         },
1374         "gaf": {
1375           "normal": [
1376             "\u06AF"
1377           ],
1378           "ring": [
1379             "\u06B0"
1380           ],
1381           "two_dots_below": [
1382             "\u06B2"
1383           ],
1384           "three_dots_above": [
1385             "\u06B4"
1386           ],
1387           "inverted_stroke": [
1388             "\u08B0"
1389           ],
1390           "isolated": "\uFB92",
1391           "final": "\uFB93",
1392           "initial": "\uFB94",
1393           "medial": "\uFB95"
1394         },
1395         "ngoeh": {
1396           "normal": [
1397             "\u06B1"
1398           ],
1399           "isolated": "\uFB9A",
1400           "final": "\uFB9B",
1401           "initial": "\uFB9C",
1402           "medial": "\uFB9D"
1403         },
1404         "gueh": {
1405           "normal": [
1406             "\u06B3"
1407           ],
1408           "isolated": "\uFB96",
1409           "final": "\uFB97",
1410           "initial": "\uFB98",
1411           "medial": "\uFB99"
1412         },
1413         "noon ghunna": {
1414           "normal": [
1415             "\u06BA"
1416           ],
1417           "isolated": "\uFB9E",
1418           "final": "\uFB9F"
1419         },
1420         "rnoon": {
1421           "normal": [
1422             "\u06BB"
1423           ],
1424           "isolated": "\uFBA0",
1425           "final": "\uFBA1",
1426           "initial": "\uFBA2",
1427           "medial": "\uFBA3"
1428         },
1429         "heh doachashmee": {
1430           "normal": [
1431             "\u06BE"
1432           ],
1433           "isolated": "\uFBAA",
1434           "final": "\uFBAB",
1435           "initial": "\uFBAC",
1436           "medial": "\uFBAD"
1437         },
1438         "heh goal": {
1439           "normal": [
1440             "\u06C1"
1441           ],
1442           "hamza_above": [
1443             "\u06C1\u0654",
1444             "\u06C2"
1445           ],
1446           "isolated": "\uFBA6",
1447           "final": "\uFBA7",
1448           "initial": "\uFBA8",
1449           "medial": "\uFBA9"
1450         },
1451         "teh marbuta goal": {
1452           "normal": [
1453             "\u06C3"
1454           ]
1455         },
1456         "kirghiz oe": {
1457           "normal": [
1458             "\u06C5"
1459           ],
1460           "isolated": "\uFBE0",
1461           "final": "\uFBE1"
1462         },
1463         "oe": {
1464           "normal": [
1465             "\u06C6"
1466           ],
1467           "isolated": "\uFBD9",
1468           "final": "\uFBDA"
1469         },
1470         "u": {
1471           "normal": [
1472             "\u06C7"
1473           ],
1474           "hamza_above": {
1475             "normal": [
1476               "\u0677",
1477               "\u06C7\u0674"
1478             ],
1479             "isolated": "\uFBDD"
1480           },
1481           "isolated": "\uFBD7",
1482           "final": "\uFBD8"
1483         },
1484         "yu": {
1485           "normal": [
1486             "\u06C8"
1487           ],
1488           "isolated": "\uFBDB",
1489           "final": "\uFBDC"
1490         },
1491         "kirghiz yu": {
1492           "normal": [
1493             "\u06C9"
1494           ],
1495           "isolated": "\uFBE2",
1496           "final": "\uFBE3"
1497         },
1498         "ve": {
1499           "normal": [
1500             "\u06CB"
1501           ],
1502           "isolated": "\uFBDE",
1503           "final": "\uFBDF"
1504         },
1505         "farsi yeh": {
1506           "normal": [
1507             "\u06CC"
1508           ],
1509           "indic_two_above": [
1510             "\u0775"
1511           ],
1512           "indic_three_above": [
1513             "\u0776"
1514           ],
1515           "indic_four_above": [
1516             "\u0777"
1517           ],
1518           "isolated": "\uFBFC",
1519           "final": "\uFBFD",
1520           "initial": "\uFBFE",
1521           "medial": "\uFBFF"
1522         },
1523         "e": {
1524           "normal": [
1525             "\u06D0"
1526           ],
1527           "isolated": "\uFBE4",
1528           "final": "\uFBE5",
1529           "initial": "\uFBE6",
1530           "medial": "\uFBE7"
1531         },
1532         "yeh barree": {
1533           "normal": [
1534             "\u06D2"
1535           ],
1536           "hamza_above": {
1537             "normal": [
1538               "\u06D2\u0654",
1539               "\u06D3"
1540             ],
1541             "isolated": "\uFBB0",
1542             "final": "\uFBB1"
1543           },
1544           "indic_two_above": [
1545             "\u077A"
1546           ],
1547           "indic_three_above": [
1548             "\u077B"
1549           ],
1550           "isolated": "\uFBAE",
1551           "final": "\uFBAF"
1552         },
1553         "ae": {
1554           "normal": [
1555             "\u06D5"
1556           ],
1557           "isolated": "\u06D5",
1558           "final": "\uFEEA",
1559           "yeh_above": {
1560             "normal": [
1561               "\u06C0",
1562               "\u06D5\u0654"
1563             ],
1564             "isolated": "\uFBA4",
1565             "final": "\uFBA5"
1566           }
1567         },
1568         "rohingya yeh": {
1569           "normal": [
1570             "\u08AC"
1571           ]
1572         },
1573         "low alef": {
1574           "normal": [
1575             "\u08AD"
1576           ]
1577         },
1578         "straight waw": {
1579           "normal": [
1580             "\u08B1"
1581           ]
1582         },
1583         "african feh": {
1584           "normal": [
1585             "\u08BB"
1586           ]
1587         },
1588         "african qaf": {
1589           "normal": [
1590             "\u08BC"
1591           ]
1592         },
1593         "african noon": {
1594           "normal": [
1595             "\u08BD"
1596           ]
1597         }
1598       };
1599       exports2.default = arabicReference;
1600     }
1601   });
1602
1603   // node_modules/alif-toolkit/lib/unicode-ligatures.js
1604   var require_unicode_ligatures = __commonJS({
1605     "node_modules/alif-toolkit/lib/unicode-ligatures.js"(exports2) {
1606       "use strict";
1607       Object.defineProperty(exports2, "__esModule", { value: true });
1608       var ligatureReference = {
1609         "\u0626\u0627": {
1610           "isolated": "\uFBEA",
1611           "final": "\uFBEB"
1612         },
1613         "\u0626\u06D5": {
1614           "isolated": "\uFBEC",
1615           "final": "\uFBED"
1616         },
1617         "\u0626\u0648": {
1618           "isolated": "\uFBEE",
1619           "final": "\uFBEF"
1620         },
1621         "\u0626\u06C7": {
1622           "isolated": "\uFBF0",
1623           "final": "\uFBF1"
1624         },
1625         "\u0626\u06C6": {
1626           "isolated": "\uFBF2",
1627           "final": "\uFBF3"
1628         },
1629         "\u0626\u06C8": {
1630           "isolated": "\uFBF4",
1631           "final": "\uFBF5"
1632         },
1633         "\u0626\u06D0": {
1634           "isolated": "\uFBF6",
1635           "final": "\uFBF7",
1636           "initial": "\uFBF8"
1637         },
1638         "\u0626\u0649": {
1639           "uighur_kirghiz": {
1640             "isolated": "\uFBF9",
1641             "final": "\uFBFA",
1642             "initial": "\uFBFB"
1643           },
1644           "isolated": "\uFC03",
1645           "final": "\uFC68"
1646         },
1647         "\u0626\u062C": {
1648           "isolated": "\uFC00",
1649           "initial": "\uFC97"
1650         },
1651         "\u0626\u062D": {
1652           "isolated": "\uFC01",
1653           "initial": "\uFC98"
1654         },
1655         "\u0626\u0645": {
1656           "isolated": "\uFC02",
1657           "final": "\uFC66",
1658           "initial": "\uFC9A",
1659           "medial": "\uFCDF"
1660         },
1661         "\u0626\u064A": {
1662           "isolated": "\uFC04",
1663           "final": "\uFC69"
1664         },
1665         "\u0628\u062C": {
1666           "isolated": "\uFC05",
1667           "initial": "\uFC9C"
1668         },
1669         "\u0628\u062D": {
1670           "isolated": "\uFC06",
1671           "initial": "\uFC9D"
1672         },
1673         "\u0628\u062E": {
1674           "isolated": "\uFC07",
1675           "initial": "\uFC9E"
1676         },
1677         "\u0628\u0645": {
1678           "isolated": "\uFC08",
1679           "final": "\uFC6C",
1680           "initial": "\uFC9F",
1681           "medial": "\uFCE1"
1682         },
1683         "\u0628\u0649": {
1684           "isolated": "\uFC09",
1685           "final": "\uFC6E"
1686         },
1687         "\u0628\u064A": {
1688           "isolated": "\uFC0A",
1689           "final": "\uFC6F"
1690         },
1691         "\u062A\u062C": {
1692           "isolated": "\uFC0B",
1693           "initial": "\uFCA1"
1694         },
1695         "\u062A\u062D": {
1696           "isolated": "\uFC0C",
1697           "initial": "\uFCA2"
1698         },
1699         "\u062A\u062E": {
1700           "isolated": "\uFC0D",
1701           "initial": "\uFCA3"
1702         },
1703         "\u062A\u0645": {
1704           "isolated": "\uFC0E",
1705           "final": "\uFC72",
1706           "initial": "\uFCA4",
1707           "medial": "\uFCE3"
1708         },
1709         "\u062A\u0649": {
1710           "isolated": "\uFC0F",
1711           "final": "\uFC74"
1712         },
1713         "\u062A\u064A": {
1714           "isolated": "\uFC10",
1715           "final": "\uFC75"
1716         },
1717         "\u062B\u062C": {
1718           "isolated": "\uFC11"
1719         },
1720         "\u062B\u0645": {
1721           "isolated": "\uFC12",
1722           "final": "\uFC78",
1723           "initial": "\uFCA6",
1724           "medial": "\uFCE5"
1725         },
1726         "\u062B\u0649": {
1727           "isolated": "\uFC13",
1728           "final": "\uFC7A"
1729         },
1730         "\u062B\u0648": {
1731           "isolated": "\uFC14"
1732         },
1733         "\u062C\u062D": {
1734           "isolated": "\uFC15",
1735           "initial": "\uFCA7"
1736         },
1737         "\u062C\u0645": {
1738           "isolated": "\uFC16",
1739           "initial": "\uFCA8"
1740         },
1741         "\u062D\u062C": {
1742           "isolated": "\uFC17",
1743           "initial": "\uFCA9"
1744         },
1745         "\u062D\u0645": {
1746           "isolated": "\uFC18",
1747           "initial": "\uFCAA"
1748         },
1749         "\u062E\u062C": {
1750           "isolated": "\uFC19",
1751           "initial": "\uFCAB"
1752         },
1753         "\u062E\u062D": {
1754           "isolated": "\uFC1A"
1755         },
1756         "\u062E\u0645": {
1757           "isolated": "\uFC1B",
1758           "initial": "\uFCAC"
1759         },
1760         "\u0633\u062C": {
1761           "isolated": "\uFC1C",
1762           "initial": "\uFCAD",
1763           "medial": "\uFD34"
1764         },
1765         "\u0633\u062D": {
1766           "isolated": "\uFC1D",
1767           "initial": "\uFCAE",
1768           "medial": "\uFD35"
1769         },
1770         "\u0633\u062E": {
1771           "isolated": "\uFC1E",
1772           "initial": "\uFCAF",
1773           "medial": "\uFD36"
1774         },
1775         "\u0633\u0645": {
1776           "isolated": "\uFC1F",
1777           "initial": "\uFCB0",
1778           "medial": "\uFCE7"
1779         },
1780         "\u0635\u062D": {
1781           "isolated": "\uFC20",
1782           "initial": "\uFCB1"
1783         },
1784         "\u0635\u0645": {
1785           "isolated": "\uFC21",
1786           "initial": "\uFCB3"
1787         },
1788         "\u0636\u062C": {
1789           "isolated": "\uFC22",
1790           "initial": "\uFCB4"
1791         },
1792         "\u0636\u062D": {
1793           "isolated": "\uFC23",
1794           "initial": "\uFCB5"
1795         },
1796         "\u0636\u062E": {
1797           "isolated": "\uFC24",
1798           "initial": "\uFCB6"
1799         },
1800         "\u0636\u0645": {
1801           "isolated": "\uFC25",
1802           "initial": "\uFCB7"
1803         },
1804         "\u0637\u062D": {
1805           "isolated": "\uFC26",
1806           "initial": "\uFCB8"
1807         },
1808         "\u0637\u0645": {
1809           "isolated": "\uFC27",
1810           "initial": "\uFD33",
1811           "medial": "\uFD3A"
1812         },
1813         "\u0638\u0645": {
1814           "isolated": "\uFC28",
1815           "initial": "\uFCB9",
1816           "medial": "\uFD3B"
1817         },
1818         "\u0639\u062C": {
1819           "isolated": "\uFC29",
1820           "initial": "\uFCBA"
1821         },
1822         "\u0639\u0645": {
1823           "isolated": "\uFC2A",
1824           "initial": "\uFCBB"
1825         },
1826         "\u063A\u062C": {
1827           "isolated": "\uFC2B",
1828           "initial": "\uFCBC"
1829         },
1830         "\u063A\u0645": {
1831           "isolated": "\uFC2C",
1832           "initial": "\uFCBD"
1833         },
1834         "\u0641\u062C": {
1835           "isolated": "\uFC2D",
1836           "initial": "\uFCBE"
1837         },
1838         "\u0641\u062D": {
1839           "isolated": "\uFC2E",
1840           "initial": "\uFCBF"
1841         },
1842         "\u0641\u062E": {
1843           "isolated": "\uFC2F",
1844           "initial": "\uFCC0"
1845         },
1846         "\u0641\u0645": {
1847           "isolated": "\uFC30",
1848           "initial": "\uFCC1"
1849         },
1850         "\u0641\u0649": {
1851           "isolated": "\uFC31",
1852           "final": "\uFC7C"
1853         },
1854         "\u0641\u064A": {
1855           "isolated": "\uFC32",
1856           "final": "\uFC7D"
1857         },
1858         "\u0642\u062D": {
1859           "isolated": "\uFC33",
1860           "initial": "\uFCC2"
1861         },
1862         "\u0642\u0645": {
1863           "isolated": "\uFC34",
1864           "initial": "\uFCC3"
1865         },
1866         "\u0642\u0649": {
1867           "isolated": "\uFC35",
1868           "final": "\uFC7E"
1869         },
1870         "\u0642\u064A": {
1871           "isolated": "\uFC36",
1872           "final": "\uFC7F"
1873         },
1874         "\u0643\u0627": {
1875           "isolated": "\uFC37",
1876           "final": "\uFC80"
1877         },
1878         "\u0643\u062C": {
1879           "isolated": "\uFC38",
1880           "initial": "\uFCC4"
1881         },
1882         "\u0643\u062D": {
1883           "isolated": "\uFC39",
1884           "initial": "\uFCC5"
1885         },
1886         "\u0643\u062E": {
1887           "isolated": "\uFC3A",
1888           "initial": "\uFCC6"
1889         },
1890         "\u0643\u0644": {
1891           "isolated": "\uFC3B",
1892           "final": "\uFC81",
1893           "initial": "\uFCC7",
1894           "medial": "\uFCEB"
1895         },
1896         "\u0643\u0645": {
1897           "isolated": "\uFC3C",
1898           "final": "\uFC82",
1899           "initial": "\uFCC8",
1900           "medial": "\uFCEC"
1901         },
1902         "\u0643\u0649": {
1903           "isolated": "\uFC3D",
1904           "final": "\uFC83"
1905         },
1906         "\u0643\u064A": {
1907           "isolated": "\uFC3E",
1908           "final": "\uFC84"
1909         },
1910         "\u0644\u062C": {
1911           "isolated": "\uFC3F",
1912           "initial": "\uFCC9"
1913         },
1914         "\u0644\u062D": {
1915           "isolated": "\uFC40",
1916           "initial": "\uFCCA"
1917         },
1918         "\u0644\u062E": {
1919           "isolated": "\uFC41",
1920           "initial": "\uFCCB"
1921         },
1922         "\u0644\u0645": {
1923           "isolated": "\uFC42",
1924           "final": "\uFC85",
1925           "initial": "\uFCCC",
1926           "medial": "\uFCED"
1927         },
1928         "\u0644\u0649": {
1929           "isolated": "\uFC43",
1930           "final": "\uFC86"
1931         },
1932         "\u0644\u064A": {
1933           "isolated": "\uFC44",
1934           "final": "\uFC87"
1935         },
1936         "\u0645\u062C": {
1937           "isolated": "\uFC45",
1938           "initial": "\uFCCE"
1939         },
1940         "\u0645\u062D": {
1941           "isolated": "\uFC46",
1942           "initial": "\uFCCF"
1943         },
1944         "\u0645\u062E": {
1945           "isolated": "\uFC47",
1946           "initial": "\uFCD0"
1947         },
1948         "\u0645\u0645": {
1949           "isolated": "\uFC48",
1950           "final": "\uFC89",
1951           "initial": "\uFCD1"
1952         },
1953         "\u0645\u0649": {
1954           "isolated": "\uFC49"
1955         },
1956         "\u0645\u064A": {
1957           "isolated": "\uFC4A"
1958         },
1959         "\u0646\u062C": {
1960           "isolated": "\uFC4B",
1961           "initial": "\uFCD2"
1962         },
1963         "\u0646\u062D": {
1964           "isolated": "\uFC4C",
1965           "initial": "\uFCD3"
1966         },
1967         "\u0646\u062E": {
1968           "isolated": "\uFC4D",
1969           "initial": "\uFCD4"
1970         },
1971         "\u0646\u0645": {
1972           "isolated": "\uFC4E",
1973           "final": "\uFC8C",
1974           "initial": "\uFCD5",
1975           "medial": "\uFCEE"
1976         },
1977         "\u0646\u0649": {
1978           "isolated": "\uFC4F",
1979           "final": "\uFC8E"
1980         },
1981         "\u0646\u064A": {
1982           "isolated": "\uFC50",
1983           "final": "\uFC8F"
1984         },
1985         "\u0647\u062C": {
1986           "isolated": "\uFC51",
1987           "initial": "\uFCD7"
1988         },
1989         "\u0647\u0645": {
1990           "isolated": "\uFC52",
1991           "initial": "\uFCD8"
1992         },
1993         "\u0647\u0649": {
1994           "isolated": "\uFC53"
1995         },
1996         "\u0647\u064A": {
1997           "isolated": "\uFC54"
1998         },
1999         "\u064A\u062C": {
2000           "isolated": "\uFC55",
2001           "initial": "\uFCDA"
2002         },
2003         "\u064A\u062D": {
2004           "isolated": "\uFC56",
2005           "initial": "\uFCDB"
2006         },
2007         "\u064A\u062E": {
2008           "isolated": "\uFC57",
2009           "initial": "\uFCDC"
2010         },
2011         "\u064A\u0645": {
2012           "isolated": "\uFC58",
2013           "final": "\uFC93",
2014           "initial": "\uFCDD",
2015           "medial": "\uFCF0"
2016         },
2017         "\u064A\u0649": {
2018           "isolated": "\uFC59",
2019           "final": "\uFC95"
2020         },
2021         "\u064A\u064A": {
2022           "isolated": "\uFC5A",
2023           "final": "\uFC96"
2024         },
2025         "\u0630\u0670": {
2026           "isolated": "\uFC5B"
2027         },
2028         "\u0631\u0670": {
2029           "isolated": "\uFC5C"
2030         },
2031         "\u0649\u0670": {
2032           "isolated": "\uFC5D",
2033           "final": "\uFC90"
2034         },
2035         "\u064C\u0651": {
2036           "isolated": "\uFC5E"
2037         },
2038         "\u064D\u0651": {
2039           "isolated": "\uFC5F"
2040         },
2041         "\u064E\u0651": {
2042           "isolated": "\uFC60"
2043         },
2044         "\u064F\u0651": {
2045           "isolated": "\uFC61"
2046         },
2047         "\u0650\u0651": {
2048           "isolated": "\uFC62"
2049         },
2050         "\u0651\u0670": {
2051           "isolated": "\uFC63"
2052         },
2053         "\u0626\u0631": {
2054           "final": "\uFC64"
2055         },
2056         "\u0626\u0632": {
2057           "final": "\uFC65"
2058         },
2059         "\u0626\u0646": {
2060           "final": "\uFC67"
2061         },
2062         "\u0628\u0631": {
2063           "final": "\uFC6A"
2064         },
2065         "\u0628\u0632": {
2066           "final": "\uFC6B"
2067         },
2068         "\u0628\u0646": {
2069           "final": "\uFC6D"
2070         },
2071         "\u062A\u0631": {
2072           "final": "\uFC70"
2073         },
2074         "\u062A\u0632": {
2075           "final": "\uFC71"
2076         },
2077         "\u062A\u0646": {
2078           "final": "\uFC73"
2079         },
2080         "\u062B\u0631": {
2081           "final": "\uFC76"
2082         },
2083         "\u062B\u0632": {
2084           "final": "\uFC77"
2085         },
2086         "\u062B\u0646": {
2087           "final": "\uFC79"
2088         },
2089         "\u062B\u064A": {
2090           "final": "\uFC7B"
2091         },
2092         "\u0645\u0627": {
2093           "final": "\uFC88"
2094         },
2095         "\u0646\u0631": {
2096           "final": "\uFC8A"
2097         },
2098         "\u0646\u0632": {
2099           "final": "\uFC8B"
2100         },
2101         "\u0646\u0646": {
2102           "final": "\uFC8D"
2103         },
2104         "\u064A\u0631": {
2105           "final": "\uFC91"
2106         },
2107         "\u064A\u0632": {
2108           "final": "\uFC92"
2109         },
2110         "\u064A\u0646": {
2111           "final": "\uFC94"
2112         },
2113         "\u0626\u062E": {
2114           "initial": "\uFC99"
2115         },
2116         "\u0626\u0647": {
2117           "initial": "\uFC9B",
2118           "medial": "\uFCE0"
2119         },
2120         "\u0628\u0647": {
2121           "initial": "\uFCA0",
2122           "medial": "\uFCE2"
2123         },
2124         "\u062A\u0647": {
2125           "initial": "\uFCA5",
2126           "medial": "\uFCE4"
2127         },
2128         "\u0635\u062E": {
2129           "initial": "\uFCB2"
2130         },
2131         "\u0644\u0647": {
2132           "initial": "\uFCCD"
2133         },
2134         "\u0646\u0647": {
2135           "initial": "\uFCD6",
2136           "medial": "\uFCEF"
2137         },
2138         "\u0647\u0670": {
2139           "initial": "\uFCD9"
2140         },
2141         "\u064A\u0647": {
2142           "initial": "\uFCDE",
2143           "medial": "\uFCF1"
2144         },
2145         "\u062B\u0647": {
2146           "medial": "\uFCE6"
2147         },
2148         "\u0633\u0647": {
2149           "medial": "\uFCE8",
2150           "initial": "\uFD31"
2151         },
2152         "\u0634\u0645": {
2153           "medial": "\uFCE9",
2154           "isolated": "\uFD0C",
2155           "final": "\uFD28",
2156           "initial": "\uFD30"
2157         },
2158         "\u0634\u0647": {
2159           "medial": "\uFCEA",
2160           "initial": "\uFD32"
2161         },
2162         "\u0640\u064E\u0651": {
2163           "medial": "\uFCF2"
2164         },
2165         "\u0640\u064F\u0651": {
2166           "medial": "\uFCF3"
2167         },
2168         "\u0640\u0650\u0651": {
2169           "medial": "\uFCF4"
2170         },
2171         "\u0637\u0649": {
2172           "isolated": "\uFCF5",
2173           "final": "\uFD11"
2174         },
2175         "\u0637\u064A": {
2176           "isolated": "\uFCF6",
2177           "final": "\uFD12"
2178         },
2179         "\u0639\u0649": {
2180           "isolated": "\uFCF7",
2181           "final": "\uFD13"
2182         },
2183         "\u0639\u064A": {
2184           "isolated": "\uFCF8",
2185           "final": "\uFD14"
2186         },
2187         "\u063A\u0649": {
2188           "isolated": "\uFCF9",
2189           "final": "\uFD15"
2190         },
2191         "\u063A\u064A": {
2192           "isolated": "\uFCFA",
2193           "final": "\uFD16"
2194         },
2195         "\u0633\u0649": {
2196           "isolated": "\uFCFB"
2197         },
2198         "\u0633\u064A": {
2199           "isolated": "\uFCFC",
2200           "final": "\uFD18"
2201         },
2202         "\u0634\u0649": {
2203           "isolated": "\uFCFD",
2204           "final": "\uFD19"
2205         },
2206         "\u0634\u064A": {
2207           "isolated": "\uFCFE",
2208           "final": "\uFD1A"
2209         },
2210         "\u062D\u0649": {
2211           "isolated": "\uFCFF",
2212           "final": "\uFD1B"
2213         },
2214         "\u062D\u064A": {
2215           "isolated": "\uFD00",
2216           "final": "\uFD1C"
2217         },
2218         "\u062C\u0649": {
2219           "isolated": "\uFD01",
2220           "final": "\uFD1D"
2221         },
2222         "\u062C\u064A": {
2223           "isolated": "\uFD02",
2224           "final": "\uFD1E"
2225         },
2226         "\u062E\u0649": {
2227           "isolated": "\uFD03",
2228           "final": "\uFD1F"
2229         },
2230         "\u062E\u064A": {
2231           "isolated": "\uFD04",
2232           "final": "\uFD20"
2233         },
2234         "\u0635\u0649": {
2235           "isolated": "\uFD05",
2236           "final": "\uFD21"
2237         },
2238         "\u0635\u064A": {
2239           "isolated": "\uFD06",
2240           "final": "\uFD22"
2241         },
2242         "\u0636\u0649": {
2243           "isolated": "\uFD07",
2244           "final": "\uFD23"
2245         },
2246         "\u0636\u064A": {
2247           "isolated": "\uFD08",
2248           "final": "\uFD24"
2249         },
2250         "\u0634\u062C": {
2251           "isolated": "\uFD09",
2252           "final": "\uFD25",
2253           "initial": "\uFD2D",
2254           "medial": "\uFD37"
2255         },
2256         "\u0634\u062D": {
2257           "isolated": "\uFD0A",
2258           "final": "\uFD26",
2259           "initial": "\uFD2E",
2260           "medial": "\uFD38"
2261         },
2262         "\u0634\u062E": {
2263           "isolated": "\uFD0B",
2264           "final": "\uFD27",
2265           "initial": "\uFD2F",
2266           "medial": "\uFD39"
2267         },
2268         "\u0634\u0631": {
2269           "isolated": "\uFD0D",
2270           "final": "\uFD29"
2271         },
2272         "\u0633\u0631": {
2273           "isolated": "\uFD0E",
2274           "final": "\uFD2A"
2275         },
2276         "\u0635\u0631": {
2277           "isolated": "\uFD0F",
2278           "final": "\uFD2B"
2279         },
2280         "\u0636\u0631": {
2281           "isolated": "\uFD10",
2282           "final": "\uFD2C"
2283         },
2284         "\u0633\u0639": {
2285           "final": "\uFD17"
2286         },
2287         "\u062A\u062C\u0645": {
2288           "initial": "\uFD50"
2289         },
2290         "\u062A\u062D\u062C": {
2291           "final": "\uFD51",
2292           "initial": "\uFD52"
2293         },
2294         "\u062A\u062D\u0645": {
2295           "initial": "\uFD53"
2296         },
2297         "\u062A\u062E\u0645": {
2298           "initial": "\uFD54"
2299         },
2300         "\u062A\u0645\u062C": {
2301           "initial": "\uFD55"
2302         },
2303         "\u062A\u0645\u062D": {
2304           "initial": "\uFD56"
2305         },
2306         "\u062A\u0645\u062E": {
2307           "initial": "\uFD57"
2308         },
2309         "\u062C\u0645\u062D": {
2310           "final": "\uFD58",
2311           "initial": "\uFD59"
2312         },
2313         "\u062D\u0645\u064A": {
2314           "final": "\uFD5A"
2315         },
2316         "\u062D\u0645\u0649": {
2317           "final": "\uFD5B"
2318         },
2319         "\u0633\u062D\u062C": {
2320           "initial": "\uFD5C"
2321         },
2322         "\u0633\u062C\u062D": {
2323           "initial": "\uFD5D"
2324         },
2325         "\u0633\u062C\u0649": {
2326           "final": "\uFD5E"
2327         },
2328         "\u0633\u0645\u062D": {
2329           "final": "\uFD5F",
2330           "initial": "\uFD60"
2331         },
2332         "\u0633\u0645\u062C": {
2333           "initial": "\uFD61"
2334         },
2335         "\u0633\u0645\u0645": {
2336           "final": "\uFD62",
2337           "initial": "\uFD63"
2338         },
2339         "\u0635\u062D\u062D": {
2340           "final": "\uFD64",
2341           "initial": "\uFD65"
2342         },
2343         "\u0635\u0645\u0645": {
2344           "final": "\uFD66",
2345           "initial": "\uFDC5"
2346         },
2347         "\u0634\u062D\u0645": {
2348           "final": "\uFD67",
2349           "initial": "\uFD68"
2350         },
2351         "\u0634\u062C\u064A": {
2352           "final": "\uFD69"
2353         },
2354         "\u0634\u0645\u062E": {
2355           "final": "\uFD6A",
2356           "initial": "\uFD6B"
2357         },
2358         "\u0634\u0645\u0645": {
2359           "final": "\uFD6C",
2360           "initial": "\uFD6D"
2361         },
2362         "\u0636\u062D\u0649": {
2363           "final": "\uFD6E"
2364         },
2365         "\u0636\u062E\u0645": {
2366           "final": "\uFD6F",
2367           "initial": "\uFD70"
2368         },
2369         "\u0636\u0645\u062D": {
2370           "final": "\uFD71"
2371         },
2372         "\u0637\u0645\u062D": {
2373           "initial": "\uFD72"
2374         },
2375         "\u0637\u0645\u0645": {
2376           "initial": "\uFD73"
2377         },
2378         "\u0637\u0645\u064A": {
2379           "final": "\uFD74"
2380         },
2381         "\u0639\u062C\u0645": {
2382           "final": "\uFD75",
2383           "initial": "\uFDC4"
2384         },
2385         "\u0639\u0645\u0645": {
2386           "final": "\uFD76",
2387           "initial": "\uFD77"
2388         },
2389         "\u0639\u0645\u0649": {
2390           "final": "\uFD78"
2391         },
2392         "\u063A\u0645\u0645": {
2393           "final": "\uFD79"
2394         },
2395         "\u063A\u0645\u064A": {
2396           "final": "\uFD7A"
2397         },
2398         "\u063A\u0645\u0649": {
2399           "final": "\uFD7B"
2400         },
2401         "\u0641\u062E\u0645": {
2402           "final": "\uFD7C",
2403           "initial": "\uFD7D"
2404         },
2405         "\u0642\u0645\u062D": {
2406           "final": "\uFD7E",
2407           "initial": "\uFDB4"
2408         },
2409         "\u0642\u0645\u0645": {
2410           "final": "\uFD7F"
2411         },
2412         "\u0644\u062D\u0645": {
2413           "final": "\uFD80",
2414           "initial": "\uFDB5"
2415         },
2416         "\u0644\u062D\u064A": {
2417           "final": "\uFD81"
2418         },
2419         "\u0644\u062D\u0649": {
2420           "final": "\uFD82"
2421         },
2422         "\u0644\u062C\u062C": {
2423           "initial": "\uFD83",
2424           "final": "\uFD84"
2425         },
2426         "\u0644\u062E\u0645": {
2427           "final": "\uFD85",
2428           "initial": "\uFD86"
2429         },
2430         "\u0644\u0645\u062D": {
2431           "final": "\uFD87",
2432           "initial": "\uFD88"
2433         },
2434         "\u0645\u062D\u062C": {
2435           "initial": "\uFD89"
2436         },
2437         "\u0645\u062D\u0645": {
2438           "initial": "\uFD8A"
2439         },
2440         "\u0645\u062D\u064A": {
2441           "final": "\uFD8B"
2442         },
2443         "\u0645\u062C\u062D": {
2444           "initial": "\uFD8C"
2445         },
2446         "\u0645\u062C\u0645": {
2447           "initial": "\uFD8D"
2448         },
2449         "\u0645\u062E\u062C": {
2450           "initial": "\uFD8E"
2451         },
2452         "\u0645\u062E\u0645": {
2453           "initial": "\uFD8F"
2454         },
2455         "\u0645\u062C\u062E": {
2456           "initial": "\uFD92"
2457         },
2458         "\u0647\u0645\u062C": {
2459           "initial": "\uFD93"
2460         },
2461         "\u0647\u0645\u0645": {
2462           "initial": "\uFD94"
2463         },
2464         "\u0646\u062D\u0645": {
2465           "initial": "\uFD95"
2466         },
2467         "\u0646\u062D\u0649": {
2468           "final": "\uFD96"
2469         },
2470         "\u0646\u062C\u0645": {
2471           "final": "\uFD97",
2472           "initial": "\uFD98"
2473         },
2474         "\u0646\u062C\u0649": {
2475           "final": "\uFD99"
2476         },
2477         "\u0646\u0645\u064A": {
2478           "final": "\uFD9A"
2479         },
2480         "\u0646\u0645\u0649": {
2481           "final": "\uFD9B"
2482         },
2483         "\u064A\u0645\u0645": {
2484           "final": "\uFD9C",
2485           "initial": "\uFD9D"
2486         },
2487         "\u0628\u062E\u064A": {
2488           "final": "\uFD9E"
2489         },
2490         "\u062A\u062C\u064A": {
2491           "final": "\uFD9F"
2492         },
2493         "\u062A\u062C\u0649": {
2494           "final": "\uFDA0"
2495         },
2496         "\u062A\u062E\u064A": {
2497           "final": "\uFDA1"
2498         },
2499         "\u062A\u062E\u0649": {
2500           "final": "\uFDA2"
2501         },
2502         "\u062A\u0645\u064A": {
2503           "final": "\uFDA3"
2504         },
2505         "\u062A\u0645\u0649": {
2506           "final": "\uFDA4"
2507         },
2508         "\u062C\u0645\u064A": {
2509           "final": "\uFDA5"
2510         },
2511         "\u062C\u062D\u0649": {
2512           "final": "\uFDA6"
2513         },
2514         "\u062C\u0645\u0649": {
2515           "final": "\uFDA7"
2516         },
2517         "\u0633\u062E\u0649": {
2518           "final": "\uFDA8"
2519         },
2520         "\u0635\u062D\u064A": {
2521           "final": "\uFDA9"
2522         },
2523         "\u0634\u062D\u064A": {
2524           "final": "\uFDAA"
2525         },
2526         "\u0636\u062D\u064A": {
2527           "final": "\uFDAB"
2528         },
2529         "\u0644\u062C\u064A": {
2530           "final": "\uFDAC"
2531         },
2532         "\u0644\u0645\u064A": {
2533           "final": "\uFDAD"
2534         },
2535         "\u064A\u062D\u064A": {
2536           "final": "\uFDAE"
2537         },
2538         "\u064A\u062C\u064A": {
2539           "final": "\uFDAF"
2540         },
2541         "\u064A\u0645\u064A": {
2542           "final": "\uFDB0"
2543         },
2544         "\u0645\u0645\u064A": {
2545           "final": "\uFDB1"
2546         },
2547         "\u0642\u0645\u064A": {
2548           "final": "\uFDB2"
2549         },
2550         "\u0646\u062D\u064A": {
2551           "final": "\uFDB3"
2552         },
2553         "\u0639\u0645\u064A": {
2554           "final": "\uFDB6"
2555         },
2556         "\u0643\u0645\u064A": {
2557           "final": "\uFDB7"
2558         },
2559         "\u0646\u062C\u062D": {
2560           "initial": "\uFDB8",
2561           "final": "\uFDBD"
2562         },
2563         "\u0645\u062E\u064A": {
2564           "final": "\uFDB9"
2565         },
2566         "\u0644\u062C\u0645": {
2567           "initial": "\uFDBA",
2568           "final": "\uFDBC"
2569         },
2570         "\u0643\u0645\u0645": {
2571           "final": "\uFDBB",
2572           "initial": "\uFDC3"
2573         },
2574         "\u062C\u062D\u064A": {
2575           "final": "\uFDBE"
2576         },
2577         "\u062D\u062C\u064A": {
2578           "final": "\uFDBF"
2579         },
2580         "\u0645\u062C\u064A": {
2581           "final": "\uFDC0"
2582         },
2583         "\u0641\u0645\u064A": {
2584           "final": "\uFDC1"
2585         },
2586         "\u0628\u062D\u064A": {
2587           "final": "\uFDC2"
2588         },
2589         "\u0633\u062E\u064A": {
2590           "final": "\uFDC6"
2591         },
2592         "\u0646\u062C\u064A": {
2593           "final": "\uFDC7"
2594         },
2595         "\u0644\u0622": {
2596           "isolated": "\uFEF5",
2597           "final": "\uFEF6"
2598         },
2599         "\u0644\u0623": {
2600           "isolated": "\uFEF7",
2601           "final": "\uFEF8"
2602         },
2603         "\u0644\u0625": {
2604           "isolated": "\uFEF9",
2605           "final": "\uFEFA"
2606         },
2607         "\u0644\u0627": {
2608           "isolated": "\uFEFB",
2609           "final": "\uFEFC"
2610         },
2611         "words": {
2612           "\u0635\u0644\u06D2": "\uFDF0",
2613           "\u0642\u0644\u06D2": "\uFDF1",
2614           "\u0627\u0644\u0644\u0647": "\uFDF2",
2615           "\u0627\u0643\u0628\u0631": "\uFDF3",
2616           "\u0645\u062D\u0645\u062F": "\uFDF4",
2617           "\u0635\u0644\u0639\u0645": "\uFDF5",
2618           "\u0631\u0633\u0648\u0644": "\uFDF6",
2619           "\u0639\u0644\u064A\u0647": "\uFDF7",
2620           "\u0648\u0633\u0644\u0645": "\uFDF8",
2621           "\u0635\u0644\u0649": "\uFDF9",
2622           "\u0635\u0644\u0649\u0627\u0644\u0644\u0647\u0639\u0644\u064A\u0647\u0648\u0633\u0644\u0645": "\uFDFA",
2623           "\u062C\u0644\u062C\u0644\u0627\u0644\u0647": "\uFDFB",
2624           "\u0631\u06CC\u0627\u0644": "\uFDFC"
2625         }
2626       };
2627       exports2.default = ligatureReference;
2628     }
2629   });
2630
2631   // node_modules/alif-toolkit/lib/reference.js
2632   var require_reference = __commonJS({
2633     "node_modules/alif-toolkit/lib/reference.js"(exports2) {
2634       "use strict";
2635       Object.defineProperty(exports2, "__esModule", { value: true });
2636       exports2.ligatureWordList = exports2.ligatureList = exports2.letterList = exports2.alefs = exports2.lams = exports2.lineBreakers = exports2.tashkeel = void 0;
2637       var unicode_arabic_1 = require_unicode_arabic();
2638       var unicode_ligatures_1 = require_unicode_ligatures();
2639       var letterList = Object.keys(unicode_arabic_1.default);
2640       exports2.letterList = letterList;
2641       var ligatureList = Object.keys(unicode_ligatures_1.default);
2642       exports2.ligatureList = ligatureList;
2643       var ligatureWordList = Object.keys(unicode_ligatures_1.default.words);
2644       exports2.ligatureWordList = ligatureWordList;
2645       var lams = "\u0644\u06B5\u06B6\u06B7\u06B8";
2646       exports2.lams = lams;
2647       var alefs = "\u0627\u0622\u0623\u0625\u0671\u0672\u0673\u0675\u0773\u0774";
2648       exports2.alefs = alefs;
2649       var tashkeel = "\u0605\u0640\u0670\u0674\u06DF\u06E7\u06E8";
2650       exports2.tashkeel = tashkeel;
2651       function addToTashkeel(start2, finish) {
2652         for (var i3 = start2; i3 <= finish; i3++) {
2653           exports2.tashkeel = tashkeel += String.fromCharCode(i3);
2654         }
2655       }
2656       addToTashkeel(1552, 1562);
2657       addToTashkeel(1611, 1631);
2658       addToTashkeel(1750, 1756);
2659       addToTashkeel(1760, 1764);
2660       addToTashkeel(1770, 1773);
2661       addToTashkeel(2259, 2273);
2662       addToTashkeel(2275, 2303);
2663       addToTashkeel(65136, 65151);
2664       var lineBreakers = "\u0627\u0629\u0648\u06C0\u06CF\u06FD\u06FE\u076B\u076C\u0771\u0773\u0774\u0778\u0779\u08E2\u08B1\u08B2\u08B9";
2665       exports2.lineBreakers = lineBreakers;
2666       function addToLineBreakers(start2, finish) {
2667         for (var i3 = start2; i3 <= finish; i3++) {
2668           exports2.lineBreakers = lineBreakers += String.fromCharCode(i3);
2669         }
2670       }
2671       addToLineBreakers(1536, 1567);
2672       addToLineBreakers(1569, 1573);
2673       addToLineBreakers(1583, 1586);
2674       addToLineBreakers(1632, 1645);
2675       addToLineBreakers(1649, 1655);
2676       addToLineBreakers(1672, 1689);
2677       addToLineBreakers(1731, 1739);
2678       addToLineBreakers(1746, 1785);
2679       addToLineBreakers(1881, 1883);
2680       addToLineBreakers(2218, 2222);
2681       addToLineBreakers(64336, 65021);
2682       addToLineBreakers(65152, 65276);
2683       addToLineBreakers(69216, 69247);
2684       addToLineBreakers(126064, 126143);
2685       addToLineBreakers(126464, 126719);
2686     }
2687   });
2688
2689   // node_modules/alif-toolkit/lib/GlyphSplitter.js
2690   var require_GlyphSplitter = __commonJS({
2691     "node_modules/alif-toolkit/lib/GlyphSplitter.js"(exports2) {
2692       "use strict";
2693       Object.defineProperty(exports2, "__esModule", { value: true });
2694       exports2.GlyphSplitter = GlyphSplitter;
2695       var isArabic_1 = require_isArabic();
2696       var reference_1 = require_reference();
2697       function GlyphSplitter(word) {
2698         let letters = [];
2699         let lastLetter = "";
2700         word.split("").forEach((letter) => {
2701           if ((0, isArabic_1.isArabic)(letter)) {
2702             if (reference_1.tashkeel.indexOf(letter) > -1) {
2703               letters[letters.length - 1] += letter;
2704             } else if (lastLetter.length && (reference_1.lams.indexOf(lastLetter) === 0 && reference_1.alefs.indexOf(letter) > -1 || reference_1.lams.indexOf(lastLetter) > 0 && reference_1.alefs.indexOf(letter) === 0)) {
2705               letters[letters.length - 1] += letter;
2706             } else {
2707               letters.push(letter);
2708             }
2709           } else {
2710             letters.push(letter);
2711           }
2712           if (reference_1.tashkeel.indexOf(letter) === -1) {
2713             lastLetter = letter;
2714           }
2715         });
2716         return letters;
2717       }
2718     }
2719   });
2720
2721   // node_modules/alif-toolkit/lib/BaselineSplitter.js
2722   var require_BaselineSplitter = __commonJS({
2723     "node_modules/alif-toolkit/lib/BaselineSplitter.js"(exports2) {
2724       "use strict";
2725       Object.defineProperty(exports2, "__esModule", { value: true });
2726       exports2.BaselineSplitter = BaselineSplitter;
2727       var isArabic_1 = require_isArabic();
2728       var reference_1 = require_reference();
2729       function BaselineSplitter(word) {
2730         let letters = [];
2731         let lastLetter = "";
2732         word.split("").forEach((letter) => {
2733           if ((0, isArabic_1.isArabic)(letter) && (0, isArabic_1.isArabic)(lastLetter)) {
2734             if (lastLetter.length && reference_1.tashkeel.indexOf(letter) > -1) {
2735               letters[letters.length - 1] += letter;
2736             } else if (reference_1.lineBreakers.indexOf(lastLetter) > -1) {
2737               letters.push(letter);
2738             } else {
2739               letters[letters.length - 1] += letter;
2740             }
2741           } else {
2742             letters.push(letter);
2743           }
2744           if (reference_1.tashkeel.indexOf(letter) === -1) {
2745             lastLetter = letter;
2746           }
2747         });
2748         return letters;
2749       }
2750     }
2751   });
2752
2753   // node_modules/alif-toolkit/lib/Normalization.js
2754   var require_Normalization = __commonJS({
2755     "node_modules/alif-toolkit/lib/Normalization.js"(exports2) {
2756       "use strict";
2757       Object.defineProperty(exports2, "__esModule", { value: true });
2758       exports2.Normal = Normal;
2759       var unicode_arabic_1 = require_unicode_arabic();
2760       var unicode_ligatures_1 = require_unicode_ligatures();
2761       var isArabic_1 = require_isArabic();
2762       var reference_1 = require_reference();
2763       function Normal(word, breakPresentationForm) {
2764         if (typeof breakPresentationForm === "undefined") {
2765           breakPresentationForm = true;
2766         }
2767         let returnable = "";
2768         word.split("").forEach((letter) => {
2769           if (!(0, isArabic_1.isArabic)(letter)) {
2770             returnable += letter;
2771             return;
2772           }
2773           for (let w2 = 0; w2 < reference_1.letterList.length; w2++) {
2774             let letterForms = unicode_arabic_1.default[reference_1.letterList[w2]];
2775             let versions = Object.keys(letterForms);
2776             for (let v2 = 0; v2 < versions.length; v2++) {
2777               let localVersion = letterForms[versions[v2]];
2778               if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2779                 let embeddedForms = Object.keys(localVersion);
2780                 for (let ef = 0; ef < embeddedForms.length; ef++) {
2781                   let form = localVersion[embeddedForms[ef]];
2782                   if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2783                     if (form === letter) {
2784                       if (breakPresentationForm && localVersion["normal"] && ["isolated", "initial", "medial", "final"].indexOf(embeddedForms[ef]) > -1) {
2785                         if (typeof localVersion["normal"] === "object") {
2786                           returnable += localVersion["normal"][0];
2787                         } else {
2788                           returnable += localVersion["normal"];
2789                         }
2790                         return;
2791                       }
2792                       returnable += letter;
2793                       return;
2794                     } else if (typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2795                       returnable += form[0];
2796                       return;
2797                     }
2798                   }
2799                 }
2800               } else if (localVersion === letter) {
2801                 if (breakPresentationForm && letterForms["normal"] && ["isolated", "initial", "medial", "final"].indexOf(versions[v2]) > -1) {
2802                   if (typeof letterForms["normal"] === "object") {
2803                     returnable += letterForms["normal"][0];
2804                   } else {
2805                     returnable += letterForms["normal"];
2806                   }
2807                   return;
2808                 }
2809                 returnable += letter;
2810                 return;
2811               } else if (typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2812                 returnable += localVersion[0];
2813                 return;
2814               }
2815             }
2816           }
2817           for (let v2 = 0; v2 < reference_1.ligatureList.length; v2++) {
2818             let normalForm = reference_1.ligatureList[v2];
2819             if (normalForm !== "words") {
2820               let ligForms = Object.keys(unicode_ligatures_1.default[normalForm]);
2821               for (let f2 = 0; f2 < ligForms.length; f2++) {
2822                 if (unicode_ligatures_1.default[normalForm][ligForms[f2]] === letter) {
2823                   returnable += normalForm;
2824                   return;
2825                 }
2826               }
2827             }
2828           }
2829           for (let v3 = 0; v3 < reference_1.ligatureWordList.length; v3++) {
2830             let normalForm = reference_1.ligatureWordList[v3];
2831             if (unicode_ligatures_1.default.words[normalForm] === letter) {
2832               returnable += normalForm;
2833               return;
2834             }
2835           }
2836           returnable += letter;
2837         });
2838         return returnable;
2839       }
2840     }
2841   });
2842
2843   // node_modules/alif-toolkit/lib/CharShaper.js
2844   var require_CharShaper = __commonJS({
2845     "node_modules/alif-toolkit/lib/CharShaper.js"(exports2) {
2846       "use strict";
2847       Object.defineProperty(exports2, "__esModule", { value: true });
2848       exports2.CharShaper = CharShaper;
2849       var unicode_arabic_1 = require_unicode_arabic();
2850       var isArabic_1 = require_isArabic();
2851       var reference_1 = require_reference();
2852       function CharShaper(letter, form) {
2853         if (!(0, isArabic_1.isArabic)(letter)) {
2854           throw new Error("Not Arabic");
2855         }
2856         if (letter === "\u0621") {
2857           return "\u0621";
2858         }
2859         for (let w2 = 0; w2 < reference_1.letterList.length; w2++) {
2860           let letterForms = unicode_arabic_1.default[reference_1.letterList[w2]];
2861           let versions = Object.keys(letterForms);
2862           for (let v2 = 0; v2 < versions.length; v2++) {
2863             let localVersion = letterForms[versions[v2]];
2864             if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2865               if (versions.indexOf(form) > -1) {
2866                 return letterForms[form];
2867               }
2868             } else if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2869               let embeddedVersions = Object.keys(localVersion);
2870               for (let ev = 0; ev < embeddedVersions.length; ev++) {
2871                 if (localVersion[embeddedVersions[ev]] === letter || typeof localVersion[embeddedVersions[ev]] === "object" && localVersion[embeddedVersions[ev]].indexOf && localVersion[embeddedVersions[ev]].indexOf(letter) > -1) {
2872                   if (embeddedVersions.indexOf(form) > -1) {
2873                     return localVersion[form];
2874                   }
2875                 }
2876               }
2877             }
2878           }
2879         }
2880       }
2881     }
2882   });
2883
2884   // node_modules/alif-toolkit/lib/WordShaper.js
2885   var require_WordShaper = __commonJS({
2886     "node_modules/alif-toolkit/lib/WordShaper.js"(exports2) {
2887       "use strict";
2888       Object.defineProperty(exports2, "__esModule", { value: true });
2889       exports2.WordShaper = WordShaper2;
2890       var isArabic_1 = require_isArabic();
2891       var reference_1 = require_reference();
2892       var CharShaper_1 = require_CharShaper();
2893       var unicode_ligatures_1 = require_unicode_ligatures();
2894       function WordShaper2(word) {
2895         let state = "initial";
2896         let output = "";
2897         for (let w2 = 0; w2 < word.length; w2++) {
2898           let nextLetter = " ";
2899           for (let nxw = w2 + 1; nxw < word.length; nxw++) {
2900             if (!(0, isArabic_1.isArabic)(word[nxw])) {
2901               break;
2902             }
2903             if (reference_1.tashkeel.indexOf(word[nxw]) === -1) {
2904               nextLetter = word[nxw];
2905               break;
2906             }
2907           }
2908           if (!(0, isArabic_1.isArabic)(word[w2]) || (0, isArabic_1.isMath)(word[w2])) {
2909             output += word[w2];
2910             state = "initial";
2911           } else if (reference_1.tashkeel.indexOf(word[w2]) > -1) {
2912             output += word[w2];
2913           } else if (nextLetter === " " || reference_1.lineBreakers.indexOf(word[w2]) > -1) {
2914             output += (0, CharShaper_1.CharShaper)(word[w2], state === "initial" ? "isolated" : "final");
2915             state = "initial";
2916           } else if (reference_1.lams.indexOf(word[w2]) > -1 && reference_1.alefs.indexOf(nextLetter) > -1) {
2917             output += unicode_ligatures_1.default[word[w2] + nextLetter][state === "initial" ? "isolated" : "final"];
2918             while (word[w2] !== nextLetter) {
2919               w2++;
2920             }
2921             state = "initial";
2922           } else {
2923             output += (0, CharShaper_1.CharShaper)(word[w2], state);
2924             state = "medial";
2925           }
2926         }
2927         return output;
2928       }
2929     }
2930   });
2931
2932   // node_modules/alif-toolkit/lib/ParentLetter.js
2933   var require_ParentLetter = __commonJS({
2934     "node_modules/alif-toolkit/lib/ParentLetter.js"(exports2) {
2935       "use strict";
2936       Object.defineProperty(exports2, "__esModule", { value: true });
2937       exports2.ParentLetter = ParentLetter;
2938       exports2.GrandparentLetter = GrandparentLetter;
2939       var unicode_arabic_1 = require_unicode_arabic();
2940       var isArabic_1 = require_isArabic();
2941       var reference_1 = require_reference();
2942       function ParentLetter(letter) {
2943         if (!(0, isArabic_1.isArabic)(letter)) {
2944           throw new Error("Not an Arabic letter");
2945         }
2946         for (let w2 = 0; w2 < reference_1.letterList.length; w2++) {
2947           let letterForms = unicode_arabic_1.default[reference_1.letterList[w2]];
2948           let versions = Object.keys(letterForms);
2949           for (let v2 = 0; v2 < versions.length; v2++) {
2950             let localVersion = letterForms[versions[v2]];
2951             if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2952               let embeddedForms = Object.keys(localVersion);
2953               for (let ef = 0; ef < embeddedForms.length; ef++) {
2954                 let form = localVersion[embeddedForms[ef]];
2955                 if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2956                   return localVersion;
2957                 }
2958               }
2959             } else if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2960               return letterForms;
2961             }
2962           }
2963           return null;
2964         }
2965       }
2966       function GrandparentLetter(letter) {
2967         if (!(0, isArabic_1.isArabic)(letter)) {
2968           throw new Error("Not an Arabic letter");
2969         }
2970         for (let w2 = 0; w2 < reference_1.letterList.length; w2++) {
2971           let letterForms = unicode_arabic_1.default[reference_1.letterList[w2]];
2972           let versions = Object.keys(letterForms);
2973           for (let v2 = 0; v2 < versions.length; v2++) {
2974             let localVersion = letterForms[versions[v2]];
2975             if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2976               let embeddedForms = Object.keys(localVersion);
2977               for (let ef = 0; ef < embeddedForms.length; ef++) {
2978                 let form = localVersion[embeddedForms[ef]];
2979                 if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2980                   return letterForms;
2981                 }
2982               }
2983             } else if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2984               return letterForms;
2985             }
2986           }
2987           return null;
2988         }
2989       }
2990     }
2991   });
2992
2993   // node_modules/alif-toolkit/lib/index.js
2994   var require_lib = __commonJS({
2995     "node_modules/alif-toolkit/lib/index.js"(exports2) {
2996       "use strict";
2997       Object.defineProperty(exports2, "__esModule", { value: true });
2998       exports2.GrandparentLetter = exports2.ParentLetter = exports2.WordShaper = exports2.CharShaper = exports2.Normal = exports2.BaselineSplitter = exports2.GlyphSplitter = exports2.isArabic = void 0;
2999       var isArabic_1 = require_isArabic();
3000       Object.defineProperty(exports2, "isArabic", { enumerable: true, get: function() {
3001         return isArabic_1.isArabic;
3002       } });
3003       var GlyphSplitter_1 = require_GlyphSplitter();
3004       Object.defineProperty(exports2, "GlyphSplitter", { enumerable: true, get: function() {
3005         return GlyphSplitter_1.GlyphSplitter;
3006       } });
3007       var BaselineSplitter_1 = require_BaselineSplitter();
3008       Object.defineProperty(exports2, "BaselineSplitter", { enumerable: true, get: function() {
3009         return BaselineSplitter_1.BaselineSplitter;
3010       } });
3011       var Normalization_1 = require_Normalization();
3012       Object.defineProperty(exports2, "Normal", { enumerable: true, get: function() {
3013         return Normalization_1.Normal;
3014       } });
3015       var CharShaper_1 = require_CharShaper();
3016       Object.defineProperty(exports2, "CharShaper", { enumerable: true, get: function() {
3017         return CharShaper_1.CharShaper;
3018       } });
3019       var WordShaper_1 = require_WordShaper();
3020       Object.defineProperty(exports2, "WordShaper", { enumerable: true, get: function() {
3021         return WordShaper_1.WordShaper;
3022       } });
3023       var ParentLetter_1 = require_ParentLetter();
3024       Object.defineProperty(exports2, "ParentLetter", { enumerable: true, get: function() {
3025         return ParentLetter_1.ParentLetter;
3026       } });
3027       Object.defineProperty(exports2, "GrandparentLetter", { enumerable: true, get: function() {
3028         return ParentLetter_1.GrandparentLetter;
3029       } });
3030     }
3031   });
3032
3033   // node_modules/vparse/index.js
3034   var require_vparse = __commonJS({
3035     "node_modules/vparse/index.js"(exports2, module2) {
3036       (function(window2) {
3037         "use strict";
3038         function parseVersion3(v2) {
3039           var m2 = v2.replace(/[^0-9.]/g, "").match(/[0-9]*\.|[0-9]+/g) || [];
3040           v2 = {
3041             major: +m2[0] || 0,
3042             minor: +m2[1] || 0,
3043             patch: +m2[2] || 0,
3044             build: +m2[3] || 0
3045           };
3046           v2.isEmpty = !v2.major && !v2.minor && !v2.patch && !v2.build;
3047           v2.parsed = [v2.major, v2.minor, v2.patch, v2.build];
3048           v2.text = v2.parsed.join(".");
3049           v2.compare = compare2;
3050           return v2;
3051         }
3052         function compare2(v2) {
3053           if (typeof v2 === "string") {
3054             v2 = parseVersion3(v2);
3055           }
3056           for (var i3 = 0; i3 < 4; i3++) {
3057             if (this.parsed[i3] !== v2.parsed[i3]) {
3058               return this.parsed[i3] > v2.parsed[i3] ? 1 : -1;
3059             }
3060           }
3061           return 0;
3062         }
3063         if (typeof module2 === "object" && module2 && typeof module2.exports === "object") {
3064           module2.exports = parseVersion3;
3065         } else {
3066           window2.parseVersion = parseVersion3;
3067         }
3068       })(exports2);
3069     }
3070   });
3071
3072   // node_modules/which-polygon/node_modules/quickselect/quickselect.js
3073   var require_quickselect = __commonJS({
3074     "node_modules/which-polygon/node_modules/quickselect/quickselect.js"(exports2, module2) {
3075       (function(global2, factory) {
3076         typeof exports2 === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global2.quickselect = factory();
3077       })(exports2, function() {
3078         "use strict";
3079         function quickselect3(arr, k2, left, right, compare2) {
3080           quickselectStep2(arr, k2, left || 0, right || arr.length - 1, compare2 || defaultCompare2);
3081         }
3082         function quickselectStep2(arr, k2, left, right, compare2) {
3083           while (right > left) {
3084             if (right - left > 600) {
3085               var n3 = right - left + 1;
3086               var m2 = k2 - left + 1;
3087               var z2 = Math.log(n3);
3088               var s2 = 0.5 * Math.exp(2 * z2 / 3);
3089               var sd = 0.5 * Math.sqrt(z2 * s2 * (n3 - s2) / n3) * (m2 - n3 / 2 < 0 ? -1 : 1);
3090               var newLeft = Math.max(left, Math.floor(k2 - m2 * s2 / n3 + sd));
3091               var newRight = Math.min(right, Math.floor(k2 + (n3 - m2) * s2 / n3 + sd));
3092               quickselectStep2(arr, k2, newLeft, newRight, compare2);
3093             }
3094             var t2 = arr[k2];
3095             var i3 = left;
3096             var j2 = right;
3097             swap3(arr, left, k2);
3098             if (compare2(arr[right], t2) > 0) swap3(arr, left, right);
3099             while (i3 < j2) {
3100               swap3(arr, i3, j2);
3101               i3++;
3102               j2--;
3103               while (compare2(arr[i3], t2) < 0) i3++;
3104               while (compare2(arr[j2], t2) > 0) j2--;
3105             }
3106             if (compare2(arr[left], t2) === 0) swap3(arr, left, j2);
3107             else {
3108               j2++;
3109               swap3(arr, j2, right);
3110             }
3111             if (j2 <= k2) left = j2 + 1;
3112             if (k2 <= j2) right = j2 - 1;
3113           }
3114         }
3115         function swap3(arr, i3, j2) {
3116           var tmp = arr[i3];
3117           arr[i3] = arr[j2];
3118           arr[j2] = tmp;
3119         }
3120         function defaultCompare2(a2, b2) {
3121           return a2 < b2 ? -1 : a2 > b2 ? 1 : 0;
3122         }
3123         return quickselect3;
3124       });
3125     }
3126   });
3127
3128   // node_modules/which-polygon/node_modules/rbush/index.js
3129   var require_rbush = __commonJS({
3130     "node_modules/which-polygon/node_modules/rbush/index.js"(exports2, module2) {
3131       "use strict";
3132       module2.exports = rbush;
3133       module2.exports.default = rbush;
3134       var quickselect3 = require_quickselect();
3135       function rbush(maxEntries, format2) {
3136         if (!(this instanceof rbush)) return new rbush(maxEntries, format2);
3137         this._maxEntries = Math.max(4, maxEntries || 9);
3138         this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
3139         if (format2) {
3140           this._initFormat(format2);
3141         }
3142         this.clear();
3143       }
3144       rbush.prototype = {
3145         all: function() {
3146           return this._all(this.data, []);
3147         },
3148         search: function(bbox2) {
3149           var node = this.data, result = [], toBBox = this.toBBox;
3150           if (!intersects2(bbox2, node)) return result;
3151           var nodesToSearch = [], i3, len, child, childBBox;
3152           while (node) {
3153             for (i3 = 0, len = node.children.length; i3 < len; i3++) {
3154               child = node.children[i3];
3155               childBBox = node.leaf ? toBBox(child) : child;
3156               if (intersects2(bbox2, childBBox)) {
3157                 if (node.leaf) result.push(child);
3158                 else if (contains2(bbox2, childBBox)) this._all(child, result);
3159                 else nodesToSearch.push(child);
3160               }
3161             }
3162             node = nodesToSearch.pop();
3163           }
3164           return result;
3165         },
3166         collides: function(bbox2) {
3167           var node = this.data, toBBox = this.toBBox;
3168           if (!intersects2(bbox2, node)) return false;
3169           var nodesToSearch = [], i3, len, child, childBBox;
3170           while (node) {
3171             for (i3 = 0, len = node.children.length; i3 < len; i3++) {
3172               child = node.children[i3];
3173               childBBox = node.leaf ? toBBox(child) : child;
3174               if (intersects2(bbox2, childBBox)) {
3175                 if (node.leaf || contains2(bbox2, childBBox)) return true;
3176                 nodesToSearch.push(child);
3177               }
3178             }
3179             node = nodesToSearch.pop();
3180           }
3181           return false;
3182         },
3183         load: function(data) {
3184           if (!(data && data.length)) return this;
3185           if (data.length < this._minEntries) {
3186             for (var i3 = 0, len = data.length; i3 < len; i3++) {
3187               this.insert(data[i3]);
3188             }
3189             return this;
3190           }
3191           var node = this._build(data.slice(), 0, data.length - 1, 0);
3192           if (!this.data.children.length) {
3193             this.data = node;
3194           } else if (this.data.height === node.height) {
3195             this._splitRoot(this.data, node);
3196           } else {
3197             if (this.data.height < node.height) {
3198               var tmpNode = this.data;
3199               this.data = node;
3200               node = tmpNode;
3201             }
3202             this._insert(node, this.data.height - node.height - 1, true);
3203           }
3204           return this;
3205         },
3206         insert: function(item) {
3207           if (item) this._insert(item, this.data.height - 1);
3208           return this;
3209         },
3210         clear: function() {
3211           this.data = createNode2([]);
3212           return this;
3213         },
3214         remove: function(item, equalsFn) {
3215           if (!item) return this;
3216           var node = this.data, bbox2 = this.toBBox(item), path = [], indexes = [], i3, parent, index, goingUp;
3217           while (node || path.length) {
3218             if (!node) {
3219               node = path.pop();
3220               parent = path[path.length - 1];
3221               i3 = indexes.pop();
3222               goingUp = true;
3223             }
3224             if (node.leaf) {
3225               index = findItem2(item, node.children, equalsFn);
3226               if (index !== -1) {
3227                 node.children.splice(index, 1);
3228                 path.push(node);
3229                 this._condense(path);
3230                 return this;
3231               }
3232             }
3233             if (!goingUp && !node.leaf && contains2(node, bbox2)) {
3234               path.push(node);
3235               indexes.push(i3);
3236               i3 = 0;
3237               parent = node;
3238               node = node.children[0];
3239             } else if (parent) {
3240               i3++;
3241               node = parent.children[i3];
3242               goingUp = false;
3243             } else node = null;
3244           }
3245           return this;
3246         },
3247         toBBox: function(item) {
3248           return item;
3249         },
3250         compareMinX: compareNodeMinX2,
3251         compareMinY: compareNodeMinY2,
3252         toJSON: function() {
3253           return this.data;
3254         },
3255         fromJSON: function(data) {
3256           this.data = data;
3257           return this;
3258         },
3259         _all: function(node, result) {
3260           var nodesToSearch = [];
3261           while (node) {
3262             if (node.leaf) result.push.apply(result, node.children);
3263             else nodesToSearch.push.apply(nodesToSearch, node.children);
3264             node = nodesToSearch.pop();
3265           }
3266           return result;
3267         },
3268         _build: function(items, left, right, height) {
3269           var N2 = right - left + 1, M2 = this._maxEntries, node;
3270           if (N2 <= M2) {
3271             node = createNode2(items.slice(left, right + 1));
3272             calcBBox2(node, this.toBBox);
3273             return node;
3274           }
3275           if (!height) {
3276             height = Math.ceil(Math.log(N2) / Math.log(M2));
3277             M2 = Math.ceil(N2 / Math.pow(M2, height - 1));
3278           }
3279           node = createNode2([]);
3280           node.leaf = false;
3281           node.height = height;
3282           var N22 = Math.ceil(N2 / M2), N1 = N22 * Math.ceil(Math.sqrt(M2)), i3, j2, right2, right3;
3283           multiSelect2(items, left, right, N1, this.compareMinX);
3284           for (i3 = left; i3 <= right; i3 += N1) {
3285             right2 = Math.min(i3 + N1 - 1, right);
3286             multiSelect2(items, i3, right2, N22, this.compareMinY);
3287             for (j2 = i3; j2 <= right2; j2 += N22) {
3288               right3 = Math.min(j2 + N22 - 1, right2);
3289               node.children.push(this._build(items, j2, right3, height - 1));
3290             }
3291           }
3292           calcBBox2(node, this.toBBox);
3293           return node;
3294         },
3295         _chooseSubtree: function(bbox2, node, level, path) {
3296           var i3, len, child, targetNode, area, enlargement, minArea, minEnlargement;
3297           while (true) {
3298             path.push(node);
3299             if (node.leaf || path.length - 1 === level) break;
3300             minArea = minEnlargement = Infinity;
3301             for (i3 = 0, len = node.children.length; i3 < len; i3++) {
3302               child = node.children[i3];
3303               area = bboxArea2(child);
3304               enlargement = enlargedArea2(bbox2, child) - area;
3305               if (enlargement < minEnlargement) {
3306                 minEnlargement = enlargement;
3307                 minArea = area < minArea ? area : minArea;
3308                 targetNode = child;
3309               } else if (enlargement === minEnlargement) {
3310                 if (area < minArea) {
3311                   minArea = area;
3312                   targetNode = child;
3313                 }
3314               }
3315             }
3316             node = targetNode || node.children[0];
3317           }
3318           return node;
3319         },
3320         _insert: function(item, level, isNode) {
3321           var toBBox = this.toBBox, bbox2 = isNode ? item : toBBox(item), insertPath = [];
3322           var node = this._chooseSubtree(bbox2, this.data, level, insertPath);
3323           node.children.push(item);
3324           extend3(node, bbox2);
3325           while (level >= 0) {
3326             if (insertPath[level].children.length > this._maxEntries) {
3327               this._split(insertPath, level);
3328               level--;
3329             } else break;
3330           }
3331           this._adjustParentBBoxes(bbox2, insertPath, level);
3332         },
3333         // split overflowed node into two
3334         _split: function(insertPath, level) {
3335           var node = insertPath[level], M2 = node.children.length, m2 = this._minEntries;
3336           this._chooseSplitAxis(node, m2, M2);
3337           var splitIndex = this._chooseSplitIndex(node, m2, M2);
3338           var newNode = createNode2(node.children.splice(splitIndex, node.children.length - splitIndex));
3339           newNode.height = node.height;
3340           newNode.leaf = node.leaf;
3341           calcBBox2(node, this.toBBox);
3342           calcBBox2(newNode, this.toBBox);
3343           if (level) insertPath[level - 1].children.push(newNode);
3344           else this._splitRoot(node, newNode);
3345         },
3346         _splitRoot: function(node, newNode) {
3347           this.data = createNode2([node, newNode]);
3348           this.data.height = node.height + 1;
3349           this.data.leaf = false;
3350           calcBBox2(this.data, this.toBBox);
3351         },
3352         _chooseSplitIndex: function(node, m2, M2) {
3353           var i3, bbox1, bbox2, overlap, area, minOverlap, minArea, index;
3354           minOverlap = minArea = Infinity;
3355           for (i3 = m2; i3 <= M2 - m2; i3++) {
3356             bbox1 = distBBox2(node, 0, i3, this.toBBox);
3357             bbox2 = distBBox2(node, i3, M2, this.toBBox);
3358             overlap = intersectionArea2(bbox1, bbox2);
3359             area = bboxArea2(bbox1) + bboxArea2(bbox2);
3360             if (overlap < minOverlap) {
3361               minOverlap = overlap;
3362               index = i3;
3363               minArea = area < minArea ? area : minArea;
3364             } else if (overlap === minOverlap) {
3365               if (area < minArea) {
3366                 minArea = area;
3367                 index = i3;
3368               }
3369             }
3370           }
3371           return index;
3372         },
3373         // sorts node children by the best axis for split
3374         _chooseSplitAxis: function(node, m2, M2) {
3375           var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX2, compareMinY = node.leaf ? this.compareMinY : compareNodeMinY2, xMargin = this._allDistMargin(node, m2, M2, compareMinX), yMargin = this._allDistMargin(node, m2, M2, compareMinY);
3376           if (xMargin < yMargin) node.children.sort(compareMinX);
3377         },
3378         // total margin of all possible split distributions where each node is at least m full
3379         _allDistMargin: function(node, m2, M2, compare2) {
3380           node.children.sort(compare2);
3381           var toBBox = this.toBBox, leftBBox = distBBox2(node, 0, m2, toBBox), rightBBox = distBBox2(node, M2 - m2, M2, toBBox), margin = bboxMargin2(leftBBox) + bboxMargin2(rightBBox), i3, child;
3382           for (i3 = m2; i3 < M2 - m2; i3++) {
3383             child = node.children[i3];
3384             extend3(leftBBox, node.leaf ? toBBox(child) : child);
3385             margin += bboxMargin2(leftBBox);
3386           }
3387           for (i3 = M2 - m2 - 1; i3 >= m2; i3--) {
3388             child = node.children[i3];
3389             extend3(rightBBox, node.leaf ? toBBox(child) : child);
3390             margin += bboxMargin2(rightBBox);
3391           }
3392           return margin;
3393         },
3394         _adjustParentBBoxes: function(bbox2, path, level) {
3395           for (var i3 = level; i3 >= 0; i3--) {
3396             extend3(path[i3], bbox2);
3397           }
3398         },
3399         _condense: function(path) {
3400           for (var i3 = path.length - 1, siblings; i3 >= 0; i3--) {
3401             if (path[i3].children.length === 0) {
3402               if (i3 > 0) {
3403                 siblings = path[i3 - 1].children;
3404                 siblings.splice(siblings.indexOf(path[i3]), 1);
3405               } else this.clear();
3406             } else calcBBox2(path[i3], this.toBBox);
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 findItem2(item, items, equalsFn) {
3420         if (!equalsFn) return items.indexOf(item);
3421         for (var i3 = 0; i3 < items.length; i3++) {
3422           if (equalsFn(item, items[i3])) return i3;
3423         }
3424         return -1;
3425       }
3426       function calcBBox2(node, toBBox) {
3427         distBBox2(node, 0, node.children.length, toBBox, node);
3428       }
3429       function distBBox2(node, k2, p2, toBBox, destNode) {
3430         if (!destNode) destNode = createNode2(null);
3431         destNode.minX = Infinity;
3432         destNode.minY = Infinity;
3433         destNode.maxX = -Infinity;
3434         destNode.maxY = -Infinity;
3435         for (var i3 = k2, child; i3 < p2; i3++) {
3436           child = node.children[i3];
3437           extend3(destNode, node.leaf ? toBBox(child) : child);
3438         }
3439         return destNode;
3440       }
3441       function extend3(a2, b2) {
3442         a2.minX = Math.min(a2.minX, b2.minX);
3443         a2.minY = Math.min(a2.minY, b2.minY);
3444         a2.maxX = Math.max(a2.maxX, b2.maxX);
3445         a2.maxY = Math.max(a2.maxY, b2.maxY);
3446         return a2;
3447       }
3448       function compareNodeMinX2(a2, b2) {
3449         return a2.minX - b2.minX;
3450       }
3451       function compareNodeMinY2(a2, b2) {
3452         return a2.minY - b2.minY;
3453       }
3454       function bboxArea2(a2) {
3455         return (a2.maxX - a2.minX) * (a2.maxY - a2.minY);
3456       }
3457       function bboxMargin2(a2) {
3458         return a2.maxX - a2.minX + (a2.maxY - a2.minY);
3459       }
3460       function enlargedArea2(a2, b2) {
3461         return (Math.max(b2.maxX, a2.maxX) - Math.min(b2.minX, a2.minX)) * (Math.max(b2.maxY, a2.maxY) - Math.min(b2.minY, a2.minY));
3462       }
3463       function intersectionArea2(a2, b2) {
3464         var minX = Math.max(a2.minX, b2.minX), minY = Math.max(a2.minY, b2.minY), maxX = Math.min(a2.maxX, b2.maxX), maxY = Math.min(a2.maxY, b2.maxY);
3465         return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
3466       }
3467       function contains2(a2, b2) {
3468         return a2.minX <= b2.minX && a2.minY <= b2.minY && b2.maxX <= a2.maxX && b2.maxY <= a2.maxY;
3469       }
3470       function intersects2(a2, b2) {
3471         return b2.minX <= a2.maxX && b2.minY <= a2.maxY && b2.maxX >= a2.minX && b2.maxY >= a2.minY;
3472       }
3473       function createNode2(children2) {
3474         return {
3475           children: children2,
3476           height: 1,
3477           leaf: true,
3478           minX: Infinity,
3479           minY: Infinity,
3480           maxX: -Infinity,
3481           maxY: -Infinity
3482         };
3483       }
3484       function multiSelect2(arr, left, right, n3, compare2) {
3485         var stack = [left, right], mid;
3486         while (stack.length) {
3487           right = stack.pop();
3488           left = stack.pop();
3489           if (right - left <= n3) continue;
3490           mid = left + Math.ceil((right - left) / n3 / 2) * n3;
3491           quickselect3(arr, mid, left, right, compare2);
3492           stack.push(left, mid, mid, right);
3493         }
3494       }
3495     }
3496   });
3497
3498   // node_modules/lineclip/index.js
3499   var require_lineclip = __commonJS({
3500     "node_modules/lineclip/index.js"(exports2, module2) {
3501       "use strict";
3502       module2.exports = lineclip2;
3503       lineclip2.polyline = lineclip2;
3504       lineclip2.polygon = polygonclip2;
3505       function lineclip2(points, bbox2, result) {
3506         var len = points.length, codeA = bitCode2(points[0], bbox2), part = [], i3, a2, b2, codeB, lastCode;
3507         if (!result) result = [];
3508         for (i3 = 1; i3 < len; i3++) {
3509           a2 = points[i3 - 1];
3510           b2 = points[i3];
3511           codeB = lastCode = bitCode2(b2, bbox2);
3512           while (true) {
3513             if (!(codeA | codeB)) {
3514               part.push(a2);
3515               if (codeB !== lastCode) {
3516                 part.push(b2);
3517                 if (i3 < len - 1) {
3518                   result.push(part);
3519                   part = [];
3520                 }
3521               } else if (i3 === len - 1) {
3522                 part.push(b2);
3523               }
3524               break;
3525             } else if (codeA & codeB) {
3526               break;
3527             } else if (codeA) {
3528               a2 = intersect2(a2, b2, codeA, bbox2);
3529               codeA = bitCode2(a2, bbox2);
3530             } else {
3531               b2 = intersect2(a2, b2, codeB, bbox2);
3532               codeB = bitCode2(b2, bbox2);
3533             }
3534           }
3535           codeA = lastCode;
3536         }
3537         if (part.length) result.push(part);
3538         return result;
3539       }
3540       function polygonclip2(points, bbox2) {
3541         var result, edge, prev, prevInside, i3, p2, inside;
3542         for (edge = 1; edge <= 8; edge *= 2) {
3543           result = [];
3544           prev = points[points.length - 1];
3545           prevInside = !(bitCode2(prev, bbox2) & edge);
3546           for (i3 = 0; i3 < points.length; i3++) {
3547             p2 = points[i3];
3548             inside = !(bitCode2(p2, bbox2) & edge);
3549             if (inside !== prevInside) result.push(intersect2(prev, p2, edge, bbox2));
3550             if (inside) result.push(p2);
3551             prev = p2;
3552             prevInside = inside;
3553           }
3554           points = result;
3555           if (!points.length) break;
3556         }
3557         return result;
3558       }
3559       function intersect2(a2, b2, edge, bbox2) {
3560         return edge & 8 ? [a2[0] + (b2[0] - a2[0]) * (bbox2[3] - a2[1]) / (b2[1] - a2[1]), bbox2[3]] : (
3561           // top
3562           edge & 4 ? [a2[0] + (b2[0] - a2[0]) * (bbox2[1] - a2[1]) / (b2[1] - a2[1]), bbox2[1]] : (
3563             // bottom
3564             edge & 2 ? [bbox2[2], a2[1] + (b2[1] - a2[1]) * (bbox2[2] - a2[0]) / (b2[0] - a2[0])] : (
3565               // right
3566               edge & 1 ? [bbox2[0], a2[1] + (b2[1] - a2[1]) * (bbox2[0] - a2[0]) / (b2[0] - a2[0])] : (
3567                 // left
3568                 null
3569               )
3570             )
3571           )
3572         );
3573       }
3574       function bitCode2(p2, bbox2) {
3575         var code = 0;
3576         if (p2[0] < bbox2[0]) code |= 1;
3577         else if (p2[0] > bbox2[2]) code |= 2;
3578         if (p2[1] < bbox2[1]) code |= 4;
3579         else if (p2[1] > bbox2[3]) code |= 8;
3580         return code;
3581       }
3582     }
3583   });
3584
3585   // node_modules/which-polygon/index.js
3586   var require_which_polygon = __commonJS({
3587     "node_modules/which-polygon/index.js"(exports2, module2) {
3588       "use strict";
3589       var rbush = require_rbush();
3590       var lineclip2 = require_lineclip();
3591       module2.exports = whichPolygon5;
3592       function whichPolygon5(data) {
3593         var bboxes = [];
3594         for (var i3 = 0; i3 < data.features.length; i3++) {
3595           var feature3 = data.features[i3];
3596           if (!feature3.geometry) continue;
3597           var coords = feature3.geometry.coordinates;
3598           if (feature3.geometry.type === "Polygon") {
3599             bboxes.push(treeItem(coords, feature3.properties));
3600           } else if (feature3.geometry.type === "MultiPolygon") {
3601             for (var j2 = 0; j2 < coords.length; j2++) {
3602               bboxes.push(treeItem(coords[j2], feature3.properties));
3603             }
3604           }
3605         }
3606         var tree = rbush().load(bboxes);
3607         function query(p2, multi) {
3608           var output = [], result = tree.search({
3609             minX: p2[0],
3610             minY: p2[1],
3611             maxX: p2[0],
3612             maxY: p2[1]
3613           });
3614           for (var i4 = 0; i4 < result.length; i4++) {
3615             if (insidePolygon(result[i4].coords, p2)) {
3616               if (multi)
3617                 output.push(result[i4].props);
3618               else
3619                 return result[i4].props;
3620             }
3621           }
3622           return multi && output.length ? output : null;
3623         }
3624         query.tree = tree;
3625         query.bbox = function queryBBox(bbox2) {
3626           var output = [];
3627           var result = tree.search({
3628             minX: bbox2[0],
3629             minY: bbox2[1],
3630             maxX: bbox2[2],
3631             maxY: bbox2[3]
3632           });
3633           for (var i4 = 0; i4 < result.length; i4++) {
3634             if (polygonIntersectsBBox(result[i4].coords, bbox2)) {
3635               output.push(result[i4].props);
3636             }
3637           }
3638           return output;
3639         };
3640         return query;
3641       }
3642       function polygonIntersectsBBox(polygon2, bbox2) {
3643         var bboxCenter = [
3644           (bbox2[0] + bbox2[2]) / 2,
3645           (bbox2[1] + bbox2[3]) / 2
3646         ];
3647         if (insidePolygon(polygon2, bboxCenter)) return true;
3648         for (var i3 = 0; i3 < polygon2.length; i3++) {
3649           if (lineclip2(polygon2[i3], bbox2).length > 0) return true;
3650         }
3651         return false;
3652       }
3653       function insidePolygon(rings, p2) {
3654         var inside = false;
3655         for (var i3 = 0, len = rings.length; i3 < len; i3++) {
3656           var ring = rings[i3];
3657           for (var j2 = 0, len2 = ring.length, k2 = len2 - 1; j2 < len2; k2 = j2++) {
3658             if (rayIntersect(p2, ring[j2], ring[k2])) inside = !inside;
3659           }
3660         }
3661         return inside;
3662       }
3663       function rayIntersect(p2, p1, p22) {
3664         return p1[1] > p2[1] !== p22[1] > p2[1] && p2[0] < (p22[0] - p1[0]) * (p2[1] - p1[1]) / (p22[1] - p1[1]) + p1[0];
3665       }
3666       function treeItem(coords, props) {
3667         var item = {
3668           minX: Infinity,
3669           minY: Infinity,
3670           maxX: -Infinity,
3671           maxY: -Infinity,
3672           coords,
3673           props
3674         };
3675         for (var i3 = 0; i3 < coords[0].length; i3++) {
3676           var p2 = coords[0][i3];
3677           item.minX = Math.min(item.minX, p2[0]);
3678           item.minY = Math.min(item.minY, p2[1]);
3679           item.maxX = Math.max(item.maxX, p2[0]);
3680           item.maxY = Math.max(item.maxY, p2[1]);
3681         }
3682         return item;
3683       }
3684     }
3685   });
3686
3687   // node_modules/wgs84/index.js
3688   var require_wgs84 = __commonJS({
3689     "node_modules/wgs84/index.js"(exports2, module2) {
3690       module2.exports.RADIUS = 6378137;
3691       module2.exports.FLATTENING = 1 / 298.257223563;
3692       module2.exports.POLAR_RADIUS = 63567523142e-4;
3693     }
3694   });
3695
3696   // node_modules/@mapbox/geojson-area/index.js
3697   var require_geojson_area = __commonJS({
3698     "node_modules/@mapbox/geojson-area/index.js"(exports2, module2) {
3699       var wgs84 = require_wgs84();
3700       module2.exports.geometry = geometry;
3701       module2.exports.ring = ringArea;
3702       function geometry(_2) {
3703         var area = 0, i3;
3704         switch (_2.type) {
3705           case "Polygon":
3706             return polygonArea(_2.coordinates);
3707           case "MultiPolygon":
3708             for (i3 = 0; i3 < _2.coordinates.length; i3++) {
3709               area += polygonArea(_2.coordinates[i3]);
3710             }
3711             return area;
3712           case "Point":
3713           case "MultiPoint":
3714           case "LineString":
3715           case "MultiLineString":
3716             return 0;
3717           case "GeometryCollection":
3718             for (i3 = 0; i3 < _2.geometries.length; i3++) {
3719               area += geometry(_2.geometries[i3]);
3720             }
3721             return area;
3722         }
3723       }
3724       function polygonArea(coords) {
3725         var area = 0;
3726         if (coords && coords.length > 0) {
3727           area += Math.abs(ringArea(coords[0]));
3728           for (var i3 = 1; i3 < coords.length; i3++) {
3729             area -= Math.abs(ringArea(coords[i3]));
3730           }
3731         }
3732         return area;
3733       }
3734       function ringArea(coords) {
3735         var p1, p2, p3, lowerIndex, middleIndex, upperIndex, i3, area = 0, coordsLength = coords.length;
3736         if (coordsLength > 2) {
3737           for (i3 = 0; i3 < coordsLength; i3++) {
3738             if (i3 === coordsLength - 2) {
3739               lowerIndex = coordsLength - 2;
3740               middleIndex = coordsLength - 1;
3741               upperIndex = 0;
3742             } else if (i3 === coordsLength - 1) {
3743               lowerIndex = coordsLength - 1;
3744               middleIndex = 0;
3745               upperIndex = 1;
3746             } else {
3747               lowerIndex = i3;
3748               middleIndex = i3 + 1;
3749               upperIndex = i3 + 2;
3750             }
3751             p1 = coords[lowerIndex];
3752             p2 = coords[middleIndex];
3753             p3 = coords[upperIndex];
3754             area += (rad(p3[0]) - rad(p1[0])) * Math.sin(rad(p2[1]));
3755           }
3756           area = area * wgs84.RADIUS * wgs84.RADIUS / 2;
3757         }
3758         return area;
3759       }
3760       function rad(_2) {
3761         return _2 * Math.PI / 180;
3762       }
3763     }
3764   });
3765
3766   // node_modules/circle-to-polygon/input-validation/validateCenter.js
3767   var require_validateCenter = __commonJS({
3768     "node_modules/circle-to-polygon/input-validation/validateCenter.js"(exports2) {
3769       exports2.validateCenter = function validateCenter(center) {
3770         var validCenterLengths = [2, 3];
3771         if (!Array.isArray(center) || !validCenterLengths.includes(center.length)) {
3772           throw new Error("ERROR! Center has to be an array of length two or three");
3773         }
3774         var [lng, lat] = center;
3775         if (typeof lng !== "number" || typeof lat !== "number") {
3776           throw new Error(
3777             "ERROR! Longitude and Latitude has to be numbers but where ".concat(typeof lng, " and ").concat(typeof lat)
3778           );
3779         }
3780         if (lng > 180 || lng < -180) {
3781           throw new Error("ERROR! Longitude has to be between -180 and 180 but was ".concat(lng));
3782         }
3783         if (lat > 90 || lat < -90) {
3784           throw new Error("ERROR! Latitude has to be between -90 and 90 but was ".concat(lat));
3785         }
3786       };
3787     }
3788   });
3789
3790   // node_modules/circle-to-polygon/input-validation/validateRadius.js
3791   var require_validateRadius = __commonJS({
3792     "node_modules/circle-to-polygon/input-validation/validateRadius.js"(exports2) {
3793       exports2.validateRadius = function validateRadius(radius) {
3794         if (typeof radius !== "number") {
3795           throw new Error("ERROR! Radius has to be a positive number but was: ".concat(typeof radius));
3796         }
3797         if (radius <= 0) {
3798           throw new Error("ERROR! Radius has to be a positive number but was: ".concat(radius));
3799         }
3800       };
3801     }
3802   });
3803
3804   // node_modules/circle-to-polygon/input-validation/validateNumberOfEdges.js
3805   var require_validateNumberOfEdges = __commonJS({
3806     "node_modules/circle-to-polygon/input-validation/validateNumberOfEdges.js"(exports2) {
3807       exports2.validateNumberOfEdges = function validateNumberOfEdges(numberOfEdges) {
3808         if (typeof numberOfEdges !== "number") {
3809           const ARGUMENT_TYPE = Array.isArray(numberOfEdges) ? "array" : typeof numberOfEdges;
3810           throw new Error("ERROR! Number of edges has to be a number but was: ".concat(ARGUMENT_TYPE));
3811         }
3812         if (numberOfEdges < 3) {
3813           throw new Error("ERROR! Number of edges has to be at least 3 but was: ".concat(numberOfEdges));
3814         }
3815       };
3816     }
3817   });
3818
3819   // node_modules/circle-to-polygon/input-validation/validateEarthRadius.js
3820   var require_validateEarthRadius = __commonJS({
3821     "node_modules/circle-to-polygon/input-validation/validateEarthRadius.js"(exports2) {
3822       exports2.validateEarthRadius = function validateEarthRadius(earthRadius2) {
3823         if (typeof earthRadius2 !== "number") {
3824           const ARGUMENT_TYPE = Array.isArray(earthRadius2) ? "array" : typeof earthRadius2;
3825           throw new Error("ERROR! Earth radius has to be a number but was: ".concat(ARGUMENT_TYPE));
3826         }
3827         if (earthRadius2 <= 0) {
3828           throw new Error("ERROR! Earth radius has to be a positive number but was: ".concat(earthRadius2));
3829         }
3830       };
3831     }
3832   });
3833
3834   // node_modules/circle-to-polygon/input-validation/validateBearing.js
3835   var require_validateBearing = __commonJS({
3836     "node_modules/circle-to-polygon/input-validation/validateBearing.js"(exports2) {
3837       exports2.validateBearing = function validateBearing(bearing) {
3838         if (typeof bearing !== "number") {
3839           const ARGUMENT_TYPE = Array.isArray(bearing) ? "array" : typeof bearing;
3840           throw new Error("ERROR! Bearing has to be a number but was: ".concat(ARGUMENT_TYPE));
3841         }
3842       };
3843     }
3844   });
3845
3846   // node_modules/circle-to-polygon/input-validation/index.js
3847   var require_input_validation = __commonJS({
3848     "node_modules/circle-to-polygon/input-validation/index.js"(exports2) {
3849       var validateCenter = require_validateCenter().validateCenter;
3850       var validateRadius = require_validateRadius().validateRadius;
3851       var validateNumberOfEdges = require_validateNumberOfEdges().validateNumberOfEdges;
3852       var validateEarthRadius = require_validateEarthRadius().validateEarthRadius;
3853       var validateBearing = require_validateBearing().validateBearing;
3854       function validateInput({ center, radius, numberOfEdges, earthRadius: earthRadius2, bearing }) {
3855         validateCenter(center);
3856         validateRadius(radius);
3857         validateNumberOfEdges(numberOfEdges);
3858         validateEarthRadius(earthRadius2);
3859         validateBearing(bearing);
3860       }
3861       exports2.validateCenter = validateCenter;
3862       exports2.validateRadius = validateRadius;
3863       exports2.validateNumberOfEdges = validateNumberOfEdges;
3864       exports2.validateEarthRadius = validateEarthRadius;
3865       exports2.validateBearing = validateBearing;
3866       exports2.validateInput = validateInput;
3867     }
3868   });
3869
3870   // node_modules/circle-to-polygon/index.js
3871   var require_circle_to_polygon = __commonJS({
3872     "node_modules/circle-to-polygon/index.js"(exports2, module2) {
3873       "use strict";
3874       var { validateInput } = require_input_validation();
3875       var defaultEarthRadius = 6378137;
3876       function toRadians(angleInDegrees) {
3877         return angleInDegrees * Math.PI / 180;
3878       }
3879       function toDegrees(angleInRadians) {
3880         return angleInRadians * 180 / Math.PI;
3881       }
3882       function offset(c1, distance, earthRadius2, bearing) {
3883         var lat1 = toRadians(c1[1]);
3884         var lon1 = toRadians(c1[0]);
3885         var dByR = distance / earthRadius2;
3886         var lat = Math.asin(
3887           Math.sin(lat1) * Math.cos(dByR) + Math.cos(lat1) * Math.sin(dByR) * Math.cos(bearing)
3888         );
3889         var lon = lon1 + Math.atan2(
3890           Math.sin(bearing) * Math.sin(dByR) * Math.cos(lat1),
3891           Math.cos(dByR) - Math.sin(lat1) * Math.sin(lat)
3892         );
3893         return [toDegrees(lon), toDegrees(lat)];
3894       }
3895       module2.exports = function circleToPolygon2(center, radius, options2) {
3896         var n3 = getNumberOfEdges(options2);
3897         var earthRadius2 = getEarthRadius(options2);
3898         var bearing = getBearing(options2);
3899         var direction = getDirection(options2);
3900         validateInput({ center, radius, numberOfEdges: n3, earthRadius: earthRadius2, bearing });
3901         var start2 = toRadians(bearing);
3902         var coordinates = [];
3903         for (var i3 = 0; i3 < n3; ++i3) {
3904           coordinates.push(
3905             offset(
3906               center,
3907               radius,
3908               earthRadius2,
3909               start2 + direction * 2 * Math.PI * -i3 / n3
3910             )
3911           );
3912         }
3913         coordinates.push(coordinates[0]);
3914         return {
3915           type: "Polygon",
3916           coordinates: [coordinates]
3917         };
3918       };
3919       function getNumberOfEdges(options2) {
3920         if (isUndefinedOrNull(options2)) {
3921           return 32;
3922         } else if (isObjectNotArray(options2)) {
3923           var numberOfEdges = options2.numberOfEdges;
3924           return numberOfEdges === void 0 ? 32 : numberOfEdges;
3925         }
3926         return options2;
3927       }
3928       function getEarthRadius(options2) {
3929         if (isUndefinedOrNull(options2)) {
3930           return defaultEarthRadius;
3931         } else if (isObjectNotArray(options2)) {
3932           var earthRadius2 = options2.earthRadius;
3933           return earthRadius2 === void 0 ? defaultEarthRadius : earthRadius2;
3934         }
3935         return defaultEarthRadius;
3936       }
3937       function getDirection(options2) {
3938         if (isObjectNotArray(options2) && options2.rightHandRule) {
3939           return -1;
3940         }
3941         return 1;
3942       }
3943       function getBearing(options2) {
3944         if (isUndefinedOrNull(options2)) {
3945           return 0;
3946         } else if (isObjectNotArray(options2)) {
3947           var bearing = options2.bearing;
3948           return bearing === void 0 ? 0 : bearing;
3949         }
3950         return 0;
3951       }
3952       function isObjectNotArray(argument) {
3953         return argument !== null && typeof argument === "object" && !Array.isArray(argument);
3954       }
3955       function isUndefinedOrNull(argument) {
3956         return argument === null || argument === void 0;
3957       }
3958     }
3959   });
3960
3961   // node_modules/geojson-precision/index.js
3962   var require_geojson_precision = __commonJS({
3963     "node_modules/geojson-precision/index.js"(exports2, module2) {
3964       (function() {
3965         function parse(t2, coordinatePrecision, extrasPrecision) {
3966           function point(p2) {
3967             return p2.map(function(e3, index) {
3968               if (index < 2) {
3969                 return 1 * e3.toFixed(coordinatePrecision);
3970               } else {
3971                 return 1 * e3.toFixed(extrasPrecision);
3972               }
3973             });
3974           }
3975           function multi(l2) {
3976             return l2.map(point);
3977           }
3978           function poly(p2) {
3979             return p2.map(multi);
3980           }
3981           function multiPoly(m2) {
3982             return m2.map(poly);
3983           }
3984           function geometry(obj) {
3985             if (!obj) {
3986               return {};
3987             }
3988             switch (obj.type) {
3989               case "Point":
3990                 obj.coordinates = point(obj.coordinates);
3991                 return obj;
3992               case "LineString":
3993               case "MultiPoint":
3994                 obj.coordinates = multi(obj.coordinates);
3995                 return obj;
3996               case "Polygon":
3997               case "MultiLineString":
3998                 obj.coordinates = poly(obj.coordinates);
3999                 return obj;
4000               case "MultiPolygon":
4001                 obj.coordinates = multiPoly(obj.coordinates);
4002                 return obj;
4003               case "GeometryCollection":
4004                 obj.geometries = obj.geometries.map(geometry);
4005                 return obj;
4006               default:
4007                 return {};
4008             }
4009           }
4010           function feature3(obj) {
4011             obj.geometry = geometry(obj.geometry);
4012             return obj;
4013           }
4014           function featureCollection(f2) {
4015             f2.features = f2.features.map(feature3);
4016             return f2;
4017           }
4018           function geometryCollection(g3) {
4019             g3.geometries = g3.geometries.map(geometry);
4020             return g3;
4021           }
4022           if (!t2) {
4023             return t2;
4024           }
4025           switch (t2.type) {
4026             case "Feature":
4027               return feature3(t2);
4028             case "GeometryCollection":
4029               return geometryCollection(t2);
4030             case "FeatureCollection":
4031               return featureCollection(t2);
4032             case "Point":
4033             case "LineString":
4034             case "Polygon":
4035             case "MultiPoint":
4036             case "MultiPolygon":
4037             case "MultiLineString":
4038               return geometry(t2);
4039             default:
4040               return t2;
4041           }
4042         }
4043         module2.exports = parse;
4044         module2.exports.parse = parse;
4045       })();
4046     }
4047   });
4048
4049   // node_modules/@aitodotai/json-stringify-pretty-compact/index.js
4050   var require_json_stringify_pretty_compact = __commonJS({
4051     "node_modules/@aitodotai/json-stringify-pretty-compact/index.js"(exports2, module2) {
4052       function isObject2(obj) {
4053         return typeof obj === "object" && obj !== null;
4054       }
4055       function forEach(obj, cb) {
4056         if (Array.isArray(obj)) {
4057           obj.forEach(cb);
4058         } else if (isObject2(obj)) {
4059           Object.keys(obj).forEach(function(key) {
4060             var val = obj[key];
4061             cb(val, key);
4062           });
4063         }
4064       }
4065       function getTreeDepth(obj) {
4066         var depth = 0;
4067         if (Array.isArray(obj) || isObject2(obj)) {
4068           forEach(obj, function(val) {
4069             if (Array.isArray(val) || isObject2(val)) {
4070               var tmpDepth = getTreeDepth(val);
4071               if (tmpDepth > depth) {
4072                 depth = tmpDepth;
4073               }
4074             }
4075           });
4076           return depth + 1;
4077         }
4078         return depth;
4079       }
4080       function stringify3(obj, options2) {
4081         options2 = options2 || {};
4082         var indent = JSON.stringify([1], null, get4(options2, "indent", 2)).slice(2, -3);
4083         var addMargin = get4(options2, "margins", false);
4084         var addArrayMargin = get4(options2, "arrayMargins", false);
4085         var addObjectMargin = get4(options2, "objectMargins", false);
4086         var maxLength = indent === "" ? Infinity : get4(options2, "maxLength", 80);
4087         var maxNesting = get4(options2, "maxNesting", Infinity);
4088         return function _stringify(obj2, currentIndent, reserved) {
4089           if (obj2 && typeof obj2.toJSON === "function") {
4090             obj2 = obj2.toJSON();
4091           }
4092           var string = JSON.stringify(obj2);
4093           if (string === void 0) {
4094             return string;
4095           }
4096           var length2 = maxLength - currentIndent.length - reserved;
4097           var treeDepth = getTreeDepth(obj2);
4098           if (treeDepth <= maxNesting && string.length <= length2) {
4099             var prettified = prettify(string, {
4100               addMargin,
4101               addArrayMargin,
4102               addObjectMargin
4103             });
4104             if (prettified.length <= length2) {
4105               return prettified;
4106             }
4107           }
4108           if (isObject2(obj2)) {
4109             var nextIndent = currentIndent + indent;
4110             var items = [];
4111             var delimiters;
4112             var comma = function(array2, index2) {
4113               return index2 === array2.length - 1 ? 0 : 1;
4114             };
4115             if (Array.isArray(obj2)) {
4116               for (var index = 0; index < obj2.length; index++) {
4117                 items.push(
4118                   _stringify(obj2[index], nextIndent, comma(obj2, index)) || "null"
4119                 );
4120               }
4121               delimiters = "[]";
4122             } else {
4123               Object.keys(obj2).forEach(function(key, index2, array2) {
4124                 var keyPart = JSON.stringify(key) + ": ";
4125                 var value = _stringify(
4126                   obj2[key],
4127                   nextIndent,
4128                   keyPart.length + comma(array2, index2)
4129                 );
4130                 if (value !== void 0) {
4131                   items.push(keyPart + value);
4132                 }
4133               });
4134               delimiters = "{}";
4135             }
4136             if (items.length > 0) {
4137               return [
4138                 delimiters[0],
4139                 indent + items.join(",\n" + nextIndent),
4140                 delimiters[1]
4141               ].join("\n" + currentIndent);
4142             }
4143           }
4144           return string;
4145         }(obj, "", 0);
4146       }
4147       var stringOrChar = /("(?:[^\\"]|\\.)*")|[:,\][}{]/g;
4148       function prettify(string, options2) {
4149         options2 = options2 || {};
4150         var tokens = {
4151           "{": "{",
4152           "}": "}",
4153           "[": "[",
4154           "]": "]",
4155           ",": ", ",
4156           ":": ": "
4157         };
4158         if (options2.addMargin || options2.addObjectMargin) {
4159           tokens["{"] = "{ ";
4160           tokens["}"] = " }";
4161         }
4162         if (options2.addMargin || options2.addArrayMargin) {
4163           tokens["["] = "[ ";
4164           tokens["]"] = " ]";
4165         }
4166         return string.replace(stringOrChar, function(match, string2) {
4167           return string2 ? match : tokens[match];
4168         });
4169       }
4170       function get4(options2, name, defaultValue) {
4171         return name in options2 ? options2[name] : defaultValue;
4172       }
4173       module2.exports = stringify3;
4174     }
4175   });
4176
4177   // node_modules/aes-js/index.js
4178   var require_aes_js = __commonJS({
4179     "node_modules/aes-js/index.js"(exports2, module2) {
4180       (function(root3) {
4181         "use strict";
4182         function checkInt(value) {
4183           return parseInt(value) === value;
4184         }
4185         function checkInts(arrayish) {
4186           if (!checkInt(arrayish.length)) {
4187             return false;
4188           }
4189           for (var i3 = 0; i3 < arrayish.length; i3++) {
4190             if (!checkInt(arrayish[i3]) || arrayish[i3] < 0 || arrayish[i3] > 255) {
4191               return false;
4192             }
4193           }
4194           return true;
4195         }
4196         function coerceArray(arg, copy2) {
4197           if (arg.buffer && arg.name === "Uint8Array") {
4198             if (copy2) {
4199               if (arg.slice) {
4200                 arg = arg.slice();
4201               } else {
4202                 arg = Array.prototype.slice.call(arg);
4203               }
4204             }
4205             return arg;
4206           }
4207           if (Array.isArray(arg)) {
4208             if (!checkInts(arg)) {
4209               throw new Error("Array contains invalid value: " + arg);
4210             }
4211             return new Uint8Array(arg);
4212           }
4213           if (checkInt(arg.length) && checkInts(arg)) {
4214             return new Uint8Array(arg);
4215           }
4216           throw new Error("unsupported array-like object");
4217         }
4218         function createArray(length2) {
4219           return new Uint8Array(length2);
4220         }
4221         function copyArray(sourceArray, targetArray, targetStart, sourceStart, sourceEnd) {
4222           if (sourceStart != null || sourceEnd != null) {
4223             if (sourceArray.slice) {
4224               sourceArray = sourceArray.slice(sourceStart, sourceEnd);
4225             } else {
4226               sourceArray = Array.prototype.slice.call(sourceArray, sourceStart, sourceEnd);
4227             }
4228           }
4229           targetArray.set(sourceArray, targetStart);
4230         }
4231         var convertUtf8 = /* @__PURE__ */ function() {
4232           function toBytes(text) {
4233             var result = [], i3 = 0;
4234             text = encodeURI(text);
4235             while (i3 < text.length) {
4236               var c2 = text.charCodeAt(i3++);
4237               if (c2 === 37) {
4238                 result.push(parseInt(text.substr(i3, 2), 16));
4239                 i3 += 2;
4240               } else {
4241                 result.push(c2);
4242               }
4243             }
4244             return coerceArray(result);
4245           }
4246           function fromBytes(bytes) {
4247             var result = [], i3 = 0;
4248             while (i3 < bytes.length) {
4249               var c2 = bytes[i3];
4250               if (c2 < 128) {
4251                 result.push(String.fromCharCode(c2));
4252                 i3++;
4253               } else if (c2 > 191 && c2 < 224) {
4254                 result.push(String.fromCharCode((c2 & 31) << 6 | bytes[i3 + 1] & 63));
4255                 i3 += 2;
4256               } else {
4257                 result.push(String.fromCharCode((c2 & 15) << 12 | (bytes[i3 + 1] & 63) << 6 | bytes[i3 + 2] & 63));
4258                 i3 += 3;
4259               }
4260             }
4261             return result.join("");
4262           }
4263           return {
4264             toBytes,
4265             fromBytes
4266           };
4267         }();
4268         var convertHex = /* @__PURE__ */ function() {
4269           function toBytes(text) {
4270             var result = [];
4271             for (var i3 = 0; i3 < text.length; i3 += 2) {
4272               result.push(parseInt(text.substr(i3, 2), 16));
4273             }
4274             return result;
4275           }
4276           var Hex = "0123456789abcdef";
4277           function fromBytes(bytes) {
4278             var result = [];
4279             for (var i3 = 0; i3 < bytes.length; i3++) {
4280               var v2 = bytes[i3];
4281               result.push(Hex[(v2 & 240) >> 4] + Hex[v2 & 15]);
4282             }
4283             return result.join("");
4284           }
4285           return {
4286             toBytes,
4287             fromBytes
4288           };
4289         }();
4290         var numberOfRounds = { 16: 10, 24: 12, 32: 14 };
4291         var rcon = [1, 2, 4, 8, 16, 32, 64, 128, 27, 54, 108, 216, 171, 77, 154, 47, 94, 188, 99, 198, 151, 53, 106, 212, 179, 125, 250, 239, 197, 145];
4292         var S2 = [99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, 243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22];
4293         var Si = [82, 9, 106, 213, 48, 54, 165, 56, 191, 64, 163, 158, 129, 243, 215, 251, 124, 227, 57, 130, 155, 47, 255, 135, 52, 142, 67, 68, 196, 222, 233, 203, 84, 123, 148, 50, 166, 194, 35, 61, 238, 76, 149, 11, 66, 250, 195, 78, 8, 46, 161, 102, 40, 217, 36, 178, 118, 91, 162, 73, 109, 139, 209, 37, 114, 248, 246, 100, 134, 104, 152, 22, 212, 164, 92, 204, 93, 101, 182, 146, 108, 112, 72, 80, 253, 237, 185, 218, 94, 21, 70, 87, 167, 141, 157, 132, 144, 216, 171, 0, 140, 188, 211, 10, 247, 228, 88, 5, 184, 179, 69, 6, 208, 44, 30, 143, 202, 63, 15, 2, 193, 175, 189, 3, 1, 19, 138, 107, 58, 145, 17, 65, 79, 103, 220, 234, 151, 242, 207, 206, 240, 180, 230, 115, 150, 172, 116, 34, 231, 173, 53, 133, 226, 249, 55, 232, 28, 117, 223, 110, 71, 241, 26, 113, 29, 41, 197, 137, 111, 183, 98, 14, 170, 24, 190, 27, 252, 86, 62, 75, 198, 210, 121, 32, 154, 219, 192, 254, 120, 205, 90, 244, 31, 221, 168, 51, 136, 7, 199, 49, 177, 18, 16, 89, 39, 128, 236, 95, 96, 81, 127, 169, 25, 181, 74, 13, 45, 229, 122, 159, 147, 201, 156, 239, 160, 224, 59, 77, 174, 42, 245, 176, 200, 235, 187, 60, 131, 83, 153, 97, 23, 43, 4, 126, 186, 119, 214, 38, 225, 105, 20, 99, 85, 33, 12, 125];
4294         var T1 = [3328402341, 4168907908, 4000806809, 4135287693, 4294111757, 3597364157, 3731845041, 2445657428, 1613770832, 33620227, 3462883241, 1445669757, 3892248089, 3050821474, 1303096294, 3967186586, 2412431941, 528646813, 2311702848, 4202528135, 4026202645, 2992200171, 2387036105, 4226871307, 1101901292, 3017069671, 1604494077, 1169141738, 597466303, 1403299063, 3832705686, 2613100635, 1974974402, 3791519004, 1033081774, 1277568618, 1815492186, 2118074177, 4126668546, 2211236943, 1748251740, 1369810420, 3521504564, 4193382664, 3799085459, 2883115123, 1647391059, 706024767, 134480908, 2512897874, 1176707941, 2646852446, 806885416, 932615841, 168101135, 798661301, 235341577, 605164086, 461406363, 3756188221, 3454790438, 1311188841, 2142417613, 3933566367, 302582043, 495158174, 1479289972, 874125870, 907746093, 3698224818, 3025820398, 1537253627, 2756858614, 1983593293, 3084310113, 2108928974, 1378429307, 3722699582, 1580150641, 327451799, 2790478837, 3117535592, 0, 3253595436, 1075847264, 3825007647, 2041688520, 3059440621, 3563743934, 2378943302, 1740553945, 1916352843, 2487896798, 2555137236, 2958579944, 2244988746, 3151024235, 3320835882, 1336584933, 3992714006, 2252555205, 2588757463, 1714631509, 293963156, 2319795663, 3925473552, 67240454, 4269768577, 2689618160, 2017213508, 631218106, 1269344483, 2723238387, 1571005438, 2151694528, 93294474, 1066570413, 563977660, 1882732616, 4059428100, 1673313503, 2008463041, 2950355573, 1109467491, 537923632, 3858759450, 4260623118, 3218264685, 2177748300, 403442708, 638784309, 3287084079, 3193921505, 899127202, 2286175436, 773265209, 2479146071, 1437050866, 4236148354, 2050833735, 3362022572, 3126681063, 840505643, 3866325909, 3227541664, 427917720, 2655997905, 2749160575, 1143087718, 1412049534, 999329963, 193497219, 2353415882, 3354324521, 1807268051, 672404540, 2816401017, 3160301282, 369822493, 2916866934, 3688947771, 1681011286, 1949973070, 336202270, 2454276571, 201721354, 1210328172, 3093060836, 2680341085, 3184776046, 1135389935, 3294782118, 965841320, 831886756, 3554993207, 4068047243, 3588745010, 2345191491, 1849112409, 3664604599, 26054028, 2983581028, 2622377682, 1235855840, 3630984372, 2891339514, 4092916743, 3488279077, 3395642799, 4101667470, 1202630377, 268961816, 1874508501, 4034427016, 1243948399, 1546530418, 941366308, 1470539505, 1941222599, 2546386513, 3421038627, 2715671932, 3899946140, 1042226977, 2521517021, 1639824860, 227249030, 260737669, 3765465232, 2084453954, 1907733956, 3429263018, 2420656344, 100860677, 4160157185, 470683154, 3261161891, 1781871967, 2924959737, 1773779408, 394692241, 2579611992, 974986535, 664706745, 3655459128, 3958962195, 731420851, 571543859, 3530123707, 2849626480, 126783113, 865375399, 765172662, 1008606754, 361203602, 3387549984, 2278477385, 2857719295, 1344809080, 2782912378, 59542671, 1503764984, 160008576, 437062935, 1707065306, 3622233649, 2218934982, 3496503480, 2185314755, 697932208, 1512910199, 504303377, 2075177163, 2824099068, 1841019862, 739644986];
4295         var T2 = [2781242211, 2230877308, 2582542199, 2381740923, 234877682, 3184946027, 2984144751, 1418839493, 1348481072, 50462977, 2848876391, 2102799147, 434634494, 1656084439, 3863849899, 2599188086, 1167051466, 2636087938, 1082771913, 2281340285, 368048890, 3954334041, 3381544775, 201060592, 3963727277, 1739838676, 4250903202, 3930435503, 3206782108, 4149453988, 2531553906, 1536934080, 3262494647, 484572669, 2923271059, 1783375398, 1517041206, 1098792767, 49674231, 1334037708, 1550332980, 4098991525, 886171109, 150598129, 2481090929, 1940642008, 1398944049, 1059722517, 201851908, 1385547719, 1699095331, 1587397571, 674240536, 2704774806, 252314885, 3039795866, 151914247, 908333586, 2602270848, 1038082786, 651029483, 1766729511, 3447698098, 2682942837, 454166793, 2652734339, 1951935532, 775166490, 758520603, 3000790638, 4004797018, 4217086112, 4137964114, 1299594043, 1639438038, 3464344499, 2068982057, 1054729187, 1901997871, 2534638724, 4121318227, 1757008337, 0, 750906861, 1614815264, 535035132, 3363418545, 3988151131, 3201591914, 1183697867, 3647454910, 1265776953, 3734260298, 3566750796, 3903871064, 1250283471, 1807470800, 717615087, 3847203498, 384695291, 3313910595, 3617213773, 1432761139, 2484176261, 3481945413, 283769337, 100925954, 2180939647, 4037038160, 1148730428, 3123027871, 3813386408, 4087501137, 4267549603, 3229630528, 2315620239, 2906624658, 3156319645, 1215313976, 82966005, 3747855548, 3245848246, 1974459098, 1665278241, 807407632, 451280895, 251524083, 1841287890, 1283575245, 337120268, 891687699, 801369324, 3787349855, 2721421207, 3431482436, 959321879, 1469301956, 4065699751, 2197585534, 1199193405, 2898814052, 3887750493, 724703513, 2514908019, 2696962144, 2551808385, 3516813135, 2141445340, 1715741218, 2119445034, 2872807568, 2198571144, 3398190662, 700968686, 3547052216, 1009259540, 2041044702, 3803995742, 487983883, 1991105499, 1004265696, 1449407026, 1316239930, 504629770, 3683797321, 168560134, 1816667172, 3837287516, 1570751170, 1857934291, 4014189740, 2797888098, 2822345105, 2754712981, 936633572, 2347923833, 852879335, 1133234376, 1500395319, 3084545389, 2348912013, 1689376213, 3533459022, 3762923945, 3034082412, 4205598294, 133428468, 634383082, 2949277029, 2398386810, 3913789102, 403703816, 3580869306, 2297460856, 1867130149, 1918643758, 607656988, 4049053350, 3346248884, 1368901318, 600565992, 2090982877, 2632479860, 557719327, 3717614411, 3697393085, 2249034635, 2232388234, 2430627952, 1115438654, 3295786421, 2865522278, 3633334344, 84280067, 33027830, 303828494, 2747425121, 1600795957, 4188952407, 3496589753, 2434238086, 1486471617, 658119965, 3106381470, 953803233, 334231800, 3005978776, 857870609, 3151128937, 1890179545, 2298973838, 2805175444, 3056442267, 574365214, 2450884487, 550103529, 1233637070, 4289353045, 2018519080, 2057691103, 2399374476, 4166623649, 2148108681, 387583245, 3664101311, 836232934, 3330556482, 3100665960, 3280093505, 2955516313, 2002398509, 287182607, 3413881008, 4238890068, 3597515707, 975967766];
4296         var T3 = [1671808611, 2089089148, 2006576759, 2072901243, 4061003762, 1807603307, 1873927791, 3310653893, 810573872, 16974337, 1739181671, 729634347, 4263110654, 3613570519, 2883997099, 1989864566, 3393556426, 2191335298, 3376449993, 2106063485, 4195741690, 1508618841, 1204391495, 4027317232, 2917941677, 3563566036, 2734514082, 2951366063, 2629772188, 2767672228, 1922491506, 3227229120, 3082974647, 4246528509, 2477669779, 644500518, 911895606, 1061256767, 4144166391, 3427763148, 878471220, 2784252325, 3845444069, 4043897329, 1905517169, 3631459288, 827548209, 356461077, 67897348, 3344078279, 593839651, 3277757891, 405286936, 2527147926, 84871685, 2595565466, 118033927, 305538066, 2157648768, 3795705826, 3945188843, 661212711, 2999812018, 1973414517, 152769033, 2208177539, 745822252, 439235610, 455947803, 1857215598, 1525593178, 2700827552, 1391895634, 994932283, 3596728278, 3016654259, 695947817, 3812548067, 795958831, 2224493444, 1408607827, 3513301457, 0, 3979133421, 543178784, 4229948412, 2982705585, 1542305371, 1790891114, 3410398667, 3201918910, 961245753, 1256100938, 1289001036, 1491644504, 3477767631, 3496721360, 4012557807, 2867154858, 4212583931, 1137018435, 1305975373, 861234739, 2241073541, 1171229253, 4178635257, 33948674, 2139225727, 1357946960, 1011120188, 2679776671, 2833468328, 1374921297, 2751356323, 1086357568, 2408187279, 2460827538, 2646352285, 944271416, 4110742005, 3168756668, 3066132406, 3665145818, 560153121, 271589392, 4279952895, 4077846003, 3530407890, 3444343245, 202643468, 322250259, 3962553324, 1608629855, 2543990167, 1154254916, 389623319, 3294073796, 2817676711, 2122513534, 1028094525, 1689045092, 1575467613, 422261273, 1939203699, 1621147744, 2174228865, 1339137615, 3699352540, 577127458, 712922154, 2427141008, 2290289544, 1187679302, 3995715566, 3100863416, 339486740, 3732514782, 1591917662, 186455563, 3681988059, 3762019296, 844522546, 978220090, 169743370, 1239126601, 101321734, 611076132, 1558493276, 3260915650, 3547250131, 2901361580, 1655096418, 2443721105, 2510565781, 3828863972, 2039214713, 3878868455, 3359869896, 928607799, 1840765549, 2374762893, 3580146133, 1322425422, 2850048425, 1823791212, 1459268694, 4094161908, 3928346602, 1706019429, 2056189050, 2934523822, 135794696, 3134549946, 2022240376, 628050469, 779246638, 472135708, 2800834470, 3032970164, 3327236038, 3894660072, 3715932637, 1956440180, 522272287, 1272813131, 3185336765, 2340818315, 2323976074, 1888542832, 1044544574, 3049550261, 1722469478, 1222152264, 50660867, 4127324150, 236067854, 1638122081, 895445557, 1475980887, 3117443513, 2257655686, 3243809217, 489110045, 2662934430, 3778599393, 4162055160, 2561878936, 288563729, 1773916777, 3648039385, 2391345038, 2493985684, 2612407707, 505560094, 2274497927, 3911240169, 3460925390, 1442818645, 678973480, 3749357023, 2358182796, 2717407649, 2306869641, 219617805, 3218761151, 3862026214, 1120306242, 1756942440, 1103331905, 2578459033, 762796589, 252780047, 2966125488, 1425844308, 3151392187, 372911126];
4297         var T4 = [1667474886, 2088535288, 2004326894, 2071694838, 4075949567, 1802223062, 1869591006, 3318043793, 808472672, 16843522, 1734846926, 724270422, 4278065639, 3621216949, 2880169549, 1987484396, 3402253711, 2189597983, 3385409673, 2105378810, 4210693615, 1499065266, 1195886990, 4042263547, 2913856577, 3570689971, 2728590687, 2947541573, 2627518243, 2762274643, 1920112356, 3233831835, 3082273397, 4261223649, 2475929149, 640051788, 909531756, 1061110142, 4160160501, 3435941763, 875846760, 2779116625, 3857003729, 4059105529, 1903268834, 3638064043, 825316194, 353713962, 67374088, 3351728789, 589522246, 3284360861, 404236336, 2526454071, 84217610, 2593830191, 117901582, 303183396, 2155911963, 3806477791, 3958056653, 656894286, 2998062463, 1970642922, 151591698, 2206440989, 741110872, 437923380, 454765878, 1852748508, 1515908788, 2694904667, 1381168804, 993742198, 3604373943, 3014905469, 690584402, 3823320797, 791638366, 2223281939, 1398011302, 3520161977, 0, 3991743681, 538992704, 4244381667, 2981218425, 1532751286, 1785380564, 3419096717, 3200178535, 960056178, 1246420628, 1280103576, 1482221744, 3486468741, 3503319995, 4025428677, 2863326543, 4227536621, 1128514950, 1296947098, 859002214, 2240123921, 1162203018, 4193849577, 33687044, 2139062782, 1347481760, 1010582648, 2678045221, 2829640523, 1364325282, 2745433693, 1077985408, 2408548869, 2459086143, 2644360225, 943212656, 4126475505, 3166494563, 3065430391, 3671750063, 555836226, 269496352, 4294908645, 4092792573, 3537006015, 3452783745, 202118168, 320025894, 3974901699, 1600119230, 2543297077, 1145359496, 387397934, 3301201811, 2812801621, 2122220284, 1027426170, 1684319432, 1566435258, 421079858, 1936954854, 1616945344, 2172753945, 1330631070, 3705438115, 572679748, 707427924, 2425400123, 2290647819, 1179044492, 4008585671, 3099120491, 336870440, 3739122087, 1583276732, 185277718, 3688593069, 3772791771, 842159716, 976899700, 168435220, 1229577106, 101059084, 606366792, 1549591736, 3267517855, 3553849021, 2897014595, 1650632388, 2442242105, 2509612081, 3840161747, 2038008818, 3890688725, 3368567691, 926374254, 1835907034, 2374863873, 3587531953, 1313788572, 2846482505, 1819063512, 1448540844, 4109633523, 3941213647, 1701162954, 2054852340, 2930698567, 134748176, 3132806511, 2021165296, 623210314, 774795868, 471606328, 2795958615, 3031746419, 3334885783, 3907527627, 3722280097, 1953799400, 522133822, 1263263126, 3183336545, 2341176845, 2324333839, 1886425312, 1044267644, 3048588401, 1718004428, 1212733584, 50529542, 4143317495, 235803164, 1633788866, 892690282, 1465383342, 3115962473, 2256965911, 3250673817, 488449850, 2661202215, 3789633753, 4177007595, 2560144171, 286339874, 1768537042, 3654906025, 2391705863, 2492770099, 2610673197, 505291324, 2273808917, 3924369609, 3469625735, 1431699370, 673740880, 3755965093, 2358021891, 2711746649, 2307489801, 218961690, 3217021541, 3873845719, 1111672452, 1751693520, 1094828930, 2576986153, 757954394, 252645662, 2964376443, 1414855848, 3149649517, 370555436];
4298         var T5 = [1374988112, 2118214995, 437757123, 975658646, 1001089995, 530400753, 2902087851, 1273168787, 540080725, 2910219766, 2295101073, 4110568485, 1340463100, 3307916247, 641025152, 3043140495, 3736164937, 632953703, 1172967064, 1576976609, 3274667266, 2169303058, 2370213795, 1809054150, 59727847, 361929877, 3211623147, 2505202138, 3569255213, 1484005843, 1239443753, 2395588676, 1975683434, 4102977912, 2572697195, 666464733, 3202437046, 4035489047, 3374361702, 2110667444, 1675577880, 3843699074, 2538681184, 1649639237, 2976151520, 3144396420, 4269907996, 4178062228, 1883793496, 2403728665, 2497604743, 1383856311, 2876494627, 1917518562, 3810496343, 1716890410, 3001755655, 800440835, 2261089178, 3543599269, 807962610, 599762354, 33778362, 3977675356, 2328828971, 2809771154, 4077384432, 1315562145, 1708848333, 101039829, 3509871135, 3299278474, 875451293, 2733856160, 92987698, 2767645557, 193195065, 1080094634, 1584504582, 3178106961, 1042385657, 2531067453, 3711829422, 1306967366, 2438237621, 1908694277, 67556463, 1615861247, 429456164, 3602770327, 2302690252, 1742315127, 2968011453, 126454664, 3877198648, 2043211483, 2709260871, 2084704233, 4169408201, 0, 159417987, 841739592, 504459436, 1817866830, 4245618683, 260388950, 1034867998, 908933415, 168810852, 1750902305, 2606453969, 607530554, 202008497, 2472011535, 3035535058, 463180190, 2160117071, 1641816226, 1517767529, 470948374, 3801332234, 3231722213, 1008918595, 303765277, 235474187, 4069246893, 766945465, 337553864, 1475418501, 2943682380, 4003061179, 2743034109, 4144047775, 1551037884, 1147550661, 1543208500, 2336434550, 3408119516, 3069049960, 3102011747, 3610369226, 1113818384, 328671808, 2227573024, 2236228733, 3535486456, 2935566865, 3341394285, 496906059, 3702665459, 226906860, 2009195472, 733156972, 2842737049, 294930682, 1206477858, 2835123396, 2700099354, 1451044056, 573804783, 2269728455, 3644379585, 2362090238, 2564033334, 2801107407, 2776292904, 3669462566, 1068351396, 742039012, 1350078989, 1784663195, 1417561698, 4136440770, 2430122216, 775550814, 2193862645, 2673705150, 1775276924, 1876241833, 3475313331, 3366754619, 270040487, 3902563182, 3678124923, 3441850377, 1851332852, 3969562369, 2203032232, 3868552805, 2868897406, 566021896, 4011190502, 3135740889, 1248802510, 3936291284, 699432150, 832877231, 708780849, 3332740144, 899835584, 1951317047, 4236429990, 3767586992, 866637845, 4043610186, 1106041591, 2144161806, 395441711, 1984812685, 1139781709, 3433712980, 3835036895, 2664543715, 1282050075, 3240894392, 1181045119, 2640243204, 25965917, 4203181171, 4211818798, 3009879386, 2463879762, 3910161971, 1842759443, 2597806476, 933301370, 1509430414, 3943906441, 3467192302, 3076639029, 3776767469, 2051518780, 2631065433, 1441952575, 404016761, 1942435775, 1408749034, 1610459739, 3745345300, 2017778566, 3400528769, 3110650942, 941896748, 3265478751, 371049330, 3168937228, 675039627, 4279080257, 967311729, 135050206, 3635733660, 1683407248, 2076935265, 3576870512, 1215061108, 3501741890];
4299         var T6 = [1347548327, 1400783205, 3273267108, 2520393566, 3409685355, 4045380933, 2880240216, 2471224067, 1428173050, 4138563181, 2441661558, 636813900, 4233094615, 3620022987, 2149987652, 2411029155, 1239331162, 1730525723, 2554718734, 3781033664, 46346101, 310463728, 2743944855, 3328955385, 3875770207, 2501218972, 3955191162, 3667219033, 768917123, 3545789473, 692707433, 1150208456, 1786102409, 2029293177, 1805211710, 3710368113, 3065962831, 401639597, 1724457132, 3028143674, 409198410, 2196052529, 1620529459, 1164071807, 3769721975, 2226875310, 486441376, 2499348523, 1483753576, 428819965, 2274680428, 3075636216, 598438867, 3799141122, 1474502543, 711349675, 129166120, 53458370, 2592523643, 2782082824, 4063242375, 2988687269, 3120694122, 1559041666, 730517276, 2460449204, 4042459122, 2706270690, 3446004468, 3573941694, 533804130, 2328143614, 2637442643, 2695033685, 839224033, 1973745387, 957055980, 2856345839, 106852767, 1371368976, 4181598602, 1033297158, 2933734917, 1179510461, 3046200461, 91341917, 1862534868, 4284502037, 605657339, 2547432937, 3431546947, 2003294622, 3182487618, 2282195339, 954669403, 3682191598, 1201765386, 3917234703, 3388507166, 0, 2198438022, 1211247597, 2887651696, 1315723890, 4227665663, 1443857720, 507358933, 657861945, 1678381017, 560487590, 3516619604, 975451694, 2970356327, 261314535, 3535072918, 2652609425, 1333838021, 2724322336, 1767536459, 370938394, 182621114, 3854606378, 1128014560, 487725847, 185469197, 2918353863, 3106780840, 3356761769, 2237133081, 1286567175, 3152976349, 4255350624, 2683765030, 3160175349, 3309594171, 878443390, 1988838185, 3704300486, 1756818940, 1673061617, 3403100636, 272786309, 1075025698, 545572369, 2105887268, 4174560061, 296679730, 1841768865, 1260232239, 4091327024, 3960309330, 3497509347, 1814803222, 2578018489, 4195456072, 575138148, 3299409036, 446754879, 3629546796, 4011996048, 3347532110, 3252238545, 4270639778, 915985419, 3483825537, 681933534, 651868046, 2755636671, 3828103837, 223377554, 2607439820, 1649704518, 3270937875, 3901806776, 1580087799, 4118987695, 3198115200, 2087309459, 2842678573, 3016697106, 1003007129, 2802849917, 1860738147, 2077965243, 164439672, 4100872472, 32283319, 2827177882, 1709610350, 2125135846, 136428751, 3874428392, 3652904859, 3460984630, 3572145929, 3593056380, 2939266226, 824852259, 818324884, 3224740454, 930369212, 2801566410, 2967507152, 355706840, 1257309336, 4148292826, 243256656, 790073846, 2373340630, 1296297904, 1422699085, 3756299780, 3818836405, 457992840, 3099667487, 2135319889, 77422314, 1560382517, 1945798516, 788204353, 1521706781, 1385356242, 870912086, 325965383, 2358957921, 2050466060, 2388260884, 2313884476, 4006521127, 901210569, 3990953189, 1014646705, 1503449823, 1062597235, 2031621326, 3212035895, 3931371469, 1533017514, 350174575, 2256028891, 2177544179, 1052338372, 741876788, 1606591296, 1914052035, 213705253, 2334669897, 1107234197, 1899603969, 3725069491, 2631447780, 2422494913, 1635502980, 1893020342, 1950903388, 1120974935];
4300         var T7 = [2807058932, 1699970625, 2764249623, 1586903591, 1808481195, 1173430173, 1487645946, 59984867, 4199882800, 1844882806, 1989249228, 1277555970, 3623636965, 3419915562, 1149249077, 2744104290, 1514790577, 459744698, 244860394, 3235995134, 1963115311, 4027744588, 2544078150, 4190530515, 1608975247, 2627016082, 2062270317, 1507497298, 2200818878, 567498868, 1764313568, 3359936201, 2305455554, 2037970062, 1047239e3, 1910319033, 1337376481, 2904027272, 2892417312, 984907214, 1243112415, 830661914, 861968209, 2135253587, 2011214180, 2927934315, 2686254721, 731183368, 1750626376, 4246310725, 1820824798, 4172763771, 3542330227, 48394827, 2404901663, 2871682645, 671593195, 3254988725, 2073724613, 145085239, 2280796200, 2779915199, 1790575107, 2187128086, 472615631, 3029510009, 4075877127, 3802222185, 4107101658, 3201631749, 1646252340, 4270507174, 1402811438, 1436590835, 3778151818, 3950355702, 3963161475, 4020912224, 2667994737, 273792366, 2331590177, 104699613, 95345982, 3175501286, 2377486676, 1560637892, 3564045318, 369057872, 4213447064, 3919042237, 1137477952, 2658625497, 1119727848, 2340947849, 1530455833, 4007360968, 172466556, 266959938, 516552836, 0, 2256734592, 3980931627, 1890328081, 1917742170, 4294704398, 945164165, 3575528878, 958871085, 3647212047, 2787207260, 1423022939, 775562294, 1739656202, 3876557655, 2530391278, 2443058075, 3310321856, 547512796, 1265195639, 437656594, 3121275539, 719700128, 3762502690, 387781147, 218828297, 3350065803, 2830708150, 2848461854, 428169201, 122466165, 3720081049, 1627235199, 648017665, 4122762354, 1002783846, 2117360635, 695634755, 3336358691, 4234721005, 4049844452, 3704280881, 2232435299, 574624663, 287343814, 612205898, 1039717051, 840019705, 2708326185, 793451934, 821288114, 1391201670, 3822090177, 376187827, 3113855344, 1224348052, 1679968233, 2361698556, 1058709744, 752375421, 2431590963, 1321699145, 3519142200, 2734591178, 188127444, 2177869557, 3727205754, 2384911031, 3215212461, 2648976442, 2450346104, 3432737375, 1180849278, 331544205, 3102249176, 4150144569, 2952102595, 2159976285, 2474404304, 766078933, 313773861, 2570832044, 2108100632, 1668212892, 3145456443, 2013908262, 418672217, 3070356634, 2594734927, 1852171925, 3867060991, 3473416636, 3907448597, 2614737639, 919489135, 164948639, 2094410160, 2997825956, 590424639, 2486224549, 1723872674, 3157750862, 3399941250, 3501252752, 3625268135, 2555048196, 3673637356, 1343127501, 4130281361, 3599595085, 2957853679, 1297403050, 81781910, 3051593425, 2283490410, 532201772, 1367295589, 3926170974, 895287692, 1953757831, 1093597963, 492483431, 3528626907, 1446242576, 1192455638, 1636604631, 209336225, 344873464, 1015671571, 669961897, 3375740769, 3857572124, 2973530695, 3747192018, 1933530610, 3464042516, 935293895, 3454686199, 2858115069, 1863638845, 3683022916, 4085369519, 3292445032, 875313188, 1080017571, 3279033885, 621591778, 1233856572, 2504130317, 24197544, 3017672716, 3835484340, 3247465558, 2220981195, 3060847922, 1551124588, 1463996600];
4301         var T8 = [4104605777, 1097159550, 396673818, 660510266, 2875968315, 2638606623, 4200115116, 3808662347, 821712160, 1986918061, 3430322568, 38544885, 3856137295, 718002117, 893681702, 1654886325, 2975484382, 3122358053, 3926825029, 4274053469, 796197571, 1290801793, 1184342925, 3556361835, 2405426947, 2459735317, 1836772287, 1381620373, 3196267988, 1948373848, 3764988233, 3385345166, 3263785589, 2390325492, 1480485785, 3111247143, 3780097726, 2293045232, 548169417, 3459953789, 3746175075, 439452389, 1362321559, 1400849762, 1685577905, 1806599355, 2174754046, 137073913, 1214797936, 1174215055, 3731654548, 2079897426, 1943217067, 1258480242, 529487843, 1437280870, 3945269170, 3049390895, 3313212038, 923313619, 679998e3, 3215307299, 57326082, 377642221, 3474729866, 2041877159, 133361907, 1776460110, 3673476453, 96392454, 878845905, 2801699524, 777231668, 4082475170, 2330014213, 4142626212, 2213296395, 1626319424, 1906247262, 1846563261, 562755902, 3708173718, 1040559837, 3871163981, 1418573201, 3294430577, 114585348, 1343618912, 2566595609, 3186202582, 1078185097, 3651041127, 3896688048, 2307622919, 425408743, 3371096953, 2081048481, 1108339068, 2216610296, 0, 2156299017, 736970802, 292596766, 1517440620, 251657213, 2235061775, 2933202493, 758720310, 265905162, 1554391400, 1532285339, 908999204, 174567692, 1474760595, 4002861748, 2610011675, 3234156416, 3693126241, 2001430874, 303699484, 2478443234, 2687165888, 585122620, 454499602, 151849742, 2345119218, 3064510765, 514443284, 4044981591, 1963412655, 2581445614, 2137062819, 19308535, 1928707164, 1715193156, 4219352155, 1126790795, 600235211, 3992742070, 3841024952, 836553431, 1669664834, 2535604243, 3323011204, 1243905413, 3141400786, 4180808110, 698445255, 2653899549, 2989552604, 2253581325, 3252932727, 3004591147, 1891211689, 2487810577, 3915653703, 4237083816, 4030667424, 2100090966, 865136418, 1229899655, 953270745, 3399679628, 3557504664, 4118925222, 2061379749, 3079546586, 2915017791, 983426092, 2022837584, 1607244650, 2118541908, 2366882550, 3635996816, 972512814, 3283088770, 1568718495, 3499326569, 3576539503, 621982671, 2895723464, 410887952, 2623762152, 1002142683, 645401037, 1494807662, 2595684844, 1335535747, 2507040230, 4293295786, 3167684641, 367585007, 3885750714, 1865862730, 2668221674, 2960971305, 2763173681, 1059270954, 2777952454, 2724642869, 1320957812, 2194319100, 2429595872, 2815956275, 77089521, 3973773121, 3444575871, 2448830231, 1305906550, 4021308739, 2857194700, 2516901860, 3518358430, 1787304780, 740276417, 1699839814, 1592394909, 2352307457, 2272556026, 188821243, 1729977011, 3687994002, 274084841, 3594982253, 3613494426, 2701949495, 4162096729, 322734571, 2837966542, 1640576439, 484830689, 1202797690, 3537852828, 4067639125, 349075736, 3342319475, 4157467219, 4255800159, 1030690015, 1155237496, 2951971274, 1757691577, 607398968, 2738905026, 499347990, 3794078908, 1011452712, 227885567, 2818666809, 213114376, 3034881240, 1455525988, 3414450555, 850817237, 1817998408, 3092726480];
4302         var U1 = [0, 235474187, 470948374, 303765277, 941896748, 908933415, 607530554, 708780849, 1883793496, 2118214995, 1817866830, 1649639237, 1215061108, 1181045119, 1417561698, 1517767529, 3767586992, 4003061179, 4236429990, 4069246893, 3635733660, 3602770327, 3299278474, 3400528769, 2430122216, 2664543715, 2362090238, 2193862645, 2835123396, 2801107407, 3035535058, 3135740889, 3678124923, 3576870512, 3341394285, 3374361702, 3810496343, 3977675356, 4279080257, 4043610186, 2876494627, 2776292904, 3076639029, 3110650942, 2472011535, 2640243204, 2403728665, 2169303058, 1001089995, 899835584, 666464733, 699432150, 59727847, 226906860, 530400753, 294930682, 1273168787, 1172967064, 1475418501, 1509430414, 1942435775, 2110667444, 1876241833, 1641816226, 2910219766, 2743034109, 2976151520, 3211623147, 2505202138, 2606453969, 2302690252, 2269728455, 3711829422, 3543599269, 3240894392, 3475313331, 3843699074, 3943906441, 4178062228, 4144047775, 1306967366, 1139781709, 1374988112, 1610459739, 1975683434, 2076935265, 1775276924, 1742315127, 1034867998, 866637845, 566021896, 800440835, 92987698, 193195065, 429456164, 395441711, 1984812685, 2017778566, 1784663195, 1683407248, 1315562145, 1080094634, 1383856311, 1551037884, 101039829, 135050206, 437757123, 337553864, 1042385657, 807962610, 573804783, 742039012, 2531067453, 2564033334, 2328828971, 2227573024, 2935566865, 2700099354, 3001755655, 3168937228, 3868552805, 3902563182, 4203181171, 4102977912, 3736164937, 3501741890, 3265478751, 3433712980, 1106041591, 1340463100, 1576976609, 1408749034, 2043211483, 2009195472, 1708848333, 1809054150, 832877231, 1068351396, 766945465, 599762354, 159417987, 126454664, 361929877, 463180190, 2709260871, 2943682380, 3178106961, 3009879386, 2572697195, 2538681184, 2236228733, 2336434550, 3509871135, 3745345300, 3441850377, 3274667266, 3910161971, 3877198648, 4110568485, 4211818798, 2597806476, 2497604743, 2261089178, 2295101073, 2733856160, 2902087851, 3202437046, 2968011453, 3936291284, 3835036895, 4136440770, 4169408201, 3535486456, 3702665459, 3467192302, 3231722213, 2051518780, 1951317047, 1716890410, 1750902305, 1113818384, 1282050075, 1584504582, 1350078989, 168810852, 67556463, 371049330, 404016761, 841739592, 1008918595, 775550814, 540080725, 3969562369, 3801332234, 4035489047, 4269907996, 3569255213, 3669462566, 3366754619, 3332740144, 2631065433, 2463879762, 2160117071, 2395588676, 2767645557, 2868897406, 3102011747, 3069049960, 202008497, 33778362, 270040487, 504459436, 875451293, 975658646, 675039627, 641025152, 2084704233, 1917518562, 1615861247, 1851332852, 1147550661, 1248802510, 1484005843, 1451044056, 933301370, 967311729, 733156972, 632953703, 260388950, 25965917, 328671808, 496906059, 1206477858, 1239443753, 1543208500, 1441952575, 2144161806, 1908694277, 1675577880, 1842759443, 3610369226, 3644379585, 3408119516, 3307916247, 4011190502, 3776767469, 4077384432, 4245618683, 2809771154, 2842737049, 3144396420, 3043140495, 2673705150, 2438237621, 2203032232, 2370213795];
4303         var U2 = [0, 185469197, 370938394, 487725847, 741876788, 657861945, 975451694, 824852259, 1483753576, 1400783205, 1315723890, 1164071807, 1950903388, 2135319889, 1649704518, 1767536459, 2967507152, 3152976349, 2801566410, 2918353863, 2631447780, 2547432937, 2328143614, 2177544179, 3901806776, 3818836405, 4270639778, 4118987695, 3299409036, 3483825537, 3535072918, 3652904859, 2077965243, 1893020342, 1841768865, 1724457132, 1474502543, 1559041666, 1107234197, 1257309336, 598438867, 681933534, 901210569, 1052338372, 261314535, 77422314, 428819965, 310463728, 3409685355, 3224740454, 3710368113, 3593056380, 3875770207, 3960309330, 4045380933, 4195456072, 2471224067, 2554718734, 2237133081, 2388260884, 3212035895, 3028143674, 2842678573, 2724322336, 4138563181, 4255350624, 3769721975, 3955191162, 3667219033, 3516619604, 3431546947, 3347532110, 2933734917, 2782082824, 3099667487, 3016697106, 2196052529, 2313884476, 2499348523, 2683765030, 1179510461, 1296297904, 1347548327, 1533017514, 1786102409, 1635502980, 2087309459, 2003294622, 507358933, 355706840, 136428751, 53458370, 839224033, 957055980, 605657339, 790073846, 2373340630, 2256028891, 2607439820, 2422494913, 2706270690, 2856345839, 3075636216, 3160175349, 3573941694, 3725069491, 3273267108, 3356761769, 4181598602, 4063242375, 4011996048, 3828103837, 1033297158, 915985419, 730517276, 545572369, 296679730, 446754879, 129166120, 213705253, 1709610350, 1860738147, 1945798516, 2029293177, 1239331162, 1120974935, 1606591296, 1422699085, 4148292826, 4233094615, 3781033664, 3931371469, 3682191598, 3497509347, 3446004468, 3328955385, 2939266226, 2755636671, 3106780840, 2988687269, 2198438022, 2282195339, 2501218972, 2652609425, 1201765386, 1286567175, 1371368976, 1521706781, 1805211710, 1620529459, 2105887268, 1988838185, 533804130, 350174575, 164439672, 46346101, 870912086, 954669403, 636813900, 788204353, 2358957921, 2274680428, 2592523643, 2441661558, 2695033685, 2880240216, 3065962831, 3182487618, 3572145929, 3756299780, 3270937875, 3388507166, 4174560061, 4091327024, 4006521127, 3854606378, 1014646705, 930369212, 711349675, 560487590, 272786309, 457992840, 106852767, 223377554, 1678381017, 1862534868, 1914052035, 2031621326, 1211247597, 1128014560, 1580087799, 1428173050, 32283319, 182621114, 401639597, 486441376, 768917123, 651868046, 1003007129, 818324884, 1503449823, 1385356242, 1333838021, 1150208456, 1973745387, 2125135846, 1673061617, 1756818940, 2970356327, 3120694122, 2802849917, 2887651696, 2637442643, 2520393566, 2334669897, 2149987652, 3917234703, 3799141122, 4284502037, 4100872472, 3309594171, 3460984630, 3545789473, 3629546796, 2050466060, 1899603969, 1814803222, 1730525723, 1443857720, 1560382517, 1075025698, 1260232239, 575138148, 692707433, 878443390, 1062597235, 243256656, 91341917, 409198410, 325965383, 3403100636, 3252238545, 3704300486, 3620022987, 3874428392, 3990953189, 4042459122, 4227665663, 2460449204, 2578018489, 2226875310, 2411029155, 3198115200, 3046200461, 2827177882, 2743944855];
4304         var U3 = [0, 218828297, 437656594, 387781147, 875313188, 958871085, 775562294, 590424639, 1750626376, 1699970625, 1917742170, 2135253587, 1551124588, 1367295589, 1180849278, 1265195639, 3501252752, 3720081049, 3399941250, 3350065803, 3835484340, 3919042237, 4270507174, 4085369519, 3102249176, 3051593425, 2734591178, 2952102595, 2361698556, 2177869557, 2530391278, 2614737639, 3145456443, 3060847922, 2708326185, 2892417312, 2404901663, 2187128086, 2504130317, 2555048196, 3542330227, 3727205754, 3375740769, 3292445032, 3876557655, 3926170974, 4246310725, 4027744588, 1808481195, 1723872674, 1910319033, 2094410160, 1608975247, 1391201670, 1173430173, 1224348052, 59984867, 244860394, 428169201, 344873464, 935293895, 984907214, 766078933, 547512796, 1844882806, 1627235199, 2011214180, 2062270317, 1507497298, 1423022939, 1137477952, 1321699145, 95345982, 145085239, 532201772, 313773861, 830661914, 1015671571, 731183368, 648017665, 3175501286, 2957853679, 2807058932, 2858115069, 2305455554, 2220981195, 2474404304, 2658625497, 3575528878, 3625268135, 3473416636, 3254988725, 3778151818, 3963161475, 4213447064, 4130281361, 3599595085, 3683022916, 3432737375, 3247465558, 3802222185, 4020912224, 4172763771, 4122762354, 3201631749, 3017672716, 2764249623, 2848461854, 2331590177, 2280796200, 2431590963, 2648976442, 104699613, 188127444, 472615631, 287343814, 840019705, 1058709744, 671593195, 621591778, 1852171925, 1668212892, 1953757831, 2037970062, 1514790577, 1463996600, 1080017571, 1297403050, 3673637356, 3623636965, 3235995134, 3454686199, 4007360968, 3822090177, 4107101658, 4190530515, 2997825956, 3215212461, 2830708150, 2779915199, 2256734592, 2340947849, 2627016082, 2443058075, 172466556, 122466165, 273792366, 492483431, 1047239e3, 861968209, 612205898, 695634755, 1646252340, 1863638845, 2013908262, 1963115311, 1446242576, 1530455833, 1277555970, 1093597963, 1636604631, 1820824798, 2073724613, 1989249228, 1436590835, 1487645946, 1337376481, 1119727848, 164948639, 81781910, 331544205, 516552836, 1039717051, 821288114, 669961897, 719700128, 2973530695, 3157750862, 2871682645, 2787207260, 2232435299, 2283490410, 2667994737, 2450346104, 3647212047, 3564045318, 3279033885, 3464042516, 3980931627, 3762502690, 4150144569, 4199882800, 3070356634, 3121275539, 2904027272, 2686254721, 2200818878, 2384911031, 2570832044, 2486224549, 3747192018, 3528626907, 3310321856, 3359936201, 3950355702, 3867060991, 4049844452, 4234721005, 1739656202, 1790575107, 2108100632, 1890328081, 1402811438, 1586903591, 1233856572, 1149249077, 266959938, 48394827, 369057872, 418672217, 1002783846, 919489135, 567498868, 752375421, 209336225, 24197544, 376187827, 459744698, 945164165, 895287692, 574624663, 793451934, 1679968233, 1764313568, 2117360635, 1933530610, 1343127501, 1560637892, 1243112415, 1192455638, 3704280881, 3519142200, 3336358691, 3419915562, 3907448597, 3857572124, 4075877127, 4294704398, 3029510009, 3113855344, 2927934315, 2744104290, 2159976285, 2377486676, 2594734927, 2544078150];
4305         var U4 = [0, 151849742, 303699484, 454499602, 607398968, 758720310, 908999204, 1059270954, 1214797936, 1097159550, 1517440620, 1400849762, 1817998408, 1699839814, 2118541908, 2001430874, 2429595872, 2581445614, 2194319100, 2345119218, 3034881240, 3186202582, 2801699524, 2951971274, 3635996816, 3518358430, 3399679628, 3283088770, 4237083816, 4118925222, 4002861748, 3885750714, 1002142683, 850817237, 698445255, 548169417, 529487843, 377642221, 227885567, 77089521, 1943217067, 2061379749, 1640576439, 1757691577, 1474760595, 1592394909, 1174215055, 1290801793, 2875968315, 2724642869, 3111247143, 2960971305, 2405426947, 2253581325, 2638606623, 2487810577, 3808662347, 3926825029, 4044981591, 4162096729, 3342319475, 3459953789, 3576539503, 3693126241, 1986918061, 2137062819, 1685577905, 1836772287, 1381620373, 1532285339, 1078185097, 1229899655, 1040559837, 923313619, 740276417, 621982671, 439452389, 322734571, 137073913, 19308535, 3871163981, 4021308739, 4104605777, 4255800159, 3263785589, 3414450555, 3499326569, 3651041127, 2933202493, 2815956275, 3167684641, 3049390895, 2330014213, 2213296395, 2566595609, 2448830231, 1305906550, 1155237496, 1607244650, 1455525988, 1776460110, 1626319424, 2079897426, 1928707164, 96392454, 213114376, 396673818, 514443284, 562755902, 679998e3, 865136418, 983426092, 3708173718, 3557504664, 3474729866, 3323011204, 4180808110, 4030667424, 3945269170, 3794078908, 2507040230, 2623762152, 2272556026, 2390325492, 2975484382, 3092726480, 2738905026, 2857194700, 3973773121, 3856137295, 4274053469, 4157467219, 3371096953, 3252932727, 3673476453, 3556361835, 2763173681, 2915017791, 3064510765, 3215307299, 2156299017, 2307622919, 2459735317, 2610011675, 2081048481, 1963412655, 1846563261, 1729977011, 1480485785, 1362321559, 1243905413, 1126790795, 878845905, 1030690015, 645401037, 796197571, 274084841, 425408743, 38544885, 188821243, 3613494426, 3731654548, 3313212038, 3430322568, 4082475170, 4200115116, 3780097726, 3896688048, 2668221674, 2516901860, 2366882550, 2216610296, 3141400786, 2989552604, 2837966542, 2687165888, 1202797690, 1320957812, 1437280870, 1554391400, 1669664834, 1787304780, 1906247262, 2022837584, 265905162, 114585348, 499347990, 349075736, 736970802, 585122620, 972512814, 821712160, 2595684844, 2478443234, 2293045232, 2174754046, 3196267988, 3079546586, 2895723464, 2777952454, 3537852828, 3687994002, 3234156416, 3385345166, 4142626212, 4293295786, 3841024952, 3992742070, 174567692, 57326082, 410887952, 292596766, 777231668, 660510266, 1011452712, 893681702, 1108339068, 1258480242, 1343618912, 1494807662, 1715193156, 1865862730, 1948373848, 2100090966, 2701949495, 2818666809, 3004591147, 3122358053, 2235061775, 2352307457, 2535604243, 2653899549, 3915653703, 3764988233, 4219352155, 4067639125, 3444575871, 3294430577, 3746175075, 3594982253, 836553431, 953270745, 600235211, 718002117, 367585007, 484830689, 133361907, 251657213, 2041877159, 1891211689, 1806599355, 1654886325, 1568718495, 1418573201, 1335535747, 1184342925];
4306         function convertToInt32(bytes) {
4307           var result = [];
4308           for (var i3 = 0; i3 < bytes.length; i3 += 4) {
4309             result.push(
4310               bytes[i3] << 24 | bytes[i3 + 1] << 16 | bytes[i3 + 2] << 8 | bytes[i3 + 3]
4311             );
4312           }
4313           return result;
4314         }
4315         var AES = function(key) {
4316           if (!(this instanceof AES)) {
4317             throw Error("AES must be instanitated with `new`");
4318           }
4319           Object.defineProperty(this, "key", {
4320             value: coerceArray(key, true)
4321           });
4322           this._prepare();
4323         };
4324         AES.prototype._prepare = function() {
4325           var rounds = numberOfRounds[this.key.length];
4326           if (rounds == null) {
4327             throw new Error("invalid key size (must be 16, 24 or 32 bytes)");
4328           }
4329           this._Ke = [];
4330           this._Kd = [];
4331           for (var i3 = 0; i3 <= rounds; i3++) {
4332             this._Ke.push([0, 0, 0, 0]);
4333             this._Kd.push([0, 0, 0, 0]);
4334           }
4335           var roundKeyCount = (rounds + 1) * 4;
4336           var KC = this.key.length / 4;
4337           var tk = convertToInt32(this.key);
4338           var index;
4339           for (var i3 = 0; i3 < KC; i3++) {
4340             index = i3 >> 2;
4341             this._Ke[index][i3 % 4] = tk[i3];
4342             this._Kd[rounds - index][i3 % 4] = tk[i3];
4343           }
4344           var rconpointer = 0;
4345           var t2 = KC, tt2;
4346           while (t2 < roundKeyCount) {
4347             tt2 = tk[KC - 1];
4348             tk[0] ^= S2[tt2 >> 16 & 255] << 24 ^ S2[tt2 >> 8 & 255] << 16 ^ S2[tt2 & 255] << 8 ^ S2[tt2 >> 24 & 255] ^ rcon[rconpointer] << 24;
4349             rconpointer += 1;
4350             if (KC != 8) {
4351               for (var i3 = 1; i3 < KC; i3++) {
4352                 tk[i3] ^= tk[i3 - 1];
4353               }
4354             } else {
4355               for (var i3 = 1; i3 < KC / 2; i3++) {
4356                 tk[i3] ^= tk[i3 - 1];
4357               }
4358               tt2 = tk[KC / 2 - 1];
4359               tk[KC / 2] ^= S2[tt2 & 255] ^ S2[tt2 >> 8 & 255] << 8 ^ S2[tt2 >> 16 & 255] << 16 ^ S2[tt2 >> 24 & 255] << 24;
4360               for (var i3 = KC / 2 + 1; i3 < KC; i3++) {
4361                 tk[i3] ^= tk[i3 - 1];
4362               }
4363             }
4364             var i3 = 0, r2, c2;
4365             while (i3 < KC && t2 < roundKeyCount) {
4366               r2 = t2 >> 2;
4367               c2 = t2 % 4;
4368               this._Ke[r2][c2] = tk[i3];
4369               this._Kd[rounds - r2][c2] = tk[i3++];
4370               t2++;
4371             }
4372           }
4373           for (var r2 = 1; r2 < rounds; r2++) {
4374             for (var c2 = 0; c2 < 4; c2++) {
4375               tt2 = this._Kd[r2][c2];
4376               this._Kd[r2][c2] = U1[tt2 >> 24 & 255] ^ U2[tt2 >> 16 & 255] ^ U3[tt2 >> 8 & 255] ^ U4[tt2 & 255];
4377             }
4378           }
4379         };
4380         AES.prototype.encrypt = function(plaintext) {
4381           if (plaintext.length != 16) {
4382             throw new Error("invalid plaintext size (must be 16 bytes)");
4383           }
4384           var rounds = this._Ke.length - 1;
4385           var a2 = [0, 0, 0, 0];
4386           var t2 = convertToInt32(plaintext);
4387           for (var i3 = 0; i3 < 4; i3++) {
4388             t2[i3] ^= this._Ke[0][i3];
4389           }
4390           for (var r2 = 1; r2 < rounds; r2++) {
4391             for (var i3 = 0; i3 < 4; i3++) {
4392               a2[i3] = T1[t2[i3] >> 24 & 255] ^ T2[t2[(i3 + 1) % 4] >> 16 & 255] ^ T3[t2[(i3 + 2) % 4] >> 8 & 255] ^ T4[t2[(i3 + 3) % 4] & 255] ^ this._Ke[r2][i3];
4393             }
4394             t2 = a2.slice();
4395           }
4396           var result = createArray(16), tt2;
4397           for (var i3 = 0; i3 < 4; i3++) {
4398             tt2 = this._Ke[rounds][i3];
4399             result[4 * i3] = (S2[t2[i3] >> 24 & 255] ^ tt2 >> 24) & 255;
4400             result[4 * i3 + 1] = (S2[t2[(i3 + 1) % 4] >> 16 & 255] ^ tt2 >> 16) & 255;
4401             result[4 * i3 + 2] = (S2[t2[(i3 + 2) % 4] >> 8 & 255] ^ tt2 >> 8) & 255;
4402             result[4 * i3 + 3] = (S2[t2[(i3 + 3) % 4] & 255] ^ tt2) & 255;
4403           }
4404           return result;
4405         };
4406         AES.prototype.decrypt = function(ciphertext) {
4407           if (ciphertext.length != 16) {
4408             throw new Error("invalid ciphertext size (must be 16 bytes)");
4409           }
4410           var rounds = this._Kd.length - 1;
4411           var a2 = [0, 0, 0, 0];
4412           var t2 = convertToInt32(ciphertext);
4413           for (var i3 = 0; i3 < 4; i3++) {
4414             t2[i3] ^= this._Kd[0][i3];
4415           }
4416           for (var r2 = 1; r2 < rounds; r2++) {
4417             for (var i3 = 0; i3 < 4; i3++) {
4418               a2[i3] = T5[t2[i3] >> 24 & 255] ^ T6[t2[(i3 + 3) % 4] >> 16 & 255] ^ T7[t2[(i3 + 2) % 4] >> 8 & 255] ^ T8[t2[(i3 + 1) % 4] & 255] ^ this._Kd[r2][i3];
4419             }
4420             t2 = a2.slice();
4421           }
4422           var result = createArray(16), tt2;
4423           for (var i3 = 0; i3 < 4; i3++) {
4424             tt2 = this._Kd[rounds][i3];
4425             result[4 * i3] = (Si[t2[i3] >> 24 & 255] ^ tt2 >> 24) & 255;
4426             result[4 * i3 + 1] = (Si[t2[(i3 + 3) % 4] >> 16 & 255] ^ tt2 >> 16) & 255;
4427             result[4 * i3 + 2] = (Si[t2[(i3 + 2) % 4] >> 8 & 255] ^ tt2 >> 8) & 255;
4428             result[4 * i3 + 3] = (Si[t2[(i3 + 1) % 4] & 255] ^ tt2) & 255;
4429           }
4430           return result;
4431         };
4432         var ModeOfOperationECB = function(key) {
4433           if (!(this instanceof ModeOfOperationECB)) {
4434             throw Error("AES must be instanitated with `new`");
4435           }
4436           this.description = "Electronic Code Block";
4437           this.name = "ecb";
4438           this._aes = new AES(key);
4439         };
4440         ModeOfOperationECB.prototype.encrypt = function(plaintext) {
4441           plaintext = coerceArray(plaintext);
4442           if (plaintext.length % 16 !== 0) {
4443             throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
4444           }
4445           var ciphertext = createArray(plaintext.length);
4446           var block2 = createArray(16);
4447           for (var i3 = 0; i3 < plaintext.length; i3 += 16) {
4448             copyArray(plaintext, block2, 0, i3, i3 + 16);
4449             block2 = this._aes.encrypt(block2);
4450             copyArray(block2, ciphertext, i3);
4451           }
4452           return ciphertext;
4453         };
4454         ModeOfOperationECB.prototype.decrypt = function(ciphertext) {
4455           ciphertext = coerceArray(ciphertext);
4456           if (ciphertext.length % 16 !== 0) {
4457             throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
4458           }
4459           var plaintext = createArray(ciphertext.length);
4460           var block2 = createArray(16);
4461           for (var i3 = 0; i3 < ciphertext.length; i3 += 16) {
4462             copyArray(ciphertext, block2, 0, i3, i3 + 16);
4463             block2 = this._aes.decrypt(block2);
4464             copyArray(block2, plaintext, i3);
4465           }
4466           return plaintext;
4467         };
4468         var ModeOfOperationCBC = function(key, iv) {
4469           if (!(this instanceof ModeOfOperationCBC)) {
4470             throw Error("AES must be instanitated with `new`");
4471           }
4472           this.description = "Cipher Block Chaining";
4473           this.name = "cbc";
4474           if (!iv) {
4475             iv = createArray(16);
4476           } else if (iv.length != 16) {
4477             throw new Error("invalid initialation vector size (must be 16 bytes)");
4478           }
4479           this._lastCipherblock = coerceArray(iv, true);
4480           this._aes = new AES(key);
4481         };
4482         ModeOfOperationCBC.prototype.encrypt = function(plaintext) {
4483           plaintext = coerceArray(plaintext);
4484           if (plaintext.length % 16 !== 0) {
4485             throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
4486           }
4487           var ciphertext = createArray(plaintext.length);
4488           var block2 = createArray(16);
4489           for (var i3 = 0; i3 < plaintext.length; i3 += 16) {
4490             copyArray(plaintext, block2, 0, i3, i3 + 16);
4491             for (var j2 = 0; j2 < 16; j2++) {
4492               block2[j2] ^= this._lastCipherblock[j2];
4493             }
4494             this._lastCipherblock = this._aes.encrypt(block2);
4495             copyArray(this._lastCipherblock, ciphertext, i3);
4496           }
4497           return ciphertext;
4498         };
4499         ModeOfOperationCBC.prototype.decrypt = function(ciphertext) {
4500           ciphertext = coerceArray(ciphertext);
4501           if (ciphertext.length % 16 !== 0) {
4502             throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
4503           }
4504           var plaintext = createArray(ciphertext.length);
4505           var block2 = createArray(16);
4506           for (var i3 = 0; i3 < ciphertext.length; i3 += 16) {
4507             copyArray(ciphertext, block2, 0, i3, i3 + 16);
4508             block2 = this._aes.decrypt(block2);
4509             for (var j2 = 0; j2 < 16; j2++) {
4510               plaintext[i3 + j2] = block2[j2] ^ this._lastCipherblock[j2];
4511             }
4512             copyArray(ciphertext, this._lastCipherblock, 0, i3, i3 + 16);
4513           }
4514           return plaintext;
4515         };
4516         var ModeOfOperationCFB = function(key, iv, segmentSize) {
4517           if (!(this instanceof ModeOfOperationCFB)) {
4518             throw Error("AES must be instanitated with `new`");
4519           }
4520           this.description = "Cipher Feedback";
4521           this.name = "cfb";
4522           if (!iv) {
4523             iv = createArray(16);
4524           } else if (iv.length != 16) {
4525             throw new Error("invalid initialation vector size (must be 16 size)");
4526           }
4527           if (!segmentSize) {
4528             segmentSize = 1;
4529           }
4530           this.segmentSize = segmentSize;
4531           this._shiftRegister = coerceArray(iv, true);
4532           this._aes = new AES(key);
4533         };
4534         ModeOfOperationCFB.prototype.encrypt = function(plaintext) {
4535           if (plaintext.length % this.segmentSize != 0) {
4536             throw new Error("invalid plaintext size (must be segmentSize bytes)");
4537           }
4538           var encrypted = coerceArray(plaintext, true);
4539           var xorSegment;
4540           for (var i3 = 0; i3 < encrypted.length; i3 += this.segmentSize) {
4541             xorSegment = this._aes.encrypt(this._shiftRegister);
4542             for (var j2 = 0; j2 < this.segmentSize; j2++) {
4543               encrypted[i3 + j2] ^= xorSegment[j2];
4544             }
4545             copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);
4546             copyArray(encrypted, this._shiftRegister, 16 - this.segmentSize, i3, i3 + this.segmentSize);
4547           }
4548           return encrypted;
4549         };
4550         ModeOfOperationCFB.prototype.decrypt = function(ciphertext) {
4551           if (ciphertext.length % this.segmentSize != 0) {
4552             throw new Error("invalid ciphertext size (must be segmentSize bytes)");
4553           }
4554           var plaintext = coerceArray(ciphertext, true);
4555           var xorSegment;
4556           for (var i3 = 0; i3 < plaintext.length; i3 += this.segmentSize) {
4557             xorSegment = this._aes.encrypt(this._shiftRegister);
4558             for (var j2 = 0; j2 < this.segmentSize; j2++) {
4559               plaintext[i3 + j2] ^= xorSegment[j2];
4560             }
4561             copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);
4562             copyArray(ciphertext, this._shiftRegister, 16 - this.segmentSize, i3, i3 + this.segmentSize);
4563           }
4564           return plaintext;
4565         };
4566         var ModeOfOperationOFB = function(key, iv) {
4567           if (!(this instanceof ModeOfOperationOFB)) {
4568             throw Error("AES must be instanitated with `new`");
4569           }
4570           this.description = "Output Feedback";
4571           this.name = "ofb";
4572           if (!iv) {
4573             iv = createArray(16);
4574           } else if (iv.length != 16) {
4575             throw new Error("invalid initialation vector size (must be 16 bytes)");
4576           }
4577           this._lastPrecipher = coerceArray(iv, true);
4578           this._lastPrecipherIndex = 16;
4579           this._aes = new AES(key);
4580         };
4581         ModeOfOperationOFB.prototype.encrypt = function(plaintext) {
4582           var encrypted = coerceArray(plaintext, true);
4583           for (var i3 = 0; i3 < encrypted.length; i3++) {
4584             if (this._lastPrecipherIndex === 16) {
4585               this._lastPrecipher = this._aes.encrypt(this._lastPrecipher);
4586               this._lastPrecipherIndex = 0;
4587             }
4588             encrypted[i3] ^= this._lastPrecipher[this._lastPrecipherIndex++];
4589           }
4590           return encrypted;
4591         };
4592         ModeOfOperationOFB.prototype.decrypt = ModeOfOperationOFB.prototype.encrypt;
4593         var Counter = function(initialValue) {
4594           if (!(this instanceof Counter)) {
4595             throw Error("Counter must be instanitated with `new`");
4596           }
4597           if (initialValue !== 0 && !initialValue) {
4598             initialValue = 1;
4599           }
4600           if (typeof initialValue === "number") {
4601             this._counter = createArray(16);
4602             this.setValue(initialValue);
4603           } else {
4604             this.setBytes(initialValue);
4605           }
4606         };
4607         Counter.prototype.setValue = function(value) {
4608           if (typeof value !== "number" || parseInt(value) != value) {
4609             throw new Error("invalid counter value (must be an integer)");
4610           }
4611           if (value > Number.MAX_SAFE_INTEGER) {
4612             throw new Error("integer value out of safe range");
4613           }
4614           for (var index = 15; index >= 0; --index) {
4615             this._counter[index] = value % 256;
4616             value = parseInt(value / 256);
4617           }
4618         };
4619         Counter.prototype.setBytes = function(bytes) {
4620           bytes = coerceArray(bytes, true);
4621           if (bytes.length != 16) {
4622             throw new Error("invalid counter bytes size (must be 16 bytes)");
4623           }
4624           this._counter = bytes;
4625         };
4626         Counter.prototype.increment = function() {
4627           for (var i3 = 15; i3 >= 0; i3--) {
4628             if (this._counter[i3] === 255) {
4629               this._counter[i3] = 0;
4630             } else {
4631               this._counter[i3]++;
4632               break;
4633             }
4634           }
4635         };
4636         var ModeOfOperationCTR = function(key, counter) {
4637           if (!(this instanceof ModeOfOperationCTR)) {
4638             throw Error("AES must be instanitated with `new`");
4639           }
4640           this.description = "Counter";
4641           this.name = "ctr";
4642           if (!(counter instanceof Counter)) {
4643             counter = new Counter(counter);
4644           }
4645           this._counter = counter;
4646           this._remainingCounter = null;
4647           this._remainingCounterIndex = 16;
4648           this._aes = new AES(key);
4649         };
4650         ModeOfOperationCTR.prototype.encrypt = function(plaintext) {
4651           var encrypted = coerceArray(plaintext, true);
4652           for (var i3 = 0; i3 < encrypted.length; i3++) {
4653             if (this._remainingCounterIndex === 16) {
4654               this._remainingCounter = this._aes.encrypt(this._counter._counter);
4655               this._remainingCounterIndex = 0;
4656               this._counter.increment();
4657             }
4658             encrypted[i3] ^= this._remainingCounter[this._remainingCounterIndex++];
4659           }
4660           return encrypted;
4661         };
4662         ModeOfOperationCTR.prototype.decrypt = ModeOfOperationCTR.prototype.encrypt;
4663         function pkcs7pad(data) {
4664           data = coerceArray(data, true);
4665           var padder = 16 - data.length % 16;
4666           var result = createArray(data.length + padder);
4667           copyArray(data, result);
4668           for (var i3 = data.length; i3 < result.length; i3++) {
4669             result[i3] = padder;
4670           }
4671           return result;
4672         }
4673         function pkcs7strip(data) {
4674           data = coerceArray(data, true);
4675           if (data.length < 16) {
4676             throw new Error("PKCS#7 invalid length");
4677           }
4678           var padder = data[data.length - 1];
4679           if (padder > 16) {
4680             throw new Error("PKCS#7 padding byte out of range");
4681           }
4682           var length2 = data.length - padder;
4683           for (var i3 = 0; i3 < padder; i3++) {
4684             if (data[length2 + i3] !== padder) {
4685               throw new Error("PKCS#7 invalid padding byte");
4686             }
4687           }
4688           var result = createArray(length2);
4689           copyArray(data, result, 0, 0, length2);
4690           return result;
4691         }
4692         var aesjs2 = {
4693           AES,
4694           Counter,
4695           ModeOfOperation: {
4696             ecb: ModeOfOperationECB,
4697             cbc: ModeOfOperationCBC,
4698             cfb: ModeOfOperationCFB,
4699             ofb: ModeOfOperationOFB,
4700             ctr: ModeOfOperationCTR
4701           },
4702           utils: {
4703             hex: convertHex,
4704             utf8: convertUtf8
4705           },
4706           padding: {
4707             pkcs7: {
4708               pad: pkcs7pad,
4709               strip: pkcs7strip
4710             }
4711           },
4712           _arrayTest: {
4713             coerceArray,
4714             createArray,
4715             copyArray
4716           }
4717         };
4718         if (typeof exports2 !== "undefined") {
4719           module2.exports = aesjs2;
4720         } else if (typeof define === "function" && define.amd) {
4721           define([], function() {
4722             return aesjs2;
4723           });
4724         } else {
4725           if (root3.aesjs) {
4726             aesjs2._aesjs = root3.aesjs;
4727           }
4728           root3.aesjs = aesjs2;
4729         }
4730       })(exports2);
4731     }
4732   });
4733
4734   // node_modules/lodash/lodash.js
4735   var require_lodash = __commonJS({
4736     "node_modules/lodash/lodash.js"(exports2, module2) {
4737       (function() {
4738         var undefined2;
4739         var VERSION = "4.17.21";
4740         var LARGE_ARRAY_SIZE2 = 200;
4741         var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", FUNC_ERROR_TEXT3 = "Expected a function", INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`";
4742         var HASH_UNDEFINED4 = "__lodash_hash_undefined__";
4743         var MAX_MEMOIZE_SIZE = 500;
4744         var PLACEHOLDER = "__lodash_placeholder__";
4745         var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
4746         var COMPARE_PARTIAL_FLAG5 = 1, COMPARE_UNORDERED_FLAG3 = 2;
4747         var WRAP_BIND_FLAG = 1, WRAP_BIND_KEY_FLAG = 2, WRAP_CURRY_BOUND_FLAG = 4, WRAP_CURRY_FLAG = 8, WRAP_CURRY_RIGHT_FLAG = 16, WRAP_PARTIAL_FLAG = 32, WRAP_PARTIAL_RIGHT_FLAG = 64, WRAP_ARY_FLAG = 128, WRAP_REARG_FLAG = 256, WRAP_FLIP_FLAG = 512;
4748         var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "...";
4749         var HOT_COUNT = 800, HOT_SPAN = 16;
4750         var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3;
4751         var INFINITY2 = 1 / 0, MAX_SAFE_INTEGER4 = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN2 = 0 / 0;
4752         var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
4753         var wrapFlags = [
4754           ["ary", WRAP_ARY_FLAG],
4755           ["bind", WRAP_BIND_FLAG],
4756           ["bindKey", WRAP_BIND_KEY_FLAG],
4757           ["curry", WRAP_CURRY_FLAG],
4758           ["curryRight", WRAP_CURRY_RIGHT_FLAG],
4759           ["flip", WRAP_FLIP_FLAG],
4760           ["partial", WRAP_PARTIAL_FLAG],
4761           ["partialRight", WRAP_PARTIAL_RIGHT_FLAG],
4762           ["rearg", WRAP_REARG_FLAG]
4763         ];
4764         var argsTag4 = "[object Arguments]", arrayTag3 = "[object Array]", asyncTag2 = "[object AsyncFunction]", boolTag3 = "[object Boolean]", dateTag3 = "[object Date]", domExcTag = "[object DOMException]", errorTag3 = "[object Error]", funcTag3 = "[object Function]", genTag2 = "[object GeneratorFunction]", mapTag4 = "[object Map]", numberTag4 = "[object Number]", nullTag2 = "[object Null]", objectTag4 = "[object Object]", promiseTag2 = "[object Promise]", proxyTag2 = "[object Proxy]", regexpTag3 = "[object RegExp]", setTag4 = "[object Set]", stringTag3 = "[object String]", symbolTag3 = "[object Symbol]", undefinedTag2 = "[object Undefined]", weakMapTag3 = "[object WeakMap]", weakSetTag = "[object WeakSet]";
4765         var arrayBufferTag3 = "[object ArrayBuffer]", dataViewTag4 = "[object DataView]", float32Tag2 = "[object Float32Array]", float64Tag2 = "[object Float64Array]", int8Tag2 = "[object Int8Array]", int16Tag2 = "[object Int16Array]", int32Tag2 = "[object Int32Array]", uint8Tag2 = "[object Uint8Array]", uint8ClampedTag2 = "[object Uint8ClampedArray]", uint16Tag2 = "[object Uint16Array]", uint32Tag2 = "[object Uint32Array]";
4766         var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
4767         var reEscapedHtml2 = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml2 = /[&<>"']/g, reHasEscapedHtml2 = RegExp(reEscapedHtml2.source), reHasUnescapedHtml2 = RegExp(reUnescapedHtml2.source);
4768         var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g;
4769         var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
4770         var reRegExpChar2 = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar2.source);
4771         var reTrimStart2 = /^\s+/;
4772         var reWhitespace2 = /\s/;
4773         var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /;
4774         var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
4775         var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
4776         var reEscapeChar = /\\(\\)?/g;
4777         var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
4778         var reFlags = /\w*$/;
4779         var reIsBadHex2 = /^[-+]0x[0-9a-f]+$/i;
4780         var reIsBinary2 = /^0b[01]+$/i;
4781         var reIsHostCtor2 = /^\[object .+?Constructor\]$/;
4782         var reIsOctal2 = /^0o[0-7]+$/i;
4783         var reIsUint2 = /^(?:0|[1-9]\d*)$/;
4784         var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
4785         var reNoMatch = /($^)/;
4786         var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
4787         var rsAstralRange = "\\ud800-\\udfff", rsComboMarksRange = "\\u0300-\\u036f", reComboHalfMarksRange = "\\ufe20-\\ufe2f", rsComboSymbolsRange = "\\u20d0-\\u20ff", rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, rsDingbatRange = "\\u2700-\\u27bf", rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff", rsMathOpRange = "\\xac\\xb1\\xd7\\xf7", rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", rsPunctuationRange = "\\u2000-\\u206f", rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde", rsVarRange = "\\ufe0e\\ufe0f", rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
4788         var rsApos = "['\u2019]", rsAstral = "[" + rsAstralRange + "]", rsBreak = "[" + rsBreakRange + "]", rsCombo = "[" + rsComboRange + "]", rsDigits = "\\d+", rsDingbat = "[" + rsDingbatRange + "]", rsLower = "[" + rsLowerRange + "]", rsMisc = "[^" + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]", rsFitz = "\\ud83c[\\udffb-\\udfff]", rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")", rsNonAstral = "[^" + rsAstralRange + "]", rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}", rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]", rsUpper = "[" + rsUpperRange + "]", rsZWJ = "\\u200d";
4789         var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")", rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")", rsOptContrLower = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?", rsOptContrUpper = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?", reOptMod = rsModifier + "?", rsOptVar = "[" + rsVarRange + "]?", rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*", rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = "(?:" + [rsDingbat, rsRegional, rsSurrPair].join("|") + ")" + rsSeq, rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
4790         var reApos = RegExp(rsApos, "g");
4791         var reComboMark = RegExp(rsCombo, "g");
4792         var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
4793         var reUnicodeWord = RegExp([
4794           rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
4795           rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
4796           rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
4797           rsUpper + "+" + rsOptContrUpper,
4798           rsOrdUpper,
4799           rsOrdLower,
4800           rsDigits,
4801           rsEmoji
4802         ].join("|"), "g");
4803         var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
4804         var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
4805         var contextProps = [
4806           "Array",
4807           "Buffer",
4808           "DataView",
4809           "Date",
4810           "Error",
4811           "Float32Array",
4812           "Float64Array",
4813           "Function",
4814           "Int8Array",
4815           "Int16Array",
4816           "Int32Array",
4817           "Map",
4818           "Math",
4819           "Object",
4820           "Promise",
4821           "RegExp",
4822           "Set",
4823           "String",
4824           "Symbol",
4825           "TypeError",
4826           "Uint8Array",
4827           "Uint8ClampedArray",
4828           "Uint16Array",
4829           "Uint32Array",
4830           "WeakMap",
4831           "_",
4832           "clearTimeout",
4833           "isFinite",
4834           "parseInt",
4835           "setTimeout"
4836         ];
4837         var templateCounter = -1;
4838         var typedArrayTags2 = {};
4839         typedArrayTags2[float32Tag2] = typedArrayTags2[float64Tag2] = typedArrayTags2[int8Tag2] = typedArrayTags2[int16Tag2] = typedArrayTags2[int32Tag2] = typedArrayTags2[uint8Tag2] = typedArrayTags2[uint8ClampedTag2] = typedArrayTags2[uint16Tag2] = typedArrayTags2[uint32Tag2] = true;
4840         typedArrayTags2[argsTag4] = typedArrayTags2[arrayTag3] = typedArrayTags2[arrayBufferTag3] = typedArrayTags2[boolTag3] = typedArrayTags2[dataViewTag4] = typedArrayTags2[dateTag3] = typedArrayTags2[errorTag3] = typedArrayTags2[funcTag3] = typedArrayTags2[mapTag4] = typedArrayTags2[numberTag4] = typedArrayTags2[objectTag4] = typedArrayTags2[regexpTag3] = typedArrayTags2[setTag4] = typedArrayTags2[stringTag3] = typedArrayTags2[weakMapTag3] = false;
4841         var cloneableTags = {};
4842         cloneableTags[argsTag4] = cloneableTags[arrayTag3] = cloneableTags[arrayBufferTag3] = cloneableTags[dataViewTag4] = cloneableTags[boolTag3] = cloneableTags[dateTag3] = cloneableTags[float32Tag2] = cloneableTags[float64Tag2] = cloneableTags[int8Tag2] = cloneableTags[int16Tag2] = cloneableTags[int32Tag2] = cloneableTags[mapTag4] = cloneableTags[numberTag4] = cloneableTags[objectTag4] = cloneableTags[regexpTag3] = cloneableTags[setTag4] = cloneableTags[stringTag3] = cloneableTags[symbolTag3] = cloneableTags[uint8Tag2] = cloneableTags[uint8ClampedTag2] = cloneableTags[uint16Tag2] = cloneableTags[uint32Tag2] = true;
4843         cloneableTags[errorTag3] = cloneableTags[funcTag3] = cloneableTags[weakMapTag3] = false;
4844         var deburredLetters = {
4845           // Latin-1 Supplement block.
4846           "\xC0": "A",
4847           "\xC1": "A",
4848           "\xC2": "A",
4849           "\xC3": "A",
4850           "\xC4": "A",
4851           "\xC5": "A",
4852           "\xE0": "a",
4853           "\xE1": "a",
4854           "\xE2": "a",
4855           "\xE3": "a",
4856           "\xE4": "a",
4857           "\xE5": "a",
4858           "\xC7": "C",
4859           "\xE7": "c",
4860           "\xD0": "D",
4861           "\xF0": "d",
4862           "\xC8": "E",
4863           "\xC9": "E",
4864           "\xCA": "E",
4865           "\xCB": "E",
4866           "\xE8": "e",
4867           "\xE9": "e",
4868           "\xEA": "e",
4869           "\xEB": "e",
4870           "\xCC": "I",
4871           "\xCD": "I",
4872           "\xCE": "I",
4873           "\xCF": "I",
4874           "\xEC": "i",
4875           "\xED": "i",
4876           "\xEE": "i",
4877           "\xEF": "i",
4878           "\xD1": "N",
4879           "\xF1": "n",
4880           "\xD2": "O",
4881           "\xD3": "O",
4882           "\xD4": "O",
4883           "\xD5": "O",
4884           "\xD6": "O",
4885           "\xD8": "O",
4886           "\xF2": "o",
4887           "\xF3": "o",
4888           "\xF4": "o",
4889           "\xF5": "o",
4890           "\xF6": "o",
4891           "\xF8": "o",
4892           "\xD9": "U",
4893           "\xDA": "U",
4894           "\xDB": "U",
4895           "\xDC": "U",
4896           "\xF9": "u",
4897           "\xFA": "u",
4898           "\xFB": "u",
4899           "\xFC": "u",
4900           "\xDD": "Y",
4901           "\xFD": "y",
4902           "\xFF": "y",
4903           "\xC6": "Ae",
4904           "\xE6": "ae",
4905           "\xDE": "Th",
4906           "\xFE": "th",
4907           "\xDF": "ss",
4908           // Latin Extended-A block.
4909           "\u0100": "A",
4910           "\u0102": "A",
4911           "\u0104": "A",
4912           "\u0101": "a",
4913           "\u0103": "a",
4914           "\u0105": "a",
4915           "\u0106": "C",
4916           "\u0108": "C",
4917           "\u010A": "C",
4918           "\u010C": "C",
4919           "\u0107": "c",
4920           "\u0109": "c",
4921           "\u010B": "c",
4922           "\u010D": "c",
4923           "\u010E": "D",
4924           "\u0110": "D",
4925           "\u010F": "d",
4926           "\u0111": "d",
4927           "\u0112": "E",
4928           "\u0114": "E",
4929           "\u0116": "E",
4930           "\u0118": "E",
4931           "\u011A": "E",
4932           "\u0113": "e",
4933           "\u0115": "e",
4934           "\u0117": "e",
4935           "\u0119": "e",
4936           "\u011B": "e",
4937           "\u011C": "G",
4938           "\u011E": "G",
4939           "\u0120": "G",
4940           "\u0122": "G",
4941           "\u011D": "g",
4942           "\u011F": "g",
4943           "\u0121": "g",
4944           "\u0123": "g",
4945           "\u0124": "H",
4946           "\u0126": "H",
4947           "\u0125": "h",
4948           "\u0127": "h",
4949           "\u0128": "I",
4950           "\u012A": "I",
4951           "\u012C": "I",
4952           "\u012E": "I",
4953           "\u0130": "I",
4954           "\u0129": "i",
4955           "\u012B": "i",
4956           "\u012D": "i",
4957           "\u012F": "i",
4958           "\u0131": "i",
4959           "\u0134": "J",
4960           "\u0135": "j",
4961           "\u0136": "K",
4962           "\u0137": "k",
4963           "\u0138": "k",
4964           "\u0139": "L",
4965           "\u013B": "L",
4966           "\u013D": "L",
4967           "\u013F": "L",
4968           "\u0141": "L",
4969           "\u013A": "l",
4970           "\u013C": "l",
4971           "\u013E": "l",
4972           "\u0140": "l",
4973           "\u0142": "l",
4974           "\u0143": "N",
4975           "\u0145": "N",
4976           "\u0147": "N",
4977           "\u014A": "N",
4978           "\u0144": "n",
4979           "\u0146": "n",
4980           "\u0148": "n",
4981           "\u014B": "n",
4982           "\u014C": "O",
4983           "\u014E": "O",
4984           "\u0150": "O",
4985           "\u014D": "o",
4986           "\u014F": "o",
4987           "\u0151": "o",
4988           "\u0154": "R",
4989           "\u0156": "R",
4990           "\u0158": "R",
4991           "\u0155": "r",
4992           "\u0157": "r",
4993           "\u0159": "r",
4994           "\u015A": "S",
4995           "\u015C": "S",
4996           "\u015E": "S",
4997           "\u0160": "S",
4998           "\u015B": "s",
4999           "\u015D": "s",
5000           "\u015F": "s",
5001           "\u0161": "s",
5002           "\u0162": "T",
5003           "\u0164": "T",
5004           "\u0166": "T",
5005           "\u0163": "t",
5006           "\u0165": "t",
5007           "\u0167": "t",
5008           "\u0168": "U",
5009           "\u016A": "U",
5010           "\u016C": "U",
5011           "\u016E": "U",
5012           "\u0170": "U",
5013           "\u0172": "U",
5014           "\u0169": "u",
5015           "\u016B": "u",
5016           "\u016D": "u",
5017           "\u016F": "u",
5018           "\u0171": "u",
5019           "\u0173": "u",
5020           "\u0174": "W",
5021           "\u0175": "w",
5022           "\u0176": "Y",
5023           "\u0177": "y",
5024           "\u0178": "Y",
5025           "\u0179": "Z",
5026           "\u017B": "Z",
5027           "\u017D": "Z",
5028           "\u017A": "z",
5029           "\u017C": "z",
5030           "\u017E": "z",
5031           "\u0132": "IJ",
5032           "\u0133": "ij",
5033           "\u0152": "Oe",
5034           "\u0153": "oe",
5035           "\u0149": "'n",
5036           "\u017F": "s"
5037         };
5038         var htmlEscapes2 = {
5039           "&": "&amp;",
5040           "<": "&lt;",
5041           ">": "&gt;",
5042           '"': "&quot;",
5043           "'": "&#39;"
5044         };
5045         var htmlUnescapes2 = {
5046           "&amp;": "&",
5047           "&lt;": "<",
5048           "&gt;": ">",
5049           "&quot;": '"',
5050           "&#39;": "'"
5051         };
5052         var stringEscapes = {
5053           "\\": "\\",
5054           "'": "'",
5055           "\n": "n",
5056           "\r": "r",
5057           "\u2028": "u2028",
5058           "\u2029": "u2029"
5059         };
5060         var freeParseFloat = parseFloat, freeParseInt2 = parseInt;
5061         var freeGlobal2 = typeof global == "object" && global && global.Object === Object && global;
5062         var freeSelf2 = typeof self == "object" && self && self.Object === Object && self;
5063         var root3 = freeGlobal2 || freeSelf2 || Function("return this")();
5064         var freeExports3 = typeof exports2 == "object" && exports2 && !exports2.nodeType && exports2;
5065         var freeModule3 = freeExports3 && typeof module2 == "object" && module2 && !module2.nodeType && module2;
5066         var moduleExports3 = freeModule3 && freeModule3.exports === freeExports3;
5067         var freeProcess2 = moduleExports3 && freeGlobal2.process;
5068         var nodeUtil2 = function() {
5069           try {
5070             var types = freeModule3 && freeModule3.require && freeModule3.require("util").types;
5071             if (types) {
5072               return types;
5073             }
5074             return freeProcess2 && freeProcess2.binding && freeProcess2.binding("util");
5075           } catch (e3) {
5076           }
5077         }();
5078         var nodeIsArrayBuffer = nodeUtil2 && nodeUtil2.isArrayBuffer, nodeIsDate = nodeUtil2 && nodeUtil2.isDate, nodeIsMap = nodeUtil2 && nodeUtil2.isMap, nodeIsRegExp = nodeUtil2 && nodeUtil2.isRegExp, nodeIsSet = nodeUtil2 && nodeUtil2.isSet, nodeIsTypedArray2 = nodeUtil2 && nodeUtil2.isTypedArray;
5079         function apply(func, thisArg, args) {
5080           switch (args.length) {
5081             case 0:
5082               return func.call(thisArg);
5083             case 1:
5084               return func.call(thisArg, args[0]);
5085             case 2:
5086               return func.call(thisArg, args[0], args[1]);
5087             case 3:
5088               return func.call(thisArg, args[0], args[1], args[2]);
5089           }
5090           return func.apply(thisArg, args);
5091         }
5092         function arrayAggregator(array2, setter, iteratee, accumulator) {
5093           var index = -1, length2 = array2 == null ? 0 : array2.length;
5094           while (++index < length2) {
5095             var value = array2[index];
5096             setter(accumulator, value, iteratee(value), array2);
5097           }
5098           return accumulator;
5099         }
5100         function arrayEach(array2, iteratee) {
5101           var index = -1, length2 = array2 == null ? 0 : array2.length;
5102           while (++index < length2) {
5103             if (iteratee(array2[index], index, array2) === false) {
5104               break;
5105             }
5106           }
5107           return array2;
5108         }
5109         function arrayEachRight(array2, iteratee) {
5110           var length2 = array2 == null ? 0 : array2.length;
5111           while (length2--) {
5112             if (iteratee(array2[length2], length2, array2) === false) {
5113               break;
5114             }
5115           }
5116           return array2;
5117         }
5118         function arrayEvery(array2, predicate) {
5119           var index = -1, length2 = array2 == null ? 0 : array2.length;
5120           while (++index < length2) {
5121             if (!predicate(array2[index], index, array2)) {
5122               return false;
5123             }
5124           }
5125           return true;
5126         }
5127         function arrayFilter2(array2, predicate) {
5128           var index = -1, length2 = array2 == null ? 0 : array2.length, resIndex = 0, result = [];
5129           while (++index < length2) {
5130             var value = array2[index];
5131             if (predicate(value, index, array2)) {
5132               result[resIndex++] = value;
5133             }
5134           }
5135           return result;
5136         }
5137         function arrayIncludes(array2, value) {
5138           var length2 = array2 == null ? 0 : array2.length;
5139           return !!length2 && baseIndexOf(array2, value, 0) > -1;
5140         }
5141         function arrayIncludesWith(array2, value, comparator) {
5142           var index = -1, length2 = array2 == null ? 0 : array2.length;
5143           while (++index < length2) {
5144             if (comparator(value, array2[index])) {
5145               return true;
5146             }
5147           }
5148           return false;
5149         }
5150         function arrayMap2(array2, iteratee) {
5151           var index = -1, length2 = array2 == null ? 0 : array2.length, result = Array(length2);
5152           while (++index < length2) {
5153             result[index] = iteratee(array2[index], index, array2);
5154           }
5155           return result;
5156         }
5157         function arrayPush2(array2, values) {
5158           var index = -1, length2 = values.length, offset = array2.length;
5159           while (++index < length2) {
5160             array2[offset + index] = values[index];
5161           }
5162           return array2;
5163         }
5164         function arrayReduce(array2, iteratee, accumulator, initAccum) {
5165           var index = -1, length2 = array2 == null ? 0 : array2.length;
5166           if (initAccum && length2) {
5167             accumulator = array2[++index];
5168           }
5169           while (++index < length2) {
5170             accumulator = iteratee(accumulator, array2[index], index, array2);
5171           }
5172           return accumulator;
5173         }
5174         function arrayReduceRight(array2, iteratee, accumulator, initAccum) {
5175           var length2 = array2 == null ? 0 : array2.length;
5176           if (initAccum && length2) {
5177             accumulator = array2[--length2];
5178           }
5179           while (length2--) {
5180             accumulator = iteratee(accumulator, array2[length2], length2, array2);
5181           }
5182           return accumulator;
5183         }
5184         function arraySome2(array2, predicate) {
5185           var index = -1, length2 = array2 == null ? 0 : array2.length;
5186           while (++index < length2) {
5187             if (predicate(array2[index], index, array2)) {
5188               return true;
5189             }
5190           }
5191           return false;
5192         }
5193         var asciiSize = baseProperty("length");
5194         function asciiToArray(string) {
5195           return string.split("");
5196         }
5197         function asciiWords(string) {
5198           return string.match(reAsciiWord) || [];
5199         }
5200         function baseFindKey(collection, predicate, eachFunc) {
5201           var result;
5202           eachFunc(collection, function(value, key, collection2) {
5203             if (predicate(value, key, collection2)) {
5204               result = key;
5205               return false;
5206             }
5207           });
5208           return result;
5209         }
5210         function baseFindIndex(array2, predicate, fromIndex, fromRight) {
5211           var length2 = array2.length, index = fromIndex + (fromRight ? 1 : -1);
5212           while (fromRight ? index-- : ++index < length2) {
5213             if (predicate(array2[index], index, array2)) {
5214               return index;
5215             }
5216           }
5217           return -1;
5218         }
5219         function baseIndexOf(array2, value, fromIndex) {
5220           return value === value ? strictIndexOf(array2, value, fromIndex) : baseFindIndex(array2, baseIsNaN, fromIndex);
5221         }
5222         function baseIndexOfWith(array2, value, fromIndex, comparator) {
5223           var index = fromIndex - 1, length2 = array2.length;
5224           while (++index < length2) {
5225             if (comparator(array2[index], value)) {
5226               return index;
5227             }
5228           }
5229           return -1;
5230         }
5231         function baseIsNaN(value) {
5232           return value !== value;
5233         }
5234         function baseMean(array2, iteratee) {
5235           var length2 = array2 == null ? 0 : array2.length;
5236           return length2 ? baseSum(array2, iteratee) / length2 : NAN2;
5237         }
5238         function baseProperty(key) {
5239           return function(object) {
5240             return object == null ? undefined2 : object[key];
5241           };
5242         }
5243         function basePropertyOf2(object) {
5244           return function(key) {
5245             return object == null ? undefined2 : object[key];
5246           };
5247         }
5248         function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
5249           eachFunc(collection, function(value, index, collection2) {
5250             accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2);
5251           });
5252           return accumulator;
5253         }
5254         function baseSortBy(array2, comparer) {
5255           var length2 = array2.length;
5256           array2.sort(comparer);
5257           while (length2--) {
5258             array2[length2] = array2[length2].value;
5259           }
5260           return array2;
5261         }
5262         function baseSum(array2, iteratee) {
5263           var result, index = -1, length2 = array2.length;
5264           while (++index < length2) {
5265             var current = iteratee(array2[index]);
5266             if (current !== undefined2) {
5267               result = result === undefined2 ? current : result + current;
5268             }
5269           }
5270           return result;
5271         }
5272         function baseTimes2(n3, iteratee) {
5273           var index = -1, result = Array(n3);
5274           while (++index < n3) {
5275             result[index] = iteratee(index);
5276           }
5277           return result;
5278         }
5279         function baseToPairs(object, props) {
5280           return arrayMap2(props, function(key) {
5281             return [key, object[key]];
5282           });
5283         }
5284         function baseTrim2(string) {
5285           return string ? string.slice(0, trimmedEndIndex2(string) + 1).replace(reTrimStart2, "") : string;
5286         }
5287         function baseUnary2(func) {
5288           return function(value) {
5289             return func(value);
5290           };
5291         }
5292         function baseValues(object, props) {
5293           return arrayMap2(props, function(key) {
5294             return object[key];
5295           });
5296         }
5297         function cacheHas2(cache, key) {
5298           return cache.has(key);
5299         }
5300         function charsStartIndex(strSymbols, chrSymbols) {
5301           var index = -1, length2 = strSymbols.length;
5302           while (++index < length2 && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
5303           }
5304           return index;
5305         }
5306         function charsEndIndex(strSymbols, chrSymbols) {
5307           var index = strSymbols.length;
5308           while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
5309           }
5310           return index;
5311         }
5312         function countHolders(array2, placeholder) {
5313           var length2 = array2.length, result = 0;
5314           while (length2--) {
5315             if (array2[length2] === placeholder) {
5316               ++result;
5317             }
5318           }
5319           return result;
5320         }
5321         var deburrLetter = basePropertyOf2(deburredLetters);
5322         var escapeHtmlChar2 = basePropertyOf2(htmlEscapes2);
5323         function escapeStringChar(chr) {
5324           return "\\" + stringEscapes[chr];
5325         }
5326         function getValue2(object, key) {
5327           return object == null ? undefined2 : object[key];
5328         }
5329         function hasUnicode(string) {
5330           return reHasUnicode.test(string);
5331         }
5332         function hasUnicodeWord(string) {
5333           return reHasUnicodeWord.test(string);
5334         }
5335         function iteratorToArray(iterator) {
5336           var data, result = [];
5337           while (!(data = iterator.next()).done) {
5338             result.push(data.value);
5339           }
5340           return result;
5341         }
5342         function mapToArray2(map2) {
5343           var index = -1, result = Array(map2.size);
5344           map2.forEach(function(value, key) {
5345             result[++index] = [key, value];
5346           });
5347           return result;
5348         }
5349         function overArg2(func, transform2) {
5350           return function(arg) {
5351             return func(transform2(arg));
5352           };
5353         }
5354         function replaceHolders(array2, placeholder) {
5355           var index = -1, length2 = array2.length, resIndex = 0, result = [];
5356           while (++index < length2) {
5357             var value = array2[index];
5358             if (value === placeholder || value === PLACEHOLDER) {
5359               array2[index] = PLACEHOLDER;
5360               result[resIndex++] = index;
5361             }
5362           }
5363           return result;
5364         }
5365         function setToArray2(set4) {
5366           var index = -1, result = Array(set4.size);
5367           set4.forEach(function(value) {
5368             result[++index] = value;
5369           });
5370           return result;
5371         }
5372         function setToPairs(set4) {
5373           var index = -1, result = Array(set4.size);
5374           set4.forEach(function(value) {
5375             result[++index] = [value, value];
5376           });
5377           return result;
5378         }
5379         function strictIndexOf(array2, value, fromIndex) {
5380           var index = fromIndex - 1, length2 = array2.length;
5381           while (++index < length2) {
5382             if (array2[index] === value) {
5383               return index;
5384             }
5385           }
5386           return -1;
5387         }
5388         function strictLastIndexOf(array2, value, fromIndex) {
5389           var index = fromIndex + 1;
5390           while (index--) {
5391             if (array2[index] === value) {
5392               return index;
5393             }
5394           }
5395           return index;
5396         }
5397         function stringSize(string) {
5398           return hasUnicode(string) ? unicodeSize(string) : asciiSize(string);
5399         }
5400         function stringToArray(string) {
5401           return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
5402         }
5403         function trimmedEndIndex2(string) {
5404           var index = string.length;
5405           while (index-- && reWhitespace2.test(string.charAt(index))) {
5406           }
5407           return index;
5408         }
5409         var unescapeHtmlChar2 = basePropertyOf2(htmlUnescapes2);
5410         function unicodeSize(string) {
5411           var result = reUnicode.lastIndex = 0;
5412           while (reUnicode.test(string)) {
5413             ++result;
5414           }
5415           return result;
5416         }
5417         function unicodeToArray(string) {
5418           return string.match(reUnicode) || [];
5419         }
5420         function unicodeWords(string) {
5421           return string.match(reUnicodeWord) || [];
5422         }
5423         var runInContext = function runInContext2(context) {
5424           context = context == null ? root3 : _2.defaults(root3.Object(), context, _2.pick(root3, contextProps));
5425           var Array2 = context.Array, Date2 = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError;
5426           var arrayProto2 = Array2.prototype, funcProto3 = Function2.prototype, objectProto13 = Object2.prototype;
5427           var coreJsData2 = context["__core-js_shared__"];
5428           var funcToString3 = funcProto3.toString;
5429           var hasOwnProperty10 = objectProto13.hasOwnProperty;
5430           var idCounter = 0;
5431           var maskSrcKey2 = function() {
5432             var uid = /[^.]+$/.exec(coreJsData2 && coreJsData2.keys && coreJsData2.keys.IE_PROTO || "");
5433             return uid ? "Symbol(src)_1." + uid : "";
5434           }();
5435           var nativeObjectToString3 = objectProto13.toString;
5436           var objectCtorString = funcToString3.call(Object2);
5437           var oldDash = root3._;
5438           var reIsNative2 = RegExp2(
5439             "^" + funcToString3.call(hasOwnProperty10).replace(reRegExpChar2, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
5440           );
5441           var Buffer3 = moduleExports3 ? context.Buffer : undefined2, Symbol3 = context.Symbol, Uint8Array3 = context.Uint8Array, allocUnsafe = Buffer3 ? Buffer3.allocUnsafe : undefined2, getPrototype = overArg2(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable3 = objectProto13.propertyIsEnumerable, splice2 = arrayProto2.splice, spreadableSymbol = Symbol3 ? Symbol3.isConcatSpreadable : undefined2, symIterator = Symbol3 ? Symbol3.iterator : undefined2, symToStringTag3 = Symbol3 ? Symbol3.toStringTag : undefined2;
5442           var defineProperty = function() {
5443             try {
5444               var func = getNative2(Object2, "defineProperty");
5445               func({}, "", {});
5446               return func;
5447             } catch (e3) {
5448             }
5449           }();
5450           var ctxClearTimeout = context.clearTimeout !== root3.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root3.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root3.setTimeout && context.setTimeout;
5451           var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols2 = Object2.getOwnPropertySymbols, nativeIsBuffer2 = Buffer3 ? Buffer3.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto2.join, nativeKeys2 = overArg2(Object2.keys, Object2), nativeMax2 = Math2.max, nativeMin2 = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto2.reverse;
5452           var DataView3 = getNative2(context, "DataView"), Map3 = getNative2(context, "Map"), Promise3 = getNative2(context, "Promise"), Set3 = getNative2(context, "Set"), WeakMap2 = getNative2(context, "WeakMap"), nativeCreate2 = getNative2(Object2, "create");
5453           var metaMap = WeakMap2 && new WeakMap2();
5454           var realNames = {};
5455           var dataViewCtorString2 = toSource2(DataView3), mapCtorString2 = toSource2(Map3), promiseCtorString2 = toSource2(Promise3), setCtorString2 = toSource2(Set3), weakMapCtorString2 = toSource2(WeakMap2);
5456           var symbolProto3 = Symbol3 ? Symbol3.prototype : undefined2, symbolValueOf2 = symbolProto3 ? symbolProto3.valueOf : undefined2, symbolToString2 = symbolProto3 ? symbolProto3.toString : undefined2;
5457           function lodash(value) {
5458             if (isObjectLike2(value) && !isArray2(value) && !(value instanceof LazyWrapper)) {
5459               if (value instanceof LodashWrapper) {
5460                 return value;
5461               }
5462               if (hasOwnProperty10.call(value, "__wrapped__")) {
5463                 return wrapperClone(value);
5464               }
5465             }
5466             return new LodashWrapper(value);
5467           }
5468           var baseCreate = /* @__PURE__ */ function() {
5469             function object() {
5470             }
5471             return function(proto) {
5472               if (!isObject2(proto)) {
5473                 return {};
5474               }
5475               if (objectCreate) {
5476                 return objectCreate(proto);
5477               }
5478               object.prototype = proto;
5479               var result2 = new object();
5480               object.prototype = undefined2;
5481               return result2;
5482             };
5483           }();
5484           function baseLodash() {
5485           }
5486           function LodashWrapper(value, chainAll) {
5487             this.__wrapped__ = value;
5488             this.__actions__ = [];
5489             this.__chain__ = !!chainAll;
5490             this.__index__ = 0;
5491             this.__values__ = undefined2;
5492           }
5493           lodash.templateSettings = {
5494             /**
5495              * Used to detect `data` property values to be HTML-escaped.
5496              *
5497              * @memberOf _.templateSettings
5498              * @type {RegExp}
5499              */
5500             "escape": reEscape,
5501             /**
5502              * Used to detect code to be evaluated.
5503              *
5504              * @memberOf _.templateSettings
5505              * @type {RegExp}
5506              */
5507             "evaluate": reEvaluate,
5508             /**
5509              * Used to detect `data` property values to inject.
5510              *
5511              * @memberOf _.templateSettings
5512              * @type {RegExp}
5513              */
5514             "interpolate": reInterpolate,
5515             /**
5516              * Used to reference the data object in the template text.
5517              *
5518              * @memberOf _.templateSettings
5519              * @type {string}
5520              */
5521             "variable": "",
5522             /**
5523              * Used to import variables into the compiled template.
5524              *
5525              * @memberOf _.templateSettings
5526              * @type {Object}
5527              */
5528             "imports": {
5529               /**
5530                * A reference to the `lodash` function.
5531                *
5532                * @memberOf _.templateSettings.imports
5533                * @type {Function}
5534                */
5535               "_": lodash
5536             }
5537           };
5538           lodash.prototype = baseLodash.prototype;
5539           lodash.prototype.constructor = lodash;
5540           LodashWrapper.prototype = baseCreate(baseLodash.prototype);
5541           LodashWrapper.prototype.constructor = LodashWrapper;
5542           function LazyWrapper(value) {
5543             this.__wrapped__ = value;
5544             this.__actions__ = [];
5545             this.__dir__ = 1;
5546             this.__filtered__ = false;
5547             this.__iteratees__ = [];
5548             this.__takeCount__ = MAX_ARRAY_LENGTH;
5549             this.__views__ = [];
5550           }
5551           function lazyClone() {
5552             var result2 = new LazyWrapper(this.__wrapped__);
5553             result2.__actions__ = copyArray(this.__actions__);
5554             result2.__dir__ = this.__dir__;
5555             result2.__filtered__ = this.__filtered__;
5556             result2.__iteratees__ = copyArray(this.__iteratees__);
5557             result2.__takeCount__ = this.__takeCount__;
5558             result2.__views__ = copyArray(this.__views__);
5559             return result2;
5560           }
5561           function lazyReverse() {
5562             if (this.__filtered__) {
5563               var result2 = new LazyWrapper(this);
5564               result2.__dir__ = -1;
5565               result2.__filtered__ = true;
5566             } else {
5567               result2 = this.clone();
5568               result2.__dir__ *= -1;
5569             }
5570             return result2;
5571           }
5572           function lazyValue() {
5573             var array2 = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray2(array2), isRight = dir < 0, arrLength = isArr ? array2.length : 0, view = getView(0, arrLength, this.__views__), start2 = view.start, end = view.end, length2 = end - start2, index = isRight ? end : start2 - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin2(length2, this.__takeCount__);
5574             if (!isArr || !isRight && arrLength == length2 && takeCount == length2) {
5575               return baseWrapperValue(array2, this.__actions__);
5576             }
5577             var result2 = [];
5578             outer:
5579               while (length2-- && resIndex < takeCount) {
5580                 index += dir;
5581                 var iterIndex = -1, value = array2[index];
5582                 while (++iterIndex < iterLength) {
5583                   var data = iteratees[iterIndex], iteratee2 = data.iteratee, type2 = data.type, computed = iteratee2(value);
5584                   if (type2 == LAZY_MAP_FLAG) {
5585                     value = computed;
5586                   } else if (!computed) {
5587                     if (type2 == LAZY_FILTER_FLAG) {
5588                       continue outer;
5589                     } else {
5590                       break outer;
5591                     }
5592                   }
5593                 }
5594                 result2[resIndex++] = value;
5595               }
5596             return result2;
5597           }
5598           LazyWrapper.prototype = baseCreate(baseLodash.prototype);
5599           LazyWrapper.prototype.constructor = LazyWrapper;
5600           function Hash2(entries) {
5601             var index = -1, length2 = entries == null ? 0 : entries.length;
5602             this.clear();
5603             while (++index < length2) {
5604               var entry = entries[index];
5605               this.set(entry[0], entry[1]);
5606             }
5607           }
5608           function hashClear2() {
5609             this.__data__ = nativeCreate2 ? nativeCreate2(null) : {};
5610             this.size = 0;
5611           }
5612           function hashDelete2(key) {
5613             var result2 = this.has(key) && delete this.__data__[key];
5614             this.size -= result2 ? 1 : 0;
5615             return result2;
5616           }
5617           function hashGet2(key) {
5618             var data = this.__data__;
5619             if (nativeCreate2) {
5620               var result2 = data[key];
5621               return result2 === HASH_UNDEFINED4 ? undefined2 : result2;
5622             }
5623             return hasOwnProperty10.call(data, key) ? data[key] : undefined2;
5624           }
5625           function hashHas2(key) {
5626             var data = this.__data__;
5627             return nativeCreate2 ? data[key] !== undefined2 : hasOwnProperty10.call(data, key);
5628           }
5629           function hashSet2(key, value) {
5630             var data = this.__data__;
5631             this.size += this.has(key) ? 0 : 1;
5632             data[key] = nativeCreate2 && value === undefined2 ? HASH_UNDEFINED4 : value;
5633             return this;
5634           }
5635           Hash2.prototype.clear = hashClear2;
5636           Hash2.prototype["delete"] = hashDelete2;
5637           Hash2.prototype.get = hashGet2;
5638           Hash2.prototype.has = hashHas2;
5639           Hash2.prototype.set = hashSet2;
5640           function ListCache2(entries) {
5641             var index = -1, length2 = entries == null ? 0 : entries.length;
5642             this.clear();
5643             while (++index < length2) {
5644               var entry = entries[index];
5645               this.set(entry[0], entry[1]);
5646             }
5647           }
5648           function listCacheClear2() {
5649             this.__data__ = [];
5650             this.size = 0;
5651           }
5652           function listCacheDelete2(key) {
5653             var data = this.__data__, index = assocIndexOf2(data, key);
5654             if (index < 0) {
5655               return false;
5656             }
5657             var lastIndex = data.length - 1;
5658             if (index == lastIndex) {
5659               data.pop();
5660             } else {
5661               splice2.call(data, index, 1);
5662             }
5663             --this.size;
5664             return true;
5665           }
5666           function listCacheGet2(key) {
5667             var data = this.__data__, index = assocIndexOf2(data, key);
5668             return index < 0 ? undefined2 : data[index][1];
5669           }
5670           function listCacheHas2(key) {
5671             return assocIndexOf2(this.__data__, key) > -1;
5672           }
5673           function listCacheSet2(key, value) {
5674             var data = this.__data__, index = assocIndexOf2(data, key);
5675             if (index < 0) {
5676               ++this.size;
5677               data.push([key, value]);
5678             } else {
5679               data[index][1] = value;
5680             }
5681             return this;
5682           }
5683           ListCache2.prototype.clear = listCacheClear2;
5684           ListCache2.prototype["delete"] = listCacheDelete2;
5685           ListCache2.prototype.get = listCacheGet2;
5686           ListCache2.prototype.has = listCacheHas2;
5687           ListCache2.prototype.set = listCacheSet2;
5688           function MapCache2(entries) {
5689             var index = -1, length2 = entries == null ? 0 : entries.length;
5690             this.clear();
5691             while (++index < length2) {
5692               var entry = entries[index];
5693               this.set(entry[0], entry[1]);
5694             }
5695           }
5696           function mapCacheClear2() {
5697             this.size = 0;
5698             this.__data__ = {
5699               "hash": new Hash2(),
5700               "map": new (Map3 || ListCache2)(),
5701               "string": new Hash2()
5702             };
5703           }
5704           function mapCacheDelete2(key) {
5705             var result2 = getMapData2(this, key)["delete"](key);
5706             this.size -= result2 ? 1 : 0;
5707             return result2;
5708           }
5709           function mapCacheGet2(key) {
5710             return getMapData2(this, key).get(key);
5711           }
5712           function mapCacheHas2(key) {
5713             return getMapData2(this, key).has(key);
5714           }
5715           function mapCacheSet2(key, value) {
5716             var data = getMapData2(this, key), size2 = data.size;
5717             data.set(key, value);
5718             this.size += data.size == size2 ? 0 : 1;
5719             return this;
5720           }
5721           MapCache2.prototype.clear = mapCacheClear2;
5722           MapCache2.prototype["delete"] = mapCacheDelete2;
5723           MapCache2.prototype.get = mapCacheGet2;
5724           MapCache2.prototype.has = mapCacheHas2;
5725           MapCache2.prototype.set = mapCacheSet2;
5726           function SetCache2(values2) {
5727             var index = -1, length2 = values2 == null ? 0 : values2.length;
5728             this.__data__ = new MapCache2();
5729             while (++index < length2) {
5730               this.add(values2[index]);
5731             }
5732           }
5733           function setCacheAdd2(value) {
5734             this.__data__.set(value, HASH_UNDEFINED4);
5735             return this;
5736           }
5737           function setCacheHas2(value) {
5738             return this.__data__.has(value);
5739           }
5740           SetCache2.prototype.add = SetCache2.prototype.push = setCacheAdd2;
5741           SetCache2.prototype.has = setCacheHas2;
5742           function Stack2(entries) {
5743             var data = this.__data__ = new ListCache2(entries);
5744             this.size = data.size;
5745           }
5746           function stackClear2() {
5747             this.__data__ = new ListCache2();
5748             this.size = 0;
5749           }
5750           function stackDelete2(key) {
5751             var data = this.__data__, result2 = data["delete"](key);
5752             this.size = data.size;
5753             return result2;
5754           }
5755           function stackGet2(key) {
5756             return this.__data__.get(key);
5757           }
5758           function stackHas2(key) {
5759             return this.__data__.has(key);
5760           }
5761           function stackSet2(key, value) {
5762             var data = this.__data__;
5763             if (data instanceof ListCache2) {
5764               var pairs2 = data.__data__;
5765               if (!Map3 || pairs2.length < LARGE_ARRAY_SIZE2 - 1) {
5766                 pairs2.push([key, value]);
5767                 this.size = ++data.size;
5768                 return this;
5769               }
5770               data = this.__data__ = new MapCache2(pairs2);
5771             }
5772             data.set(key, value);
5773             this.size = data.size;
5774             return this;
5775           }
5776           Stack2.prototype.clear = stackClear2;
5777           Stack2.prototype["delete"] = stackDelete2;
5778           Stack2.prototype.get = stackGet2;
5779           Stack2.prototype.has = stackHas2;
5780           Stack2.prototype.set = stackSet2;
5781           function arrayLikeKeys2(value, inherited) {
5782             var isArr = isArray2(value), isArg = !isArr && isArguments2(value), isBuff = !isArr && !isArg && isBuffer2(value), isType = !isArr && !isArg && !isBuff && isTypedArray2(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes2(value.length, String2) : [], length2 = result2.length;
5783             for (var key in value) {
5784               if ((inherited || hasOwnProperty10.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
5785               (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
5786               isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
5787               isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
5788               isIndex2(key, length2)))) {
5789                 result2.push(key);
5790               }
5791             }
5792             return result2;
5793           }
5794           function arraySample(array2) {
5795             var length2 = array2.length;
5796             return length2 ? array2[baseRandom(0, length2 - 1)] : undefined2;
5797           }
5798           function arraySampleSize(array2, n3) {
5799             return shuffleSelf(copyArray(array2), baseClamp(n3, 0, array2.length));
5800           }
5801           function arrayShuffle(array2) {
5802             return shuffleSelf(copyArray(array2));
5803           }
5804           function assignMergeValue(object, key, value) {
5805             if (value !== undefined2 && !eq2(object[key], value) || value === undefined2 && !(key in object)) {
5806               baseAssignValue(object, key, value);
5807             }
5808           }
5809           function assignValue(object, key, value) {
5810             var objValue = object[key];
5811             if (!(hasOwnProperty10.call(object, key) && eq2(objValue, value)) || value === undefined2 && !(key in object)) {
5812               baseAssignValue(object, key, value);
5813             }
5814           }
5815           function assocIndexOf2(array2, key) {
5816             var length2 = array2.length;
5817             while (length2--) {
5818               if (eq2(array2[length2][0], key)) {
5819                 return length2;
5820               }
5821             }
5822             return -1;
5823           }
5824           function baseAggregator(collection, setter, iteratee2, accumulator) {
5825             baseEach(collection, function(value, key, collection2) {
5826               setter(accumulator, value, iteratee2(value), collection2);
5827             });
5828             return accumulator;
5829           }
5830           function baseAssign(object, source) {
5831             return object && copyObject(source, keys2(source), object);
5832           }
5833           function baseAssignIn(object, source) {
5834             return object && copyObject(source, keysIn(source), object);
5835           }
5836           function baseAssignValue(object, key, value) {
5837             if (key == "__proto__" && defineProperty) {
5838               defineProperty(object, key, {
5839                 "configurable": true,
5840                 "enumerable": true,
5841                 "value": value,
5842                 "writable": true
5843               });
5844             } else {
5845               object[key] = value;
5846             }
5847           }
5848           function baseAt(object, paths) {
5849             var index = -1, length2 = paths.length, result2 = Array2(length2), skip = object == null;
5850             while (++index < length2) {
5851               result2[index] = skip ? undefined2 : get4(object, paths[index]);
5852             }
5853             return result2;
5854           }
5855           function baseClamp(number3, lower2, upper) {
5856             if (number3 === number3) {
5857               if (upper !== undefined2) {
5858                 number3 = number3 <= upper ? number3 : upper;
5859               }
5860               if (lower2 !== undefined2) {
5861                 number3 = number3 >= lower2 ? number3 : lower2;
5862               }
5863             }
5864             return number3;
5865           }
5866           function baseClone(value, bitmask, customizer, key, object, stack) {
5867             var result2, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG;
5868             if (customizer) {
5869               result2 = object ? customizer(value, key, object, stack) : customizer(value);
5870             }
5871             if (result2 !== undefined2) {
5872               return result2;
5873             }
5874             if (!isObject2(value)) {
5875               return value;
5876             }
5877             var isArr = isArray2(value);
5878             if (isArr) {
5879               result2 = initCloneArray(value);
5880               if (!isDeep) {
5881                 return copyArray(value, result2);
5882               }
5883             } else {
5884               var tag2 = getTag2(value), isFunc = tag2 == funcTag3 || tag2 == genTag2;
5885               if (isBuffer2(value)) {
5886                 return cloneBuffer(value, isDeep);
5887               }
5888               if (tag2 == objectTag4 || tag2 == argsTag4 || isFunc && !object) {
5889                 result2 = isFlat || isFunc ? {} : initCloneObject(value);
5890                 if (!isDeep) {
5891                   return isFlat ? copySymbolsIn(value, baseAssignIn(result2, value)) : copySymbols(value, baseAssign(result2, value));
5892                 }
5893               } else {
5894                 if (!cloneableTags[tag2]) {
5895                   return object ? value : {};
5896                 }
5897                 result2 = initCloneByTag(value, tag2, isDeep);
5898               }
5899             }
5900             stack || (stack = new Stack2());
5901             var stacked = stack.get(value);
5902             if (stacked) {
5903               return stacked;
5904             }
5905             stack.set(value, result2);
5906             if (isSet(value)) {
5907               value.forEach(function(subValue) {
5908                 result2.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
5909               });
5910             } else if (isMap(value)) {
5911               value.forEach(function(subValue, key2) {
5912                 result2.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
5913               });
5914             }
5915             var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys2 : isFlat ? keysIn : keys2;
5916             var props = isArr ? undefined2 : keysFunc(value);
5917             arrayEach(props || value, function(subValue, key2) {
5918               if (props) {
5919                 key2 = subValue;
5920                 subValue = value[key2];
5921               }
5922               assignValue(result2, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
5923             });
5924             return result2;
5925           }
5926           function baseConforms(source) {
5927             var props = keys2(source);
5928             return function(object) {
5929               return baseConformsTo(object, source, props);
5930             };
5931           }
5932           function baseConformsTo(object, source, props) {
5933             var length2 = props.length;
5934             if (object == null) {
5935               return !length2;
5936             }
5937             object = Object2(object);
5938             while (length2--) {
5939               var key = props[length2], predicate = source[key], value = object[key];
5940               if (value === undefined2 && !(key in object) || !predicate(value)) {
5941                 return false;
5942               }
5943             }
5944             return true;
5945           }
5946           function baseDelay(func, wait, args) {
5947             if (typeof func != "function") {
5948               throw new TypeError2(FUNC_ERROR_TEXT3);
5949             }
5950             return setTimeout2(function() {
5951               func.apply(undefined2, args);
5952             }, wait);
5953           }
5954           function baseDifference(array2, values2, iteratee2, comparator) {
5955             var index = -1, includes2 = arrayIncludes, isCommon = true, length2 = array2.length, result2 = [], valuesLength = values2.length;
5956             if (!length2) {
5957               return result2;
5958             }
5959             if (iteratee2) {
5960               values2 = arrayMap2(values2, baseUnary2(iteratee2));
5961             }
5962             if (comparator) {
5963               includes2 = arrayIncludesWith;
5964               isCommon = false;
5965             } else if (values2.length >= LARGE_ARRAY_SIZE2) {
5966               includes2 = cacheHas2;
5967               isCommon = false;
5968               values2 = new SetCache2(values2);
5969             }
5970             outer:
5971               while (++index < length2) {
5972                 var value = array2[index], computed = iteratee2 == null ? value : iteratee2(value);
5973                 value = comparator || value !== 0 ? value : 0;
5974                 if (isCommon && computed === computed) {
5975                   var valuesIndex = valuesLength;
5976                   while (valuesIndex--) {
5977                     if (values2[valuesIndex] === computed) {
5978                       continue outer;
5979                     }
5980                   }
5981                   result2.push(value);
5982                 } else if (!includes2(values2, computed, comparator)) {
5983                   result2.push(value);
5984                 }
5985               }
5986             return result2;
5987           }
5988           var baseEach = createBaseEach(baseForOwn);
5989           var baseEachRight = createBaseEach(baseForOwnRight, true);
5990           function baseEvery(collection, predicate) {
5991             var result2 = true;
5992             baseEach(collection, function(value, index, collection2) {
5993               result2 = !!predicate(value, index, collection2);
5994               return result2;
5995             });
5996             return result2;
5997           }
5998           function baseExtremum(array2, iteratee2, comparator) {
5999             var index = -1, length2 = array2.length;
6000             while (++index < length2) {
6001               var value = array2[index], current = iteratee2(value);
6002               if (current != null && (computed === undefined2 ? current === current && !isSymbol2(current) : comparator(current, computed))) {
6003                 var computed = current, result2 = value;
6004               }
6005             }
6006             return result2;
6007           }
6008           function baseFill(array2, value, start2, end) {
6009             var length2 = array2.length;
6010             start2 = toInteger(start2);
6011             if (start2 < 0) {
6012               start2 = -start2 > length2 ? 0 : length2 + start2;
6013             }
6014             end = end === undefined2 || end > length2 ? length2 : toInteger(end);
6015             if (end < 0) {
6016               end += length2;
6017             }
6018             end = start2 > end ? 0 : toLength(end);
6019             while (start2 < end) {
6020               array2[start2++] = value;
6021             }
6022             return array2;
6023           }
6024           function baseFilter(collection, predicate) {
6025             var result2 = [];
6026             baseEach(collection, function(value, index, collection2) {
6027               if (predicate(value, index, collection2)) {
6028                 result2.push(value);
6029               }
6030             });
6031             return result2;
6032           }
6033           function baseFlatten(array2, depth, predicate, isStrict, result2) {
6034             var index = -1, length2 = array2.length;
6035             predicate || (predicate = isFlattenable);
6036             result2 || (result2 = []);
6037             while (++index < length2) {
6038               var value = array2[index];
6039               if (depth > 0 && predicate(value)) {
6040                 if (depth > 1) {
6041                   baseFlatten(value, depth - 1, predicate, isStrict, result2);
6042                 } else {
6043                   arrayPush2(result2, value);
6044                 }
6045               } else if (!isStrict) {
6046                 result2[result2.length] = value;
6047               }
6048             }
6049             return result2;
6050           }
6051           var baseFor = createBaseFor();
6052           var baseForRight = createBaseFor(true);
6053           function baseForOwn(object, iteratee2) {
6054             return object && baseFor(object, iteratee2, keys2);
6055           }
6056           function baseForOwnRight(object, iteratee2) {
6057             return object && baseForRight(object, iteratee2, keys2);
6058           }
6059           function baseFunctions(object, props) {
6060             return arrayFilter2(props, function(key) {
6061               return isFunction2(object[key]);
6062             });
6063           }
6064           function baseGet(object, path) {
6065             path = castPath(path, object);
6066             var index = 0, length2 = path.length;
6067             while (object != null && index < length2) {
6068               object = object[toKey(path[index++])];
6069             }
6070             return index && index == length2 ? object : undefined2;
6071           }
6072           function baseGetAllKeys2(object, keysFunc, symbolsFunc) {
6073             var result2 = keysFunc(object);
6074             return isArray2(object) ? result2 : arrayPush2(result2, symbolsFunc(object));
6075           }
6076           function baseGetTag2(value) {
6077             if (value == null) {
6078               return value === undefined2 ? undefinedTag2 : nullTag2;
6079             }
6080             return symToStringTag3 && symToStringTag3 in Object2(value) ? getRawTag2(value) : objectToString2(value);
6081           }
6082           function baseGt(value, other) {
6083             return value > other;
6084           }
6085           function baseHas(object, key) {
6086             return object != null && hasOwnProperty10.call(object, key);
6087           }
6088           function baseHasIn(object, key) {
6089             return object != null && key in Object2(object);
6090           }
6091           function baseInRange(number3, start2, end) {
6092             return number3 >= nativeMin2(start2, end) && number3 < nativeMax2(start2, end);
6093           }
6094           function baseIntersection(arrays, iteratee2, comparator) {
6095             var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length2 = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array2(othLength), maxLength = Infinity, result2 = [];
6096             while (othIndex--) {
6097               var array2 = arrays[othIndex];
6098               if (othIndex && iteratee2) {
6099                 array2 = arrayMap2(array2, baseUnary2(iteratee2));
6100               }
6101               maxLength = nativeMin2(array2.length, maxLength);
6102               caches[othIndex] = !comparator && (iteratee2 || length2 >= 120 && array2.length >= 120) ? new SetCache2(othIndex && array2) : undefined2;
6103             }
6104             array2 = arrays[0];
6105             var index = -1, seen = caches[0];
6106             outer:
6107               while (++index < length2 && result2.length < maxLength) {
6108                 var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
6109                 value = comparator || value !== 0 ? value : 0;
6110                 if (!(seen ? cacheHas2(seen, computed) : includes2(result2, computed, comparator))) {
6111                   othIndex = othLength;
6112                   while (--othIndex) {
6113                     var cache = caches[othIndex];
6114                     if (!(cache ? cacheHas2(cache, computed) : includes2(arrays[othIndex], computed, comparator))) {
6115                       continue outer;
6116                     }
6117                   }
6118                   if (seen) {
6119                     seen.push(computed);
6120                   }
6121                   result2.push(value);
6122                 }
6123               }
6124             return result2;
6125           }
6126           function baseInverter(object, setter, iteratee2, accumulator) {
6127             baseForOwn(object, function(value, key, object2) {
6128               setter(accumulator, iteratee2(value), key, object2);
6129             });
6130             return accumulator;
6131           }
6132           function baseInvoke(object, path, args) {
6133             path = castPath(path, object);
6134             object = parent(object, path);
6135             var func = object == null ? object : object[toKey(last(path))];
6136             return func == null ? undefined2 : apply(func, object, args);
6137           }
6138           function baseIsArguments2(value) {
6139             return isObjectLike2(value) && baseGetTag2(value) == argsTag4;
6140           }
6141           function baseIsArrayBuffer(value) {
6142             return isObjectLike2(value) && baseGetTag2(value) == arrayBufferTag3;
6143           }
6144           function baseIsDate(value) {
6145             return isObjectLike2(value) && baseGetTag2(value) == dateTag3;
6146           }
6147           function baseIsEqual2(value, other, bitmask, customizer, stack) {
6148             if (value === other) {
6149               return true;
6150             }
6151             if (value == null || other == null || !isObjectLike2(value) && !isObjectLike2(other)) {
6152               return value !== value && other !== other;
6153             }
6154             return baseIsEqualDeep2(value, other, bitmask, customizer, baseIsEqual2, stack);
6155           }
6156           function baseIsEqualDeep2(object, other, bitmask, customizer, equalFunc, stack) {
6157             var objIsArr = isArray2(object), othIsArr = isArray2(other), objTag = objIsArr ? arrayTag3 : getTag2(object), othTag = othIsArr ? arrayTag3 : getTag2(other);
6158             objTag = objTag == argsTag4 ? objectTag4 : objTag;
6159             othTag = othTag == argsTag4 ? objectTag4 : othTag;
6160             var objIsObj = objTag == objectTag4, othIsObj = othTag == objectTag4, isSameTag = objTag == othTag;
6161             if (isSameTag && isBuffer2(object)) {
6162               if (!isBuffer2(other)) {
6163                 return false;
6164               }
6165               objIsArr = true;
6166               objIsObj = false;
6167             }
6168             if (isSameTag && !objIsObj) {
6169               stack || (stack = new Stack2());
6170               return objIsArr || isTypedArray2(object) ? equalArrays2(object, other, bitmask, customizer, equalFunc, stack) : equalByTag2(object, other, objTag, bitmask, customizer, equalFunc, stack);
6171             }
6172             if (!(bitmask & COMPARE_PARTIAL_FLAG5)) {
6173               var objIsWrapped = objIsObj && hasOwnProperty10.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty10.call(other, "__wrapped__");
6174               if (objIsWrapped || othIsWrapped) {
6175                 var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
6176                 stack || (stack = new Stack2());
6177                 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
6178               }
6179             }
6180             if (!isSameTag) {
6181               return false;
6182             }
6183             stack || (stack = new Stack2());
6184             return equalObjects2(object, other, bitmask, customizer, equalFunc, stack);
6185           }
6186           function baseIsMap(value) {
6187             return isObjectLike2(value) && getTag2(value) == mapTag4;
6188           }
6189           function baseIsMatch(object, source, matchData, customizer) {
6190             var index = matchData.length, length2 = index, noCustomizer = !customizer;
6191             if (object == null) {
6192               return !length2;
6193             }
6194             object = Object2(object);
6195             while (index--) {
6196               var data = matchData[index];
6197               if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
6198                 return false;
6199               }
6200             }
6201             while (++index < length2) {
6202               data = matchData[index];
6203               var key = data[0], objValue = object[key], srcValue = data[1];
6204               if (noCustomizer && data[2]) {
6205                 if (objValue === undefined2 && !(key in object)) {
6206                   return false;
6207                 }
6208               } else {
6209                 var stack = new Stack2();
6210                 if (customizer) {
6211                   var result2 = customizer(objValue, srcValue, key, object, source, stack);
6212                 }
6213                 if (!(result2 === undefined2 ? baseIsEqual2(srcValue, objValue, COMPARE_PARTIAL_FLAG5 | COMPARE_UNORDERED_FLAG3, customizer, stack) : result2)) {
6214                   return false;
6215                 }
6216               }
6217             }
6218             return true;
6219           }
6220           function baseIsNative2(value) {
6221             if (!isObject2(value) || isMasked2(value)) {
6222               return false;
6223             }
6224             var pattern = isFunction2(value) ? reIsNative2 : reIsHostCtor2;
6225             return pattern.test(toSource2(value));
6226           }
6227           function baseIsRegExp(value) {
6228             return isObjectLike2(value) && baseGetTag2(value) == regexpTag3;
6229           }
6230           function baseIsSet(value) {
6231             return isObjectLike2(value) && getTag2(value) == setTag4;
6232           }
6233           function baseIsTypedArray2(value) {
6234             return isObjectLike2(value) && isLength2(value.length) && !!typedArrayTags2[baseGetTag2(value)];
6235           }
6236           function baseIteratee(value) {
6237             if (typeof value == "function") {
6238               return value;
6239             }
6240             if (value == null) {
6241               return identity4;
6242             }
6243             if (typeof value == "object") {
6244               return isArray2(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
6245             }
6246             return property(value);
6247           }
6248           function baseKeys2(object) {
6249             if (!isPrototype2(object)) {
6250               return nativeKeys2(object);
6251             }
6252             var result2 = [];
6253             for (var key in Object2(object)) {
6254               if (hasOwnProperty10.call(object, key) && key != "constructor") {
6255                 result2.push(key);
6256               }
6257             }
6258             return result2;
6259           }
6260           function baseKeysIn(object) {
6261             if (!isObject2(object)) {
6262               return nativeKeysIn(object);
6263             }
6264             var isProto = isPrototype2(object), result2 = [];
6265             for (var key in object) {
6266               if (!(key == "constructor" && (isProto || !hasOwnProperty10.call(object, key)))) {
6267                 result2.push(key);
6268               }
6269             }
6270             return result2;
6271           }
6272           function baseLt(value, other) {
6273             return value < other;
6274           }
6275           function baseMap(collection, iteratee2) {
6276             var index = -1, result2 = isArrayLike2(collection) ? Array2(collection.length) : [];
6277             baseEach(collection, function(value, key, collection2) {
6278               result2[++index] = iteratee2(value, key, collection2);
6279             });
6280             return result2;
6281           }
6282           function baseMatches(source) {
6283             var matchData = getMatchData(source);
6284             if (matchData.length == 1 && matchData[0][2]) {
6285               return matchesStrictComparable(matchData[0][0], matchData[0][1]);
6286             }
6287             return function(object) {
6288               return object === source || baseIsMatch(object, source, matchData);
6289             };
6290           }
6291           function baseMatchesProperty(path, srcValue) {
6292             if (isKey(path) && isStrictComparable(srcValue)) {
6293               return matchesStrictComparable(toKey(path), srcValue);
6294             }
6295             return function(object) {
6296               var objValue = get4(object, path);
6297               return objValue === undefined2 && objValue === srcValue ? hasIn(object, path) : baseIsEqual2(srcValue, objValue, COMPARE_PARTIAL_FLAG5 | COMPARE_UNORDERED_FLAG3);
6298             };
6299           }
6300           function baseMerge(object, source, srcIndex, customizer, stack) {
6301             if (object === source) {
6302               return;
6303             }
6304             baseFor(source, function(srcValue, key) {
6305               stack || (stack = new Stack2());
6306               if (isObject2(srcValue)) {
6307                 baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
6308               } else {
6309                 var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : undefined2;
6310                 if (newValue === undefined2) {
6311                   newValue = srcValue;
6312                 }
6313                 assignMergeValue(object, key, newValue);
6314               }
6315             }, keysIn);
6316           }
6317           function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
6318             var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
6319             if (stacked) {
6320               assignMergeValue(object, key, stacked);
6321               return;
6322             }
6323             var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : undefined2;
6324             var isCommon = newValue === undefined2;
6325             if (isCommon) {
6326               var isArr = isArray2(srcValue), isBuff = !isArr && isBuffer2(srcValue), isTyped = !isArr && !isBuff && isTypedArray2(srcValue);
6327               newValue = srcValue;
6328               if (isArr || isBuff || isTyped) {
6329                 if (isArray2(objValue)) {
6330                   newValue = objValue;
6331                 } else if (isArrayLikeObject(objValue)) {
6332                   newValue = copyArray(objValue);
6333                 } else if (isBuff) {
6334                   isCommon = false;
6335                   newValue = cloneBuffer(srcValue, true);
6336                 } else if (isTyped) {
6337                   isCommon = false;
6338                   newValue = cloneTypedArray(srcValue, true);
6339                 } else {
6340                   newValue = [];
6341                 }
6342               } else if (isPlainObject(srcValue) || isArguments2(srcValue)) {
6343                 newValue = objValue;
6344                 if (isArguments2(objValue)) {
6345                   newValue = toPlainObject(objValue);
6346                 } else if (!isObject2(objValue) || isFunction2(objValue)) {
6347                   newValue = initCloneObject(srcValue);
6348                 }
6349               } else {
6350                 isCommon = false;
6351               }
6352             }
6353             if (isCommon) {
6354               stack.set(srcValue, newValue);
6355               mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
6356               stack["delete"](srcValue);
6357             }
6358             assignMergeValue(object, key, newValue);
6359           }
6360           function baseNth(array2, n3) {
6361             var length2 = array2.length;
6362             if (!length2) {
6363               return;
6364             }
6365             n3 += n3 < 0 ? length2 : 0;
6366             return isIndex2(n3, length2) ? array2[n3] : undefined2;
6367           }
6368           function baseOrderBy(collection, iteratees, orders) {
6369             if (iteratees.length) {
6370               iteratees = arrayMap2(iteratees, function(iteratee2) {
6371                 if (isArray2(iteratee2)) {
6372                   return function(value) {
6373                     return baseGet(value, iteratee2.length === 1 ? iteratee2[0] : iteratee2);
6374                   };
6375                 }
6376                 return iteratee2;
6377               });
6378             } else {
6379               iteratees = [identity4];
6380             }
6381             var index = -1;
6382             iteratees = arrayMap2(iteratees, baseUnary2(getIteratee()));
6383             var result2 = baseMap(collection, function(value, key, collection2) {
6384               var criteria = arrayMap2(iteratees, function(iteratee2) {
6385                 return iteratee2(value);
6386               });
6387               return { "criteria": criteria, "index": ++index, "value": value };
6388             });
6389             return baseSortBy(result2, function(object, other) {
6390               return compareMultiple(object, other, orders);
6391             });
6392           }
6393           function basePick(object, paths) {
6394             return basePickBy(object, paths, function(value, path) {
6395               return hasIn(object, path);
6396             });
6397           }
6398           function basePickBy(object, paths, predicate) {
6399             var index = -1, length2 = paths.length, result2 = {};
6400             while (++index < length2) {
6401               var path = paths[index], value = baseGet(object, path);
6402               if (predicate(value, path)) {
6403                 baseSet(result2, castPath(path, object), value);
6404               }
6405             }
6406             return result2;
6407           }
6408           function basePropertyDeep(path) {
6409             return function(object) {
6410               return baseGet(object, path);
6411             };
6412           }
6413           function basePullAll(array2, values2, iteratee2, comparator) {
6414             var indexOf2 = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length2 = values2.length, seen = array2;
6415             if (array2 === values2) {
6416               values2 = copyArray(values2);
6417             }
6418             if (iteratee2) {
6419               seen = arrayMap2(array2, baseUnary2(iteratee2));
6420             }
6421             while (++index < length2) {
6422               var fromIndex = 0, value = values2[index], computed = iteratee2 ? iteratee2(value) : value;
6423               while ((fromIndex = indexOf2(seen, computed, fromIndex, comparator)) > -1) {
6424                 if (seen !== array2) {
6425                   splice2.call(seen, fromIndex, 1);
6426                 }
6427                 splice2.call(array2, fromIndex, 1);
6428               }
6429             }
6430             return array2;
6431           }
6432           function basePullAt(array2, indexes) {
6433             var length2 = array2 ? indexes.length : 0, lastIndex = length2 - 1;
6434             while (length2--) {
6435               var index = indexes[length2];
6436               if (length2 == lastIndex || index !== previous) {
6437                 var previous = index;
6438                 if (isIndex2(index)) {
6439                   splice2.call(array2, index, 1);
6440                 } else {
6441                   baseUnset(array2, index);
6442                 }
6443               }
6444             }
6445             return array2;
6446           }
6447           function baseRandom(lower2, upper) {
6448             return lower2 + nativeFloor(nativeRandom() * (upper - lower2 + 1));
6449           }
6450           function baseRange(start2, end, step, fromRight) {
6451             var index = -1, length2 = nativeMax2(nativeCeil((end - start2) / (step || 1)), 0), result2 = Array2(length2);
6452             while (length2--) {
6453               result2[fromRight ? length2 : ++index] = start2;
6454               start2 += step;
6455             }
6456             return result2;
6457           }
6458           function baseRepeat(string, n3) {
6459             var result2 = "";
6460             if (!string || n3 < 1 || n3 > MAX_SAFE_INTEGER4) {
6461               return result2;
6462             }
6463             do {
6464               if (n3 % 2) {
6465                 result2 += string;
6466               }
6467               n3 = nativeFloor(n3 / 2);
6468               if (n3) {
6469                 string += string;
6470               }
6471             } while (n3);
6472             return result2;
6473           }
6474           function baseRest(func, start2) {
6475             return setToString(overRest(func, start2, identity4), func + "");
6476           }
6477           function baseSample(collection) {
6478             return arraySample(values(collection));
6479           }
6480           function baseSampleSize(collection, n3) {
6481             var array2 = values(collection);
6482             return shuffleSelf(array2, baseClamp(n3, 0, array2.length));
6483           }
6484           function baseSet(object, path, value, customizer) {
6485             if (!isObject2(object)) {
6486               return object;
6487             }
6488             path = castPath(path, object);
6489             var index = -1, length2 = path.length, lastIndex = length2 - 1, nested = object;
6490             while (nested != null && ++index < length2) {
6491               var key = toKey(path[index]), newValue = value;
6492               if (key === "__proto__" || key === "constructor" || key === "prototype") {
6493                 return object;
6494               }
6495               if (index != lastIndex) {
6496                 var objValue = nested[key];
6497                 newValue = customizer ? customizer(objValue, key, nested) : undefined2;
6498                 if (newValue === undefined2) {
6499                   newValue = isObject2(objValue) ? objValue : isIndex2(path[index + 1]) ? [] : {};
6500                 }
6501               }
6502               assignValue(nested, key, newValue);
6503               nested = nested[key];
6504             }
6505             return object;
6506           }
6507           var baseSetData = !metaMap ? identity4 : function(func, data) {
6508             metaMap.set(func, data);
6509             return func;
6510           };
6511           var baseSetToString = !defineProperty ? identity4 : function(func, string) {
6512             return defineProperty(func, "toString", {
6513               "configurable": true,
6514               "enumerable": false,
6515               "value": constant(string),
6516               "writable": true
6517             });
6518           };
6519           function baseShuffle(collection) {
6520             return shuffleSelf(values(collection));
6521           }
6522           function baseSlice(array2, start2, end) {
6523             var index = -1, length2 = array2.length;
6524             if (start2 < 0) {
6525               start2 = -start2 > length2 ? 0 : length2 + start2;
6526             }
6527             end = end > length2 ? length2 : end;
6528             if (end < 0) {
6529               end += length2;
6530             }
6531             length2 = start2 > end ? 0 : end - start2 >>> 0;
6532             start2 >>>= 0;
6533             var result2 = Array2(length2);
6534             while (++index < length2) {
6535               result2[index] = array2[index + start2];
6536             }
6537             return result2;
6538           }
6539           function baseSome(collection, predicate) {
6540             var result2;
6541             baseEach(collection, function(value, index, collection2) {
6542               result2 = predicate(value, index, collection2);
6543               return !result2;
6544             });
6545             return !!result2;
6546           }
6547           function baseSortedIndex(array2, value, retHighest) {
6548             var low = 0, high = array2 == null ? low : array2.length;
6549             if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
6550               while (low < high) {
6551                 var mid = low + high >>> 1, computed = array2[mid];
6552                 if (computed !== null && !isSymbol2(computed) && (retHighest ? computed <= value : computed < value)) {
6553                   low = mid + 1;
6554                 } else {
6555                   high = mid;
6556                 }
6557               }
6558               return high;
6559             }
6560             return baseSortedIndexBy(array2, value, identity4, retHighest);
6561           }
6562           function baseSortedIndexBy(array2, value, iteratee2, retHighest) {
6563             var low = 0, high = array2 == null ? 0 : array2.length;
6564             if (high === 0) {
6565               return 0;
6566             }
6567             value = iteratee2(value);
6568             var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol2(value), valIsUndefined = value === undefined2;
6569             while (low < high) {
6570               var mid = nativeFloor((low + high) / 2), computed = iteratee2(array2[mid]), othIsDefined = computed !== undefined2, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol2(computed);
6571               if (valIsNaN) {
6572                 var setLow = retHighest || othIsReflexive;
6573               } else if (valIsUndefined) {
6574                 setLow = othIsReflexive && (retHighest || othIsDefined);
6575               } else if (valIsNull) {
6576                 setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
6577               } else if (valIsSymbol) {
6578                 setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
6579               } else if (othIsNull || othIsSymbol) {
6580                 setLow = false;
6581               } else {
6582                 setLow = retHighest ? computed <= value : computed < value;
6583               }
6584               if (setLow) {
6585                 low = mid + 1;
6586               } else {
6587                 high = mid;
6588               }
6589             }
6590             return nativeMin2(high, MAX_ARRAY_INDEX);
6591           }
6592           function baseSortedUniq(array2, iteratee2) {
6593             var index = -1, length2 = array2.length, resIndex = 0, result2 = [];
6594             while (++index < length2) {
6595               var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
6596               if (!index || !eq2(computed, seen)) {
6597                 var seen = computed;
6598                 result2[resIndex++] = value === 0 ? 0 : value;
6599               }
6600             }
6601             return result2;
6602           }
6603           function baseToNumber(value) {
6604             if (typeof value == "number") {
6605               return value;
6606             }
6607             if (isSymbol2(value)) {
6608               return NAN2;
6609             }
6610             return +value;
6611           }
6612           function baseToString2(value) {
6613             if (typeof value == "string") {
6614               return value;
6615             }
6616             if (isArray2(value)) {
6617               return arrayMap2(value, baseToString2) + "";
6618             }
6619             if (isSymbol2(value)) {
6620               return symbolToString2 ? symbolToString2.call(value) : "";
6621             }
6622             var result2 = value + "";
6623             return result2 == "0" && 1 / value == -INFINITY2 ? "-0" : result2;
6624           }
6625           function baseUniq(array2, iteratee2, comparator) {
6626             var index = -1, includes2 = arrayIncludes, length2 = array2.length, isCommon = true, result2 = [], seen = result2;
6627             if (comparator) {
6628               isCommon = false;
6629               includes2 = arrayIncludesWith;
6630             } else if (length2 >= LARGE_ARRAY_SIZE2) {
6631               var set5 = iteratee2 ? null : createSet(array2);
6632               if (set5) {
6633                 return setToArray2(set5);
6634               }
6635               isCommon = false;
6636               includes2 = cacheHas2;
6637               seen = new SetCache2();
6638             } else {
6639               seen = iteratee2 ? [] : result2;
6640             }
6641             outer:
6642               while (++index < length2) {
6643                 var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
6644                 value = comparator || value !== 0 ? value : 0;
6645                 if (isCommon && computed === computed) {
6646                   var seenIndex = seen.length;
6647                   while (seenIndex--) {
6648                     if (seen[seenIndex] === computed) {
6649                       continue outer;
6650                     }
6651                   }
6652                   if (iteratee2) {
6653                     seen.push(computed);
6654                   }
6655                   result2.push(value);
6656                 } else if (!includes2(seen, computed, comparator)) {
6657                   if (seen !== result2) {
6658                     seen.push(computed);
6659                   }
6660                   result2.push(value);
6661                 }
6662               }
6663             return result2;
6664           }
6665           function baseUnset(object, path) {
6666             path = castPath(path, object);
6667             object = parent(object, path);
6668             return object == null || delete object[toKey(last(path))];
6669           }
6670           function baseUpdate(object, path, updater, customizer) {
6671             return baseSet(object, path, updater(baseGet(object, path)), customizer);
6672           }
6673           function baseWhile(array2, predicate, isDrop, fromRight) {
6674             var length2 = array2.length, index = fromRight ? length2 : -1;
6675             while ((fromRight ? index-- : ++index < length2) && predicate(array2[index], index, array2)) {
6676             }
6677             return isDrop ? baseSlice(array2, fromRight ? 0 : index, fromRight ? index + 1 : length2) : baseSlice(array2, fromRight ? index + 1 : 0, fromRight ? length2 : index);
6678           }
6679           function baseWrapperValue(value, actions) {
6680             var result2 = value;
6681             if (result2 instanceof LazyWrapper) {
6682               result2 = result2.value();
6683             }
6684             return arrayReduce(actions, function(result3, action) {
6685               return action.func.apply(action.thisArg, arrayPush2([result3], action.args));
6686             }, result2);
6687           }
6688           function baseXor(arrays, iteratee2, comparator) {
6689             var length2 = arrays.length;
6690             if (length2 < 2) {
6691               return length2 ? baseUniq(arrays[0]) : [];
6692             }
6693             var index = -1, result2 = Array2(length2);
6694             while (++index < length2) {
6695               var array2 = arrays[index], othIndex = -1;
6696               while (++othIndex < length2) {
6697                 if (othIndex != index) {
6698                   result2[index] = baseDifference(result2[index] || array2, arrays[othIndex], iteratee2, comparator);
6699                 }
6700               }
6701             }
6702             return baseUniq(baseFlatten(result2, 1), iteratee2, comparator);
6703           }
6704           function baseZipObject(props, values2, assignFunc) {
6705             var index = -1, length2 = props.length, valsLength = values2.length, result2 = {};
6706             while (++index < length2) {
6707               var value = index < valsLength ? values2[index] : undefined2;
6708               assignFunc(result2, props[index], value);
6709             }
6710             return result2;
6711           }
6712           function castArrayLikeObject(value) {
6713             return isArrayLikeObject(value) ? value : [];
6714           }
6715           function castFunction(value) {
6716             return typeof value == "function" ? value : identity4;
6717           }
6718           function castPath(value, object) {
6719             if (isArray2(value)) {
6720               return value;
6721             }
6722             return isKey(value, object) ? [value] : stringToPath(toString2(value));
6723           }
6724           var castRest = baseRest;
6725           function castSlice(array2, start2, end) {
6726             var length2 = array2.length;
6727             end = end === undefined2 ? length2 : end;
6728             return !start2 && end >= length2 ? array2 : baseSlice(array2, start2, end);
6729           }
6730           var clearTimeout2 = ctxClearTimeout || function(id2) {
6731             return root3.clearTimeout(id2);
6732           };
6733           function cloneBuffer(buffer, isDeep) {
6734             if (isDeep) {
6735               return buffer.slice();
6736             }
6737             var length2 = buffer.length, result2 = allocUnsafe ? allocUnsafe(length2) : new buffer.constructor(length2);
6738             buffer.copy(result2);
6739             return result2;
6740           }
6741           function cloneArrayBuffer(arrayBuffer) {
6742             var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength);
6743             new Uint8Array3(result2).set(new Uint8Array3(arrayBuffer));
6744             return result2;
6745           }
6746           function cloneDataView(dataView, isDeep) {
6747             var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
6748             return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
6749           }
6750           function cloneRegExp(regexp) {
6751             var result2 = new regexp.constructor(regexp.source, reFlags.exec(regexp));
6752             result2.lastIndex = regexp.lastIndex;
6753             return result2;
6754           }
6755           function cloneSymbol(symbol) {
6756             return symbolValueOf2 ? Object2(symbolValueOf2.call(symbol)) : {};
6757           }
6758           function cloneTypedArray(typedArray, isDeep) {
6759             var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
6760             return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
6761           }
6762           function compareAscending(value, other) {
6763             if (value !== other) {
6764               var valIsDefined = value !== undefined2, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol2(value);
6765               var othIsDefined = other !== undefined2, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol2(other);
6766               if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
6767                 return 1;
6768               }
6769               if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
6770                 return -1;
6771               }
6772             }
6773             return 0;
6774           }
6775           function compareMultiple(object, other, orders) {
6776             var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length2 = objCriteria.length, ordersLength = orders.length;
6777             while (++index < length2) {
6778               var result2 = compareAscending(objCriteria[index], othCriteria[index]);
6779               if (result2) {
6780                 if (index >= ordersLength) {
6781                   return result2;
6782                 }
6783                 var order = orders[index];
6784                 return result2 * (order == "desc" ? -1 : 1);
6785               }
6786             }
6787             return object.index - other.index;
6788           }
6789           function composeArgs(args, partials, holders, isCurried) {
6790             var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax2(argsLength - holdersLength, 0), result2 = Array2(leftLength + rangeLength), isUncurried = !isCurried;
6791             while (++leftIndex < leftLength) {
6792               result2[leftIndex] = partials[leftIndex];
6793             }
6794             while (++argsIndex < holdersLength) {
6795               if (isUncurried || argsIndex < argsLength) {
6796                 result2[holders[argsIndex]] = args[argsIndex];
6797               }
6798             }
6799             while (rangeLength--) {
6800               result2[leftIndex++] = args[argsIndex++];
6801             }
6802             return result2;
6803           }
6804           function composeArgsRight(args, partials, holders, isCurried) {
6805             var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax2(argsLength - holdersLength, 0), result2 = Array2(rangeLength + rightLength), isUncurried = !isCurried;
6806             while (++argsIndex < rangeLength) {
6807               result2[argsIndex] = args[argsIndex];
6808             }
6809             var offset = argsIndex;
6810             while (++rightIndex < rightLength) {
6811               result2[offset + rightIndex] = partials[rightIndex];
6812             }
6813             while (++holdersIndex < holdersLength) {
6814               if (isUncurried || argsIndex < argsLength) {
6815                 result2[offset + holders[holdersIndex]] = args[argsIndex++];
6816               }
6817             }
6818             return result2;
6819           }
6820           function copyArray(source, array2) {
6821             var index = -1, length2 = source.length;
6822             array2 || (array2 = Array2(length2));
6823             while (++index < length2) {
6824               array2[index] = source[index];
6825             }
6826             return array2;
6827           }
6828           function copyObject(source, props, object, customizer) {
6829             var isNew = !object;
6830             object || (object = {});
6831             var index = -1, length2 = props.length;
6832             while (++index < length2) {
6833               var key = props[index];
6834               var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined2;
6835               if (newValue === undefined2) {
6836                 newValue = source[key];
6837               }
6838               if (isNew) {
6839                 baseAssignValue(object, key, newValue);
6840               } else {
6841                 assignValue(object, key, newValue);
6842               }
6843             }
6844             return object;
6845           }
6846           function copySymbols(source, object) {
6847             return copyObject(source, getSymbols2(source), object);
6848           }
6849           function copySymbolsIn(source, object) {
6850             return copyObject(source, getSymbolsIn(source), object);
6851           }
6852           function createAggregator(setter, initializer) {
6853             return function(collection, iteratee2) {
6854               var func = isArray2(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
6855               return func(collection, setter, getIteratee(iteratee2, 2), accumulator);
6856             };
6857           }
6858           function createAssigner(assigner) {
6859             return baseRest(function(object, sources) {
6860               var index = -1, length2 = sources.length, customizer = length2 > 1 ? sources[length2 - 1] : undefined2, guard = length2 > 2 ? sources[2] : undefined2;
6861               customizer = assigner.length > 3 && typeof customizer == "function" ? (length2--, customizer) : undefined2;
6862               if (guard && isIterateeCall(sources[0], sources[1], guard)) {
6863                 customizer = length2 < 3 ? undefined2 : customizer;
6864                 length2 = 1;
6865               }
6866               object = Object2(object);
6867               while (++index < length2) {
6868                 var source = sources[index];
6869                 if (source) {
6870                   assigner(object, source, index, customizer);
6871                 }
6872               }
6873               return object;
6874             });
6875           }
6876           function createBaseEach(eachFunc, fromRight) {
6877             return function(collection, iteratee2) {
6878               if (collection == null) {
6879                 return collection;
6880               }
6881               if (!isArrayLike2(collection)) {
6882                 return eachFunc(collection, iteratee2);
6883               }
6884               var length2 = collection.length, index = fromRight ? length2 : -1, iterable = Object2(collection);
6885               while (fromRight ? index-- : ++index < length2) {
6886                 if (iteratee2(iterable[index], index, iterable) === false) {
6887                   break;
6888                 }
6889               }
6890               return collection;
6891             };
6892           }
6893           function createBaseFor(fromRight) {
6894             return function(object, iteratee2, keysFunc) {
6895               var index = -1, iterable = Object2(object), props = keysFunc(object), length2 = props.length;
6896               while (length2--) {
6897                 var key = props[fromRight ? length2 : ++index];
6898                 if (iteratee2(iterable[key], key, iterable) === false) {
6899                   break;
6900                 }
6901               }
6902               return object;
6903             };
6904           }
6905           function createBind(func, bitmask, thisArg) {
6906             var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
6907             function wrapper() {
6908               var fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
6909               return fn.apply(isBind ? thisArg : this, arguments);
6910             }
6911             return wrapper;
6912           }
6913           function createCaseFirst(methodName) {
6914             return function(string) {
6915               string = toString2(string);
6916               var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined2;
6917               var chr = strSymbols ? strSymbols[0] : string.charAt(0);
6918               var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1);
6919               return chr[methodName]() + trailing;
6920             };
6921           }
6922           function createCompounder(callback) {
6923             return function(string) {
6924               return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
6925             };
6926           }
6927           function createCtor(Ctor) {
6928             return function() {
6929               var args = arguments;
6930               switch (args.length) {
6931                 case 0:
6932                   return new Ctor();
6933                 case 1:
6934                   return new Ctor(args[0]);
6935                 case 2:
6936                   return new Ctor(args[0], args[1]);
6937                 case 3:
6938                   return new Ctor(args[0], args[1], args[2]);
6939                 case 4:
6940                   return new Ctor(args[0], args[1], args[2], args[3]);
6941                 case 5:
6942                   return new Ctor(args[0], args[1], args[2], args[3], args[4]);
6943                 case 6:
6944                   return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
6945                 case 7:
6946                   return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
6947               }
6948               var thisBinding = baseCreate(Ctor.prototype), result2 = Ctor.apply(thisBinding, args);
6949               return isObject2(result2) ? result2 : thisBinding;
6950             };
6951           }
6952           function createCurry(func, bitmask, arity) {
6953             var Ctor = createCtor(func);
6954             function wrapper() {
6955               var length2 = arguments.length, args = Array2(length2), index = length2, placeholder = getHolder(wrapper);
6956               while (index--) {
6957                 args[index] = arguments[index];
6958               }
6959               var holders = length2 < 3 && args[0] !== placeholder && args[length2 - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
6960               length2 -= holders.length;
6961               if (length2 < arity) {
6962                 return createRecurry(
6963                   func,
6964                   bitmask,
6965                   createHybrid,
6966                   wrapper.placeholder,
6967                   undefined2,
6968                   args,
6969                   holders,
6970                   undefined2,
6971                   undefined2,
6972                   arity - length2
6973                 );
6974               }
6975               var fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
6976               return apply(fn, this, args);
6977             }
6978             return wrapper;
6979           }
6980           function createFind(findIndexFunc) {
6981             return function(collection, predicate, fromIndex) {
6982               var iterable = Object2(collection);
6983               if (!isArrayLike2(collection)) {
6984                 var iteratee2 = getIteratee(predicate, 3);
6985                 collection = keys2(collection);
6986                 predicate = function(key) {
6987                   return iteratee2(iterable[key], key, iterable);
6988                 };
6989               }
6990               var index = findIndexFunc(collection, predicate, fromIndex);
6991               return index > -1 ? iterable[iteratee2 ? collection[index] : index] : undefined2;
6992             };
6993           }
6994           function createFlow(fromRight) {
6995             return flatRest(function(funcs) {
6996               var length2 = funcs.length, index = length2, prereq = LodashWrapper.prototype.thru;
6997               if (fromRight) {
6998                 funcs.reverse();
6999               }
7000               while (index--) {
7001                 var func = funcs[index];
7002                 if (typeof func != "function") {
7003                   throw new TypeError2(FUNC_ERROR_TEXT3);
7004                 }
7005                 if (prereq && !wrapper && getFuncName(func) == "wrapper") {
7006                   var wrapper = new LodashWrapper([], true);
7007                 }
7008               }
7009               index = wrapper ? index : length2;
7010               while (++index < length2) {
7011                 func = funcs[index];
7012                 var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : undefined2;
7013                 if (data && isLaziable(data[0]) && data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && !data[4].length && data[9] == 1) {
7014                   wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
7015                 } else {
7016                   wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
7017                 }
7018               }
7019               return function() {
7020                 var args = arguments, value = args[0];
7021                 if (wrapper && args.length == 1 && isArray2(value)) {
7022                   return wrapper.plant(value).value();
7023                 }
7024                 var index2 = 0, result2 = length2 ? funcs[index2].apply(this, args) : value;
7025                 while (++index2 < length2) {
7026                   result2 = funcs[index2].call(this, result2);
7027                 }
7028                 return result2;
7029               };
7030             });
7031           }
7032           function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, arity) {
7033             var isAry = bitmask & WRAP_ARY_FLAG, isBind = bitmask & WRAP_BIND_FLAG, isBindKey = bitmask & WRAP_BIND_KEY_FLAG, isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), isFlip = bitmask & WRAP_FLIP_FLAG, Ctor = isBindKey ? undefined2 : createCtor(func);
7034             function wrapper() {
7035               var length2 = arguments.length, args = Array2(length2), index = length2;
7036               while (index--) {
7037                 args[index] = arguments[index];
7038               }
7039               if (isCurried) {
7040                 var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder);
7041               }
7042               if (partials) {
7043                 args = composeArgs(args, partials, holders, isCurried);
7044               }
7045               if (partialsRight) {
7046                 args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
7047               }
7048               length2 -= holdersCount;
7049               if (isCurried && length2 < arity) {
7050                 var newHolders = replaceHolders(args, placeholder);
7051                 return createRecurry(
7052                   func,
7053                   bitmask,
7054                   createHybrid,
7055                   wrapper.placeholder,
7056                   thisArg,
7057                   args,
7058                   newHolders,
7059                   argPos,
7060                   ary2,
7061                   arity - length2
7062                 );
7063               }
7064               var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
7065               length2 = args.length;
7066               if (argPos) {
7067                 args = reorder(args, argPos);
7068               } else if (isFlip && length2 > 1) {
7069                 args.reverse();
7070               }
7071               if (isAry && ary2 < length2) {
7072                 args.length = ary2;
7073               }
7074               if (this && this !== root3 && this instanceof wrapper) {
7075                 fn = Ctor || createCtor(fn);
7076               }
7077               return fn.apply(thisBinding, args);
7078             }
7079             return wrapper;
7080           }
7081           function createInverter(setter, toIteratee) {
7082             return function(object, iteratee2) {
7083               return baseInverter(object, setter, toIteratee(iteratee2), {});
7084             };
7085           }
7086           function createMathOperation(operator, defaultValue) {
7087             return function(value, other) {
7088               var result2;
7089               if (value === undefined2 && other === undefined2) {
7090                 return defaultValue;
7091               }
7092               if (value !== undefined2) {
7093                 result2 = value;
7094               }
7095               if (other !== undefined2) {
7096                 if (result2 === undefined2) {
7097                   return other;
7098                 }
7099                 if (typeof value == "string" || typeof other == "string") {
7100                   value = baseToString2(value);
7101                   other = baseToString2(other);
7102                 } else {
7103                   value = baseToNumber(value);
7104                   other = baseToNumber(other);
7105                 }
7106                 result2 = operator(value, other);
7107               }
7108               return result2;
7109             };
7110           }
7111           function createOver(arrayFunc) {
7112             return flatRest(function(iteratees) {
7113               iteratees = arrayMap2(iteratees, baseUnary2(getIteratee()));
7114               return baseRest(function(args) {
7115                 var thisArg = this;
7116                 return arrayFunc(iteratees, function(iteratee2) {
7117                   return apply(iteratee2, thisArg, args);
7118                 });
7119               });
7120             });
7121           }
7122           function createPadding(length2, chars) {
7123             chars = chars === undefined2 ? " " : baseToString2(chars);
7124             var charsLength = chars.length;
7125             if (charsLength < 2) {
7126               return charsLength ? baseRepeat(chars, length2) : chars;
7127             }
7128             var result2 = baseRepeat(chars, nativeCeil(length2 / stringSize(chars)));
7129             return hasUnicode(chars) ? castSlice(stringToArray(result2), 0, length2).join("") : result2.slice(0, length2);
7130           }
7131           function createPartial(func, bitmask, thisArg, partials) {
7132             var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
7133             function wrapper() {
7134               var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
7135               while (++leftIndex < leftLength) {
7136                 args[leftIndex] = partials[leftIndex];
7137               }
7138               while (argsLength--) {
7139                 args[leftIndex++] = arguments[++argsIndex];
7140               }
7141               return apply(fn, isBind ? thisArg : this, args);
7142             }
7143             return wrapper;
7144           }
7145           function createRange(fromRight) {
7146             return function(start2, end, step) {
7147               if (step && typeof step != "number" && isIterateeCall(start2, end, step)) {
7148                 end = step = undefined2;
7149               }
7150               start2 = toFinite(start2);
7151               if (end === undefined2) {
7152                 end = start2;
7153                 start2 = 0;
7154               } else {
7155                 end = toFinite(end);
7156               }
7157               step = step === undefined2 ? start2 < end ? 1 : -1 : toFinite(step);
7158               return baseRange(start2, end, step, fromRight);
7159             };
7160           }
7161           function createRelationalOperation(operator) {
7162             return function(value, other) {
7163               if (!(typeof value == "string" && typeof other == "string")) {
7164                 value = toNumber3(value);
7165                 other = toNumber3(other);
7166               }
7167               return operator(value, other);
7168             };
7169           }
7170           function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary2, arity) {
7171             var isCurry = bitmask & WRAP_CURRY_FLAG, newHolders = isCurry ? holders : undefined2, newHoldersRight = isCurry ? undefined2 : holders, newPartials = isCurry ? partials : undefined2, newPartialsRight = isCurry ? undefined2 : partials;
7172             bitmask |= isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG;
7173             bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
7174             if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
7175               bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
7176             }
7177             var newData = [
7178               func,
7179               bitmask,
7180               thisArg,
7181               newPartials,
7182               newHolders,
7183               newPartialsRight,
7184               newHoldersRight,
7185               argPos,
7186               ary2,
7187               arity
7188             ];
7189             var result2 = wrapFunc.apply(undefined2, newData);
7190             if (isLaziable(func)) {
7191               setData(result2, newData);
7192             }
7193             result2.placeholder = placeholder;
7194             return setWrapToString(result2, func, bitmask);
7195           }
7196           function createRound(methodName) {
7197             var func = Math2[methodName];
7198             return function(number3, precision3) {
7199               number3 = toNumber3(number3);
7200               precision3 = precision3 == null ? 0 : nativeMin2(toInteger(precision3), 292);
7201               if (precision3 && nativeIsFinite(number3)) {
7202                 var pair3 = (toString2(number3) + "e").split("e"), value = func(pair3[0] + "e" + (+pair3[1] + precision3));
7203                 pair3 = (toString2(value) + "e").split("e");
7204                 return +(pair3[0] + "e" + (+pair3[1] - precision3));
7205               }
7206               return func(number3);
7207             };
7208           }
7209           var createSet = !(Set3 && 1 / setToArray2(new Set3([, -0]))[1] == INFINITY2) ? noop3 : function(values2) {
7210             return new Set3(values2);
7211           };
7212           function createToPairs(keysFunc) {
7213             return function(object) {
7214               var tag2 = getTag2(object);
7215               if (tag2 == mapTag4) {
7216                 return mapToArray2(object);
7217               }
7218               if (tag2 == setTag4) {
7219                 return setToPairs(object);
7220               }
7221               return baseToPairs(object, keysFunc(object));
7222             };
7223           }
7224           function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary2, arity) {
7225             var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
7226             if (!isBindKey && typeof func != "function") {
7227               throw new TypeError2(FUNC_ERROR_TEXT3);
7228             }
7229             var length2 = partials ? partials.length : 0;
7230             if (!length2) {
7231               bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
7232               partials = holders = undefined2;
7233             }
7234             ary2 = ary2 === undefined2 ? ary2 : nativeMax2(toInteger(ary2), 0);
7235             arity = arity === undefined2 ? arity : toInteger(arity);
7236             length2 -= holders ? holders.length : 0;
7237             if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
7238               var partialsRight = partials, holdersRight = holders;
7239               partials = holders = undefined2;
7240             }
7241             var data = isBindKey ? undefined2 : getData(func);
7242             var newData = [
7243               func,
7244               bitmask,
7245               thisArg,
7246               partials,
7247               holders,
7248               partialsRight,
7249               holdersRight,
7250               argPos,
7251               ary2,
7252               arity
7253             ];
7254             if (data) {
7255               mergeData(newData, data);
7256             }
7257             func = newData[0];
7258             bitmask = newData[1];
7259             thisArg = newData[2];
7260             partials = newData[3];
7261             holders = newData[4];
7262             arity = newData[9] = newData[9] === undefined2 ? isBindKey ? 0 : func.length : nativeMax2(newData[9] - length2, 0);
7263             if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
7264               bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
7265             }
7266             if (!bitmask || bitmask == WRAP_BIND_FLAG) {
7267               var result2 = createBind(func, bitmask, thisArg);
7268             } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
7269               result2 = createCurry(func, bitmask, arity);
7270             } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
7271               result2 = createPartial(func, bitmask, thisArg, partials);
7272             } else {
7273               result2 = createHybrid.apply(undefined2, newData);
7274             }
7275             var setter = data ? baseSetData : setData;
7276             return setWrapToString(setter(result2, newData), func, bitmask);
7277           }
7278           function customDefaultsAssignIn(objValue, srcValue, key, object) {
7279             if (objValue === undefined2 || eq2(objValue, objectProto13[key]) && !hasOwnProperty10.call(object, key)) {
7280               return srcValue;
7281             }
7282             return objValue;
7283           }
7284           function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
7285             if (isObject2(objValue) && isObject2(srcValue)) {
7286               stack.set(srcValue, objValue);
7287               baseMerge(objValue, srcValue, undefined2, customDefaultsMerge, stack);
7288               stack["delete"](srcValue);
7289             }
7290             return objValue;
7291           }
7292           function customOmitClone(value) {
7293             return isPlainObject(value) ? undefined2 : value;
7294           }
7295           function equalArrays2(array2, other, bitmask, customizer, equalFunc, stack) {
7296             var isPartial = bitmask & COMPARE_PARTIAL_FLAG5, arrLength = array2.length, othLength = other.length;
7297             if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
7298               return false;
7299             }
7300             var arrStacked = stack.get(array2);
7301             var othStacked = stack.get(other);
7302             if (arrStacked && othStacked) {
7303               return arrStacked == other && othStacked == array2;
7304             }
7305             var index = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG3 ? new SetCache2() : undefined2;
7306             stack.set(array2, other);
7307             stack.set(other, array2);
7308             while (++index < arrLength) {
7309               var arrValue = array2[index], othValue = other[index];
7310               if (customizer) {
7311                 var compared = isPartial ? customizer(othValue, arrValue, index, other, array2, stack) : customizer(arrValue, othValue, index, array2, other, stack);
7312               }
7313               if (compared !== undefined2) {
7314                 if (compared) {
7315                   continue;
7316                 }
7317                 result2 = false;
7318                 break;
7319               }
7320               if (seen) {
7321                 if (!arraySome2(other, function(othValue2, othIndex) {
7322                   if (!cacheHas2(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
7323                     return seen.push(othIndex);
7324                   }
7325                 })) {
7326                   result2 = false;
7327                   break;
7328                 }
7329               } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
7330                 result2 = false;
7331                 break;
7332               }
7333             }
7334             stack["delete"](array2);
7335             stack["delete"](other);
7336             return result2;
7337           }
7338           function equalByTag2(object, other, tag2, bitmask, customizer, equalFunc, stack) {
7339             switch (tag2) {
7340               case dataViewTag4:
7341                 if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
7342                   return false;
7343                 }
7344                 object = object.buffer;
7345                 other = other.buffer;
7346               case arrayBufferTag3:
7347                 if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array3(object), new Uint8Array3(other))) {
7348                   return false;
7349                 }
7350                 return true;
7351               case boolTag3:
7352               case dateTag3:
7353               case numberTag4:
7354                 return eq2(+object, +other);
7355               case errorTag3:
7356                 return object.name == other.name && object.message == other.message;
7357               case regexpTag3:
7358               case stringTag3:
7359                 return object == other + "";
7360               case mapTag4:
7361                 var convert = mapToArray2;
7362               case setTag4:
7363                 var isPartial = bitmask & COMPARE_PARTIAL_FLAG5;
7364                 convert || (convert = setToArray2);
7365                 if (object.size != other.size && !isPartial) {
7366                   return false;
7367                 }
7368                 var stacked = stack.get(object);
7369                 if (stacked) {
7370                   return stacked == other;
7371                 }
7372                 bitmask |= COMPARE_UNORDERED_FLAG3;
7373                 stack.set(object, other);
7374                 var result2 = equalArrays2(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
7375                 stack["delete"](object);
7376                 return result2;
7377               case symbolTag3:
7378                 if (symbolValueOf2) {
7379                   return symbolValueOf2.call(object) == symbolValueOf2.call(other);
7380                 }
7381             }
7382             return false;
7383           }
7384           function equalObjects2(object, other, bitmask, customizer, equalFunc, stack) {
7385             var isPartial = bitmask & COMPARE_PARTIAL_FLAG5, objProps = getAllKeys2(object), objLength = objProps.length, othProps = getAllKeys2(other), othLength = othProps.length;
7386             if (objLength != othLength && !isPartial) {
7387               return false;
7388             }
7389             var index = objLength;
7390             while (index--) {
7391               var key = objProps[index];
7392               if (!(isPartial ? key in other : hasOwnProperty10.call(other, key))) {
7393                 return false;
7394               }
7395             }
7396             var objStacked = stack.get(object);
7397             var othStacked = stack.get(other);
7398             if (objStacked && othStacked) {
7399               return objStacked == other && othStacked == object;
7400             }
7401             var result2 = true;
7402             stack.set(object, other);
7403             stack.set(other, object);
7404             var skipCtor = isPartial;
7405             while (++index < objLength) {
7406               key = objProps[index];
7407               var objValue = object[key], othValue = other[key];
7408               if (customizer) {
7409                 var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
7410               }
7411               if (!(compared === undefined2 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
7412                 result2 = false;
7413                 break;
7414               }
7415               skipCtor || (skipCtor = key == "constructor");
7416             }
7417             if (result2 && !skipCtor) {
7418               var objCtor = object.constructor, othCtor = other.constructor;
7419               if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
7420                 result2 = false;
7421               }
7422             }
7423             stack["delete"](object);
7424             stack["delete"](other);
7425             return result2;
7426           }
7427           function flatRest(func) {
7428             return setToString(overRest(func, undefined2, flatten2), func + "");
7429           }
7430           function getAllKeys2(object) {
7431             return baseGetAllKeys2(object, keys2, getSymbols2);
7432           }
7433           function getAllKeysIn(object) {
7434             return baseGetAllKeys2(object, keysIn, getSymbolsIn);
7435           }
7436           var getData = !metaMap ? noop3 : function(func) {
7437             return metaMap.get(func);
7438           };
7439           function getFuncName(func) {
7440             var result2 = func.name + "", array2 = realNames[result2], length2 = hasOwnProperty10.call(realNames, result2) ? array2.length : 0;
7441             while (length2--) {
7442               var data = array2[length2], otherFunc = data.func;
7443               if (otherFunc == null || otherFunc == func) {
7444                 return data.name;
7445               }
7446             }
7447             return result2;
7448           }
7449           function getHolder(func) {
7450             var object = hasOwnProperty10.call(lodash, "placeholder") ? lodash : func;
7451             return object.placeholder;
7452           }
7453           function getIteratee() {
7454             var result2 = lodash.iteratee || iteratee;
7455             result2 = result2 === iteratee ? baseIteratee : result2;
7456             return arguments.length ? result2(arguments[0], arguments[1]) : result2;
7457           }
7458           function getMapData2(map3, key) {
7459             var data = map3.__data__;
7460             return isKeyable2(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
7461           }
7462           function getMatchData(object) {
7463             var result2 = keys2(object), length2 = result2.length;
7464             while (length2--) {
7465               var key = result2[length2], value = object[key];
7466               result2[length2] = [key, value, isStrictComparable(value)];
7467             }
7468             return result2;
7469           }
7470           function getNative2(object, key) {
7471             var value = getValue2(object, key);
7472             return baseIsNative2(value) ? value : undefined2;
7473           }
7474           function getRawTag2(value) {
7475             var isOwn = hasOwnProperty10.call(value, symToStringTag3), tag2 = value[symToStringTag3];
7476             try {
7477               value[symToStringTag3] = undefined2;
7478               var unmasked = true;
7479             } catch (e3) {
7480             }
7481             var result2 = nativeObjectToString3.call(value);
7482             if (unmasked) {
7483               if (isOwn) {
7484                 value[symToStringTag3] = tag2;
7485               } else {
7486                 delete value[symToStringTag3];
7487               }
7488             }
7489             return result2;
7490           }
7491           var getSymbols2 = !nativeGetSymbols2 ? stubArray2 : function(object) {
7492             if (object == null) {
7493               return [];
7494             }
7495             object = Object2(object);
7496             return arrayFilter2(nativeGetSymbols2(object), function(symbol) {
7497               return propertyIsEnumerable3.call(object, symbol);
7498             });
7499           };
7500           var getSymbolsIn = !nativeGetSymbols2 ? stubArray2 : function(object) {
7501             var result2 = [];
7502             while (object) {
7503               arrayPush2(result2, getSymbols2(object));
7504               object = getPrototype(object);
7505             }
7506             return result2;
7507           };
7508           var getTag2 = baseGetTag2;
7509           if (DataView3 && getTag2(new DataView3(new ArrayBuffer(1))) != dataViewTag4 || Map3 && getTag2(new Map3()) != mapTag4 || Promise3 && getTag2(Promise3.resolve()) != promiseTag2 || Set3 && getTag2(new Set3()) != setTag4 || WeakMap2 && getTag2(new WeakMap2()) != weakMapTag3) {
7510             getTag2 = function(value) {
7511               var result2 = baseGetTag2(value), Ctor = result2 == objectTag4 ? value.constructor : undefined2, ctorString = Ctor ? toSource2(Ctor) : "";
7512               if (ctorString) {
7513                 switch (ctorString) {
7514                   case dataViewCtorString2:
7515                     return dataViewTag4;
7516                   case mapCtorString2:
7517                     return mapTag4;
7518                   case promiseCtorString2:
7519                     return promiseTag2;
7520                   case setCtorString2:
7521                     return setTag4;
7522                   case weakMapCtorString2:
7523                     return weakMapTag3;
7524                 }
7525               }
7526               return result2;
7527             };
7528           }
7529           function getView(start2, end, transforms) {
7530             var index = -1, length2 = transforms.length;
7531             while (++index < length2) {
7532               var data = transforms[index], size2 = data.size;
7533               switch (data.type) {
7534                 case "drop":
7535                   start2 += size2;
7536                   break;
7537                 case "dropRight":
7538                   end -= size2;
7539                   break;
7540                 case "take":
7541                   end = nativeMin2(end, start2 + size2);
7542                   break;
7543                 case "takeRight":
7544                   start2 = nativeMax2(start2, end - size2);
7545                   break;
7546               }
7547             }
7548             return { "start": start2, "end": end };
7549           }
7550           function getWrapDetails(source) {
7551             var match = source.match(reWrapDetails);
7552             return match ? match[1].split(reSplitDetails) : [];
7553           }
7554           function hasPath(object, path, hasFunc) {
7555             path = castPath(path, object);
7556             var index = -1, length2 = path.length, result2 = false;
7557             while (++index < length2) {
7558               var key = toKey(path[index]);
7559               if (!(result2 = object != null && hasFunc(object, key))) {
7560                 break;
7561               }
7562               object = object[key];
7563             }
7564             if (result2 || ++index != length2) {
7565               return result2;
7566             }
7567             length2 = object == null ? 0 : object.length;
7568             return !!length2 && isLength2(length2) && isIndex2(key, length2) && (isArray2(object) || isArguments2(object));
7569           }
7570           function initCloneArray(array2) {
7571             var length2 = array2.length, result2 = new array2.constructor(length2);
7572             if (length2 && typeof array2[0] == "string" && hasOwnProperty10.call(array2, "index")) {
7573               result2.index = array2.index;
7574               result2.input = array2.input;
7575             }
7576             return result2;
7577           }
7578           function initCloneObject(object) {
7579             return typeof object.constructor == "function" && !isPrototype2(object) ? baseCreate(getPrototype(object)) : {};
7580           }
7581           function initCloneByTag(object, tag2, isDeep) {
7582             var Ctor = object.constructor;
7583             switch (tag2) {
7584               case arrayBufferTag3:
7585                 return cloneArrayBuffer(object);
7586               case boolTag3:
7587               case dateTag3:
7588                 return new Ctor(+object);
7589               case dataViewTag4:
7590                 return cloneDataView(object, isDeep);
7591               case float32Tag2:
7592               case float64Tag2:
7593               case int8Tag2:
7594               case int16Tag2:
7595               case int32Tag2:
7596               case uint8Tag2:
7597               case uint8ClampedTag2:
7598               case uint16Tag2:
7599               case uint32Tag2:
7600                 return cloneTypedArray(object, isDeep);
7601               case mapTag4:
7602                 return new Ctor();
7603               case numberTag4:
7604               case stringTag3:
7605                 return new Ctor(object);
7606               case regexpTag3:
7607                 return cloneRegExp(object);
7608               case setTag4:
7609                 return new Ctor();
7610               case symbolTag3:
7611                 return cloneSymbol(object);
7612             }
7613           }
7614           function insertWrapDetails(source, details) {
7615             var length2 = details.length;
7616             if (!length2) {
7617               return source;
7618             }
7619             var lastIndex = length2 - 1;
7620             details[lastIndex] = (length2 > 1 ? "& " : "") + details[lastIndex];
7621             details = details.join(length2 > 2 ? ", " : " ");
7622             return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
7623           }
7624           function isFlattenable(value) {
7625             return isArray2(value) || isArguments2(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
7626           }
7627           function isIndex2(value, length2) {
7628             var type2 = typeof value;
7629             length2 = length2 == null ? MAX_SAFE_INTEGER4 : length2;
7630             return !!length2 && (type2 == "number" || type2 != "symbol" && reIsUint2.test(value)) && (value > -1 && value % 1 == 0 && value < length2);
7631           }
7632           function isIterateeCall(value, index, object) {
7633             if (!isObject2(object)) {
7634               return false;
7635             }
7636             var type2 = typeof index;
7637             if (type2 == "number" ? isArrayLike2(object) && isIndex2(index, object.length) : type2 == "string" && index in object) {
7638               return eq2(object[index], value);
7639             }
7640             return false;
7641           }
7642           function isKey(value, object) {
7643             if (isArray2(value)) {
7644               return false;
7645             }
7646             var type2 = typeof value;
7647             if (type2 == "number" || type2 == "symbol" || type2 == "boolean" || value == null || isSymbol2(value)) {
7648               return true;
7649             }
7650             return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object2(object);
7651           }
7652           function isKeyable2(value) {
7653             var type2 = typeof value;
7654             return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null;
7655           }
7656           function isLaziable(func) {
7657             var funcName = getFuncName(func), other = lodash[funcName];
7658             if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) {
7659               return false;
7660             }
7661             if (func === other) {
7662               return true;
7663             }
7664             var data = getData(other);
7665             return !!data && func === data[0];
7666           }
7667           function isMasked2(func) {
7668             return !!maskSrcKey2 && maskSrcKey2 in func;
7669           }
7670           var isMaskable = coreJsData2 ? isFunction2 : stubFalse2;
7671           function isPrototype2(value) {
7672             var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto13;
7673             return value === proto;
7674           }
7675           function isStrictComparable(value) {
7676             return value === value && !isObject2(value);
7677           }
7678           function matchesStrictComparable(key, srcValue) {
7679             return function(object) {
7680               if (object == null) {
7681                 return false;
7682               }
7683               return object[key] === srcValue && (srcValue !== undefined2 || key in Object2(object));
7684             };
7685           }
7686           function memoizeCapped(func) {
7687             var result2 = memoize(func, function(key) {
7688               if (cache.size === MAX_MEMOIZE_SIZE) {
7689                 cache.clear();
7690               }
7691               return key;
7692             });
7693             var cache = result2.cache;
7694             return result2;
7695           }
7696           function mergeData(data, source) {
7697             var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
7698             var isCombo = srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_CURRY_FLAG || srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_REARG_FLAG && data[7].length <= source[8] || srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG) && source[7].length <= source[8] && bitmask == WRAP_CURRY_FLAG;
7699             if (!(isCommon || isCombo)) {
7700               return data;
7701             }
7702             if (srcBitmask & WRAP_BIND_FLAG) {
7703               data[2] = source[2];
7704               newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
7705             }
7706             var value = source[3];
7707             if (value) {
7708               var partials = data[3];
7709               data[3] = partials ? composeArgs(partials, value, source[4]) : value;
7710               data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
7711             }
7712             value = source[5];
7713             if (value) {
7714               partials = data[5];
7715               data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
7716               data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
7717             }
7718             value = source[7];
7719             if (value) {
7720               data[7] = value;
7721             }
7722             if (srcBitmask & WRAP_ARY_FLAG) {
7723               data[8] = data[8] == null ? source[8] : nativeMin2(data[8], source[8]);
7724             }
7725             if (data[9] == null) {
7726               data[9] = source[9];
7727             }
7728             data[0] = source[0];
7729             data[1] = newBitmask;
7730             return data;
7731           }
7732           function nativeKeysIn(object) {
7733             var result2 = [];
7734             if (object != null) {
7735               for (var key in Object2(object)) {
7736                 result2.push(key);
7737               }
7738             }
7739             return result2;
7740           }
7741           function objectToString2(value) {
7742             return nativeObjectToString3.call(value);
7743           }
7744           function overRest(func, start2, transform3) {
7745             start2 = nativeMax2(start2 === undefined2 ? func.length - 1 : start2, 0);
7746             return function() {
7747               var args = arguments, index = -1, length2 = nativeMax2(args.length - start2, 0), array2 = Array2(length2);
7748               while (++index < length2) {
7749                 array2[index] = args[start2 + index];
7750               }
7751               index = -1;
7752               var otherArgs = Array2(start2 + 1);
7753               while (++index < start2) {
7754                 otherArgs[index] = args[index];
7755               }
7756               otherArgs[start2] = transform3(array2);
7757               return apply(func, this, otherArgs);
7758             };
7759           }
7760           function parent(object, path) {
7761             return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
7762           }
7763           function reorder(array2, indexes) {
7764             var arrLength = array2.length, length2 = nativeMin2(indexes.length, arrLength), oldArray = copyArray(array2);
7765             while (length2--) {
7766               var index = indexes[length2];
7767               array2[length2] = isIndex2(index, arrLength) ? oldArray[index] : undefined2;
7768             }
7769             return array2;
7770           }
7771           function safeGet(object, key) {
7772             if (key === "constructor" && typeof object[key] === "function") {
7773               return;
7774             }
7775             if (key == "__proto__") {
7776               return;
7777             }
7778             return object[key];
7779           }
7780           var setData = shortOut(baseSetData);
7781           var setTimeout2 = ctxSetTimeout || function(func, wait) {
7782             return root3.setTimeout(func, wait);
7783           };
7784           var setToString = shortOut(baseSetToString);
7785           function setWrapToString(wrapper, reference, bitmask) {
7786             var source = reference + "";
7787             return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
7788           }
7789           function shortOut(func) {
7790             var count = 0, lastCalled = 0;
7791             return function() {
7792               var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
7793               lastCalled = stamp;
7794               if (remaining > 0) {
7795                 if (++count >= HOT_COUNT) {
7796                   return arguments[0];
7797                 }
7798               } else {
7799                 count = 0;
7800               }
7801               return func.apply(undefined2, arguments);
7802             };
7803           }
7804           function shuffleSelf(array2, size2) {
7805             var index = -1, length2 = array2.length, lastIndex = length2 - 1;
7806             size2 = size2 === undefined2 ? length2 : size2;
7807             while (++index < size2) {
7808               var rand = baseRandom(index, lastIndex), value = array2[rand];
7809               array2[rand] = array2[index];
7810               array2[index] = value;
7811             }
7812             array2.length = size2;
7813             return array2;
7814           }
7815           var stringToPath = memoizeCapped(function(string) {
7816             var result2 = [];
7817             if (string.charCodeAt(0) === 46) {
7818               result2.push("");
7819             }
7820             string.replace(rePropName, function(match, number3, quote, subString) {
7821               result2.push(quote ? subString.replace(reEscapeChar, "$1") : number3 || match);
7822             });
7823             return result2;
7824           });
7825           function toKey(value) {
7826             if (typeof value == "string" || isSymbol2(value)) {
7827               return value;
7828             }
7829             var result2 = value + "";
7830             return result2 == "0" && 1 / value == -INFINITY2 ? "-0" : result2;
7831           }
7832           function toSource2(func) {
7833             if (func != null) {
7834               try {
7835                 return funcToString3.call(func);
7836               } catch (e3) {
7837               }
7838               try {
7839                 return func + "";
7840               } catch (e3) {
7841               }
7842             }
7843             return "";
7844           }
7845           function updateWrapDetails(details, bitmask) {
7846             arrayEach(wrapFlags, function(pair3) {
7847               var value = "_." + pair3[0];
7848               if (bitmask & pair3[1] && !arrayIncludes(details, value)) {
7849                 details.push(value);
7850               }
7851             });
7852             return details.sort();
7853           }
7854           function wrapperClone(wrapper) {
7855             if (wrapper instanceof LazyWrapper) {
7856               return wrapper.clone();
7857             }
7858             var result2 = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
7859             result2.__actions__ = copyArray(wrapper.__actions__);
7860             result2.__index__ = wrapper.__index__;
7861             result2.__values__ = wrapper.__values__;
7862             return result2;
7863           }
7864           function chunk(array2, size2, guard) {
7865             if (guard ? isIterateeCall(array2, size2, guard) : size2 === undefined2) {
7866               size2 = 1;
7867             } else {
7868               size2 = nativeMax2(toInteger(size2), 0);
7869             }
7870             var length2 = array2 == null ? 0 : array2.length;
7871             if (!length2 || size2 < 1) {
7872               return [];
7873             }
7874             var index = 0, resIndex = 0, result2 = Array2(nativeCeil(length2 / size2));
7875             while (index < length2) {
7876               result2[resIndex++] = baseSlice(array2, index, index += size2);
7877             }
7878             return result2;
7879           }
7880           function compact(array2) {
7881             var index = -1, length2 = array2 == null ? 0 : array2.length, resIndex = 0, result2 = [];
7882             while (++index < length2) {
7883               var value = array2[index];
7884               if (value) {
7885                 result2[resIndex++] = value;
7886               }
7887             }
7888             return result2;
7889           }
7890           function concat() {
7891             var length2 = arguments.length;
7892             if (!length2) {
7893               return [];
7894             }
7895             var args = Array2(length2 - 1), array2 = arguments[0], index = length2;
7896             while (index--) {
7897               args[index - 1] = arguments[index];
7898             }
7899             return arrayPush2(isArray2(array2) ? copyArray(array2) : [array2], baseFlatten(args, 1));
7900           }
7901           var difference2 = baseRest(function(array2, values2) {
7902             return isArrayLikeObject(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject, true)) : [];
7903           });
7904           var differenceBy = baseRest(function(array2, values2) {
7905             var iteratee2 = last(values2);
7906             if (isArrayLikeObject(iteratee2)) {
7907               iteratee2 = undefined2;
7908             }
7909             return isArrayLikeObject(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2)) : [];
7910           });
7911           var differenceWith = baseRest(function(array2, values2) {
7912             var comparator = last(values2);
7913             if (isArrayLikeObject(comparator)) {
7914               comparator = undefined2;
7915             }
7916             return isArrayLikeObject(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject, true), undefined2, comparator) : [];
7917           });
7918           function drop(array2, n3, guard) {
7919             var length2 = array2 == null ? 0 : array2.length;
7920             if (!length2) {
7921               return [];
7922             }
7923             n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
7924             return baseSlice(array2, n3 < 0 ? 0 : n3, length2);
7925           }
7926           function dropRight(array2, n3, guard) {
7927             var length2 = array2 == null ? 0 : array2.length;
7928             if (!length2) {
7929               return [];
7930             }
7931             n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
7932             n3 = length2 - n3;
7933             return baseSlice(array2, 0, n3 < 0 ? 0 : n3);
7934           }
7935           function dropRightWhile(array2, predicate) {
7936             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), true, true) : [];
7937           }
7938           function dropWhile(array2, predicate) {
7939             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), true) : [];
7940           }
7941           function fill(array2, value, start2, end) {
7942             var length2 = array2 == null ? 0 : array2.length;
7943             if (!length2) {
7944               return [];
7945             }
7946             if (start2 && typeof start2 != "number" && isIterateeCall(array2, value, start2)) {
7947               start2 = 0;
7948               end = length2;
7949             }
7950             return baseFill(array2, value, start2, end);
7951           }
7952           function findIndex(array2, predicate, fromIndex) {
7953             var length2 = array2 == null ? 0 : array2.length;
7954             if (!length2) {
7955               return -1;
7956             }
7957             var index = fromIndex == null ? 0 : toInteger(fromIndex);
7958             if (index < 0) {
7959               index = nativeMax2(length2 + index, 0);
7960             }
7961             return baseFindIndex(array2, getIteratee(predicate, 3), index);
7962           }
7963           function findLastIndex(array2, predicate, fromIndex) {
7964             var length2 = array2 == null ? 0 : array2.length;
7965             if (!length2) {
7966               return -1;
7967             }
7968             var index = length2 - 1;
7969             if (fromIndex !== undefined2) {
7970               index = toInteger(fromIndex);
7971               index = fromIndex < 0 ? nativeMax2(length2 + index, 0) : nativeMin2(index, length2 - 1);
7972             }
7973             return baseFindIndex(array2, getIteratee(predicate, 3), index, true);
7974           }
7975           function flatten2(array2) {
7976             var length2 = array2 == null ? 0 : array2.length;
7977             return length2 ? baseFlatten(array2, 1) : [];
7978           }
7979           function flattenDeep(array2) {
7980             var length2 = array2 == null ? 0 : array2.length;
7981             return length2 ? baseFlatten(array2, INFINITY2) : [];
7982           }
7983           function flattenDepth(array2, depth) {
7984             var length2 = array2 == null ? 0 : array2.length;
7985             if (!length2) {
7986               return [];
7987             }
7988             depth = depth === undefined2 ? 1 : toInteger(depth);
7989             return baseFlatten(array2, depth);
7990           }
7991           function fromPairs(pairs2) {
7992             var index = -1, length2 = pairs2 == null ? 0 : pairs2.length, result2 = {};
7993             while (++index < length2) {
7994               var pair3 = pairs2[index];
7995               result2[pair3[0]] = pair3[1];
7996             }
7997             return result2;
7998           }
7999           function head(array2) {
8000             return array2 && array2.length ? array2[0] : undefined2;
8001           }
8002           function indexOf(array2, value, fromIndex) {
8003             var length2 = array2 == null ? 0 : array2.length;
8004             if (!length2) {
8005               return -1;
8006             }
8007             var index = fromIndex == null ? 0 : toInteger(fromIndex);
8008             if (index < 0) {
8009               index = nativeMax2(length2 + index, 0);
8010             }
8011             return baseIndexOf(array2, value, index);
8012           }
8013           function initial(array2) {
8014             var length2 = array2 == null ? 0 : array2.length;
8015             return length2 ? baseSlice(array2, 0, -1) : [];
8016           }
8017           var intersection2 = baseRest(function(arrays) {
8018             var mapped = arrayMap2(arrays, castArrayLikeObject);
8019             return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
8020           });
8021           var intersectionBy = baseRest(function(arrays) {
8022             var iteratee2 = last(arrays), mapped = arrayMap2(arrays, castArrayLikeObject);
8023             if (iteratee2 === last(mapped)) {
8024               iteratee2 = undefined2;
8025             } else {
8026               mapped.pop();
8027             }
8028             return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, getIteratee(iteratee2, 2)) : [];
8029           });
8030           var intersectionWith = baseRest(function(arrays) {
8031             var comparator = last(arrays), mapped = arrayMap2(arrays, castArrayLikeObject);
8032             comparator = typeof comparator == "function" ? comparator : undefined2;
8033             if (comparator) {
8034               mapped.pop();
8035             }
8036             return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
8037           });
8038           function join(array2, separator) {
8039             return array2 == null ? "" : nativeJoin.call(array2, separator);
8040           }
8041           function last(array2) {
8042             var length2 = array2 == null ? 0 : array2.length;
8043             return length2 ? array2[length2 - 1] : undefined2;
8044           }
8045           function lastIndexOf(array2, value, fromIndex) {
8046             var length2 = array2 == null ? 0 : array2.length;
8047             if (!length2) {
8048               return -1;
8049             }
8050             var index = length2;
8051             if (fromIndex !== undefined2) {
8052               index = toInteger(fromIndex);
8053               index = index < 0 ? nativeMax2(length2 + index, 0) : nativeMin2(index, length2 - 1);
8054             }
8055             return value === value ? strictLastIndexOf(array2, value, index) : baseFindIndex(array2, baseIsNaN, index, true);
8056           }
8057           function nth(array2, n3) {
8058             return array2 && array2.length ? baseNth(array2, toInteger(n3)) : undefined2;
8059           }
8060           var pull = baseRest(pullAll);
8061           function pullAll(array2, values2) {
8062             return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2) : array2;
8063           }
8064           function pullAllBy(array2, values2, iteratee2) {
8065             return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2, getIteratee(iteratee2, 2)) : array2;
8066           }
8067           function pullAllWith(array2, values2, comparator) {
8068             return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2, undefined2, comparator) : array2;
8069           }
8070           var pullAt = flatRest(function(array2, indexes) {
8071             var length2 = array2 == null ? 0 : array2.length, result2 = baseAt(array2, indexes);
8072             basePullAt(array2, arrayMap2(indexes, function(index) {
8073               return isIndex2(index, length2) ? +index : index;
8074             }).sort(compareAscending));
8075             return result2;
8076           });
8077           function remove2(array2, predicate) {
8078             var result2 = [];
8079             if (!(array2 && array2.length)) {
8080               return result2;
8081             }
8082             var index = -1, indexes = [], length2 = array2.length;
8083             predicate = getIteratee(predicate, 3);
8084             while (++index < length2) {
8085               var value = array2[index];
8086               if (predicate(value, index, array2)) {
8087                 result2.push(value);
8088                 indexes.push(index);
8089               }
8090             }
8091             basePullAt(array2, indexes);
8092             return result2;
8093           }
8094           function reverse(array2) {
8095             return array2 == null ? array2 : nativeReverse.call(array2);
8096           }
8097           function slice(array2, start2, end) {
8098             var length2 = array2 == null ? 0 : array2.length;
8099             if (!length2) {
8100               return [];
8101             }
8102             if (end && typeof end != "number" && isIterateeCall(array2, start2, end)) {
8103               start2 = 0;
8104               end = length2;
8105             } else {
8106               start2 = start2 == null ? 0 : toInteger(start2);
8107               end = end === undefined2 ? length2 : toInteger(end);
8108             }
8109             return baseSlice(array2, start2, end);
8110           }
8111           function sortedIndex(array2, value) {
8112             return baseSortedIndex(array2, value);
8113           }
8114           function sortedIndexBy(array2, value, iteratee2) {
8115             return baseSortedIndexBy(array2, value, getIteratee(iteratee2, 2));
8116           }
8117           function sortedIndexOf(array2, value) {
8118             var length2 = array2 == null ? 0 : array2.length;
8119             if (length2) {
8120               var index = baseSortedIndex(array2, value);
8121               if (index < length2 && eq2(array2[index], value)) {
8122                 return index;
8123               }
8124             }
8125             return -1;
8126           }
8127           function sortedLastIndex(array2, value) {
8128             return baseSortedIndex(array2, value, true);
8129           }
8130           function sortedLastIndexBy(array2, value, iteratee2) {
8131             return baseSortedIndexBy(array2, value, getIteratee(iteratee2, 2), true);
8132           }
8133           function sortedLastIndexOf(array2, value) {
8134             var length2 = array2 == null ? 0 : array2.length;
8135             if (length2) {
8136               var index = baseSortedIndex(array2, value, true) - 1;
8137               if (eq2(array2[index], value)) {
8138                 return index;
8139               }
8140             }
8141             return -1;
8142           }
8143           function sortedUniq(array2) {
8144             return array2 && array2.length ? baseSortedUniq(array2) : [];
8145           }
8146           function sortedUniqBy(array2, iteratee2) {
8147             return array2 && array2.length ? baseSortedUniq(array2, getIteratee(iteratee2, 2)) : [];
8148           }
8149           function tail(array2) {
8150             var length2 = array2 == null ? 0 : array2.length;
8151             return length2 ? baseSlice(array2, 1, length2) : [];
8152           }
8153           function take(array2, n3, guard) {
8154             if (!(array2 && array2.length)) {
8155               return [];
8156             }
8157             n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
8158             return baseSlice(array2, 0, n3 < 0 ? 0 : n3);
8159           }
8160           function takeRight(array2, n3, guard) {
8161             var length2 = array2 == null ? 0 : array2.length;
8162             if (!length2) {
8163               return [];
8164             }
8165             n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
8166             n3 = length2 - n3;
8167             return baseSlice(array2, n3 < 0 ? 0 : n3, length2);
8168           }
8169           function takeRightWhile(array2, predicate) {
8170             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), false, true) : [];
8171           }
8172           function takeWhile(array2, predicate) {
8173             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3)) : [];
8174           }
8175           var union2 = baseRest(function(arrays) {
8176             return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
8177           });
8178           var unionBy = baseRest(function(arrays) {
8179             var iteratee2 = last(arrays);
8180             if (isArrayLikeObject(iteratee2)) {
8181               iteratee2 = undefined2;
8182             }
8183             return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2));
8184           });
8185           var unionWith = baseRest(function(arrays) {
8186             var comparator = last(arrays);
8187             comparator = typeof comparator == "function" ? comparator : undefined2;
8188             return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined2, comparator);
8189           });
8190           function uniq(array2) {
8191             return array2 && array2.length ? baseUniq(array2) : [];
8192           }
8193           function uniqBy(array2, iteratee2) {
8194             return array2 && array2.length ? baseUniq(array2, getIteratee(iteratee2, 2)) : [];
8195           }
8196           function uniqWith(array2, comparator) {
8197             comparator = typeof comparator == "function" ? comparator : undefined2;
8198             return array2 && array2.length ? baseUniq(array2, undefined2, comparator) : [];
8199           }
8200           function unzip(array2) {
8201             if (!(array2 && array2.length)) {
8202               return [];
8203             }
8204             var length2 = 0;
8205             array2 = arrayFilter2(array2, function(group) {
8206               if (isArrayLikeObject(group)) {
8207                 length2 = nativeMax2(group.length, length2);
8208                 return true;
8209               }
8210             });
8211             return baseTimes2(length2, function(index) {
8212               return arrayMap2(array2, baseProperty(index));
8213             });
8214           }
8215           function unzipWith(array2, iteratee2) {
8216             if (!(array2 && array2.length)) {
8217               return [];
8218             }
8219             var result2 = unzip(array2);
8220             if (iteratee2 == null) {
8221               return result2;
8222             }
8223             return arrayMap2(result2, function(group) {
8224               return apply(iteratee2, undefined2, group);
8225             });
8226           }
8227           var without = baseRest(function(array2, values2) {
8228             return isArrayLikeObject(array2) ? baseDifference(array2, values2) : [];
8229           });
8230           var xor = baseRest(function(arrays) {
8231             return baseXor(arrayFilter2(arrays, isArrayLikeObject));
8232           });
8233           var xorBy = baseRest(function(arrays) {
8234             var iteratee2 = last(arrays);
8235             if (isArrayLikeObject(iteratee2)) {
8236               iteratee2 = undefined2;
8237             }
8238             return baseXor(arrayFilter2(arrays, isArrayLikeObject), getIteratee(iteratee2, 2));
8239           });
8240           var xorWith = baseRest(function(arrays) {
8241             var comparator = last(arrays);
8242             comparator = typeof comparator == "function" ? comparator : undefined2;
8243             return baseXor(arrayFilter2(arrays, isArrayLikeObject), undefined2, comparator);
8244           });
8245           var zip = baseRest(unzip);
8246           function zipObject(props, values2) {
8247             return baseZipObject(props || [], values2 || [], assignValue);
8248           }
8249           function zipObjectDeep(props, values2) {
8250             return baseZipObject(props || [], values2 || [], baseSet);
8251           }
8252           var zipWith = baseRest(function(arrays) {
8253             var length2 = arrays.length, iteratee2 = length2 > 1 ? arrays[length2 - 1] : undefined2;
8254             iteratee2 = typeof iteratee2 == "function" ? (arrays.pop(), iteratee2) : undefined2;
8255             return unzipWith(arrays, iteratee2);
8256           });
8257           function chain(value) {
8258             var result2 = lodash(value);
8259             result2.__chain__ = true;
8260             return result2;
8261           }
8262           function tap(value, interceptor) {
8263             interceptor(value);
8264             return value;
8265           }
8266           function thru(value, interceptor) {
8267             return interceptor(value);
8268           }
8269           var wrapperAt = flatRest(function(paths) {
8270             var length2 = paths.length, start2 = length2 ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) {
8271               return baseAt(object, paths);
8272             };
8273             if (length2 > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex2(start2)) {
8274               return this.thru(interceptor);
8275             }
8276             value = value.slice(start2, +start2 + (length2 ? 1 : 0));
8277             value.__actions__.push({
8278               "func": thru,
8279               "args": [interceptor],
8280               "thisArg": undefined2
8281             });
8282             return new LodashWrapper(value, this.__chain__).thru(function(array2) {
8283               if (length2 && !array2.length) {
8284                 array2.push(undefined2);
8285               }
8286               return array2;
8287             });
8288           });
8289           function wrapperChain() {
8290             return chain(this);
8291           }
8292           function wrapperCommit() {
8293             return new LodashWrapper(this.value(), this.__chain__);
8294           }
8295           function wrapperNext() {
8296             if (this.__values__ === undefined2) {
8297               this.__values__ = toArray(this.value());
8298             }
8299             var done = this.__index__ >= this.__values__.length, value = done ? undefined2 : this.__values__[this.__index__++];
8300             return { "done": done, "value": value };
8301           }
8302           function wrapperToIterator() {
8303             return this;
8304           }
8305           function wrapperPlant(value) {
8306             var result2, parent2 = this;
8307             while (parent2 instanceof baseLodash) {
8308               var clone3 = wrapperClone(parent2);
8309               clone3.__index__ = 0;
8310               clone3.__values__ = undefined2;
8311               if (result2) {
8312                 previous.__wrapped__ = clone3;
8313               } else {
8314                 result2 = clone3;
8315               }
8316               var previous = clone3;
8317               parent2 = parent2.__wrapped__;
8318             }
8319             previous.__wrapped__ = value;
8320             return result2;
8321           }
8322           function wrapperReverse() {
8323             var value = this.__wrapped__;
8324             if (value instanceof LazyWrapper) {
8325               var wrapped = value;
8326               if (this.__actions__.length) {
8327                 wrapped = new LazyWrapper(this);
8328               }
8329               wrapped = wrapped.reverse();
8330               wrapped.__actions__.push({
8331                 "func": thru,
8332                 "args": [reverse],
8333                 "thisArg": undefined2
8334               });
8335               return new LodashWrapper(wrapped, this.__chain__);
8336             }
8337             return this.thru(reverse);
8338           }
8339           function wrapperValue() {
8340             return baseWrapperValue(this.__wrapped__, this.__actions__);
8341           }
8342           var countBy = createAggregator(function(result2, value, key) {
8343             if (hasOwnProperty10.call(result2, key)) {
8344               ++result2[key];
8345             } else {
8346               baseAssignValue(result2, key, 1);
8347             }
8348           });
8349           function every(collection, predicate, guard) {
8350             var func = isArray2(collection) ? arrayEvery : baseEvery;
8351             if (guard && isIterateeCall(collection, predicate, guard)) {
8352               predicate = undefined2;
8353             }
8354             return func(collection, getIteratee(predicate, 3));
8355           }
8356           function filter2(collection, predicate) {
8357             var func = isArray2(collection) ? arrayFilter2 : baseFilter;
8358             return func(collection, getIteratee(predicate, 3));
8359           }
8360           var find2 = createFind(findIndex);
8361           var findLast = createFind(findLastIndex);
8362           function flatMap(collection, iteratee2) {
8363             return baseFlatten(map2(collection, iteratee2), 1);
8364           }
8365           function flatMapDeep(collection, iteratee2) {
8366             return baseFlatten(map2(collection, iteratee2), INFINITY2);
8367           }
8368           function flatMapDepth(collection, iteratee2, depth) {
8369             depth = depth === undefined2 ? 1 : toInteger(depth);
8370             return baseFlatten(map2(collection, iteratee2), depth);
8371           }
8372           function forEach(collection, iteratee2) {
8373             var func = isArray2(collection) ? arrayEach : baseEach;
8374             return func(collection, getIteratee(iteratee2, 3));
8375           }
8376           function forEachRight(collection, iteratee2) {
8377             var func = isArray2(collection) ? arrayEachRight : baseEachRight;
8378             return func(collection, getIteratee(iteratee2, 3));
8379           }
8380           var groupBy = createAggregator(function(result2, value, key) {
8381             if (hasOwnProperty10.call(result2, key)) {
8382               result2[key].push(value);
8383             } else {
8384               baseAssignValue(result2, key, [value]);
8385             }
8386           });
8387           function includes(collection, value, fromIndex, guard) {
8388             collection = isArrayLike2(collection) ? collection : values(collection);
8389             fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
8390             var length2 = collection.length;
8391             if (fromIndex < 0) {
8392               fromIndex = nativeMax2(length2 + fromIndex, 0);
8393             }
8394             return isString(collection) ? fromIndex <= length2 && collection.indexOf(value, fromIndex) > -1 : !!length2 && baseIndexOf(collection, value, fromIndex) > -1;
8395           }
8396           var invokeMap = baseRest(function(collection, path, args) {
8397             var index = -1, isFunc = typeof path == "function", result2 = isArrayLike2(collection) ? Array2(collection.length) : [];
8398             baseEach(collection, function(value) {
8399               result2[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
8400             });
8401             return result2;
8402           });
8403           var keyBy = createAggregator(function(result2, value, key) {
8404             baseAssignValue(result2, key, value);
8405           });
8406           function map2(collection, iteratee2) {
8407             var func = isArray2(collection) ? arrayMap2 : baseMap;
8408             return func(collection, getIteratee(iteratee2, 3));
8409           }
8410           function orderBy(collection, iteratees, orders, guard) {
8411             if (collection == null) {
8412               return [];
8413             }
8414             if (!isArray2(iteratees)) {
8415               iteratees = iteratees == null ? [] : [iteratees];
8416             }
8417             orders = guard ? undefined2 : orders;
8418             if (!isArray2(orders)) {
8419               orders = orders == null ? [] : [orders];
8420             }
8421             return baseOrderBy(collection, iteratees, orders);
8422           }
8423           var partition = createAggregator(function(result2, value, key) {
8424             result2[key ? 0 : 1].push(value);
8425           }, function() {
8426             return [[], []];
8427           });
8428           function reduce(collection, iteratee2, accumulator) {
8429             var func = isArray2(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
8430             return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEach);
8431           }
8432           function reduceRight(collection, iteratee2, accumulator) {
8433             var func = isArray2(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
8434             return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEachRight);
8435           }
8436           function reject(collection, predicate) {
8437             var func = isArray2(collection) ? arrayFilter2 : baseFilter;
8438             return func(collection, negate(getIteratee(predicate, 3)));
8439           }
8440           function sample(collection) {
8441             var func = isArray2(collection) ? arraySample : baseSample;
8442             return func(collection);
8443           }
8444           function sampleSize(collection, n3, guard) {
8445             if (guard ? isIterateeCall(collection, n3, guard) : n3 === undefined2) {
8446               n3 = 1;
8447             } else {
8448               n3 = toInteger(n3);
8449             }
8450             var func = isArray2(collection) ? arraySampleSize : baseSampleSize;
8451             return func(collection, n3);
8452           }
8453           function shuffle(collection) {
8454             var func = isArray2(collection) ? arrayShuffle : baseShuffle;
8455             return func(collection);
8456           }
8457           function size(collection) {
8458             if (collection == null) {
8459               return 0;
8460             }
8461             if (isArrayLike2(collection)) {
8462               return isString(collection) ? stringSize(collection) : collection.length;
8463             }
8464             var tag2 = getTag2(collection);
8465             if (tag2 == mapTag4 || tag2 == setTag4) {
8466               return collection.size;
8467             }
8468             return baseKeys2(collection).length;
8469           }
8470           function some(collection, predicate, guard) {
8471             var func = isArray2(collection) ? arraySome2 : baseSome;
8472             if (guard && isIterateeCall(collection, predicate, guard)) {
8473               predicate = undefined2;
8474             }
8475             return func(collection, getIteratee(predicate, 3));
8476           }
8477           var sortBy = baseRest(function(collection, iteratees) {
8478             if (collection == null) {
8479               return [];
8480             }
8481             var length2 = iteratees.length;
8482             if (length2 > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
8483               iteratees = [];
8484             } else if (length2 > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
8485               iteratees = [iteratees[0]];
8486             }
8487             return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
8488           });
8489           var now3 = ctxNow || function() {
8490             return root3.Date.now();
8491           };
8492           function after(n3, func) {
8493             if (typeof func != "function") {
8494               throw new TypeError2(FUNC_ERROR_TEXT3);
8495             }
8496             n3 = toInteger(n3);
8497             return function() {
8498               if (--n3 < 1) {
8499                 return func.apply(this, arguments);
8500               }
8501             };
8502           }
8503           function ary(func, n3, guard) {
8504             n3 = guard ? undefined2 : n3;
8505             n3 = func && n3 == null ? func.length : n3;
8506             return createWrap(func, WRAP_ARY_FLAG, undefined2, undefined2, undefined2, undefined2, n3);
8507           }
8508           function before(n3, func) {
8509             var result2;
8510             if (typeof func != "function") {
8511               throw new TypeError2(FUNC_ERROR_TEXT3);
8512             }
8513             n3 = toInteger(n3);
8514             return function() {
8515               if (--n3 > 0) {
8516                 result2 = func.apply(this, arguments);
8517               }
8518               if (n3 <= 1) {
8519                 func = undefined2;
8520               }
8521               return result2;
8522             };
8523           }
8524           var bind = baseRest(function(func, thisArg, partials) {
8525             var bitmask = WRAP_BIND_FLAG;
8526             if (partials.length) {
8527               var holders = replaceHolders(partials, getHolder(bind));
8528               bitmask |= WRAP_PARTIAL_FLAG;
8529             }
8530             return createWrap(func, bitmask, thisArg, partials, holders);
8531           });
8532           var bindKey2 = baseRest(function(object, key, partials) {
8533             var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
8534             if (partials.length) {
8535               var holders = replaceHolders(partials, getHolder(bindKey2));
8536               bitmask |= WRAP_PARTIAL_FLAG;
8537             }
8538             return createWrap(key, bitmask, object, partials, holders);
8539           });
8540           function curry(func, arity, guard) {
8541             arity = guard ? undefined2 : arity;
8542             var result2 = createWrap(func, WRAP_CURRY_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
8543             result2.placeholder = curry.placeholder;
8544             return result2;
8545           }
8546           function curryRight(func, arity, guard) {
8547             arity = guard ? undefined2 : arity;
8548             var result2 = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
8549             result2.placeholder = curryRight.placeholder;
8550             return result2;
8551           }
8552           function debounce2(func, wait, options2) {
8553             var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
8554             if (typeof func != "function") {
8555               throw new TypeError2(FUNC_ERROR_TEXT3);
8556             }
8557             wait = toNumber3(wait) || 0;
8558             if (isObject2(options2)) {
8559               leading = !!options2.leading;
8560               maxing = "maxWait" in options2;
8561               maxWait = maxing ? nativeMax2(toNumber3(options2.maxWait) || 0, wait) : maxWait;
8562               trailing = "trailing" in options2 ? !!options2.trailing : trailing;
8563             }
8564             function invokeFunc(time) {
8565               var args = lastArgs, thisArg = lastThis;
8566               lastArgs = lastThis = undefined2;
8567               lastInvokeTime = time;
8568               result2 = func.apply(thisArg, args);
8569               return result2;
8570             }
8571             function leadingEdge(time) {
8572               lastInvokeTime = time;
8573               timerId = setTimeout2(timerExpired, wait);
8574               return leading ? invokeFunc(time) : result2;
8575             }
8576             function remainingWait(time) {
8577               var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
8578               return maxing ? nativeMin2(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
8579             }
8580             function shouldInvoke(time) {
8581               var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
8582               return lastCallTime === undefined2 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
8583             }
8584             function timerExpired() {
8585               var time = now3();
8586               if (shouldInvoke(time)) {
8587                 return trailingEdge(time);
8588               }
8589               timerId = setTimeout2(timerExpired, remainingWait(time));
8590             }
8591             function trailingEdge(time) {
8592               timerId = undefined2;
8593               if (trailing && lastArgs) {
8594                 return invokeFunc(time);
8595               }
8596               lastArgs = lastThis = undefined2;
8597               return result2;
8598             }
8599             function cancel() {
8600               if (timerId !== undefined2) {
8601                 clearTimeout2(timerId);
8602               }
8603               lastInvokeTime = 0;
8604               lastArgs = lastCallTime = lastThis = timerId = undefined2;
8605             }
8606             function flush() {
8607               return timerId === undefined2 ? result2 : trailingEdge(now3());
8608             }
8609             function debounced() {
8610               var time = now3(), isInvoking = shouldInvoke(time);
8611               lastArgs = arguments;
8612               lastThis = this;
8613               lastCallTime = time;
8614               if (isInvoking) {
8615                 if (timerId === undefined2) {
8616                   return leadingEdge(lastCallTime);
8617                 }
8618                 if (maxing) {
8619                   clearTimeout2(timerId);
8620                   timerId = setTimeout2(timerExpired, wait);
8621                   return invokeFunc(lastCallTime);
8622                 }
8623               }
8624               if (timerId === undefined2) {
8625                 timerId = setTimeout2(timerExpired, wait);
8626               }
8627               return result2;
8628             }
8629             debounced.cancel = cancel;
8630             debounced.flush = flush;
8631             return debounced;
8632           }
8633           var defer = baseRest(function(func, args) {
8634             return baseDelay(func, 1, args);
8635           });
8636           var delay = baseRest(function(func, wait, args) {
8637             return baseDelay(func, toNumber3(wait) || 0, args);
8638           });
8639           function flip(func) {
8640             return createWrap(func, WRAP_FLIP_FLAG);
8641           }
8642           function memoize(func, resolver) {
8643             if (typeof func != "function" || resolver != null && typeof resolver != "function") {
8644               throw new TypeError2(FUNC_ERROR_TEXT3);
8645             }
8646             var memoized = function() {
8647               var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
8648               if (cache.has(key)) {
8649                 return cache.get(key);
8650               }
8651               var result2 = func.apply(this, args);
8652               memoized.cache = cache.set(key, result2) || cache;
8653               return result2;
8654             };
8655             memoized.cache = new (memoize.Cache || MapCache2)();
8656             return memoized;
8657           }
8658           memoize.Cache = MapCache2;
8659           function negate(predicate) {
8660             if (typeof predicate != "function") {
8661               throw new TypeError2(FUNC_ERROR_TEXT3);
8662             }
8663             return function() {
8664               var args = arguments;
8665               switch (args.length) {
8666                 case 0:
8667                   return !predicate.call(this);
8668                 case 1:
8669                   return !predicate.call(this, args[0]);
8670                 case 2:
8671                   return !predicate.call(this, args[0], args[1]);
8672                 case 3:
8673                   return !predicate.call(this, args[0], args[1], args[2]);
8674               }
8675               return !predicate.apply(this, args);
8676             };
8677           }
8678           function once(func) {
8679             return before(2, func);
8680           }
8681           var overArgs = castRest(function(func, transforms) {
8682             transforms = transforms.length == 1 && isArray2(transforms[0]) ? arrayMap2(transforms[0], baseUnary2(getIteratee())) : arrayMap2(baseFlatten(transforms, 1), baseUnary2(getIteratee()));
8683             var funcsLength = transforms.length;
8684             return baseRest(function(args) {
8685               var index = -1, length2 = nativeMin2(args.length, funcsLength);
8686               while (++index < length2) {
8687                 args[index] = transforms[index].call(this, args[index]);
8688               }
8689               return apply(func, this, args);
8690             });
8691           });
8692           var partial = baseRest(function(func, partials) {
8693             var holders = replaceHolders(partials, getHolder(partial));
8694             return createWrap(func, WRAP_PARTIAL_FLAG, undefined2, partials, holders);
8695           });
8696           var partialRight = baseRest(function(func, partials) {
8697             var holders = replaceHolders(partials, getHolder(partialRight));
8698             return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined2, partials, holders);
8699           });
8700           var rearg = flatRest(function(func, indexes) {
8701             return createWrap(func, WRAP_REARG_FLAG, undefined2, undefined2, undefined2, indexes);
8702           });
8703           function rest(func, start2) {
8704             if (typeof func != "function") {
8705               throw new TypeError2(FUNC_ERROR_TEXT3);
8706             }
8707             start2 = start2 === undefined2 ? start2 : toInteger(start2);
8708             return baseRest(func, start2);
8709           }
8710           function spread(func, start2) {
8711             if (typeof func != "function") {
8712               throw new TypeError2(FUNC_ERROR_TEXT3);
8713             }
8714             start2 = start2 == null ? 0 : nativeMax2(toInteger(start2), 0);
8715             return baseRest(function(args) {
8716               var array2 = args[start2], otherArgs = castSlice(args, 0, start2);
8717               if (array2) {
8718                 arrayPush2(otherArgs, array2);
8719               }
8720               return apply(func, this, otherArgs);
8721             });
8722           }
8723           function throttle2(func, wait, options2) {
8724             var leading = true, trailing = true;
8725             if (typeof func != "function") {
8726               throw new TypeError2(FUNC_ERROR_TEXT3);
8727             }
8728             if (isObject2(options2)) {
8729               leading = "leading" in options2 ? !!options2.leading : leading;
8730               trailing = "trailing" in options2 ? !!options2.trailing : trailing;
8731             }
8732             return debounce2(func, wait, {
8733               "leading": leading,
8734               "maxWait": wait,
8735               "trailing": trailing
8736             });
8737           }
8738           function unary(func) {
8739             return ary(func, 1);
8740           }
8741           function wrap2(value, wrapper) {
8742             return partial(castFunction(wrapper), value);
8743           }
8744           function castArray() {
8745             if (!arguments.length) {
8746               return [];
8747             }
8748             var value = arguments[0];
8749             return isArray2(value) ? value : [value];
8750           }
8751           function clone2(value) {
8752             return baseClone(value, CLONE_SYMBOLS_FLAG);
8753           }
8754           function cloneWith(value, customizer) {
8755             customizer = typeof customizer == "function" ? customizer : undefined2;
8756             return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
8757           }
8758           function cloneDeep(value) {
8759             return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
8760           }
8761           function cloneDeepWith(value, customizer) {
8762             customizer = typeof customizer == "function" ? customizer : undefined2;
8763             return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
8764           }
8765           function conformsTo(object, source) {
8766             return source == null || baseConformsTo(object, source, keys2(source));
8767           }
8768           function eq2(value, other) {
8769             return value === other || value !== value && other !== other;
8770           }
8771           var gt2 = createRelationalOperation(baseGt);
8772           var gte = createRelationalOperation(function(value, other) {
8773             return value >= other;
8774           });
8775           var isArguments2 = baseIsArguments2(/* @__PURE__ */ function() {
8776             return arguments;
8777           }()) ? baseIsArguments2 : function(value) {
8778             return isObjectLike2(value) && hasOwnProperty10.call(value, "callee") && !propertyIsEnumerable3.call(value, "callee");
8779           };
8780           var isArray2 = Array2.isArray;
8781           var isArrayBuffer = nodeIsArrayBuffer ? baseUnary2(nodeIsArrayBuffer) : baseIsArrayBuffer;
8782           function isArrayLike2(value) {
8783             return value != null && isLength2(value.length) && !isFunction2(value);
8784           }
8785           function isArrayLikeObject(value) {
8786             return isObjectLike2(value) && isArrayLike2(value);
8787           }
8788           function isBoolean(value) {
8789             return value === true || value === false || isObjectLike2(value) && baseGetTag2(value) == boolTag3;
8790           }
8791           var isBuffer2 = nativeIsBuffer2 || stubFalse2;
8792           var isDate = nodeIsDate ? baseUnary2(nodeIsDate) : baseIsDate;
8793           function isElement2(value) {
8794             return isObjectLike2(value) && value.nodeType === 1 && !isPlainObject(value);
8795           }
8796           function isEmpty(value) {
8797             if (value == null) {
8798               return true;
8799             }
8800             if (isArrayLike2(value) && (isArray2(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer2(value) || isTypedArray2(value) || isArguments2(value))) {
8801               return !value.length;
8802             }
8803             var tag2 = getTag2(value);
8804             if (tag2 == mapTag4 || tag2 == setTag4) {
8805               return !value.size;
8806             }
8807             if (isPrototype2(value)) {
8808               return !baseKeys2(value).length;
8809             }
8810             for (var key in value) {
8811               if (hasOwnProperty10.call(value, key)) {
8812                 return false;
8813               }
8814             }
8815             return true;
8816           }
8817           function isEqual4(value, other) {
8818             return baseIsEqual2(value, other);
8819           }
8820           function isEqualWith(value, other, customizer) {
8821             customizer = typeof customizer == "function" ? customizer : undefined2;
8822             var result2 = customizer ? customizer(value, other) : undefined2;
8823             return result2 === undefined2 ? baseIsEqual2(value, other, undefined2, customizer) : !!result2;
8824           }
8825           function isError(value) {
8826             if (!isObjectLike2(value)) {
8827               return false;
8828             }
8829             var tag2 = baseGetTag2(value);
8830             return tag2 == errorTag3 || tag2 == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value);
8831           }
8832           function isFinite2(value) {
8833             return typeof value == "number" && nativeIsFinite(value);
8834           }
8835           function isFunction2(value) {
8836             if (!isObject2(value)) {
8837               return false;
8838             }
8839             var tag2 = baseGetTag2(value);
8840             return tag2 == funcTag3 || tag2 == genTag2 || tag2 == asyncTag2 || tag2 == proxyTag2;
8841           }
8842           function isInteger(value) {
8843             return typeof value == "number" && value == toInteger(value);
8844           }
8845           function isLength2(value) {
8846             return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER4;
8847           }
8848           function isObject2(value) {
8849             var type2 = typeof value;
8850             return value != null && (type2 == "object" || type2 == "function");
8851           }
8852           function isObjectLike2(value) {
8853             return value != null && typeof value == "object";
8854           }
8855           var isMap = nodeIsMap ? baseUnary2(nodeIsMap) : baseIsMap;
8856           function isMatch(object, source) {
8857             return object === source || baseIsMatch(object, source, getMatchData(source));
8858           }
8859           function isMatchWith(object, source, customizer) {
8860             customizer = typeof customizer == "function" ? customizer : undefined2;
8861             return baseIsMatch(object, source, getMatchData(source), customizer);
8862           }
8863           function isNaN2(value) {
8864             return isNumber2(value) && value != +value;
8865           }
8866           function isNative(value) {
8867             if (isMaskable(value)) {
8868               throw new Error2(CORE_ERROR_TEXT);
8869             }
8870             return baseIsNative2(value);
8871           }
8872           function isNull(value) {
8873             return value === null;
8874           }
8875           function isNil(value) {
8876             return value == null;
8877           }
8878           function isNumber2(value) {
8879             return typeof value == "number" || isObjectLike2(value) && baseGetTag2(value) == numberTag4;
8880           }
8881           function isPlainObject(value) {
8882             if (!isObjectLike2(value) || baseGetTag2(value) != objectTag4) {
8883               return false;
8884             }
8885             var proto = getPrototype(value);
8886             if (proto === null) {
8887               return true;
8888             }
8889             var Ctor = hasOwnProperty10.call(proto, "constructor") && proto.constructor;
8890             return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString3.call(Ctor) == objectCtorString;
8891           }
8892           var isRegExp = nodeIsRegExp ? baseUnary2(nodeIsRegExp) : baseIsRegExp;
8893           function isSafeInteger(value) {
8894             return isInteger(value) && value >= -MAX_SAFE_INTEGER4 && value <= MAX_SAFE_INTEGER4;
8895           }
8896           var isSet = nodeIsSet ? baseUnary2(nodeIsSet) : baseIsSet;
8897           function isString(value) {
8898             return typeof value == "string" || !isArray2(value) && isObjectLike2(value) && baseGetTag2(value) == stringTag3;
8899           }
8900           function isSymbol2(value) {
8901             return typeof value == "symbol" || isObjectLike2(value) && baseGetTag2(value) == symbolTag3;
8902           }
8903           var isTypedArray2 = nodeIsTypedArray2 ? baseUnary2(nodeIsTypedArray2) : baseIsTypedArray2;
8904           function isUndefined(value) {
8905             return value === undefined2;
8906           }
8907           function isWeakMap(value) {
8908             return isObjectLike2(value) && getTag2(value) == weakMapTag3;
8909           }
8910           function isWeakSet(value) {
8911             return isObjectLike2(value) && baseGetTag2(value) == weakSetTag;
8912           }
8913           var lt2 = createRelationalOperation(baseLt);
8914           var lte = createRelationalOperation(function(value, other) {
8915             return value <= other;
8916           });
8917           function toArray(value) {
8918             if (!value) {
8919               return [];
8920             }
8921             if (isArrayLike2(value)) {
8922               return isString(value) ? stringToArray(value) : copyArray(value);
8923             }
8924             if (symIterator && value[symIterator]) {
8925               return iteratorToArray(value[symIterator]());
8926             }
8927             var tag2 = getTag2(value), func = tag2 == mapTag4 ? mapToArray2 : tag2 == setTag4 ? setToArray2 : values;
8928             return func(value);
8929           }
8930           function toFinite(value) {
8931             if (!value) {
8932               return value === 0 ? value : 0;
8933             }
8934             value = toNumber3(value);
8935             if (value === INFINITY2 || value === -INFINITY2) {
8936               var sign2 = value < 0 ? -1 : 1;
8937               return sign2 * MAX_INTEGER;
8938             }
8939             return value === value ? value : 0;
8940           }
8941           function toInteger(value) {
8942             var result2 = toFinite(value), remainder = result2 % 1;
8943             return result2 === result2 ? remainder ? result2 - remainder : result2 : 0;
8944           }
8945           function toLength(value) {
8946             return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
8947           }
8948           function toNumber3(value) {
8949             if (typeof value == "number") {
8950               return value;
8951             }
8952             if (isSymbol2(value)) {
8953               return NAN2;
8954             }
8955             if (isObject2(value)) {
8956               var other = typeof value.valueOf == "function" ? value.valueOf() : value;
8957               value = isObject2(other) ? other + "" : other;
8958             }
8959             if (typeof value != "string") {
8960               return value === 0 ? value : +value;
8961             }
8962             value = baseTrim2(value);
8963             var isBinary = reIsBinary2.test(value);
8964             return isBinary || reIsOctal2.test(value) ? freeParseInt2(value.slice(2), isBinary ? 2 : 8) : reIsBadHex2.test(value) ? NAN2 : +value;
8965           }
8966           function toPlainObject(value) {
8967             return copyObject(value, keysIn(value));
8968           }
8969           function toSafeInteger(value) {
8970             return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER4, MAX_SAFE_INTEGER4) : value === 0 ? value : 0;
8971           }
8972           function toString2(value) {
8973             return value == null ? "" : baseToString2(value);
8974           }
8975           var assign = createAssigner(function(object, source) {
8976             if (isPrototype2(source) || isArrayLike2(source)) {
8977               copyObject(source, keys2(source), object);
8978               return;
8979             }
8980             for (var key in source) {
8981               if (hasOwnProperty10.call(source, key)) {
8982                 assignValue(object, key, source[key]);
8983               }
8984             }
8985           });
8986           var assignIn = createAssigner(function(object, source) {
8987             copyObject(source, keysIn(source), object);
8988           });
8989           var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
8990             copyObject(source, keysIn(source), object, customizer);
8991           });
8992           var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
8993             copyObject(source, keys2(source), object, customizer);
8994           });
8995           var at2 = flatRest(baseAt);
8996           function create2(prototype, properties) {
8997             var result2 = baseCreate(prototype);
8998             return properties == null ? result2 : baseAssign(result2, properties);
8999           }
9000           var defaults = baseRest(function(object, sources) {
9001             object = Object2(object);
9002             var index = -1;
9003             var length2 = sources.length;
9004             var guard = length2 > 2 ? sources[2] : undefined2;
9005             if (guard && isIterateeCall(sources[0], sources[1], guard)) {
9006               length2 = 1;
9007             }
9008             while (++index < length2) {
9009               var source = sources[index];
9010               var props = keysIn(source);
9011               var propsIndex = -1;
9012               var propsLength = props.length;
9013               while (++propsIndex < propsLength) {
9014                 var key = props[propsIndex];
9015                 var value = object[key];
9016                 if (value === undefined2 || eq2(value, objectProto13[key]) && !hasOwnProperty10.call(object, key)) {
9017                   object[key] = source[key];
9018                 }
9019               }
9020             }
9021             return object;
9022           });
9023           var defaultsDeep = baseRest(function(args) {
9024             args.push(undefined2, customDefaultsMerge);
9025             return apply(mergeWith, undefined2, args);
9026           });
9027           function findKey(object, predicate) {
9028             return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
9029           }
9030           function findLastKey(object, predicate) {
9031             return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
9032           }
9033           function forIn(object, iteratee2) {
9034             return object == null ? object : baseFor(object, getIteratee(iteratee2, 3), keysIn);
9035           }
9036           function forInRight(object, iteratee2) {
9037             return object == null ? object : baseForRight(object, getIteratee(iteratee2, 3), keysIn);
9038           }
9039           function forOwn(object, iteratee2) {
9040             return object && baseForOwn(object, getIteratee(iteratee2, 3));
9041           }
9042           function forOwnRight(object, iteratee2) {
9043             return object && baseForOwnRight(object, getIteratee(iteratee2, 3));
9044           }
9045           function functions(object) {
9046             return object == null ? [] : baseFunctions(object, keys2(object));
9047           }
9048           function functionsIn(object) {
9049             return object == null ? [] : baseFunctions(object, keysIn(object));
9050           }
9051           function get4(object, path, defaultValue) {
9052             var result2 = object == null ? undefined2 : baseGet(object, path);
9053             return result2 === undefined2 ? defaultValue : result2;
9054           }
9055           function has(object, path) {
9056             return object != null && hasPath(object, path, baseHas);
9057           }
9058           function hasIn(object, path) {
9059             return object != null && hasPath(object, path, baseHasIn);
9060           }
9061           var invert = createInverter(function(result2, value, key) {
9062             if (value != null && typeof value.toString != "function") {
9063               value = nativeObjectToString3.call(value);
9064             }
9065             result2[value] = key;
9066           }, constant(identity4));
9067           var invertBy = createInverter(function(result2, value, key) {
9068             if (value != null && typeof value.toString != "function") {
9069               value = nativeObjectToString3.call(value);
9070             }
9071             if (hasOwnProperty10.call(result2, value)) {
9072               result2[value].push(key);
9073             } else {
9074               result2[value] = [key];
9075             }
9076           }, getIteratee);
9077           var invoke = baseRest(baseInvoke);
9078           function keys2(object) {
9079             return isArrayLike2(object) ? arrayLikeKeys2(object) : baseKeys2(object);
9080           }
9081           function keysIn(object) {
9082             return isArrayLike2(object) ? arrayLikeKeys2(object, true) : baseKeysIn(object);
9083           }
9084           function mapKeys(object, iteratee2) {
9085             var result2 = {};
9086             iteratee2 = getIteratee(iteratee2, 3);
9087             baseForOwn(object, function(value, key, object2) {
9088               baseAssignValue(result2, iteratee2(value, key, object2), value);
9089             });
9090             return result2;
9091           }
9092           function mapValues(object, iteratee2) {
9093             var result2 = {};
9094             iteratee2 = getIteratee(iteratee2, 3);
9095             baseForOwn(object, function(value, key, object2) {
9096               baseAssignValue(result2, key, iteratee2(value, key, object2));
9097             });
9098             return result2;
9099           }
9100           var merge2 = createAssigner(function(object, source, srcIndex) {
9101             baseMerge(object, source, srcIndex);
9102           });
9103           var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
9104             baseMerge(object, source, srcIndex, customizer);
9105           });
9106           var omit = flatRest(function(object, paths) {
9107             var result2 = {};
9108             if (object == null) {
9109               return result2;
9110             }
9111             var isDeep = false;
9112             paths = arrayMap2(paths, function(path) {
9113               path = castPath(path, object);
9114               isDeep || (isDeep = path.length > 1);
9115               return path;
9116             });
9117             copyObject(object, getAllKeysIn(object), result2);
9118             if (isDeep) {
9119               result2 = baseClone(result2, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
9120             }
9121             var length2 = paths.length;
9122             while (length2--) {
9123               baseUnset(result2, paths[length2]);
9124             }
9125             return result2;
9126           });
9127           function omitBy(object, predicate) {
9128             return pickBy(object, negate(getIteratee(predicate)));
9129           }
9130           var pick = flatRest(function(object, paths) {
9131             return object == null ? {} : basePick(object, paths);
9132           });
9133           function pickBy(object, predicate) {
9134             if (object == null) {
9135               return {};
9136             }
9137             var props = arrayMap2(getAllKeysIn(object), function(prop) {
9138               return [prop];
9139             });
9140             predicate = getIteratee(predicate);
9141             return basePickBy(object, props, function(value, path) {
9142               return predicate(value, path[0]);
9143             });
9144           }
9145           function result(object, path, defaultValue) {
9146             path = castPath(path, object);
9147             var index = -1, length2 = path.length;
9148             if (!length2) {
9149               length2 = 1;
9150               object = undefined2;
9151             }
9152             while (++index < length2) {
9153               var value = object == null ? undefined2 : object[toKey(path[index])];
9154               if (value === undefined2) {
9155                 index = length2;
9156                 value = defaultValue;
9157               }
9158               object = isFunction2(value) ? value.call(object) : value;
9159             }
9160             return object;
9161           }
9162           function set4(object, path, value) {
9163             return object == null ? object : baseSet(object, path, value);
9164           }
9165           function setWith(object, path, value, customizer) {
9166             customizer = typeof customizer == "function" ? customizer : undefined2;
9167             return object == null ? object : baseSet(object, path, value, customizer);
9168           }
9169           var toPairs = createToPairs(keys2);
9170           var toPairsIn = createToPairs(keysIn);
9171           function transform2(object, iteratee2, accumulator) {
9172             var isArr = isArray2(object), isArrLike = isArr || isBuffer2(object) || isTypedArray2(object);
9173             iteratee2 = getIteratee(iteratee2, 4);
9174             if (accumulator == null) {
9175               var Ctor = object && object.constructor;
9176               if (isArrLike) {
9177                 accumulator = isArr ? new Ctor() : [];
9178               } else if (isObject2(object)) {
9179                 accumulator = isFunction2(Ctor) ? baseCreate(getPrototype(object)) : {};
9180               } else {
9181                 accumulator = {};
9182               }
9183             }
9184             (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) {
9185               return iteratee2(accumulator, value, index, object2);
9186             });
9187             return accumulator;
9188           }
9189           function unset(object, path) {
9190             return object == null ? true : baseUnset(object, path);
9191           }
9192           function update(object, path, updater) {
9193             return object == null ? object : baseUpdate(object, path, castFunction(updater));
9194           }
9195           function updateWith(object, path, updater, customizer) {
9196             customizer = typeof customizer == "function" ? customizer : undefined2;
9197             return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
9198           }
9199           function values(object) {
9200             return object == null ? [] : baseValues(object, keys2(object));
9201           }
9202           function valuesIn(object) {
9203             return object == null ? [] : baseValues(object, keysIn(object));
9204           }
9205           function clamp3(number3, lower2, upper) {
9206             if (upper === undefined2) {
9207               upper = lower2;
9208               lower2 = undefined2;
9209             }
9210             if (upper !== undefined2) {
9211               upper = toNumber3(upper);
9212               upper = upper === upper ? upper : 0;
9213             }
9214             if (lower2 !== undefined2) {
9215               lower2 = toNumber3(lower2);
9216               lower2 = lower2 === lower2 ? lower2 : 0;
9217             }
9218             return baseClamp(toNumber3(number3), lower2, upper);
9219           }
9220           function inRange(number3, start2, end) {
9221             start2 = toFinite(start2);
9222             if (end === undefined2) {
9223               end = start2;
9224               start2 = 0;
9225             } else {
9226               end = toFinite(end);
9227             }
9228             number3 = toNumber3(number3);
9229             return baseInRange(number3, start2, end);
9230           }
9231           function random(lower2, upper, floating) {
9232             if (floating && typeof floating != "boolean" && isIterateeCall(lower2, upper, floating)) {
9233               upper = floating = undefined2;
9234             }
9235             if (floating === undefined2) {
9236               if (typeof upper == "boolean") {
9237                 floating = upper;
9238                 upper = undefined2;
9239               } else if (typeof lower2 == "boolean") {
9240                 floating = lower2;
9241                 lower2 = undefined2;
9242               }
9243             }
9244             if (lower2 === undefined2 && upper === undefined2) {
9245               lower2 = 0;
9246               upper = 1;
9247             } else {
9248               lower2 = toFinite(lower2);
9249               if (upper === undefined2) {
9250                 upper = lower2;
9251                 lower2 = 0;
9252               } else {
9253                 upper = toFinite(upper);
9254               }
9255             }
9256             if (lower2 > upper) {
9257               var temp = lower2;
9258               lower2 = upper;
9259               upper = temp;
9260             }
9261             if (floating || lower2 % 1 || upper % 1) {
9262               var rand = nativeRandom();
9263               return nativeMin2(lower2 + rand * (upper - lower2 + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
9264             }
9265             return baseRandom(lower2, upper);
9266           }
9267           var camelCase = createCompounder(function(result2, word, index) {
9268             word = word.toLowerCase();
9269             return result2 + (index ? capitalize(word) : word);
9270           });
9271           function capitalize(string) {
9272             return upperFirst(toString2(string).toLowerCase());
9273           }
9274           function deburr(string) {
9275             string = toString2(string);
9276             return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
9277           }
9278           function endsWith(string, target, position) {
9279             string = toString2(string);
9280             target = baseToString2(target);
9281             var length2 = string.length;
9282             position = position === undefined2 ? length2 : baseClamp(toInteger(position), 0, length2);
9283             var end = position;
9284             position -= target.length;
9285             return position >= 0 && string.slice(position, end) == target;
9286           }
9287           function escape6(string) {
9288             string = toString2(string);
9289             return string && reHasUnescapedHtml2.test(string) ? string.replace(reUnescapedHtml2, escapeHtmlChar2) : string;
9290           }
9291           function escapeRegExp(string) {
9292             string = toString2(string);
9293             return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar2, "\\$&") : string;
9294           }
9295           var kebabCase = createCompounder(function(result2, word, index) {
9296             return result2 + (index ? "-" : "") + word.toLowerCase();
9297           });
9298           var lowerCase = createCompounder(function(result2, word, index) {
9299             return result2 + (index ? " " : "") + word.toLowerCase();
9300           });
9301           var lowerFirst = createCaseFirst("toLowerCase");
9302           function pad2(string, length2, chars) {
9303             string = toString2(string);
9304             length2 = toInteger(length2);
9305             var strLength = length2 ? stringSize(string) : 0;
9306             if (!length2 || strLength >= length2) {
9307               return string;
9308             }
9309             var mid = (length2 - strLength) / 2;
9310             return createPadding(nativeFloor(mid), chars) + string + createPadding(nativeCeil(mid), chars);
9311           }
9312           function padEnd(string, length2, chars) {
9313             string = toString2(string);
9314             length2 = toInteger(length2);
9315             var strLength = length2 ? stringSize(string) : 0;
9316             return length2 && strLength < length2 ? string + createPadding(length2 - strLength, chars) : string;
9317           }
9318           function padStart(string, length2, chars) {
9319             string = toString2(string);
9320             length2 = toInteger(length2);
9321             var strLength = length2 ? stringSize(string) : 0;
9322             return length2 && strLength < length2 ? createPadding(length2 - strLength, chars) + string : string;
9323           }
9324           function parseInt2(string, radix, guard) {
9325             if (guard || radix == null) {
9326               radix = 0;
9327             } else if (radix) {
9328               radix = +radix;
9329             }
9330             return nativeParseInt(toString2(string).replace(reTrimStart2, ""), radix || 0);
9331           }
9332           function repeat(string, n3, guard) {
9333             if (guard ? isIterateeCall(string, n3, guard) : n3 === undefined2) {
9334               n3 = 1;
9335             } else {
9336               n3 = toInteger(n3);
9337             }
9338             return baseRepeat(toString2(string), n3);
9339           }
9340           function replace() {
9341             var args = arguments, string = toString2(args[0]);
9342             return args.length < 3 ? string : string.replace(args[1], args[2]);
9343           }
9344           var snakeCase = createCompounder(function(result2, word, index) {
9345             return result2 + (index ? "_" : "") + word.toLowerCase();
9346           });
9347           function split(string, separator, limit) {
9348             if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) {
9349               separator = limit = undefined2;
9350             }
9351             limit = limit === undefined2 ? MAX_ARRAY_LENGTH : limit >>> 0;
9352             if (!limit) {
9353               return [];
9354             }
9355             string = toString2(string);
9356             if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) {
9357               separator = baseToString2(separator);
9358               if (!separator && hasUnicode(string)) {
9359                 return castSlice(stringToArray(string), 0, limit);
9360               }
9361             }
9362             return string.split(separator, limit);
9363           }
9364           var startCase = createCompounder(function(result2, word, index) {
9365             return result2 + (index ? " " : "") + upperFirst(word);
9366           });
9367           function startsWith(string, target, position) {
9368             string = toString2(string);
9369             position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length);
9370             target = baseToString2(target);
9371             return string.slice(position, position + target.length) == target;
9372           }
9373           function template(string, options2, guard) {
9374             var settings = lodash.templateSettings;
9375             if (guard && isIterateeCall(string, options2, guard)) {
9376               options2 = undefined2;
9377             }
9378             string = toString2(string);
9379             options2 = assignInWith({}, options2, settings, customDefaultsAssignIn);
9380             var imports = assignInWith({}, options2.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys2(imports), importsValues = baseValues(imports, importsKeys);
9381             var isEscaping, isEvaluating, index = 0, interpolate = options2.interpolate || reNoMatch, source = "__p += '";
9382             var reDelimiters = RegExp2(
9383               (options2.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options2.evaluate || reNoMatch).source + "|$",
9384               "g"
9385             );
9386             var sourceURL = "//# sourceURL=" + (hasOwnProperty10.call(options2, "sourceURL") ? (options2.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
9387             string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
9388               interpolateValue || (interpolateValue = esTemplateValue);
9389               source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
9390               if (escapeValue) {
9391                 isEscaping = true;
9392                 source += "' +\n__e(" + escapeValue + ") +\n'";
9393               }
9394               if (evaluateValue) {
9395                 isEvaluating = true;
9396                 source += "';\n" + evaluateValue + ";\n__p += '";
9397               }
9398               if (interpolateValue) {
9399                 source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
9400               }
9401               index = offset + match.length;
9402               return match;
9403             });
9404             source += "';\n";
9405             var variable = hasOwnProperty10.call(options2, "variable") && options2.variable;
9406             if (!variable) {
9407               source = "with (obj) {\n" + source + "\n}\n";
9408             } else if (reForbiddenIdentifierChars.test(variable)) {
9409               throw new Error2(INVALID_TEMPL_VAR_ERROR_TEXT);
9410             }
9411             source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
9412             source = "function(" + (variable || "obj") + ") {\n" + (variable ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (isEscaping ? ", __e = _.escape" : "") + (isEvaluating ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + source + "return __p\n}";
9413             var result2 = attempt(function() {
9414               return Function2(importsKeys, sourceURL + "return " + source).apply(undefined2, importsValues);
9415             });
9416             result2.source = source;
9417             if (isError(result2)) {
9418               throw result2;
9419             }
9420             return result2;
9421           }
9422           function toLower(value) {
9423             return toString2(value).toLowerCase();
9424           }
9425           function toUpper(value) {
9426             return toString2(value).toUpperCase();
9427           }
9428           function trim(string, chars, guard) {
9429             string = toString2(string);
9430             if (string && (guard || chars === undefined2)) {
9431               return baseTrim2(string);
9432             }
9433             if (!string || !(chars = baseToString2(chars))) {
9434               return string;
9435             }
9436             var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start2 = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1;
9437             return castSlice(strSymbols, start2, end).join("");
9438           }
9439           function trimEnd(string, chars, guard) {
9440             string = toString2(string);
9441             if (string && (guard || chars === undefined2)) {
9442               return string.slice(0, trimmedEndIndex2(string) + 1);
9443             }
9444             if (!string || !(chars = baseToString2(chars))) {
9445               return string;
9446             }
9447             var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
9448             return castSlice(strSymbols, 0, end).join("");
9449           }
9450           function trimStart(string, chars, guard) {
9451             string = toString2(string);
9452             if (string && (guard || chars === undefined2)) {
9453               return string.replace(reTrimStart2, "");
9454             }
9455             if (!string || !(chars = baseToString2(chars))) {
9456               return string;
9457             }
9458             var strSymbols = stringToArray(string), start2 = charsStartIndex(strSymbols, stringToArray(chars));
9459             return castSlice(strSymbols, start2).join("");
9460           }
9461           function truncate(string, options2) {
9462             var length2 = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
9463             if (isObject2(options2)) {
9464               var separator = "separator" in options2 ? options2.separator : separator;
9465               length2 = "length" in options2 ? toInteger(options2.length) : length2;
9466               omission = "omission" in options2 ? baseToString2(options2.omission) : omission;
9467             }
9468             string = toString2(string);
9469             var strLength = string.length;
9470             if (hasUnicode(string)) {
9471               var strSymbols = stringToArray(string);
9472               strLength = strSymbols.length;
9473             }
9474             if (length2 >= strLength) {
9475               return string;
9476             }
9477             var end = length2 - stringSize(omission);
9478             if (end < 1) {
9479               return omission;
9480             }
9481             var result2 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end);
9482             if (separator === undefined2) {
9483               return result2 + omission;
9484             }
9485             if (strSymbols) {
9486               end += result2.length - end;
9487             }
9488             if (isRegExp(separator)) {
9489               if (string.slice(end).search(separator)) {
9490                 var match, substring = result2;
9491                 if (!separator.global) {
9492                   separator = RegExp2(separator.source, toString2(reFlags.exec(separator)) + "g");
9493                 }
9494                 separator.lastIndex = 0;
9495                 while (match = separator.exec(substring)) {
9496                   var newEnd = match.index;
9497                 }
9498                 result2 = result2.slice(0, newEnd === undefined2 ? end : newEnd);
9499               }
9500             } else if (string.indexOf(baseToString2(separator), end) != end) {
9501               var index = result2.lastIndexOf(separator);
9502               if (index > -1) {
9503                 result2 = result2.slice(0, index);
9504               }
9505             }
9506             return result2 + omission;
9507           }
9508           function unescape2(string) {
9509             string = toString2(string);
9510             return string && reHasEscapedHtml2.test(string) ? string.replace(reEscapedHtml2, unescapeHtmlChar2) : string;
9511           }
9512           var upperCase = createCompounder(function(result2, word, index) {
9513             return result2 + (index ? " " : "") + word.toUpperCase();
9514           });
9515           var upperFirst = createCaseFirst("toUpperCase");
9516           function words(string, pattern, guard) {
9517             string = toString2(string);
9518             pattern = guard ? undefined2 : pattern;
9519             if (pattern === undefined2) {
9520               return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
9521             }
9522             return string.match(pattern) || [];
9523           }
9524           var attempt = baseRest(function(func, args) {
9525             try {
9526               return apply(func, undefined2, args);
9527             } catch (e3) {
9528               return isError(e3) ? e3 : new Error2(e3);
9529             }
9530           });
9531           var bindAll = flatRest(function(object, methodNames) {
9532             arrayEach(methodNames, function(key) {
9533               key = toKey(key);
9534               baseAssignValue(object, key, bind(object[key], object));
9535             });
9536             return object;
9537           });
9538           function cond(pairs2) {
9539             var length2 = pairs2 == null ? 0 : pairs2.length, toIteratee = getIteratee();
9540             pairs2 = !length2 ? [] : arrayMap2(pairs2, function(pair3) {
9541               if (typeof pair3[1] != "function") {
9542                 throw new TypeError2(FUNC_ERROR_TEXT3);
9543               }
9544               return [toIteratee(pair3[0]), pair3[1]];
9545             });
9546             return baseRest(function(args) {
9547               var index = -1;
9548               while (++index < length2) {
9549                 var pair3 = pairs2[index];
9550                 if (apply(pair3[0], this, args)) {
9551                   return apply(pair3[1], this, args);
9552                 }
9553               }
9554             });
9555           }
9556           function conforms(source) {
9557             return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
9558           }
9559           function constant(value) {
9560             return function() {
9561               return value;
9562             };
9563           }
9564           function defaultTo(value, defaultValue) {
9565             return value == null || value !== value ? defaultValue : value;
9566           }
9567           var flow = createFlow();
9568           var flowRight = createFlow(true);
9569           function identity4(value) {
9570             return value;
9571           }
9572           function iteratee(func) {
9573             return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG));
9574           }
9575           function matches(source) {
9576             return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
9577           }
9578           function matchesProperty(path, srcValue) {
9579             return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
9580           }
9581           var method = baseRest(function(path, args) {
9582             return function(object) {
9583               return baseInvoke(object, path, args);
9584             };
9585           });
9586           var methodOf = baseRest(function(object, args) {
9587             return function(path) {
9588               return baseInvoke(object, path, args);
9589             };
9590           });
9591           function mixin(object, source, options2) {
9592             var props = keys2(source), methodNames = baseFunctions(source, props);
9593             if (options2 == null && !(isObject2(source) && (methodNames.length || !props.length))) {
9594               options2 = source;
9595               source = object;
9596               object = this;
9597               methodNames = baseFunctions(source, keys2(source));
9598             }
9599             var chain2 = !(isObject2(options2) && "chain" in options2) || !!options2.chain, isFunc = isFunction2(object);
9600             arrayEach(methodNames, function(methodName) {
9601               var func = source[methodName];
9602               object[methodName] = func;
9603               if (isFunc) {
9604                 object.prototype[methodName] = function() {
9605                   var chainAll = this.__chain__;
9606                   if (chain2 || chainAll) {
9607                     var result2 = object(this.__wrapped__), actions = result2.__actions__ = copyArray(this.__actions__);
9608                     actions.push({ "func": func, "args": arguments, "thisArg": object });
9609                     result2.__chain__ = chainAll;
9610                     return result2;
9611                   }
9612                   return func.apply(object, arrayPush2([this.value()], arguments));
9613                 };
9614               }
9615             });
9616             return object;
9617           }
9618           function noConflict() {
9619             if (root3._ === this) {
9620               root3._ = oldDash;
9621             }
9622             return this;
9623           }
9624           function noop3() {
9625           }
9626           function nthArg(n3) {
9627             n3 = toInteger(n3);
9628             return baseRest(function(args) {
9629               return baseNth(args, n3);
9630             });
9631           }
9632           var over = createOver(arrayMap2);
9633           var overEvery = createOver(arrayEvery);
9634           var overSome = createOver(arraySome2);
9635           function property(path) {
9636             return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
9637           }
9638           function propertyOf(object) {
9639             return function(path) {
9640               return object == null ? undefined2 : baseGet(object, path);
9641             };
9642           }
9643           var range3 = createRange();
9644           var rangeRight = createRange(true);
9645           function stubArray2() {
9646             return [];
9647           }
9648           function stubFalse2() {
9649             return false;
9650           }
9651           function stubObject() {
9652             return {};
9653           }
9654           function stubString() {
9655             return "";
9656           }
9657           function stubTrue() {
9658             return true;
9659           }
9660           function times(n3, iteratee2) {
9661             n3 = toInteger(n3);
9662             if (n3 < 1 || n3 > MAX_SAFE_INTEGER4) {
9663               return [];
9664             }
9665             var index = MAX_ARRAY_LENGTH, length2 = nativeMin2(n3, MAX_ARRAY_LENGTH);
9666             iteratee2 = getIteratee(iteratee2);
9667             n3 -= MAX_ARRAY_LENGTH;
9668             var result2 = baseTimes2(length2, iteratee2);
9669             while (++index < n3) {
9670               iteratee2(index);
9671             }
9672             return result2;
9673           }
9674           function toPath(value) {
9675             if (isArray2(value)) {
9676               return arrayMap2(value, toKey);
9677             }
9678             return isSymbol2(value) ? [value] : copyArray(stringToPath(toString2(value)));
9679           }
9680           function uniqueId(prefix) {
9681             var id2 = ++idCounter;
9682             return toString2(prefix) + id2;
9683           }
9684           var add = createMathOperation(function(augend, addend) {
9685             return augend + addend;
9686           }, 0);
9687           var ceil = createRound("ceil");
9688           var divide = createMathOperation(function(dividend, divisor) {
9689             return dividend / divisor;
9690           }, 1);
9691           var floor = createRound("floor");
9692           function max3(array2) {
9693             return array2 && array2.length ? baseExtremum(array2, identity4, baseGt) : undefined2;
9694           }
9695           function maxBy(array2, iteratee2) {
9696             return array2 && array2.length ? baseExtremum(array2, getIteratee(iteratee2, 2), baseGt) : undefined2;
9697           }
9698           function mean(array2) {
9699             return baseMean(array2, identity4);
9700           }
9701           function meanBy(array2, iteratee2) {
9702             return baseMean(array2, getIteratee(iteratee2, 2));
9703           }
9704           function min3(array2) {
9705             return array2 && array2.length ? baseExtremum(array2, identity4, baseLt) : undefined2;
9706           }
9707           function minBy(array2, iteratee2) {
9708             return array2 && array2.length ? baseExtremum(array2, getIteratee(iteratee2, 2), baseLt) : undefined2;
9709           }
9710           var multiply = createMathOperation(function(multiplier, multiplicand) {
9711             return multiplier * multiplicand;
9712           }, 1);
9713           var round = createRound("round");
9714           var subtract = createMathOperation(function(minuend, subtrahend) {
9715             return minuend - subtrahend;
9716           }, 0);
9717           function sum(array2) {
9718             return array2 && array2.length ? baseSum(array2, identity4) : 0;
9719           }
9720           function sumBy(array2, iteratee2) {
9721             return array2 && array2.length ? baseSum(array2, getIteratee(iteratee2, 2)) : 0;
9722           }
9723           lodash.after = after;
9724           lodash.ary = ary;
9725           lodash.assign = assign;
9726           lodash.assignIn = assignIn;
9727           lodash.assignInWith = assignInWith;
9728           lodash.assignWith = assignWith;
9729           lodash.at = at2;
9730           lodash.before = before;
9731           lodash.bind = bind;
9732           lodash.bindAll = bindAll;
9733           lodash.bindKey = bindKey2;
9734           lodash.castArray = castArray;
9735           lodash.chain = chain;
9736           lodash.chunk = chunk;
9737           lodash.compact = compact;
9738           lodash.concat = concat;
9739           lodash.cond = cond;
9740           lodash.conforms = conforms;
9741           lodash.constant = constant;
9742           lodash.countBy = countBy;
9743           lodash.create = create2;
9744           lodash.curry = curry;
9745           lodash.curryRight = curryRight;
9746           lodash.debounce = debounce2;
9747           lodash.defaults = defaults;
9748           lodash.defaultsDeep = defaultsDeep;
9749           lodash.defer = defer;
9750           lodash.delay = delay;
9751           lodash.difference = difference2;
9752           lodash.differenceBy = differenceBy;
9753           lodash.differenceWith = differenceWith;
9754           lodash.drop = drop;
9755           lodash.dropRight = dropRight;
9756           lodash.dropRightWhile = dropRightWhile;
9757           lodash.dropWhile = dropWhile;
9758           lodash.fill = fill;
9759           lodash.filter = filter2;
9760           lodash.flatMap = flatMap;
9761           lodash.flatMapDeep = flatMapDeep;
9762           lodash.flatMapDepth = flatMapDepth;
9763           lodash.flatten = flatten2;
9764           lodash.flattenDeep = flattenDeep;
9765           lodash.flattenDepth = flattenDepth;
9766           lodash.flip = flip;
9767           lodash.flow = flow;
9768           lodash.flowRight = flowRight;
9769           lodash.fromPairs = fromPairs;
9770           lodash.functions = functions;
9771           lodash.functionsIn = functionsIn;
9772           lodash.groupBy = groupBy;
9773           lodash.initial = initial;
9774           lodash.intersection = intersection2;
9775           lodash.intersectionBy = intersectionBy;
9776           lodash.intersectionWith = intersectionWith;
9777           lodash.invert = invert;
9778           lodash.invertBy = invertBy;
9779           lodash.invokeMap = invokeMap;
9780           lodash.iteratee = iteratee;
9781           lodash.keyBy = keyBy;
9782           lodash.keys = keys2;
9783           lodash.keysIn = keysIn;
9784           lodash.map = map2;
9785           lodash.mapKeys = mapKeys;
9786           lodash.mapValues = mapValues;
9787           lodash.matches = matches;
9788           lodash.matchesProperty = matchesProperty;
9789           lodash.memoize = memoize;
9790           lodash.merge = merge2;
9791           lodash.mergeWith = mergeWith;
9792           lodash.method = method;
9793           lodash.methodOf = methodOf;
9794           lodash.mixin = mixin;
9795           lodash.negate = negate;
9796           lodash.nthArg = nthArg;
9797           lodash.omit = omit;
9798           lodash.omitBy = omitBy;
9799           lodash.once = once;
9800           lodash.orderBy = orderBy;
9801           lodash.over = over;
9802           lodash.overArgs = overArgs;
9803           lodash.overEvery = overEvery;
9804           lodash.overSome = overSome;
9805           lodash.partial = partial;
9806           lodash.partialRight = partialRight;
9807           lodash.partition = partition;
9808           lodash.pick = pick;
9809           lodash.pickBy = pickBy;
9810           lodash.property = property;
9811           lodash.propertyOf = propertyOf;
9812           lodash.pull = pull;
9813           lodash.pullAll = pullAll;
9814           lodash.pullAllBy = pullAllBy;
9815           lodash.pullAllWith = pullAllWith;
9816           lodash.pullAt = pullAt;
9817           lodash.range = range3;
9818           lodash.rangeRight = rangeRight;
9819           lodash.rearg = rearg;
9820           lodash.reject = reject;
9821           lodash.remove = remove2;
9822           lodash.rest = rest;
9823           lodash.reverse = reverse;
9824           lodash.sampleSize = sampleSize;
9825           lodash.set = set4;
9826           lodash.setWith = setWith;
9827           lodash.shuffle = shuffle;
9828           lodash.slice = slice;
9829           lodash.sortBy = sortBy;
9830           lodash.sortedUniq = sortedUniq;
9831           lodash.sortedUniqBy = sortedUniqBy;
9832           lodash.split = split;
9833           lodash.spread = spread;
9834           lodash.tail = tail;
9835           lodash.take = take;
9836           lodash.takeRight = takeRight;
9837           lodash.takeRightWhile = takeRightWhile;
9838           lodash.takeWhile = takeWhile;
9839           lodash.tap = tap;
9840           lodash.throttle = throttle2;
9841           lodash.thru = thru;
9842           lodash.toArray = toArray;
9843           lodash.toPairs = toPairs;
9844           lodash.toPairsIn = toPairsIn;
9845           lodash.toPath = toPath;
9846           lodash.toPlainObject = toPlainObject;
9847           lodash.transform = transform2;
9848           lodash.unary = unary;
9849           lodash.union = union2;
9850           lodash.unionBy = unionBy;
9851           lodash.unionWith = unionWith;
9852           lodash.uniq = uniq;
9853           lodash.uniqBy = uniqBy;
9854           lodash.uniqWith = uniqWith;
9855           lodash.unset = unset;
9856           lodash.unzip = unzip;
9857           lodash.unzipWith = unzipWith;
9858           lodash.update = update;
9859           lodash.updateWith = updateWith;
9860           lodash.values = values;
9861           lodash.valuesIn = valuesIn;
9862           lodash.without = without;
9863           lodash.words = words;
9864           lodash.wrap = wrap2;
9865           lodash.xor = xor;
9866           lodash.xorBy = xorBy;
9867           lodash.xorWith = xorWith;
9868           lodash.zip = zip;
9869           lodash.zipObject = zipObject;
9870           lodash.zipObjectDeep = zipObjectDeep;
9871           lodash.zipWith = zipWith;
9872           lodash.entries = toPairs;
9873           lodash.entriesIn = toPairsIn;
9874           lodash.extend = assignIn;
9875           lodash.extendWith = assignInWith;
9876           mixin(lodash, lodash);
9877           lodash.add = add;
9878           lodash.attempt = attempt;
9879           lodash.camelCase = camelCase;
9880           lodash.capitalize = capitalize;
9881           lodash.ceil = ceil;
9882           lodash.clamp = clamp3;
9883           lodash.clone = clone2;
9884           lodash.cloneDeep = cloneDeep;
9885           lodash.cloneDeepWith = cloneDeepWith;
9886           lodash.cloneWith = cloneWith;
9887           lodash.conformsTo = conformsTo;
9888           lodash.deburr = deburr;
9889           lodash.defaultTo = defaultTo;
9890           lodash.divide = divide;
9891           lodash.endsWith = endsWith;
9892           lodash.eq = eq2;
9893           lodash.escape = escape6;
9894           lodash.escapeRegExp = escapeRegExp;
9895           lodash.every = every;
9896           lodash.find = find2;
9897           lodash.findIndex = findIndex;
9898           lodash.findKey = findKey;
9899           lodash.findLast = findLast;
9900           lodash.findLastIndex = findLastIndex;
9901           lodash.findLastKey = findLastKey;
9902           lodash.floor = floor;
9903           lodash.forEach = forEach;
9904           lodash.forEachRight = forEachRight;
9905           lodash.forIn = forIn;
9906           lodash.forInRight = forInRight;
9907           lodash.forOwn = forOwn;
9908           lodash.forOwnRight = forOwnRight;
9909           lodash.get = get4;
9910           lodash.gt = gt2;
9911           lodash.gte = gte;
9912           lodash.has = has;
9913           lodash.hasIn = hasIn;
9914           lodash.head = head;
9915           lodash.identity = identity4;
9916           lodash.includes = includes;
9917           lodash.indexOf = indexOf;
9918           lodash.inRange = inRange;
9919           lodash.invoke = invoke;
9920           lodash.isArguments = isArguments2;
9921           lodash.isArray = isArray2;
9922           lodash.isArrayBuffer = isArrayBuffer;
9923           lodash.isArrayLike = isArrayLike2;
9924           lodash.isArrayLikeObject = isArrayLikeObject;
9925           lodash.isBoolean = isBoolean;
9926           lodash.isBuffer = isBuffer2;
9927           lodash.isDate = isDate;
9928           lodash.isElement = isElement2;
9929           lodash.isEmpty = isEmpty;
9930           lodash.isEqual = isEqual4;
9931           lodash.isEqualWith = isEqualWith;
9932           lodash.isError = isError;
9933           lodash.isFinite = isFinite2;
9934           lodash.isFunction = isFunction2;
9935           lodash.isInteger = isInteger;
9936           lodash.isLength = isLength2;
9937           lodash.isMap = isMap;
9938           lodash.isMatch = isMatch;
9939           lodash.isMatchWith = isMatchWith;
9940           lodash.isNaN = isNaN2;
9941           lodash.isNative = isNative;
9942           lodash.isNil = isNil;
9943           lodash.isNull = isNull;
9944           lodash.isNumber = isNumber2;
9945           lodash.isObject = isObject2;
9946           lodash.isObjectLike = isObjectLike2;
9947           lodash.isPlainObject = isPlainObject;
9948           lodash.isRegExp = isRegExp;
9949           lodash.isSafeInteger = isSafeInteger;
9950           lodash.isSet = isSet;
9951           lodash.isString = isString;
9952           lodash.isSymbol = isSymbol2;
9953           lodash.isTypedArray = isTypedArray2;
9954           lodash.isUndefined = isUndefined;
9955           lodash.isWeakMap = isWeakMap;
9956           lodash.isWeakSet = isWeakSet;
9957           lodash.join = join;
9958           lodash.kebabCase = kebabCase;
9959           lodash.last = last;
9960           lodash.lastIndexOf = lastIndexOf;
9961           lodash.lowerCase = lowerCase;
9962           lodash.lowerFirst = lowerFirst;
9963           lodash.lt = lt2;
9964           lodash.lte = lte;
9965           lodash.max = max3;
9966           lodash.maxBy = maxBy;
9967           lodash.mean = mean;
9968           lodash.meanBy = meanBy;
9969           lodash.min = min3;
9970           lodash.minBy = minBy;
9971           lodash.stubArray = stubArray2;
9972           lodash.stubFalse = stubFalse2;
9973           lodash.stubObject = stubObject;
9974           lodash.stubString = stubString;
9975           lodash.stubTrue = stubTrue;
9976           lodash.multiply = multiply;
9977           lodash.nth = nth;
9978           lodash.noConflict = noConflict;
9979           lodash.noop = noop3;
9980           lodash.now = now3;
9981           lodash.pad = pad2;
9982           lodash.padEnd = padEnd;
9983           lodash.padStart = padStart;
9984           lodash.parseInt = parseInt2;
9985           lodash.random = random;
9986           lodash.reduce = reduce;
9987           lodash.reduceRight = reduceRight;
9988           lodash.repeat = repeat;
9989           lodash.replace = replace;
9990           lodash.result = result;
9991           lodash.round = round;
9992           lodash.runInContext = runInContext2;
9993           lodash.sample = sample;
9994           lodash.size = size;
9995           lodash.snakeCase = snakeCase;
9996           lodash.some = some;
9997           lodash.sortedIndex = sortedIndex;
9998           lodash.sortedIndexBy = sortedIndexBy;
9999           lodash.sortedIndexOf = sortedIndexOf;
10000           lodash.sortedLastIndex = sortedLastIndex;
10001           lodash.sortedLastIndexBy = sortedLastIndexBy;
10002           lodash.sortedLastIndexOf = sortedLastIndexOf;
10003           lodash.startCase = startCase;
10004           lodash.startsWith = startsWith;
10005           lodash.subtract = subtract;
10006           lodash.sum = sum;
10007           lodash.sumBy = sumBy;
10008           lodash.template = template;
10009           lodash.times = times;
10010           lodash.toFinite = toFinite;
10011           lodash.toInteger = toInteger;
10012           lodash.toLength = toLength;
10013           lodash.toLower = toLower;
10014           lodash.toNumber = toNumber3;
10015           lodash.toSafeInteger = toSafeInteger;
10016           lodash.toString = toString2;
10017           lodash.toUpper = toUpper;
10018           lodash.trim = trim;
10019           lodash.trimEnd = trimEnd;
10020           lodash.trimStart = trimStart;
10021           lodash.truncate = truncate;
10022           lodash.unescape = unescape2;
10023           lodash.uniqueId = uniqueId;
10024           lodash.upperCase = upperCase;
10025           lodash.upperFirst = upperFirst;
10026           lodash.each = forEach;
10027           lodash.eachRight = forEachRight;
10028           lodash.first = head;
10029           mixin(lodash, function() {
10030             var source = {};
10031             baseForOwn(lodash, function(func, methodName) {
10032               if (!hasOwnProperty10.call(lodash.prototype, methodName)) {
10033                 source[methodName] = func;
10034               }
10035             });
10036             return source;
10037           }(), { "chain": false });
10038           lodash.VERSION = VERSION;
10039           arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
10040             lodash[methodName].placeholder = lodash;
10041           });
10042           arrayEach(["drop", "take"], function(methodName, index) {
10043             LazyWrapper.prototype[methodName] = function(n3) {
10044               n3 = n3 === undefined2 ? 1 : nativeMax2(toInteger(n3), 0);
10045               var result2 = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone();
10046               if (result2.__filtered__) {
10047                 result2.__takeCount__ = nativeMin2(n3, result2.__takeCount__);
10048               } else {
10049                 result2.__views__.push({
10050                   "size": nativeMin2(n3, MAX_ARRAY_LENGTH),
10051                   "type": methodName + (result2.__dir__ < 0 ? "Right" : "")
10052                 });
10053               }
10054               return result2;
10055             };
10056             LazyWrapper.prototype[methodName + "Right"] = function(n3) {
10057               return this.reverse()[methodName](n3).reverse();
10058             };
10059           });
10060           arrayEach(["filter", "map", "takeWhile"], function(methodName, index) {
10061             var type2 = index + 1, isFilter = type2 == LAZY_FILTER_FLAG || type2 == LAZY_WHILE_FLAG;
10062             LazyWrapper.prototype[methodName] = function(iteratee2) {
10063               var result2 = this.clone();
10064               result2.__iteratees__.push({
10065                 "iteratee": getIteratee(iteratee2, 3),
10066                 "type": type2
10067               });
10068               result2.__filtered__ = result2.__filtered__ || isFilter;
10069               return result2;
10070             };
10071           });
10072           arrayEach(["head", "last"], function(methodName, index) {
10073             var takeName = "take" + (index ? "Right" : "");
10074             LazyWrapper.prototype[methodName] = function() {
10075               return this[takeName](1).value()[0];
10076             };
10077           });
10078           arrayEach(["initial", "tail"], function(methodName, index) {
10079             var dropName = "drop" + (index ? "" : "Right");
10080             LazyWrapper.prototype[methodName] = function() {
10081               return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
10082             };
10083           });
10084           LazyWrapper.prototype.compact = function() {
10085             return this.filter(identity4);
10086           };
10087           LazyWrapper.prototype.find = function(predicate) {
10088             return this.filter(predicate).head();
10089           };
10090           LazyWrapper.prototype.findLast = function(predicate) {
10091             return this.reverse().find(predicate);
10092           };
10093           LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
10094             if (typeof path == "function") {
10095               return new LazyWrapper(this);
10096             }
10097             return this.map(function(value) {
10098               return baseInvoke(value, path, args);
10099             });
10100           });
10101           LazyWrapper.prototype.reject = function(predicate) {
10102             return this.filter(negate(getIteratee(predicate)));
10103           };
10104           LazyWrapper.prototype.slice = function(start2, end) {
10105             start2 = toInteger(start2);
10106             var result2 = this;
10107             if (result2.__filtered__ && (start2 > 0 || end < 0)) {
10108               return new LazyWrapper(result2);
10109             }
10110             if (start2 < 0) {
10111               result2 = result2.takeRight(-start2);
10112             } else if (start2) {
10113               result2 = result2.drop(start2);
10114             }
10115             if (end !== undefined2) {
10116               end = toInteger(end);
10117               result2 = end < 0 ? result2.dropRight(-end) : result2.take(end - start2);
10118             }
10119             return result2;
10120           };
10121           LazyWrapper.prototype.takeRightWhile = function(predicate) {
10122             return this.reverse().takeWhile(predicate).reverse();
10123           };
10124           LazyWrapper.prototype.toArray = function() {
10125             return this.take(MAX_ARRAY_LENGTH);
10126           };
10127           baseForOwn(LazyWrapper.prototype, function(func, methodName) {
10128             var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash[isTaker ? "take" + (methodName == "last" ? "Right" : "") : methodName], retUnwrapped = isTaker || /^find/.test(methodName);
10129             if (!lodashFunc) {
10130               return;
10131             }
10132             lodash.prototype[methodName] = function() {
10133               var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray2(value);
10134               var interceptor = function(value2) {
10135                 var result3 = lodashFunc.apply(lodash, arrayPush2([value2], args));
10136                 return isTaker && chainAll ? result3[0] : result3;
10137               };
10138               if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) {
10139                 isLazy = useLazy = false;
10140               }
10141               var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
10142               if (!retUnwrapped && useLazy) {
10143                 value = onlyLazy ? value : new LazyWrapper(this);
10144                 var result2 = func.apply(value, args);
10145                 result2.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": undefined2 });
10146                 return new LodashWrapper(result2, chainAll);
10147               }
10148               if (isUnwrapped && onlyLazy) {
10149                 return func.apply(this, args);
10150               }
10151               result2 = this.thru(interceptor);
10152               return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2;
10153             };
10154           });
10155           arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
10156             var func = arrayProto2[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
10157             lodash.prototype[methodName] = function() {
10158               var args = arguments;
10159               if (retUnwrapped && !this.__chain__) {
10160                 var value = this.value();
10161                 return func.apply(isArray2(value) ? value : [], args);
10162               }
10163               return this[chainName](function(value2) {
10164                 return func.apply(isArray2(value2) ? value2 : [], args);
10165               });
10166             };
10167           });
10168           baseForOwn(LazyWrapper.prototype, function(func, methodName) {
10169             var lodashFunc = lodash[methodName];
10170             if (lodashFunc) {
10171               var key = lodashFunc.name + "";
10172               if (!hasOwnProperty10.call(realNames, key)) {
10173                 realNames[key] = [];
10174               }
10175               realNames[key].push({ "name": methodName, "func": lodashFunc });
10176             }
10177           });
10178           realNames[createHybrid(undefined2, WRAP_BIND_KEY_FLAG).name] = [{
10179             "name": "wrapper",
10180             "func": undefined2
10181           }];
10182           LazyWrapper.prototype.clone = lazyClone;
10183           LazyWrapper.prototype.reverse = lazyReverse;
10184           LazyWrapper.prototype.value = lazyValue;
10185           lodash.prototype.at = wrapperAt;
10186           lodash.prototype.chain = wrapperChain;
10187           lodash.prototype.commit = wrapperCommit;
10188           lodash.prototype.next = wrapperNext;
10189           lodash.prototype.plant = wrapperPlant;
10190           lodash.prototype.reverse = wrapperReverse;
10191           lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
10192           lodash.prototype.first = lodash.prototype.head;
10193           if (symIterator) {
10194             lodash.prototype[symIterator] = wrapperToIterator;
10195           }
10196           return lodash;
10197         };
10198         var _2 = runInContext();
10199         if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
10200           root3._ = _2;
10201           define(function() {
10202             return _2;
10203           });
10204         } else if (freeModule3) {
10205           (freeModule3.exports = _2)._ = _2;
10206           freeExports3._ = _2;
10207         } else {
10208           root3._ = _2;
10209         }
10210       }).call(exports2);
10211     }
10212   });
10213
10214   // node_modules/fast-deep-equal/index.js
10215   var require_fast_deep_equal = __commonJS({
10216     "node_modules/fast-deep-equal/index.js"(exports2, module2) {
10217       "use strict";
10218       module2.exports = function equal(a2, b2) {
10219         if (a2 === b2) return true;
10220         if (a2 && b2 && typeof a2 == "object" && typeof b2 == "object") {
10221           if (a2.constructor !== b2.constructor) return false;
10222           var length2, i3, keys2;
10223           if (Array.isArray(a2)) {
10224             length2 = a2.length;
10225             if (length2 != b2.length) return false;
10226             for (i3 = length2; i3-- !== 0; )
10227               if (!equal(a2[i3], b2[i3])) return false;
10228             return true;
10229           }
10230           if (a2.constructor === RegExp) return a2.source === b2.source && a2.flags === b2.flags;
10231           if (a2.valueOf !== Object.prototype.valueOf) return a2.valueOf() === b2.valueOf();
10232           if (a2.toString !== Object.prototype.toString) return a2.toString() === b2.toString();
10233           keys2 = Object.keys(a2);
10234           length2 = keys2.length;
10235           if (length2 !== Object.keys(b2).length) return false;
10236           for (i3 = length2; i3-- !== 0; )
10237             if (!Object.prototype.hasOwnProperty.call(b2, keys2[i3])) return false;
10238           for (i3 = length2; i3-- !== 0; ) {
10239             var key = keys2[i3];
10240             if (!equal(a2[key], b2[key])) return false;
10241           }
10242           return true;
10243         }
10244         return a2 !== a2 && b2 !== b2;
10245       };
10246     }
10247   });
10248
10249   // node_modules/fast-json-stable-stringify/index.js
10250   var require_fast_json_stable_stringify = __commonJS({
10251     "node_modules/fast-json-stable-stringify/index.js"(exports2, module2) {
10252       "use strict";
10253       module2.exports = function(data, opts) {
10254         if (!opts) opts = {};
10255         if (typeof opts === "function") opts = { cmp: opts };
10256         var cycles = typeof opts.cycles === "boolean" ? opts.cycles : false;
10257         var cmp = opts.cmp && /* @__PURE__ */ function(f2) {
10258           return function(node) {
10259             return function(a2, b2) {
10260               var aobj = { key: a2, value: node[a2] };
10261               var bobj = { key: b2, value: node[b2] };
10262               return f2(aobj, bobj);
10263             };
10264           };
10265         }(opts.cmp);
10266         var seen = [];
10267         return function stringify3(node) {
10268           if (node && node.toJSON && typeof node.toJSON === "function") {
10269             node = node.toJSON();
10270           }
10271           if (node === void 0) return;
10272           if (typeof node == "number") return isFinite(node) ? "" + node : "null";
10273           if (typeof node !== "object") return JSON.stringify(node);
10274           var i3, out;
10275           if (Array.isArray(node)) {
10276             out = "[";
10277             for (i3 = 0; i3 < node.length; i3++) {
10278               if (i3) out += ",";
10279               out += stringify3(node[i3]) || "null";
10280             }
10281             return out + "]";
10282           }
10283           if (node === null) return "null";
10284           if (seen.indexOf(node) !== -1) {
10285             if (cycles) return JSON.stringify("__cycle__");
10286             throw new TypeError("Converting circular structure to JSON");
10287           }
10288           var seenIndex = seen.push(node) - 1;
10289           var keys2 = Object.keys(node).sort(cmp && cmp(node));
10290           out = "";
10291           for (i3 = 0; i3 < keys2.length; i3++) {
10292             var key = keys2[i3];
10293             var value = stringify3(node[key]);
10294             if (!value) continue;
10295             if (out) out += ",";
10296             out += JSON.stringify(key) + ":" + value;
10297           }
10298           seen.splice(seenIndex, 1);
10299           return "{" + out + "}";
10300         }(data);
10301       };
10302     }
10303   });
10304
10305   // node_modules/@mapbox/sexagesimal/index.js
10306   var require_sexagesimal = __commonJS({
10307     "node_modules/@mapbox/sexagesimal/index.js"(exports2, module2) {
10308       module2.exports = element;
10309       module2.exports.pair = pair3;
10310       module2.exports.format = format2;
10311       module2.exports.formatPair = formatPair;
10312       module2.exports.coordToDMS = coordToDMS;
10313       function element(input, dims) {
10314         var result = search(input, dims);
10315         return result === null ? null : result.val;
10316       }
10317       function formatPair(input) {
10318         return format2(input.lat, "lat") + " " + format2(input.lon, "lon");
10319       }
10320       function format2(input, dim) {
10321         var dms = coordToDMS(input, dim);
10322         return dms.whole + "\xB0 " + (dms.minutes ? dms.minutes + "' " : "") + (dms.seconds ? dms.seconds + '" ' : "") + dms.dir;
10323       }
10324       function coordToDMS(input, dim) {
10325         var dirs = { lat: ["N", "S"], lon: ["E", "W"] }[dim] || "";
10326         var dir = dirs[input >= 0 ? 0 : 1];
10327         var abs3 = Math.abs(input);
10328         var whole = Math.floor(abs3);
10329         var fraction = abs3 - whole;
10330         var fractionMinutes = fraction * 60;
10331         var minutes = Math.floor(fractionMinutes);
10332         var seconds = Math.floor((fractionMinutes - minutes) * 60);
10333         return {
10334           whole,
10335           minutes,
10336           seconds,
10337           dir
10338         };
10339       }
10340       function search(input, dims) {
10341         if (!dims) dims = "NSEW";
10342         if (typeof input !== "string") return null;
10343         input = input.toUpperCase();
10344         var regex = /^[\s\,]*([NSEW])?\s*([\-|\—|\―]?[0-9.]+)[°º˚]?\s*(?:([0-9.]+)['’′‘]\s*)?(?:([0-9.]+)(?:''|"|”|″)\s*)?([NSEW])?/;
10345         var m2 = input.match(regex);
10346         if (!m2) return null;
10347         var matched = m2[0];
10348         var dim;
10349         if (m2[1] && m2[5]) {
10350           dim = m2[1];
10351           matched = matched.slice(0, -1);
10352         } else {
10353           dim = m2[1] || m2[5];
10354         }
10355         if (dim && dims.indexOf(dim) === -1) return null;
10356         var deg = m2[2] ? parseFloat(m2[2]) : 0;
10357         var min3 = m2[3] ? parseFloat(m2[3]) / 60 : 0;
10358         var sec = m2[4] ? parseFloat(m2[4]) / 3600 : 0;
10359         var sign2 = deg < 0 ? -1 : 1;
10360         if (dim === "S" || dim === "W") sign2 *= -1;
10361         return {
10362           val: (Math.abs(deg) + min3 + sec) * sign2,
10363           dim,
10364           matched,
10365           remain: input.slice(matched.length)
10366         };
10367       }
10368       function pair3(input, dims) {
10369         input = input.trim();
10370         var one2 = search(input, dims);
10371         if (!one2) return null;
10372         input = one2.remain.trim();
10373         var two = search(input, dims);
10374         if (!two || two.remain) return null;
10375         if (one2.dim) {
10376           return swapdim(one2.val, two.val, one2.dim);
10377         } else {
10378           return [one2.val, two.val];
10379         }
10380       }
10381       function swapdim(a2, b2, dim) {
10382         if (dim === "N" || dim === "S") return [a2, b2];
10383         if (dim === "W" || dim === "E") return [b2, a2];
10384       }
10385     }
10386   });
10387
10388   // node_modules/polygon-clipping/dist/polygon-clipping.umd.js
10389   var require_polygon_clipping_umd = __commonJS({
10390     "node_modules/polygon-clipping/dist/polygon-clipping.umd.js"(exports2, module2) {
10391       (function(global2, factory) {
10392         typeof exports2 === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, global2.polygonClipping = factory());
10393       })(exports2, function() {
10394         "use strict";
10395         function __generator(thisArg, body) {
10396           var _2 = {
10397             label: 0,
10398             sent: function() {
10399               if (t2[0] & 1) throw t2[1];
10400               return t2[1];
10401             },
10402             trys: [],
10403             ops: []
10404           }, f2, y2, t2, g3;
10405           return g3 = {
10406             next: verb(0),
10407             "throw": verb(1),
10408             "return": verb(2)
10409           }, typeof Symbol === "function" && (g3[Symbol.iterator] = function() {
10410             return this;
10411           }), g3;
10412           function verb(n3) {
10413             return function(v2) {
10414               return step([n3, v2]);
10415             };
10416           }
10417           function step(op) {
10418             if (f2) throw new TypeError("Generator is already executing.");
10419             while (_2) try {
10420               if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2;
10421               if (y2 = 0, t2) op = [op[0] & 2, t2.value];
10422               switch (op[0]) {
10423                 case 0:
10424                 case 1:
10425                   t2 = op;
10426                   break;
10427                 case 4:
10428                   _2.label++;
10429                   return {
10430                     value: op[1],
10431                     done: false
10432                   };
10433                 case 5:
10434                   _2.label++;
10435                   y2 = op[1];
10436                   op = [0];
10437                   continue;
10438                 case 7:
10439                   op = _2.ops.pop();
10440                   _2.trys.pop();
10441                   continue;
10442                 default:
10443                   if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) {
10444                     _2 = 0;
10445                     continue;
10446                   }
10447                   if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) {
10448                     _2.label = op[1];
10449                     break;
10450                   }
10451                   if (op[0] === 6 && _2.label < t2[1]) {
10452                     _2.label = t2[1];
10453                     t2 = op;
10454                     break;
10455                   }
10456                   if (t2 && _2.label < t2[2]) {
10457                     _2.label = t2[2];
10458                     _2.ops.push(op);
10459                     break;
10460                   }
10461                   if (t2[2]) _2.ops.pop();
10462                   _2.trys.pop();
10463                   continue;
10464               }
10465               op = body.call(thisArg, _2);
10466             } catch (e3) {
10467               op = [6, e3];
10468               y2 = 0;
10469             } finally {
10470               f2 = t2 = 0;
10471             }
10472             if (op[0] & 5) throw op[1];
10473             return {
10474               value: op[0] ? op[1] : void 0,
10475               done: true
10476             };
10477           }
10478         }
10479         var Node = (
10480           /** @class */
10481           /* @__PURE__ */ function() {
10482             function Node2(key, data) {
10483               this.next = null;
10484               this.key = key;
10485               this.data = data;
10486               this.left = null;
10487               this.right = null;
10488             }
10489             return Node2;
10490           }()
10491         );
10492         function DEFAULT_COMPARE(a2, b2) {
10493           return a2 > b2 ? 1 : a2 < b2 ? -1 : 0;
10494         }
10495         function splay(i3, t2, comparator) {
10496           var N2 = new Node(null, null);
10497           var l2 = N2;
10498           var r2 = N2;
10499           while (true) {
10500             var cmp2 = comparator(i3, t2.key);
10501             if (cmp2 < 0) {
10502               if (t2.left === null) break;
10503               if (comparator(i3, t2.left.key) < 0) {
10504                 var y2 = t2.left;
10505                 t2.left = y2.right;
10506                 y2.right = t2;
10507                 t2 = y2;
10508                 if (t2.left === null) break;
10509               }
10510               r2.left = t2;
10511               r2 = t2;
10512               t2 = t2.left;
10513             } else if (cmp2 > 0) {
10514               if (t2.right === null) break;
10515               if (comparator(i3, t2.right.key) > 0) {
10516                 var y2 = t2.right;
10517                 t2.right = y2.left;
10518                 y2.left = t2;
10519                 t2 = y2;
10520                 if (t2.right === null) break;
10521               }
10522               l2.right = t2;
10523               l2 = t2;
10524               t2 = t2.right;
10525             } else break;
10526           }
10527           l2.right = t2.left;
10528           r2.left = t2.right;
10529           t2.left = N2.right;
10530           t2.right = N2.left;
10531           return t2;
10532         }
10533         function insert(i3, data, t2, comparator) {
10534           var node = new Node(i3, data);
10535           if (t2 === null) {
10536             node.left = node.right = null;
10537             return node;
10538           }
10539           t2 = splay(i3, t2, comparator);
10540           var cmp2 = comparator(i3, t2.key);
10541           if (cmp2 < 0) {
10542             node.left = t2.left;
10543             node.right = t2;
10544             t2.left = null;
10545           } else if (cmp2 >= 0) {
10546             node.right = t2.right;
10547             node.left = t2;
10548             t2.right = null;
10549           }
10550           return node;
10551         }
10552         function split(key, v2, comparator) {
10553           var left = null;
10554           var right = null;
10555           if (v2) {
10556             v2 = splay(key, v2, comparator);
10557             var cmp2 = comparator(v2.key, key);
10558             if (cmp2 === 0) {
10559               left = v2.left;
10560               right = v2.right;
10561             } else if (cmp2 < 0) {
10562               right = v2.right;
10563               v2.right = null;
10564               left = v2;
10565             } else {
10566               left = v2.left;
10567               v2.left = null;
10568               right = v2;
10569             }
10570           }
10571           return {
10572             left,
10573             right
10574           };
10575         }
10576         function merge2(left, right, comparator) {
10577           if (right === null) return left;
10578           if (left === null) return right;
10579           right = splay(left.key, right, comparator);
10580           right.left = left;
10581           return right;
10582         }
10583         function printRow(root3, prefix, isTail, out, printNode) {
10584           if (root3) {
10585             out("" + prefix + (isTail ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ") + printNode(root3) + "\n");
10586             var indent = prefix + (isTail ? "    " : "\u2502   ");
10587             if (root3.left) printRow(root3.left, indent, false, out, printNode);
10588             if (root3.right) printRow(root3.right, indent, true, out, printNode);
10589           }
10590         }
10591         var Tree = (
10592           /** @class */
10593           function() {
10594             function Tree2(comparator) {
10595               if (comparator === void 0) {
10596                 comparator = DEFAULT_COMPARE;
10597               }
10598               this._root = null;
10599               this._size = 0;
10600               this._comparator = comparator;
10601             }
10602             Tree2.prototype.insert = function(key, data) {
10603               this._size++;
10604               return this._root = insert(key, data, this._root, this._comparator);
10605             };
10606             Tree2.prototype.add = function(key, data) {
10607               var node = new Node(key, data);
10608               if (this._root === null) {
10609                 node.left = node.right = null;
10610                 this._size++;
10611                 this._root = node;
10612               }
10613               var comparator = this._comparator;
10614               var t2 = splay(key, this._root, comparator);
10615               var cmp2 = comparator(key, t2.key);
10616               if (cmp2 === 0) this._root = t2;
10617               else {
10618                 if (cmp2 < 0) {
10619                   node.left = t2.left;
10620                   node.right = t2;
10621                   t2.left = null;
10622                 } else if (cmp2 > 0) {
10623                   node.right = t2.right;
10624                   node.left = t2;
10625                   t2.right = null;
10626                 }
10627                 this._size++;
10628                 this._root = node;
10629               }
10630               return this._root;
10631             };
10632             Tree2.prototype.remove = function(key) {
10633               this._root = this._remove(key, this._root, this._comparator);
10634             };
10635             Tree2.prototype._remove = function(i3, t2, comparator) {
10636               var x2;
10637               if (t2 === null) return null;
10638               t2 = splay(i3, t2, comparator);
10639               var cmp2 = comparator(i3, t2.key);
10640               if (cmp2 === 0) {
10641                 if (t2.left === null) {
10642                   x2 = t2.right;
10643                 } else {
10644                   x2 = splay(i3, t2.left, comparator);
10645                   x2.right = t2.right;
10646                 }
10647                 this._size--;
10648                 return x2;
10649               }
10650               return t2;
10651             };
10652             Tree2.prototype.pop = function() {
10653               var node = this._root;
10654               if (node) {
10655                 while (node.left) node = node.left;
10656                 this._root = splay(node.key, this._root, this._comparator);
10657                 this._root = this._remove(node.key, this._root, this._comparator);
10658                 return {
10659                   key: node.key,
10660                   data: node.data
10661                 };
10662               }
10663               return null;
10664             };
10665             Tree2.prototype.findStatic = function(key) {
10666               var current = this._root;
10667               var compare2 = this._comparator;
10668               while (current) {
10669                 var cmp2 = compare2(key, current.key);
10670                 if (cmp2 === 0) return current;
10671                 else if (cmp2 < 0) current = current.left;
10672                 else current = current.right;
10673               }
10674               return null;
10675             };
10676             Tree2.prototype.find = function(key) {
10677               if (this._root) {
10678                 this._root = splay(key, this._root, this._comparator);
10679                 if (this._comparator(key, this._root.key) !== 0) return null;
10680               }
10681               return this._root;
10682             };
10683             Tree2.prototype.contains = function(key) {
10684               var current = this._root;
10685               var compare2 = this._comparator;
10686               while (current) {
10687                 var cmp2 = compare2(key, current.key);
10688                 if (cmp2 === 0) return true;
10689                 else if (cmp2 < 0) current = current.left;
10690                 else current = current.right;
10691               }
10692               return false;
10693             };
10694             Tree2.prototype.forEach = function(visitor, ctx) {
10695               var current = this._root;
10696               var Q2 = [];
10697               var done = false;
10698               while (!done) {
10699                 if (current !== null) {
10700                   Q2.push(current);
10701                   current = current.left;
10702                 } else {
10703                   if (Q2.length !== 0) {
10704                     current = Q2.pop();
10705                     visitor.call(ctx, current);
10706                     current = current.right;
10707                   } else done = true;
10708                 }
10709               }
10710               return this;
10711             };
10712             Tree2.prototype.range = function(low, high, fn, ctx) {
10713               var Q2 = [];
10714               var compare2 = this._comparator;
10715               var node = this._root;
10716               var cmp2;
10717               while (Q2.length !== 0 || node) {
10718                 if (node) {
10719                   Q2.push(node);
10720                   node = node.left;
10721                 } else {
10722                   node = Q2.pop();
10723                   cmp2 = compare2(node.key, high);
10724                   if (cmp2 > 0) {
10725                     break;
10726                   } else if (compare2(node.key, low) >= 0) {
10727                     if (fn.call(ctx, node)) return this;
10728                   }
10729                   node = node.right;
10730                 }
10731               }
10732               return this;
10733             };
10734             Tree2.prototype.keys = function() {
10735               var keys2 = [];
10736               this.forEach(function(_a3) {
10737                 var key = _a3.key;
10738                 return keys2.push(key);
10739               });
10740               return keys2;
10741             };
10742             Tree2.prototype.values = function() {
10743               var values = [];
10744               this.forEach(function(_a3) {
10745                 var data = _a3.data;
10746                 return values.push(data);
10747               });
10748               return values;
10749             };
10750             Tree2.prototype.min = function() {
10751               if (this._root) return this.minNode(this._root).key;
10752               return null;
10753             };
10754             Tree2.prototype.max = function() {
10755               if (this._root) return this.maxNode(this._root).key;
10756               return null;
10757             };
10758             Tree2.prototype.minNode = function(t2) {
10759               if (t2 === void 0) {
10760                 t2 = this._root;
10761               }
10762               if (t2) while (t2.left) t2 = t2.left;
10763               return t2;
10764             };
10765             Tree2.prototype.maxNode = function(t2) {
10766               if (t2 === void 0) {
10767                 t2 = this._root;
10768               }
10769               if (t2) while (t2.right) t2 = t2.right;
10770               return t2;
10771             };
10772             Tree2.prototype.at = function(index2) {
10773               var current = this._root;
10774               var done = false;
10775               var i3 = 0;
10776               var Q2 = [];
10777               while (!done) {
10778                 if (current) {
10779                   Q2.push(current);
10780                   current = current.left;
10781                 } else {
10782                   if (Q2.length > 0) {
10783                     current = Q2.pop();
10784                     if (i3 === index2) return current;
10785                     i3++;
10786                     current = current.right;
10787                   } else done = true;
10788                 }
10789               }
10790               return null;
10791             };
10792             Tree2.prototype.next = function(d2) {
10793               var root3 = this._root;
10794               var successor = null;
10795               if (d2.right) {
10796                 successor = d2.right;
10797                 while (successor.left) successor = successor.left;
10798                 return successor;
10799               }
10800               var comparator = this._comparator;
10801               while (root3) {
10802                 var cmp2 = comparator(d2.key, root3.key);
10803                 if (cmp2 === 0) break;
10804                 else if (cmp2 < 0) {
10805                   successor = root3;
10806                   root3 = root3.left;
10807                 } else root3 = root3.right;
10808               }
10809               return successor;
10810             };
10811             Tree2.prototype.prev = function(d2) {
10812               var root3 = this._root;
10813               var predecessor = null;
10814               if (d2.left !== null) {
10815                 predecessor = d2.left;
10816                 while (predecessor.right) predecessor = predecessor.right;
10817                 return predecessor;
10818               }
10819               var comparator = this._comparator;
10820               while (root3) {
10821                 var cmp2 = comparator(d2.key, root3.key);
10822                 if (cmp2 === 0) break;
10823                 else if (cmp2 < 0) root3 = root3.left;
10824                 else {
10825                   predecessor = root3;
10826                   root3 = root3.right;
10827                 }
10828               }
10829               return predecessor;
10830             };
10831             Tree2.prototype.clear = function() {
10832               this._root = null;
10833               this._size = 0;
10834               return this;
10835             };
10836             Tree2.prototype.toList = function() {
10837               return toList(this._root);
10838             };
10839             Tree2.prototype.load = function(keys2, values, presort) {
10840               if (values === void 0) {
10841                 values = [];
10842               }
10843               if (presort === void 0) {
10844                 presort = false;
10845               }
10846               var size = keys2.length;
10847               var comparator = this._comparator;
10848               if (presort) sort(keys2, values, 0, size - 1, comparator);
10849               if (this._root === null) {
10850                 this._root = loadRecursive(keys2, values, 0, size);
10851                 this._size = size;
10852               } else {
10853                 var mergedList = mergeLists(this.toList(), createList(keys2, values), comparator);
10854                 size = this._size + size;
10855                 this._root = sortedListToBST({
10856                   head: mergedList
10857                 }, 0, size);
10858               }
10859               return this;
10860             };
10861             Tree2.prototype.isEmpty = function() {
10862               return this._root === null;
10863             };
10864             Object.defineProperty(Tree2.prototype, "size", {
10865               get: function() {
10866                 return this._size;
10867               },
10868               enumerable: true,
10869               configurable: true
10870             });
10871             Object.defineProperty(Tree2.prototype, "root", {
10872               get: function() {
10873                 return this._root;
10874               },
10875               enumerable: true,
10876               configurable: true
10877             });
10878             Tree2.prototype.toString = function(printNode) {
10879               if (printNode === void 0) {
10880                 printNode = function(n3) {
10881                   return String(n3.key);
10882                 };
10883               }
10884               var out = [];
10885               printRow(this._root, "", true, function(v2) {
10886                 return out.push(v2);
10887               }, printNode);
10888               return out.join("");
10889             };
10890             Tree2.prototype.update = function(key, newKey, newData) {
10891               var comparator = this._comparator;
10892               var _a3 = split(key, this._root, comparator), left = _a3.left, right = _a3.right;
10893               if (comparator(key, newKey) < 0) {
10894                 right = insert(newKey, newData, right, comparator);
10895               } else {
10896                 left = insert(newKey, newData, left, comparator);
10897               }
10898               this._root = merge2(left, right, comparator);
10899             };
10900             Tree2.prototype.split = function(key) {
10901               return split(key, this._root, this._comparator);
10902             };
10903             Tree2.prototype[Symbol.iterator] = function() {
10904               var current, Q2, done;
10905               return __generator(this, function(_a3) {
10906                 switch (_a3.label) {
10907                   case 0:
10908                     current = this._root;
10909                     Q2 = [];
10910                     done = false;
10911                     _a3.label = 1;
10912                   case 1:
10913                     if (!!done) return [3, 6];
10914                     if (!(current !== null)) return [3, 2];
10915                     Q2.push(current);
10916                     current = current.left;
10917                     return [3, 5];
10918                   case 2:
10919                     if (!(Q2.length !== 0)) return [3, 4];
10920                     current = Q2.pop();
10921                     return [4, current];
10922                   case 3:
10923                     _a3.sent();
10924                     current = current.right;
10925                     return [3, 5];
10926                   case 4:
10927                     done = true;
10928                     _a3.label = 5;
10929                   case 5:
10930                     return [3, 1];
10931                   case 6:
10932                     return [
10933                       2
10934                       /*return*/
10935                     ];
10936                 }
10937               });
10938             };
10939             return Tree2;
10940           }()
10941         );
10942         function loadRecursive(keys2, values, start2, end) {
10943           var size = end - start2;
10944           if (size > 0) {
10945             var middle = start2 + Math.floor(size / 2);
10946             var key = keys2[middle];
10947             var data = values[middle];
10948             var node = new Node(key, data);
10949             node.left = loadRecursive(keys2, values, start2, middle);
10950             node.right = loadRecursive(keys2, values, middle + 1, end);
10951             return node;
10952           }
10953           return null;
10954         }
10955         function createList(keys2, values) {
10956           var head = new Node(null, null);
10957           var p2 = head;
10958           for (var i3 = 0; i3 < keys2.length; i3++) {
10959             p2 = p2.next = new Node(keys2[i3], values[i3]);
10960           }
10961           p2.next = null;
10962           return head.next;
10963         }
10964         function toList(root3) {
10965           var current = root3;
10966           var Q2 = [];
10967           var done = false;
10968           var head = new Node(null, null);
10969           var p2 = head;
10970           while (!done) {
10971             if (current) {
10972               Q2.push(current);
10973               current = current.left;
10974             } else {
10975               if (Q2.length > 0) {
10976                 current = p2 = p2.next = Q2.pop();
10977                 current = current.right;
10978               } else done = true;
10979             }
10980           }
10981           p2.next = null;
10982           return head.next;
10983         }
10984         function sortedListToBST(list2, start2, end) {
10985           var size = end - start2;
10986           if (size > 0) {
10987             var middle = start2 + Math.floor(size / 2);
10988             var left = sortedListToBST(list2, start2, middle);
10989             var root3 = list2.head;
10990             root3.left = left;
10991             list2.head = list2.head.next;
10992             root3.right = sortedListToBST(list2, middle + 1, end);
10993             return root3;
10994           }
10995           return null;
10996         }
10997         function mergeLists(l1, l2, compare2) {
10998           var head = new Node(null, null);
10999           var p2 = head;
11000           var p1 = l1;
11001           var p22 = l2;
11002           while (p1 !== null && p22 !== null) {
11003             if (compare2(p1.key, p22.key) < 0) {
11004               p2.next = p1;
11005               p1 = p1.next;
11006             } else {
11007               p2.next = p22;
11008               p22 = p22.next;
11009             }
11010             p2 = p2.next;
11011           }
11012           if (p1 !== null) {
11013             p2.next = p1;
11014           } else if (p22 !== null) {
11015             p2.next = p22;
11016           }
11017           return head.next;
11018         }
11019         function sort(keys2, values, left, right, compare2) {
11020           if (left >= right) return;
11021           var pivot = keys2[left + right >> 1];
11022           var i3 = left - 1;
11023           var j2 = right + 1;
11024           while (true) {
11025             do
11026               i3++;
11027             while (compare2(keys2[i3], pivot) < 0);
11028             do
11029               j2--;
11030             while (compare2(keys2[j2], pivot) > 0);
11031             if (i3 >= j2) break;
11032             var tmp = keys2[i3];
11033             keys2[i3] = keys2[j2];
11034             keys2[j2] = tmp;
11035             tmp = values[i3];
11036             values[i3] = values[j2];
11037             values[j2] = tmp;
11038           }
11039           sort(keys2, values, left, j2, compare2);
11040           sort(keys2, values, j2 + 1, right, compare2);
11041         }
11042         const isInBbox2 = (bbox2, point) => {
11043           return bbox2.ll.x <= point.x && point.x <= bbox2.ur.x && bbox2.ll.y <= point.y && point.y <= bbox2.ur.y;
11044         };
11045         const getBboxOverlap2 = (b1, b2) => {
11046           if (b2.ur.x < b1.ll.x || b1.ur.x < b2.ll.x || b2.ur.y < b1.ll.y || b1.ur.y < b2.ll.y) return null;
11047           const lowerX = b1.ll.x < b2.ll.x ? b2.ll.x : b1.ll.x;
11048           const upperX = b1.ur.x < b2.ur.x ? b1.ur.x : b2.ur.x;
11049           const lowerY = b1.ll.y < b2.ll.y ? b2.ll.y : b1.ll.y;
11050           const upperY = b1.ur.y < b2.ur.y ? b1.ur.y : b2.ur.y;
11051           return {
11052             ll: {
11053               x: lowerX,
11054               y: lowerY
11055             },
11056             ur: {
11057               x: upperX,
11058               y: upperY
11059             }
11060           };
11061         };
11062         let epsilon$1 = Number.EPSILON;
11063         if (epsilon$1 === void 0) epsilon$1 = Math.pow(2, -52);
11064         const EPSILON_SQ = epsilon$1 * epsilon$1;
11065         const cmp = (a2, b2) => {
11066           if (-epsilon$1 < a2 && a2 < epsilon$1) {
11067             if (-epsilon$1 < b2 && b2 < epsilon$1) {
11068               return 0;
11069             }
11070           }
11071           const ab = a2 - b2;
11072           if (ab * ab < EPSILON_SQ * a2 * b2) {
11073             return 0;
11074           }
11075           return a2 < b2 ? -1 : 1;
11076         };
11077         class PtRounder {
11078           constructor() {
11079             this.reset();
11080           }
11081           reset() {
11082             this.xRounder = new CoordRounder();
11083             this.yRounder = new CoordRounder();
11084           }
11085           round(x2, y2) {
11086             return {
11087               x: this.xRounder.round(x2),
11088               y: this.yRounder.round(y2)
11089             };
11090           }
11091         }
11092         class CoordRounder {
11093           constructor() {
11094             this.tree = new Tree();
11095             this.round(0);
11096           }
11097           // Note: this can rounds input values backwards or forwards.
11098           //       You might ask, why not restrict this to just rounding
11099           //       forwards? Wouldn't that allow left endpoints to always
11100           //       remain left endpoints during splitting (never change to
11101           //       right). No - it wouldn't, because we snap intersections
11102           //       to endpoints (to establish independence from the segment
11103           //       angle for t-intersections).
11104           round(coord2) {
11105             const node = this.tree.add(coord2);
11106             const prevNode = this.tree.prev(node);
11107             if (prevNode !== null && cmp(node.key, prevNode.key) === 0) {
11108               this.tree.remove(coord2);
11109               return prevNode.key;
11110             }
11111             const nextNode = this.tree.next(node);
11112             if (nextNode !== null && cmp(node.key, nextNode.key) === 0) {
11113               this.tree.remove(coord2);
11114               return nextNode.key;
11115             }
11116             return coord2;
11117           }
11118         }
11119         const rounder = new PtRounder();
11120         const epsilon3 = 11102230246251565e-32;
11121         const splitter = 134217729;
11122         const resulterrbound = (3 + 8 * epsilon3) * epsilon3;
11123         function sum(elen, e3, flen, f2, h2) {
11124           let Q2, Qnew, hh, bvirt;
11125           let enow = e3[0];
11126           let fnow = f2[0];
11127           let eindex = 0;
11128           let findex = 0;
11129           if (fnow > enow === fnow > -enow) {
11130             Q2 = enow;
11131             enow = e3[++eindex];
11132           } else {
11133             Q2 = fnow;
11134             fnow = f2[++findex];
11135           }
11136           let hindex = 0;
11137           if (eindex < elen && findex < flen) {
11138             if (fnow > enow === fnow > -enow) {
11139               Qnew = enow + Q2;
11140               hh = Q2 - (Qnew - enow);
11141               enow = e3[++eindex];
11142             } else {
11143               Qnew = fnow + Q2;
11144               hh = Q2 - (Qnew - fnow);
11145               fnow = f2[++findex];
11146             }
11147             Q2 = Qnew;
11148             if (hh !== 0) {
11149               h2[hindex++] = hh;
11150             }
11151             while (eindex < elen && findex < flen) {
11152               if (fnow > enow === fnow > -enow) {
11153                 Qnew = Q2 + enow;
11154                 bvirt = Qnew - Q2;
11155                 hh = Q2 - (Qnew - bvirt) + (enow - bvirt);
11156                 enow = e3[++eindex];
11157               } else {
11158                 Qnew = Q2 + fnow;
11159                 bvirt = Qnew - Q2;
11160                 hh = Q2 - (Qnew - bvirt) + (fnow - bvirt);
11161                 fnow = f2[++findex];
11162               }
11163               Q2 = Qnew;
11164               if (hh !== 0) {
11165                 h2[hindex++] = hh;
11166               }
11167             }
11168           }
11169           while (eindex < elen) {
11170             Qnew = Q2 + enow;
11171             bvirt = Qnew - Q2;
11172             hh = Q2 - (Qnew - bvirt) + (enow - bvirt);
11173             enow = e3[++eindex];
11174             Q2 = Qnew;
11175             if (hh !== 0) {
11176               h2[hindex++] = hh;
11177             }
11178           }
11179           while (findex < flen) {
11180             Qnew = Q2 + fnow;
11181             bvirt = Qnew - Q2;
11182             hh = Q2 - (Qnew - bvirt) + (fnow - bvirt);
11183             fnow = f2[++findex];
11184             Q2 = Qnew;
11185             if (hh !== 0) {
11186               h2[hindex++] = hh;
11187             }
11188           }
11189           if (Q2 !== 0 || hindex === 0) {
11190             h2[hindex++] = Q2;
11191           }
11192           return hindex;
11193         }
11194         function estimate(elen, e3) {
11195           let Q2 = e3[0];
11196           for (let i3 = 1; i3 < elen; i3++) Q2 += e3[i3];
11197           return Q2;
11198         }
11199         function vec(n3) {
11200           return new Float64Array(n3);
11201         }
11202         const ccwerrboundA = (3 + 16 * epsilon3) * epsilon3;
11203         const ccwerrboundB = (2 + 12 * epsilon3) * epsilon3;
11204         const ccwerrboundC = (9 + 64 * epsilon3) * epsilon3 * epsilon3;
11205         const B2 = vec(4);
11206         const C1 = vec(8);
11207         const C2 = vec(12);
11208         const D2 = vec(16);
11209         const u2 = vec(4);
11210         function orient2dadapt(ax, ay, bx, by, cx, cy, detsum) {
11211           let acxtail, acytail, bcxtail, bcytail;
11212           let bvirt, c2, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3;
11213           const acx = ax - cx;
11214           const bcx = bx - cx;
11215           const acy = ay - cy;
11216           const bcy = by - cy;
11217           s1 = acx * bcy;
11218           c2 = splitter * acx;
11219           ahi = c2 - (c2 - acx);
11220           alo = acx - ahi;
11221           c2 = splitter * bcy;
11222           bhi = c2 - (c2 - bcy);
11223           blo = bcy - bhi;
11224           s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
11225           t1 = acy * bcx;
11226           c2 = splitter * acy;
11227           ahi = c2 - (c2 - acy);
11228           alo = acy - ahi;
11229           c2 = splitter * bcx;
11230           bhi = c2 - (c2 - bcx);
11231           blo = bcx - bhi;
11232           t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
11233           _i = s0 - t0;
11234           bvirt = s0 - _i;
11235           B2[0] = s0 - (_i + bvirt) + (bvirt - t0);
11236           _j = s1 + _i;
11237           bvirt = _j - s1;
11238           _0 = s1 - (_j - bvirt) + (_i - bvirt);
11239           _i = _0 - t1;
11240           bvirt = _0 - _i;
11241           B2[1] = _0 - (_i + bvirt) + (bvirt - t1);
11242           u3 = _j + _i;
11243           bvirt = u3 - _j;
11244           B2[2] = _j - (u3 - bvirt) + (_i - bvirt);
11245           B2[3] = u3;
11246           let det = estimate(4, B2);
11247           let errbound = ccwerrboundB * detsum;
11248           if (det >= errbound || -det >= errbound) {
11249             return det;
11250           }
11251           bvirt = ax - acx;
11252           acxtail = ax - (acx + bvirt) + (bvirt - cx);
11253           bvirt = bx - bcx;
11254           bcxtail = bx - (bcx + bvirt) + (bvirt - cx);
11255           bvirt = ay - acy;
11256           acytail = ay - (acy + bvirt) + (bvirt - cy);
11257           bvirt = by - bcy;
11258           bcytail = by - (bcy + bvirt) + (bvirt - cy);
11259           if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) {
11260             return det;
11261           }
11262           errbound = ccwerrboundC * detsum + resulterrbound * Math.abs(det);
11263           det += acx * bcytail + bcy * acxtail - (acy * bcxtail + bcx * acytail);
11264           if (det >= errbound || -det >= errbound) return det;
11265           s1 = acxtail * bcy;
11266           c2 = splitter * acxtail;
11267           ahi = c2 - (c2 - acxtail);
11268           alo = acxtail - ahi;
11269           c2 = splitter * bcy;
11270           bhi = c2 - (c2 - bcy);
11271           blo = bcy - bhi;
11272           s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
11273           t1 = acytail * bcx;
11274           c2 = splitter * acytail;
11275           ahi = c2 - (c2 - acytail);
11276           alo = acytail - ahi;
11277           c2 = splitter * bcx;
11278           bhi = c2 - (c2 - bcx);
11279           blo = bcx - bhi;
11280           t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
11281           _i = s0 - t0;
11282           bvirt = s0 - _i;
11283           u2[0] = s0 - (_i + bvirt) + (bvirt - t0);
11284           _j = s1 + _i;
11285           bvirt = _j - s1;
11286           _0 = s1 - (_j - bvirt) + (_i - bvirt);
11287           _i = _0 - t1;
11288           bvirt = _0 - _i;
11289           u2[1] = _0 - (_i + bvirt) + (bvirt - t1);
11290           u3 = _j + _i;
11291           bvirt = u3 - _j;
11292           u2[2] = _j - (u3 - bvirt) + (_i - bvirt);
11293           u2[3] = u3;
11294           const C1len = sum(4, B2, 4, u2, C1);
11295           s1 = acx * bcytail;
11296           c2 = splitter * acx;
11297           ahi = c2 - (c2 - acx);
11298           alo = acx - ahi;
11299           c2 = splitter * bcytail;
11300           bhi = c2 - (c2 - bcytail);
11301           blo = bcytail - bhi;
11302           s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
11303           t1 = acy * bcxtail;
11304           c2 = splitter * acy;
11305           ahi = c2 - (c2 - acy);
11306           alo = acy - ahi;
11307           c2 = splitter * bcxtail;
11308           bhi = c2 - (c2 - bcxtail);
11309           blo = bcxtail - bhi;
11310           t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
11311           _i = s0 - t0;
11312           bvirt = s0 - _i;
11313           u2[0] = s0 - (_i + bvirt) + (bvirt - t0);
11314           _j = s1 + _i;
11315           bvirt = _j - s1;
11316           _0 = s1 - (_j - bvirt) + (_i - bvirt);
11317           _i = _0 - t1;
11318           bvirt = _0 - _i;
11319           u2[1] = _0 - (_i + bvirt) + (bvirt - t1);
11320           u3 = _j + _i;
11321           bvirt = u3 - _j;
11322           u2[2] = _j - (u3 - bvirt) + (_i - bvirt);
11323           u2[3] = u3;
11324           const C2len = sum(C1len, C1, 4, u2, C2);
11325           s1 = acxtail * bcytail;
11326           c2 = splitter * acxtail;
11327           ahi = c2 - (c2 - acxtail);
11328           alo = acxtail - ahi;
11329           c2 = splitter * bcytail;
11330           bhi = c2 - (c2 - bcytail);
11331           blo = bcytail - bhi;
11332           s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
11333           t1 = acytail * bcxtail;
11334           c2 = splitter * acytail;
11335           ahi = c2 - (c2 - acytail);
11336           alo = acytail - ahi;
11337           c2 = splitter * bcxtail;
11338           bhi = c2 - (c2 - bcxtail);
11339           blo = bcxtail - bhi;
11340           t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
11341           _i = s0 - t0;
11342           bvirt = s0 - _i;
11343           u2[0] = s0 - (_i + bvirt) + (bvirt - t0);
11344           _j = s1 + _i;
11345           bvirt = _j - s1;
11346           _0 = s1 - (_j - bvirt) + (_i - bvirt);
11347           _i = _0 - t1;
11348           bvirt = _0 - _i;
11349           u2[1] = _0 - (_i + bvirt) + (bvirt - t1);
11350           u3 = _j + _i;
11351           bvirt = u3 - _j;
11352           u2[2] = _j - (u3 - bvirt) + (_i - bvirt);
11353           u2[3] = u3;
11354           const Dlen = sum(C2len, C2, 4, u2, D2);
11355           return D2[Dlen - 1];
11356         }
11357         function orient2d(ax, ay, bx, by, cx, cy) {
11358           const detleft = (ay - cy) * (bx - cx);
11359           const detright = (ax - cx) * (by - cy);
11360           const det = detleft - detright;
11361           const detsum = Math.abs(detleft + detright);
11362           if (Math.abs(det) >= ccwerrboundA * detsum) return det;
11363           return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum);
11364         }
11365         const crossProduct2 = (a2, b2) => a2.x * b2.y - a2.y * b2.x;
11366         const dotProduct2 = (a2, b2) => a2.x * b2.x + a2.y * b2.y;
11367         const compareVectorAngles = (basePt, endPt1, endPt2) => {
11368           const res = orient2d(basePt.x, basePt.y, endPt1.x, endPt1.y, endPt2.x, endPt2.y);
11369           if (res > 0) return -1;
11370           if (res < 0) return 1;
11371           return 0;
11372         };
11373         const length2 = (v2) => Math.sqrt(dotProduct2(v2, v2));
11374         const sineOfAngle2 = (pShared, pBase, pAngle) => {
11375           const vBase = {
11376             x: pBase.x - pShared.x,
11377             y: pBase.y - pShared.y
11378           };
11379           const vAngle = {
11380             x: pAngle.x - pShared.x,
11381             y: pAngle.y - pShared.y
11382           };
11383           return crossProduct2(vAngle, vBase) / length2(vAngle) / length2(vBase);
11384         };
11385         const cosineOfAngle2 = (pShared, pBase, pAngle) => {
11386           const vBase = {
11387             x: pBase.x - pShared.x,
11388             y: pBase.y - pShared.y
11389           };
11390           const vAngle = {
11391             x: pAngle.x - pShared.x,
11392             y: pAngle.y - pShared.y
11393           };
11394           return dotProduct2(vAngle, vBase) / length2(vAngle) / length2(vBase);
11395         };
11396         const horizontalIntersection2 = (pt2, v2, y2) => {
11397           if (v2.y === 0) return null;
11398           return {
11399             x: pt2.x + v2.x / v2.y * (y2 - pt2.y),
11400             y: y2
11401           };
11402         };
11403         const verticalIntersection2 = (pt2, v2, x2) => {
11404           if (v2.x === 0) return null;
11405           return {
11406             x: x2,
11407             y: pt2.y + v2.y / v2.x * (x2 - pt2.x)
11408           };
11409         };
11410         const intersection$1 = (pt1, v1, pt2, v2) => {
11411           if (v1.x === 0) return verticalIntersection2(pt2, v2, pt1.x);
11412           if (v2.x === 0) return verticalIntersection2(pt1, v1, pt2.x);
11413           if (v1.y === 0) return horizontalIntersection2(pt2, v2, pt1.y);
11414           if (v2.y === 0) return horizontalIntersection2(pt1, v1, pt2.y);
11415           const kross = crossProduct2(v1, v2);
11416           if (kross == 0) return null;
11417           const ve2 = {
11418             x: pt2.x - pt1.x,
11419             y: pt2.y - pt1.y
11420           };
11421           const d1 = crossProduct2(ve2, v1) / kross;
11422           const d2 = crossProduct2(ve2, v2) / kross;
11423           const x12 = pt1.x + d2 * v1.x, x2 = pt2.x + d1 * v2.x;
11424           const y12 = pt1.y + d2 * v1.y, y2 = pt2.y + d1 * v2.y;
11425           const x3 = (x12 + x2) / 2;
11426           const y3 = (y12 + y2) / 2;
11427           return {
11428             x: x3,
11429             y: y3
11430           };
11431         };
11432         class SweepEvent2 {
11433           // for ordering sweep events in the sweep event queue
11434           static compare(a2, b2) {
11435             const ptCmp = SweepEvent2.comparePoints(a2.point, b2.point);
11436             if (ptCmp !== 0) return ptCmp;
11437             if (a2.point !== b2.point) a2.link(b2);
11438             if (a2.isLeft !== b2.isLeft) return a2.isLeft ? 1 : -1;
11439             return Segment2.compare(a2.segment, b2.segment);
11440           }
11441           // for ordering points in sweep line order
11442           static comparePoints(aPt, bPt) {
11443             if (aPt.x < bPt.x) return -1;
11444             if (aPt.x > bPt.x) return 1;
11445             if (aPt.y < bPt.y) return -1;
11446             if (aPt.y > bPt.y) return 1;
11447             return 0;
11448           }
11449           // Warning: 'point' input will be modified and re-used (for performance)
11450           constructor(point, isLeft) {
11451             if (point.events === void 0) point.events = [this];
11452             else point.events.push(this);
11453             this.point = point;
11454             this.isLeft = isLeft;
11455           }
11456           link(other) {
11457             if (other.point === this.point) {
11458               throw new Error("Tried to link already linked events");
11459             }
11460             const otherEvents = other.point.events;
11461             for (let i3 = 0, iMax = otherEvents.length; i3 < iMax; i3++) {
11462               const evt = otherEvents[i3];
11463               this.point.events.push(evt);
11464               evt.point = this.point;
11465             }
11466             this.checkForConsuming();
11467           }
11468           /* Do a pass over our linked events and check to see if any pair
11469            * of segments match, and should be consumed. */
11470           checkForConsuming() {
11471             const numEvents = this.point.events.length;
11472             for (let i3 = 0; i3 < numEvents; i3++) {
11473               const evt1 = this.point.events[i3];
11474               if (evt1.segment.consumedBy !== void 0) continue;
11475               for (let j2 = i3 + 1; j2 < numEvents; j2++) {
11476                 const evt2 = this.point.events[j2];
11477                 if (evt2.consumedBy !== void 0) continue;
11478                 if (evt1.otherSE.point.events !== evt2.otherSE.point.events) continue;
11479                 evt1.segment.consume(evt2.segment);
11480               }
11481             }
11482           }
11483           getAvailableLinkedEvents() {
11484             const events = [];
11485             for (let i3 = 0, iMax = this.point.events.length; i3 < iMax; i3++) {
11486               const evt = this.point.events[i3];
11487               if (evt !== this && !evt.segment.ringOut && evt.segment.isInResult()) {
11488                 events.push(evt);
11489               }
11490             }
11491             return events;
11492           }
11493           /**
11494            * Returns a comparator function for sorting linked events that will
11495            * favor the event that will give us the smallest left-side angle.
11496            * All ring construction starts as low as possible heading to the right,
11497            * so by always turning left as sharp as possible we'll get polygons
11498            * without uncessary loops & holes.
11499            *
11500            * The comparator function has a compute cache such that it avoids
11501            * re-computing already-computed values.
11502            */
11503           getLeftmostComparator(baseEvent) {
11504             const cache = /* @__PURE__ */ new Map();
11505             const fillCache = (linkedEvent) => {
11506               const nextEvent = linkedEvent.otherSE;
11507               cache.set(linkedEvent, {
11508                 sine: sineOfAngle2(this.point, baseEvent.point, nextEvent.point),
11509                 cosine: cosineOfAngle2(this.point, baseEvent.point, nextEvent.point)
11510               });
11511             };
11512             return (a2, b2) => {
11513               if (!cache.has(a2)) fillCache(a2);
11514               if (!cache.has(b2)) fillCache(b2);
11515               const {
11516                 sine: asine,
11517                 cosine: acosine
11518               } = cache.get(a2);
11519               const {
11520                 sine: bsine,
11521                 cosine: bcosine
11522               } = cache.get(b2);
11523               if (asine >= 0 && bsine >= 0) {
11524                 if (acosine < bcosine) return 1;
11525                 if (acosine > bcosine) return -1;
11526                 return 0;
11527               }
11528               if (asine < 0 && bsine < 0) {
11529                 if (acosine < bcosine) return -1;
11530                 if (acosine > bcosine) return 1;
11531                 return 0;
11532               }
11533               if (bsine < asine) return -1;
11534               if (bsine > asine) return 1;
11535               return 0;
11536             };
11537           }
11538         }
11539         let segmentId2 = 0;
11540         class Segment2 {
11541           /* This compare() function is for ordering segments in the sweep
11542            * line tree, and does so according to the following criteria:
11543            *
11544            * Consider the vertical line that lies an infinestimal step to the
11545            * right of the right-more of the two left endpoints of the input
11546            * segments. Imagine slowly moving a point up from negative infinity
11547            * in the increasing y direction. Which of the two segments will that
11548            * point intersect first? That segment comes 'before' the other one.
11549            *
11550            * If neither segment would be intersected by such a line, (if one
11551            * or more of the segments are vertical) then the line to be considered
11552            * is directly on the right-more of the two left inputs.
11553            */
11554           static compare(a2, b2) {
11555             const alx = a2.leftSE.point.x;
11556             const blx = b2.leftSE.point.x;
11557             const arx = a2.rightSE.point.x;
11558             const brx = b2.rightSE.point.x;
11559             if (brx < alx) return 1;
11560             if (arx < blx) return -1;
11561             const aly = a2.leftSE.point.y;
11562             const bly = b2.leftSE.point.y;
11563             const ary = a2.rightSE.point.y;
11564             const bry = b2.rightSE.point.y;
11565             if (alx < blx) {
11566               if (bly < aly && bly < ary) return 1;
11567               if (bly > aly && bly > ary) return -1;
11568               const aCmpBLeft = a2.comparePoint(b2.leftSE.point);
11569               if (aCmpBLeft < 0) return 1;
11570               if (aCmpBLeft > 0) return -1;
11571               const bCmpARight = b2.comparePoint(a2.rightSE.point);
11572               if (bCmpARight !== 0) return bCmpARight;
11573               return -1;
11574             }
11575             if (alx > blx) {
11576               if (aly < bly && aly < bry) return -1;
11577               if (aly > bly && aly > bry) return 1;
11578               const bCmpALeft = b2.comparePoint(a2.leftSE.point);
11579               if (bCmpALeft !== 0) return bCmpALeft;
11580               const aCmpBRight = a2.comparePoint(b2.rightSE.point);
11581               if (aCmpBRight < 0) return 1;
11582               if (aCmpBRight > 0) return -1;
11583               return 1;
11584             }
11585             if (aly < bly) return -1;
11586             if (aly > bly) return 1;
11587             if (arx < brx) {
11588               const bCmpARight = b2.comparePoint(a2.rightSE.point);
11589               if (bCmpARight !== 0) return bCmpARight;
11590             }
11591             if (arx > brx) {
11592               const aCmpBRight = a2.comparePoint(b2.rightSE.point);
11593               if (aCmpBRight < 0) return 1;
11594               if (aCmpBRight > 0) return -1;
11595             }
11596             if (arx !== brx) {
11597               const ay = ary - aly;
11598               const ax = arx - alx;
11599               const by = bry - bly;
11600               const bx = brx - blx;
11601               if (ay > ax && by < bx) return 1;
11602               if (ay < ax && by > bx) return -1;
11603             }
11604             if (arx > brx) return 1;
11605             if (arx < brx) return -1;
11606             if (ary < bry) return -1;
11607             if (ary > bry) return 1;
11608             if (a2.id < b2.id) return -1;
11609             if (a2.id > b2.id) return 1;
11610             return 0;
11611           }
11612           /* Warning: a reference to ringWindings input will be stored,
11613            *  and possibly will be later modified */
11614           constructor(leftSE, rightSE, rings, windings) {
11615             this.id = ++segmentId2;
11616             this.leftSE = leftSE;
11617             leftSE.segment = this;
11618             leftSE.otherSE = rightSE;
11619             this.rightSE = rightSE;
11620             rightSE.segment = this;
11621             rightSE.otherSE = leftSE;
11622             this.rings = rings;
11623             this.windings = windings;
11624           }
11625           static fromRing(pt1, pt2, ring) {
11626             let leftPt, rightPt, winding;
11627             const cmpPts = SweepEvent2.comparePoints(pt1, pt2);
11628             if (cmpPts < 0) {
11629               leftPt = pt1;
11630               rightPt = pt2;
11631               winding = 1;
11632             } else if (cmpPts > 0) {
11633               leftPt = pt2;
11634               rightPt = pt1;
11635               winding = -1;
11636             } else throw new Error("Tried to create degenerate segment at [".concat(pt1.x, ", ").concat(pt1.y, "]"));
11637             const leftSE = new SweepEvent2(leftPt, true);
11638             const rightSE = new SweepEvent2(rightPt, false);
11639             return new Segment2(leftSE, rightSE, [ring], [winding]);
11640           }
11641           /* When a segment is split, the rightSE is replaced with a new sweep event */
11642           replaceRightSE(newRightSE) {
11643             this.rightSE = newRightSE;
11644             this.rightSE.segment = this;
11645             this.rightSE.otherSE = this.leftSE;
11646             this.leftSE.otherSE = this.rightSE;
11647           }
11648           bbox() {
11649             const y12 = this.leftSE.point.y;
11650             const y2 = this.rightSE.point.y;
11651             return {
11652               ll: {
11653                 x: this.leftSE.point.x,
11654                 y: y12 < y2 ? y12 : y2
11655               },
11656               ur: {
11657                 x: this.rightSE.point.x,
11658                 y: y12 > y2 ? y12 : y2
11659               }
11660             };
11661           }
11662           /* A vector from the left point to the right */
11663           vector() {
11664             return {
11665               x: this.rightSE.point.x - this.leftSE.point.x,
11666               y: this.rightSE.point.y - this.leftSE.point.y
11667             };
11668           }
11669           isAnEndpoint(pt2) {
11670             return pt2.x === this.leftSE.point.x && pt2.y === this.leftSE.point.y || pt2.x === this.rightSE.point.x && pt2.y === this.rightSE.point.y;
11671           }
11672           /* Compare this segment with a point.
11673            *
11674            * A point P is considered to be colinear to a segment if there
11675            * exists a distance D such that if we travel along the segment
11676            * from one * endpoint towards the other a distance D, we find
11677            * ourselves at point P.
11678            *
11679            * Return value indicates:
11680            *
11681            *   1: point lies above the segment (to the left of vertical)
11682            *   0: point is colinear to segment
11683            *  -1: point lies below the segment (to the right of vertical)
11684            */
11685           comparePoint(point) {
11686             if (this.isAnEndpoint(point)) return 0;
11687             const lPt = this.leftSE.point;
11688             const rPt = this.rightSE.point;
11689             const v2 = this.vector();
11690             if (lPt.x === rPt.x) {
11691               if (point.x === lPt.x) return 0;
11692               return point.x < lPt.x ? 1 : -1;
11693             }
11694             const yDist = (point.y - lPt.y) / v2.y;
11695             const xFromYDist = lPt.x + yDist * v2.x;
11696             if (point.x === xFromYDist) return 0;
11697             const xDist = (point.x - lPt.x) / v2.x;
11698             const yFromXDist = lPt.y + xDist * v2.y;
11699             if (point.y === yFromXDist) return 0;
11700             return point.y < yFromXDist ? -1 : 1;
11701           }
11702           /**
11703            * Given another segment, returns the first non-trivial intersection
11704            * between the two segments (in terms of sweep line ordering), if it exists.
11705            *
11706            * A 'non-trivial' intersection is one that will cause one or both of the
11707            * segments to be split(). As such, 'trivial' vs. 'non-trivial' intersection:
11708            *
11709            *   * endpoint of segA with endpoint of segB --> trivial
11710            *   * endpoint of segA with point along segB --> non-trivial
11711            *   * endpoint of segB with point along segA --> non-trivial
11712            *   * point along segA with point along segB --> non-trivial
11713            *
11714            * If no non-trivial intersection exists, return null
11715            * Else, return null.
11716            */
11717           getIntersection(other) {
11718             const tBbox = this.bbox();
11719             const oBbox = other.bbox();
11720             const bboxOverlap = getBboxOverlap2(tBbox, oBbox);
11721             if (bboxOverlap === null) return null;
11722             const tlp = this.leftSE.point;
11723             const trp = this.rightSE.point;
11724             const olp = other.leftSE.point;
11725             const orp = other.rightSE.point;
11726             const touchesOtherLSE = isInBbox2(tBbox, olp) && this.comparePoint(olp) === 0;
11727             const touchesThisLSE = isInBbox2(oBbox, tlp) && other.comparePoint(tlp) === 0;
11728             const touchesOtherRSE = isInBbox2(tBbox, orp) && this.comparePoint(orp) === 0;
11729             const touchesThisRSE = isInBbox2(oBbox, trp) && other.comparePoint(trp) === 0;
11730             if (touchesThisLSE && touchesOtherLSE) {
11731               if (touchesThisRSE && !touchesOtherRSE) return trp;
11732               if (!touchesThisRSE && touchesOtherRSE) return orp;
11733               return null;
11734             }
11735             if (touchesThisLSE) {
11736               if (touchesOtherRSE) {
11737                 if (tlp.x === orp.x && tlp.y === orp.y) return null;
11738               }
11739               return tlp;
11740             }
11741             if (touchesOtherLSE) {
11742               if (touchesThisRSE) {
11743                 if (trp.x === olp.x && trp.y === olp.y) return null;
11744               }
11745               return olp;
11746             }
11747             if (touchesThisRSE && touchesOtherRSE) return null;
11748             if (touchesThisRSE) return trp;
11749             if (touchesOtherRSE) return orp;
11750             const pt2 = intersection$1(tlp, this.vector(), olp, other.vector());
11751             if (pt2 === null) return null;
11752             if (!isInBbox2(bboxOverlap, pt2)) return null;
11753             return rounder.round(pt2.x, pt2.y);
11754           }
11755           /**
11756            * Split the given segment into multiple segments on the given points.
11757            *  * Each existing segment will retain its leftSE and a new rightSE will be
11758            *    generated for it.
11759            *  * A new segment will be generated which will adopt the original segment's
11760            *    rightSE, and a new leftSE will be generated for it.
11761            *  * If there are more than two points given to split on, new segments
11762            *    in the middle will be generated with new leftSE and rightSE's.
11763            *  * An array of the newly generated SweepEvents will be returned.
11764            *
11765            * Warning: input array of points is modified
11766            */
11767           split(point) {
11768             const newEvents = [];
11769             const alreadyLinked = point.events !== void 0;
11770             const newLeftSE = new SweepEvent2(point, true);
11771             const newRightSE = new SweepEvent2(point, false);
11772             const oldRightSE = this.rightSE;
11773             this.replaceRightSE(newRightSE);
11774             newEvents.push(newRightSE);
11775             newEvents.push(newLeftSE);
11776             const newSeg = new Segment2(newLeftSE, oldRightSE, this.rings.slice(), this.windings.slice());
11777             if (SweepEvent2.comparePoints(newSeg.leftSE.point, newSeg.rightSE.point) > 0) {
11778               newSeg.swapEvents();
11779             }
11780             if (SweepEvent2.comparePoints(this.leftSE.point, this.rightSE.point) > 0) {
11781               this.swapEvents();
11782             }
11783             if (alreadyLinked) {
11784               newLeftSE.checkForConsuming();
11785               newRightSE.checkForConsuming();
11786             }
11787             return newEvents;
11788           }
11789           /* Swap which event is left and right */
11790           swapEvents() {
11791             const tmpEvt = this.rightSE;
11792             this.rightSE = this.leftSE;
11793             this.leftSE = tmpEvt;
11794             this.leftSE.isLeft = true;
11795             this.rightSE.isLeft = false;
11796             for (let i3 = 0, iMax = this.windings.length; i3 < iMax; i3++) {
11797               this.windings[i3] *= -1;
11798             }
11799           }
11800           /* Consume another segment. We take their rings under our wing
11801            * and mark them as consumed. Use for perfectly overlapping segments */
11802           consume(other) {
11803             let consumer = this;
11804             let consumee = other;
11805             while (consumer.consumedBy) consumer = consumer.consumedBy;
11806             while (consumee.consumedBy) consumee = consumee.consumedBy;
11807             const cmp2 = Segment2.compare(consumer, consumee);
11808             if (cmp2 === 0) return;
11809             if (cmp2 > 0) {
11810               const tmp = consumer;
11811               consumer = consumee;
11812               consumee = tmp;
11813             }
11814             if (consumer.prev === consumee) {
11815               const tmp = consumer;
11816               consumer = consumee;
11817               consumee = tmp;
11818             }
11819             for (let i3 = 0, iMax = consumee.rings.length; i3 < iMax; i3++) {
11820               const ring = consumee.rings[i3];
11821               const winding = consumee.windings[i3];
11822               const index2 = consumer.rings.indexOf(ring);
11823               if (index2 === -1) {
11824                 consumer.rings.push(ring);
11825                 consumer.windings.push(winding);
11826               } else consumer.windings[index2] += winding;
11827             }
11828             consumee.rings = null;
11829             consumee.windings = null;
11830             consumee.consumedBy = consumer;
11831             consumee.leftSE.consumedBy = consumer.leftSE;
11832             consumee.rightSE.consumedBy = consumer.rightSE;
11833           }
11834           /* The first segment previous segment chain that is in the result */
11835           prevInResult() {
11836             if (this._prevInResult !== void 0) return this._prevInResult;
11837             if (!this.prev) this._prevInResult = null;
11838             else if (this.prev.isInResult()) this._prevInResult = this.prev;
11839             else this._prevInResult = this.prev.prevInResult();
11840             return this._prevInResult;
11841           }
11842           beforeState() {
11843             if (this._beforeState !== void 0) return this._beforeState;
11844             if (!this.prev) this._beforeState = {
11845               rings: [],
11846               windings: [],
11847               multiPolys: []
11848             };
11849             else {
11850               const seg = this.prev.consumedBy || this.prev;
11851               this._beforeState = seg.afterState();
11852             }
11853             return this._beforeState;
11854           }
11855           afterState() {
11856             if (this._afterState !== void 0) return this._afterState;
11857             const beforeState = this.beforeState();
11858             this._afterState = {
11859               rings: beforeState.rings.slice(0),
11860               windings: beforeState.windings.slice(0),
11861               multiPolys: []
11862             };
11863             const ringsAfter = this._afterState.rings;
11864             const windingsAfter = this._afterState.windings;
11865             const mpsAfter = this._afterState.multiPolys;
11866             for (let i3 = 0, iMax = this.rings.length; i3 < iMax; i3++) {
11867               const ring = this.rings[i3];
11868               const winding = this.windings[i3];
11869               const index2 = ringsAfter.indexOf(ring);
11870               if (index2 === -1) {
11871                 ringsAfter.push(ring);
11872                 windingsAfter.push(winding);
11873               } else windingsAfter[index2] += winding;
11874             }
11875             const polysAfter = [];
11876             const polysExclude = [];
11877             for (let i3 = 0, iMax = ringsAfter.length; i3 < iMax; i3++) {
11878               if (windingsAfter[i3] === 0) continue;
11879               const ring = ringsAfter[i3];
11880               const poly = ring.poly;
11881               if (polysExclude.indexOf(poly) !== -1) continue;
11882               if (ring.isExterior) polysAfter.push(poly);
11883               else {
11884                 if (polysExclude.indexOf(poly) === -1) polysExclude.push(poly);
11885                 const index2 = polysAfter.indexOf(ring.poly);
11886                 if (index2 !== -1) polysAfter.splice(index2, 1);
11887               }
11888             }
11889             for (let i3 = 0, iMax = polysAfter.length; i3 < iMax; i3++) {
11890               const mp = polysAfter[i3].multiPoly;
11891               if (mpsAfter.indexOf(mp) === -1) mpsAfter.push(mp);
11892             }
11893             return this._afterState;
11894           }
11895           /* Is this segment part of the final result? */
11896           isInResult() {
11897             if (this.consumedBy) return false;
11898             if (this._isInResult !== void 0) return this._isInResult;
11899             const mpsBefore = this.beforeState().multiPolys;
11900             const mpsAfter = this.afterState().multiPolys;
11901             switch (operation2.type) {
11902               case "union": {
11903                 const noBefores = mpsBefore.length === 0;
11904                 const noAfters = mpsAfter.length === 0;
11905                 this._isInResult = noBefores !== noAfters;
11906                 break;
11907               }
11908               case "intersection": {
11909                 let least;
11910                 let most;
11911                 if (mpsBefore.length < mpsAfter.length) {
11912                   least = mpsBefore.length;
11913                   most = mpsAfter.length;
11914                 } else {
11915                   least = mpsAfter.length;
11916                   most = mpsBefore.length;
11917                 }
11918                 this._isInResult = most === operation2.numMultiPolys && least < most;
11919                 break;
11920               }
11921               case "xor": {
11922                 const diff = Math.abs(mpsBefore.length - mpsAfter.length);
11923                 this._isInResult = diff % 2 === 1;
11924                 break;
11925               }
11926               case "difference": {
11927                 const isJustSubject = (mps) => mps.length === 1 && mps[0].isSubject;
11928                 this._isInResult = isJustSubject(mpsBefore) !== isJustSubject(mpsAfter);
11929                 break;
11930               }
11931               default:
11932                 throw new Error("Unrecognized operation type found ".concat(operation2.type));
11933             }
11934             return this._isInResult;
11935           }
11936         }
11937         class RingIn2 {
11938           constructor(geomRing, poly, isExterior) {
11939             if (!Array.isArray(geomRing) || geomRing.length === 0) {
11940               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
11941             }
11942             this.poly = poly;
11943             this.isExterior = isExterior;
11944             this.segments = [];
11945             if (typeof geomRing[0][0] !== "number" || typeof geomRing[0][1] !== "number") {
11946               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
11947             }
11948             const firstPoint = rounder.round(geomRing[0][0], geomRing[0][1]);
11949             this.bbox = {
11950               ll: {
11951                 x: firstPoint.x,
11952                 y: firstPoint.y
11953               },
11954               ur: {
11955                 x: firstPoint.x,
11956                 y: firstPoint.y
11957               }
11958             };
11959             let prevPoint = firstPoint;
11960             for (let i3 = 1, iMax = geomRing.length; i3 < iMax; i3++) {
11961               if (typeof geomRing[i3][0] !== "number" || typeof geomRing[i3][1] !== "number") {
11962                 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
11963               }
11964               let point = rounder.round(geomRing[i3][0], geomRing[i3][1]);
11965               if (point.x === prevPoint.x && point.y === prevPoint.y) continue;
11966               this.segments.push(Segment2.fromRing(prevPoint, point, this));
11967               if (point.x < this.bbox.ll.x) this.bbox.ll.x = point.x;
11968               if (point.y < this.bbox.ll.y) this.bbox.ll.y = point.y;
11969               if (point.x > this.bbox.ur.x) this.bbox.ur.x = point.x;
11970               if (point.y > this.bbox.ur.y) this.bbox.ur.y = point.y;
11971               prevPoint = point;
11972             }
11973             if (firstPoint.x !== prevPoint.x || firstPoint.y !== prevPoint.y) {
11974               this.segments.push(Segment2.fromRing(prevPoint, firstPoint, this));
11975             }
11976           }
11977           getSweepEvents() {
11978             const sweepEvents = [];
11979             for (let i3 = 0, iMax = this.segments.length; i3 < iMax; i3++) {
11980               const segment = this.segments[i3];
11981               sweepEvents.push(segment.leftSE);
11982               sweepEvents.push(segment.rightSE);
11983             }
11984             return sweepEvents;
11985           }
11986         }
11987         class PolyIn2 {
11988           constructor(geomPoly, multiPoly) {
11989             if (!Array.isArray(geomPoly)) {
11990               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
11991             }
11992             this.exteriorRing = new RingIn2(geomPoly[0], this, true);
11993             this.bbox = {
11994               ll: {
11995                 x: this.exteriorRing.bbox.ll.x,
11996                 y: this.exteriorRing.bbox.ll.y
11997               },
11998               ur: {
11999                 x: this.exteriorRing.bbox.ur.x,
12000                 y: this.exteriorRing.bbox.ur.y
12001               }
12002             };
12003             this.interiorRings = [];
12004             for (let i3 = 1, iMax = geomPoly.length; i3 < iMax; i3++) {
12005               const ring = new RingIn2(geomPoly[i3], this, false);
12006               if (ring.bbox.ll.x < this.bbox.ll.x) this.bbox.ll.x = ring.bbox.ll.x;
12007               if (ring.bbox.ll.y < this.bbox.ll.y) this.bbox.ll.y = ring.bbox.ll.y;
12008               if (ring.bbox.ur.x > this.bbox.ur.x) this.bbox.ur.x = ring.bbox.ur.x;
12009               if (ring.bbox.ur.y > this.bbox.ur.y) this.bbox.ur.y = ring.bbox.ur.y;
12010               this.interiorRings.push(ring);
12011             }
12012             this.multiPoly = multiPoly;
12013           }
12014           getSweepEvents() {
12015             const sweepEvents = this.exteriorRing.getSweepEvents();
12016             for (let i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
12017               const ringSweepEvents = this.interiorRings[i3].getSweepEvents();
12018               for (let j2 = 0, jMax = ringSweepEvents.length; j2 < jMax; j2++) {
12019                 sweepEvents.push(ringSweepEvents[j2]);
12020               }
12021             }
12022             return sweepEvents;
12023           }
12024         }
12025         class MultiPolyIn2 {
12026           constructor(geom, isSubject) {
12027             if (!Array.isArray(geom)) {
12028               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
12029             }
12030             try {
12031               if (typeof geom[0][0][0] === "number") geom = [geom];
12032             } catch (ex) {
12033             }
12034             this.polys = [];
12035             this.bbox = {
12036               ll: {
12037                 x: Number.POSITIVE_INFINITY,
12038                 y: Number.POSITIVE_INFINITY
12039               },
12040               ur: {
12041                 x: Number.NEGATIVE_INFINITY,
12042                 y: Number.NEGATIVE_INFINITY
12043               }
12044             };
12045             for (let i3 = 0, iMax = geom.length; i3 < iMax; i3++) {
12046               const poly = new PolyIn2(geom[i3], this);
12047               if (poly.bbox.ll.x < this.bbox.ll.x) this.bbox.ll.x = poly.bbox.ll.x;
12048               if (poly.bbox.ll.y < this.bbox.ll.y) this.bbox.ll.y = poly.bbox.ll.y;
12049               if (poly.bbox.ur.x > this.bbox.ur.x) this.bbox.ur.x = poly.bbox.ur.x;
12050               if (poly.bbox.ur.y > this.bbox.ur.y) this.bbox.ur.y = poly.bbox.ur.y;
12051               this.polys.push(poly);
12052             }
12053             this.isSubject = isSubject;
12054           }
12055           getSweepEvents() {
12056             const sweepEvents = [];
12057             for (let i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
12058               const polySweepEvents = this.polys[i3].getSweepEvents();
12059               for (let j2 = 0, jMax = polySweepEvents.length; j2 < jMax; j2++) {
12060                 sweepEvents.push(polySweepEvents[j2]);
12061               }
12062             }
12063             return sweepEvents;
12064           }
12065         }
12066         class RingOut2 {
12067           /* Given the segments from the sweep line pass, compute & return a series
12068            * of closed rings from all the segments marked to be part of the result */
12069           static factory(allSegments) {
12070             const ringsOut = [];
12071             for (let i3 = 0, iMax = allSegments.length; i3 < iMax; i3++) {
12072               const segment = allSegments[i3];
12073               if (!segment.isInResult() || segment.ringOut) continue;
12074               let prevEvent = null;
12075               let event = segment.leftSE;
12076               let nextEvent = segment.rightSE;
12077               const events = [event];
12078               const startingPoint = event.point;
12079               const intersectionLEs = [];
12080               while (true) {
12081                 prevEvent = event;
12082                 event = nextEvent;
12083                 events.push(event);
12084                 if (event.point === startingPoint) break;
12085                 while (true) {
12086                   const availableLEs = event.getAvailableLinkedEvents();
12087                   if (availableLEs.length === 0) {
12088                     const firstPt = events[0].point;
12089                     const lastPt = events[events.length - 1].point;
12090                     throw new Error("Unable to complete output ring starting at [".concat(firstPt.x, ",") + " ".concat(firstPt.y, "]. Last matching segment found ends at") + " [".concat(lastPt.x, ", ").concat(lastPt.y, "]."));
12091                   }
12092                   if (availableLEs.length === 1) {
12093                     nextEvent = availableLEs[0].otherSE;
12094                     break;
12095                   }
12096                   let indexLE = null;
12097                   for (let j2 = 0, jMax = intersectionLEs.length; j2 < jMax; j2++) {
12098                     if (intersectionLEs[j2].point === event.point) {
12099                       indexLE = j2;
12100                       break;
12101                     }
12102                   }
12103                   if (indexLE !== null) {
12104                     const intersectionLE = intersectionLEs.splice(indexLE)[0];
12105                     const ringEvents = events.splice(intersectionLE.index);
12106                     ringEvents.unshift(ringEvents[0].otherSE);
12107                     ringsOut.push(new RingOut2(ringEvents.reverse()));
12108                     continue;
12109                   }
12110                   intersectionLEs.push({
12111                     index: events.length,
12112                     point: event.point
12113                   });
12114                   const comparator = event.getLeftmostComparator(prevEvent);
12115                   nextEvent = availableLEs.sort(comparator)[0].otherSE;
12116                   break;
12117                 }
12118               }
12119               ringsOut.push(new RingOut2(events));
12120             }
12121             return ringsOut;
12122           }
12123           constructor(events) {
12124             this.events = events;
12125             for (let i3 = 0, iMax = events.length; i3 < iMax; i3++) {
12126               events[i3].segment.ringOut = this;
12127             }
12128             this.poly = null;
12129           }
12130           getGeom() {
12131             let prevPt = this.events[0].point;
12132             const points = [prevPt];
12133             for (let i3 = 1, iMax = this.events.length - 1; i3 < iMax; i3++) {
12134               const pt3 = this.events[i3].point;
12135               const nextPt2 = this.events[i3 + 1].point;
12136               if (compareVectorAngles(pt3, prevPt, nextPt2) === 0) continue;
12137               points.push(pt3);
12138               prevPt = pt3;
12139             }
12140             if (points.length === 1) return null;
12141             const pt2 = points[0];
12142             const nextPt = points[1];
12143             if (compareVectorAngles(pt2, prevPt, nextPt) === 0) points.shift();
12144             points.push(points[0]);
12145             const step = this.isExteriorRing() ? 1 : -1;
12146             const iStart = this.isExteriorRing() ? 0 : points.length - 1;
12147             const iEnd = this.isExteriorRing() ? points.length : -1;
12148             const orderedPoints = [];
12149             for (let i3 = iStart; i3 != iEnd; i3 += step) orderedPoints.push([points[i3].x, points[i3].y]);
12150             return orderedPoints;
12151           }
12152           isExteriorRing() {
12153             if (this._isExteriorRing === void 0) {
12154               const enclosing = this.enclosingRing();
12155               this._isExteriorRing = enclosing ? !enclosing.isExteriorRing() : true;
12156             }
12157             return this._isExteriorRing;
12158           }
12159           enclosingRing() {
12160             if (this._enclosingRing === void 0) {
12161               this._enclosingRing = this._calcEnclosingRing();
12162             }
12163             return this._enclosingRing;
12164           }
12165           /* Returns the ring that encloses this one, if any */
12166           _calcEnclosingRing() {
12167             let leftMostEvt = this.events[0];
12168             for (let i3 = 1, iMax = this.events.length; i3 < iMax; i3++) {
12169               const evt = this.events[i3];
12170               if (SweepEvent2.compare(leftMostEvt, evt) > 0) leftMostEvt = evt;
12171             }
12172             let prevSeg = leftMostEvt.segment.prevInResult();
12173             let prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
12174             while (true) {
12175               if (!prevSeg) return null;
12176               if (!prevPrevSeg) return prevSeg.ringOut;
12177               if (prevPrevSeg.ringOut !== prevSeg.ringOut) {
12178                 if (prevPrevSeg.ringOut.enclosingRing() !== prevSeg.ringOut) {
12179                   return prevSeg.ringOut;
12180                 } else return prevSeg.ringOut.enclosingRing();
12181               }
12182               prevSeg = prevPrevSeg.prevInResult();
12183               prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
12184             }
12185           }
12186         }
12187         class PolyOut2 {
12188           constructor(exteriorRing) {
12189             this.exteriorRing = exteriorRing;
12190             exteriorRing.poly = this;
12191             this.interiorRings = [];
12192           }
12193           addInterior(ring) {
12194             this.interiorRings.push(ring);
12195             ring.poly = this;
12196           }
12197           getGeom() {
12198             const geom = [this.exteriorRing.getGeom()];
12199             if (geom[0] === null) return null;
12200             for (let i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
12201               const ringGeom = this.interiorRings[i3].getGeom();
12202               if (ringGeom === null) continue;
12203               geom.push(ringGeom);
12204             }
12205             return geom;
12206           }
12207         }
12208         class MultiPolyOut2 {
12209           constructor(rings) {
12210             this.rings = rings;
12211             this.polys = this._composePolys(rings);
12212           }
12213           getGeom() {
12214             const geom = [];
12215             for (let i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
12216               const polyGeom = this.polys[i3].getGeom();
12217               if (polyGeom === null) continue;
12218               geom.push(polyGeom);
12219             }
12220             return geom;
12221           }
12222           _composePolys(rings) {
12223             const polys = [];
12224             for (let i3 = 0, iMax = rings.length; i3 < iMax; i3++) {
12225               const ring = rings[i3];
12226               if (ring.poly) continue;
12227               if (ring.isExteriorRing()) polys.push(new PolyOut2(ring));
12228               else {
12229                 const enclosingRing = ring.enclosingRing();
12230                 if (!enclosingRing.poly) polys.push(new PolyOut2(enclosingRing));
12231                 enclosingRing.poly.addInterior(ring);
12232               }
12233             }
12234             return polys;
12235           }
12236         }
12237         class SweepLine2 {
12238           constructor(queue) {
12239             let comparator = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Segment2.compare;
12240             this.queue = queue;
12241             this.tree = new Tree(comparator);
12242             this.segments = [];
12243           }
12244           process(event) {
12245             const segment = event.segment;
12246             const newEvents = [];
12247             if (event.consumedBy) {
12248               if (event.isLeft) this.queue.remove(event.otherSE);
12249               else this.tree.remove(segment);
12250               return newEvents;
12251             }
12252             const node = event.isLeft ? this.tree.add(segment) : this.tree.find(segment);
12253             if (!node) throw new Error("Unable to find segment #".concat(segment.id, " ") + "[".concat(segment.leftSE.point.x, ", ").concat(segment.leftSE.point.y, "] -> ") + "[".concat(segment.rightSE.point.x, ", ").concat(segment.rightSE.point.y, "] ") + "in SweepLine tree.");
12254             let prevNode = node;
12255             let nextNode = node;
12256             let prevSeg = void 0;
12257             let nextSeg = void 0;
12258             while (prevSeg === void 0) {
12259               prevNode = this.tree.prev(prevNode);
12260               if (prevNode === null) prevSeg = null;
12261               else if (prevNode.key.consumedBy === void 0) prevSeg = prevNode.key;
12262             }
12263             while (nextSeg === void 0) {
12264               nextNode = this.tree.next(nextNode);
12265               if (nextNode === null) nextSeg = null;
12266               else if (nextNode.key.consumedBy === void 0) nextSeg = nextNode.key;
12267             }
12268             if (event.isLeft) {
12269               let prevMySplitter = null;
12270               if (prevSeg) {
12271                 const prevInter = prevSeg.getIntersection(segment);
12272                 if (prevInter !== null) {
12273                   if (!segment.isAnEndpoint(prevInter)) prevMySplitter = prevInter;
12274                   if (!prevSeg.isAnEndpoint(prevInter)) {
12275                     const newEventsFromSplit = this._splitSafely(prevSeg, prevInter);
12276                     for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
12277                       newEvents.push(newEventsFromSplit[i3]);
12278                     }
12279                   }
12280                 }
12281               }
12282               let nextMySplitter = null;
12283               if (nextSeg) {
12284                 const nextInter = nextSeg.getIntersection(segment);
12285                 if (nextInter !== null) {
12286                   if (!segment.isAnEndpoint(nextInter)) nextMySplitter = nextInter;
12287                   if (!nextSeg.isAnEndpoint(nextInter)) {
12288                     const newEventsFromSplit = this._splitSafely(nextSeg, nextInter);
12289                     for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
12290                       newEvents.push(newEventsFromSplit[i3]);
12291                     }
12292                   }
12293                 }
12294               }
12295               if (prevMySplitter !== null || nextMySplitter !== null) {
12296                 let mySplitter = null;
12297                 if (prevMySplitter === null) mySplitter = nextMySplitter;
12298                 else if (nextMySplitter === null) mySplitter = prevMySplitter;
12299                 else {
12300                   const cmpSplitters = SweepEvent2.comparePoints(prevMySplitter, nextMySplitter);
12301                   mySplitter = cmpSplitters <= 0 ? prevMySplitter : nextMySplitter;
12302                 }
12303                 this.queue.remove(segment.rightSE);
12304                 newEvents.push(segment.rightSE);
12305                 const newEventsFromSplit = segment.split(mySplitter);
12306                 for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
12307                   newEvents.push(newEventsFromSplit[i3]);
12308                 }
12309               }
12310               if (newEvents.length > 0) {
12311                 this.tree.remove(segment);
12312                 newEvents.push(event);
12313               } else {
12314                 this.segments.push(segment);
12315                 segment.prev = prevSeg;
12316               }
12317             } else {
12318               if (prevSeg && nextSeg) {
12319                 const inter = prevSeg.getIntersection(nextSeg);
12320                 if (inter !== null) {
12321                   if (!prevSeg.isAnEndpoint(inter)) {
12322                     const newEventsFromSplit = this._splitSafely(prevSeg, inter);
12323                     for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
12324                       newEvents.push(newEventsFromSplit[i3]);
12325                     }
12326                   }
12327                   if (!nextSeg.isAnEndpoint(inter)) {
12328                     const newEventsFromSplit = this._splitSafely(nextSeg, inter);
12329                     for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
12330                       newEvents.push(newEventsFromSplit[i3]);
12331                     }
12332                   }
12333                 }
12334               }
12335               this.tree.remove(segment);
12336             }
12337             return newEvents;
12338           }
12339           /* Safely split a segment that is currently in the datastructures
12340            * IE - a segment other than the one that is currently being processed. */
12341           _splitSafely(seg, pt2) {
12342             this.tree.remove(seg);
12343             const rightSE = seg.rightSE;
12344             this.queue.remove(rightSE);
12345             const newEvents = seg.split(pt2);
12346             newEvents.push(rightSE);
12347             if (seg.consumedBy === void 0) this.tree.add(seg);
12348             return newEvents;
12349           }
12350         }
12351         const POLYGON_CLIPPING_MAX_QUEUE_SIZE = typeof process !== "undefined" && process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE || 1e6;
12352         const POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS = typeof process !== "undefined" && process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS || 1e6;
12353         class Operation2 {
12354           run(type2, geom, moreGeoms) {
12355             operation2.type = type2;
12356             rounder.reset();
12357             const multipolys = [new MultiPolyIn2(geom, true)];
12358             for (let i3 = 0, iMax = moreGeoms.length; i3 < iMax; i3++) {
12359               multipolys.push(new MultiPolyIn2(moreGeoms[i3], false));
12360             }
12361             operation2.numMultiPolys = multipolys.length;
12362             if (operation2.type === "difference") {
12363               const subject = multipolys[0];
12364               let i3 = 1;
12365               while (i3 < multipolys.length) {
12366                 if (getBboxOverlap2(multipolys[i3].bbox, subject.bbox) !== null) i3++;
12367                 else multipolys.splice(i3, 1);
12368               }
12369             }
12370             if (operation2.type === "intersection") {
12371               for (let i3 = 0, iMax = multipolys.length; i3 < iMax; i3++) {
12372                 const mpA = multipolys[i3];
12373                 for (let j2 = i3 + 1, jMax = multipolys.length; j2 < jMax; j2++) {
12374                   if (getBboxOverlap2(mpA.bbox, multipolys[j2].bbox) === null) return [];
12375                 }
12376               }
12377             }
12378             const queue = new Tree(SweepEvent2.compare);
12379             for (let i3 = 0, iMax = multipolys.length; i3 < iMax; i3++) {
12380               const sweepEvents = multipolys[i3].getSweepEvents();
12381               for (let j2 = 0, jMax = sweepEvents.length; j2 < jMax; j2++) {
12382                 queue.insert(sweepEvents[j2]);
12383                 if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {
12384                   throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).");
12385                 }
12386               }
12387             }
12388             const sweepLine = new SweepLine2(queue);
12389             let prevQueueSize = queue.size;
12390             let node = queue.pop();
12391             while (node) {
12392               const evt = node.key;
12393               if (queue.size === prevQueueSize) {
12394                 const seg = evt.segment;
12395                 throw new Error("Unable to pop() ".concat(evt.isLeft ? "left" : "right", " SweepEvent ") + "[".concat(evt.point.x, ", ").concat(evt.point.y, "] from segment #").concat(seg.id, " ") + "[".concat(seg.leftSE.point.x, ", ").concat(seg.leftSE.point.y, "] -> ") + "[".concat(seg.rightSE.point.x, ", ").concat(seg.rightSE.point.y, "] from queue."));
12396               }
12397               if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {
12398                 throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");
12399               }
12400               if (sweepLine.segments.length > POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS) {
12401                 throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");
12402               }
12403               const newEvents = sweepLine.process(evt);
12404               for (let i3 = 0, iMax = newEvents.length; i3 < iMax; i3++) {
12405                 const evt2 = newEvents[i3];
12406                 if (evt2.consumedBy === void 0) queue.insert(evt2);
12407               }
12408               prevQueueSize = queue.size;
12409               node = queue.pop();
12410             }
12411             rounder.reset();
12412             const ringsOut = RingOut2.factory(sweepLine.segments);
12413             const result = new MultiPolyOut2(ringsOut);
12414             return result.getGeom();
12415           }
12416         }
12417         const operation2 = new Operation2();
12418         const union2 = function(geom) {
12419           for (var _len = arguments.length, moreGeoms = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
12420             moreGeoms[_key - 1] = arguments[_key];
12421           }
12422           return operation2.run("union", geom, moreGeoms);
12423         };
12424         const intersection2 = function(geom) {
12425           for (var _len2 = arguments.length, moreGeoms = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
12426             moreGeoms[_key2 - 1] = arguments[_key2];
12427           }
12428           return operation2.run("intersection", geom, moreGeoms);
12429         };
12430         const xor = function(geom) {
12431           for (var _len3 = arguments.length, moreGeoms = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
12432             moreGeoms[_key3 - 1] = arguments[_key3];
12433           }
12434           return operation2.run("xor", geom, moreGeoms);
12435         };
12436         const difference2 = function(subjectGeom) {
12437           for (var _len4 = arguments.length, clippingGeoms = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
12438             clippingGeoms[_key4 - 1] = arguments[_key4];
12439           }
12440           return operation2.run("difference", subjectGeom, clippingGeoms);
12441         };
12442         var index = {
12443           union: union2,
12444           intersection: intersection2,
12445           xor,
12446           difference: difference2
12447         };
12448         return index;
12449       });
12450     }
12451   });
12452
12453   // node_modules/whatwg-fetch/fetch.js
12454   var g = typeof globalThis !== "undefined" && globalThis || typeof self !== "undefined" && self || // eslint-disable-next-line no-undef
12455   typeof global !== "undefined" && global || {};
12456   var support = {
12457     searchParams: "URLSearchParams" in g,
12458     iterable: "Symbol" in g && "iterator" in Symbol,
12459     blob: "FileReader" in g && "Blob" in g && function() {
12460       try {
12461         new Blob();
12462         return true;
12463       } catch (e3) {
12464         return false;
12465       }
12466     }(),
12467     formData: "FormData" in g,
12468     arrayBuffer: "ArrayBuffer" in g
12469   };
12470   function isDataView(obj) {
12471     return obj && DataView.prototype.isPrototypeOf(obj);
12472   }
12473   if (support.arrayBuffer) {
12474     viewClasses = [
12475       "[object Int8Array]",
12476       "[object Uint8Array]",
12477       "[object Uint8ClampedArray]",
12478       "[object Int16Array]",
12479       "[object Uint16Array]",
12480       "[object Int32Array]",
12481       "[object Uint32Array]",
12482       "[object Float32Array]",
12483       "[object Float64Array]"
12484     ];
12485     isArrayBufferView = ArrayBuffer.isView || function(obj) {
12486       return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1;
12487     };
12488   }
12489   var viewClasses;
12490   var isArrayBufferView;
12491   function normalizeName(name) {
12492     if (typeof name !== "string") {
12493       name = String(name);
12494     }
12495     if (/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(name) || name === "") {
12496       throw new TypeError('Invalid character in header field name: "' + name + '"');
12497     }
12498     return name.toLowerCase();
12499   }
12500   function normalizeValue(value) {
12501     if (typeof value !== "string") {
12502       value = String(value);
12503     }
12504     return value;
12505   }
12506   function iteratorFor(items) {
12507     var iterator = {
12508       next: function() {
12509         var value = items.shift();
12510         return { done: value === void 0, value };
12511       }
12512     };
12513     if (support.iterable) {
12514       iterator[Symbol.iterator] = function() {
12515         return iterator;
12516       };
12517     }
12518     return iterator;
12519   }
12520   function Headers(headers) {
12521     this.map = {};
12522     if (headers instanceof Headers) {
12523       headers.forEach(function(value, name) {
12524         this.append(name, value);
12525       }, this);
12526     } else if (Array.isArray(headers)) {
12527       headers.forEach(function(header) {
12528         if (header.length != 2) {
12529           throw new TypeError("Headers constructor: expected name/value pair to be length 2, found" + header.length);
12530         }
12531         this.append(header[0], header[1]);
12532       }, this);
12533     } else if (headers) {
12534       Object.getOwnPropertyNames(headers).forEach(function(name) {
12535         this.append(name, headers[name]);
12536       }, this);
12537     }
12538   }
12539   Headers.prototype.append = function(name, value) {
12540     name = normalizeName(name);
12541     value = normalizeValue(value);
12542     var oldValue = this.map[name];
12543     this.map[name] = oldValue ? oldValue + ", " + value : value;
12544   };
12545   Headers.prototype["delete"] = function(name) {
12546     delete this.map[normalizeName(name)];
12547   };
12548   Headers.prototype.get = function(name) {
12549     name = normalizeName(name);
12550     return this.has(name) ? this.map[name] : null;
12551   };
12552   Headers.prototype.has = function(name) {
12553     return this.map.hasOwnProperty(normalizeName(name));
12554   };
12555   Headers.prototype.set = function(name, value) {
12556     this.map[normalizeName(name)] = normalizeValue(value);
12557   };
12558   Headers.prototype.forEach = function(callback, thisArg) {
12559     for (var name in this.map) {
12560       if (this.map.hasOwnProperty(name)) {
12561         callback.call(thisArg, this.map[name], name, this);
12562       }
12563     }
12564   };
12565   Headers.prototype.keys = function() {
12566     var items = [];
12567     this.forEach(function(value, name) {
12568       items.push(name);
12569     });
12570     return iteratorFor(items);
12571   };
12572   Headers.prototype.values = function() {
12573     var items = [];
12574     this.forEach(function(value) {
12575       items.push(value);
12576     });
12577     return iteratorFor(items);
12578   };
12579   Headers.prototype.entries = function() {
12580     var items = [];
12581     this.forEach(function(value, name) {
12582       items.push([name, value]);
12583     });
12584     return iteratorFor(items);
12585   };
12586   if (support.iterable) {
12587     Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
12588   }
12589   function consumed(body) {
12590     if (body._noBody) return;
12591     if (body.bodyUsed) {
12592       return Promise.reject(new TypeError("Already read"));
12593     }
12594     body.bodyUsed = true;
12595   }
12596   function fileReaderReady(reader) {
12597     return new Promise(function(resolve, reject) {
12598       reader.onload = function() {
12599         resolve(reader.result);
12600       };
12601       reader.onerror = function() {
12602         reject(reader.error);
12603       };
12604     });
12605   }
12606   function readBlobAsArrayBuffer(blob) {
12607     var reader = new FileReader();
12608     var promise = fileReaderReady(reader);
12609     reader.readAsArrayBuffer(blob);
12610     return promise;
12611   }
12612   function readBlobAsText(blob) {
12613     var reader = new FileReader();
12614     var promise = fileReaderReady(reader);
12615     var match = /charset=([A-Za-z0-9_-]+)/.exec(blob.type);
12616     var encoding = match ? match[1] : "utf-8";
12617     reader.readAsText(blob, encoding);
12618     return promise;
12619   }
12620   function readArrayBufferAsText(buf) {
12621     var view = new Uint8Array(buf);
12622     var chars = new Array(view.length);
12623     for (var i3 = 0; i3 < view.length; i3++) {
12624       chars[i3] = String.fromCharCode(view[i3]);
12625     }
12626     return chars.join("");
12627   }
12628   function bufferClone(buf) {
12629     if (buf.slice) {
12630       return buf.slice(0);
12631     } else {
12632       var view = new Uint8Array(buf.byteLength);
12633       view.set(new Uint8Array(buf));
12634       return view.buffer;
12635     }
12636   }
12637   function Body() {
12638     this.bodyUsed = false;
12639     this._initBody = function(body) {
12640       this.bodyUsed = this.bodyUsed;
12641       this._bodyInit = body;
12642       if (!body) {
12643         this._noBody = true;
12644         this._bodyText = "";
12645       } else if (typeof body === "string") {
12646         this._bodyText = body;
12647       } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
12648         this._bodyBlob = body;
12649       } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
12650         this._bodyFormData = body;
12651       } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
12652         this._bodyText = body.toString();
12653       } else if (support.arrayBuffer && support.blob && isDataView(body)) {
12654         this._bodyArrayBuffer = bufferClone(body.buffer);
12655         this._bodyInit = new Blob([this._bodyArrayBuffer]);
12656       } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
12657         this._bodyArrayBuffer = bufferClone(body);
12658       } else {
12659         this._bodyText = body = Object.prototype.toString.call(body);
12660       }
12661       if (!this.headers.get("content-type")) {
12662         if (typeof body === "string") {
12663           this.headers.set("content-type", "text/plain;charset=UTF-8");
12664         } else if (this._bodyBlob && this._bodyBlob.type) {
12665           this.headers.set("content-type", this._bodyBlob.type);
12666         } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
12667           this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8");
12668         }
12669       }
12670     };
12671     if (support.blob) {
12672       this.blob = function() {
12673         var rejected = consumed(this);
12674         if (rejected) {
12675           return rejected;
12676         }
12677         if (this._bodyBlob) {
12678           return Promise.resolve(this._bodyBlob);
12679         } else if (this._bodyArrayBuffer) {
12680           return Promise.resolve(new Blob([this._bodyArrayBuffer]));
12681         } else if (this._bodyFormData) {
12682           throw new Error("could not read FormData body as blob");
12683         } else {
12684           return Promise.resolve(new Blob([this._bodyText]));
12685         }
12686       };
12687     }
12688     this.arrayBuffer = function() {
12689       if (this._bodyArrayBuffer) {
12690         var isConsumed = consumed(this);
12691         if (isConsumed) {
12692           return isConsumed;
12693         } else if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
12694           return Promise.resolve(
12695             this._bodyArrayBuffer.buffer.slice(
12696               this._bodyArrayBuffer.byteOffset,
12697               this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
12698             )
12699           );
12700         } else {
12701           return Promise.resolve(this._bodyArrayBuffer);
12702         }
12703       } else if (support.blob) {
12704         return this.blob().then(readBlobAsArrayBuffer);
12705       } else {
12706         throw new Error("could not read as ArrayBuffer");
12707       }
12708     };
12709     this.text = function() {
12710       var rejected = consumed(this);
12711       if (rejected) {
12712         return rejected;
12713       }
12714       if (this._bodyBlob) {
12715         return readBlobAsText(this._bodyBlob);
12716       } else if (this._bodyArrayBuffer) {
12717         return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer));
12718       } else if (this._bodyFormData) {
12719         throw new Error("could not read FormData body as text");
12720       } else {
12721         return Promise.resolve(this._bodyText);
12722       }
12723     };
12724     if (support.formData) {
12725       this.formData = function() {
12726         return this.text().then(decode);
12727       };
12728     }
12729     this.json = function() {
12730       return this.text().then(JSON.parse);
12731     };
12732     return this;
12733   }
12734   var methods = ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"];
12735   function normalizeMethod(method) {
12736     var upcased = method.toUpperCase();
12737     return methods.indexOf(upcased) > -1 ? upcased : method;
12738   }
12739   function Request(input, options2) {
12740     if (!(this instanceof Request)) {
12741       throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
12742     }
12743     options2 = options2 || {};
12744     var body = options2.body;
12745     if (input instanceof Request) {
12746       if (input.bodyUsed) {
12747         throw new TypeError("Already read");
12748       }
12749       this.url = input.url;
12750       this.credentials = input.credentials;
12751       if (!options2.headers) {
12752         this.headers = new Headers(input.headers);
12753       }
12754       this.method = input.method;
12755       this.mode = input.mode;
12756       this.signal = input.signal;
12757       if (!body && input._bodyInit != null) {
12758         body = input._bodyInit;
12759         input.bodyUsed = true;
12760       }
12761     } else {
12762       this.url = String(input);
12763     }
12764     this.credentials = options2.credentials || this.credentials || "same-origin";
12765     if (options2.headers || !this.headers) {
12766       this.headers = new Headers(options2.headers);
12767     }
12768     this.method = normalizeMethod(options2.method || this.method || "GET");
12769     this.mode = options2.mode || this.mode || null;
12770     this.signal = options2.signal || this.signal || function() {
12771       if ("AbortController" in g) {
12772         var ctrl = new AbortController();
12773         return ctrl.signal;
12774       }
12775     }();
12776     this.referrer = null;
12777     if ((this.method === "GET" || this.method === "HEAD") && body) {
12778       throw new TypeError("Body not allowed for GET or HEAD requests");
12779     }
12780     this._initBody(body);
12781     if (this.method === "GET" || this.method === "HEAD") {
12782       if (options2.cache === "no-store" || options2.cache === "no-cache") {
12783         var reParamSearch = /([?&])_=[^&]*/;
12784         if (reParamSearch.test(this.url)) {
12785           this.url = this.url.replace(reParamSearch, "$1_=" + (/* @__PURE__ */ new Date()).getTime());
12786         } else {
12787           var reQueryString = /\?/;
12788           this.url += (reQueryString.test(this.url) ? "&" : "?") + "_=" + (/* @__PURE__ */ new Date()).getTime();
12789         }
12790       }
12791     }
12792   }
12793   Request.prototype.clone = function() {
12794     return new Request(this, { body: this._bodyInit });
12795   };
12796   function decode(body) {
12797     var form = new FormData();
12798     body.trim().split("&").forEach(function(bytes) {
12799       if (bytes) {
12800         var split = bytes.split("=");
12801         var name = split.shift().replace(/\+/g, " ");
12802         var value = split.join("=").replace(/\+/g, " ");
12803         form.append(decodeURIComponent(name), decodeURIComponent(value));
12804       }
12805     });
12806     return form;
12807   }
12808   function parseHeaders(rawHeaders) {
12809     var headers = new Headers();
12810     var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, " ");
12811     preProcessedHeaders.split("\r").map(function(header) {
12812       return header.indexOf("\n") === 0 ? header.substr(1, header.length) : header;
12813     }).forEach(function(line) {
12814       var parts = line.split(":");
12815       var key = parts.shift().trim();
12816       if (key) {
12817         var value = parts.join(":").trim();
12818         try {
12819           headers.append(key, value);
12820         } catch (error) {
12821           console.warn("Response " + error.message);
12822         }
12823       }
12824     });
12825     return headers;
12826   }
12827   Body.call(Request.prototype);
12828   function Response(bodyInit, options2) {
12829     if (!(this instanceof Response)) {
12830       throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
12831     }
12832     if (!options2) {
12833       options2 = {};
12834     }
12835     this.type = "default";
12836     this.status = options2.status === void 0 ? 200 : options2.status;
12837     if (this.status < 200 || this.status > 599) {
12838       throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");
12839     }
12840     this.ok = this.status >= 200 && this.status < 300;
12841     this.statusText = options2.statusText === void 0 ? "" : "" + options2.statusText;
12842     this.headers = new Headers(options2.headers);
12843     this.url = options2.url || "";
12844     this._initBody(bodyInit);
12845   }
12846   Body.call(Response.prototype);
12847   Response.prototype.clone = function() {
12848     return new Response(this._bodyInit, {
12849       status: this.status,
12850       statusText: this.statusText,
12851       headers: new Headers(this.headers),
12852       url: this.url
12853     });
12854   };
12855   Response.error = function() {
12856     var response = new Response(null, { status: 200, statusText: "" });
12857     response.ok = false;
12858     response.status = 0;
12859     response.type = "error";
12860     return response;
12861   };
12862   var redirectStatuses = [301, 302, 303, 307, 308];
12863   Response.redirect = function(url, status) {
12864     if (redirectStatuses.indexOf(status) === -1) {
12865       throw new RangeError("Invalid status code");
12866     }
12867     return new Response(null, { status, headers: { location: url } });
12868   };
12869   var DOMException2 = g.DOMException;
12870   try {
12871     new DOMException2();
12872   } catch (err) {
12873     DOMException2 = function(message, name) {
12874       this.message = message;
12875       this.name = name;
12876       var error = Error(message);
12877       this.stack = error.stack;
12878     };
12879     DOMException2.prototype = Object.create(Error.prototype);
12880     DOMException2.prototype.constructor = DOMException2;
12881   }
12882   function fetch2(input, init2) {
12883     return new Promise(function(resolve, reject) {
12884       var request3 = new Request(input, init2);
12885       if (request3.signal && request3.signal.aborted) {
12886         return reject(new DOMException2("Aborted", "AbortError"));
12887       }
12888       var xhr = new XMLHttpRequest();
12889       function abortXhr() {
12890         xhr.abort();
12891       }
12892       xhr.onload = function() {
12893         var options2 = {
12894           statusText: xhr.statusText,
12895           headers: parseHeaders(xhr.getAllResponseHeaders() || "")
12896         };
12897         if (request3.url.indexOf("file://") === 0 && (xhr.status < 200 || xhr.status > 599)) {
12898           options2.status = 200;
12899         } else {
12900           options2.status = xhr.status;
12901         }
12902         options2.url = "responseURL" in xhr ? xhr.responseURL : options2.headers.get("X-Request-URL");
12903         var body = "response" in xhr ? xhr.response : xhr.responseText;
12904         setTimeout(function() {
12905           resolve(new Response(body, options2));
12906         }, 0);
12907       };
12908       xhr.onerror = function() {
12909         setTimeout(function() {
12910           reject(new TypeError("Network request failed"));
12911         }, 0);
12912       };
12913       xhr.ontimeout = function() {
12914         setTimeout(function() {
12915           reject(new TypeError("Network request timed out"));
12916         }, 0);
12917       };
12918       xhr.onabort = function() {
12919         setTimeout(function() {
12920           reject(new DOMException2("Aborted", "AbortError"));
12921         }, 0);
12922       };
12923       function fixUrl(url) {
12924         try {
12925           return url === "" && g.location.href ? g.location.href : url;
12926         } catch (e3) {
12927           return url;
12928         }
12929       }
12930       xhr.open(request3.method, fixUrl(request3.url), true);
12931       if (request3.credentials === "include") {
12932         xhr.withCredentials = true;
12933       } else if (request3.credentials === "omit") {
12934         xhr.withCredentials = false;
12935       }
12936       if ("responseType" in xhr) {
12937         if (support.blob) {
12938           xhr.responseType = "blob";
12939         } else if (support.arrayBuffer) {
12940           xhr.responseType = "arraybuffer";
12941         }
12942       }
12943       if (init2 && typeof init2.headers === "object" && !(init2.headers instanceof Headers || g.Headers && init2.headers instanceof g.Headers)) {
12944         var names = [];
12945         Object.getOwnPropertyNames(init2.headers).forEach(function(name) {
12946           names.push(normalizeName(name));
12947           xhr.setRequestHeader(name, normalizeValue(init2.headers[name]));
12948         });
12949         request3.headers.forEach(function(value, name) {
12950           if (names.indexOf(name) === -1) {
12951             xhr.setRequestHeader(name, value);
12952           }
12953         });
12954       } else {
12955         request3.headers.forEach(function(value, name) {
12956           xhr.setRequestHeader(name, value);
12957         });
12958       }
12959       if (request3.signal) {
12960         request3.signal.addEventListener("abort", abortXhr);
12961         xhr.onreadystatechange = function() {
12962           if (xhr.readyState === 4) {
12963             request3.signal.removeEventListener("abort", abortXhr);
12964           }
12965         };
12966       }
12967       xhr.send(typeof request3._bodyInit === "undefined" ? null : request3._bodyInit);
12968     });
12969   }
12970   fetch2.polyfill = true;
12971   if (!g.fetch) {
12972     g.fetch = fetch2;
12973     g.Headers = Headers;
12974     g.Request = Request;
12975     g.Response = Response;
12976   }
12977
12978   // node_modules/abortcontroller-polyfill/dist/polyfill-patch-fetch.js
12979   (function(factory) {
12980     typeof define === "function" && define.amd ? define(factory) : factory();
12981   })(function() {
12982     "use strict";
12983     function _classCallCheck(instance, Constructor) {
12984       if (!(instance instanceof Constructor)) {
12985         throw new TypeError("Cannot call a class as a function");
12986       }
12987     }
12988     function _defineProperties(target, props) {
12989       for (var i3 = 0; i3 < props.length; i3++) {
12990         var descriptor = props[i3];
12991         descriptor.enumerable = descriptor.enumerable || false;
12992         descriptor.configurable = true;
12993         if ("value" in descriptor) descriptor.writable = true;
12994         Object.defineProperty(target, descriptor.key, descriptor);
12995       }
12996     }
12997     function _createClass(Constructor, protoProps, staticProps) {
12998       if (protoProps) _defineProperties(Constructor.prototype, protoProps);
12999       if (staticProps) _defineProperties(Constructor, staticProps);
13000       Object.defineProperty(Constructor, "prototype", {
13001         writable: false
13002       });
13003       return Constructor;
13004     }
13005     function _inherits(subClass, superClass) {
13006       if (typeof superClass !== "function" && superClass !== null) {
13007         throw new TypeError("Super expression must either be null or a function");
13008       }
13009       subClass.prototype = Object.create(superClass && superClass.prototype, {
13010         constructor: {
13011           value: subClass,
13012           writable: true,
13013           configurable: true
13014         }
13015       });
13016       Object.defineProperty(subClass, "prototype", {
13017         writable: false
13018       });
13019       if (superClass) _setPrototypeOf(subClass, superClass);
13020     }
13021     function _getPrototypeOf(o2) {
13022       _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o3) {
13023         return o3.__proto__ || Object.getPrototypeOf(o3);
13024       };
13025       return _getPrototypeOf(o2);
13026     }
13027     function _setPrototypeOf(o2, p2) {
13028       _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o3, p3) {
13029         o3.__proto__ = p3;
13030         return o3;
13031       };
13032       return _setPrototypeOf(o2, p2);
13033     }
13034     function _isNativeReflectConstruct() {
13035       if (typeof Reflect === "undefined" || !Reflect.construct) return false;
13036       if (Reflect.construct.sham) return false;
13037       if (typeof Proxy === "function") return true;
13038       try {
13039         Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
13040         }));
13041         return true;
13042       } catch (e3) {
13043         return false;
13044       }
13045     }
13046     function _assertThisInitialized(self2) {
13047       if (self2 === void 0) {
13048         throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
13049       }
13050       return self2;
13051     }
13052     function _possibleConstructorReturn(self2, call) {
13053       if (call && (typeof call === "object" || typeof call === "function")) {
13054         return call;
13055       } else if (call !== void 0) {
13056         throw new TypeError("Derived constructors may only return object or undefined");
13057       }
13058       return _assertThisInitialized(self2);
13059     }
13060     function _createSuper(Derived) {
13061       var hasNativeReflectConstruct = _isNativeReflectConstruct();
13062       return function _createSuperInternal() {
13063         var Super = _getPrototypeOf(Derived), result;
13064         if (hasNativeReflectConstruct) {
13065           var NewTarget = _getPrototypeOf(this).constructor;
13066           result = Reflect.construct(Super, arguments, NewTarget);
13067         } else {
13068           result = Super.apply(this, arguments);
13069         }
13070         return _possibleConstructorReturn(this, result);
13071       };
13072     }
13073     function _superPropBase(object, property) {
13074       while (!Object.prototype.hasOwnProperty.call(object, property)) {
13075         object = _getPrototypeOf(object);
13076         if (object === null) break;
13077       }
13078       return object;
13079     }
13080     function _get() {
13081       if (typeof Reflect !== "undefined" && Reflect.get) {
13082         _get = Reflect.get.bind();
13083       } else {
13084         _get = function _get2(target, property, receiver) {
13085           var base = _superPropBase(target, property);
13086           if (!base) return;
13087           var desc = Object.getOwnPropertyDescriptor(base, property);
13088           if (desc.get) {
13089             return desc.get.call(arguments.length < 3 ? target : receiver);
13090           }
13091           return desc.value;
13092         };
13093       }
13094       return _get.apply(this, arguments);
13095     }
13096     var Emitter = /* @__PURE__ */ function() {
13097       function Emitter2() {
13098         _classCallCheck(this, Emitter2);
13099         Object.defineProperty(this, "listeners", {
13100           value: {},
13101           writable: true,
13102           configurable: true
13103         });
13104       }
13105       _createClass(Emitter2, [{
13106         key: "addEventListener",
13107         value: function addEventListener(type2, callback, options2) {
13108           if (!(type2 in this.listeners)) {
13109             this.listeners[type2] = [];
13110           }
13111           this.listeners[type2].push({
13112             callback,
13113             options: options2
13114           });
13115         }
13116       }, {
13117         key: "removeEventListener",
13118         value: function removeEventListener(type2, callback) {
13119           if (!(type2 in this.listeners)) {
13120             return;
13121           }
13122           var stack = this.listeners[type2];
13123           for (var i3 = 0, l2 = stack.length; i3 < l2; i3++) {
13124             if (stack[i3].callback === callback) {
13125               stack.splice(i3, 1);
13126               return;
13127             }
13128           }
13129         }
13130       }, {
13131         key: "dispatchEvent",
13132         value: function dispatchEvent2(event) {
13133           if (!(event.type in this.listeners)) {
13134             return;
13135           }
13136           var stack = this.listeners[event.type];
13137           var stackToCall = stack.slice();
13138           for (var i3 = 0, l2 = stackToCall.length; i3 < l2; i3++) {
13139             var listener = stackToCall[i3];
13140             try {
13141               listener.callback.call(this, event);
13142             } catch (e3) {
13143               Promise.resolve().then(function() {
13144                 throw e3;
13145               });
13146             }
13147             if (listener.options && listener.options.once) {
13148               this.removeEventListener(event.type, listener.callback);
13149             }
13150           }
13151           return !event.defaultPrevented;
13152         }
13153       }]);
13154       return Emitter2;
13155     }();
13156     var AbortSignal = /* @__PURE__ */ function(_Emitter) {
13157       _inherits(AbortSignal2, _Emitter);
13158       var _super = _createSuper(AbortSignal2);
13159       function AbortSignal2() {
13160         var _this;
13161         _classCallCheck(this, AbortSignal2);
13162         _this = _super.call(this);
13163         if (!_this.listeners) {
13164           Emitter.call(_assertThisInitialized(_this));
13165         }
13166         Object.defineProperty(_assertThisInitialized(_this), "aborted", {
13167           value: false,
13168           writable: true,
13169           configurable: true
13170         });
13171         Object.defineProperty(_assertThisInitialized(_this), "onabort", {
13172           value: null,
13173           writable: true,
13174           configurable: true
13175         });
13176         Object.defineProperty(_assertThisInitialized(_this), "reason", {
13177           value: void 0,
13178           writable: true,
13179           configurable: true
13180         });
13181         return _this;
13182       }
13183       _createClass(AbortSignal2, [{
13184         key: "toString",
13185         value: function toString2() {
13186           return "[object AbortSignal]";
13187         }
13188       }, {
13189         key: "dispatchEvent",
13190         value: function dispatchEvent2(event) {
13191           if (event.type === "abort") {
13192             this.aborted = true;
13193             if (typeof this.onabort === "function") {
13194               this.onabort.call(this, event);
13195             }
13196           }
13197           _get(_getPrototypeOf(AbortSignal2.prototype), "dispatchEvent", this).call(this, event);
13198         }
13199       }]);
13200       return AbortSignal2;
13201     }(Emitter);
13202     var AbortController2 = /* @__PURE__ */ function() {
13203       function AbortController3() {
13204         _classCallCheck(this, AbortController3);
13205         Object.defineProperty(this, "signal", {
13206           value: new AbortSignal(),
13207           writable: true,
13208           configurable: true
13209         });
13210       }
13211       _createClass(AbortController3, [{
13212         key: "abort",
13213         value: function abort(reason) {
13214           var event;
13215           try {
13216             event = new Event("abort");
13217           } catch (e3) {
13218             if (typeof document !== "undefined") {
13219               if (!document.createEvent) {
13220                 event = document.createEventObject();
13221                 event.type = "abort";
13222               } else {
13223                 event = document.createEvent("Event");
13224                 event.initEvent("abort", false, false);
13225               }
13226             } else {
13227               event = {
13228                 type: "abort",
13229                 bubbles: false,
13230                 cancelable: false
13231               };
13232             }
13233           }
13234           var signalReason = reason;
13235           if (signalReason === void 0) {
13236             if (typeof document === "undefined") {
13237               signalReason = new Error("This operation was aborted");
13238               signalReason.name = "AbortError";
13239             } else {
13240               try {
13241                 signalReason = new DOMException("signal is aborted without reason");
13242               } catch (err) {
13243                 signalReason = new Error("This operation was aborted");
13244                 signalReason.name = "AbortError";
13245               }
13246             }
13247           }
13248           this.signal.reason = signalReason;
13249           this.signal.dispatchEvent(event);
13250         }
13251       }, {
13252         key: "toString",
13253         value: function toString2() {
13254           return "[object AbortController]";
13255         }
13256       }]);
13257       return AbortController3;
13258     }();
13259     if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
13260       AbortController2.prototype[Symbol.toStringTag] = "AbortController";
13261       AbortSignal.prototype[Symbol.toStringTag] = "AbortSignal";
13262     }
13263     function polyfillNeeded(self2) {
13264       if (self2.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
13265         console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill");
13266         return true;
13267       }
13268       return typeof self2.Request === "function" && !self2.Request.prototype.hasOwnProperty("signal") || !self2.AbortController;
13269     }
13270     function abortableFetchDecorator(patchTargets) {
13271       if ("function" === typeof patchTargets) {
13272         patchTargets = {
13273           fetch: patchTargets
13274         };
13275       }
13276       var _patchTargets = patchTargets, fetch3 = _patchTargets.fetch, _patchTargets$Request = _patchTargets.Request, NativeRequest = _patchTargets$Request === void 0 ? fetch3.Request : _patchTargets$Request, NativeAbortController = _patchTargets.AbortController, _patchTargets$__FORCE = _patchTargets.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL, __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL = _patchTargets$__FORCE === void 0 ? false : _patchTargets$__FORCE;
13277       if (!polyfillNeeded({
13278         fetch: fetch3,
13279         Request: NativeRequest,
13280         AbortController: NativeAbortController,
13281         __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL
13282       })) {
13283         return {
13284           fetch: fetch3,
13285           Request: Request2
13286         };
13287       }
13288       var Request2 = NativeRequest;
13289       if (Request2 && !Request2.prototype.hasOwnProperty("signal") || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
13290         Request2 = function Request3(input, init2) {
13291           var signal;
13292           if (init2 && init2.signal) {
13293             signal = init2.signal;
13294             delete init2.signal;
13295           }
13296           var request3 = new NativeRequest(input, init2);
13297           if (signal) {
13298             Object.defineProperty(request3, "signal", {
13299               writable: false,
13300               enumerable: false,
13301               configurable: true,
13302               value: signal
13303             });
13304           }
13305           return request3;
13306         };
13307         Request2.prototype = NativeRequest.prototype;
13308       }
13309       var realFetch = fetch3;
13310       var abortableFetch = function abortableFetch2(input, init2) {
13311         var signal = Request2 && Request2.prototype.isPrototypeOf(input) ? input.signal : init2 ? init2.signal : void 0;
13312         if (signal) {
13313           var abortError;
13314           try {
13315             abortError = new DOMException("Aborted", "AbortError");
13316           } catch (err) {
13317             abortError = new Error("Aborted");
13318             abortError.name = "AbortError";
13319           }
13320           if (signal.aborted) {
13321             return Promise.reject(abortError);
13322           }
13323           var cancellation = new Promise(function(_2, reject) {
13324             signal.addEventListener("abort", function() {
13325               return reject(abortError);
13326             }, {
13327               once: true
13328             });
13329           });
13330           if (init2 && init2.signal) {
13331             delete init2.signal;
13332           }
13333           return Promise.race([cancellation, realFetch(input, init2)]);
13334         }
13335         return realFetch(input, init2);
13336       };
13337       return {
13338         fetch: abortableFetch,
13339         Request: Request2
13340       };
13341     }
13342     (function(self2) {
13343       if (!polyfillNeeded(self2)) {
13344         return;
13345       }
13346       if (!self2.fetch) {
13347         console.warn("fetch() is not available, cannot install abortcontroller-polyfill");
13348         return;
13349       }
13350       var _abortableFetch = abortableFetchDecorator(self2), fetch3 = _abortableFetch.fetch, Request2 = _abortableFetch.Request;
13351       self2.fetch = fetch3;
13352       self2.Request = Request2;
13353       Object.defineProperty(self2, "AbortController", {
13354         writable: true,
13355         enumerable: false,
13356         configurable: true,
13357         value: AbortController2
13358       });
13359       Object.defineProperty(self2, "AbortSignal", {
13360         writable: true,
13361         enumerable: false,
13362         configurable: true,
13363         value: AbortSignal
13364       });
13365     })(typeof self !== "undefined" ? self : global);
13366   });
13367
13368   // modules/index.js
13369   var modules_exports = {};
13370   __export(modules_exports, {
13371     LANGUAGE_SUFFIX_REGEX: () => LANGUAGE_SUFFIX_REGEX,
13372     LocationManager: () => LocationManager,
13373     QAItem: () => QAItem,
13374     actionAddEntity: () => actionAddEntity,
13375     actionAddMember: () => actionAddMember,
13376     actionAddMidpoint: () => actionAddMidpoint,
13377     actionAddVertex: () => actionAddVertex,
13378     actionChangeMember: () => actionChangeMember,
13379     actionChangePreset: () => actionChangePreset,
13380     actionChangeTags: () => actionChangeTags,
13381     actionCircularize: () => actionCircularize,
13382     actionConnect: () => actionConnect,
13383     actionCopyEntities: () => actionCopyEntities,
13384     actionDeleteMember: () => actionDeleteMember,
13385     actionDeleteMultiple: () => actionDeleteMultiple,
13386     actionDeleteNode: () => actionDeleteNode,
13387     actionDeleteRelation: () => actionDeleteRelation,
13388     actionDeleteWay: () => actionDeleteWay,
13389     actionDiscardTags: () => actionDiscardTags,
13390     actionDisconnect: () => actionDisconnect,
13391     actionExtract: () => actionExtract,
13392     actionJoin: () => actionJoin,
13393     actionMerge: () => actionMerge,
13394     actionMergeNodes: () => actionMergeNodes,
13395     actionMergePolygon: () => actionMergePolygon,
13396     actionMergeRemoteChanges: () => actionMergeRemoteChanges,
13397     actionMove: () => actionMove,
13398     actionMoveMember: () => actionMoveMember,
13399     actionMoveNode: () => actionMoveNode,
13400     actionNoop: () => actionNoop,
13401     actionOrthogonalize: () => actionOrthogonalize,
13402     actionReflect: () => actionReflect,
13403     actionRestrictTurn: () => actionRestrictTurn,
13404     actionReverse: () => actionReverse,
13405     actionRevert: () => actionRevert,
13406     actionRotate: () => actionRotate,
13407     actionScale: () => actionScale,
13408     actionSplit: () => actionSplit,
13409     actionStraightenNodes: () => actionStraightenNodes,
13410     actionStraightenWay: () => actionStraightenWay,
13411     actionUnrestrictTurn: () => actionUnrestrictTurn,
13412     actionUpgradeTags: () => actionUpgradeTags,
13413     behaviorAddWay: () => behaviorAddWay,
13414     behaviorBreathe: () => behaviorBreathe,
13415     behaviorDrag: () => behaviorDrag,
13416     behaviorDraw: () => behaviorDraw,
13417     behaviorDrawWay: () => behaviorDrawWay,
13418     behaviorEdit: () => behaviorEdit,
13419     behaviorHash: () => behaviorHash,
13420     behaviorHover: () => behaviorHover,
13421     behaviorLasso: () => behaviorLasso,
13422     behaviorOperation: () => behaviorOperation,
13423     behaviorPaste: () => behaviorPaste,
13424     behaviorSelect: () => behaviorSelect,
13425     coreContext: () => coreContext,
13426     coreDifference: () => coreDifference,
13427     coreFileFetcher: () => coreFileFetcher,
13428     coreGraph: () => coreGraph,
13429     coreHistory: () => coreHistory,
13430     coreLocalizer: () => coreLocalizer,
13431     coreTree: () => coreTree,
13432     coreUploader: () => coreUploader,
13433     coreValidator: () => coreValidator,
13434     d3: () => d3,
13435     debug: () => debug,
13436     dmsCoordinatePair: () => dmsCoordinatePair,
13437     dmsMatcher: () => dmsMatcher,
13438     fileFetcher: () => _mainFileFetcher,
13439     geoAngle: () => geoAngle,
13440     geoChooseEdge: () => geoChooseEdge,
13441     geoEdgeEqual: () => geoEdgeEqual,
13442     geoExtent: () => geoExtent,
13443     geoGetSmallestSurroundingRectangle: () => geoGetSmallestSurroundingRectangle,
13444     geoHasLineIntersections: () => geoHasLineIntersections,
13445     geoHasSelfIntersections: () => geoHasSelfIntersections,
13446     geoLatToMeters: () => geoLatToMeters,
13447     geoLineIntersection: () => geoLineIntersection,
13448     geoLonToMeters: () => geoLonToMeters,
13449     geoMetersToLat: () => geoMetersToLat,
13450     geoMetersToLon: () => geoMetersToLon,
13451     geoMetersToOffset: () => geoMetersToOffset,
13452     geoOffsetToMeters: () => geoOffsetToMeters,
13453     geoOrthoCalcScore: () => geoOrthoCalcScore,
13454     geoOrthoCanOrthogonalize: () => geoOrthoCanOrthogonalize,
13455     geoOrthoMaxOffsetAngle: () => geoOrthoMaxOffsetAngle,
13456     geoOrthoNormalizedDotProduct: () => geoOrthoNormalizedDotProduct,
13457     geoPathHasIntersections: () => geoPathHasIntersections,
13458     geoPathIntersections: () => geoPathIntersections,
13459     geoPathLength: () => geoPathLength,
13460     geoPointInPolygon: () => geoPointInPolygon,
13461     geoPolygonContainsPolygon: () => geoPolygonContainsPolygon,
13462     geoPolygonIntersectsPolygon: () => geoPolygonIntersectsPolygon,
13463     geoRawMercator: () => geoRawMercator,
13464     geoRotate: () => geoRotate,
13465     geoScaleToZoom: () => geoScaleToZoom,
13466     geoSphericalClosestNode: () => geoSphericalClosestNode,
13467     geoSphericalDistance: () => geoSphericalDistance,
13468     geoVecAdd: () => geoVecAdd,
13469     geoVecAngle: () => geoVecAngle,
13470     geoVecCross: () => geoVecCross,
13471     geoVecDot: () => geoVecDot,
13472     geoVecEqual: () => geoVecEqual,
13473     geoVecFloor: () => geoVecFloor,
13474     geoVecInterp: () => geoVecInterp,
13475     geoVecLength: () => geoVecLength,
13476     geoVecLengthSquare: () => geoVecLengthSquare,
13477     geoVecNormalize: () => geoVecNormalize,
13478     geoVecNormalizedDot: () => geoVecNormalizedDot,
13479     geoVecProject: () => geoVecProject,
13480     geoVecScale: () => geoVecScale,
13481     geoVecSubtract: () => geoVecSubtract,
13482     geoViewportEdge: () => geoViewportEdge,
13483     geoZoomToScale: () => geoZoomToScale,
13484     likelyRawNumberFormat: () => likelyRawNumberFormat,
13485     localizer: () => _mainLocalizer,
13486     locationManager: () => _sharedLocationManager,
13487     modeAddArea: () => modeAddArea,
13488     modeAddLine: () => modeAddLine,
13489     modeAddNote: () => modeAddNote,
13490     modeAddPoint: () => modeAddPoint,
13491     modeBrowse: () => modeBrowse,
13492     modeDragNode: () => modeDragNode,
13493     modeDragNote: () => modeDragNote,
13494     modeDrawArea: () => modeDrawArea,
13495     modeDrawLine: () => modeDrawLine,
13496     modeMove: () => modeMove,
13497     modeRotate: () => modeRotate,
13498     modeSave: () => modeSave,
13499     modeSelect: () => modeSelect,
13500     modeSelectData: () => modeSelectData,
13501     modeSelectError: () => modeSelectError,
13502     modeSelectNote: () => modeSelectNote,
13503     operationCircularize: () => operationCircularize,
13504     operationContinue: () => operationContinue,
13505     operationCopy: () => operationCopy,
13506     operationDelete: () => operationDelete,
13507     operationDisconnect: () => operationDisconnect,
13508     operationDowngrade: () => operationDowngrade,
13509     operationExtract: () => operationExtract,
13510     operationMerge: () => operationMerge,
13511     operationMove: () => operationMove,
13512     operationOrthogonalize: () => operationOrthogonalize,
13513     operationPaste: () => operationPaste,
13514     operationReflectLong: () => operationReflectLong,
13515     operationReflectShort: () => operationReflectShort,
13516     operationReverse: () => operationReverse,
13517     operationRotate: () => operationRotate,
13518     operationSplit: () => operationSplit,
13519     operationStraighten: () => operationStraighten,
13520     osmAreaKeys: () => osmAreaKeys,
13521     osmChangeset: () => osmChangeset,
13522     osmEntity: () => osmEntity,
13523     osmFlowingWaterwayTagValues: () => osmFlowingWaterwayTagValues,
13524     osmInferRestriction: () => osmInferRestriction,
13525     osmIntersection: () => osmIntersection,
13526     osmIsInterestingTag: () => osmIsInterestingTag,
13527     osmJoinWays: () => osmJoinWays,
13528     osmLanes: () => osmLanes,
13529     osmLifecyclePrefixes: () => osmLifecyclePrefixes,
13530     osmNode: () => osmNode,
13531     osmNodeGeometriesForTags: () => osmNodeGeometriesForTags,
13532     osmNote: () => osmNote,
13533     osmOneWayTags: () => osmOneWayTags,
13534     osmPavedTags: () => osmPavedTags,
13535     osmPointTags: () => osmPointTags,
13536     osmRailwayTrackTagValues: () => osmRailwayTrackTagValues,
13537     osmRelation: () => osmRelation,
13538     osmRemoveLifecyclePrefix: () => osmRemoveLifecyclePrefix,
13539     osmRoutableHighwayTagValues: () => osmRoutableHighwayTagValues,
13540     osmSetAreaKeys: () => osmSetAreaKeys,
13541     osmSetPointTags: () => osmSetPointTags,
13542     osmSetVertexTags: () => osmSetVertexTags,
13543     osmTagSuggestingArea: () => osmTagSuggestingArea,
13544     osmTurn: () => osmTurn,
13545     osmVertexTags: () => osmVertexTags,
13546     osmWay: () => osmWay,
13547     prefs: () => corePreferences,
13548     presetCategory: () => presetCategory,
13549     presetCollection: () => presetCollection,
13550     presetField: () => presetField,
13551     presetIndex: () => presetIndex,
13552     presetManager: () => _mainPresetIndex,
13553     presetPreset: () => presetPreset,
13554     rendererBackground: () => rendererBackground,
13555     rendererBackgroundSource: () => rendererBackgroundSource,
13556     rendererFeatures: () => rendererFeatures,
13557     rendererMap: () => rendererMap,
13558     rendererPhotos: () => rendererPhotos,
13559     rendererTileLayer: () => rendererTileLayer,
13560     serviceKartaview: () => kartaview_default,
13561     serviceKeepRight: () => keepRight_default,
13562     serviceMapRules: () => maprules_default,
13563     serviceMapilio: () => mapilio_default,
13564     serviceMapillary: () => mapillary_default,
13565     serviceNominatim: () => nominatim_default,
13566     serviceNsi: () => nsi_default,
13567     serviceOsm: () => osm_default,
13568     serviceOsmWikibase: () => osm_wikibase_default,
13569     serviceOsmose: () => osmose_default,
13570     servicePanoramax: () => panoramax_default,
13571     serviceStreetside: () => streetside_default,
13572     serviceTaginfo: () => taginfo_default,
13573     serviceVectorTile: () => vector_tile_default,
13574     serviceVegbilder: () => vegbilder_default,
13575     serviceWikidata: () => wikidata_default,
13576     serviceWikipedia: () => wikipedia_default,
13577     services: () => services,
13578     svgAreas: () => svgAreas,
13579     svgData: () => svgData,
13580     svgDebug: () => svgDebug,
13581     svgDefs: () => svgDefs,
13582     svgGeolocate: () => svgGeolocate,
13583     svgIcon: () => svgIcon,
13584     svgKartaviewImages: () => svgKartaviewImages,
13585     svgKeepRight: () => svgKeepRight,
13586     svgLabels: () => svgLabels,
13587     svgLayers: () => svgLayers,
13588     svgLines: () => svgLines,
13589     svgMapilioImages: () => svgMapilioImages,
13590     svgMapillaryImages: () => svgMapillaryImages,
13591     svgMapillarySigns: () => svgMapillarySigns,
13592     svgMarkerSegments: () => svgMarkerSegments,
13593     svgMidpoints: () => svgMidpoints,
13594     svgNotes: () => svgNotes,
13595     svgOsm: () => svgOsm,
13596     svgPanoramaxImages: () => svgPanoramaxImages,
13597     svgPassiveVertex: () => svgPassiveVertex,
13598     svgPath: () => svgPath,
13599     svgPointTransform: () => svgPointTransform,
13600     svgPoints: () => svgPoints,
13601     svgRelationMemberTags: () => svgRelationMemberTags,
13602     svgSegmentWay: () => svgSegmentWay,
13603     svgStreetside: () => svgStreetside,
13604     svgTagClasses: () => svgTagClasses,
13605     svgTagPattern: () => svgTagPattern,
13606     svgTouch: () => svgTouch,
13607     svgTurns: () => svgTurns,
13608     svgVegbilder: () => svgVegbilder,
13609     svgVertices: () => svgVertices,
13610     t: () => _t,
13611     uiAccount: () => uiAccount,
13612     uiAttribution: () => uiAttribution,
13613     uiChangesetEditor: () => uiChangesetEditor,
13614     uiCmd: () => uiCmd,
13615     uiCombobox: () => uiCombobox,
13616     uiCommit: () => uiCommit,
13617     uiCommitWarnings: () => uiCommitWarnings,
13618     uiConfirm: () => uiConfirm,
13619     uiConflicts: () => uiConflicts,
13620     uiContributors: () => uiContributors,
13621     uiCurtain: () => uiCurtain,
13622     uiDataEditor: () => uiDataEditor,
13623     uiDataHeader: () => uiDataHeader,
13624     uiDisclosure: () => uiDisclosure,
13625     uiEditMenu: () => uiEditMenu,
13626     uiEntityEditor: () => uiEntityEditor,
13627     uiFeatureInfo: () => uiFeatureInfo,
13628     uiFeatureList: () => uiFeatureList,
13629     uiField: () => uiField,
13630     uiFieldAccess: () => uiFieldAccess,
13631     uiFieldAddress: () => uiFieldAddress,
13632     uiFieldCheck: () => uiFieldCheck,
13633     uiFieldColour: () => uiFieldText,
13634     uiFieldCombo: () => uiFieldCombo,
13635     uiFieldDefaultCheck: () => uiFieldCheck,
13636     uiFieldDirectionalCombo: () => uiFieldDirectionalCombo,
13637     uiFieldEmail: () => uiFieldText,
13638     uiFieldHelp: () => uiFieldHelp,
13639     uiFieldIdentifier: () => uiFieldText,
13640     uiFieldLanes: () => uiFieldLanes,
13641     uiFieldLocalized: () => uiFieldLocalized,
13642     uiFieldManyCombo: () => uiFieldCombo,
13643     uiFieldMultiCombo: () => uiFieldCombo,
13644     uiFieldNetworkCombo: () => uiFieldCombo,
13645     uiFieldNumber: () => uiFieldText,
13646     uiFieldOnewayCheck: () => uiFieldCheck,
13647     uiFieldRadio: () => uiFieldRadio,
13648     uiFieldRestrictions: () => uiFieldRestrictions,
13649     uiFieldRoadheight: () => uiFieldRoadheight,
13650     uiFieldRoadspeed: () => uiFieldRoadspeed,
13651     uiFieldSemiCombo: () => uiFieldCombo,
13652     uiFieldStructureRadio: () => uiFieldRadio,
13653     uiFieldTel: () => uiFieldText,
13654     uiFieldText: () => uiFieldText,
13655     uiFieldTextarea: () => uiFieldTextarea,
13656     uiFieldTypeCombo: () => uiFieldCombo,
13657     uiFieldUrl: () => uiFieldText,
13658     uiFieldWikidata: () => uiFieldWikidata,
13659     uiFieldWikipedia: () => uiFieldWikipedia,
13660     uiFields: () => uiFields,
13661     uiFlash: () => uiFlash,
13662     uiFormFields: () => uiFormFields,
13663     uiFullScreen: () => uiFullScreen,
13664     uiGeolocate: () => uiGeolocate,
13665     uiInfo: () => uiInfo,
13666     uiInfoPanels: () => uiInfoPanels,
13667     uiInit: () => uiInit,
13668     uiInspector: () => uiInspector,
13669     uiIntro: () => uiIntro,
13670     uiIssuesInfo: () => uiIssuesInfo,
13671     uiKeepRightDetails: () => uiKeepRightDetails,
13672     uiKeepRightEditor: () => uiKeepRightEditor,
13673     uiKeepRightHeader: () => uiKeepRightHeader,
13674     uiLasso: () => uiLasso,
13675     uiLengthIndicator: () => uiLengthIndicator,
13676     uiLoading: () => uiLoading,
13677     uiMapInMap: () => uiMapInMap,
13678     uiModal: () => uiModal,
13679     uiNoteComments: () => uiNoteComments,
13680     uiNoteEditor: () => uiNoteEditor,
13681     uiNoteHeader: () => uiNoteHeader,
13682     uiNoteReport: () => uiNoteReport,
13683     uiNotice: () => uiNotice,
13684     uiPaneBackground: () => uiPaneBackground,
13685     uiPaneHelp: () => uiPaneHelp,
13686     uiPaneIssues: () => uiPaneIssues,
13687     uiPaneMapData: () => uiPaneMapData,
13688     uiPanePreferences: () => uiPanePreferences,
13689     uiPanelBackground: () => uiPanelBackground,
13690     uiPanelHistory: () => uiPanelHistory,
13691     uiPanelLocation: () => uiPanelLocation,
13692     uiPanelMeasurement: () => uiPanelMeasurement,
13693     uiPopover: () => uiPopover,
13694     uiPresetIcon: () => uiPresetIcon,
13695     uiPresetList: () => uiPresetList,
13696     uiRestore: () => uiRestore,
13697     uiScale: () => uiScale,
13698     uiSectionBackgroundDisplayOptions: () => uiSectionBackgroundDisplayOptions,
13699     uiSectionBackgroundList: () => uiSectionBackgroundList,
13700     uiSectionBackgroundOffset: () => uiSectionBackgroundOffset,
13701     uiSectionChanges: () => uiSectionChanges,
13702     uiSectionDataLayers: () => uiSectionDataLayers,
13703     uiSectionEntityIssues: () => uiSectionEntityIssues,
13704     uiSectionFeatureType: () => uiSectionFeatureType,
13705     uiSectionMapFeatures: () => uiSectionMapFeatures,
13706     uiSectionMapStyleOptions: () => uiSectionMapStyleOptions,
13707     uiSectionOverlayList: () => uiSectionOverlayList,
13708     uiSectionPhotoOverlays: () => uiSectionPhotoOverlays,
13709     uiSectionPresetFields: () => uiSectionPresetFields,
13710     uiSectionPrivacy: () => uiSectionPrivacy,
13711     uiSectionRawMemberEditor: () => uiSectionRawMemberEditor,
13712     uiSectionRawMembershipEditor: () => uiSectionRawMembershipEditor,
13713     uiSectionRawTagEditor: () => uiSectionRawTagEditor,
13714     uiSectionSelectionList: () => uiSectionSelectionList,
13715     uiSectionValidationIssues: () => uiSectionValidationIssues,
13716     uiSectionValidationOptions: () => uiSectionValidationOptions,
13717     uiSectionValidationRules: () => uiSectionValidationRules,
13718     uiSectionValidationStatus: () => uiSectionValidationStatus,
13719     uiSettingsCustomBackground: () => uiSettingsCustomBackground,
13720     uiSettingsCustomData: () => uiSettingsCustomData,
13721     uiSidebar: () => uiSidebar,
13722     uiSourceSwitch: () => uiSourceSwitch,
13723     uiSpinner: () => uiSpinner,
13724     uiSplash: () => uiSplash,
13725     uiStatus: () => uiStatus,
13726     uiSuccess: () => uiSuccess,
13727     uiTagReference: () => uiTagReference,
13728     uiToggle: () => uiToggle,
13729     uiTooltip: () => uiTooltip,
13730     uiVersion: () => uiVersion,
13731     uiViewOnKeepRight: () => uiViewOnKeepRight,
13732     uiViewOnOSM: () => uiViewOnOSM,
13733     uiZoom: () => uiZoom,
13734     utilAesDecrypt: () => utilAesDecrypt,
13735     utilAesEncrypt: () => utilAesEncrypt,
13736     utilArrayChunk: () => utilArrayChunk,
13737     utilArrayDifference: () => utilArrayDifference,
13738     utilArrayFlatten: () => utilArrayFlatten,
13739     utilArrayGroupBy: () => utilArrayGroupBy,
13740     utilArrayIdentical: () => utilArrayIdentical,
13741     utilArrayIntersection: () => utilArrayIntersection,
13742     utilArrayUnion: () => utilArrayUnion,
13743     utilArrayUniq: () => utilArrayUniq,
13744     utilArrayUniqBy: () => utilArrayUniqBy,
13745     utilAsyncMap: () => utilAsyncMap,
13746     utilCleanOsmString: () => utilCleanOsmString,
13747     utilCleanTags: () => utilCleanTags,
13748     utilCombinedTags: () => utilCombinedTags,
13749     utilCompareIDs: () => utilCompareIDs,
13750     utilDeepMemberSelector: () => utilDeepMemberSelector,
13751     utilDetect: () => utilDetect,
13752     utilDisplayLabel: () => utilDisplayLabel,
13753     utilDisplayName: () => utilDisplayName,
13754     utilDisplayNameForPath: () => utilDisplayNameForPath,
13755     utilDisplayType: () => utilDisplayType,
13756     utilEditDistance: () => utilEditDistance,
13757     utilEntityAndDeepMemberIDs: () => utilEntityAndDeepMemberIDs,
13758     utilEntityOrDeepMemberSelector: () => utilEntityOrDeepMemberSelector,
13759     utilEntityOrMemberSelector: () => utilEntityOrMemberSelector,
13760     utilEntityRoot: () => utilEntityRoot,
13761     utilEntitySelector: () => utilEntitySelector,
13762     utilFastMouse: () => utilFastMouse,
13763     utilFunctor: () => utilFunctor,
13764     utilGetAllNodes: () => utilGetAllNodes,
13765     utilGetSetValue: () => utilGetSetValue,
13766     utilHashcode: () => utilHashcode,
13767     utilHighlightEntities: () => utilHighlightEntities,
13768     utilKeybinding: () => utilKeybinding,
13769     utilNoAuto: () => utilNoAuto,
13770     utilObjectOmit: () => utilObjectOmit,
13771     utilOldestID: () => utilOldestID,
13772     utilPrefixCSSProperty: () => utilPrefixCSSProperty,
13773     utilPrefixDOMProperty: () => utilPrefixDOMProperty,
13774     utilQsString: () => utilQsString,
13775     utilRebind: () => utilRebind,
13776     utilSafeClassName: () => utilSafeClassName,
13777     utilSessionMutex: () => utilSessionMutex,
13778     utilSetTransform: () => utilSetTransform,
13779     utilStringQs: () => utilStringQs,
13780     utilTagDiff: () => utilTagDiff,
13781     utilTagText: () => utilTagText,
13782     utilTiler: () => utilTiler,
13783     utilTotalExtent: () => utilTotalExtent,
13784     utilTriggerEvent: () => utilTriggerEvent,
13785     utilUnicodeCharsCount: () => utilUnicodeCharsCount,
13786     utilUnicodeCharsTruncated: () => utilUnicodeCharsTruncated,
13787     utilUniqueDomId: () => utilUniqueDomId,
13788     utilWrap: () => utilWrap,
13789     validationAlmostJunction: () => validationAlmostJunction,
13790     validationCloseNodes: () => validationCloseNodes,
13791     validationCrossingWays: () => validationCrossingWays,
13792     validationDisconnectedWay: () => validationDisconnectedWay,
13793     validationFormatting: () => validationFormatting,
13794     validationHelpRequest: () => validationHelpRequest,
13795     validationImpossibleOneway: () => validationImpossibleOneway,
13796     validationIncompatibleSource: () => validationIncompatibleSource,
13797     validationMaprules: () => validationMaprules,
13798     validationMismatchedGeometry: () => validationMismatchedGeometry,
13799     validationMissingRole: () => validationMissingRole,
13800     validationMissingTag: () => validationMissingTag,
13801     validationMutuallyExclusiveTags: () => validationMutuallyExclusiveTags,
13802     validationOutdatedTags: () => validationOutdatedTags,
13803     validationPrivateData: () => validationPrivateData,
13804     validationSuspiciousName: () => validationSuspiciousName,
13805     validationUnsquareWay: () => validationUnsquareWay
13806   });
13807
13808   // modules/actions/add_entity.js
13809   function actionAddEntity(way) {
13810     return function(graph) {
13811       return graph.replace(way);
13812     };
13813   }
13814
13815   // modules/actions/reverse.js
13816   function actionReverse(entityID, options2) {
13817     var ignoreKey = /^.*(_|:)?(description|name|note|website|ref|source|comment|watch|attribution)(_|:)?/;
13818     var numeric = /^([+\-]?)(?=[\d.])/;
13819     var directionKey = /direction$/;
13820     var turn_lanes = /^turn:lanes:?/;
13821     var keyReplacements = [
13822       [/:right$/, ":left"],
13823       [/:left$/, ":right"],
13824       [/:forward$/, ":backward"],
13825       [/:backward$/, ":forward"],
13826       [/:right:/, ":left:"],
13827       [/:left:/, ":right:"],
13828       [/:forward:/, ":backward:"],
13829       [/:backward:/, ":forward:"]
13830     ];
13831     var valueReplacements = {
13832       left: "right",
13833       right: "left",
13834       up: "down",
13835       down: "up",
13836       forward: "backward",
13837       backward: "forward",
13838       forwards: "backward",
13839       backwards: "forward"
13840     };
13841     const valueReplacementsExceptions = {
13842       "side": [
13843         { highway: "cyclist_waiting_aid" }
13844       ]
13845     };
13846     var roleReplacements = {
13847       forward: "backward",
13848       backward: "forward",
13849       forwards: "backward",
13850       backwards: "forward"
13851     };
13852     var onewayReplacements = {
13853       yes: "-1",
13854       "1": "-1",
13855       "-1": "yes"
13856     };
13857     var compassReplacements = {
13858       N: "S",
13859       NNE: "SSW",
13860       NE: "SW",
13861       ENE: "WSW",
13862       E: "W",
13863       ESE: "WNW",
13864       SE: "NW",
13865       SSE: "NNW",
13866       S: "N",
13867       SSW: "NNE",
13868       SW: "NE",
13869       WSW: "ENE",
13870       W: "E",
13871       WNW: "ESE",
13872       NW: "SE",
13873       NNW: "SSE"
13874     };
13875     function reverseKey(key) {
13876       for (var i3 = 0; i3 < keyReplacements.length; ++i3) {
13877         var replacement = keyReplacements[i3];
13878         if (replacement[0].test(key)) {
13879           return key.replace(replacement[0], replacement[1]);
13880         }
13881       }
13882       return key;
13883     }
13884     function reverseValue(key, value, includeAbsolute, allTags) {
13885       if (ignoreKey.test(key)) return value;
13886       if (turn_lanes.test(key)) {
13887         return value;
13888       } else if (key === "incline" && numeric.test(value)) {
13889         return value.replace(numeric, function(_2, sign2) {
13890           return sign2 === "-" ? "" : "-";
13891         });
13892       } else if (options2 && options2.reverseOneway && key === "oneway") {
13893         return onewayReplacements[value] || value;
13894       } else if (includeAbsolute && directionKey.test(key)) {
13895         return value.split(";").map((value2) => {
13896           if (compassReplacements[value2]) return compassReplacements[value2];
13897           var degrees3 = Number(value2);
13898           if (isFinite(degrees3)) {
13899             if (degrees3 < 180) {
13900               degrees3 += 180;
13901             } else {
13902               degrees3 -= 180;
13903             }
13904             return degrees3.toString();
13905           } else {
13906             return valueReplacements[value2] || value2;
13907           }
13908         }).join(";");
13909       }
13910       if (valueReplacementsExceptions[key] && valueReplacementsExceptions[key].some(
13911         (exceptionTags) => Object.keys(exceptionTags).every((k2) => {
13912           const v2 = exceptionTags[k2];
13913           return allTags[k2] && (v2 === "*" || allTags[k2] === v2);
13914         })
13915       )) {
13916         return value;
13917       }
13918       return valueReplacements[value] || value;
13919     }
13920     function reverseNodeTags(graph, nodeIDs) {
13921       for (var i3 = 0; i3 < nodeIDs.length; i3++) {
13922         var node = graph.hasEntity(nodeIDs[i3]);
13923         if (!node || !Object.keys(node.tags).length) continue;
13924         var tags = {};
13925         for (var key in node.tags) {
13926           tags[reverseKey(key)] = reverseValue(key, node.tags[key], node.id === entityID, node.tags);
13927         }
13928         graph = graph.replace(node.update({ tags }));
13929       }
13930       return graph;
13931     }
13932     function reverseWay(graph, way) {
13933       var nodes = way.nodes.slice().reverse();
13934       var tags = {};
13935       var role;
13936       for (var key in way.tags) {
13937         tags[reverseKey(key)] = reverseValue(key, way.tags[key], false, way.tags);
13938       }
13939       graph.parentRelations(way).forEach(function(relation) {
13940         relation.members.forEach(function(member, index) {
13941           if (member.id === way.id && (role = roleReplacements[member.role])) {
13942             relation = relation.updateMember({ role }, index);
13943             graph = graph.replace(relation);
13944           }
13945         });
13946       });
13947       return reverseNodeTags(graph, nodes).replace(way.update({ nodes, tags }));
13948     }
13949     var action = function(graph) {
13950       var entity = graph.entity(entityID);
13951       if (entity.type === "way") {
13952         return reverseWay(graph, entity);
13953       }
13954       return reverseNodeTags(graph, [entityID]);
13955     };
13956     action.disabled = function(graph) {
13957       var entity = graph.hasEntity(entityID);
13958       if (!entity || entity.type === "way") return false;
13959       for (var key in entity.tags) {
13960         var value = entity.tags[key];
13961         if (reverseKey(key) !== key || reverseValue(key, value, true, entity.tags) !== value) {
13962           return false;
13963         }
13964       }
13965       return "nondirectional_node";
13966     };
13967     action.entityID = function() {
13968       return entityID;
13969     };
13970     return action;
13971   }
13972
13973   // node_modules/d3-array/src/ascending.js
13974   function ascending(a2, b2) {
13975     return a2 == null || b2 == null ? NaN : a2 < b2 ? -1 : a2 > b2 ? 1 : a2 >= b2 ? 0 : NaN;
13976   }
13977
13978   // node_modules/d3-array/src/descending.js
13979   function descending(a2, b2) {
13980     return a2 == null || b2 == null ? NaN : b2 < a2 ? -1 : b2 > a2 ? 1 : b2 >= a2 ? 0 : NaN;
13981   }
13982
13983   // node_modules/d3-array/src/bisector.js
13984   function bisector(f2) {
13985     let compare1, compare2, delta;
13986     if (f2.length !== 2) {
13987       compare1 = ascending;
13988       compare2 = (d2, x2) => ascending(f2(d2), x2);
13989       delta = (d2, x2) => f2(d2) - x2;
13990     } else {
13991       compare1 = f2 === ascending || f2 === descending ? f2 : zero;
13992       compare2 = f2;
13993       delta = f2;
13994     }
13995     function left(a2, x2, lo = 0, hi = a2.length) {
13996       if (lo < hi) {
13997         if (compare1(x2, x2) !== 0) return hi;
13998         do {
13999           const mid = lo + hi >>> 1;
14000           if (compare2(a2[mid], x2) < 0) lo = mid + 1;
14001           else hi = mid;
14002         } while (lo < hi);
14003       }
14004       return lo;
14005     }
14006     function right(a2, x2, lo = 0, hi = a2.length) {
14007       if (lo < hi) {
14008         if (compare1(x2, x2) !== 0) return hi;
14009         do {
14010           const mid = lo + hi >>> 1;
14011           if (compare2(a2[mid], x2) <= 0) lo = mid + 1;
14012           else hi = mid;
14013         } while (lo < hi);
14014       }
14015       return lo;
14016     }
14017     function center(a2, x2, lo = 0, hi = a2.length) {
14018       const i3 = left(a2, x2, lo, hi - 1);
14019       return i3 > lo && delta(a2[i3 - 1], x2) > -delta(a2[i3], x2) ? i3 - 1 : i3;
14020     }
14021     return { left, center, right };
14022   }
14023   function zero() {
14024     return 0;
14025   }
14026
14027   // node_modules/d3-array/src/number.js
14028   function number(x2) {
14029     return x2 === null ? NaN : +x2;
14030   }
14031   function* numbers(values, valueof) {
14032     if (valueof === void 0) {
14033       for (let value of values) {
14034         if (value != null && (value = +value) >= value) {
14035           yield value;
14036         }
14037       }
14038     } else {
14039       let index = -1;
14040       for (let value of values) {
14041         if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
14042           yield value;
14043         }
14044       }
14045     }
14046   }
14047
14048   // node_modules/d3-array/src/bisect.js
14049   var ascendingBisect = bisector(ascending);
14050   var bisectRight = ascendingBisect.right;
14051   var bisectLeft = ascendingBisect.left;
14052   var bisectCenter = bisector(number).center;
14053   var bisect_default = bisectRight;
14054
14055   // node_modules/d3-array/src/fsum.js
14056   var Adder = class {
14057     constructor() {
14058       this._partials = new Float64Array(32);
14059       this._n = 0;
14060     }
14061     add(x2) {
14062       const p2 = this._partials;
14063       let i3 = 0;
14064       for (let j2 = 0; j2 < this._n && j2 < 32; j2++) {
14065         const y2 = p2[j2], hi = x2 + y2, lo = Math.abs(x2) < Math.abs(y2) ? x2 - (hi - y2) : y2 - (hi - x2);
14066         if (lo) p2[i3++] = lo;
14067         x2 = hi;
14068       }
14069       p2[i3] = x2;
14070       this._n = i3 + 1;
14071       return this;
14072     }
14073     valueOf() {
14074       const p2 = this._partials;
14075       let n3 = this._n, x2, y2, lo, hi = 0;
14076       if (n3 > 0) {
14077         hi = p2[--n3];
14078         while (n3 > 0) {
14079           x2 = hi;
14080           y2 = p2[--n3];
14081           hi = x2 + y2;
14082           lo = y2 - (hi - x2);
14083           if (lo) break;
14084         }
14085         if (n3 > 0 && (lo < 0 && p2[n3 - 1] < 0 || lo > 0 && p2[n3 - 1] > 0)) {
14086           y2 = lo * 2;
14087           x2 = hi + y2;
14088           if (y2 == x2 - hi) hi = x2;
14089         }
14090       }
14091       return hi;
14092     }
14093   };
14094
14095   // node_modules/d3-array/src/sort.js
14096   function compareDefined(compare2 = ascending) {
14097     if (compare2 === ascending) return ascendingDefined;
14098     if (typeof compare2 !== "function") throw new TypeError("compare is not a function");
14099     return (a2, b2) => {
14100       const x2 = compare2(a2, b2);
14101       if (x2 || x2 === 0) return x2;
14102       return (compare2(b2, b2) === 0) - (compare2(a2, a2) === 0);
14103     };
14104   }
14105   function ascendingDefined(a2, b2) {
14106     return (a2 == null || !(a2 >= a2)) - (b2 == null || !(b2 >= b2)) || (a2 < b2 ? -1 : a2 > b2 ? 1 : 0);
14107   }
14108
14109   // node_modules/d3-array/src/ticks.js
14110   var e10 = Math.sqrt(50);
14111   var e5 = Math.sqrt(10);
14112   var e2 = Math.sqrt(2);
14113   function ticks(start2, stop, count) {
14114     var reverse, i3 = -1, n3, ticks2, step;
14115     stop = +stop, start2 = +start2, count = +count;
14116     if (start2 === stop && count > 0) return [start2];
14117     if (reverse = stop < start2) n3 = start2, start2 = stop, stop = n3;
14118     if ((step = tickIncrement(start2, stop, count)) === 0 || !isFinite(step)) return [];
14119     if (step > 0) {
14120       let r0 = Math.round(start2 / step), r1 = Math.round(stop / step);
14121       if (r0 * step < start2) ++r0;
14122       if (r1 * step > stop) --r1;
14123       ticks2 = new Array(n3 = r1 - r0 + 1);
14124       while (++i3 < n3) ticks2[i3] = (r0 + i3) * step;
14125     } else {
14126       step = -step;
14127       let r0 = Math.round(start2 * step), r1 = Math.round(stop * step);
14128       if (r0 / step < start2) ++r0;
14129       if (r1 / step > stop) --r1;
14130       ticks2 = new Array(n3 = r1 - r0 + 1);
14131       while (++i3 < n3) ticks2[i3] = (r0 + i3) / step;
14132     }
14133     if (reverse) ticks2.reverse();
14134     return ticks2;
14135   }
14136   function tickIncrement(start2, stop, count) {
14137     var step = (stop - start2) / Math.max(0, count), power = Math.floor(Math.log(step) / Math.LN10), error = step / Math.pow(10, power);
14138     return power >= 0 ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power) : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1);
14139   }
14140   function tickStep(start2, stop, count) {
14141     var step0 = Math.abs(stop - start2) / Math.max(0, count), step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), error = step0 / step1;
14142     if (error >= e10) step1 *= 10;
14143     else if (error >= e5) step1 *= 5;
14144     else if (error >= e2) step1 *= 2;
14145     return stop < start2 ? -step1 : step1;
14146   }
14147
14148   // node_modules/d3-array/src/max.js
14149   function max(values, valueof) {
14150     let max3;
14151     if (valueof === void 0) {
14152       for (const value of values) {
14153         if (value != null && (max3 < value || max3 === void 0 && value >= value)) {
14154           max3 = value;
14155         }
14156       }
14157     } else {
14158       let index = -1;
14159       for (let value of values) {
14160         if ((value = valueof(value, ++index, values)) != null && (max3 < value || max3 === void 0 && value >= value)) {
14161           max3 = value;
14162         }
14163       }
14164     }
14165     return max3;
14166   }
14167
14168   // node_modules/d3-array/src/min.js
14169   function min(values, valueof) {
14170     let min3;
14171     if (valueof === void 0) {
14172       for (const value of values) {
14173         if (value != null && (min3 > value || min3 === void 0 && value >= value)) {
14174           min3 = value;
14175         }
14176       }
14177     } else {
14178       let index = -1;
14179       for (let value of values) {
14180         if ((value = valueof(value, ++index, values)) != null && (min3 > value || min3 === void 0 && value >= value)) {
14181           min3 = value;
14182         }
14183       }
14184     }
14185     return min3;
14186   }
14187
14188   // node_modules/d3-array/src/quickselect.js
14189   function quickselect(array2, k2, left = 0, right = array2.length - 1, compare2) {
14190     compare2 = compare2 === void 0 ? ascendingDefined : compareDefined(compare2);
14191     while (right > left) {
14192       if (right - left > 600) {
14193         const n3 = right - left + 1;
14194         const m2 = k2 - left + 1;
14195         const z2 = Math.log(n3);
14196         const s2 = 0.5 * Math.exp(2 * z2 / 3);
14197         const sd = 0.5 * Math.sqrt(z2 * s2 * (n3 - s2) / n3) * (m2 - n3 / 2 < 0 ? -1 : 1);
14198         const newLeft = Math.max(left, Math.floor(k2 - m2 * s2 / n3 + sd));
14199         const newRight = Math.min(right, Math.floor(k2 + (n3 - m2) * s2 / n3 + sd));
14200         quickselect(array2, k2, newLeft, newRight, compare2);
14201       }
14202       const t2 = array2[k2];
14203       let i3 = left;
14204       let j2 = right;
14205       swap(array2, left, k2);
14206       if (compare2(array2[right], t2) > 0) swap(array2, left, right);
14207       while (i3 < j2) {
14208         swap(array2, i3, j2), ++i3, --j2;
14209         while (compare2(array2[i3], t2) < 0) ++i3;
14210         while (compare2(array2[j2], t2) > 0) --j2;
14211       }
14212       if (compare2(array2[left], t2) === 0) swap(array2, left, j2);
14213       else ++j2, swap(array2, j2, right);
14214       if (j2 <= k2) left = j2 + 1;
14215       if (k2 <= j2) right = j2 - 1;
14216     }
14217     return array2;
14218   }
14219   function swap(array2, i3, j2) {
14220     const t2 = array2[i3];
14221     array2[i3] = array2[j2];
14222     array2[j2] = t2;
14223   }
14224
14225   // node_modules/d3-array/src/quantile.js
14226   function quantile(values, p2, valueof) {
14227     values = Float64Array.from(numbers(values, valueof));
14228     if (!(n3 = values.length)) return;
14229     if ((p2 = +p2) <= 0 || n3 < 2) return min(values);
14230     if (p2 >= 1) return max(values);
14231     var n3, i3 = (n3 - 1) * p2, i0 = Math.floor(i3), value0 = max(quickselect(values, i0).subarray(0, i0 + 1)), value1 = min(values.subarray(i0 + 1));
14232     return value0 + (value1 - value0) * (i3 - i0);
14233   }
14234
14235   // node_modules/d3-array/src/median.js
14236   function median(values, valueof) {
14237     return quantile(values, 0.5, valueof);
14238   }
14239
14240   // node_modules/d3-array/src/merge.js
14241   function* flatten(arrays) {
14242     for (const array2 of arrays) {
14243       yield* array2;
14244     }
14245   }
14246   function merge(arrays) {
14247     return Array.from(flatten(arrays));
14248   }
14249
14250   // node_modules/d3-array/src/pairs.js
14251   function pairs(values, pairof = pair) {
14252     const pairs2 = [];
14253     let previous;
14254     let first = false;
14255     for (const value of values) {
14256       if (first) pairs2.push(pairof(previous, value));
14257       previous = value;
14258       first = true;
14259     }
14260     return pairs2;
14261   }
14262   function pair(a2, b2) {
14263     return [a2, b2];
14264   }
14265
14266   // node_modules/d3-array/src/range.js
14267   function range(start2, stop, step) {
14268     start2 = +start2, stop = +stop, step = (n3 = arguments.length) < 2 ? (stop = start2, start2 = 0, 1) : n3 < 3 ? 1 : +step;
14269     var i3 = -1, n3 = Math.max(0, Math.ceil((stop - start2) / step)) | 0, range3 = new Array(n3);
14270     while (++i3 < n3) {
14271       range3[i3] = start2 + i3 * step;
14272     }
14273     return range3;
14274   }
14275
14276   // node_modules/d3-geo/src/math.js
14277   var epsilon = 1e-6;
14278   var epsilon2 = 1e-12;
14279   var pi = Math.PI;
14280   var halfPi = pi / 2;
14281   var quarterPi = pi / 4;
14282   var tau = pi * 2;
14283   var degrees = 180 / pi;
14284   var radians = pi / 180;
14285   var abs = Math.abs;
14286   var atan = Math.atan;
14287   var atan2 = Math.atan2;
14288   var cos = Math.cos;
14289   var exp = Math.exp;
14290   var log = Math.log;
14291   var sin = Math.sin;
14292   var sign = Math.sign || function(x2) {
14293     return x2 > 0 ? 1 : x2 < 0 ? -1 : 0;
14294   };
14295   var sqrt = Math.sqrt;
14296   var tan = Math.tan;
14297   function acos(x2) {
14298     return x2 > 1 ? 0 : x2 < -1 ? pi : Math.acos(x2);
14299   }
14300   function asin(x2) {
14301     return x2 > 1 ? halfPi : x2 < -1 ? -halfPi : Math.asin(x2);
14302   }
14303
14304   // node_modules/d3-geo/src/noop.js
14305   function noop() {
14306   }
14307
14308   // node_modules/d3-geo/src/stream.js
14309   function streamGeometry(geometry, stream) {
14310     if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) {
14311       streamGeometryType[geometry.type](geometry, stream);
14312     }
14313   }
14314   var streamObjectType = {
14315     Feature: function(object, stream) {
14316       streamGeometry(object.geometry, stream);
14317     },
14318     FeatureCollection: function(object, stream) {
14319       var features = object.features, i3 = -1, n3 = features.length;
14320       while (++i3 < n3) streamGeometry(features[i3].geometry, stream);
14321     }
14322   };
14323   var streamGeometryType = {
14324     Sphere: function(object, stream) {
14325       stream.sphere();
14326     },
14327     Point: function(object, stream) {
14328       object = object.coordinates;
14329       stream.point(object[0], object[1], object[2]);
14330     },
14331     MultiPoint: function(object, stream) {
14332       var coordinates = object.coordinates, i3 = -1, n3 = coordinates.length;
14333       while (++i3 < n3) object = coordinates[i3], stream.point(object[0], object[1], object[2]);
14334     },
14335     LineString: function(object, stream) {
14336       streamLine(object.coordinates, stream, 0);
14337     },
14338     MultiLineString: function(object, stream) {
14339       var coordinates = object.coordinates, i3 = -1, n3 = coordinates.length;
14340       while (++i3 < n3) streamLine(coordinates[i3], stream, 0);
14341     },
14342     Polygon: function(object, stream) {
14343       streamPolygon(object.coordinates, stream);
14344     },
14345     MultiPolygon: function(object, stream) {
14346       var coordinates = object.coordinates, i3 = -1, n3 = coordinates.length;
14347       while (++i3 < n3) streamPolygon(coordinates[i3], stream);
14348     },
14349     GeometryCollection: function(object, stream) {
14350       var geometries = object.geometries, i3 = -1, n3 = geometries.length;
14351       while (++i3 < n3) streamGeometry(geometries[i3], stream);
14352     }
14353   };
14354   function streamLine(coordinates, stream, closed) {
14355     var i3 = -1, n3 = coordinates.length - closed, coordinate;
14356     stream.lineStart();
14357     while (++i3 < n3) coordinate = coordinates[i3], stream.point(coordinate[0], coordinate[1], coordinate[2]);
14358     stream.lineEnd();
14359   }
14360   function streamPolygon(coordinates, stream) {
14361     var i3 = -1, n3 = coordinates.length;
14362     stream.polygonStart();
14363     while (++i3 < n3) streamLine(coordinates[i3], stream, 1);
14364     stream.polygonEnd();
14365   }
14366   function stream_default(object, stream) {
14367     if (object && streamObjectType.hasOwnProperty(object.type)) {
14368       streamObjectType[object.type](object, stream);
14369     } else {
14370       streamGeometry(object, stream);
14371     }
14372   }
14373
14374   // node_modules/d3-geo/src/area.js
14375   var areaRingSum = new Adder();
14376   var areaSum = new Adder();
14377   var lambda00;
14378   var phi00;
14379   var lambda0;
14380   var cosPhi0;
14381   var sinPhi0;
14382   var areaStream = {
14383     point: noop,
14384     lineStart: noop,
14385     lineEnd: noop,
14386     polygonStart: function() {
14387       areaRingSum = new Adder();
14388       areaStream.lineStart = areaRingStart;
14389       areaStream.lineEnd = areaRingEnd;
14390     },
14391     polygonEnd: function() {
14392       var areaRing = +areaRingSum;
14393       areaSum.add(areaRing < 0 ? tau + areaRing : areaRing);
14394       this.lineStart = this.lineEnd = this.point = noop;
14395     },
14396     sphere: function() {
14397       areaSum.add(tau);
14398     }
14399   };
14400   function areaRingStart() {
14401     areaStream.point = areaPointFirst;
14402   }
14403   function areaRingEnd() {
14404     areaPoint(lambda00, phi00);
14405   }
14406   function areaPointFirst(lambda, phi) {
14407     areaStream.point = areaPoint;
14408     lambda00 = lambda, phi00 = phi;
14409     lambda *= radians, phi *= radians;
14410     lambda0 = lambda, cosPhi0 = cos(phi = phi / 2 + quarterPi), sinPhi0 = sin(phi);
14411   }
14412   function areaPoint(lambda, phi) {
14413     lambda *= radians, phi *= radians;
14414     phi = phi / 2 + quarterPi;
14415     var dLambda = lambda - lambda0, sdLambda = dLambda >= 0 ? 1 : -1, adLambda = sdLambda * dLambda, cosPhi = cos(phi), sinPhi = sin(phi), k2 = sinPhi0 * sinPhi, u2 = cosPhi0 * cosPhi + k2 * cos(adLambda), v2 = k2 * sdLambda * sin(adLambda);
14416     areaRingSum.add(atan2(v2, u2));
14417     lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi;
14418   }
14419   function area_default(object) {
14420     areaSum = new Adder();
14421     stream_default(object, areaStream);
14422     return areaSum * 2;
14423   }
14424
14425   // node_modules/d3-geo/src/cartesian.js
14426   function spherical(cartesian2) {
14427     return [atan2(cartesian2[1], cartesian2[0]), asin(cartesian2[2])];
14428   }
14429   function cartesian(spherical2) {
14430     var lambda = spherical2[0], phi = spherical2[1], cosPhi = cos(phi);
14431     return [cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi)];
14432   }
14433   function cartesianDot(a2, b2) {
14434     return a2[0] * b2[0] + a2[1] * b2[1] + a2[2] * b2[2];
14435   }
14436   function cartesianCross(a2, b2) {
14437     return [a2[1] * b2[2] - a2[2] * b2[1], a2[2] * b2[0] - a2[0] * b2[2], a2[0] * b2[1] - a2[1] * b2[0]];
14438   }
14439   function cartesianAddInPlace(a2, b2) {
14440     a2[0] += b2[0], a2[1] += b2[1], a2[2] += b2[2];
14441   }
14442   function cartesianScale(vector, k2) {
14443     return [vector[0] * k2, vector[1] * k2, vector[2] * k2];
14444   }
14445   function cartesianNormalizeInPlace(d2) {
14446     var l2 = sqrt(d2[0] * d2[0] + d2[1] * d2[1] + d2[2] * d2[2]);
14447     d2[0] /= l2, d2[1] /= l2, d2[2] /= l2;
14448   }
14449
14450   // node_modules/d3-geo/src/bounds.js
14451   var lambda02;
14452   var phi0;
14453   var lambda1;
14454   var phi1;
14455   var lambda2;
14456   var lambda002;
14457   var phi002;
14458   var p0;
14459   var deltaSum;
14460   var ranges;
14461   var range2;
14462   var boundsStream = {
14463     point: boundsPoint,
14464     lineStart: boundsLineStart,
14465     lineEnd: boundsLineEnd,
14466     polygonStart: function() {
14467       boundsStream.point = boundsRingPoint;
14468       boundsStream.lineStart = boundsRingStart;
14469       boundsStream.lineEnd = boundsRingEnd;
14470       deltaSum = new Adder();
14471       areaStream.polygonStart();
14472     },
14473     polygonEnd: function() {
14474       areaStream.polygonEnd();
14475       boundsStream.point = boundsPoint;
14476       boundsStream.lineStart = boundsLineStart;
14477       boundsStream.lineEnd = boundsLineEnd;
14478       if (areaRingSum < 0) lambda02 = -(lambda1 = 180), phi0 = -(phi1 = 90);
14479       else if (deltaSum > epsilon) phi1 = 90;
14480       else if (deltaSum < -epsilon) phi0 = -90;
14481       range2[0] = lambda02, range2[1] = lambda1;
14482     },
14483     sphere: function() {
14484       lambda02 = -(lambda1 = 180), phi0 = -(phi1 = 90);
14485     }
14486   };
14487   function boundsPoint(lambda, phi) {
14488     ranges.push(range2 = [lambda02 = lambda, lambda1 = lambda]);
14489     if (phi < phi0) phi0 = phi;
14490     if (phi > phi1) phi1 = phi;
14491   }
14492   function linePoint(lambda, phi) {
14493     var p2 = cartesian([lambda * radians, phi * radians]);
14494     if (p0) {
14495       var normal = cartesianCross(p0, p2), equatorial = [normal[1], -normal[0], 0], inflection = cartesianCross(equatorial, normal);
14496       cartesianNormalizeInPlace(inflection);
14497       inflection = spherical(inflection);
14498       var delta = lambda - lambda2, sign2 = delta > 0 ? 1 : -1, lambdai = inflection[0] * degrees * sign2, phii, antimeridian = abs(delta) > 180;
14499       if (antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) {
14500         phii = inflection[1] * degrees;
14501         if (phii > phi1) phi1 = phii;
14502       } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) {
14503         phii = -inflection[1] * degrees;
14504         if (phii < phi0) phi0 = phii;
14505       } else {
14506         if (phi < phi0) phi0 = phi;
14507         if (phi > phi1) phi1 = phi;
14508       }
14509       if (antimeridian) {
14510         if (lambda < lambda2) {
14511           if (angle(lambda02, lambda) > angle(lambda02, lambda1)) lambda1 = lambda;
14512         } else {
14513           if (angle(lambda, lambda1) > angle(lambda02, lambda1)) lambda02 = lambda;
14514         }
14515       } else {
14516         if (lambda1 >= lambda02) {
14517           if (lambda < lambda02) lambda02 = lambda;
14518           if (lambda > lambda1) lambda1 = lambda;
14519         } else {
14520           if (lambda > lambda2) {
14521             if (angle(lambda02, lambda) > angle(lambda02, lambda1)) lambda1 = lambda;
14522           } else {
14523             if (angle(lambda, lambda1) > angle(lambda02, lambda1)) lambda02 = lambda;
14524           }
14525         }
14526       }
14527     } else {
14528       ranges.push(range2 = [lambda02 = lambda, lambda1 = lambda]);
14529     }
14530     if (phi < phi0) phi0 = phi;
14531     if (phi > phi1) phi1 = phi;
14532     p0 = p2, lambda2 = lambda;
14533   }
14534   function boundsLineStart() {
14535     boundsStream.point = linePoint;
14536   }
14537   function boundsLineEnd() {
14538     range2[0] = lambda02, range2[1] = lambda1;
14539     boundsStream.point = boundsPoint;
14540     p0 = null;
14541   }
14542   function boundsRingPoint(lambda, phi) {
14543     if (p0) {
14544       var delta = lambda - lambda2;
14545       deltaSum.add(abs(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta);
14546     } else {
14547       lambda002 = lambda, phi002 = phi;
14548     }
14549     areaStream.point(lambda, phi);
14550     linePoint(lambda, phi);
14551   }
14552   function boundsRingStart() {
14553     areaStream.lineStart();
14554   }
14555   function boundsRingEnd() {
14556     boundsRingPoint(lambda002, phi002);
14557     areaStream.lineEnd();
14558     if (abs(deltaSum) > epsilon) lambda02 = -(lambda1 = 180);
14559     range2[0] = lambda02, range2[1] = lambda1;
14560     p0 = null;
14561   }
14562   function angle(lambda04, lambda12) {
14563     return (lambda12 -= lambda04) < 0 ? lambda12 + 360 : lambda12;
14564   }
14565   function rangeCompare(a2, b2) {
14566     return a2[0] - b2[0];
14567   }
14568   function rangeContains(range3, x2) {
14569     return range3[0] <= range3[1] ? range3[0] <= x2 && x2 <= range3[1] : x2 < range3[0] || range3[1] < x2;
14570   }
14571   function bounds_default(feature3) {
14572     var i3, n3, a2, b2, merged, deltaMax, delta;
14573     phi1 = lambda1 = -(lambda02 = phi0 = Infinity);
14574     ranges = [];
14575     stream_default(feature3, boundsStream);
14576     if (n3 = ranges.length) {
14577       ranges.sort(rangeCompare);
14578       for (i3 = 1, a2 = ranges[0], merged = [a2]; i3 < n3; ++i3) {
14579         b2 = ranges[i3];
14580         if (rangeContains(a2, b2[0]) || rangeContains(a2, b2[1])) {
14581           if (angle(a2[0], b2[1]) > angle(a2[0], a2[1])) a2[1] = b2[1];
14582           if (angle(b2[0], a2[1]) > angle(a2[0], a2[1])) a2[0] = b2[0];
14583         } else {
14584           merged.push(a2 = b2);
14585         }
14586       }
14587       for (deltaMax = -Infinity, n3 = merged.length - 1, i3 = 0, a2 = merged[n3]; i3 <= n3; a2 = b2, ++i3) {
14588         b2 = merged[i3];
14589         if ((delta = angle(a2[1], b2[0])) > deltaMax) deltaMax = delta, lambda02 = b2[0], lambda1 = a2[1];
14590       }
14591     }
14592     ranges = range2 = null;
14593     return lambda02 === Infinity || phi0 === Infinity ? [[NaN, NaN], [NaN, NaN]] : [[lambda02, phi0], [lambda1, phi1]];
14594   }
14595
14596   // node_modules/d3-geo/src/compose.js
14597   function compose_default(a2, b2) {
14598     function compose(x2, y2) {
14599       return x2 = a2(x2, y2), b2(x2[0], x2[1]);
14600     }
14601     if (a2.invert && b2.invert) compose.invert = function(x2, y2) {
14602       return x2 = b2.invert(x2, y2), x2 && a2.invert(x2[0], x2[1]);
14603     };
14604     return compose;
14605   }
14606
14607   // node_modules/d3-geo/src/rotation.js
14608   function rotationIdentity(lambda, phi) {
14609     return [abs(lambda) > pi ? lambda + Math.round(-lambda / tau) * tau : lambda, phi];
14610   }
14611   rotationIdentity.invert = rotationIdentity;
14612   function rotateRadians(deltaLambda, deltaPhi, deltaGamma) {
14613     return (deltaLambda %= tau) ? deltaPhi || deltaGamma ? compose_default(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity;
14614   }
14615   function forwardRotationLambda(deltaLambda) {
14616     return function(lambda, phi) {
14617       return lambda += deltaLambda, [lambda > pi ? lambda - tau : lambda < -pi ? lambda + tau : lambda, phi];
14618     };
14619   }
14620   function rotationLambda(deltaLambda) {
14621     var rotation = forwardRotationLambda(deltaLambda);
14622     rotation.invert = forwardRotationLambda(-deltaLambda);
14623     return rotation;
14624   }
14625   function rotationPhiGamma(deltaPhi, deltaGamma) {
14626     var cosDeltaPhi = cos(deltaPhi), sinDeltaPhi = sin(deltaPhi), cosDeltaGamma = cos(deltaGamma), sinDeltaGamma = sin(deltaGamma);
14627     function rotation(lambda, phi) {
14628       var cosPhi = cos(phi), x2 = cos(lambda) * cosPhi, y2 = sin(lambda) * cosPhi, z2 = sin(phi), k2 = z2 * cosDeltaPhi + x2 * sinDeltaPhi;
14629       return [
14630         atan2(y2 * cosDeltaGamma - k2 * sinDeltaGamma, x2 * cosDeltaPhi - z2 * sinDeltaPhi),
14631         asin(k2 * cosDeltaGamma + y2 * sinDeltaGamma)
14632       ];
14633     }
14634     rotation.invert = function(lambda, phi) {
14635       var cosPhi = cos(phi), x2 = cos(lambda) * cosPhi, y2 = sin(lambda) * cosPhi, z2 = sin(phi), k2 = z2 * cosDeltaGamma - y2 * sinDeltaGamma;
14636       return [
14637         atan2(y2 * cosDeltaGamma + z2 * sinDeltaGamma, x2 * cosDeltaPhi + k2 * sinDeltaPhi),
14638         asin(k2 * cosDeltaPhi - x2 * sinDeltaPhi)
14639       ];
14640     };
14641     return rotation;
14642   }
14643   function rotation_default(rotate) {
14644     rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0);
14645     function forward(coordinates) {
14646       coordinates = rotate(coordinates[0] * radians, coordinates[1] * radians);
14647       return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;
14648     }
14649     forward.invert = function(coordinates) {
14650       coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians);
14651       return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;
14652     };
14653     return forward;
14654   }
14655
14656   // node_modules/d3-geo/src/circle.js
14657   function circleStream(stream, radius, delta, direction, t0, t1) {
14658     if (!delta) return;
14659     var cosRadius = cos(radius), sinRadius = sin(radius), step = direction * delta;
14660     if (t0 == null) {
14661       t0 = radius + direction * tau;
14662       t1 = radius - step / 2;
14663     } else {
14664       t0 = circleRadius(cosRadius, t0);
14665       t1 = circleRadius(cosRadius, t1);
14666       if (direction > 0 ? t0 < t1 : t0 > t1) t0 += direction * tau;
14667     }
14668     for (var point, t2 = t0; direction > 0 ? t2 > t1 : t2 < t1; t2 -= step) {
14669       point = spherical([cosRadius, -sinRadius * cos(t2), -sinRadius * sin(t2)]);
14670       stream.point(point[0], point[1]);
14671     }
14672   }
14673   function circleRadius(cosRadius, point) {
14674     point = cartesian(point), point[0] -= cosRadius;
14675     cartesianNormalizeInPlace(point);
14676     var radius = acos(-point[1]);
14677     return ((-point[2] < 0 ? -radius : radius) + tau - epsilon) % tau;
14678   }
14679
14680   // node_modules/d3-geo/src/clip/buffer.js
14681   function buffer_default() {
14682     var lines = [], line;
14683     return {
14684       point: function(x2, y2, m2) {
14685         line.push([x2, y2, m2]);
14686       },
14687       lineStart: function() {
14688         lines.push(line = []);
14689       },
14690       lineEnd: noop,
14691       rejoin: function() {
14692         if (lines.length > 1) lines.push(lines.pop().concat(lines.shift()));
14693       },
14694       result: function() {
14695         var result = lines;
14696         lines = [];
14697         line = null;
14698         return result;
14699       }
14700     };
14701   }
14702
14703   // node_modules/d3-geo/src/pointEqual.js
14704   function pointEqual_default(a2, b2) {
14705     return abs(a2[0] - b2[0]) < epsilon && abs(a2[1] - b2[1]) < epsilon;
14706   }
14707
14708   // node_modules/d3-geo/src/clip/rejoin.js
14709   function Intersection(point, points, other, entry) {
14710     this.x = point;
14711     this.z = points;
14712     this.o = other;
14713     this.e = entry;
14714     this.v = false;
14715     this.n = this.p = null;
14716   }
14717   function rejoin_default(segments, compareIntersection2, startInside, interpolate, stream) {
14718     var subject = [], clip = [], i3, n3;
14719     segments.forEach(function(segment) {
14720       if ((n4 = segment.length - 1) <= 0) return;
14721       var n4, p02 = segment[0], p1 = segment[n4], x2;
14722       if (pointEqual_default(p02, p1)) {
14723         if (!p02[2] && !p1[2]) {
14724           stream.lineStart();
14725           for (i3 = 0; i3 < n4; ++i3) stream.point((p02 = segment[i3])[0], p02[1]);
14726           stream.lineEnd();
14727           return;
14728         }
14729         p1[0] += 2 * epsilon;
14730       }
14731       subject.push(x2 = new Intersection(p02, segment, null, true));
14732       clip.push(x2.o = new Intersection(p02, null, x2, false));
14733       subject.push(x2 = new Intersection(p1, segment, null, false));
14734       clip.push(x2.o = new Intersection(p1, null, x2, true));
14735     });
14736     if (!subject.length) return;
14737     clip.sort(compareIntersection2);
14738     link(subject);
14739     link(clip);
14740     for (i3 = 0, n3 = clip.length; i3 < n3; ++i3) {
14741       clip[i3].e = startInside = !startInside;
14742     }
14743     var start2 = subject[0], points, point;
14744     while (1) {
14745       var current = start2, isSubject = true;
14746       while (current.v) if ((current = current.n) === start2) return;
14747       points = current.z;
14748       stream.lineStart();
14749       do {
14750         current.v = current.o.v = true;
14751         if (current.e) {
14752           if (isSubject) {
14753             for (i3 = 0, n3 = points.length; i3 < n3; ++i3) stream.point((point = points[i3])[0], point[1]);
14754           } else {
14755             interpolate(current.x, current.n.x, 1, stream);
14756           }
14757           current = current.n;
14758         } else {
14759           if (isSubject) {
14760             points = current.p.z;
14761             for (i3 = points.length - 1; i3 >= 0; --i3) stream.point((point = points[i3])[0], point[1]);
14762           } else {
14763             interpolate(current.x, current.p.x, -1, stream);
14764           }
14765           current = current.p;
14766         }
14767         current = current.o;
14768         points = current.z;
14769         isSubject = !isSubject;
14770       } while (!current.v);
14771       stream.lineEnd();
14772     }
14773   }
14774   function link(array2) {
14775     if (!(n3 = array2.length)) return;
14776     var n3, i3 = 0, a2 = array2[0], b2;
14777     while (++i3 < n3) {
14778       a2.n = b2 = array2[i3];
14779       b2.p = a2;
14780       a2 = b2;
14781     }
14782     a2.n = b2 = array2[0];
14783     b2.p = a2;
14784   }
14785
14786   // node_modules/d3-geo/src/polygonContains.js
14787   function longitude(point) {
14788     return abs(point[0]) <= pi ? point[0] : sign(point[0]) * ((abs(point[0]) + pi) % tau - pi);
14789   }
14790   function polygonContains_default(polygon2, point) {
14791     var lambda = longitude(point), phi = point[1], sinPhi = sin(phi), normal = [sin(lambda), -cos(lambda), 0], angle2 = 0, winding = 0;
14792     var sum = new Adder();
14793     if (sinPhi === 1) phi = halfPi + epsilon;
14794     else if (sinPhi === -1) phi = -halfPi - epsilon;
14795     for (var i3 = 0, n3 = polygon2.length; i3 < n3; ++i3) {
14796       if (!(m2 = (ring = polygon2[i3]).length)) continue;
14797       var ring, m2, point0 = ring[m2 - 1], lambda04 = longitude(point0), phi02 = point0[1] / 2 + quarterPi, sinPhi03 = sin(phi02), cosPhi03 = cos(phi02);
14798       for (var j2 = 0; j2 < m2; ++j2, lambda04 = lambda12, sinPhi03 = sinPhi1, cosPhi03 = cosPhi1, point0 = point1) {
14799         var point1 = ring[j2], lambda12 = longitude(point1), phi12 = point1[1] / 2 + quarterPi, sinPhi1 = sin(phi12), cosPhi1 = cos(phi12), delta = lambda12 - lambda04, sign2 = delta >= 0 ? 1 : -1, absDelta = sign2 * delta, antimeridian = absDelta > pi, k2 = sinPhi03 * sinPhi1;
14800         sum.add(atan2(k2 * sign2 * sin(absDelta), cosPhi03 * cosPhi1 + k2 * cos(absDelta)));
14801         angle2 += antimeridian ? delta + sign2 * tau : delta;
14802         if (antimeridian ^ lambda04 >= lambda ^ lambda12 >= lambda) {
14803           var arc = cartesianCross(cartesian(point0), cartesian(point1));
14804           cartesianNormalizeInPlace(arc);
14805           var intersection2 = cartesianCross(normal, arc);
14806           cartesianNormalizeInPlace(intersection2);
14807           var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection2[2]);
14808           if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) {
14809             winding += antimeridian ^ delta >= 0 ? 1 : -1;
14810           }
14811         }
14812       }
14813     }
14814     return (angle2 < -epsilon || angle2 < epsilon && sum < -epsilon2) ^ winding & 1;
14815   }
14816
14817   // node_modules/d3-geo/src/clip/index.js
14818   function clip_default(pointVisible, clipLine, interpolate, start2) {
14819     return function(sink) {
14820       var line = clipLine(sink), ringBuffer = buffer_default(), ringSink = clipLine(ringBuffer), polygonStarted = false, polygon2, segments, ring;
14821       var clip = {
14822         point,
14823         lineStart,
14824         lineEnd,
14825         polygonStart: function() {
14826           clip.point = pointRing;
14827           clip.lineStart = ringStart;
14828           clip.lineEnd = ringEnd;
14829           segments = [];
14830           polygon2 = [];
14831         },
14832         polygonEnd: function() {
14833           clip.point = point;
14834           clip.lineStart = lineStart;
14835           clip.lineEnd = lineEnd;
14836           segments = merge(segments);
14837           var startInside = polygonContains_default(polygon2, start2);
14838           if (segments.length) {
14839             if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
14840             rejoin_default(segments, compareIntersection, startInside, interpolate, sink);
14841           } else if (startInside) {
14842             if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
14843             sink.lineStart();
14844             interpolate(null, null, 1, sink);
14845             sink.lineEnd();
14846           }
14847           if (polygonStarted) sink.polygonEnd(), polygonStarted = false;
14848           segments = polygon2 = null;
14849         },
14850         sphere: function() {
14851           sink.polygonStart();
14852           sink.lineStart();
14853           interpolate(null, null, 1, sink);
14854           sink.lineEnd();
14855           sink.polygonEnd();
14856         }
14857       };
14858       function point(lambda, phi) {
14859         if (pointVisible(lambda, phi)) sink.point(lambda, phi);
14860       }
14861       function pointLine(lambda, phi) {
14862         line.point(lambda, phi);
14863       }
14864       function lineStart() {
14865         clip.point = pointLine;
14866         line.lineStart();
14867       }
14868       function lineEnd() {
14869         clip.point = point;
14870         line.lineEnd();
14871       }
14872       function pointRing(lambda, phi) {
14873         ring.push([lambda, phi]);
14874         ringSink.point(lambda, phi);
14875       }
14876       function ringStart() {
14877         ringSink.lineStart();
14878         ring = [];
14879       }
14880       function ringEnd() {
14881         pointRing(ring[0][0], ring[0][1]);
14882         ringSink.lineEnd();
14883         var clean2 = ringSink.clean(), ringSegments = ringBuffer.result(), i3, n3 = ringSegments.length, m2, segment, point2;
14884         ring.pop();
14885         polygon2.push(ring);
14886         ring = null;
14887         if (!n3) return;
14888         if (clean2 & 1) {
14889           segment = ringSegments[0];
14890           if ((m2 = segment.length - 1) > 0) {
14891             if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
14892             sink.lineStart();
14893             for (i3 = 0; i3 < m2; ++i3) sink.point((point2 = segment[i3])[0], point2[1]);
14894             sink.lineEnd();
14895           }
14896           return;
14897         }
14898         if (n3 > 1 && clean2 & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));
14899         segments.push(ringSegments.filter(validSegment));
14900       }
14901       return clip;
14902     };
14903   }
14904   function validSegment(segment) {
14905     return segment.length > 1;
14906   }
14907   function compareIntersection(a2, b2) {
14908     return ((a2 = a2.x)[0] < 0 ? a2[1] - halfPi - epsilon : halfPi - a2[1]) - ((b2 = b2.x)[0] < 0 ? b2[1] - halfPi - epsilon : halfPi - b2[1]);
14909   }
14910
14911   // node_modules/d3-geo/src/clip/antimeridian.js
14912   var antimeridian_default = clip_default(
14913     function() {
14914       return true;
14915     },
14916     clipAntimeridianLine,
14917     clipAntimeridianInterpolate,
14918     [-pi, -halfPi]
14919   );
14920   function clipAntimeridianLine(stream) {
14921     var lambda04 = NaN, phi02 = NaN, sign0 = NaN, clean2;
14922     return {
14923       lineStart: function() {
14924         stream.lineStart();
14925         clean2 = 1;
14926       },
14927       point: function(lambda12, phi12) {
14928         var sign1 = lambda12 > 0 ? pi : -pi, delta = abs(lambda12 - lambda04);
14929         if (abs(delta - pi) < epsilon) {
14930           stream.point(lambda04, phi02 = (phi02 + phi12) / 2 > 0 ? halfPi : -halfPi);
14931           stream.point(sign0, phi02);
14932           stream.lineEnd();
14933           stream.lineStart();
14934           stream.point(sign1, phi02);
14935           stream.point(lambda12, phi02);
14936           clean2 = 0;
14937         } else if (sign0 !== sign1 && delta >= pi) {
14938           if (abs(lambda04 - sign0) < epsilon) lambda04 -= sign0 * epsilon;
14939           if (abs(lambda12 - sign1) < epsilon) lambda12 -= sign1 * epsilon;
14940           phi02 = clipAntimeridianIntersect(lambda04, phi02, lambda12, phi12);
14941           stream.point(sign0, phi02);
14942           stream.lineEnd();
14943           stream.lineStart();
14944           stream.point(sign1, phi02);
14945           clean2 = 0;
14946         }
14947         stream.point(lambda04 = lambda12, phi02 = phi12);
14948         sign0 = sign1;
14949       },
14950       lineEnd: function() {
14951         stream.lineEnd();
14952         lambda04 = phi02 = NaN;
14953       },
14954       clean: function() {
14955         return 2 - clean2;
14956       }
14957     };
14958   }
14959   function clipAntimeridianIntersect(lambda04, phi02, lambda12, phi12) {
14960     var cosPhi03, cosPhi1, sinLambda0Lambda1 = sin(lambda04 - lambda12);
14961     return abs(sinLambda0Lambda1) > epsilon ? atan((sin(phi02) * (cosPhi1 = cos(phi12)) * sin(lambda12) - sin(phi12) * (cosPhi03 = cos(phi02)) * sin(lambda04)) / (cosPhi03 * cosPhi1 * sinLambda0Lambda1)) : (phi02 + phi12) / 2;
14962   }
14963   function clipAntimeridianInterpolate(from, to, direction, stream) {
14964     var phi;
14965     if (from == null) {
14966       phi = direction * halfPi;
14967       stream.point(-pi, phi);
14968       stream.point(0, phi);
14969       stream.point(pi, phi);
14970       stream.point(pi, 0);
14971       stream.point(pi, -phi);
14972       stream.point(0, -phi);
14973       stream.point(-pi, -phi);
14974       stream.point(-pi, 0);
14975       stream.point(-pi, phi);
14976     } else if (abs(from[0] - to[0]) > epsilon) {
14977       var lambda = from[0] < to[0] ? pi : -pi;
14978       phi = direction * lambda / 2;
14979       stream.point(-lambda, phi);
14980       stream.point(0, phi);
14981       stream.point(lambda, phi);
14982     } else {
14983       stream.point(to[0], to[1]);
14984     }
14985   }
14986
14987   // node_modules/d3-geo/src/clip/circle.js
14988   function circle_default(radius) {
14989     var cr = cos(radius), delta = 6 * radians, smallRadius = cr > 0, notHemisphere = abs(cr) > epsilon;
14990     function interpolate(from, to, direction, stream) {
14991       circleStream(stream, radius, delta, direction, from, to);
14992     }
14993     function visible(lambda, phi) {
14994       return cos(lambda) * cos(phi) > cr;
14995     }
14996     function clipLine(stream) {
14997       var point0, c0, v0, v00, clean2;
14998       return {
14999         lineStart: function() {
15000           v00 = v0 = false;
15001           clean2 = 1;
15002         },
15003         point: function(lambda, phi) {
15004           var point1 = [lambda, phi], point2, v2 = visible(lambda, phi), c2 = smallRadius ? v2 ? 0 : code(lambda, phi) : v2 ? code(lambda + (lambda < 0 ? pi : -pi), phi) : 0;
15005           if (!point0 && (v00 = v0 = v2)) stream.lineStart();
15006           if (v2 !== v0) {
15007             point2 = intersect2(point0, point1);
15008             if (!point2 || pointEqual_default(point0, point2) || pointEqual_default(point1, point2))
15009               point1[2] = 1;
15010           }
15011           if (v2 !== v0) {
15012             clean2 = 0;
15013             if (v2) {
15014               stream.lineStart();
15015               point2 = intersect2(point1, point0);
15016               stream.point(point2[0], point2[1]);
15017             } else {
15018               point2 = intersect2(point0, point1);
15019               stream.point(point2[0], point2[1], 2);
15020               stream.lineEnd();
15021             }
15022             point0 = point2;
15023           } else if (notHemisphere && point0 && smallRadius ^ v2) {
15024             var t2;
15025             if (!(c2 & c0) && (t2 = intersect2(point1, point0, true))) {
15026               clean2 = 0;
15027               if (smallRadius) {
15028                 stream.lineStart();
15029                 stream.point(t2[0][0], t2[0][1]);
15030                 stream.point(t2[1][0], t2[1][1]);
15031                 stream.lineEnd();
15032               } else {
15033                 stream.point(t2[1][0], t2[1][1]);
15034                 stream.lineEnd();
15035                 stream.lineStart();
15036                 stream.point(t2[0][0], t2[0][1], 3);
15037               }
15038             }
15039           }
15040           if (v2 && (!point0 || !pointEqual_default(point0, point1))) {
15041             stream.point(point1[0], point1[1]);
15042           }
15043           point0 = point1, v0 = v2, c0 = c2;
15044         },
15045         lineEnd: function() {
15046           if (v0) stream.lineEnd();
15047           point0 = null;
15048         },
15049         // Rejoin first and last segments if there were intersections and the first
15050         // and last points were visible.
15051         clean: function() {
15052           return clean2 | (v00 && v0) << 1;
15053         }
15054       };
15055     }
15056     function intersect2(a2, b2, two) {
15057       var pa = cartesian(a2), pb = cartesian(b2);
15058       var n1 = [1, 0, 0], n22 = cartesianCross(pa, pb), n2n2 = cartesianDot(n22, n22), n1n2 = n22[0], determinant = n2n2 - n1n2 * n1n2;
15059       if (!determinant) return !two && a2;
15060       var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = cartesianCross(n1, n22), A2 = cartesianScale(n1, c1), B2 = cartesianScale(n22, c2);
15061       cartesianAddInPlace(A2, B2);
15062       var u2 = n1xn2, w2 = cartesianDot(A2, u2), uu = cartesianDot(u2, u2), t2 = w2 * w2 - uu * (cartesianDot(A2, A2) - 1);
15063       if (t2 < 0) return;
15064       var t3 = sqrt(t2), q2 = cartesianScale(u2, (-w2 - t3) / uu);
15065       cartesianAddInPlace(q2, A2);
15066       q2 = spherical(q2);
15067       if (!two) return q2;
15068       var lambda04 = a2[0], lambda12 = b2[0], phi02 = a2[1], phi12 = b2[1], z2;
15069       if (lambda12 < lambda04) z2 = lambda04, lambda04 = lambda12, lambda12 = z2;
15070       var delta2 = lambda12 - lambda04, polar = abs(delta2 - pi) < epsilon, meridian = polar || delta2 < epsilon;
15071       if (!polar && phi12 < phi02) z2 = phi02, phi02 = phi12, phi12 = z2;
15072       if (meridian ? polar ? phi02 + phi12 > 0 ^ q2[1] < (abs(q2[0] - lambda04) < epsilon ? phi02 : phi12) : phi02 <= q2[1] && q2[1] <= phi12 : delta2 > pi ^ (lambda04 <= q2[0] && q2[0] <= lambda12)) {
15073         var q1 = cartesianScale(u2, (-w2 + t3) / uu);
15074         cartesianAddInPlace(q1, A2);
15075         return [q2, spherical(q1)];
15076       }
15077     }
15078     function code(lambda, phi) {
15079       var r2 = smallRadius ? radius : pi - radius, code2 = 0;
15080       if (lambda < -r2) code2 |= 1;
15081       else if (lambda > r2) code2 |= 2;
15082       if (phi < -r2) code2 |= 4;
15083       else if (phi > r2) code2 |= 8;
15084       return code2;
15085     }
15086     return clip_default(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi, radius - pi]);
15087   }
15088
15089   // node_modules/d3-geo/src/clip/line.js
15090   function line_default(a2, b2, x05, y05, x12, y12) {
15091     var ax = a2[0], ay = a2[1], bx = b2[0], by = b2[1], t0 = 0, t1 = 1, dx = bx - ax, dy = by - ay, r2;
15092     r2 = x05 - ax;
15093     if (!dx && r2 > 0) return;
15094     r2 /= dx;
15095     if (dx < 0) {
15096       if (r2 < t0) return;
15097       if (r2 < t1) t1 = r2;
15098     } else if (dx > 0) {
15099       if (r2 > t1) return;
15100       if (r2 > t0) t0 = r2;
15101     }
15102     r2 = x12 - ax;
15103     if (!dx && r2 < 0) return;
15104     r2 /= dx;
15105     if (dx < 0) {
15106       if (r2 > t1) return;
15107       if (r2 > t0) t0 = r2;
15108     } else if (dx > 0) {
15109       if (r2 < t0) return;
15110       if (r2 < t1) t1 = r2;
15111     }
15112     r2 = y05 - ay;
15113     if (!dy && r2 > 0) return;
15114     r2 /= dy;
15115     if (dy < 0) {
15116       if (r2 < t0) return;
15117       if (r2 < t1) t1 = r2;
15118     } else if (dy > 0) {
15119       if (r2 > t1) return;
15120       if (r2 > t0) t0 = r2;
15121     }
15122     r2 = y12 - ay;
15123     if (!dy && r2 < 0) return;
15124     r2 /= dy;
15125     if (dy < 0) {
15126       if (r2 > t1) return;
15127       if (r2 > t0) t0 = r2;
15128     } else if (dy > 0) {
15129       if (r2 < t0) return;
15130       if (r2 < t1) t1 = r2;
15131     }
15132     if (t0 > 0) a2[0] = ax + t0 * dx, a2[1] = ay + t0 * dy;
15133     if (t1 < 1) b2[0] = ax + t1 * dx, b2[1] = ay + t1 * dy;
15134     return true;
15135   }
15136
15137   // node_modules/d3-geo/src/clip/rectangle.js
15138   var clipMax = 1e9;
15139   var clipMin = -clipMax;
15140   function clipRectangle(x05, y05, x12, y12) {
15141     function visible(x2, y2) {
15142       return x05 <= x2 && x2 <= x12 && y05 <= y2 && y2 <= y12;
15143     }
15144     function interpolate(from, to, direction, stream) {
15145       var a2 = 0, a1 = 0;
15146       if (from == null || (a2 = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) {
15147         do
15148           stream.point(a2 === 0 || a2 === 3 ? x05 : x12, a2 > 1 ? y12 : y05);
15149         while ((a2 = (a2 + direction + 4) % 4) !== a1);
15150       } else {
15151         stream.point(to[0], to[1]);
15152       }
15153     }
15154     function corner(p2, direction) {
15155       return abs(p2[0] - x05) < epsilon ? direction > 0 ? 0 : 3 : abs(p2[0] - x12) < epsilon ? direction > 0 ? 2 : 1 : abs(p2[1] - y05) < epsilon ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2;
15156     }
15157     function compareIntersection2(a2, b2) {
15158       return comparePoint(a2.x, b2.x);
15159     }
15160     function comparePoint(a2, b2) {
15161       var ca = corner(a2, 1), cb = corner(b2, 1);
15162       return ca !== cb ? ca - cb : ca === 0 ? b2[1] - a2[1] : ca === 1 ? a2[0] - b2[0] : ca === 2 ? a2[1] - b2[1] : b2[0] - a2[0];
15163     }
15164     return function(stream) {
15165       var activeStream = stream, bufferStream = buffer_default(), segments, polygon2, ring, x__, y__, v__, x_, y_, v_, first, clean2;
15166       var clipStream = {
15167         point,
15168         lineStart,
15169         lineEnd,
15170         polygonStart,
15171         polygonEnd
15172       };
15173       function point(x2, y2) {
15174         if (visible(x2, y2)) activeStream.point(x2, y2);
15175       }
15176       function polygonInside() {
15177         var winding = 0;
15178         for (var i3 = 0, n3 = polygon2.length; i3 < n3; ++i3) {
15179           for (var ring2 = polygon2[i3], j2 = 1, m2 = ring2.length, point2 = ring2[0], a0, a1, b0 = point2[0], b1 = point2[1]; j2 < m2; ++j2) {
15180             a0 = b0, a1 = b1, point2 = ring2[j2], b0 = point2[0], b1 = point2[1];
15181             if (a1 <= y12) {
15182               if (b1 > y12 && (b0 - a0) * (y12 - a1) > (b1 - a1) * (x05 - a0)) ++winding;
15183             } else {
15184               if (b1 <= y12 && (b0 - a0) * (y12 - a1) < (b1 - a1) * (x05 - a0)) --winding;
15185             }
15186           }
15187         }
15188         return winding;
15189       }
15190       function polygonStart() {
15191         activeStream = bufferStream, segments = [], polygon2 = [], clean2 = true;
15192       }
15193       function polygonEnd() {
15194         var startInside = polygonInside(), cleanInside = clean2 && startInside, visible2 = (segments = merge(segments)).length;
15195         if (cleanInside || visible2) {
15196           stream.polygonStart();
15197           if (cleanInside) {
15198             stream.lineStart();
15199             interpolate(null, null, 1, stream);
15200             stream.lineEnd();
15201           }
15202           if (visible2) {
15203             rejoin_default(segments, compareIntersection2, startInside, interpolate, stream);
15204           }
15205           stream.polygonEnd();
15206         }
15207         activeStream = stream, segments = polygon2 = ring = null;
15208       }
15209       function lineStart() {
15210         clipStream.point = linePoint2;
15211         if (polygon2) polygon2.push(ring = []);
15212         first = true;
15213         v_ = false;
15214         x_ = y_ = NaN;
15215       }
15216       function lineEnd() {
15217         if (segments) {
15218           linePoint2(x__, y__);
15219           if (v__ && v_) bufferStream.rejoin();
15220           segments.push(bufferStream.result());
15221         }
15222         clipStream.point = point;
15223         if (v_) activeStream.lineEnd();
15224       }
15225       function linePoint2(x2, y2) {
15226         var v2 = visible(x2, y2);
15227         if (polygon2) ring.push([x2, y2]);
15228         if (first) {
15229           x__ = x2, y__ = y2, v__ = v2;
15230           first = false;
15231           if (v2) {
15232             activeStream.lineStart();
15233             activeStream.point(x2, y2);
15234           }
15235         } else {
15236           if (v2 && v_) activeStream.point(x2, y2);
15237           else {
15238             var a2 = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], b2 = [x2 = Math.max(clipMin, Math.min(clipMax, x2)), y2 = Math.max(clipMin, Math.min(clipMax, y2))];
15239             if (line_default(a2, b2, x05, y05, x12, y12)) {
15240               if (!v_) {
15241                 activeStream.lineStart();
15242                 activeStream.point(a2[0], a2[1]);
15243               }
15244               activeStream.point(b2[0], b2[1]);
15245               if (!v2) activeStream.lineEnd();
15246               clean2 = false;
15247             } else if (v2) {
15248               activeStream.lineStart();
15249               activeStream.point(x2, y2);
15250               clean2 = false;
15251             }
15252           }
15253         }
15254         x_ = x2, y_ = y2, v_ = v2;
15255       }
15256       return clipStream;
15257     };
15258   }
15259
15260   // node_modules/d3-geo/src/length.js
15261   var lengthSum;
15262   var lambda03;
15263   var sinPhi02;
15264   var cosPhi02;
15265   var lengthStream = {
15266     sphere: noop,
15267     point: noop,
15268     lineStart: lengthLineStart,
15269     lineEnd: noop,
15270     polygonStart: noop,
15271     polygonEnd: noop
15272   };
15273   function lengthLineStart() {
15274     lengthStream.point = lengthPointFirst;
15275     lengthStream.lineEnd = lengthLineEnd;
15276   }
15277   function lengthLineEnd() {
15278     lengthStream.point = lengthStream.lineEnd = noop;
15279   }
15280   function lengthPointFirst(lambda, phi) {
15281     lambda *= radians, phi *= radians;
15282     lambda03 = lambda, sinPhi02 = sin(phi), cosPhi02 = cos(phi);
15283     lengthStream.point = lengthPoint;
15284   }
15285   function lengthPoint(lambda, phi) {
15286     lambda *= radians, phi *= radians;
15287     var sinPhi = sin(phi), cosPhi = cos(phi), delta = abs(lambda - lambda03), cosDelta = cos(delta), sinDelta = sin(delta), x2 = cosPhi * sinDelta, y2 = cosPhi02 * sinPhi - sinPhi02 * cosPhi * cosDelta, z2 = sinPhi02 * sinPhi + cosPhi02 * cosPhi * cosDelta;
15288     lengthSum.add(atan2(sqrt(x2 * x2 + y2 * y2), z2));
15289     lambda03 = lambda, sinPhi02 = sinPhi, cosPhi02 = cosPhi;
15290   }
15291   function length_default(object) {
15292     lengthSum = new Adder();
15293     stream_default(object, lengthStream);
15294     return +lengthSum;
15295   }
15296
15297   // node_modules/d3-geo/src/identity.js
15298   var identity_default = (x2) => x2;
15299
15300   // node_modules/d3-geo/src/path/area.js
15301   var areaSum2 = new Adder();
15302   var areaRingSum2 = new Adder();
15303   var x00;
15304   var y00;
15305   var x0;
15306   var y0;
15307   var areaStream2 = {
15308     point: noop,
15309     lineStart: noop,
15310     lineEnd: noop,
15311     polygonStart: function() {
15312       areaStream2.lineStart = areaRingStart2;
15313       areaStream2.lineEnd = areaRingEnd2;
15314     },
15315     polygonEnd: function() {
15316       areaStream2.lineStart = areaStream2.lineEnd = areaStream2.point = noop;
15317       areaSum2.add(abs(areaRingSum2));
15318       areaRingSum2 = new Adder();
15319     },
15320     result: function() {
15321       var area = areaSum2 / 2;
15322       areaSum2 = new Adder();
15323       return area;
15324     }
15325   };
15326   function areaRingStart2() {
15327     areaStream2.point = areaPointFirst2;
15328   }
15329   function areaPointFirst2(x2, y2) {
15330     areaStream2.point = areaPoint2;
15331     x00 = x0 = x2, y00 = y0 = y2;
15332   }
15333   function areaPoint2(x2, y2) {
15334     areaRingSum2.add(y0 * x2 - x0 * y2);
15335     x0 = x2, y0 = y2;
15336   }
15337   function areaRingEnd2() {
15338     areaPoint2(x00, y00);
15339   }
15340   var area_default2 = areaStream2;
15341
15342   // node_modules/d3-geo/src/path/bounds.js
15343   var x02 = Infinity;
15344   var y02 = x02;
15345   var x1 = -x02;
15346   var y1 = x1;
15347   var boundsStream2 = {
15348     point: boundsPoint2,
15349     lineStart: noop,
15350     lineEnd: noop,
15351     polygonStart: noop,
15352     polygonEnd: noop,
15353     result: function() {
15354       var bounds = [[x02, y02], [x1, y1]];
15355       x1 = y1 = -(y02 = x02 = Infinity);
15356       return bounds;
15357     }
15358   };
15359   function boundsPoint2(x2, y2) {
15360     if (x2 < x02) x02 = x2;
15361     if (x2 > x1) x1 = x2;
15362     if (y2 < y02) y02 = y2;
15363     if (y2 > y1) y1 = y2;
15364   }
15365   var bounds_default2 = boundsStream2;
15366
15367   // node_modules/d3-geo/src/path/centroid.js
15368   var X0 = 0;
15369   var Y0 = 0;
15370   var Z0 = 0;
15371   var X1 = 0;
15372   var Y1 = 0;
15373   var Z1 = 0;
15374   var X2 = 0;
15375   var Y2 = 0;
15376   var Z2 = 0;
15377   var x002;
15378   var y002;
15379   var x03;
15380   var y03;
15381   var centroidStream = {
15382     point: centroidPoint,
15383     lineStart: centroidLineStart,
15384     lineEnd: centroidLineEnd,
15385     polygonStart: function() {
15386       centroidStream.lineStart = centroidRingStart;
15387       centroidStream.lineEnd = centroidRingEnd;
15388     },
15389     polygonEnd: function() {
15390       centroidStream.point = centroidPoint;
15391       centroidStream.lineStart = centroidLineStart;
15392       centroidStream.lineEnd = centroidLineEnd;
15393     },
15394     result: function() {
15395       var centroid = Z2 ? [X2 / Z2, Y2 / Z2] : Z1 ? [X1 / Z1, Y1 / Z1] : Z0 ? [X0 / Z0, Y0 / Z0] : [NaN, NaN];
15396       X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0;
15397       return centroid;
15398     }
15399   };
15400   function centroidPoint(x2, y2) {
15401     X0 += x2;
15402     Y0 += y2;
15403     ++Z0;
15404   }
15405   function centroidLineStart() {
15406     centroidStream.point = centroidPointFirstLine;
15407   }
15408   function centroidPointFirstLine(x2, y2) {
15409     centroidStream.point = centroidPointLine;
15410     centroidPoint(x03 = x2, y03 = y2);
15411   }
15412   function centroidPointLine(x2, y2) {
15413     var dx = x2 - x03, dy = y2 - y03, z2 = sqrt(dx * dx + dy * dy);
15414     X1 += z2 * (x03 + x2) / 2;
15415     Y1 += z2 * (y03 + y2) / 2;
15416     Z1 += z2;
15417     centroidPoint(x03 = x2, y03 = y2);
15418   }
15419   function centroidLineEnd() {
15420     centroidStream.point = centroidPoint;
15421   }
15422   function centroidRingStart() {
15423     centroidStream.point = centroidPointFirstRing;
15424   }
15425   function centroidRingEnd() {
15426     centroidPointRing(x002, y002);
15427   }
15428   function centroidPointFirstRing(x2, y2) {
15429     centroidStream.point = centroidPointRing;
15430     centroidPoint(x002 = x03 = x2, y002 = y03 = y2);
15431   }
15432   function centroidPointRing(x2, y2) {
15433     var dx = x2 - x03, dy = y2 - y03, z2 = sqrt(dx * dx + dy * dy);
15434     X1 += z2 * (x03 + x2) / 2;
15435     Y1 += z2 * (y03 + y2) / 2;
15436     Z1 += z2;
15437     z2 = y03 * x2 - x03 * y2;
15438     X2 += z2 * (x03 + x2);
15439     Y2 += z2 * (y03 + y2);
15440     Z2 += z2 * 3;
15441     centroidPoint(x03 = x2, y03 = y2);
15442   }
15443   var centroid_default = centroidStream;
15444
15445   // node_modules/d3-geo/src/path/context.js
15446   function PathContext(context) {
15447     this._context = context;
15448   }
15449   PathContext.prototype = {
15450     _radius: 4.5,
15451     pointRadius: function(_2) {
15452       return this._radius = _2, this;
15453     },
15454     polygonStart: function() {
15455       this._line = 0;
15456     },
15457     polygonEnd: function() {
15458       this._line = NaN;
15459     },
15460     lineStart: function() {
15461       this._point = 0;
15462     },
15463     lineEnd: function() {
15464       if (this._line === 0) this._context.closePath();
15465       this._point = NaN;
15466     },
15467     point: function(x2, y2) {
15468       switch (this._point) {
15469         case 0: {
15470           this._context.moveTo(x2, y2);
15471           this._point = 1;
15472           break;
15473         }
15474         case 1: {
15475           this._context.lineTo(x2, y2);
15476           break;
15477         }
15478         default: {
15479           this._context.moveTo(x2 + this._radius, y2);
15480           this._context.arc(x2, y2, this._radius, 0, tau);
15481           break;
15482         }
15483       }
15484     },
15485     result: noop
15486   };
15487
15488   // node_modules/d3-geo/src/path/measure.js
15489   var lengthSum2 = new Adder();
15490   var lengthRing;
15491   var x003;
15492   var y003;
15493   var x04;
15494   var y04;
15495   var lengthStream2 = {
15496     point: noop,
15497     lineStart: function() {
15498       lengthStream2.point = lengthPointFirst2;
15499     },
15500     lineEnd: function() {
15501       if (lengthRing) lengthPoint2(x003, y003);
15502       lengthStream2.point = noop;
15503     },
15504     polygonStart: function() {
15505       lengthRing = true;
15506     },
15507     polygonEnd: function() {
15508       lengthRing = null;
15509     },
15510     result: function() {
15511       var length2 = +lengthSum2;
15512       lengthSum2 = new Adder();
15513       return length2;
15514     }
15515   };
15516   function lengthPointFirst2(x2, y2) {
15517     lengthStream2.point = lengthPoint2;
15518     x003 = x04 = x2, y003 = y04 = y2;
15519   }
15520   function lengthPoint2(x2, y2) {
15521     x04 -= x2, y04 -= y2;
15522     lengthSum2.add(sqrt(x04 * x04 + y04 * y04));
15523     x04 = x2, y04 = y2;
15524   }
15525   var measure_default = lengthStream2;
15526
15527   // node_modules/d3-geo/src/path/string.js
15528   function PathString() {
15529     this._string = [];
15530   }
15531   PathString.prototype = {
15532     _radius: 4.5,
15533     _circle: circle(4.5),
15534     pointRadius: function(_2) {
15535       if ((_2 = +_2) !== this._radius) this._radius = _2, this._circle = null;
15536       return this;
15537     },
15538     polygonStart: function() {
15539       this._line = 0;
15540     },
15541     polygonEnd: function() {
15542       this._line = NaN;
15543     },
15544     lineStart: function() {
15545       this._point = 0;
15546     },
15547     lineEnd: function() {
15548       if (this._line === 0) this._string.push("Z");
15549       this._point = NaN;
15550     },
15551     point: function(x2, y2) {
15552       switch (this._point) {
15553         case 0: {
15554           this._string.push("M", x2, ",", y2);
15555           this._point = 1;
15556           break;
15557         }
15558         case 1: {
15559           this._string.push("L", x2, ",", y2);
15560           break;
15561         }
15562         default: {
15563           if (this._circle == null) this._circle = circle(this._radius);
15564           this._string.push("M", x2, ",", y2, this._circle);
15565           break;
15566         }
15567       }
15568     },
15569     result: function() {
15570       if (this._string.length) {
15571         var result = this._string.join("");
15572         this._string = [];
15573         return result;
15574       } else {
15575         return null;
15576       }
15577     }
15578   };
15579   function circle(radius) {
15580     return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius + "z";
15581   }
15582
15583   // node_modules/d3-geo/src/path/index.js
15584   function path_default(projection2, context) {
15585     var pointRadius = 4.5, projectionStream, contextStream;
15586     function path(object) {
15587       if (object) {
15588         if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments));
15589         stream_default(object, projectionStream(contextStream));
15590       }
15591       return contextStream.result();
15592     }
15593     path.area = function(object) {
15594       stream_default(object, projectionStream(area_default2));
15595       return area_default2.result();
15596     };
15597     path.measure = function(object) {
15598       stream_default(object, projectionStream(measure_default));
15599       return measure_default.result();
15600     };
15601     path.bounds = function(object) {
15602       stream_default(object, projectionStream(bounds_default2));
15603       return bounds_default2.result();
15604     };
15605     path.centroid = function(object) {
15606       stream_default(object, projectionStream(centroid_default));
15607       return centroid_default.result();
15608     };
15609     path.projection = function(_2) {
15610       return arguments.length ? (projectionStream = _2 == null ? (projection2 = null, identity_default) : (projection2 = _2).stream, path) : projection2;
15611     };
15612     path.context = function(_2) {
15613       if (!arguments.length) return context;
15614       contextStream = _2 == null ? (context = null, new PathString()) : new PathContext(context = _2);
15615       if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius);
15616       return path;
15617     };
15618     path.pointRadius = function(_2) {
15619       if (!arguments.length) return pointRadius;
15620       pointRadius = typeof _2 === "function" ? _2 : (contextStream.pointRadius(+_2), +_2);
15621       return path;
15622     };
15623     return path.projection(projection2).context(context);
15624   }
15625
15626   // node_modules/d3-geo/src/transform.js
15627   function transform_default(methods2) {
15628     return {
15629       stream: transformer(methods2)
15630     };
15631   }
15632   function transformer(methods2) {
15633     return function(stream) {
15634       var s2 = new TransformStream();
15635       for (var key in methods2) s2[key] = methods2[key];
15636       s2.stream = stream;
15637       return s2;
15638     };
15639   }
15640   function TransformStream() {
15641   }
15642   TransformStream.prototype = {
15643     constructor: TransformStream,
15644     point: function(x2, y2) {
15645       this.stream.point(x2, y2);
15646     },
15647     sphere: function() {
15648       this.stream.sphere();
15649     },
15650     lineStart: function() {
15651       this.stream.lineStart();
15652     },
15653     lineEnd: function() {
15654       this.stream.lineEnd();
15655     },
15656     polygonStart: function() {
15657       this.stream.polygonStart();
15658     },
15659     polygonEnd: function() {
15660       this.stream.polygonEnd();
15661     }
15662   };
15663
15664   // node_modules/d3-geo/src/projection/fit.js
15665   function fit(projection2, fitBounds, object) {
15666     var clip = projection2.clipExtent && projection2.clipExtent();
15667     projection2.scale(150).translate([0, 0]);
15668     if (clip != null) projection2.clipExtent(null);
15669     stream_default(object, projection2.stream(bounds_default2));
15670     fitBounds(bounds_default2.result());
15671     if (clip != null) projection2.clipExtent(clip);
15672     return projection2;
15673   }
15674   function fitExtent(projection2, extent, object) {
15675     return fit(projection2, function(b2) {
15676       var w2 = extent[1][0] - extent[0][0], h2 = extent[1][1] - extent[0][1], k2 = Math.min(w2 / (b2[1][0] - b2[0][0]), h2 / (b2[1][1] - b2[0][1])), x2 = +extent[0][0] + (w2 - k2 * (b2[1][0] + b2[0][0])) / 2, y2 = +extent[0][1] + (h2 - k2 * (b2[1][1] + b2[0][1])) / 2;
15677       projection2.scale(150 * k2).translate([x2, y2]);
15678     }, object);
15679   }
15680   function fitSize(projection2, size, object) {
15681     return fitExtent(projection2, [[0, 0], size], object);
15682   }
15683   function fitWidth(projection2, width, object) {
15684     return fit(projection2, function(b2) {
15685       var w2 = +width, k2 = w2 / (b2[1][0] - b2[0][0]), x2 = (w2 - k2 * (b2[1][0] + b2[0][0])) / 2, y2 = -k2 * b2[0][1];
15686       projection2.scale(150 * k2).translate([x2, y2]);
15687     }, object);
15688   }
15689   function fitHeight(projection2, height, object) {
15690     return fit(projection2, function(b2) {
15691       var h2 = +height, k2 = h2 / (b2[1][1] - b2[0][1]), x2 = -k2 * b2[0][0], y2 = (h2 - k2 * (b2[1][1] + b2[0][1])) / 2;
15692       projection2.scale(150 * k2).translate([x2, y2]);
15693     }, object);
15694   }
15695
15696   // node_modules/d3-geo/src/projection/resample.js
15697   var maxDepth = 16;
15698   var cosMinDistance = cos(30 * radians);
15699   function resample_default(project, delta2) {
15700     return +delta2 ? resample(project, delta2) : resampleNone(project);
15701   }
15702   function resampleNone(project) {
15703     return transformer({
15704       point: function(x2, y2) {
15705         x2 = project(x2, y2);
15706         this.stream.point(x2[0], x2[1]);
15707       }
15708     });
15709   }
15710   function resample(project, delta2) {
15711     function resampleLineTo(x05, y05, lambda04, a0, b0, c0, x12, y12, lambda12, a1, b1, c1, depth, stream) {
15712       var dx = x12 - x05, dy = y12 - y05, d2 = dx * dx + dy * dy;
15713       if (d2 > 4 * delta2 && depth--) {
15714         var a2 = a0 + a1, b2 = b0 + b1, c2 = c0 + c1, m2 = sqrt(a2 * a2 + b2 * b2 + c2 * c2), phi2 = asin(c2 /= m2), lambda22 = abs(abs(c2) - 1) < epsilon || abs(lambda04 - lambda12) < epsilon ? (lambda04 + lambda12) / 2 : atan2(b2, a2), p2 = project(lambda22, phi2), x2 = p2[0], y2 = p2[1], dx2 = x2 - x05, dy2 = y2 - y05, dz = dy * dx2 - dx * dy2;
15715         if (dz * dz / d2 > delta2 || abs((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) {
15716           resampleLineTo(x05, y05, lambda04, a0, b0, c0, x2, y2, lambda22, a2 /= m2, b2 /= m2, c2, depth, stream);
15717           stream.point(x2, y2);
15718           resampleLineTo(x2, y2, lambda22, a2, b2, c2, x12, y12, lambda12, a1, b1, c1, depth, stream);
15719         }
15720       }
15721     }
15722     return function(stream) {
15723       var lambda003, x004, y004, a00, b00, c00, lambda04, x05, y05, a0, b0, c0;
15724       var resampleStream = {
15725         point,
15726         lineStart,
15727         lineEnd,
15728         polygonStart: function() {
15729           stream.polygonStart();
15730           resampleStream.lineStart = ringStart;
15731         },
15732         polygonEnd: function() {
15733           stream.polygonEnd();
15734           resampleStream.lineStart = lineStart;
15735         }
15736       };
15737       function point(x2, y2) {
15738         x2 = project(x2, y2);
15739         stream.point(x2[0], x2[1]);
15740       }
15741       function lineStart() {
15742         x05 = NaN;
15743         resampleStream.point = linePoint2;
15744         stream.lineStart();
15745       }
15746       function linePoint2(lambda, phi) {
15747         var c2 = cartesian([lambda, phi]), p2 = project(lambda, phi);
15748         resampleLineTo(x05, y05, lambda04, a0, b0, c0, x05 = p2[0], y05 = p2[1], lambda04 = lambda, a0 = c2[0], b0 = c2[1], c0 = c2[2], maxDepth, stream);
15749         stream.point(x05, y05);
15750       }
15751       function lineEnd() {
15752         resampleStream.point = point;
15753         stream.lineEnd();
15754       }
15755       function ringStart() {
15756         lineStart();
15757         resampleStream.point = ringPoint;
15758         resampleStream.lineEnd = ringEnd;
15759       }
15760       function ringPoint(lambda, phi) {
15761         linePoint2(lambda003 = lambda, phi), x004 = x05, y004 = y05, a00 = a0, b00 = b0, c00 = c0;
15762         resampleStream.point = linePoint2;
15763       }
15764       function ringEnd() {
15765         resampleLineTo(x05, y05, lambda04, a0, b0, c0, x004, y004, lambda003, a00, b00, c00, maxDepth, stream);
15766         resampleStream.lineEnd = lineEnd;
15767         lineEnd();
15768       }
15769       return resampleStream;
15770     };
15771   }
15772
15773   // node_modules/d3-geo/src/projection/index.js
15774   var transformRadians = transformer({
15775     point: function(x2, y2) {
15776       this.stream.point(x2 * radians, y2 * radians);
15777     }
15778   });
15779   function transformRotate(rotate) {
15780     return transformer({
15781       point: function(x2, y2) {
15782         var r2 = rotate(x2, y2);
15783         return this.stream.point(r2[0], r2[1]);
15784       }
15785     });
15786   }
15787   function scaleTranslate(k2, dx, dy, sx, sy) {
15788     function transform2(x2, y2) {
15789       x2 *= sx;
15790       y2 *= sy;
15791       return [dx + k2 * x2, dy - k2 * y2];
15792     }
15793     transform2.invert = function(x2, y2) {
15794       return [(x2 - dx) / k2 * sx, (dy - y2) / k2 * sy];
15795     };
15796     return transform2;
15797   }
15798   function scaleTranslateRotate(k2, dx, dy, sx, sy, alpha) {
15799     if (!alpha) return scaleTranslate(k2, dx, dy, sx, sy);
15800     var cosAlpha = cos(alpha), sinAlpha = sin(alpha), a2 = cosAlpha * k2, b2 = sinAlpha * k2, ai = cosAlpha / k2, bi = sinAlpha / k2, ci = (sinAlpha * dy - cosAlpha * dx) / k2, fi = (sinAlpha * dx + cosAlpha * dy) / k2;
15801     function transform2(x2, y2) {
15802       x2 *= sx;
15803       y2 *= sy;
15804       return [a2 * x2 - b2 * y2 + dx, dy - b2 * x2 - a2 * y2];
15805     }
15806     transform2.invert = function(x2, y2) {
15807       return [sx * (ai * x2 - bi * y2 + ci), sy * (fi - bi * x2 - ai * y2)];
15808     };
15809     return transform2;
15810   }
15811   function projection(project) {
15812     return projectionMutator(function() {
15813       return project;
15814     })();
15815   }
15816   function projectionMutator(projectAt) {
15817     var project, k2 = 150, x2 = 480, y2 = 250, lambda = 0, phi = 0, deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, alpha = 0, sx = 1, sy = 1, theta = null, preclip = antimeridian_default, x05 = null, y05, x12, y12, postclip = identity_default, delta2 = 0.5, projectResample, projectTransform, projectRotateTransform, cache, cacheStream;
15818     function projection2(point) {
15819       return projectRotateTransform(point[0] * radians, point[1] * radians);
15820     }
15821     function invert(point) {
15822       point = projectRotateTransform.invert(point[0], point[1]);
15823       return point && [point[0] * degrees, point[1] * degrees];
15824     }
15825     projection2.stream = function(stream) {
15826       return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));
15827     };
15828     projection2.preclip = function(_2) {
15829       return arguments.length ? (preclip = _2, theta = void 0, reset()) : preclip;
15830     };
15831     projection2.postclip = function(_2) {
15832       return arguments.length ? (postclip = _2, x05 = y05 = x12 = y12 = null, reset()) : postclip;
15833     };
15834     projection2.clipAngle = function(_2) {
15835       return arguments.length ? (preclip = +_2 ? circle_default(theta = _2 * radians) : (theta = null, antimeridian_default), reset()) : theta * degrees;
15836     };
15837     projection2.clipExtent = function(_2) {
15838       return arguments.length ? (postclip = _2 == null ? (x05 = y05 = x12 = y12 = null, identity_default) : clipRectangle(x05 = +_2[0][0], y05 = +_2[0][1], x12 = +_2[1][0], y12 = +_2[1][1]), reset()) : x05 == null ? null : [[x05, y05], [x12, y12]];
15839     };
15840     projection2.scale = function(_2) {
15841       return arguments.length ? (k2 = +_2, recenter()) : k2;
15842     };
15843     projection2.translate = function(_2) {
15844       return arguments.length ? (x2 = +_2[0], y2 = +_2[1], recenter()) : [x2, y2];
15845     };
15846     projection2.center = function(_2) {
15847       return arguments.length ? (lambda = _2[0] % 360 * radians, phi = _2[1] % 360 * radians, recenter()) : [lambda * degrees, phi * degrees];
15848     };
15849     projection2.rotate = function(_2) {
15850       return arguments.length ? (deltaLambda = _2[0] % 360 * radians, deltaPhi = _2[1] % 360 * radians, deltaGamma = _2.length > 2 ? _2[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees, deltaPhi * degrees, deltaGamma * degrees];
15851     };
15852     projection2.angle = function(_2) {
15853       return arguments.length ? (alpha = _2 % 360 * radians, recenter()) : alpha * degrees;
15854     };
15855     projection2.reflectX = function(_2) {
15856       return arguments.length ? (sx = _2 ? -1 : 1, recenter()) : sx < 0;
15857     };
15858     projection2.reflectY = function(_2) {
15859       return arguments.length ? (sy = _2 ? -1 : 1, recenter()) : sy < 0;
15860     };
15861     projection2.precision = function(_2) {
15862       return arguments.length ? (projectResample = resample_default(projectTransform, delta2 = _2 * _2), reset()) : sqrt(delta2);
15863     };
15864     projection2.fitExtent = function(extent, object) {
15865       return fitExtent(projection2, extent, object);
15866     };
15867     projection2.fitSize = function(size, object) {
15868       return fitSize(projection2, size, object);
15869     };
15870     projection2.fitWidth = function(width, object) {
15871       return fitWidth(projection2, width, object);
15872     };
15873     projection2.fitHeight = function(height, object) {
15874       return fitHeight(projection2, height, object);
15875     };
15876     function recenter() {
15877       var center = scaleTranslateRotate(k2, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)), transform2 = scaleTranslateRotate(k2, x2 - center[0], y2 - center[1], sx, sy, alpha);
15878       rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma);
15879       projectTransform = compose_default(project, transform2);
15880       projectRotateTransform = compose_default(rotate, projectTransform);
15881       projectResample = resample_default(projectTransform, delta2);
15882       return reset();
15883     }
15884     function reset() {
15885       cache = cacheStream = null;
15886       return projection2;
15887     }
15888     return function() {
15889       project = projectAt.apply(this, arguments);
15890       projection2.invert = project.invert && invert;
15891       return recenter();
15892     };
15893   }
15894
15895   // node_modules/d3-geo/src/projection/mercator.js
15896   function mercatorRaw(lambda, phi) {
15897     return [lambda, log(tan((halfPi + phi) / 2))];
15898   }
15899   mercatorRaw.invert = function(x2, y2) {
15900     return [x2, 2 * atan(exp(y2)) - halfPi];
15901   };
15902   function mercator_default() {
15903     return mercatorProjection(mercatorRaw).scale(961 / tau);
15904   }
15905   function mercatorProjection(project) {
15906     var m2 = projection(project), center = m2.center, scale = m2.scale, translate = m2.translate, clipExtent = m2.clipExtent, x05 = null, y05, x12, y12;
15907     m2.scale = function(_2) {
15908       return arguments.length ? (scale(_2), reclip()) : scale();
15909     };
15910     m2.translate = function(_2) {
15911       return arguments.length ? (translate(_2), reclip()) : translate();
15912     };
15913     m2.center = function(_2) {
15914       return arguments.length ? (center(_2), reclip()) : center();
15915     };
15916     m2.clipExtent = function(_2) {
15917       return arguments.length ? (_2 == null ? x05 = y05 = x12 = y12 = null : (x05 = +_2[0][0], y05 = +_2[0][1], x12 = +_2[1][0], y12 = +_2[1][1]), reclip()) : x05 == null ? null : [[x05, y05], [x12, y12]];
15918     };
15919     function reclip() {
15920       var k2 = pi * scale(), t2 = m2(rotation_default(m2.rotate()).invert([0, 0]));
15921       return clipExtent(x05 == null ? [[t2[0] - k2, t2[1] - k2], [t2[0] + k2, t2[1] + k2]] : project === mercatorRaw ? [[Math.max(t2[0] - k2, x05), y05], [Math.min(t2[0] + k2, x12), y12]] : [[x05, Math.max(t2[1] - k2, y05)], [x12, Math.min(t2[1] + k2, y12)]]);
15922     }
15923     return reclip();
15924   }
15925
15926   // node_modules/d3-geo/src/projection/identity.js
15927   function identity_default2() {
15928     var k2 = 1, tx = 0, ty = 0, sx = 1, sy = 1, alpha = 0, ca, sa, x05 = null, y05, x12, y12, kx = 1, ky = 1, transform2 = transformer({
15929       point: function(x2, y2) {
15930         var p2 = projection2([x2, y2]);
15931         this.stream.point(p2[0], p2[1]);
15932       }
15933     }), postclip = identity_default, cache, cacheStream;
15934     function reset() {
15935       kx = k2 * sx;
15936       ky = k2 * sy;
15937       cache = cacheStream = null;
15938       return projection2;
15939     }
15940     function projection2(p2) {
15941       var x2 = p2[0] * kx, y2 = p2[1] * ky;
15942       if (alpha) {
15943         var t2 = y2 * ca - x2 * sa;
15944         x2 = x2 * ca + y2 * sa;
15945         y2 = t2;
15946       }
15947       return [x2 + tx, y2 + ty];
15948     }
15949     projection2.invert = function(p2) {
15950       var x2 = p2[0] - tx, y2 = p2[1] - ty;
15951       if (alpha) {
15952         var t2 = y2 * ca + x2 * sa;
15953         x2 = x2 * ca - y2 * sa;
15954         y2 = t2;
15955       }
15956       return [x2 / kx, y2 / ky];
15957     };
15958     projection2.stream = function(stream) {
15959       return cache && cacheStream === stream ? cache : cache = transform2(postclip(cacheStream = stream));
15960     };
15961     projection2.postclip = function(_2) {
15962       return arguments.length ? (postclip = _2, x05 = y05 = x12 = y12 = null, reset()) : postclip;
15963     };
15964     projection2.clipExtent = function(_2) {
15965       return arguments.length ? (postclip = _2 == null ? (x05 = y05 = x12 = y12 = null, identity_default) : clipRectangle(x05 = +_2[0][0], y05 = +_2[0][1], x12 = +_2[1][0], y12 = +_2[1][1]), reset()) : x05 == null ? null : [[x05, y05], [x12, y12]];
15966     };
15967     projection2.scale = function(_2) {
15968       return arguments.length ? (k2 = +_2, reset()) : k2;
15969     };
15970     projection2.translate = function(_2) {
15971       return arguments.length ? (tx = +_2[0], ty = +_2[1], reset()) : [tx, ty];
15972     };
15973     projection2.angle = function(_2) {
15974       return arguments.length ? (alpha = _2 % 360 * radians, sa = sin(alpha), ca = cos(alpha), reset()) : alpha * degrees;
15975     };
15976     projection2.reflectX = function(_2) {
15977       return arguments.length ? (sx = _2 ? -1 : 1, reset()) : sx < 0;
15978     };
15979     projection2.reflectY = function(_2) {
15980       return arguments.length ? (sy = _2 ? -1 : 1, reset()) : sy < 0;
15981     };
15982     projection2.fitExtent = function(extent, object) {
15983       return fitExtent(projection2, extent, object);
15984     };
15985     projection2.fitSize = function(size, object) {
15986       return fitSize(projection2, size, object);
15987     };
15988     projection2.fitWidth = function(width, object) {
15989       return fitWidth(projection2, width, object);
15990     };
15991     projection2.fitHeight = function(height, object) {
15992       return fitHeight(projection2, height, object);
15993     };
15994     return projection2;
15995   }
15996
15997   // modules/geo/geo.js
15998   var TAU = 2 * Math.PI;
15999   var EQUATORIAL_RADIUS = 6378137;
16000   var POLAR_RADIUS = 63567523e-1;
16001   function geoLatToMeters(dLat) {
16002     return dLat * (TAU * POLAR_RADIUS / 360);
16003   }
16004   function geoLonToMeters(dLon, atLat) {
16005     return Math.abs(atLat) >= 90 ? 0 : dLon * (TAU * EQUATORIAL_RADIUS / 360) * Math.abs(Math.cos(atLat * (Math.PI / 180)));
16006   }
16007   function geoMetersToLat(m2) {
16008     return m2 / (TAU * POLAR_RADIUS / 360);
16009   }
16010   function geoMetersToLon(m2, atLat) {
16011     return Math.abs(atLat) >= 90 ? 0 : m2 / (TAU * EQUATORIAL_RADIUS / 360) / Math.abs(Math.cos(atLat * (Math.PI / 180)));
16012   }
16013   function geoMetersToOffset(meters, tileSize) {
16014     tileSize = tileSize || 256;
16015     return [
16016       meters[0] * tileSize / (TAU * EQUATORIAL_RADIUS),
16017       -meters[1] * tileSize / (TAU * POLAR_RADIUS)
16018     ];
16019   }
16020   function geoOffsetToMeters(offset, tileSize) {
16021     tileSize = tileSize || 256;
16022     return [
16023       offset[0] * TAU * EQUATORIAL_RADIUS / tileSize,
16024       -offset[1] * TAU * POLAR_RADIUS / tileSize
16025     ];
16026   }
16027   function geoSphericalDistance(a2, b2) {
16028     var x2 = geoLonToMeters(a2[0] - b2[0], (a2[1] + b2[1]) / 2);
16029     var y2 = geoLatToMeters(a2[1] - b2[1]);
16030     return Math.sqrt(x2 * x2 + y2 * y2);
16031   }
16032   function geoScaleToZoom(k2, tileSize) {
16033     tileSize = tileSize || 256;
16034     var log2ts = Math.log(tileSize) * Math.LOG2E;
16035     return Math.log(k2 * TAU) / Math.LN2 - log2ts;
16036   }
16037   function geoZoomToScale(z2, tileSize) {
16038     tileSize = tileSize || 256;
16039     return tileSize * Math.pow(2, z2) / TAU;
16040   }
16041   function geoSphericalClosestNode(nodes, point) {
16042     var minDistance = Infinity, distance;
16043     var indexOfMin;
16044     for (var i3 in nodes) {
16045       distance = geoSphericalDistance(nodes[i3].loc, point);
16046       if (distance < minDistance) {
16047         minDistance = distance;
16048         indexOfMin = i3;
16049       }
16050     }
16051     if (indexOfMin !== void 0) {
16052       return { index: indexOfMin, distance: minDistance, node: nodes[indexOfMin] };
16053     } else {
16054       return null;
16055     }
16056   }
16057
16058   // modules/geo/extent.js
16059   function geoExtent(min3, max3) {
16060     if (!(this instanceof geoExtent)) {
16061       return new geoExtent(min3, max3);
16062     } else if (min3 instanceof geoExtent) {
16063       return min3;
16064     } else if (min3 && min3.length === 2 && min3[0].length === 2 && min3[1].length === 2) {
16065       this[0] = min3[0];
16066       this[1] = min3[1];
16067     } else {
16068       this[0] = min3 || [Infinity, Infinity];
16069       this[1] = max3 || min3 || [-Infinity, -Infinity];
16070     }
16071   }
16072   geoExtent.prototype = new Array(2);
16073   Object.assign(geoExtent.prototype, {
16074     equals: function(obj) {
16075       return this[0][0] === obj[0][0] && this[0][1] === obj[0][1] && this[1][0] === obj[1][0] && this[1][1] === obj[1][1];
16076     },
16077     extend: function(obj) {
16078       if (!(obj instanceof geoExtent)) obj = new geoExtent(obj);
16079       return geoExtent(
16080         [Math.min(obj[0][0], this[0][0]), Math.min(obj[0][1], this[0][1])],
16081         [Math.max(obj[1][0], this[1][0]), Math.max(obj[1][1], this[1][1])]
16082       );
16083     },
16084     _extend: function(extent) {
16085       this[0][0] = Math.min(extent[0][0], this[0][0]);
16086       this[0][1] = Math.min(extent[0][1], this[0][1]);
16087       this[1][0] = Math.max(extent[1][0], this[1][0]);
16088       this[1][1] = Math.max(extent[1][1], this[1][1]);
16089     },
16090     area: function() {
16091       return Math.abs((this[1][0] - this[0][0]) * (this[1][1] - this[0][1]));
16092     },
16093     center: function() {
16094       return [(this[0][0] + this[1][0]) / 2, (this[0][1] + this[1][1]) / 2];
16095     },
16096     rectangle: function() {
16097       return [this[0][0], this[0][1], this[1][0], this[1][1]];
16098     },
16099     bbox: function() {
16100       return { minX: this[0][0], minY: this[0][1], maxX: this[1][0], maxY: this[1][1] };
16101     },
16102     polygon: function() {
16103       return [
16104         [this[0][0], this[0][1]],
16105         [this[0][0], this[1][1]],
16106         [this[1][0], this[1][1]],
16107         [this[1][0], this[0][1]],
16108         [this[0][0], this[0][1]]
16109       ];
16110     },
16111     contains: function(obj) {
16112       if (!(obj instanceof geoExtent)) obj = new geoExtent(obj);
16113       return obj[0][0] >= this[0][0] && obj[0][1] >= this[0][1] && obj[1][0] <= this[1][0] && obj[1][1] <= this[1][1];
16114     },
16115     intersects: function(obj) {
16116       if (!(obj instanceof geoExtent)) obj = new geoExtent(obj);
16117       return obj[0][0] <= this[1][0] && obj[0][1] <= this[1][1] && obj[1][0] >= this[0][0] && obj[1][1] >= this[0][1];
16118     },
16119     intersection: function(obj) {
16120       if (!this.intersects(obj)) return new geoExtent();
16121       return new geoExtent(
16122         [Math.max(obj[0][0], this[0][0]), Math.max(obj[0][1], this[0][1])],
16123         [Math.min(obj[1][0], this[1][0]), Math.min(obj[1][1], this[1][1])]
16124       );
16125     },
16126     percentContainedIn: function(obj) {
16127       if (!(obj instanceof geoExtent)) obj = new geoExtent(obj);
16128       var a1 = this.intersection(obj).area();
16129       var a2 = this.area();
16130       if (a1 === Infinity || a2 === Infinity) {
16131         return 0;
16132       } else if (a1 === 0 || a2 === 0) {
16133         if (obj.contains(this)) {
16134           return 1;
16135         }
16136         return 0;
16137       } else {
16138         return a1 / a2;
16139       }
16140     },
16141     padByMeters: function(meters) {
16142       var dLat = geoMetersToLat(meters);
16143       var dLon = geoMetersToLon(meters, this.center()[1]);
16144       return geoExtent(
16145         [this[0][0] - dLon, this[0][1] - dLat],
16146         [this[1][0] + dLon, this[1][1] + dLat]
16147       );
16148     },
16149     toParam: function() {
16150       return this.rectangle().join(",");
16151     },
16152     split: function() {
16153       const center = this.center();
16154       return [
16155         geoExtent(this[0], center),
16156         geoExtent([center[0], this[0][1]], [this[1][0], center[1]]),
16157         geoExtent(center, this[1]),
16158         geoExtent([this[0][0], center[1]], [center[0], this[1][1]])
16159       ];
16160     }
16161   });
16162
16163   // node_modules/d3-polygon/src/area.js
16164   function area_default3(polygon2) {
16165     var i3 = -1, n3 = polygon2.length, a2, b2 = polygon2[n3 - 1], area = 0;
16166     while (++i3 < n3) {
16167       a2 = b2;
16168       b2 = polygon2[i3];
16169       area += a2[1] * b2[0] - a2[0] * b2[1];
16170     }
16171     return area / 2;
16172   }
16173
16174   // node_modules/d3-polygon/src/centroid.js
16175   function centroid_default2(polygon2) {
16176     var i3 = -1, n3 = polygon2.length, x2 = 0, y2 = 0, a2, b2 = polygon2[n3 - 1], c2, k2 = 0;
16177     while (++i3 < n3) {
16178       a2 = b2;
16179       b2 = polygon2[i3];
16180       k2 += c2 = a2[0] * b2[1] - b2[0] * a2[1];
16181       x2 += (a2[0] + b2[0]) * c2;
16182       y2 += (a2[1] + b2[1]) * c2;
16183     }
16184     return k2 *= 3, [x2 / k2, y2 / k2];
16185   }
16186
16187   // node_modules/d3-polygon/src/cross.js
16188   function cross_default(a2, b2, c2) {
16189     return (b2[0] - a2[0]) * (c2[1] - a2[1]) - (b2[1] - a2[1]) * (c2[0] - a2[0]);
16190   }
16191
16192   // node_modules/d3-polygon/src/hull.js
16193   function lexicographicOrder(a2, b2) {
16194     return a2[0] - b2[0] || a2[1] - b2[1];
16195   }
16196   function computeUpperHullIndexes(points) {
16197     const n3 = points.length, indexes = [0, 1];
16198     let size = 2, i3;
16199     for (i3 = 2; i3 < n3; ++i3) {
16200       while (size > 1 && cross_default(points[indexes[size - 2]], points[indexes[size - 1]], points[i3]) <= 0) --size;
16201       indexes[size++] = i3;
16202     }
16203     return indexes.slice(0, size);
16204   }
16205   function hull_default(points) {
16206     if ((n3 = points.length) < 3) return null;
16207     var i3, n3, sortedPoints = new Array(n3), flippedPoints = new Array(n3);
16208     for (i3 = 0; i3 < n3; ++i3) sortedPoints[i3] = [+points[i3][0], +points[i3][1], i3];
16209     sortedPoints.sort(lexicographicOrder);
16210     for (i3 = 0; i3 < n3; ++i3) flippedPoints[i3] = [sortedPoints[i3][0], -sortedPoints[i3][1]];
16211     var upperIndexes = computeUpperHullIndexes(sortedPoints), lowerIndexes = computeUpperHullIndexes(flippedPoints);
16212     var skipLeft = lowerIndexes[0] === upperIndexes[0], skipRight = lowerIndexes[lowerIndexes.length - 1] === upperIndexes[upperIndexes.length - 1], hull = [];
16213     for (i3 = upperIndexes.length - 1; i3 >= 0; --i3) hull.push(points[sortedPoints[upperIndexes[i3]][2]]);
16214     for (i3 = +skipLeft; i3 < lowerIndexes.length - skipRight; ++i3) hull.push(points[sortedPoints[lowerIndexes[i3]][2]]);
16215     return hull;
16216   }
16217
16218   // modules/geo/vector.js
16219   function geoVecEqual(a2, b2, epsilon3) {
16220     if (epsilon3) {
16221       return Math.abs(a2[0] - b2[0]) <= epsilon3 && Math.abs(a2[1] - b2[1]) <= epsilon3;
16222     } else {
16223       return a2[0] === b2[0] && a2[1] === b2[1];
16224     }
16225   }
16226   function geoVecAdd(a2, b2) {
16227     return [a2[0] + b2[0], a2[1] + b2[1]];
16228   }
16229   function geoVecSubtract(a2, b2) {
16230     return [a2[0] - b2[0], a2[1] - b2[1]];
16231   }
16232   function geoVecScale(a2, mag) {
16233     return [a2[0] * mag, a2[1] * mag];
16234   }
16235   function geoVecFloor(a2) {
16236     return [Math.floor(a2[0]), Math.floor(a2[1])];
16237   }
16238   function geoVecInterp(a2, b2, t2) {
16239     return [
16240       a2[0] + (b2[0] - a2[0]) * t2,
16241       a2[1] + (b2[1] - a2[1]) * t2
16242     ];
16243   }
16244   function geoVecLength(a2, b2) {
16245     return Math.sqrt(geoVecLengthSquare(a2, b2));
16246   }
16247   function geoVecLengthSquare(a2, b2) {
16248     b2 = b2 || [0, 0];
16249     var x2 = a2[0] - b2[0];
16250     var y2 = a2[1] - b2[1];
16251     return x2 * x2 + y2 * y2;
16252   }
16253   function geoVecNormalize(a2) {
16254     var length2 = Math.sqrt(a2[0] * a2[0] + a2[1] * a2[1]);
16255     if (length2 !== 0) {
16256       return geoVecScale(a2, 1 / length2);
16257     }
16258     return [0, 0];
16259   }
16260   function geoVecAngle(a2, b2) {
16261     return Math.atan2(b2[1] - a2[1], b2[0] - a2[0]);
16262   }
16263   function geoVecDot(a2, b2, origin) {
16264     origin = origin || [0, 0];
16265     var p2 = geoVecSubtract(a2, origin);
16266     var q2 = geoVecSubtract(b2, origin);
16267     return p2[0] * q2[0] + p2[1] * q2[1];
16268   }
16269   function geoVecNormalizedDot(a2, b2, origin) {
16270     origin = origin || [0, 0];
16271     var p2 = geoVecNormalize(geoVecSubtract(a2, origin));
16272     var q2 = geoVecNormalize(geoVecSubtract(b2, origin));
16273     return geoVecDot(p2, q2);
16274   }
16275   function geoVecCross(a2, b2, origin) {
16276     origin = origin || [0, 0];
16277     var p2 = geoVecSubtract(a2, origin);
16278     var q2 = geoVecSubtract(b2, origin);
16279     return p2[0] * q2[1] - p2[1] * q2[0];
16280   }
16281   function geoVecProject(a2, points) {
16282     var min3 = Infinity;
16283     var idx;
16284     var target;
16285     for (var i3 = 0; i3 < points.length - 1; i3++) {
16286       var o2 = points[i3];
16287       var s2 = geoVecSubtract(points[i3 + 1], o2);
16288       var v2 = geoVecSubtract(a2, o2);
16289       var proj = geoVecDot(v2, s2) / geoVecDot(s2, s2);
16290       var p2;
16291       if (proj < 0) {
16292         p2 = o2;
16293       } else if (proj > 1) {
16294         p2 = points[i3 + 1];
16295       } else {
16296         p2 = [o2[0] + proj * s2[0], o2[1] + proj * s2[1]];
16297       }
16298       var dist = geoVecLength(p2, a2);
16299       if (dist < min3) {
16300         min3 = dist;
16301         idx = i3 + 1;
16302         target = p2;
16303       }
16304     }
16305     if (idx !== void 0) {
16306       return { index: idx, distance: min3, target };
16307     } else {
16308       return null;
16309     }
16310   }
16311
16312   // modules/geo/geom.js
16313   function geoAngle(a2, b2, projection2) {
16314     return geoVecAngle(projection2(a2.loc), projection2(b2.loc));
16315   }
16316   function geoEdgeEqual(a2, b2) {
16317     return a2[0] === b2[0] && a2[1] === b2[1] || a2[0] === b2[1] && a2[1] === b2[0];
16318   }
16319   function geoRotate(points, angle2, around) {
16320     return points.map(function(point) {
16321       var radial = geoVecSubtract(point, around);
16322       return [
16323         radial[0] * Math.cos(angle2) - radial[1] * Math.sin(angle2) + around[0],
16324         radial[0] * Math.sin(angle2) + radial[1] * Math.cos(angle2) + around[1]
16325       ];
16326     });
16327   }
16328   function geoChooseEdge(nodes, point, projection2, activeID) {
16329     var dist = geoVecLength;
16330     var points = nodes.map(function(n3) {
16331       return projection2(n3.loc);
16332     });
16333     var ids = nodes.map(function(n3) {
16334       return n3.id;
16335     });
16336     var min3 = Infinity;
16337     var idx;
16338     var loc;
16339     for (var i3 = 0; i3 < points.length - 1; i3++) {
16340       if (ids[i3] === activeID || ids[i3 + 1] === activeID) continue;
16341       var o2 = points[i3];
16342       var s2 = geoVecSubtract(points[i3 + 1], o2);
16343       var v2 = geoVecSubtract(point, o2);
16344       var proj = geoVecDot(v2, s2) / geoVecDot(s2, s2);
16345       var p2;
16346       if (proj < 0) {
16347         p2 = o2;
16348       } else if (proj > 1) {
16349         p2 = points[i3 + 1];
16350       } else {
16351         p2 = [o2[0] + proj * s2[0], o2[1] + proj * s2[1]];
16352       }
16353       var d2 = dist(p2, point);
16354       if (d2 < min3) {
16355         min3 = d2;
16356         idx = i3 + 1;
16357         loc = projection2.invert(p2);
16358       }
16359     }
16360     if (idx !== void 0) {
16361       return { index: idx, distance: min3, loc };
16362     } else {
16363       return null;
16364     }
16365   }
16366   function geoHasLineIntersections(activeNodes, inactiveNodes, activeID) {
16367     var actives = [];
16368     var inactives = [];
16369     var j2, k2, n1, n22, segment;
16370     for (j2 = 0; j2 < activeNodes.length - 1; j2++) {
16371       n1 = activeNodes[j2];
16372       n22 = activeNodes[j2 + 1];
16373       segment = [n1.loc, n22.loc];
16374       if (n1.id === activeID || n22.id === activeID) {
16375         actives.push(segment);
16376       }
16377     }
16378     for (j2 = 0; j2 < inactiveNodes.length - 1; j2++) {
16379       n1 = inactiveNodes[j2];
16380       n22 = inactiveNodes[j2 + 1];
16381       segment = [n1.loc, n22.loc];
16382       inactives.push(segment);
16383     }
16384     for (j2 = 0; j2 < actives.length; j2++) {
16385       for (k2 = 0; k2 < inactives.length; k2++) {
16386         var p2 = actives[j2];
16387         var q2 = inactives[k2];
16388         var hit = geoLineIntersection(p2, q2);
16389         if (hit) {
16390           return true;
16391         }
16392       }
16393     }
16394     return false;
16395   }
16396   function geoHasSelfIntersections(nodes, activeID) {
16397     var actives = [];
16398     var inactives = [];
16399     var j2, k2;
16400     for (j2 = 0; j2 < nodes.length - 1; j2++) {
16401       var n1 = nodes[j2];
16402       var n22 = nodes[j2 + 1];
16403       var segment = [n1.loc, n22.loc];
16404       if (n1.id === activeID || n22.id === activeID) {
16405         actives.push(segment);
16406       } else {
16407         inactives.push(segment);
16408       }
16409     }
16410     for (j2 = 0; j2 < actives.length; j2++) {
16411       for (k2 = 0; k2 < inactives.length; k2++) {
16412         var p2 = actives[j2];
16413         var q2 = inactives[k2];
16414         if (geoVecEqual(p2[1], q2[0]) || geoVecEqual(p2[0], q2[1]) || geoVecEqual(p2[0], q2[0]) || geoVecEqual(p2[1], q2[1])) {
16415           continue;
16416         }
16417         var hit = geoLineIntersection(p2, q2);
16418         if (hit) {
16419           var epsilon3 = 1e-8;
16420           if (geoVecEqual(p2[1], hit, epsilon3) || geoVecEqual(p2[0], hit, epsilon3) || geoVecEqual(q2[1], hit, epsilon3) || geoVecEqual(q2[0], hit, epsilon3)) {
16421             continue;
16422           } else {
16423             return true;
16424           }
16425         }
16426       }
16427     }
16428     return false;
16429   }
16430   function geoLineIntersection(a2, b2) {
16431     var p2 = [a2[0][0], a2[0][1]];
16432     var p22 = [a2[1][0], a2[1][1]];
16433     var q2 = [b2[0][0], b2[0][1]];
16434     var q22 = [b2[1][0], b2[1][1]];
16435     var r2 = geoVecSubtract(p22, p2);
16436     var s2 = geoVecSubtract(q22, q2);
16437     var uNumerator = geoVecCross(geoVecSubtract(q2, p2), r2);
16438     var denominator = geoVecCross(r2, s2);
16439     if (uNumerator && denominator) {
16440       var u2 = uNumerator / denominator;
16441       var t2 = geoVecCross(geoVecSubtract(q2, p2), s2) / denominator;
16442       if (t2 >= 0 && t2 <= 1 && u2 >= 0 && u2 <= 1) {
16443         return geoVecInterp(p2, p22, t2);
16444       }
16445     }
16446     return null;
16447   }
16448   function geoPathIntersections(path1, path2) {
16449     var intersections = [];
16450     for (var i3 = 0; i3 < path1.length - 1; i3++) {
16451       for (var j2 = 0; j2 < path2.length - 1; j2++) {
16452         var a2 = [path1[i3], path1[i3 + 1]];
16453         var b2 = [path2[j2], path2[j2 + 1]];
16454         var hit = geoLineIntersection(a2, b2);
16455         if (hit) {
16456           intersections.push(hit);
16457         }
16458       }
16459     }
16460     return intersections;
16461   }
16462   function geoPathHasIntersections(path1, path2) {
16463     for (var i3 = 0; i3 < path1.length - 1; i3++) {
16464       for (var j2 = 0; j2 < path2.length - 1; j2++) {
16465         var a2 = [path1[i3], path1[i3 + 1]];
16466         var b2 = [path2[j2], path2[j2 + 1]];
16467         var hit = geoLineIntersection(a2, b2);
16468         if (hit) {
16469           return true;
16470         }
16471       }
16472     }
16473     return false;
16474   }
16475   function geoPointInPolygon(point, polygon2) {
16476     var x2 = point[0];
16477     var y2 = point[1];
16478     var inside = false;
16479     for (var i3 = 0, j2 = polygon2.length - 1; i3 < polygon2.length; j2 = i3++) {
16480       var xi = polygon2[i3][0];
16481       var yi = polygon2[i3][1];
16482       var xj = polygon2[j2][0];
16483       var yj = polygon2[j2][1];
16484       var intersect2 = yi > y2 !== yj > y2 && x2 < (xj - xi) * (y2 - yi) / (yj - yi) + xi;
16485       if (intersect2) inside = !inside;
16486     }
16487     return inside;
16488   }
16489   function geoPolygonContainsPolygon(outer, inner) {
16490     return inner.every(function(point) {
16491       return geoPointInPolygon(point, outer);
16492     });
16493   }
16494   function geoPolygonIntersectsPolygon(outer, inner, checkSegments) {
16495     function testPoints(outer2, inner2) {
16496       return inner2.some(function(point) {
16497         return geoPointInPolygon(point, outer2);
16498       });
16499     }
16500     return testPoints(outer, inner) || !!checkSegments && geoPathHasIntersections(outer, inner);
16501   }
16502   function geoGetSmallestSurroundingRectangle(points) {
16503     var hull = hull_default(points);
16504     var centroid = centroid_default2(hull);
16505     var minArea = Infinity;
16506     var ssrExtent = [];
16507     var ssrAngle = 0;
16508     var c1 = hull[0];
16509     for (var i3 = 0; i3 <= hull.length - 1; i3++) {
16510       var c2 = i3 === hull.length - 1 ? hull[0] : hull[i3 + 1];
16511       var angle2 = Math.atan2(c2[1] - c1[1], c2[0] - c1[0]);
16512       var poly = geoRotate(hull, -angle2, centroid);
16513       var extent = poly.reduce(function(extent2, point) {
16514         return extent2.extend(geoExtent(point));
16515       }, geoExtent());
16516       var area = extent.area();
16517       if (area < minArea) {
16518         minArea = area;
16519         ssrExtent = extent;
16520         ssrAngle = angle2;
16521       }
16522       c1 = c2;
16523     }
16524     return {
16525       poly: geoRotate(ssrExtent.polygon(), ssrAngle, centroid),
16526       angle: ssrAngle
16527     };
16528   }
16529   function geoPathLength(path) {
16530     var length2 = 0;
16531     for (var i3 = 0; i3 < path.length - 1; i3++) {
16532       length2 += geoVecLength(path[i3], path[i3 + 1]);
16533     }
16534     return length2;
16535   }
16536   function geoViewportEdge(point, dimensions) {
16537     var pad2 = [80, 20, 50, 20];
16538     var x2 = 0;
16539     var y2 = 0;
16540     if (point[0] > dimensions[0] - pad2[1]) {
16541       x2 = -10;
16542     }
16543     if (point[0] < pad2[3]) {
16544       x2 = 10;
16545     }
16546     if (point[1] > dimensions[1] - pad2[2]) {
16547       y2 = -10;
16548     }
16549     if (point[1] < pad2[0]) {
16550       y2 = 10;
16551     }
16552     if (x2 || y2) {
16553       return [x2, y2];
16554     } else {
16555       return null;
16556     }
16557   }
16558
16559   // node_modules/d3-dispatch/src/dispatch.js
16560   var noop2 = { value: () => {
16561   } };
16562   function dispatch() {
16563     for (var i3 = 0, n3 = arguments.length, _2 = {}, t2; i3 < n3; ++i3) {
16564       if (!(t2 = arguments[i3] + "") || t2 in _2 || /[\s.]/.test(t2)) throw new Error("illegal type: " + t2);
16565       _2[t2] = [];
16566     }
16567     return new Dispatch(_2);
16568   }
16569   function Dispatch(_2) {
16570     this._ = _2;
16571   }
16572   function parseTypenames(typenames, types) {
16573     return typenames.trim().split(/^|\s+/).map(function(t2) {
16574       var name = "", i3 = t2.indexOf(".");
16575       if (i3 >= 0) name = t2.slice(i3 + 1), t2 = t2.slice(0, i3);
16576       if (t2 && !types.hasOwnProperty(t2)) throw new Error("unknown type: " + t2);
16577       return { type: t2, name };
16578     });
16579   }
16580   Dispatch.prototype = dispatch.prototype = {
16581     constructor: Dispatch,
16582     on: function(typename, callback) {
16583       var _2 = this._, T2 = parseTypenames(typename + "", _2), t2, i3 = -1, n3 = T2.length;
16584       if (arguments.length < 2) {
16585         while (++i3 < n3) if ((t2 = (typename = T2[i3]).type) && (t2 = get(_2[t2], typename.name))) return t2;
16586         return;
16587       }
16588       if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback);
16589       while (++i3 < n3) {
16590         if (t2 = (typename = T2[i3]).type) _2[t2] = set(_2[t2], typename.name, callback);
16591         else if (callback == null) for (t2 in _2) _2[t2] = set(_2[t2], typename.name, null);
16592       }
16593       return this;
16594     },
16595     copy: function() {
16596       var copy2 = {}, _2 = this._;
16597       for (var t2 in _2) copy2[t2] = _2[t2].slice();
16598       return new Dispatch(copy2);
16599     },
16600     call: function(type2, that) {
16601       if ((n3 = arguments.length - 2) > 0) for (var args = new Array(n3), i3 = 0, n3, t2; i3 < n3; ++i3) args[i3] = arguments[i3 + 2];
16602       if (!this._.hasOwnProperty(type2)) throw new Error("unknown type: " + type2);
16603       for (t2 = this._[type2], i3 = 0, n3 = t2.length; i3 < n3; ++i3) t2[i3].value.apply(that, args);
16604     },
16605     apply: function(type2, that, args) {
16606       if (!this._.hasOwnProperty(type2)) throw new Error("unknown type: " + type2);
16607       for (var t2 = this._[type2], i3 = 0, n3 = t2.length; i3 < n3; ++i3) t2[i3].value.apply(that, args);
16608     }
16609   };
16610   function get(type2, name) {
16611     for (var i3 = 0, n3 = type2.length, c2; i3 < n3; ++i3) {
16612       if ((c2 = type2[i3]).name === name) {
16613         return c2.value;
16614       }
16615     }
16616   }
16617   function set(type2, name, callback) {
16618     for (var i3 = 0, n3 = type2.length; i3 < n3; ++i3) {
16619       if (type2[i3].name === name) {
16620         type2[i3] = noop2, type2 = type2.slice(0, i3).concat(type2.slice(i3 + 1));
16621         break;
16622       }
16623     }
16624     if (callback != null) type2.push({ name, value: callback });
16625     return type2;
16626   }
16627   var dispatch_default = dispatch;
16628
16629   // node_modules/d3-selection/src/namespaces.js
16630   var xhtml = "http://www.w3.org/1999/xhtml";
16631   var namespaces_default = {
16632     svg: "http://www.w3.org/2000/svg",
16633     xhtml,
16634     xlink: "http://www.w3.org/1999/xlink",
16635     xml: "http://www.w3.org/XML/1998/namespace",
16636     xmlns: "http://www.w3.org/2000/xmlns/"
16637   };
16638
16639   // node_modules/d3-selection/src/namespace.js
16640   function namespace_default(name) {
16641     var prefix = name += "", i3 = prefix.indexOf(":");
16642     if (i3 >= 0 && (prefix = name.slice(0, i3)) !== "xmlns") name = name.slice(i3 + 1);
16643     return namespaces_default.hasOwnProperty(prefix) ? { space: namespaces_default[prefix], local: name } : name;
16644   }
16645
16646   // node_modules/d3-selection/src/creator.js
16647   function creatorInherit(name) {
16648     return function() {
16649       var document2 = this.ownerDocument, uri = this.namespaceURI;
16650       return uri === xhtml && document2.documentElement.namespaceURI === xhtml ? document2.createElement(name) : document2.createElementNS(uri, name);
16651     };
16652   }
16653   function creatorFixed(fullname) {
16654     return function() {
16655       return this.ownerDocument.createElementNS(fullname.space, fullname.local);
16656     };
16657   }
16658   function creator_default(name) {
16659     var fullname = namespace_default(name);
16660     return (fullname.local ? creatorFixed : creatorInherit)(fullname);
16661   }
16662
16663   // node_modules/d3-selection/src/selector.js
16664   function none() {
16665   }
16666   function selector_default(selector) {
16667     return selector == null ? none : function() {
16668       return this.querySelector(selector);
16669     };
16670   }
16671
16672   // node_modules/d3-selection/src/selection/select.js
16673   function select_default(select) {
16674     if (typeof select !== "function") select = selector_default(select);
16675     for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j2 = 0; j2 < m2; ++j2) {
16676       for (var group = groups[j2], n3 = group.length, subgroup = subgroups[j2] = new Array(n3), node, subnode, i3 = 0; i3 < n3; ++i3) {
16677         if ((node = group[i3]) && (subnode = select.call(node, node.__data__, i3, group))) {
16678           if ("__data__" in node) subnode.__data__ = node.__data__;
16679           subgroup[i3] = subnode;
16680         }
16681       }
16682     }
16683     return new Selection(subgroups, this._parents);
16684   }
16685
16686   // node_modules/d3-selection/src/array.js
16687   function array(x2) {
16688     return x2 == null ? [] : Array.isArray(x2) ? x2 : Array.from(x2);
16689   }
16690
16691   // node_modules/d3-selection/src/selectorAll.js
16692   function empty() {
16693     return [];
16694   }
16695   function selectorAll_default(selector) {
16696     return selector == null ? empty : function() {
16697       return this.querySelectorAll(selector);
16698     };
16699   }
16700
16701   // node_modules/d3-selection/src/selection/selectAll.js
16702   function arrayAll(select) {
16703     return function() {
16704       return array(select.apply(this, arguments));
16705     };
16706   }
16707   function selectAll_default(select) {
16708     if (typeof select === "function") select = arrayAll(select);
16709     else select = selectorAll_default(select);
16710     for (var groups = this._groups, m2 = groups.length, subgroups = [], parents = [], j2 = 0; j2 < m2; ++j2) {
16711       for (var group = groups[j2], n3 = group.length, node, i3 = 0; i3 < n3; ++i3) {
16712         if (node = group[i3]) {
16713           subgroups.push(select.call(node, node.__data__, i3, group));
16714           parents.push(node);
16715         }
16716       }
16717     }
16718     return new Selection(subgroups, parents);
16719   }
16720
16721   // node_modules/d3-selection/src/matcher.js
16722   function matcher_default(selector) {
16723     return function() {
16724       return this.matches(selector);
16725     };
16726   }
16727   function childMatcher(selector) {
16728     return function(node) {
16729       return node.matches(selector);
16730     };
16731   }
16732
16733   // node_modules/d3-selection/src/selection/selectChild.js
16734   var find = Array.prototype.find;
16735   function childFind(match) {
16736     return function() {
16737       return find.call(this.children, match);
16738     };
16739   }
16740   function childFirst() {
16741     return this.firstElementChild;
16742   }
16743   function selectChild_default(match) {
16744     return this.select(match == null ? childFirst : childFind(typeof match === "function" ? match : childMatcher(match)));
16745   }
16746
16747   // node_modules/d3-selection/src/selection/selectChildren.js
16748   var filter = Array.prototype.filter;
16749   function children() {
16750     return Array.from(this.children);
16751   }
16752   function childrenFilter(match) {
16753     return function() {
16754       return filter.call(this.children, match);
16755     };
16756   }
16757   function selectChildren_default(match) {
16758     return this.selectAll(match == null ? children : childrenFilter(typeof match === "function" ? match : childMatcher(match)));
16759   }
16760
16761   // node_modules/d3-selection/src/selection/filter.js
16762   function filter_default(match) {
16763     if (typeof match !== "function") match = matcher_default(match);
16764     for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j2 = 0; j2 < m2; ++j2) {
16765       for (var group = groups[j2], n3 = group.length, subgroup = subgroups[j2] = [], node, i3 = 0; i3 < n3; ++i3) {
16766         if ((node = group[i3]) && match.call(node, node.__data__, i3, group)) {
16767           subgroup.push(node);
16768         }
16769       }
16770     }
16771     return new Selection(subgroups, this._parents);
16772   }
16773
16774   // node_modules/d3-selection/src/selection/sparse.js
16775   function sparse_default(update) {
16776     return new Array(update.length);
16777   }
16778
16779   // node_modules/d3-selection/src/selection/enter.js
16780   function enter_default() {
16781     return new Selection(this._enter || this._groups.map(sparse_default), this._parents);
16782   }
16783   function EnterNode(parent, datum2) {
16784     this.ownerDocument = parent.ownerDocument;
16785     this.namespaceURI = parent.namespaceURI;
16786     this._next = null;
16787     this._parent = parent;
16788     this.__data__ = datum2;
16789   }
16790   EnterNode.prototype = {
16791     constructor: EnterNode,
16792     appendChild: function(child) {
16793       return this._parent.insertBefore(child, this._next);
16794     },
16795     insertBefore: function(child, next) {
16796       return this._parent.insertBefore(child, next);
16797     },
16798     querySelector: function(selector) {
16799       return this._parent.querySelector(selector);
16800     },
16801     querySelectorAll: function(selector) {
16802       return this._parent.querySelectorAll(selector);
16803     }
16804   };
16805
16806   // node_modules/d3-selection/src/constant.js
16807   function constant_default(x2) {
16808     return function() {
16809       return x2;
16810     };
16811   }
16812
16813   // node_modules/d3-selection/src/selection/data.js
16814   function bindIndex(parent, group, enter, update, exit, data) {
16815     var i3 = 0, node, groupLength = group.length, dataLength = data.length;
16816     for (; i3 < dataLength; ++i3) {
16817       if (node = group[i3]) {
16818         node.__data__ = data[i3];
16819         update[i3] = node;
16820       } else {
16821         enter[i3] = new EnterNode(parent, data[i3]);
16822       }
16823     }
16824     for (; i3 < groupLength; ++i3) {
16825       if (node = group[i3]) {
16826         exit[i3] = node;
16827       }
16828     }
16829   }
16830   function bindKey(parent, group, enter, update, exit, data, key) {
16831     var i3, node, nodeByKeyValue = /* @__PURE__ */ new Map(), groupLength = group.length, dataLength = data.length, keyValues = new Array(groupLength), keyValue;
16832     for (i3 = 0; i3 < groupLength; ++i3) {
16833       if (node = group[i3]) {
16834         keyValues[i3] = keyValue = key.call(node, node.__data__, i3, group) + "";
16835         if (nodeByKeyValue.has(keyValue)) {
16836           exit[i3] = node;
16837         } else {
16838           nodeByKeyValue.set(keyValue, node);
16839         }
16840       }
16841     }
16842     for (i3 = 0; i3 < dataLength; ++i3) {
16843       keyValue = key.call(parent, data[i3], i3, data) + "";
16844       if (node = nodeByKeyValue.get(keyValue)) {
16845         update[i3] = node;
16846         node.__data__ = data[i3];
16847         nodeByKeyValue.delete(keyValue);
16848       } else {
16849         enter[i3] = new EnterNode(parent, data[i3]);
16850       }
16851     }
16852     for (i3 = 0; i3 < groupLength; ++i3) {
16853       if ((node = group[i3]) && nodeByKeyValue.get(keyValues[i3]) === node) {
16854         exit[i3] = node;
16855       }
16856     }
16857   }
16858   function datum(node) {
16859     return node.__data__;
16860   }
16861   function data_default(value, key) {
16862     if (!arguments.length) return Array.from(this, datum);
16863     var bind = key ? bindKey : bindIndex, parents = this._parents, groups = this._groups;
16864     if (typeof value !== "function") value = constant_default(value);
16865     for (var m2 = groups.length, update = new Array(m2), enter = new Array(m2), exit = new Array(m2), j2 = 0; j2 < m2; ++j2) {
16866       var parent = parents[j2], group = groups[j2], groupLength = group.length, data = arraylike(value.call(parent, parent && parent.__data__, j2, parents)), dataLength = data.length, enterGroup = enter[j2] = new Array(dataLength), updateGroup = update[j2] = new Array(dataLength), exitGroup = exit[j2] = new Array(groupLength);
16867       bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);
16868       for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {
16869         if (previous = enterGroup[i0]) {
16870           if (i0 >= i1) i1 = i0 + 1;
16871           while (!(next = updateGroup[i1]) && ++i1 < dataLength) ;
16872           previous._next = next || null;
16873         }
16874       }
16875     }
16876     update = new Selection(update, parents);
16877     update._enter = enter;
16878     update._exit = exit;
16879     return update;
16880   }
16881   function arraylike(data) {
16882     return typeof data === "object" && "length" in data ? data : Array.from(data);
16883   }
16884
16885   // node_modules/d3-selection/src/selection/exit.js
16886   function exit_default() {
16887     return new Selection(this._exit || this._groups.map(sparse_default), this._parents);
16888   }
16889
16890   // node_modules/d3-selection/src/selection/join.js
16891   function join_default(onenter, onupdate, onexit) {
16892     var enter = this.enter(), update = this, exit = this.exit();
16893     if (typeof onenter === "function") {
16894       enter = onenter(enter);
16895       if (enter) enter = enter.selection();
16896     } else {
16897       enter = enter.append(onenter + "");
16898     }
16899     if (onupdate != null) {
16900       update = onupdate(update);
16901       if (update) update = update.selection();
16902     }
16903     if (onexit == null) exit.remove();
16904     else onexit(exit);
16905     return enter && update ? enter.merge(update).order() : update;
16906   }
16907
16908   // node_modules/d3-selection/src/selection/merge.js
16909   function merge_default(context) {
16910     var selection2 = context.selection ? context.selection() : context;
16911     for (var groups0 = this._groups, groups1 = selection2._groups, m0 = groups0.length, m1 = groups1.length, m2 = Math.min(m0, m1), merges = new Array(m0), j2 = 0; j2 < m2; ++j2) {
16912       for (var group0 = groups0[j2], group1 = groups1[j2], n3 = group0.length, merge2 = merges[j2] = new Array(n3), node, i3 = 0; i3 < n3; ++i3) {
16913         if (node = group0[i3] || group1[i3]) {
16914           merge2[i3] = node;
16915         }
16916       }
16917     }
16918     for (; j2 < m0; ++j2) {
16919       merges[j2] = groups0[j2];
16920     }
16921     return new Selection(merges, this._parents);
16922   }
16923
16924   // node_modules/d3-selection/src/selection/order.js
16925   function order_default() {
16926     for (var groups = this._groups, j2 = -1, m2 = groups.length; ++j2 < m2; ) {
16927       for (var group = groups[j2], i3 = group.length - 1, next = group[i3], node; --i3 >= 0; ) {
16928         if (node = group[i3]) {
16929           if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next);
16930           next = node;
16931         }
16932       }
16933     }
16934     return this;
16935   }
16936
16937   // node_modules/d3-selection/src/selection/sort.js
16938   function sort_default(compare2) {
16939     if (!compare2) compare2 = ascending2;
16940     function compareNode(a2, b2) {
16941       return a2 && b2 ? compare2(a2.__data__, b2.__data__) : !a2 - !b2;
16942     }
16943     for (var groups = this._groups, m2 = groups.length, sortgroups = new Array(m2), j2 = 0; j2 < m2; ++j2) {
16944       for (var group = groups[j2], n3 = group.length, sortgroup = sortgroups[j2] = new Array(n3), node, i3 = 0; i3 < n3; ++i3) {
16945         if (node = group[i3]) {
16946           sortgroup[i3] = node;
16947         }
16948       }
16949       sortgroup.sort(compareNode);
16950     }
16951     return new Selection(sortgroups, this._parents).order();
16952   }
16953   function ascending2(a2, b2) {
16954     return a2 < b2 ? -1 : a2 > b2 ? 1 : a2 >= b2 ? 0 : NaN;
16955   }
16956
16957   // node_modules/d3-selection/src/selection/call.js
16958   function call_default() {
16959     var callback = arguments[0];
16960     arguments[0] = this;
16961     callback.apply(null, arguments);
16962     return this;
16963   }
16964
16965   // node_modules/d3-selection/src/selection/nodes.js
16966   function nodes_default() {
16967     return Array.from(this);
16968   }
16969
16970   // node_modules/d3-selection/src/selection/node.js
16971   function node_default() {
16972     for (var groups = this._groups, j2 = 0, m2 = groups.length; j2 < m2; ++j2) {
16973       for (var group = groups[j2], i3 = 0, n3 = group.length; i3 < n3; ++i3) {
16974         var node = group[i3];
16975         if (node) return node;
16976       }
16977     }
16978     return null;
16979   }
16980
16981   // node_modules/d3-selection/src/selection/size.js
16982   function size_default() {
16983     let size = 0;
16984     for (const node of this) ++size;
16985     return size;
16986   }
16987
16988   // node_modules/d3-selection/src/selection/empty.js
16989   function empty_default() {
16990     return !this.node();
16991   }
16992
16993   // node_modules/d3-selection/src/selection/each.js
16994   function each_default(callback) {
16995     for (var groups = this._groups, j2 = 0, m2 = groups.length; j2 < m2; ++j2) {
16996       for (var group = groups[j2], i3 = 0, n3 = group.length, node; i3 < n3; ++i3) {
16997         if (node = group[i3]) callback.call(node, node.__data__, i3, group);
16998       }
16999     }
17000     return this;
17001   }
17002
17003   // node_modules/d3-selection/src/selection/attr.js
17004   function attrRemove(name) {
17005     return function() {
17006       this.removeAttribute(name);
17007     };
17008   }
17009   function attrRemoveNS(fullname) {
17010     return function() {
17011       this.removeAttributeNS(fullname.space, fullname.local);
17012     };
17013   }
17014   function attrConstant(name, value) {
17015     return function() {
17016       this.setAttribute(name, value);
17017     };
17018   }
17019   function attrConstantNS(fullname, value) {
17020     return function() {
17021       this.setAttributeNS(fullname.space, fullname.local, value);
17022     };
17023   }
17024   function attrFunction(name, value) {
17025     return function() {
17026       var v2 = value.apply(this, arguments);
17027       if (v2 == null) this.removeAttribute(name);
17028       else this.setAttribute(name, v2);
17029     };
17030   }
17031   function attrFunctionNS(fullname, value) {
17032     return function() {
17033       var v2 = value.apply(this, arguments);
17034       if (v2 == null) this.removeAttributeNS(fullname.space, fullname.local);
17035       else this.setAttributeNS(fullname.space, fullname.local, v2);
17036     };
17037   }
17038   function attr_default(name, value) {
17039     var fullname = namespace_default(name);
17040     if (arguments.length < 2) {
17041       var node = this.node();
17042       return fullname.local ? node.getAttributeNS(fullname.space, fullname.local) : node.getAttribute(fullname);
17043     }
17044     return this.each((value == null ? fullname.local ? attrRemoveNS : attrRemove : typeof value === "function" ? fullname.local ? attrFunctionNS : attrFunction : fullname.local ? attrConstantNS : attrConstant)(fullname, value));
17045   }
17046
17047   // node_modules/d3-selection/src/window.js
17048   function window_default(node) {
17049     return node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView;
17050   }
17051
17052   // node_modules/d3-selection/src/selection/style.js
17053   function styleRemove(name) {
17054     return function() {
17055       this.style.removeProperty(name);
17056     };
17057   }
17058   function styleConstant(name, value, priority) {
17059     return function() {
17060       this.style.setProperty(name, value, priority);
17061     };
17062   }
17063   function styleFunction(name, value, priority) {
17064     return function() {
17065       var v2 = value.apply(this, arguments);
17066       if (v2 == null) this.style.removeProperty(name);
17067       else this.style.setProperty(name, v2, priority);
17068     };
17069   }
17070   function style_default(name, value, priority) {
17071     return arguments.length > 1 ? this.each((value == null ? styleRemove : typeof value === "function" ? styleFunction : styleConstant)(name, value, priority == null ? "" : priority)) : styleValue(this.node(), name);
17072   }
17073   function styleValue(node, name) {
17074     return node.style.getPropertyValue(name) || window_default(node).getComputedStyle(node, null).getPropertyValue(name);
17075   }
17076
17077   // node_modules/d3-selection/src/selection/property.js
17078   function propertyRemove(name) {
17079     return function() {
17080       delete this[name];
17081     };
17082   }
17083   function propertyConstant(name, value) {
17084     return function() {
17085       this[name] = value;
17086     };
17087   }
17088   function propertyFunction(name, value) {
17089     return function() {
17090       var v2 = value.apply(this, arguments);
17091       if (v2 == null) delete this[name];
17092       else this[name] = v2;
17093     };
17094   }
17095   function property_default(name, value) {
17096     return arguments.length > 1 ? this.each((value == null ? propertyRemove : typeof value === "function" ? propertyFunction : propertyConstant)(name, value)) : this.node()[name];
17097   }
17098
17099   // node_modules/d3-selection/src/selection/classed.js
17100   function classArray(string) {
17101     return string.trim().split(/^|\s+/);
17102   }
17103   function classList(node) {
17104     return node.classList || new ClassList(node);
17105   }
17106   function ClassList(node) {
17107     this._node = node;
17108     this._names = classArray(node.getAttribute("class") || "");
17109   }
17110   ClassList.prototype = {
17111     add: function(name) {
17112       var i3 = this._names.indexOf(name);
17113       if (i3 < 0) {
17114         this._names.push(name);
17115         this._node.setAttribute("class", this._names.join(" "));
17116       }
17117     },
17118     remove: function(name) {
17119       var i3 = this._names.indexOf(name);
17120       if (i3 >= 0) {
17121         this._names.splice(i3, 1);
17122         this._node.setAttribute("class", this._names.join(" "));
17123       }
17124     },
17125     contains: function(name) {
17126       return this._names.indexOf(name) >= 0;
17127     }
17128   };
17129   function classedAdd(node, names) {
17130     var list2 = classList(node), i3 = -1, n3 = names.length;
17131     while (++i3 < n3) list2.add(names[i3]);
17132   }
17133   function classedRemove(node, names) {
17134     var list2 = classList(node), i3 = -1, n3 = names.length;
17135     while (++i3 < n3) list2.remove(names[i3]);
17136   }
17137   function classedTrue(names) {
17138     return function() {
17139       classedAdd(this, names);
17140     };
17141   }
17142   function classedFalse(names) {
17143     return function() {
17144       classedRemove(this, names);
17145     };
17146   }
17147   function classedFunction(names, value) {
17148     return function() {
17149       (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
17150     };
17151   }
17152   function classed_default(name, value) {
17153     var names = classArray(name + "");
17154     if (arguments.length < 2) {
17155       var list2 = classList(this.node()), i3 = -1, n3 = names.length;
17156       while (++i3 < n3) if (!list2.contains(names[i3])) return false;
17157       return true;
17158     }
17159     return this.each((typeof value === "function" ? classedFunction : value ? classedTrue : classedFalse)(names, value));
17160   }
17161
17162   // node_modules/d3-selection/src/selection/text.js
17163   function textRemove() {
17164     this.textContent = "";
17165   }
17166   function textConstant(value) {
17167     return function() {
17168       this.textContent = value;
17169     };
17170   }
17171   function textFunction(value) {
17172     return function() {
17173       var v2 = value.apply(this, arguments);
17174       this.textContent = v2 == null ? "" : v2;
17175     };
17176   }
17177   function text_default(value) {
17178     return arguments.length ? this.each(value == null ? textRemove : (typeof value === "function" ? textFunction : textConstant)(value)) : this.node().textContent;
17179   }
17180
17181   // node_modules/d3-selection/src/selection/html.js
17182   function htmlRemove() {
17183     this.innerHTML = "";
17184   }
17185   function htmlConstant(value) {
17186     return function() {
17187       this.innerHTML = value;
17188     };
17189   }
17190   function htmlFunction(value) {
17191     return function() {
17192       var v2 = value.apply(this, arguments);
17193       this.innerHTML = v2 == null ? "" : v2;
17194     };
17195   }
17196   function html_default(value) {
17197     return arguments.length ? this.each(value == null ? htmlRemove : (typeof value === "function" ? htmlFunction : htmlConstant)(value)) : this.node().innerHTML;
17198   }
17199
17200   // node_modules/d3-selection/src/selection/raise.js
17201   function raise() {
17202     if (this.nextSibling) this.parentNode.appendChild(this);
17203   }
17204   function raise_default() {
17205     return this.each(raise);
17206   }
17207
17208   // node_modules/d3-selection/src/selection/lower.js
17209   function lower() {
17210     if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);
17211   }
17212   function lower_default() {
17213     return this.each(lower);
17214   }
17215
17216   // node_modules/d3-selection/src/selection/append.js
17217   function append_default(name) {
17218     var create2 = typeof name === "function" ? name : creator_default(name);
17219     return this.select(function() {
17220       return this.appendChild(create2.apply(this, arguments));
17221     });
17222   }
17223
17224   // node_modules/d3-selection/src/selection/insert.js
17225   function constantNull() {
17226     return null;
17227   }
17228   function insert_default(name, before) {
17229     var create2 = typeof name === "function" ? name : creator_default(name), select = before == null ? constantNull : typeof before === "function" ? before : selector_default(before);
17230     return this.select(function() {
17231       return this.insertBefore(create2.apply(this, arguments), select.apply(this, arguments) || null);
17232     });
17233   }
17234
17235   // node_modules/d3-selection/src/selection/remove.js
17236   function remove() {
17237     var parent = this.parentNode;
17238     if (parent) parent.removeChild(this);
17239   }
17240   function remove_default() {
17241     return this.each(remove);
17242   }
17243
17244   // node_modules/d3-selection/src/selection/clone.js
17245   function selection_cloneShallow() {
17246     var clone2 = this.cloneNode(false), parent = this.parentNode;
17247     return parent ? parent.insertBefore(clone2, this.nextSibling) : clone2;
17248   }
17249   function selection_cloneDeep() {
17250     var clone2 = this.cloneNode(true), parent = this.parentNode;
17251     return parent ? parent.insertBefore(clone2, this.nextSibling) : clone2;
17252   }
17253   function clone_default(deep) {
17254     return this.select(deep ? selection_cloneDeep : selection_cloneShallow);
17255   }
17256
17257   // node_modules/d3-selection/src/selection/datum.js
17258   function datum_default(value) {
17259     return arguments.length ? this.property("__data__", value) : this.node().__data__;
17260   }
17261
17262   // node_modules/d3-selection/src/selection/on.js
17263   function contextListener(listener) {
17264     return function(event) {
17265       listener.call(this, event, this.__data__);
17266     };
17267   }
17268   function parseTypenames2(typenames) {
17269     return typenames.trim().split(/^|\s+/).map(function(t2) {
17270       var name = "", i3 = t2.indexOf(".");
17271       if (i3 >= 0) name = t2.slice(i3 + 1), t2 = t2.slice(0, i3);
17272       return { type: t2, name };
17273     });
17274   }
17275   function onRemove(typename) {
17276     return function() {
17277       var on = this.__on;
17278       if (!on) return;
17279       for (var j2 = 0, i3 = -1, m2 = on.length, o2; j2 < m2; ++j2) {
17280         if (o2 = on[j2], (!typename.type || o2.type === typename.type) && o2.name === typename.name) {
17281           this.removeEventListener(o2.type, o2.listener, o2.options);
17282         } else {
17283           on[++i3] = o2;
17284         }
17285       }
17286       if (++i3) on.length = i3;
17287       else delete this.__on;
17288     };
17289   }
17290   function onAdd(typename, value, options2) {
17291     return function() {
17292       var on = this.__on, o2, listener = contextListener(value);
17293       if (on) for (var j2 = 0, m2 = on.length; j2 < m2; ++j2) {
17294         if ((o2 = on[j2]).type === typename.type && o2.name === typename.name) {
17295           this.removeEventListener(o2.type, o2.listener, o2.options);
17296           this.addEventListener(o2.type, o2.listener = listener, o2.options = options2);
17297           o2.value = value;
17298           return;
17299         }
17300       }
17301       this.addEventListener(typename.type, listener, options2);
17302       o2 = { type: typename.type, name: typename.name, value, listener, options: options2 };
17303       if (!on) this.__on = [o2];
17304       else on.push(o2);
17305     };
17306   }
17307   function on_default(typename, value, options2) {
17308     var typenames = parseTypenames2(typename + ""), i3, n3 = typenames.length, t2;
17309     if (arguments.length < 2) {
17310       var on = this.node().__on;
17311       if (on) for (var j2 = 0, m2 = on.length, o2; j2 < m2; ++j2) {
17312         for (i3 = 0, o2 = on[j2]; i3 < n3; ++i3) {
17313           if ((t2 = typenames[i3]).type === o2.type && t2.name === o2.name) {
17314             return o2.value;
17315           }
17316         }
17317       }
17318       return;
17319     }
17320     on = value ? onAdd : onRemove;
17321     for (i3 = 0; i3 < n3; ++i3) this.each(on(typenames[i3], value, options2));
17322     return this;
17323   }
17324
17325   // node_modules/d3-selection/src/selection/dispatch.js
17326   function dispatchEvent(node, type2, params) {
17327     var window2 = window_default(node), event = window2.CustomEvent;
17328     if (typeof event === "function") {
17329       event = new event(type2, params);
17330     } else {
17331       event = window2.document.createEvent("Event");
17332       if (params) event.initEvent(type2, params.bubbles, params.cancelable), event.detail = params.detail;
17333       else event.initEvent(type2, false, false);
17334     }
17335     node.dispatchEvent(event);
17336   }
17337   function dispatchConstant(type2, params) {
17338     return function() {
17339       return dispatchEvent(this, type2, params);
17340     };
17341   }
17342   function dispatchFunction(type2, params) {
17343     return function() {
17344       return dispatchEvent(this, type2, params.apply(this, arguments));
17345     };
17346   }
17347   function dispatch_default2(type2, params) {
17348     return this.each((typeof params === "function" ? dispatchFunction : dispatchConstant)(type2, params));
17349   }
17350
17351   // node_modules/d3-selection/src/selection/iterator.js
17352   function* iterator_default() {
17353     for (var groups = this._groups, j2 = 0, m2 = groups.length; j2 < m2; ++j2) {
17354       for (var group = groups[j2], i3 = 0, n3 = group.length, node; i3 < n3; ++i3) {
17355         if (node = group[i3]) yield node;
17356       }
17357     }
17358   }
17359
17360   // node_modules/d3-selection/src/selection/index.js
17361   var root = [null];
17362   function Selection(groups, parents) {
17363     this._groups = groups;
17364     this._parents = parents;
17365   }
17366   function selection() {
17367     return new Selection([[document.documentElement]], root);
17368   }
17369   function selection_selection() {
17370     return this;
17371   }
17372   Selection.prototype = selection.prototype = {
17373     constructor: Selection,
17374     select: select_default,
17375     selectAll: selectAll_default,
17376     selectChild: selectChild_default,
17377     selectChildren: selectChildren_default,
17378     filter: filter_default,
17379     data: data_default,
17380     enter: enter_default,
17381     exit: exit_default,
17382     join: join_default,
17383     merge: merge_default,
17384     selection: selection_selection,
17385     order: order_default,
17386     sort: sort_default,
17387     call: call_default,
17388     nodes: nodes_default,
17389     node: node_default,
17390     size: size_default,
17391     empty: empty_default,
17392     each: each_default,
17393     attr: attr_default,
17394     style: style_default,
17395     property: property_default,
17396     classed: classed_default,
17397     text: text_default,
17398     html: html_default,
17399     raise: raise_default,
17400     lower: lower_default,
17401     append: append_default,
17402     insert: insert_default,
17403     remove: remove_default,
17404     clone: clone_default,
17405     datum: datum_default,
17406     on: on_default,
17407     dispatch: dispatch_default2,
17408     [Symbol.iterator]: iterator_default
17409   };
17410   var selection_default = selection;
17411
17412   // node_modules/d3-selection/src/select.js
17413   function select_default2(selector) {
17414     return typeof selector === "string" ? new Selection([[document.querySelector(selector)]], [document.documentElement]) : new Selection([[selector]], root);
17415   }
17416
17417   // node_modules/d3-selection/src/sourceEvent.js
17418   function sourceEvent_default(event) {
17419     let sourceEvent;
17420     while (sourceEvent = event.sourceEvent) event = sourceEvent;
17421     return event;
17422   }
17423
17424   // node_modules/d3-selection/src/pointer.js
17425   function pointer_default(event, node) {
17426     event = sourceEvent_default(event);
17427     if (node === void 0) node = event.currentTarget;
17428     if (node) {
17429       var svg2 = node.ownerSVGElement || node;
17430       if (svg2.createSVGPoint) {
17431         var point = svg2.createSVGPoint();
17432         point.x = event.clientX, point.y = event.clientY;
17433         point = point.matrixTransform(node.getScreenCTM().inverse());
17434         return [point.x, point.y];
17435       }
17436       if (node.getBoundingClientRect) {
17437         var rect = node.getBoundingClientRect();
17438         return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
17439       }
17440     }
17441     return [event.pageX, event.pageY];
17442   }
17443
17444   // node_modules/d3-selection/src/selectAll.js
17445   function selectAll_default2(selector) {
17446     return typeof selector === "string" ? new Selection([document.querySelectorAll(selector)], [document.documentElement]) : new Selection([array(selector)], root);
17447   }
17448
17449   // node_modules/d3-drag/src/noevent.js
17450   var nonpassive = { passive: false };
17451   var nonpassivecapture = { capture: true, passive: false };
17452   function nopropagation(event) {
17453     event.stopImmediatePropagation();
17454   }
17455   function noevent_default(event) {
17456     event.preventDefault();
17457     event.stopImmediatePropagation();
17458   }
17459
17460   // node_modules/d3-drag/src/nodrag.js
17461   function nodrag_default(view) {
17462     var root3 = view.document.documentElement, selection2 = select_default2(view).on("dragstart.drag", noevent_default, nonpassivecapture);
17463     if ("onselectstart" in root3) {
17464       selection2.on("selectstart.drag", noevent_default, nonpassivecapture);
17465     } else {
17466       root3.__noselect = root3.style.MozUserSelect;
17467       root3.style.MozUserSelect = "none";
17468     }
17469   }
17470   function yesdrag(view, noclick) {
17471     var root3 = view.document.documentElement, selection2 = select_default2(view).on("dragstart.drag", null);
17472     if (noclick) {
17473       selection2.on("click.drag", noevent_default, nonpassivecapture);
17474       setTimeout(function() {
17475         selection2.on("click.drag", null);
17476       }, 0);
17477     }
17478     if ("onselectstart" in root3) {
17479       selection2.on("selectstart.drag", null);
17480     } else {
17481       root3.style.MozUserSelect = root3.__noselect;
17482       delete root3.__noselect;
17483     }
17484   }
17485
17486   // node_modules/d3-drag/src/constant.js
17487   var constant_default2 = (x2) => () => x2;
17488
17489   // node_modules/d3-drag/src/event.js
17490   function DragEvent(type2, {
17491     sourceEvent,
17492     subject,
17493     target,
17494     identifier,
17495     active,
17496     x: x2,
17497     y: y2,
17498     dx,
17499     dy,
17500     dispatch: dispatch14
17501   }) {
17502     Object.defineProperties(this, {
17503       type: { value: type2, enumerable: true, configurable: true },
17504       sourceEvent: { value: sourceEvent, enumerable: true, configurable: true },
17505       subject: { value: subject, enumerable: true, configurable: true },
17506       target: { value: target, enumerable: true, configurable: true },
17507       identifier: { value: identifier, enumerable: true, configurable: true },
17508       active: { value: active, enumerable: true, configurable: true },
17509       x: { value: x2, enumerable: true, configurable: true },
17510       y: { value: y2, enumerable: true, configurable: true },
17511       dx: { value: dx, enumerable: true, configurable: true },
17512       dy: { value: dy, enumerable: true, configurable: true },
17513       _: { value: dispatch14 }
17514     });
17515   }
17516   DragEvent.prototype.on = function() {
17517     var value = this._.on.apply(this._, arguments);
17518     return value === this._ ? this : value;
17519   };
17520
17521   // node_modules/d3-drag/src/drag.js
17522   function defaultFilter(event) {
17523     return !event.ctrlKey && !event.button;
17524   }
17525   function defaultContainer() {
17526     return this.parentNode;
17527   }
17528   function defaultSubject(event, d2) {
17529     return d2 == null ? { x: event.x, y: event.y } : d2;
17530   }
17531   function defaultTouchable() {
17532     return navigator.maxTouchPoints || "ontouchstart" in this;
17533   }
17534   function drag_default() {
17535     var filter2 = defaultFilter, container = defaultContainer, subject = defaultSubject, touchable = defaultTouchable, gestures = {}, listeners = dispatch_default("start", "drag", "end"), active = 0, mousedownx, mousedowny, mousemoving, touchending, clickDistance2 = 0;
17536     function drag(selection2) {
17537       selection2.on("mousedown.drag", mousedowned).filter(touchable).on("touchstart.drag", touchstarted).on("touchmove.drag", touchmoved, nonpassive).on("touchend.drag touchcancel.drag", touchended).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
17538     }
17539     function mousedowned(event, d2) {
17540       if (touchending || !filter2.call(this, event, d2)) return;
17541       var gesture = beforestart(this, container.call(this, event, d2), event, d2, "mouse");
17542       if (!gesture) return;
17543       select_default2(event.view).on("mousemove.drag", mousemoved, nonpassivecapture).on("mouseup.drag", mouseupped, nonpassivecapture);
17544       nodrag_default(event.view);
17545       nopropagation(event);
17546       mousemoving = false;
17547       mousedownx = event.clientX;
17548       mousedowny = event.clientY;
17549       gesture("start", event);
17550     }
17551     function mousemoved(event) {
17552       noevent_default(event);
17553       if (!mousemoving) {
17554         var dx = event.clientX - mousedownx, dy = event.clientY - mousedowny;
17555         mousemoving = dx * dx + dy * dy > clickDistance2;
17556       }
17557       gestures.mouse("drag", event);
17558     }
17559     function mouseupped(event) {
17560       select_default2(event.view).on("mousemove.drag mouseup.drag", null);
17561       yesdrag(event.view, mousemoving);
17562       noevent_default(event);
17563       gestures.mouse("end", event);
17564     }
17565     function touchstarted(event, d2) {
17566       if (!filter2.call(this, event, d2)) return;
17567       var touches = event.changedTouches, c2 = container.call(this, event, d2), n3 = touches.length, i3, gesture;
17568       for (i3 = 0; i3 < n3; ++i3) {
17569         if (gesture = beforestart(this, c2, event, d2, touches[i3].identifier, touches[i3])) {
17570           nopropagation(event);
17571           gesture("start", event, touches[i3]);
17572         }
17573       }
17574     }
17575     function touchmoved(event) {
17576       var touches = event.changedTouches, n3 = touches.length, i3, gesture;
17577       for (i3 = 0; i3 < n3; ++i3) {
17578         if (gesture = gestures[touches[i3].identifier]) {
17579           noevent_default(event);
17580           gesture("drag", event, touches[i3]);
17581         }
17582       }
17583     }
17584     function touchended(event) {
17585       var touches = event.changedTouches, n3 = touches.length, i3, gesture;
17586       if (touchending) clearTimeout(touchending);
17587       touchending = setTimeout(function() {
17588         touchending = null;
17589       }, 500);
17590       for (i3 = 0; i3 < n3; ++i3) {
17591         if (gesture = gestures[touches[i3].identifier]) {
17592           nopropagation(event);
17593           gesture("end", event, touches[i3]);
17594         }
17595       }
17596     }
17597     function beforestart(that, container2, event, d2, identifier, touch) {
17598       var dispatch14 = listeners.copy(), p2 = pointer_default(touch || event, container2), dx, dy, s2;
17599       if ((s2 = subject.call(that, new DragEvent("beforestart", {
17600         sourceEvent: event,
17601         target: drag,
17602         identifier,
17603         active,
17604         x: p2[0],
17605         y: p2[1],
17606         dx: 0,
17607         dy: 0,
17608         dispatch: dispatch14
17609       }), d2)) == null) return;
17610       dx = s2.x - p2[0] || 0;
17611       dy = s2.y - p2[1] || 0;
17612       return function gesture(type2, event2, touch2) {
17613         var p02 = p2, n3;
17614         switch (type2) {
17615           case "start":
17616             gestures[identifier] = gesture, n3 = active++;
17617             break;
17618           case "end":
17619             delete gestures[identifier], --active;
17620           // falls through
17621           case "drag":
17622             p2 = pointer_default(touch2 || event2, container2), n3 = active;
17623             break;
17624         }
17625         dispatch14.call(
17626           type2,
17627           that,
17628           new DragEvent(type2, {
17629             sourceEvent: event2,
17630             subject: s2,
17631             target: drag,
17632             identifier,
17633             active: n3,
17634             x: p2[0] + dx,
17635             y: p2[1] + dy,
17636             dx: p2[0] - p02[0],
17637             dy: p2[1] - p02[1],
17638             dispatch: dispatch14
17639           }),
17640           d2
17641         );
17642       };
17643     }
17644     drag.filter = function(_2) {
17645       return arguments.length ? (filter2 = typeof _2 === "function" ? _2 : constant_default2(!!_2), drag) : filter2;
17646     };
17647     drag.container = function(_2) {
17648       return arguments.length ? (container = typeof _2 === "function" ? _2 : constant_default2(_2), drag) : container;
17649     };
17650     drag.subject = function(_2) {
17651       return arguments.length ? (subject = typeof _2 === "function" ? _2 : constant_default2(_2), drag) : subject;
17652     };
17653     drag.touchable = function(_2) {
17654       return arguments.length ? (touchable = typeof _2 === "function" ? _2 : constant_default2(!!_2), drag) : touchable;
17655     };
17656     drag.on = function() {
17657       var value = listeners.on.apply(listeners, arguments);
17658       return value === listeners ? drag : value;
17659     };
17660     drag.clickDistance = function(_2) {
17661       return arguments.length ? (clickDistance2 = (_2 = +_2) * _2, drag) : Math.sqrt(clickDistance2);
17662     };
17663     return drag;
17664   }
17665
17666   // node_modules/d3-color/src/define.js
17667   function define_default(constructor, factory, prototype) {
17668     constructor.prototype = factory.prototype = prototype;
17669     prototype.constructor = constructor;
17670   }
17671   function extend(parent, definition) {
17672     var prototype = Object.create(parent.prototype);
17673     for (var key in definition) prototype[key] = definition[key];
17674     return prototype;
17675   }
17676
17677   // node_modules/d3-color/src/color.js
17678   function Color() {
17679   }
17680   var darker = 0.7;
17681   var brighter = 1 / darker;
17682   var reI = "\\s*([+-]?\\d+)\\s*";
17683   var reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*";
17684   var reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*";
17685   var reHex = /^#([0-9a-f]{3,8})$/;
17686   var reRgbInteger = new RegExp("^rgb\\(".concat(reI, ",").concat(reI, ",").concat(reI, "\\)$"));
17687   var reRgbPercent = new RegExp("^rgb\\(".concat(reP, ",").concat(reP, ",").concat(reP, "\\)$"));
17688   var reRgbaInteger = new RegExp("^rgba\\(".concat(reI, ",").concat(reI, ",").concat(reI, ",").concat(reN, "\\)$"));
17689   var reRgbaPercent = new RegExp("^rgba\\(".concat(reP, ",").concat(reP, ",").concat(reP, ",").concat(reN, "\\)$"));
17690   var reHslPercent = new RegExp("^hsl\\(".concat(reN, ",").concat(reP, ",").concat(reP, "\\)$"));
17691   var reHslaPercent = new RegExp("^hsla\\(".concat(reN, ",").concat(reP, ",").concat(reP, ",").concat(reN, "\\)$"));
17692   var named = {
17693     aliceblue: 15792383,
17694     antiquewhite: 16444375,
17695     aqua: 65535,
17696     aquamarine: 8388564,
17697     azure: 15794175,
17698     beige: 16119260,
17699     bisque: 16770244,
17700     black: 0,
17701     blanchedalmond: 16772045,
17702     blue: 255,
17703     blueviolet: 9055202,
17704     brown: 10824234,
17705     burlywood: 14596231,
17706     cadetblue: 6266528,
17707     chartreuse: 8388352,
17708     chocolate: 13789470,
17709     coral: 16744272,
17710     cornflowerblue: 6591981,
17711     cornsilk: 16775388,
17712     crimson: 14423100,
17713     cyan: 65535,
17714     darkblue: 139,
17715     darkcyan: 35723,
17716     darkgoldenrod: 12092939,
17717     darkgray: 11119017,
17718     darkgreen: 25600,
17719     darkgrey: 11119017,
17720     darkkhaki: 12433259,
17721     darkmagenta: 9109643,
17722     darkolivegreen: 5597999,
17723     darkorange: 16747520,
17724     darkorchid: 10040012,
17725     darkred: 9109504,
17726     darksalmon: 15308410,
17727     darkseagreen: 9419919,
17728     darkslateblue: 4734347,
17729     darkslategray: 3100495,
17730     darkslategrey: 3100495,
17731     darkturquoise: 52945,
17732     darkviolet: 9699539,
17733     deeppink: 16716947,
17734     deepskyblue: 49151,
17735     dimgray: 6908265,
17736     dimgrey: 6908265,
17737     dodgerblue: 2003199,
17738     firebrick: 11674146,
17739     floralwhite: 16775920,
17740     forestgreen: 2263842,
17741     fuchsia: 16711935,
17742     gainsboro: 14474460,
17743     ghostwhite: 16316671,
17744     gold: 16766720,
17745     goldenrod: 14329120,
17746     gray: 8421504,
17747     green: 32768,
17748     greenyellow: 11403055,
17749     grey: 8421504,
17750     honeydew: 15794160,
17751     hotpink: 16738740,
17752     indianred: 13458524,
17753     indigo: 4915330,
17754     ivory: 16777200,
17755     khaki: 15787660,
17756     lavender: 15132410,
17757     lavenderblush: 16773365,
17758     lawngreen: 8190976,
17759     lemonchiffon: 16775885,
17760     lightblue: 11393254,
17761     lightcoral: 15761536,
17762     lightcyan: 14745599,
17763     lightgoldenrodyellow: 16448210,
17764     lightgray: 13882323,
17765     lightgreen: 9498256,
17766     lightgrey: 13882323,
17767     lightpink: 16758465,
17768     lightsalmon: 16752762,
17769     lightseagreen: 2142890,
17770     lightskyblue: 8900346,
17771     lightslategray: 7833753,
17772     lightslategrey: 7833753,
17773     lightsteelblue: 11584734,
17774     lightyellow: 16777184,
17775     lime: 65280,
17776     limegreen: 3329330,
17777     linen: 16445670,
17778     magenta: 16711935,
17779     maroon: 8388608,
17780     mediumaquamarine: 6737322,
17781     mediumblue: 205,
17782     mediumorchid: 12211667,
17783     mediumpurple: 9662683,
17784     mediumseagreen: 3978097,
17785     mediumslateblue: 8087790,
17786     mediumspringgreen: 64154,
17787     mediumturquoise: 4772300,
17788     mediumvioletred: 13047173,
17789     midnightblue: 1644912,
17790     mintcream: 16121850,
17791     mistyrose: 16770273,
17792     moccasin: 16770229,
17793     navajowhite: 16768685,
17794     navy: 128,
17795     oldlace: 16643558,
17796     olive: 8421376,
17797     olivedrab: 7048739,
17798     orange: 16753920,
17799     orangered: 16729344,
17800     orchid: 14315734,
17801     palegoldenrod: 15657130,
17802     palegreen: 10025880,
17803     paleturquoise: 11529966,
17804     palevioletred: 14381203,
17805     papayawhip: 16773077,
17806     peachpuff: 16767673,
17807     peru: 13468991,
17808     pink: 16761035,
17809     plum: 14524637,
17810     powderblue: 11591910,
17811     purple: 8388736,
17812     rebeccapurple: 6697881,
17813     red: 16711680,
17814     rosybrown: 12357519,
17815     royalblue: 4286945,
17816     saddlebrown: 9127187,
17817     salmon: 16416882,
17818     sandybrown: 16032864,
17819     seagreen: 3050327,
17820     seashell: 16774638,
17821     sienna: 10506797,
17822     silver: 12632256,
17823     skyblue: 8900331,
17824     slateblue: 6970061,
17825     slategray: 7372944,
17826     slategrey: 7372944,
17827     snow: 16775930,
17828     springgreen: 65407,
17829     steelblue: 4620980,
17830     tan: 13808780,
17831     teal: 32896,
17832     thistle: 14204888,
17833     tomato: 16737095,
17834     turquoise: 4251856,
17835     violet: 15631086,
17836     wheat: 16113331,
17837     white: 16777215,
17838     whitesmoke: 16119285,
17839     yellow: 16776960,
17840     yellowgreen: 10145074
17841   };
17842   define_default(Color, color, {
17843     copy(channels) {
17844       return Object.assign(new this.constructor(), this, channels);
17845     },
17846     displayable() {
17847       return this.rgb().displayable();
17848     },
17849     hex: color_formatHex,
17850     // Deprecated! Use color.formatHex.
17851     formatHex: color_formatHex,
17852     formatHex8: color_formatHex8,
17853     formatHsl: color_formatHsl,
17854     formatRgb: color_formatRgb,
17855     toString: color_formatRgb
17856   });
17857   function color_formatHex() {
17858     return this.rgb().formatHex();
17859   }
17860   function color_formatHex8() {
17861     return this.rgb().formatHex8();
17862   }
17863   function color_formatHsl() {
17864     return hslConvert(this).formatHsl();
17865   }
17866   function color_formatRgb() {
17867     return this.rgb().formatRgb();
17868   }
17869   function color(format2) {
17870     var m2, l2;
17871     format2 = (format2 + "").trim().toLowerCase();
17872     return (m2 = reHex.exec(format2)) ? (l2 = m2[1].length, m2 = parseInt(m2[1], 16), l2 === 6 ? rgbn(m2) : l2 === 3 ? new Rgb(m2 >> 8 & 15 | m2 >> 4 & 240, m2 >> 4 & 15 | m2 & 240, (m2 & 15) << 4 | m2 & 15, 1) : l2 === 8 ? rgba(m2 >> 24 & 255, m2 >> 16 & 255, m2 >> 8 & 255, (m2 & 255) / 255) : l2 === 4 ? rgba(m2 >> 12 & 15 | m2 >> 8 & 240, m2 >> 8 & 15 | m2 >> 4 & 240, m2 >> 4 & 15 | m2 & 240, ((m2 & 15) << 4 | m2 & 15) / 255) : null) : (m2 = reRgbInteger.exec(format2)) ? new Rgb(m2[1], m2[2], m2[3], 1) : (m2 = reRgbPercent.exec(format2)) ? new Rgb(m2[1] * 255 / 100, m2[2] * 255 / 100, m2[3] * 255 / 100, 1) : (m2 = reRgbaInteger.exec(format2)) ? rgba(m2[1], m2[2], m2[3], m2[4]) : (m2 = reRgbaPercent.exec(format2)) ? rgba(m2[1] * 255 / 100, m2[2] * 255 / 100, m2[3] * 255 / 100, m2[4]) : (m2 = reHslPercent.exec(format2)) ? hsla(m2[1], m2[2] / 100, m2[3] / 100, 1) : (m2 = reHslaPercent.exec(format2)) ? hsla(m2[1], m2[2] / 100, m2[3] / 100, m2[4]) : named.hasOwnProperty(format2) ? rgbn(named[format2]) : format2 === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null;
17873   }
17874   function rgbn(n3) {
17875     return new Rgb(n3 >> 16 & 255, n3 >> 8 & 255, n3 & 255, 1);
17876   }
17877   function rgba(r2, g3, b2, a2) {
17878     if (a2 <= 0) r2 = g3 = b2 = NaN;
17879     return new Rgb(r2, g3, b2, a2);
17880   }
17881   function rgbConvert(o2) {
17882     if (!(o2 instanceof Color)) o2 = color(o2);
17883     if (!o2) return new Rgb();
17884     o2 = o2.rgb();
17885     return new Rgb(o2.r, o2.g, o2.b, o2.opacity);
17886   }
17887   function rgb(r2, g3, b2, opacity) {
17888     return arguments.length === 1 ? rgbConvert(r2) : new Rgb(r2, g3, b2, opacity == null ? 1 : opacity);
17889   }
17890   function Rgb(r2, g3, b2, opacity) {
17891     this.r = +r2;
17892     this.g = +g3;
17893     this.b = +b2;
17894     this.opacity = +opacity;
17895   }
17896   define_default(Rgb, rgb, extend(Color, {
17897     brighter(k2) {
17898       k2 = k2 == null ? brighter : Math.pow(brighter, k2);
17899       return new Rgb(this.r * k2, this.g * k2, this.b * k2, this.opacity);
17900     },
17901     darker(k2) {
17902       k2 = k2 == null ? darker : Math.pow(darker, k2);
17903       return new Rgb(this.r * k2, this.g * k2, this.b * k2, this.opacity);
17904     },
17905     rgb() {
17906       return this;
17907     },
17908     clamp() {
17909       return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
17910     },
17911     displayable() {
17912       return -0.5 <= this.r && this.r < 255.5 && (-0.5 <= this.g && this.g < 255.5) && (-0.5 <= this.b && this.b < 255.5) && (0 <= this.opacity && this.opacity <= 1);
17913     },
17914     hex: rgb_formatHex,
17915     // Deprecated! Use color.formatHex.
17916     formatHex: rgb_formatHex,
17917     formatHex8: rgb_formatHex8,
17918     formatRgb: rgb_formatRgb,
17919     toString: rgb_formatRgb
17920   }));
17921   function rgb_formatHex() {
17922     return "#".concat(hex(this.r)).concat(hex(this.g)).concat(hex(this.b));
17923   }
17924   function rgb_formatHex8() {
17925     return "#".concat(hex(this.r)).concat(hex(this.g)).concat(hex(this.b)).concat(hex((isNaN(this.opacity) ? 1 : this.opacity) * 255));
17926   }
17927   function rgb_formatRgb() {
17928     const a2 = clampa(this.opacity);
17929     return "".concat(a2 === 1 ? "rgb(" : "rgba(").concat(clampi(this.r), ", ").concat(clampi(this.g), ", ").concat(clampi(this.b)).concat(a2 === 1 ? ")" : ", ".concat(a2, ")"));
17930   }
17931   function clampa(opacity) {
17932     return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
17933   }
17934   function clampi(value) {
17935     return Math.max(0, Math.min(255, Math.round(value) || 0));
17936   }
17937   function hex(value) {
17938     value = clampi(value);
17939     return (value < 16 ? "0" : "") + value.toString(16);
17940   }
17941   function hsla(h2, s2, l2, a2) {
17942     if (a2 <= 0) h2 = s2 = l2 = NaN;
17943     else if (l2 <= 0 || l2 >= 1) h2 = s2 = NaN;
17944     else if (s2 <= 0) h2 = NaN;
17945     return new Hsl(h2, s2, l2, a2);
17946   }
17947   function hslConvert(o2) {
17948     if (o2 instanceof Hsl) return new Hsl(o2.h, o2.s, o2.l, o2.opacity);
17949     if (!(o2 instanceof Color)) o2 = color(o2);
17950     if (!o2) return new Hsl();
17951     if (o2 instanceof Hsl) return o2;
17952     o2 = o2.rgb();
17953     var r2 = o2.r / 255, g3 = o2.g / 255, b2 = o2.b / 255, min3 = Math.min(r2, g3, b2), max3 = Math.max(r2, g3, b2), h2 = NaN, s2 = max3 - min3, l2 = (max3 + min3) / 2;
17954     if (s2) {
17955       if (r2 === max3) h2 = (g3 - b2) / s2 + (g3 < b2) * 6;
17956       else if (g3 === max3) h2 = (b2 - r2) / s2 + 2;
17957       else h2 = (r2 - g3) / s2 + 4;
17958       s2 /= l2 < 0.5 ? max3 + min3 : 2 - max3 - min3;
17959       h2 *= 60;
17960     } else {
17961       s2 = l2 > 0 && l2 < 1 ? 0 : h2;
17962     }
17963     return new Hsl(h2, s2, l2, o2.opacity);
17964   }
17965   function hsl(h2, s2, l2, opacity) {
17966     return arguments.length === 1 ? hslConvert(h2) : new Hsl(h2, s2, l2, opacity == null ? 1 : opacity);
17967   }
17968   function Hsl(h2, s2, l2, opacity) {
17969     this.h = +h2;
17970     this.s = +s2;
17971     this.l = +l2;
17972     this.opacity = +opacity;
17973   }
17974   define_default(Hsl, hsl, extend(Color, {
17975     brighter(k2) {
17976       k2 = k2 == null ? brighter : Math.pow(brighter, k2);
17977       return new Hsl(this.h, this.s, this.l * k2, this.opacity);
17978     },
17979     darker(k2) {
17980       k2 = k2 == null ? darker : Math.pow(darker, k2);
17981       return new Hsl(this.h, this.s, this.l * k2, this.opacity);
17982     },
17983     rgb() {
17984       var h2 = this.h % 360 + (this.h < 0) * 360, s2 = isNaN(h2) || isNaN(this.s) ? 0 : this.s, l2 = this.l, m2 = l2 + (l2 < 0.5 ? l2 : 1 - l2) * s2, m1 = 2 * l2 - m2;
17985       return new Rgb(
17986         hsl2rgb(h2 >= 240 ? h2 - 240 : h2 + 120, m1, m2),
17987         hsl2rgb(h2, m1, m2),
17988         hsl2rgb(h2 < 120 ? h2 + 240 : h2 - 120, m1, m2),
17989         this.opacity
17990       );
17991     },
17992     clamp() {
17993       return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
17994     },
17995     displayable() {
17996       return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1);
17997     },
17998     formatHsl() {
17999       const a2 = clampa(this.opacity);
18000       return "".concat(a2 === 1 ? "hsl(" : "hsla(").concat(clamph(this.h), ", ").concat(clampt(this.s) * 100, "%, ").concat(clampt(this.l) * 100, "%").concat(a2 === 1 ? ")" : ", ".concat(a2, ")"));
18001     }
18002   }));
18003   function clamph(value) {
18004     value = (value || 0) % 360;
18005     return value < 0 ? value + 360 : value;
18006   }
18007   function clampt(value) {
18008     return Math.max(0, Math.min(1, value || 0));
18009   }
18010   function hsl2rgb(h2, m1, m2) {
18011     return (h2 < 60 ? m1 + (m2 - m1) * h2 / 60 : h2 < 180 ? m2 : h2 < 240 ? m1 + (m2 - m1) * (240 - h2) / 60 : m1) * 255;
18012   }
18013
18014   // node_modules/d3-interpolate/src/basis.js
18015   function basis(t1, v0, v1, v2, v3) {
18016     var t2 = t1 * t1, t3 = t2 * t1;
18017     return ((1 - 3 * t1 + 3 * t2 - t3) * v0 + (4 - 6 * t2 + 3 * t3) * v1 + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2 + t3 * v3) / 6;
18018   }
18019   function basis_default(values) {
18020     var n3 = values.length - 1;
18021     return function(t2) {
18022       var i3 = t2 <= 0 ? t2 = 0 : t2 >= 1 ? (t2 = 1, n3 - 1) : Math.floor(t2 * n3), v1 = values[i3], v2 = values[i3 + 1], v0 = i3 > 0 ? values[i3 - 1] : 2 * v1 - v2, v3 = i3 < n3 - 1 ? values[i3 + 2] : 2 * v2 - v1;
18023       return basis((t2 - i3 / n3) * n3, v0, v1, v2, v3);
18024     };
18025   }
18026
18027   // node_modules/d3-interpolate/src/basisClosed.js
18028   function basisClosed_default(values) {
18029     var n3 = values.length;
18030     return function(t2) {
18031       var i3 = Math.floor(((t2 %= 1) < 0 ? ++t2 : t2) * n3), v0 = values[(i3 + n3 - 1) % n3], v1 = values[i3 % n3], v2 = values[(i3 + 1) % n3], v3 = values[(i3 + 2) % n3];
18032       return basis((t2 - i3 / n3) * n3, v0, v1, v2, v3);
18033     };
18034   }
18035
18036   // node_modules/d3-interpolate/src/constant.js
18037   var constant_default3 = (x2) => () => x2;
18038
18039   // node_modules/d3-interpolate/src/color.js
18040   function linear(a2, d2) {
18041     return function(t2) {
18042       return a2 + t2 * d2;
18043     };
18044   }
18045   function exponential(a2, b2, y2) {
18046     return a2 = Math.pow(a2, y2), b2 = Math.pow(b2, y2) - a2, y2 = 1 / y2, function(t2) {
18047       return Math.pow(a2 + t2 * b2, y2);
18048     };
18049   }
18050   function gamma(y2) {
18051     return (y2 = +y2) === 1 ? nogamma : function(a2, b2) {
18052       return b2 - a2 ? exponential(a2, b2, y2) : constant_default3(isNaN(a2) ? b2 : a2);
18053     };
18054   }
18055   function nogamma(a2, b2) {
18056     var d2 = b2 - a2;
18057     return d2 ? linear(a2, d2) : constant_default3(isNaN(a2) ? b2 : a2);
18058   }
18059
18060   // node_modules/d3-interpolate/src/rgb.js
18061   var rgb_default = function rgbGamma(y2) {
18062     var color2 = gamma(y2);
18063     function rgb2(start2, end) {
18064       var r2 = color2((start2 = rgb(start2)).r, (end = rgb(end)).r), g3 = color2(start2.g, end.g), b2 = color2(start2.b, end.b), opacity = nogamma(start2.opacity, end.opacity);
18065       return function(t2) {
18066         start2.r = r2(t2);
18067         start2.g = g3(t2);
18068         start2.b = b2(t2);
18069         start2.opacity = opacity(t2);
18070         return start2 + "";
18071       };
18072     }
18073     rgb2.gamma = rgbGamma;
18074     return rgb2;
18075   }(1);
18076   function rgbSpline(spline) {
18077     return function(colors) {
18078       var n3 = colors.length, r2 = new Array(n3), g3 = new Array(n3), b2 = new Array(n3), i3, color2;
18079       for (i3 = 0; i3 < n3; ++i3) {
18080         color2 = rgb(colors[i3]);
18081         r2[i3] = color2.r || 0;
18082         g3[i3] = color2.g || 0;
18083         b2[i3] = color2.b || 0;
18084       }
18085       r2 = spline(r2);
18086       g3 = spline(g3);
18087       b2 = spline(b2);
18088       color2.opacity = 1;
18089       return function(t2) {
18090         color2.r = r2(t2);
18091         color2.g = g3(t2);
18092         color2.b = b2(t2);
18093         return color2 + "";
18094       };
18095     };
18096   }
18097   var rgbBasis = rgbSpline(basis_default);
18098   var rgbBasisClosed = rgbSpline(basisClosed_default);
18099
18100   // node_modules/d3-interpolate/src/numberArray.js
18101   function numberArray_default(a2, b2) {
18102     if (!b2) b2 = [];
18103     var n3 = a2 ? Math.min(b2.length, a2.length) : 0, c2 = b2.slice(), i3;
18104     return function(t2) {
18105       for (i3 = 0; i3 < n3; ++i3) c2[i3] = a2[i3] * (1 - t2) + b2[i3] * t2;
18106       return c2;
18107     };
18108   }
18109   function isNumberArray(x2) {
18110     return ArrayBuffer.isView(x2) && !(x2 instanceof DataView);
18111   }
18112
18113   // node_modules/d3-interpolate/src/array.js
18114   function genericArray(a2, b2) {
18115     var nb = b2 ? b2.length : 0, na = a2 ? Math.min(nb, a2.length) : 0, x2 = new Array(na), c2 = new Array(nb), i3;
18116     for (i3 = 0; i3 < na; ++i3) x2[i3] = value_default(a2[i3], b2[i3]);
18117     for (; i3 < nb; ++i3) c2[i3] = b2[i3];
18118     return function(t2) {
18119       for (i3 = 0; i3 < na; ++i3) c2[i3] = x2[i3](t2);
18120       return c2;
18121     };
18122   }
18123
18124   // node_modules/d3-interpolate/src/date.js
18125   function date_default(a2, b2) {
18126     var d2 = /* @__PURE__ */ new Date();
18127     return a2 = +a2, b2 = +b2, function(t2) {
18128       return d2.setTime(a2 * (1 - t2) + b2 * t2), d2;
18129     };
18130   }
18131
18132   // node_modules/d3-interpolate/src/number.js
18133   function number_default(a2, b2) {
18134     return a2 = +a2, b2 = +b2, function(t2) {
18135       return a2 * (1 - t2) + b2 * t2;
18136     };
18137   }
18138
18139   // node_modules/d3-interpolate/src/object.js
18140   function object_default(a2, b2) {
18141     var i3 = {}, c2 = {}, k2;
18142     if (a2 === null || typeof a2 !== "object") a2 = {};
18143     if (b2 === null || typeof b2 !== "object") b2 = {};
18144     for (k2 in b2) {
18145       if (k2 in a2) {
18146         i3[k2] = value_default(a2[k2], b2[k2]);
18147       } else {
18148         c2[k2] = b2[k2];
18149       }
18150     }
18151     return function(t2) {
18152       for (k2 in i3) c2[k2] = i3[k2](t2);
18153       return c2;
18154     };
18155   }
18156
18157   // node_modules/d3-interpolate/src/string.js
18158   var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
18159   var reB = new RegExp(reA.source, "g");
18160   function zero2(b2) {
18161     return function() {
18162       return b2;
18163     };
18164   }
18165   function one(b2) {
18166     return function(t2) {
18167       return b2(t2) + "";
18168     };
18169   }
18170   function string_default(a2, b2) {
18171     var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i3 = -1, s2 = [], q2 = [];
18172     a2 = a2 + "", b2 = b2 + "";
18173     while ((am = reA.exec(a2)) && (bm = reB.exec(b2))) {
18174       if ((bs = bm.index) > bi) {
18175         bs = b2.slice(bi, bs);
18176         if (s2[i3]) s2[i3] += bs;
18177         else s2[++i3] = bs;
18178       }
18179       if ((am = am[0]) === (bm = bm[0])) {
18180         if (s2[i3]) s2[i3] += bm;
18181         else s2[++i3] = bm;
18182       } else {
18183         s2[++i3] = null;
18184         q2.push({ i: i3, x: number_default(am, bm) });
18185       }
18186       bi = reB.lastIndex;
18187     }
18188     if (bi < b2.length) {
18189       bs = b2.slice(bi);
18190       if (s2[i3]) s2[i3] += bs;
18191       else s2[++i3] = bs;
18192     }
18193     return s2.length < 2 ? q2[0] ? one(q2[0].x) : zero2(b2) : (b2 = q2.length, function(t2) {
18194       for (var i4 = 0, o2; i4 < b2; ++i4) s2[(o2 = q2[i4]).i] = o2.x(t2);
18195       return s2.join("");
18196     });
18197   }
18198
18199   // node_modules/d3-interpolate/src/value.js
18200   function value_default(a2, b2) {
18201     var t2 = typeof b2, c2;
18202     return b2 == null || t2 === "boolean" ? constant_default3(b2) : (t2 === "number" ? number_default : t2 === "string" ? (c2 = color(b2)) ? (b2 = c2, rgb_default) : string_default : b2 instanceof color ? rgb_default : b2 instanceof Date ? date_default : isNumberArray(b2) ? numberArray_default : Array.isArray(b2) ? genericArray : typeof b2.valueOf !== "function" && typeof b2.toString !== "function" || isNaN(b2) ? object_default : number_default)(a2, b2);
18203   }
18204
18205   // node_modules/d3-interpolate/src/round.js
18206   function round_default(a2, b2) {
18207     return a2 = +a2, b2 = +b2, function(t2) {
18208       return Math.round(a2 * (1 - t2) + b2 * t2);
18209     };
18210   }
18211
18212   // node_modules/d3-interpolate/src/transform/decompose.js
18213   var degrees2 = 180 / Math.PI;
18214   var identity = {
18215     translateX: 0,
18216     translateY: 0,
18217     rotate: 0,
18218     skewX: 0,
18219     scaleX: 1,
18220     scaleY: 1
18221   };
18222   function decompose_default(a2, b2, c2, d2, e3, f2) {
18223     var scaleX, scaleY, skewX;
18224     if (scaleX = Math.sqrt(a2 * a2 + b2 * b2)) a2 /= scaleX, b2 /= scaleX;
18225     if (skewX = a2 * c2 + b2 * d2) c2 -= a2 * skewX, d2 -= b2 * skewX;
18226     if (scaleY = Math.sqrt(c2 * c2 + d2 * d2)) c2 /= scaleY, d2 /= scaleY, skewX /= scaleY;
18227     if (a2 * d2 < b2 * c2) a2 = -a2, b2 = -b2, skewX = -skewX, scaleX = -scaleX;
18228     return {
18229       translateX: e3,
18230       translateY: f2,
18231       rotate: Math.atan2(b2, a2) * degrees2,
18232       skewX: Math.atan(skewX) * degrees2,
18233       scaleX,
18234       scaleY
18235     };
18236   }
18237
18238   // node_modules/d3-interpolate/src/transform/parse.js
18239   var svgNode;
18240   function parseCss(value) {
18241     const m2 = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + "");
18242     return m2.isIdentity ? identity : decompose_default(m2.a, m2.b, m2.c, m2.d, m2.e, m2.f);
18243   }
18244   function parseSvg(value) {
18245     if (value == null) return identity;
18246     if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
18247     svgNode.setAttribute("transform", value);
18248     if (!(value = svgNode.transform.baseVal.consolidate())) return identity;
18249     value = value.matrix;
18250     return decompose_default(value.a, value.b, value.c, value.d, value.e, value.f);
18251   }
18252
18253   // node_modules/d3-interpolate/src/transform/index.js
18254   function interpolateTransform(parse, pxComma, pxParen, degParen) {
18255     function pop(s2) {
18256       return s2.length ? s2.pop() + " " : "";
18257     }
18258     function translate(xa, ya, xb, yb, s2, q2) {
18259       if (xa !== xb || ya !== yb) {
18260         var i3 = s2.push("translate(", null, pxComma, null, pxParen);
18261         q2.push({ i: i3 - 4, x: number_default(xa, xb) }, { i: i3 - 2, x: number_default(ya, yb) });
18262       } else if (xb || yb) {
18263         s2.push("translate(" + xb + pxComma + yb + pxParen);
18264       }
18265     }
18266     function rotate(a2, b2, s2, q2) {
18267       if (a2 !== b2) {
18268         if (a2 - b2 > 180) b2 += 360;
18269         else if (b2 - a2 > 180) a2 += 360;
18270         q2.push({ i: s2.push(pop(s2) + "rotate(", null, degParen) - 2, x: number_default(a2, b2) });
18271       } else if (b2) {
18272         s2.push(pop(s2) + "rotate(" + b2 + degParen);
18273       }
18274     }
18275     function skewX(a2, b2, s2, q2) {
18276       if (a2 !== b2) {
18277         q2.push({ i: s2.push(pop(s2) + "skewX(", null, degParen) - 2, x: number_default(a2, b2) });
18278       } else if (b2) {
18279         s2.push(pop(s2) + "skewX(" + b2 + degParen);
18280       }
18281     }
18282     function scale(xa, ya, xb, yb, s2, q2) {
18283       if (xa !== xb || ya !== yb) {
18284         var i3 = s2.push(pop(s2) + "scale(", null, ",", null, ")");
18285         q2.push({ i: i3 - 4, x: number_default(xa, xb) }, { i: i3 - 2, x: number_default(ya, yb) });
18286       } else if (xb !== 1 || yb !== 1) {
18287         s2.push(pop(s2) + "scale(" + xb + "," + yb + ")");
18288       }
18289     }
18290     return function(a2, b2) {
18291       var s2 = [], q2 = [];
18292       a2 = parse(a2), b2 = parse(b2);
18293       translate(a2.translateX, a2.translateY, b2.translateX, b2.translateY, s2, q2);
18294       rotate(a2.rotate, b2.rotate, s2, q2);
18295       skewX(a2.skewX, b2.skewX, s2, q2);
18296       scale(a2.scaleX, a2.scaleY, b2.scaleX, b2.scaleY, s2, q2);
18297       a2 = b2 = null;
18298       return function(t2) {
18299         var i3 = -1, n3 = q2.length, o2;
18300         while (++i3 < n3) s2[(o2 = q2[i3]).i] = o2.x(t2);
18301         return s2.join("");
18302       };
18303     };
18304   }
18305   var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
18306   var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
18307
18308   // node_modules/d3-interpolate/src/zoom.js
18309   var epsilon22 = 1e-12;
18310   function cosh(x2) {
18311     return ((x2 = Math.exp(x2)) + 1 / x2) / 2;
18312   }
18313   function sinh(x2) {
18314     return ((x2 = Math.exp(x2)) - 1 / x2) / 2;
18315   }
18316   function tanh(x2) {
18317     return ((x2 = Math.exp(2 * x2)) - 1) / (x2 + 1);
18318   }
18319   var zoom_default = function zoomRho(rho, rho2, rho4) {
18320     function zoom(p02, p1) {
18321       var ux0 = p02[0], uy0 = p02[1], w0 = p02[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i3, S2;
18322       if (d2 < epsilon22) {
18323         S2 = Math.log(w1 / w0) / rho;
18324         i3 = function(t2) {
18325           return [
18326             ux0 + t2 * dx,
18327             uy0 + t2 * dy,
18328             w0 * Math.exp(rho * t2 * S2)
18329           ];
18330         };
18331       } else {
18332         var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
18333         S2 = (r1 - r0) / rho;
18334         i3 = function(t2) {
18335           var s2 = t2 * S2, coshr0 = cosh(r0), u2 = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s2 + r0) - sinh(r0));
18336           return [
18337             ux0 + u2 * dx,
18338             uy0 + u2 * dy,
18339             w0 * coshr0 / cosh(rho * s2 + r0)
18340           ];
18341         };
18342       }
18343       i3.duration = S2 * 1e3 * rho / Math.SQRT2;
18344       return i3;
18345     }
18346     zoom.rho = function(_2) {
18347       var _1 = Math.max(1e-3, +_2), _22 = _1 * _1, _4 = _22 * _22;
18348       return zoomRho(_1, _22, _4);
18349     };
18350     return zoom;
18351   }(Math.SQRT2, 2, 4);
18352
18353   // node_modules/d3-interpolate/src/quantize.js
18354   function quantize_default(interpolator, n3) {
18355     var samples = new Array(n3);
18356     for (var i3 = 0; i3 < n3; ++i3) samples[i3] = interpolator(i3 / (n3 - 1));
18357     return samples;
18358   }
18359
18360   // node_modules/d3-timer/src/timer.js
18361   var frame = 0;
18362   var timeout = 0;
18363   var interval = 0;
18364   var pokeDelay = 1e3;
18365   var taskHead;
18366   var taskTail;
18367   var clockLast = 0;
18368   var clockNow = 0;
18369   var clockSkew = 0;
18370   var clock = typeof performance === "object" && performance.now ? performance : Date;
18371   var setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f2) {
18372     setTimeout(f2, 17);
18373   };
18374   function now() {
18375     return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
18376   }
18377   function clearNow() {
18378     clockNow = 0;
18379   }
18380   function Timer() {
18381     this._call = this._time = this._next = null;
18382   }
18383   Timer.prototype = timer.prototype = {
18384     constructor: Timer,
18385     restart: function(callback, delay, time) {
18386       if (typeof callback !== "function") throw new TypeError("callback is not a function");
18387       time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
18388       if (!this._next && taskTail !== this) {
18389         if (taskTail) taskTail._next = this;
18390         else taskHead = this;
18391         taskTail = this;
18392       }
18393       this._call = callback;
18394       this._time = time;
18395       sleep();
18396     },
18397     stop: function() {
18398       if (this._call) {
18399         this._call = null;
18400         this._time = Infinity;
18401         sleep();
18402       }
18403     }
18404   };
18405   function timer(callback, delay, time) {
18406     var t2 = new Timer();
18407     t2.restart(callback, delay, time);
18408     return t2;
18409   }
18410   function timerFlush() {
18411     now();
18412     ++frame;
18413     var t2 = taskHead, e3;
18414     while (t2) {
18415       if ((e3 = clockNow - t2._time) >= 0) t2._call.call(void 0, e3);
18416       t2 = t2._next;
18417     }
18418     --frame;
18419   }
18420   function wake() {
18421     clockNow = (clockLast = clock.now()) + clockSkew;
18422     frame = timeout = 0;
18423     try {
18424       timerFlush();
18425     } finally {
18426       frame = 0;
18427       nap();
18428       clockNow = 0;
18429     }
18430   }
18431   function poke() {
18432     var now3 = clock.now(), delay = now3 - clockLast;
18433     if (delay > pokeDelay) clockSkew -= delay, clockLast = now3;
18434   }
18435   function nap() {
18436     var t0, t1 = taskHead, t2, time = Infinity;
18437     while (t1) {
18438       if (t1._call) {
18439         if (time > t1._time) time = t1._time;
18440         t0 = t1, t1 = t1._next;
18441       } else {
18442         t2 = t1._next, t1._next = null;
18443         t1 = t0 ? t0._next = t2 : taskHead = t2;
18444       }
18445     }
18446     taskTail = t0;
18447     sleep(time);
18448   }
18449   function sleep(time) {
18450     if (frame) return;
18451     if (timeout) timeout = clearTimeout(timeout);
18452     var delay = time - clockNow;
18453     if (delay > 24) {
18454       if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);
18455       if (interval) interval = clearInterval(interval);
18456     } else {
18457       if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
18458       frame = 1, setFrame(wake);
18459     }
18460   }
18461
18462   // node_modules/d3-timer/src/timeout.js
18463   function timeout_default(callback, delay, time) {
18464     var t2 = new Timer();
18465     delay = delay == null ? 0 : +delay;
18466     t2.restart((elapsed) => {
18467       t2.stop();
18468       callback(elapsed + delay);
18469     }, delay, time);
18470     return t2;
18471   }
18472
18473   // node_modules/d3-transition/src/transition/schedule.js
18474   var emptyOn = dispatch_default("start", "end", "cancel", "interrupt");
18475   var emptyTween = [];
18476   var CREATED = 0;
18477   var SCHEDULED = 1;
18478   var STARTING = 2;
18479   var STARTED = 3;
18480   var RUNNING = 4;
18481   var ENDING = 5;
18482   var ENDED = 6;
18483   function schedule_default(node, name, id2, index, group, timing) {
18484     var schedules = node.__transition;
18485     if (!schedules) node.__transition = {};
18486     else if (id2 in schedules) return;
18487     create(node, id2, {
18488       name,
18489       index,
18490       // For context during callback.
18491       group,
18492       // For context during callback.
18493       on: emptyOn,
18494       tween: emptyTween,
18495       time: timing.time,
18496       delay: timing.delay,
18497       duration: timing.duration,
18498       ease: timing.ease,
18499       timer: null,
18500       state: CREATED
18501     });
18502   }
18503   function init(node, id2) {
18504     var schedule = get2(node, id2);
18505     if (schedule.state > CREATED) throw new Error("too late; already scheduled");
18506     return schedule;
18507   }
18508   function set2(node, id2) {
18509     var schedule = get2(node, id2);
18510     if (schedule.state > STARTED) throw new Error("too late; already running");
18511     return schedule;
18512   }
18513   function get2(node, id2) {
18514     var schedule = node.__transition;
18515     if (!schedule || !(schedule = schedule[id2])) throw new Error("transition not found");
18516     return schedule;
18517   }
18518   function create(node, id2, self2) {
18519     var schedules = node.__transition, tween;
18520     schedules[id2] = self2;
18521     self2.timer = timer(schedule, 0, self2.time);
18522     function schedule(elapsed) {
18523       self2.state = SCHEDULED;
18524       self2.timer.restart(start2, self2.delay, self2.time);
18525       if (self2.delay <= elapsed) start2(elapsed - self2.delay);
18526     }
18527     function start2(elapsed) {
18528       var i3, j2, n3, o2;
18529       if (self2.state !== SCHEDULED) return stop();
18530       for (i3 in schedules) {
18531         o2 = schedules[i3];
18532         if (o2.name !== self2.name) continue;
18533         if (o2.state === STARTED) return timeout_default(start2);
18534         if (o2.state === RUNNING) {
18535           o2.state = ENDED;
18536           o2.timer.stop();
18537           o2.on.call("interrupt", node, node.__data__, o2.index, o2.group);
18538           delete schedules[i3];
18539         } else if (+i3 < id2) {
18540           o2.state = ENDED;
18541           o2.timer.stop();
18542           o2.on.call("cancel", node, node.__data__, o2.index, o2.group);
18543           delete schedules[i3];
18544         }
18545       }
18546       timeout_default(function() {
18547         if (self2.state === STARTED) {
18548           self2.state = RUNNING;
18549           self2.timer.restart(tick, self2.delay, self2.time);
18550           tick(elapsed);
18551         }
18552       });
18553       self2.state = STARTING;
18554       self2.on.call("start", node, node.__data__, self2.index, self2.group);
18555       if (self2.state !== STARTING) return;
18556       self2.state = STARTED;
18557       tween = new Array(n3 = self2.tween.length);
18558       for (i3 = 0, j2 = -1; i3 < n3; ++i3) {
18559         if (o2 = self2.tween[i3].value.call(node, node.__data__, self2.index, self2.group)) {
18560           tween[++j2] = o2;
18561         }
18562       }
18563       tween.length = j2 + 1;
18564     }
18565     function tick(elapsed) {
18566       var t2 = elapsed < self2.duration ? self2.ease.call(null, elapsed / self2.duration) : (self2.timer.restart(stop), self2.state = ENDING, 1), i3 = -1, n3 = tween.length;
18567       while (++i3 < n3) {
18568         tween[i3].call(node, t2);
18569       }
18570       if (self2.state === ENDING) {
18571         self2.on.call("end", node, node.__data__, self2.index, self2.group);
18572         stop();
18573       }
18574     }
18575     function stop() {
18576       self2.state = ENDED;
18577       self2.timer.stop();
18578       delete schedules[id2];
18579       for (var i3 in schedules) return;
18580       delete node.__transition;
18581     }
18582   }
18583
18584   // node_modules/d3-transition/src/interrupt.js
18585   function interrupt_default(node, name) {
18586     var schedules = node.__transition, schedule, active, empty2 = true, i3;
18587     if (!schedules) return;
18588     name = name == null ? null : name + "";
18589     for (i3 in schedules) {
18590       if ((schedule = schedules[i3]).name !== name) {
18591         empty2 = false;
18592         continue;
18593       }
18594       active = schedule.state > STARTING && schedule.state < ENDING;
18595       schedule.state = ENDED;
18596       schedule.timer.stop();
18597       schedule.on.call(active ? "interrupt" : "cancel", node, node.__data__, schedule.index, schedule.group);
18598       delete schedules[i3];
18599     }
18600     if (empty2) delete node.__transition;
18601   }
18602
18603   // node_modules/d3-transition/src/selection/interrupt.js
18604   function interrupt_default2(name) {
18605     return this.each(function() {
18606       interrupt_default(this, name);
18607     });
18608   }
18609
18610   // node_modules/d3-transition/src/transition/tween.js
18611   function tweenRemove(id2, name) {
18612     var tween0, tween1;
18613     return function() {
18614       var schedule = set2(this, id2), tween = schedule.tween;
18615       if (tween !== tween0) {
18616         tween1 = tween0 = tween;
18617         for (var i3 = 0, n3 = tween1.length; i3 < n3; ++i3) {
18618           if (tween1[i3].name === name) {
18619             tween1 = tween1.slice();
18620             tween1.splice(i3, 1);
18621             break;
18622           }
18623         }
18624       }
18625       schedule.tween = tween1;
18626     };
18627   }
18628   function tweenFunction(id2, name, value) {
18629     var tween0, tween1;
18630     if (typeof value !== "function") throw new Error();
18631     return function() {
18632       var schedule = set2(this, id2), tween = schedule.tween;
18633       if (tween !== tween0) {
18634         tween1 = (tween0 = tween).slice();
18635         for (var t2 = { name, value }, i3 = 0, n3 = tween1.length; i3 < n3; ++i3) {
18636           if (tween1[i3].name === name) {
18637             tween1[i3] = t2;
18638             break;
18639           }
18640         }
18641         if (i3 === n3) tween1.push(t2);
18642       }
18643       schedule.tween = tween1;
18644     };
18645   }
18646   function tween_default(name, value) {
18647     var id2 = this._id;
18648     name += "";
18649     if (arguments.length < 2) {
18650       var tween = get2(this.node(), id2).tween;
18651       for (var i3 = 0, n3 = tween.length, t2; i3 < n3; ++i3) {
18652         if ((t2 = tween[i3]).name === name) {
18653           return t2.value;
18654         }
18655       }
18656       return null;
18657     }
18658     return this.each((value == null ? tweenRemove : tweenFunction)(id2, name, value));
18659   }
18660   function tweenValue(transition2, name, value) {
18661     var id2 = transition2._id;
18662     transition2.each(function() {
18663       var schedule = set2(this, id2);
18664       (schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);
18665     });
18666     return function(node) {
18667       return get2(node, id2).value[name];
18668     };
18669   }
18670
18671   // node_modules/d3-transition/src/transition/interpolate.js
18672   function interpolate_default(a2, b2) {
18673     var c2;
18674     return (typeof b2 === "number" ? number_default : b2 instanceof color ? rgb_default : (c2 = color(b2)) ? (b2 = c2, rgb_default) : string_default)(a2, b2);
18675   }
18676
18677   // node_modules/d3-transition/src/transition/attr.js
18678   function attrRemove2(name) {
18679     return function() {
18680       this.removeAttribute(name);
18681     };
18682   }
18683   function attrRemoveNS2(fullname) {
18684     return function() {
18685       this.removeAttributeNS(fullname.space, fullname.local);
18686     };
18687   }
18688   function attrConstant2(name, interpolate, value1) {
18689     var string00, string1 = value1 + "", interpolate0;
18690     return function() {
18691       var string0 = this.getAttribute(name);
18692       return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
18693     };
18694   }
18695   function attrConstantNS2(fullname, interpolate, value1) {
18696     var string00, string1 = value1 + "", interpolate0;
18697     return function() {
18698       var string0 = this.getAttributeNS(fullname.space, fullname.local);
18699       return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
18700     };
18701   }
18702   function attrFunction2(name, interpolate, value) {
18703     var string00, string10, interpolate0;
18704     return function() {
18705       var string0, value1 = value(this), string1;
18706       if (value1 == null) return void this.removeAttribute(name);
18707       string0 = this.getAttribute(name);
18708       string1 = value1 + "";
18709       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
18710     };
18711   }
18712   function attrFunctionNS2(fullname, interpolate, value) {
18713     var string00, string10, interpolate0;
18714     return function() {
18715       var string0, value1 = value(this), string1;
18716       if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);
18717       string0 = this.getAttributeNS(fullname.space, fullname.local);
18718       string1 = value1 + "";
18719       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
18720     };
18721   }
18722   function attr_default2(name, value) {
18723     var fullname = namespace_default(name), i3 = fullname === "transform" ? interpolateTransformSvg : interpolate_default;
18724     return this.attrTween(name, typeof value === "function" ? (fullname.local ? attrFunctionNS2 : attrFunction2)(fullname, i3, tweenValue(this, "attr." + name, value)) : value == null ? (fullname.local ? attrRemoveNS2 : attrRemove2)(fullname) : (fullname.local ? attrConstantNS2 : attrConstant2)(fullname, i3, value));
18725   }
18726
18727   // node_modules/d3-transition/src/transition/attrTween.js
18728   function attrInterpolate(name, i3) {
18729     return function(t2) {
18730       this.setAttribute(name, i3.call(this, t2));
18731     };
18732   }
18733   function attrInterpolateNS(fullname, i3) {
18734     return function(t2) {
18735       this.setAttributeNS(fullname.space, fullname.local, i3.call(this, t2));
18736     };
18737   }
18738   function attrTweenNS(fullname, value) {
18739     var t0, i0;
18740     function tween() {
18741       var i3 = value.apply(this, arguments);
18742       if (i3 !== i0) t0 = (i0 = i3) && attrInterpolateNS(fullname, i3);
18743       return t0;
18744     }
18745     tween._value = value;
18746     return tween;
18747   }
18748   function attrTween(name, value) {
18749     var t0, i0;
18750     function tween() {
18751       var i3 = value.apply(this, arguments);
18752       if (i3 !== i0) t0 = (i0 = i3) && attrInterpolate(name, i3);
18753       return t0;
18754     }
18755     tween._value = value;
18756     return tween;
18757   }
18758   function attrTween_default(name, value) {
18759     var key = "attr." + name;
18760     if (arguments.length < 2) return (key = this.tween(key)) && key._value;
18761     if (value == null) return this.tween(key, null);
18762     if (typeof value !== "function") throw new Error();
18763     var fullname = namespace_default(name);
18764     return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
18765   }
18766
18767   // node_modules/d3-transition/src/transition/delay.js
18768   function delayFunction(id2, value) {
18769     return function() {
18770       init(this, id2).delay = +value.apply(this, arguments);
18771     };
18772   }
18773   function delayConstant(id2, value) {
18774     return value = +value, function() {
18775       init(this, id2).delay = value;
18776     };
18777   }
18778   function delay_default(value) {
18779     var id2 = this._id;
18780     return arguments.length ? this.each((typeof value === "function" ? delayFunction : delayConstant)(id2, value)) : get2(this.node(), id2).delay;
18781   }
18782
18783   // node_modules/d3-transition/src/transition/duration.js
18784   function durationFunction(id2, value) {
18785     return function() {
18786       set2(this, id2).duration = +value.apply(this, arguments);
18787     };
18788   }
18789   function durationConstant(id2, value) {
18790     return value = +value, function() {
18791       set2(this, id2).duration = value;
18792     };
18793   }
18794   function duration_default(value) {
18795     var id2 = this._id;
18796     return arguments.length ? this.each((typeof value === "function" ? durationFunction : durationConstant)(id2, value)) : get2(this.node(), id2).duration;
18797   }
18798
18799   // node_modules/d3-transition/src/transition/ease.js
18800   function easeConstant(id2, value) {
18801     if (typeof value !== "function") throw new Error();
18802     return function() {
18803       set2(this, id2).ease = value;
18804     };
18805   }
18806   function ease_default(value) {
18807     var id2 = this._id;
18808     return arguments.length ? this.each(easeConstant(id2, value)) : get2(this.node(), id2).ease;
18809   }
18810
18811   // node_modules/d3-transition/src/transition/easeVarying.js
18812   function easeVarying(id2, value) {
18813     return function() {
18814       var v2 = value.apply(this, arguments);
18815       if (typeof v2 !== "function") throw new Error();
18816       set2(this, id2).ease = v2;
18817     };
18818   }
18819   function easeVarying_default(value) {
18820     if (typeof value !== "function") throw new Error();
18821     return this.each(easeVarying(this._id, value));
18822   }
18823
18824   // node_modules/d3-transition/src/transition/filter.js
18825   function filter_default2(match) {
18826     if (typeof match !== "function") match = matcher_default(match);
18827     for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j2 = 0; j2 < m2; ++j2) {
18828       for (var group = groups[j2], n3 = group.length, subgroup = subgroups[j2] = [], node, i3 = 0; i3 < n3; ++i3) {
18829         if ((node = group[i3]) && match.call(node, node.__data__, i3, group)) {
18830           subgroup.push(node);
18831         }
18832       }
18833     }
18834     return new Transition(subgroups, this._parents, this._name, this._id);
18835   }
18836
18837   // node_modules/d3-transition/src/transition/merge.js
18838   function merge_default2(transition2) {
18839     if (transition2._id !== this._id) throw new Error();
18840     for (var groups0 = this._groups, groups1 = transition2._groups, m0 = groups0.length, m1 = groups1.length, m2 = Math.min(m0, m1), merges = new Array(m0), j2 = 0; j2 < m2; ++j2) {
18841       for (var group0 = groups0[j2], group1 = groups1[j2], n3 = group0.length, merge2 = merges[j2] = new Array(n3), node, i3 = 0; i3 < n3; ++i3) {
18842         if (node = group0[i3] || group1[i3]) {
18843           merge2[i3] = node;
18844         }
18845       }
18846     }
18847     for (; j2 < m0; ++j2) {
18848       merges[j2] = groups0[j2];
18849     }
18850     return new Transition(merges, this._parents, this._name, this._id);
18851   }
18852
18853   // node_modules/d3-transition/src/transition/on.js
18854   function start(name) {
18855     return (name + "").trim().split(/^|\s+/).every(function(t2) {
18856       var i3 = t2.indexOf(".");
18857       if (i3 >= 0) t2 = t2.slice(0, i3);
18858       return !t2 || t2 === "start";
18859     });
18860   }
18861   function onFunction(id2, name, listener) {
18862     var on0, on1, sit = start(name) ? init : set2;
18863     return function() {
18864       var schedule = sit(this, id2), on = schedule.on;
18865       if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener);
18866       schedule.on = on1;
18867     };
18868   }
18869   function on_default2(name, listener) {
18870     var id2 = this._id;
18871     return arguments.length < 2 ? get2(this.node(), id2).on.on(name) : this.each(onFunction(id2, name, listener));
18872   }
18873
18874   // node_modules/d3-transition/src/transition/remove.js
18875   function removeFunction(id2) {
18876     return function() {
18877       var parent = this.parentNode;
18878       for (var i3 in this.__transition) if (+i3 !== id2) return;
18879       if (parent) parent.removeChild(this);
18880     };
18881   }
18882   function remove_default2() {
18883     return this.on("end.remove", removeFunction(this._id));
18884   }
18885
18886   // node_modules/d3-transition/src/transition/select.js
18887   function select_default3(select) {
18888     var name = this._name, id2 = this._id;
18889     if (typeof select !== "function") select = selector_default(select);
18890     for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j2 = 0; j2 < m2; ++j2) {
18891       for (var group = groups[j2], n3 = group.length, subgroup = subgroups[j2] = new Array(n3), node, subnode, i3 = 0; i3 < n3; ++i3) {
18892         if ((node = group[i3]) && (subnode = select.call(node, node.__data__, i3, group))) {
18893           if ("__data__" in node) subnode.__data__ = node.__data__;
18894           subgroup[i3] = subnode;
18895           schedule_default(subgroup[i3], name, id2, i3, subgroup, get2(node, id2));
18896         }
18897       }
18898     }
18899     return new Transition(subgroups, this._parents, name, id2);
18900   }
18901
18902   // node_modules/d3-transition/src/transition/selectAll.js
18903   function selectAll_default3(select) {
18904     var name = this._name, id2 = this._id;
18905     if (typeof select !== "function") select = selectorAll_default(select);
18906     for (var groups = this._groups, m2 = groups.length, subgroups = [], parents = [], j2 = 0; j2 < m2; ++j2) {
18907       for (var group = groups[j2], n3 = group.length, node, i3 = 0; i3 < n3; ++i3) {
18908         if (node = group[i3]) {
18909           for (var children2 = select.call(node, node.__data__, i3, group), child, inherit2 = get2(node, id2), k2 = 0, l2 = children2.length; k2 < l2; ++k2) {
18910             if (child = children2[k2]) {
18911               schedule_default(child, name, id2, k2, children2, inherit2);
18912             }
18913           }
18914           subgroups.push(children2);
18915           parents.push(node);
18916         }
18917       }
18918     }
18919     return new Transition(subgroups, parents, name, id2);
18920   }
18921
18922   // node_modules/d3-transition/src/transition/selection.js
18923   var Selection2 = selection_default.prototype.constructor;
18924   function selection_default2() {
18925     return new Selection2(this._groups, this._parents);
18926   }
18927
18928   // node_modules/d3-transition/src/transition/style.js
18929   function styleNull(name, interpolate) {
18930     var string00, string10, interpolate0;
18931     return function() {
18932       var string0 = styleValue(this, name), string1 = (this.style.removeProperty(name), styleValue(this, name));
18933       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : interpolate0 = interpolate(string00 = string0, string10 = string1);
18934     };
18935   }
18936   function styleRemove2(name) {
18937     return function() {
18938       this.style.removeProperty(name);
18939     };
18940   }
18941   function styleConstant2(name, interpolate, value1) {
18942     var string00, string1 = value1 + "", interpolate0;
18943     return function() {
18944       var string0 = styleValue(this, name);
18945       return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
18946     };
18947   }
18948   function styleFunction2(name, interpolate, value) {
18949     var string00, string10, interpolate0;
18950     return function() {
18951       var string0 = styleValue(this, name), value1 = value(this), string1 = value1 + "";
18952       if (value1 == null) string1 = value1 = (this.style.removeProperty(name), styleValue(this, name));
18953       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
18954     };
18955   }
18956   function styleMaybeRemove(id2, name) {
18957     var on0, on1, listener0, key = "style." + name, event = "end." + key, remove2;
18958     return function() {
18959       var schedule = set2(this, id2), on = schedule.on, listener = schedule.value[key] == null ? remove2 || (remove2 = styleRemove2(name)) : void 0;
18960       if (on !== on0 || listener0 !== listener) (on1 = (on0 = on).copy()).on(event, listener0 = listener);
18961       schedule.on = on1;
18962     };
18963   }
18964   function style_default2(name, value, priority) {
18965     var i3 = (name += "") === "transform" ? interpolateTransformCss : interpolate_default;
18966     return value == null ? this.styleTween(name, styleNull(name, i3)).on("end.style." + name, styleRemove2(name)) : typeof value === "function" ? this.styleTween(name, styleFunction2(name, i3, tweenValue(this, "style." + name, value))).each(styleMaybeRemove(this._id, name)) : this.styleTween(name, styleConstant2(name, i3, value), priority).on("end.style." + name, null);
18967   }
18968
18969   // node_modules/d3-transition/src/transition/styleTween.js
18970   function styleInterpolate(name, i3, priority) {
18971     return function(t2) {
18972       this.style.setProperty(name, i3.call(this, t2), priority);
18973     };
18974   }
18975   function styleTween(name, value, priority) {
18976     var t2, i0;
18977     function tween() {
18978       var i3 = value.apply(this, arguments);
18979       if (i3 !== i0) t2 = (i0 = i3) && styleInterpolate(name, i3, priority);
18980       return t2;
18981     }
18982     tween._value = value;
18983     return tween;
18984   }
18985   function styleTween_default(name, value, priority) {
18986     var key = "style." + (name += "");
18987     if (arguments.length < 2) return (key = this.tween(key)) && key._value;
18988     if (value == null) return this.tween(key, null);
18989     if (typeof value !== "function") throw new Error();
18990     return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
18991   }
18992
18993   // node_modules/d3-transition/src/transition/text.js
18994   function textConstant2(value) {
18995     return function() {
18996       this.textContent = value;
18997     };
18998   }
18999   function textFunction2(value) {
19000     return function() {
19001       var value1 = value(this);
19002       this.textContent = value1 == null ? "" : value1;
19003     };
19004   }
19005   function text_default2(value) {
19006     return this.tween("text", typeof value === "function" ? textFunction2(tweenValue(this, "text", value)) : textConstant2(value == null ? "" : value + ""));
19007   }
19008
19009   // node_modules/d3-transition/src/transition/textTween.js
19010   function textInterpolate(i3) {
19011     return function(t2) {
19012       this.textContent = i3.call(this, t2);
19013     };
19014   }
19015   function textTween(value) {
19016     var t0, i0;
19017     function tween() {
19018       var i3 = value.apply(this, arguments);
19019       if (i3 !== i0) t0 = (i0 = i3) && textInterpolate(i3);
19020       return t0;
19021     }
19022     tween._value = value;
19023     return tween;
19024   }
19025   function textTween_default(value) {
19026     var key = "text";
19027     if (arguments.length < 1) return (key = this.tween(key)) && key._value;
19028     if (value == null) return this.tween(key, null);
19029     if (typeof value !== "function") throw new Error();
19030     return this.tween(key, textTween(value));
19031   }
19032
19033   // node_modules/d3-transition/src/transition/transition.js
19034   function transition_default() {
19035     var name = this._name, id0 = this._id, id1 = newId();
19036     for (var groups = this._groups, m2 = groups.length, j2 = 0; j2 < m2; ++j2) {
19037       for (var group = groups[j2], n3 = group.length, node, i3 = 0; i3 < n3; ++i3) {
19038         if (node = group[i3]) {
19039           var inherit2 = get2(node, id0);
19040           schedule_default(node, name, id1, i3, group, {
19041             time: inherit2.time + inherit2.delay + inherit2.duration,
19042             delay: 0,
19043             duration: inherit2.duration,
19044             ease: inherit2.ease
19045           });
19046         }
19047       }
19048     }
19049     return new Transition(groups, this._parents, name, id1);
19050   }
19051
19052   // node_modules/d3-transition/src/transition/end.js
19053   function end_default() {
19054     var on0, on1, that = this, id2 = that._id, size = that.size();
19055     return new Promise(function(resolve, reject) {
19056       var cancel = { value: reject }, end = { value: function() {
19057         if (--size === 0) resolve();
19058       } };
19059       that.each(function() {
19060         var schedule = set2(this, id2), on = schedule.on;
19061         if (on !== on0) {
19062           on1 = (on0 = on).copy();
19063           on1._.cancel.push(cancel);
19064           on1._.interrupt.push(cancel);
19065           on1._.end.push(end);
19066         }
19067         schedule.on = on1;
19068       });
19069       if (size === 0) resolve();
19070     });
19071   }
19072
19073   // node_modules/d3-transition/src/transition/index.js
19074   var id = 0;
19075   function Transition(groups, parents, name, id2) {
19076     this._groups = groups;
19077     this._parents = parents;
19078     this._name = name;
19079     this._id = id2;
19080   }
19081   function transition(name) {
19082     return selection_default().transition(name);
19083   }
19084   function newId() {
19085     return ++id;
19086   }
19087   var selection_prototype = selection_default.prototype;
19088   Transition.prototype = transition.prototype = {
19089     constructor: Transition,
19090     select: select_default3,
19091     selectAll: selectAll_default3,
19092     selectChild: selection_prototype.selectChild,
19093     selectChildren: selection_prototype.selectChildren,
19094     filter: filter_default2,
19095     merge: merge_default2,
19096     selection: selection_default2,
19097     transition: transition_default,
19098     call: selection_prototype.call,
19099     nodes: selection_prototype.nodes,
19100     node: selection_prototype.node,
19101     size: selection_prototype.size,
19102     empty: selection_prototype.empty,
19103     each: selection_prototype.each,
19104     on: on_default2,
19105     attr: attr_default2,
19106     attrTween: attrTween_default,
19107     style: style_default2,
19108     styleTween: styleTween_default,
19109     text: text_default2,
19110     textTween: textTween_default,
19111     remove: remove_default2,
19112     tween: tween_default,
19113     delay: delay_default,
19114     duration: duration_default,
19115     ease: ease_default,
19116     easeVarying: easeVarying_default,
19117     end: end_default,
19118     [Symbol.iterator]: selection_prototype[Symbol.iterator]
19119   };
19120
19121   // node_modules/d3-ease/src/linear.js
19122   var linear2 = (t2) => +t2;
19123
19124   // node_modules/d3-ease/src/cubic.js
19125   function cubicInOut(t2) {
19126     return ((t2 *= 2) <= 1 ? t2 * t2 * t2 : (t2 -= 2) * t2 * t2 + 2) / 2;
19127   }
19128
19129   // node_modules/d3-transition/src/selection/transition.js
19130   var defaultTiming = {
19131     time: null,
19132     // Set on use.
19133     delay: 0,
19134     duration: 250,
19135     ease: cubicInOut
19136   };
19137   function inherit(node, id2) {
19138     var timing;
19139     while (!(timing = node.__transition) || !(timing = timing[id2])) {
19140       if (!(node = node.parentNode)) {
19141         throw new Error("transition ".concat(id2, " not found"));
19142       }
19143     }
19144     return timing;
19145   }
19146   function transition_default2(name) {
19147     var id2, timing;
19148     if (name instanceof Transition) {
19149       id2 = name._id, name = name._name;
19150     } else {
19151       id2 = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + "";
19152     }
19153     for (var groups = this._groups, m2 = groups.length, j2 = 0; j2 < m2; ++j2) {
19154       for (var group = groups[j2], n3 = group.length, node, i3 = 0; i3 < n3; ++i3) {
19155         if (node = group[i3]) {
19156           schedule_default(node, name, id2, i3, group, timing || inherit(node, id2));
19157         }
19158       }
19159     }
19160     return new Transition(groups, this._parents, name, id2);
19161   }
19162
19163   // node_modules/d3-transition/src/selection/index.js
19164   selection_default.prototype.interrupt = interrupt_default2;
19165   selection_default.prototype.transition = transition_default2;
19166
19167   // node_modules/d3-zoom/src/constant.js
19168   var constant_default4 = (x2) => () => x2;
19169
19170   // node_modules/d3-zoom/src/event.js
19171   function ZoomEvent(type2, {
19172     sourceEvent,
19173     target,
19174     transform: transform2,
19175     dispatch: dispatch14
19176   }) {
19177     Object.defineProperties(this, {
19178       type: { value: type2, enumerable: true, configurable: true },
19179       sourceEvent: { value: sourceEvent, enumerable: true, configurable: true },
19180       target: { value: target, enumerable: true, configurable: true },
19181       transform: { value: transform2, enumerable: true, configurable: true },
19182       _: { value: dispatch14 }
19183     });
19184   }
19185
19186   // node_modules/d3-zoom/src/transform.js
19187   function Transform(k2, x2, y2) {
19188     this.k = k2;
19189     this.x = x2;
19190     this.y = y2;
19191   }
19192   Transform.prototype = {
19193     constructor: Transform,
19194     scale: function(k2) {
19195       return k2 === 1 ? this : new Transform(this.k * k2, this.x, this.y);
19196     },
19197     translate: function(x2, y2) {
19198       return x2 === 0 & y2 === 0 ? this : new Transform(this.k, this.x + this.k * x2, this.y + this.k * y2);
19199     },
19200     apply: function(point) {
19201       return [point[0] * this.k + this.x, point[1] * this.k + this.y];
19202     },
19203     applyX: function(x2) {
19204       return x2 * this.k + this.x;
19205     },
19206     applyY: function(y2) {
19207       return y2 * this.k + this.y;
19208     },
19209     invert: function(location) {
19210       return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];
19211     },
19212     invertX: function(x2) {
19213       return (x2 - this.x) / this.k;
19214     },
19215     invertY: function(y2) {
19216       return (y2 - this.y) / this.k;
19217     },
19218     rescaleX: function(x2) {
19219       return x2.copy().domain(x2.range().map(this.invertX, this).map(x2.invert, x2));
19220     },
19221     rescaleY: function(y2) {
19222       return y2.copy().domain(y2.range().map(this.invertY, this).map(y2.invert, y2));
19223     },
19224     toString: function() {
19225       return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
19226     }
19227   };
19228   var identity2 = new Transform(1, 0, 0);
19229   transform.prototype = Transform.prototype;
19230   function transform(node) {
19231     while (!node.__zoom) if (!(node = node.parentNode)) return identity2;
19232     return node.__zoom;
19233   }
19234
19235   // node_modules/d3-zoom/src/noevent.js
19236   function nopropagation2(event) {
19237     event.stopImmediatePropagation();
19238   }
19239   function noevent_default2(event) {
19240     event.preventDefault();
19241     event.stopImmediatePropagation();
19242   }
19243
19244   // node_modules/d3-zoom/src/zoom.js
19245   function defaultFilter2(event) {
19246     return (!event.ctrlKey || event.type === "wheel") && !event.button;
19247   }
19248   function defaultExtent() {
19249     var e3 = this;
19250     if (e3 instanceof SVGElement) {
19251       e3 = e3.ownerSVGElement || e3;
19252       if (e3.hasAttribute("viewBox")) {
19253         e3 = e3.viewBox.baseVal;
19254         return [[e3.x, e3.y], [e3.x + e3.width, e3.y + e3.height]];
19255       }
19256       return [[0, 0], [e3.width.baseVal.value, e3.height.baseVal.value]];
19257     }
19258     return [[0, 0], [e3.clientWidth, e3.clientHeight]];
19259   }
19260   function defaultTransform() {
19261     return this.__zoom || identity2;
19262   }
19263   function defaultWheelDelta(event) {
19264     return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 2e-3) * (event.ctrlKey ? 10 : 1);
19265   }
19266   function defaultTouchable2() {
19267     return navigator.maxTouchPoints || "ontouchstart" in this;
19268   }
19269   function defaultConstrain(transform2, extent, translateExtent) {
19270     var dx0 = transform2.invertX(extent[0][0]) - translateExtent[0][0], dx1 = transform2.invertX(extent[1][0]) - translateExtent[1][0], dy0 = transform2.invertY(extent[0][1]) - translateExtent[0][1], dy1 = transform2.invertY(extent[1][1]) - translateExtent[1][1];
19271     return transform2.translate(
19272       dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
19273       dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
19274     );
19275   }
19276   function zoom_default2() {
19277     var filter2 = defaultFilter2, extent = defaultExtent, constrain = defaultConstrain, wheelDelta = defaultWheelDelta, touchable = defaultTouchable2, scaleExtent = [0, Infinity], translateExtent = [[-Infinity, -Infinity], [Infinity, Infinity]], duration = 250, interpolate = zoom_default, listeners = dispatch_default("start", "zoom", "end"), touchstarting, touchfirst, touchending, touchDelay = 500, wheelDelay = 150, clickDistance2 = 0, tapDistance = 10;
19278     function zoom(selection2) {
19279       selection2.property("__zoom", defaultTransform).on("wheel.zoom", wheeled, { passive: false }).on("mousedown.zoom", mousedowned).on("dblclick.zoom", dblclicked).filter(touchable).on("touchstart.zoom", touchstarted).on("touchmove.zoom", touchmoved).on("touchend.zoom touchcancel.zoom", touchended).style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
19280     }
19281     zoom.transform = function(collection, transform2, point, event) {
19282       var selection2 = collection.selection ? collection.selection() : collection;
19283       selection2.property("__zoom", defaultTransform);
19284       if (collection !== selection2) {
19285         schedule(collection, transform2, point, event);
19286       } else {
19287         selection2.interrupt().each(function() {
19288           gesture(this, arguments).event(event).start().zoom(null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end();
19289         });
19290       }
19291     };
19292     zoom.scaleBy = function(selection2, k2, p2, event) {
19293       zoom.scaleTo(selection2, function() {
19294         var k0 = this.__zoom.k, k1 = typeof k2 === "function" ? k2.apply(this, arguments) : k2;
19295         return k0 * k1;
19296       }, p2, event);
19297     };
19298     zoom.scaleTo = function(selection2, k2, p2, event) {
19299       zoom.transform(selection2, function() {
19300         var e3 = extent.apply(this, arguments), t0 = this.__zoom, p02 = p2 == null ? centroid(e3) : typeof p2 === "function" ? p2.apply(this, arguments) : p2, p1 = t0.invert(p02), k1 = typeof k2 === "function" ? k2.apply(this, arguments) : k2;
19301         return constrain(translate(scale(t0, k1), p02, p1), e3, translateExtent);
19302       }, p2, event);
19303     };
19304     zoom.translateBy = function(selection2, x2, y2, event) {
19305       zoom.transform(selection2, function() {
19306         return constrain(this.__zoom.translate(
19307           typeof x2 === "function" ? x2.apply(this, arguments) : x2,
19308           typeof y2 === "function" ? y2.apply(this, arguments) : y2
19309         ), extent.apply(this, arguments), translateExtent);
19310       }, null, event);
19311     };
19312     zoom.translateTo = function(selection2, x2, y2, p2, event) {
19313       zoom.transform(selection2, function() {
19314         var e3 = extent.apply(this, arguments), t2 = this.__zoom, p02 = p2 == null ? centroid(e3) : typeof p2 === "function" ? p2.apply(this, arguments) : p2;
19315         return constrain(identity2.translate(p02[0], p02[1]).scale(t2.k).translate(
19316           typeof x2 === "function" ? -x2.apply(this, arguments) : -x2,
19317           typeof y2 === "function" ? -y2.apply(this, arguments) : -y2
19318         ), e3, translateExtent);
19319       }, p2, event);
19320     };
19321     function scale(transform2, k2) {
19322       k2 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k2));
19323       return k2 === transform2.k ? transform2 : new Transform(k2, transform2.x, transform2.y);
19324     }
19325     function translate(transform2, p02, p1) {
19326       var x2 = p02[0] - p1[0] * transform2.k, y2 = p02[1] - p1[1] * transform2.k;
19327       return x2 === transform2.x && y2 === transform2.y ? transform2 : new Transform(transform2.k, x2, y2);
19328     }
19329     function centroid(extent2) {
19330       return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
19331     }
19332     function schedule(transition2, transform2, point, event) {
19333       transition2.on("start.zoom", function() {
19334         gesture(this, arguments).event(event).start();
19335       }).on("interrupt.zoom end.zoom", function() {
19336         gesture(this, arguments).event(event).end();
19337       }).tween("zoom", function() {
19338         var that = this, args = arguments, g3 = gesture(that, args).event(event), e3 = extent.apply(that, args), p2 = point == null ? centroid(e3) : typeof point === "function" ? point.apply(that, args) : point, w2 = Math.max(e3[1][0] - e3[0][0], e3[1][1] - e3[0][1]), a2 = that.__zoom, b2 = typeof transform2 === "function" ? transform2.apply(that, args) : transform2, i3 = interpolate(a2.invert(p2).concat(w2 / a2.k), b2.invert(p2).concat(w2 / b2.k));
19339         return function(t2) {
19340           if (t2 === 1) t2 = b2;
19341           else {
19342             var l2 = i3(t2), k2 = w2 / l2[2];
19343             t2 = new Transform(k2, p2[0] - l2[0] * k2, p2[1] - l2[1] * k2);
19344           }
19345           g3.zoom(null, t2);
19346         };
19347       });
19348     }
19349     function gesture(that, args, clean2) {
19350       return !clean2 && that.__zooming || new Gesture(that, args);
19351     }
19352     function Gesture(that, args) {
19353       this.that = that;
19354       this.args = args;
19355       this.active = 0;
19356       this.sourceEvent = null;
19357       this.extent = extent.apply(that, args);
19358       this.taps = 0;
19359     }
19360     Gesture.prototype = {
19361       event: function(event) {
19362         if (event) this.sourceEvent = event;
19363         return this;
19364       },
19365       start: function() {
19366         if (++this.active === 1) {
19367           this.that.__zooming = this;
19368           this.emit("start");
19369         }
19370         return this;
19371       },
19372       zoom: function(key, transform2) {
19373         if (this.mouse && key !== "mouse") this.mouse[1] = transform2.invert(this.mouse[0]);
19374         if (this.touch0 && key !== "touch") this.touch0[1] = transform2.invert(this.touch0[0]);
19375         if (this.touch1 && key !== "touch") this.touch1[1] = transform2.invert(this.touch1[0]);
19376         this.that.__zoom = transform2;
19377         this.emit("zoom");
19378         return this;
19379       },
19380       end: function() {
19381         if (--this.active === 0) {
19382           delete this.that.__zooming;
19383           this.emit("end");
19384         }
19385         return this;
19386       },
19387       emit: function(type2) {
19388         var d2 = select_default2(this.that).datum();
19389         listeners.call(
19390           type2,
19391           this.that,
19392           new ZoomEvent(type2, {
19393             sourceEvent: this.sourceEvent,
19394             target: zoom,
19395             type: type2,
19396             transform: this.that.__zoom,
19397             dispatch: listeners
19398           }),
19399           d2
19400         );
19401       }
19402     };
19403     function wheeled(event, ...args) {
19404       if (!filter2.apply(this, arguments)) return;
19405       var g3 = gesture(this, args).event(event), t2 = this.__zoom, k2 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t2.k * Math.pow(2, wheelDelta.apply(this, arguments)))), p2 = pointer_default(event);
19406       if (g3.wheel) {
19407         if (g3.mouse[0][0] !== p2[0] || g3.mouse[0][1] !== p2[1]) {
19408           g3.mouse[1] = t2.invert(g3.mouse[0] = p2);
19409         }
19410         clearTimeout(g3.wheel);
19411       } else if (t2.k === k2) return;
19412       else {
19413         g3.mouse = [p2, t2.invert(p2)];
19414         interrupt_default(this);
19415         g3.start();
19416       }
19417       noevent_default2(event);
19418       g3.wheel = setTimeout(wheelidled, wheelDelay);
19419       g3.zoom("mouse", constrain(translate(scale(t2, k2), g3.mouse[0], g3.mouse[1]), g3.extent, translateExtent));
19420       function wheelidled() {
19421         g3.wheel = null;
19422         g3.end();
19423       }
19424     }
19425     function mousedowned(event, ...args) {
19426       if (touchending || !filter2.apply(this, arguments)) return;
19427       var currentTarget = event.currentTarget, g3 = gesture(this, args, true).event(event), v2 = select_default2(event.view).on("mousemove.zoom", mousemoved, true).on("mouseup.zoom", mouseupped, true), p2 = pointer_default(event, currentTarget), x05 = event.clientX, y05 = event.clientY;
19428       nodrag_default(event.view);
19429       nopropagation2(event);
19430       g3.mouse = [p2, this.__zoom.invert(p2)];
19431       interrupt_default(this);
19432       g3.start();
19433       function mousemoved(event2) {
19434         noevent_default2(event2);
19435         if (!g3.moved) {
19436           var dx = event2.clientX - x05, dy = event2.clientY - y05;
19437           g3.moved = dx * dx + dy * dy > clickDistance2;
19438         }
19439         g3.event(event2).zoom("mouse", constrain(translate(g3.that.__zoom, g3.mouse[0] = pointer_default(event2, currentTarget), g3.mouse[1]), g3.extent, translateExtent));
19440       }
19441       function mouseupped(event2) {
19442         v2.on("mousemove.zoom mouseup.zoom", null);
19443         yesdrag(event2.view, g3.moved);
19444         noevent_default2(event2);
19445         g3.event(event2).end();
19446       }
19447     }
19448     function dblclicked(event, ...args) {
19449       if (!filter2.apply(this, arguments)) return;
19450       var t0 = this.__zoom, p02 = pointer_default(event.changedTouches ? event.changedTouches[0] : event, this), p1 = t0.invert(p02), k1 = t0.k * (event.shiftKey ? 0.5 : 2), t1 = constrain(translate(scale(t0, k1), p02, p1), extent.apply(this, args), translateExtent);
19451       noevent_default2(event);
19452       if (duration > 0) select_default2(this).transition().duration(duration).call(schedule, t1, p02, event);
19453       else select_default2(this).call(zoom.transform, t1, p02, event);
19454     }
19455     function touchstarted(event, ...args) {
19456       if (!filter2.apply(this, arguments)) return;
19457       var touches = event.touches, n3 = touches.length, g3 = gesture(this, args, event.changedTouches.length === n3).event(event), started, i3, t2, p2;
19458       nopropagation2(event);
19459       for (i3 = 0; i3 < n3; ++i3) {
19460         t2 = touches[i3], p2 = pointer_default(t2, this);
19461         p2 = [p2, this.__zoom.invert(p2), t2.identifier];
19462         if (!g3.touch0) g3.touch0 = p2, started = true, g3.taps = 1 + !!touchstarting;
19463         else if (!g3.touch1 && g3.touch0[2] !== p2[2]) g3.touch1 = p2, g3.taps = 0;
19464       }
19465       if (touchstarting) touchstarting = clearTimeout(touchstarting);
19466       if (started) {
19467         if (g3.taps < 2) touchfirst = p2[0], touchstarting = setTimeout(function() {
19468           touchstarting = null;
19469         }, touchDelay);
19470         interrupt_default(this);
19471         g3.start();
19472       }
19473     }
19474     function touchmoved(event, ...args) {
19475       if (!this.__zooming) return;
19476       var g3 = gesture(this, args).event(event), touches = event.changedTouches, n3 = touches.length, i3, t2, p2, l2;
19477       noevent_default2(event);
19478       for (i3 = 0; i3 < n3; ++i3) {
19479         t2 = touches[i3], p2 = pointer_default(t2, this);
19480         if (g3.touch0 && g3.touch0[2] === t2.identifier) g3.touch0[0] = p2;
19481         else if (g3.touch1 && g3.touch1[2] === t2.identifier) g3.touch1[0] = p2;
19482       }
19483       t2 = g3.that.__zoom;
19484       if (g3.touch1) {
19485         var p02 = g3.touch0[0], l0 = g3.touch0[1], p1 = g3.touch1[0], l1 = g3.touch1[1], dp = (dp = p1[0] - p02[0]) * dp + (dp = p1[1] - p02[1]) * dp, dl = (dl = l1[0] - l0[0]) * dl + (dl = l1[1] - l0[1]) * dl;
19486         t2 = scale(t2, Math.sqrt(dp / dl));
19487         p2 = [(p02[0] + p1[0]) / 2, (p02[1] + p1[1]) / 2];
19488         l2 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
19489       } else if (g3.touch0) p2 = g3.touch0[0], l2 = g3.touch0[1];
19490       else return;
19491       g3.zoom("touch", constrain(translate(t2, p2, l2), g3.extent, translateExtent));
19492     }
19493     function touchended(event, ...args) {
19494       if (!this.__zooming) return;
19495       var g3 = gesture(this, args).event(event), touches = event.changedTouches, n3 = touches.length, i3, t2;
19496       nopropagation2(event);
19497       if (touchending) clearTimeout(touchending);
19498       touchending = setTimeout(function() {
19499         touchending = null;
19500       }, touchDelay);
19501       for (i3 = 0; i3 < n3; ++i3) {
19502         t2 = touches[i3];
19503         if (g3.touch0 && g3.touch0[2] === t2.identifier) delete g3.touch0;
19504         else if (g3.touch1 && g3.touch1[2] === t2.identifier) delete g3.touch1;
19505       }
19506       if (g3.touch1 && !g3.touch0) g3.touch0 = g3.touch1, delete g3.touch1;
19507       if (g3.touch0) g3.touch0[1] = this.__zoom.invert(g3.touch0[0]);
19508       else {
19509         g3.end();
19510         if (g3.taps === 2) {
19511           t2 = pointer_default(t2, this);
19512           if (Math.hypot(touchfirst[0] - t2[0], touchfirst[1] - t2[1]) < tapDistance) {
19513             var p2 = select_default2(this).on("dblclick.zoom");
19514             if (p2) p2.apply(this, arguments);
19515           }
19516         }
19517       }
19518     }
19519     zoom.wheelDelta = function(_2) {
19520       return arguments.length ? (wheelDelta = typeof _2 === "function" ? _2 : constant_default4(+_2), zoom) : wheelDelta;
19521     };
19522     zoom.filter = function(_2) {
19523       return arguments.length ? (filter2 = typeof _2 === "function" ? _2 : constant_default4(!!_2), zoom) : filter2;
19524     };
19525     zoom.touchable = function(_2) {
19526       return arguments.length ? (touchable = typeof _2 === "function" ? _2 : constant_default4(!!_2), zoom) : touchable;
19527     };
19528     zoom.extent = function(_2) {
19529       return arguments.length ? (extent = typeof _2 === "function" ? _2 : constant_default4([[+_2[0][0], +_2[0][1]], [+_2[1][0], +_2[1][1]]]), zoom) : extent;
19530     };
19531     zoom.scaleExtent = function(_2) {
19532       return arguments.length ? (scaleExtent[0] = +_2[0], scaleExtent[1] = +_2[1], zoom) : [scaleExtent[0], scaleExtent[1]];
19533     };
19534     zoom.translateExtent = function(_2) {
19535       return arguments.length ? (translateExtent[0][0] = +_2[0][0], translateExtent[1][0] = +_2[1][0], translateExtent[0][1] = +_2[0][1], translateExtent[1][1] = +_2[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];
19536     };
19537     zoom.constrain = function(_2) {
19538       return arguments.length ? (constrain = _2, zoom) : constrain;
19539     };
19540     zoom.duration = function(_2) {
19541       return arguments.length ? (duration = +_2, zoom) : duration;
19542     };
19543     zoom.interpolate = function(_2) {
19544       return arguments.length ? (interpolate = _2, zoom) : interpolate;
19545     };
19546     zoom.on = function() {
19547       var value = listeners.on.apply(listeners, arguments);
19548       return value === listeners ? zoom : value;
19549     };
19550     zoom.clickDistance = function(_2) {
19551       return arguments.length ? (clickDistance2 = (_2 = +_2) * _2, zoom) : Math.sqrt(clickDistance2);
19552     };
19553     zoom.tapDistance = function(_2) {
19554       return arguments.length ? (tapDistance = +_2, zoom) : tapDistance;
19555     };
19556     return zoom;
19557   }
19558
19559   // modules/geo/raw_mercator.js
19560   function geoRawMercator() {
19561     var project = mercatorRaw;
19562     var k2 = 512 / Math.PI;
19563     var x2 = 0;
19564     var y2 = 0;
19565     var clipExtent = [[0, 0], [0, 0]];
19566     function projection2(point) {
19567       point = project(point[0] * Math.PI / 180, point[1] * Math.PI / 180);
19568       return [point[0] * k2 + x2, y2 - point[1] * k2];
19569     }
19570     projection2.invert = function(point) {
19571       point = project.invert((point[0] - x2) / k2, (y2 - point[1]) / k2);
19572       return point && [point[0] * 180 / Math.PI, point[1] * 180 / Math.PI];
19573     };
19574     projection2.scale = function(_2) {
19575       if (!arguments.length) return k2;
19576       k2 = +_2;
19577       return projection2;
19578     };
19579     projection2.translate = function(_2) {
19580       if (!arguments.length) return [x2, y2];
19581       x2 = +_2[0];
19582       y2 = +_2[1];
19583       return projection2;
19584     };
19585     projection2.clipExtent = function(_2) {
19586       if (!arguments.length) return clipExtent;
19587       clipExtent = _2;
19588       return projection2;
19589     };
19590     projection2.transform = function(obj) {
19591       if (!arguments.length) return identity2.translate(x2, y2).scale(k2);
19592       x2 = +obj.x;
19593       y2 = +obj.y;
19594       k2 = +obj.k;
19595       return projection2;
19596     };
19597     projection2.stream = transform_default({
19598       point: function(x3, y3) {
19599         var vec = projection2([x3, y3]);
19600         this.stream.point(vec[0], vec[1]);
19601       }
19602     }).stream;
19603     return projection2;
19604   }
19605
19606   // modules/geo/ortho.js
19607   function geoOrthoNormalizedDotProduct(a2, b2, origin) {
19608     if (geoVecEqual(origin, a2) || geoVecEqual(origin, b2)) {
19609       return 1;
19610     }
19611     return geoVecNormalizedDot(a2, b2, origin);
19612   }
19613   function geoOrthoFilterDotProduct(dotp, epsilon3, lowerThreshold, upperThreshold, allowStraightAngles) {
19614     var val = Math.abs(dotp);
19615     if (val < epsilon3) {
19616       return 0;
19617     } else if (allowStraightAngles && Math.abs(val - 1) < epsilon3) {
19618       return 0;
19619     } else if (val < lowerThreshold || val > upperThreshold) {
19620       return dotp;
19621     } else {
19622       return null;
19623     }
19624   }
19625   function geoOrthoCalcScore(points, isClosed, epsilon3, threshold) {
19626     var score = 0;
19627     var first = isClosed ? 0 : 1;
19628     var last = isClosed ? points.length : points.length - 1;
19629     var coords = points.map(function(p2) {
19630       return p2.coord;
19631     });
19632     var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
19633     var upperThreshold = Math.cos(threshold * Math.PI / 180);
19634     for (var i3 = first; i3 < last; i3++) {
19635       var a2 = coords[(i3 - 1 + coords.length) % coords.length];
19636       var origin = coords[i3];
19637       var b2 = coords[(i3 + 1) % coords.length];
19638       var dotp = geoOrthoFilterDotProduct(geoOrthoNormalizedDotProduct(a2, b2, origin), epsilon3, lowerThreshold, upperThreshold);
19639       if (dotp === null) continue;
19640       score = score + 2 * Math.min(Math.abs(dotp - 1), Math.min(Math.abs(dotp), Math.abs(dotp + 1)));
19641     }
19642     return score;
19643   }
19644   function geoOrthoMaxOffsetAngle(coords, isClosed, lessThan) {
19645     var max3 = -Infinity;
19646     var first = isClosed ? 0 : 1;
19647     var last = isClosed ? coords.length : coords.length - 1;
19648     for (var i3 = first; i3 < last; i3++) {
19649       var a2 = coords[(i3 - 1 + coords.length) % coords.length];
19650       var origin = coords[i3];
19651       var b2 = coords[(i3 + 1) % coords.length];
19652       var normalizedDotP = geoOrthoNormalizedDotProduct(a2, b2, origin);
19653       var angle2 = Math.acos(Math.abs(normalizedDotP)) * 180 / Math.PI;
19654       if (angle2 > 45) angle2 = 90 - angle2;
19655       if (angle2 >= lessThan) continue;
19656       if (angle2 > max3) max3 = angle2;
19657     }
19658     if (max3 === -Infinity) return null;
19659     return max3;
19660   }
19661   function geoOrthoCanOrthogonalize(coords, isClosed, epsilon3, threshold, allowStraightAngles) {
19662     var score = null;
19663     var first = isClosed ? 0 : 1;
19664     var last = isClosed ? coords.length : coords.length - 1;
19665     var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
19666     var upperThreshold = Math.cos(threshold * Math.PI / 180);
19667     for (var i3 = first; i3 < last; i3++) {
19668       var a2 = coords[(i3 - 1 + coords.length) % coords.length];
19669       var origin = coords[i3];
19670       var b2 = coords[(i3 + 1) % coords.length];
19671       var dotp = geoOrthoFilterDotProduct(geoOrthoNormalizedDotProduct(a2, b2, origin), epsilon3, lowerThreshold, upperThreshold, allowStraightAngles);
19672       if (dotp === null) continue;
19673       if (Math.abs(dotp) > 0) return 1;
19674       score = 0;
19675     }
19676     return score;
19677   }
19678
19679   // modules/osm/tags.js
19680   function osmIsInterestingTag(key) {
19681     return key !== "attribution" && key !== "created_by" && key !== "source" && key !== "odbl" && key.indexOf("source:") !== 0 && key.indexOf("source_ref") !== 0 && // purposely exclude colon
19682     key.indexOf("tiger:") !== 0;
19683   }
19684   var osmLifecyclePrefixes = {
19685     // nonexistent, might be built
19686     proposed: true,
19687     planned: true,
19688     // under maintenance or between groundbreaking and opening
19689     construction: true,
19690     // existent but not functional
19691     disused: true,
19692     // dilapidated to nonexistent
19693     abandoned: true,
19694     was: true,
19695     // nonexistent, still may appear in imagery
19696     dismantled: true,
19697     razed: true,
19698     demolished: true,
19699     destroyed: true,
19700     removed: true,
19701     obliterated: true,
19702     // existent occasionally, e.g. stormwater drainage basin
19703     intermittent: true
19704   };
19705   function osmRemoveLifecyclePrefix(key) {
19706     const keySegments = key.split(":");
19707     if (keySegments.length === 1) return key;
19708     if (keySegments[0] in osmLifecyclePrefixes) {
19709       return key.slice(keySegments[0].length + 1);
19710     }
19711     return key;
19712   }
19713   var osmAreaKeys = {};
19714   function osmSetAreaKeys(value) {
19715     osmAreaKeys = value;
19716   }
19717   var osmAreaKeysExceptions = {
19718     highway: {
19719       elevator: true,
19720       rest_area: true,
19721       services: true
19722     },
19723     public_transport: {
19724       platform: true
19725     },
19726     railway: {
19727       platform: true,
19728       roundhouse: true,
19729       station: true,
19730       traverser: true,
19731       turntable: true,
19732       wash: true,
19733       ventilation_shaft: true
19734     },
19735     waterway: {
19736       dam: true
19737     },
19738     amenity: {
19739       bicycle_parking: true
19740     }
19741   };
19742   function osmTagSuggestingArea(tags) {
19743     if (tags.area === "yes") return { area: "yes" };
19744     if (tags.area === "no") return null;
19745     var returnTags = {};
19746     for (var realKey in tags) {
19747       const key = osmRemoveLifecyclePrefix(realKey);
19748       if (key in osmAreaKeys && !(tags[realKey] in osmAreaKeys[key])) {
19749         returnTags[realKey] = tags[realKey];
19750         return returnTags;
19751       }
19752       if (key in osmAreaKeysExceptions && tags[realKey] in osmAreaKeysExceptions[key]) {
19753         returnTags[realKey] = tags[realKey];
19754         return returnTags;
19755       }
19756     }
19757     return null;
19758   }
19759   var osmLineTags = {};
19760   function osmSetLineTags(value) {
19761     osmLineTags = value;
19762   }
19763   var osmPointTags = {};
19764   function osmSetPointTags(value) {
19765     osmPointTags = value;
19766   }
19767   var osmVertexTags = {};
19768   function osmSetVertexTags(value) {
19769     osmVertexTags = value;
19770   }
19771   function osmNodeGeometriesForTags(nodeTags) {
19772     var geometries = {};
19773     for (var key in nodeTags) {
19774       if (osmPointTags[key] && (osmPointTags[key]["*"] || osmPointTags[key][nodeTags[key]])) {
19775         geometries.point = true;
19776       }
19777       if (osmVertexTags[key] && (osmVertexTags[key]["*"] || osmVertexTags[key][nodeTags[key]])) {
19778         geometries.vertex = true;
19779       }
19780       if (geometries.point && geometries.vertex) break;
19781     }
19782     return geometries;
19783   }
19784   var osmOneWayTags = {
19785     "aerialway": {
19786       "chair_lift": true,
19787       "drag_lift": true,
19788       "j-bar": true,
19789       "magic_carpet": true,
19790       "mixed_lift": true,
19791       "platter": true,
19792       "rope_tow": true,
19793       "t-bar": true,
19794       "zip_line": true
19795     },
19796     "conveying": {
19797       "forward": true,
19798       "backward": true,
19799       "reversible": true
19800     },
19801     "highway": {
19802       "motorway": true
19803     },
19804     "junction": {
19805       "circular": true,
19806       "roundabout": true
19807     },
19808     "man_made": {
19809       "goods_conveyor": true,
19810       "piste:halfpipe": true
19811     },
19812     "piste:type": {
19813       "downhill": true,
19814       "sled": true,
19815       "yes": true
19816     },
19817     "seamark:type": {
19818       "two-way_route": true,
19819       "recommended_traffic_lane": true,
19820       "separation_lane": true,
19821       "separation_roundabout": true
19822     },
19823     "waterway": {
19824       "canal": true,
19825       "ditch": true,
19826       "drain": true,
19827       "fish_pass": true,
19828       "flowline": true,
19829       "pressurised": true,
19830       "river": true,
19831       "spillway": true,
19832       "stream": true,
19833       "tidal_channel": true
19834     }
19835   };
19836   var osmPavedTags = {
19837     "surface": {
19838       "paved": true,
19839       "asphalt": true,
19840       "concrete": true,
19841       "chipseal": true,
19842       "concrete:lanes": true,
19843       "concrete:plates": true
19844     },
19845     "tracktype": {
19846       "grade1": true
19847     }
19848   };
19849   var osmSemipavedTags = {
19850     "surface": {
19851       "cobblestone": true,
19852       "cobblestone:flattened": true,
19853       "unhewn_cobblestone": true,
19854       "sett": true,
19855       "paving_stones": true,
19856       "metal": true,
19857       "wood": true
19858     }
19859   };
19860   var osmRightSideIsInsideTags = {
19861     "natural": {
19862       "cliff": true,
19863       "coastline": "coastline"
19864     },
19865     "barrier": {
19866       "retaining_wall": true,
19867       "kerb": true,
19868       "guard_rail": true,
19869       "city_wall": true
19870     },
19871     "man_made": {
19872       "embankment": true,
19873       "quay": true
19874     },
19875     "waterway": {
19876       "weir": true
19877     }
19878   };
19879   var osmRoutableHighwayTagValues = {
19880     motorway: true,
19881     trunk: true,
19882     primary: true,
19883     secondary: true,
19884     tertiary: true,
19885     residential: true,
19886     motorway_link: true,
19887     trunk_link: true,
19888     primary_link: true,
19889     secondary_link: true,
19890     tertiary_link: true,
19891     unclassified: true,
19892     road: true,
19893     service: true,
19894     track: true,
19895     living_street: true,
19896     bus_guideway: true,
19897     busway: true,
19898     path: true,
19899     footway: true,
19900     cycleway: true,
19901     bridleway: true,
19902     pedestrian: true,
19903     corridor: true,
19904     steps: true,
19905     ladder: true
19906   };
19907   var osmPathHighwayTagValues = {
19908     path: true,
19909     footway: true,
19910     cycleway: true,
19911     bridleway: true,
19912     pedestrian: true,
19913     corridor: true,
19914     steps: true,
19915     ladder: true
19916   };
19917   var osmRailwayTrackTagValues = {
19918     rail: true,
19919     light_rail: true,
19920     tram: true,
19921     subway: true,
19922     monorail: true,
19923     funicular: true,
19924     miniature: true,
19925     narrow_gauge: true,
19926     disused: true,
19927     preserved: true
19928   };
19929   var osmFlowingWaterwayTagValues = {
19930     canal: true,
19931     ditch: true,
19932     drain: true,
19933     fish_pass: true,
19934     flowline: true,
19935     river: true,
19936     stream: true,
19937     tidal_channel: true
19938   };
19939   var allowUpperCaseTagValues = /network|taxon|genus|species|brand|grape_variety|royal_cypher|listed_status|booth|rating|stars|:output|_hours|_times|_ref|manufacturer|country|target|brewery|cai_scale|traffic_sign/;
19940   function isColourValid(value) {
19941     if (!value.match(/^(#([0-9a-fA-F]{3}){1,2}|\w+)$/)) {
19942       return false;
19943     }
19944     if (!CSS.supports("color", value) || ["unset", "inherit", "initial", "revert"].includes(value)) {
19945       return false;
19946     }
19947     return true;
19948   }
19949   var osmMutuallyExclusiveTagPairs = [
19950     ["noname", "name"],
19951     ["noref", "ref"],
19952     ["nohousenumber", "addr:housenumber"],
19953     ["noaddress", "addr:housenumber"],
19954     ["noaddress", "addr:housename"],
19955     ["noaddress", "addr:unit"],
19956     ["addr:nostreet", "addr:street"]
19957   ];
19958
19959   // modules/util/array.js
19960   function utilArrayIdentical(a2, b2) {
19961     if (a2 === b2) return true;
19962     var i3 = a2.length;
19963     if (i3 !== b2.length) return false;
19964     while (i3--) {
19965       if (a2[i3] !== b2[i3]) return false;
19966     }
19967     return true;
19968   }
19969   function utilArrayDifference(a2, b2) {
19970     var other = new Set(b2);
19971     return Array.from(new Set(a2)).filter(function(v2) {
19972       return !other.has(v2);
19973     });
19974   }
19975   function utilArrayIntersection(a2, b2) {
19976     var other = new Set(b2);
19977     return Array.from(new Set(a2)).filter(function(v2) {
19978       return other.has(v2);
19979     });
19980   }
19981   function utilArrayUnion(a2, b2) {
19982     var result = new Set(a2);
19983     b2.forEach(function(v2) {
19984       result.add(v2);
19985     });
19986     return Array.from(result);
19987   }
19988   function utilArrayUniq(a2) {
19989     return Array.from(new Set(a2));
19990   }
19991   function utilArrayChunk(a2, chunkSize) {
19992     if (!chunkSize || chunkSize < 0) return [a2.slice()];
19993     var result = new Array(Math.ceil(a2.length / chunkSize));
19994     return Array.from(result, function(item, i3) {
19995       return a2.slice(i3 * chunkSize, i3 * chunkSize + chunkSize);
19996     });
19997   }
19998   function utilArrayFlatten(a2) {
19999     return a2.reduce(function(acc, val) {
20000       return acc.concat(val);
20001     }, []);
20002   }
20003   function utilArrayGroupBy(a2, key) {
20004     return a2.reduce(function(acc, item) {
20005       var group = typeof key === "function" ? key(item) : item[key];
20006       (acc[group] = acc[group] || []).push(item);
20007       return acc;
20008     }, {});
20009   }
20010   function utilArrayUniqBy(a2, key) {
20011     var seen = /* @__PURE__ */ new Set();
20012     return a2.reduce(function(acc, item) {
20013       var val = typeof key === "function" ? key(item) : item[key];
20014       if (val && !seen.has(val)) {
20015         seen.add(val);
20016         acc.push(item);
20017       }
20018       return acc;
20019     }, []);
20020   }
20021
20022   // modules/util/util.js
20023   var import_diacritics = __toESM(require_diacritics());
20024
20025   // modules/util/svg_paths_rtl_fix.js
20026   var import_alif_toolkit = __toESM(require_lib());
20027   var rtlRegex = /[\u0590-\u05FF\u0600-\u06FF\u0750-\u07BF\u08A0–\u08BF]/;
20028   function fixRTLTextForSvg(inputText) {
20029     var ret = "", rtlBuffer = [];
20030     var arabicRegex = /[\u0600-\u06FF]/g;
20031     var arabicDiacritics = /[\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06ED]/g;
20032     var arabicMath = /[\u0660-\u066C\u06F0-\u06F9]+/g;
20033     var thaanaVowel = /[\u07A6-\u07B0]/;
20034     var hebrewSign = /[\u0591-\u05bd\u05bf\u05c1-\u05c5\u05c7]/;
20035     if (arabicRegex.test(inputText)) {
20036       inputText = (0, import_alif_toolkit.WordShaper)(inputText);
20037     }
20038     for (var n3 = 0; n3 < inputText.length; n3++) {
20039       var c2 = inputText[n3];
20040       if (arabicMath.test(c2)) {
20041         ret += rtlBuffer.reverse().join("");
20042         rtlBuffer = [c2];
20043       } else {
20044         if (rtlBuffer.length && arabicMath.test(rtlBuffer[rtlBuffer.length - 1])) {
20045           ret += rtlBuffer.reverse().join("");
20046           rtlBuffer = [];
20047         }
20048         if ((thaanaVowel.test(c2) || hebrewSign.test(c2) || arabicDiacritics.test(c2)) && rtlBuffer.length) {
20049           rtlBuffer[rtlBuffer.length - 1] += c2;
20050         } else if (rtlRegex.test(c2) || c2.charCodeAt(0) >= 64336 && c2.charCodeAt(0) <= 65023 || c2.charCodeAt(0) >= 65136 && c2.charCodeAt(0) <= 65279) {
20051           rtlBuffer.push(c2);
20052         } else if (c2 === " " && rtlBuffer.length) {
20053           rtlBuffer = [rtlBuffer.reverse().join("") + " "];
20054         } else {
20055           ret += rtlBuffer.reverse().join("") + c2;
20056           rtlBuffer = [];
20057         }
20058       }
20059     }
20060     ret += rtlBuffer.reverse().join("");
20061     return ret;
20062   }
20063
20064   // modules/core/preferences.js
20065   var _storage;
20066   try {
20067     _storage = localStorage;
20068   } catch {
20069   }
20070   _storage = _storage || /* @__PURE__ */ (() => {
20071     let s2 = {};
20072     return {
20073       getItem: (k2) => s2[k2],
20074       setItem: (k2, v2) => s2[k2] = v2,
20075       removeItem: (k2) => delete s2[k2]
20076     };
20077   })();
20078   var _listeners = {};
20079   function corePreferences(k2, v2) {
20080     try {
20081       if (v2 === void 0) return _storage.getItem(k2);
20082       else if (v2 === null) _storage.removeItem(k2);
20083       else _storage.setItem(k2, v2);
20084       if (_listeners[k2]) {
20085         _listeners[k2].forEach((handler) => handler(v2));
20086       }
20087       return true;
20088     } catch {
20089       if (typeof console !== "undefined") {
20090         console.error("localStorage quota exceeded");
20091       }
20092       return false;
20093     }
20094   }
20095   corePreferences.onChange = function(k2, handler) {
20096     _listeners[k2] = _listeners[k2] || [];
20097     _listeners[k2].push(handler);
20098   };
20099
20100   // modules/core/file_fetcher.js
20101   var import_vparse = __toESM(require_vparse());
20102
20103   // config/id.js
20104   var presetsCdnUrl = "https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@{presets_version}/";
20105   var ociCdnUrl = "https://cdn.jsdelivr.net/npm/osm-community-index@{version}/";
20106   var wmfSitematrixCdnUrl = "https://cdn.jsdelivr.net/npm/wmf-sitematrix@{version}/";
20107   var nsiCdnUrl = "https://cdn.jsdelivr.net/npm/name-suggestion-index@{version}/";
20108   var defaultOsmApiConnections = {
20109     live: {
20110       url: "https://www.openstreetmap.org",
20111       apiUrl: "https://api.openstreetmap.org",
20112       client_id: "0tmNTmd0Jo1dQp4AUmMBLtGiD9YpMuXzHefitcuVStc"
20113     },
20114     dev: {
20115       url: "https://api06.dev.openstreetmap.org",
20116       client_id: "Ee1wWJ6UlpERbF6BfTNOpwn0R8k_06mvMXdDUkeHMgw"
20117     }
20118   };
20119   var osmApiConnections = [];
20120   if (false) {
20121     osmApiConnections.push({
20122       url: null,
20123       apiUrl: null,
20124       client_id: null
20125     });
20126   } else if (false) {
20127     osmApiConnections.push(defaultOsmApiConnections[null]);
20128   } else {
20129     osmApiConnections.push(defaultOsmApiConnections.live);
20130     osmApiConnections.push(defaultOsmApiConnections.dev);
20131   }
20132   var taginfoApiUrl = "https://taginfo.openstreetmap.org/api/4/";
20133   var nominatimApiUrl = "https://nominatim.openstreetmap.org/";
20134   var showDonationMessage = true;
20135
20136   // package.json
20137   var package_default = {
20138     name: "iD",
20139     version: "2.30.4",
20140     description: "A friendly editor for OpenStreetMap",
20141     main: "dist/iD.min.js",
20142     repository: "github:openstreetmap/iD",
20143     homepage: "https://github.com/openstreetmap/iD",
20144     bugs: "https://github.com/openstreetmap/iD/issues",
20145     keywords: [
20146       "editor",
20147       "openstreetmap"
20148     ],
20149     license: "ISC",
20150     scripts: {
20151       all: "run-s clean build dist",
20152       build: "run-s build:css build:data build:js",
20153       "build:css": "node scripts/build_css.js",
20154       "build:data": "shx mkdir -p dist/data && node scripts/build_data.js",
20155       "build:stats": "node config/esbuild.config.mjs --stats && esbuild-visualizer --metadata dist/esbuild.json --exclude *.png --filename docs/statistics.html && shx rm dist/esbuild.json",
20156       "build:js": "node config/esbuild.config.mjs",
20157       "build:js:watch": "node config/esbuild.config.mjs --watch",
20158       clean: "shx rm -f dist/esbuild.json dist/*.js dist/*.map dist/*.css dist/img/*.svg",
20159       dist: "run-p dist:**",
20160       "dist:mapillary": "shx mkdir -p dist/mapillary-js && shx cp -R node_modules/mapillary-js/dist/* dist/mapillary-js/",
20161       "dist:pannellum": "shx mkdir -p dist/pannellum && shx cp -R node_modules/pannellum/build/* dist/pannellum/",
20162       "dist:min": "node config/esbuild.config.min.mjs",
20163       "dist:svg:iD": 'svg-sprite --symbol --symbol-dest . --shape-id-generator "iD-%s" --symbol-sprite dist/img/iD-sprite.svg "svg/iD-sprite/**/*.svg"',
20164       "dist:svg:community": 'svg-sprite --symbol --symbol-dest . --shape-id-generator "community-%s" --symbol-sprite dist/img/community-sprite.svg node_modules/osm-community-index/dist/img/*.svg',
20165       "dist:svg:fa": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/fa-sprite.svg svg/fontawesome/*.svg",
20166       "dist:svg:maki": 'svg-sprite --symbol --symbol-dest . --shape-id-generator "maki-%s" --symbol-sprite dist/img/maki-sprite.svg node_modules/@mapbox/maki/icons/*.svg',
20167       "dist:svg:mapillary:signs": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/mapillary-sprite.svg node_modules/@rapideditor/mapillary_sprite_source/package_signs/*.svg",
20168       "dist:svg:mapillary:objects": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/mapillary-object-sprite.svg node_modules/@rapideditor/mapillary_sprite_source/package_objects/*.svg",
20169       "dist:svg:roentgen": 'svg-sprite --shape-id-generator "roentgen-%s" --shape-dim-width 16 --shape-dim-height 16 --symbol --symbol-dest . --symbol-sprite dist/img/roentgen-sprite.svg svg/roentgen/*.svg',
20170       "dist:svg:temaki": 'svg-sprite --symbol --symbol-dest . --shape-id-generator "temaki-%s" --symbol-sprite dist/img/temaki-sprite.svg node_modules/@rapideditor/temaki/icons/*.svg',
20171       imagery: "node scripts/update_imagery.js",
20172       lint: "eslint config scripts test/spec modules",
20173       "lint:fix": "eslint scripts test/spec modules --fix",
20174       start: "run-s start:watch",
20175       "start:single-build": "run-p build:js start:server",
20176       "start:watch": "run-p build:js:watch start:server",
20177       "start:server": "node scripts/server.js",
20178       test: "npm-run-all -s lint build test:spec",
20179       "test:spec": "karma start config/karma.conf.js",
20180       translations: "node scripts/update_locales.js"
20181     },
20182     dependencies: {
20183       "@mapbox/geojson-area": "^0.2.2",
20184       "@mapbox/sexagesimal": "1.2.0",
20185       "@mapbox/vector-tile": "^2.0.3",
20186       "@rapideditor/country-coder": "~5.3.0",
20187       "@rapideditor/location-conflation": "~1.4.0",
20188       "@tmcw/togeojson": "^5.8.1",
20189       "@turf/bbox": "^7.1.0",
20190       "@turf/bbox-clip": "^7.1.0",
20191       "abortcontroller-polyfill": "^1.7.5",
20192       "aes-js": "^3.1.2",
20193       "alif-toolkit": "^1.3.0",
20194       "core-js-bundle": "^3.38.0",
20195       diacritics: "1.3.0",
20196       exifr: "^7.1.3",
20197       "fast-deep-equal": "~3.1.1",
20198       "fast-json-stable-stringify": "2.1.0",
20199       "lodash-es": "~4.17.15",
20200       marked: "~14.0.0",
20201       "node-diff3": "~3.1.0",
20202       "osm-auth": "~2.5.0",
20203       pannellum: "2.5.6",
20204       pbf: "^4.0.1",
20205       "polygon-clipping": "~0.15.7",
20206       rbush: "4.0.0",
20207       "whatwg-fetch": "^3.6.20",
20208       "which-polygon": "2.2.1"
20209     },
20210     devDependencies: {
20211       "@fortawesome/fontawesome-svg-core": "~6.6.0",
20212       "@fortawesome/free-brands-svg-icons": "~6.6.0",
20213       "@fortawesome/free-regular-svg-icons": "~6.6.0",
20214       "@fortawesome/free-solid-svg-icons": "~6.6.0",
20215       "@mapbox/maki": "^8.0.1",
20216       "@openstreetmap/id-tagging-schema": "^6.8.1",
20217       "@rapideditor/mapillary_sprite_source": "^1.8.0",
20218       "@rapideditor/temaki": "^5.9.0",
20219       "@transifex/api": "^7.1.2",
20220       autoprefixer: "^10.4.20",
20221       browserslist: "^4.23.3",
20222       "browserslist-to-esbuild": "^2.1.1",
20223       chai: "^4.5.0",
20224       chalk: "^4.1.2",
20225       "cldr-core": "^45.0.0",
20226       "cldr-localenames-full": "^45.0.0",
20227       "concat-files": "^0.1.1",
20228       d3: "~7.9.0",
20229       dotenv: "^16.4.5",
20230       "editor-layer-index": "github:osmlab/editor-layer-index#gh-pages",
20231       esbuild: "^0.23.1",
20232       "esbuild-visualizer": "^0.6.0",
20233       eslint: "^9.9.0",
20234       "fetch-mock": "^9.11.0",
20235       gaze: "^1.1.3",
20236       glob: "^10.4.5",
20237       happen: "^0.3.2",
20238       "js-yaml": "^4.0.0",
20239       "json-stringify-pretty-compact": "^3.0.0",
20240       karma: "^6.4.4",
20241       "karma-chrome-launcher": "^3.2.0",
20242       "karma-coverage": "2.1.1",
20243       "karma-mocha": "^2.0.1",
20244       "karma-remap-istanbul": "^0.6.0",
20245       "mapillary-js": "4.1.2",
20246       minimist: "^1.2.8",
20247       mocha: "^10.7.3",
20248       "name-suggestion-index": "~6.0",
20249       "npm-run-all": "^4.0.0",
20250       "osm-community-index": "~5.8.0",
20251       postcss: "^8.4.41",
20252       "postcss-selector-prepend": "^0.5.0",
20253       shelljs: "^0.8.0",
20254       shx: "^0.3.0",
20255       sinon: "^11.1.2",
20256       "sinon-chai": "^3.7.0",
20257       smash: "0.0",
20258       "static-server": "^2.2.1",
20259       "svg-sprite": "2.0.4",
20260       vparse: "~1.1.0"
20261     },
20262     engines: {
20263       node: ">=18"
20264     },
20265     browserslist: [
20266       "> 0.3%, last 6 major versions, not dead, Firefox ESR, maintained node versions"
20267     ]
20268   };
20269
20270   // modules/core/file_fetcher.js
20271   var _mainFileFetcher = coreFileFetcher();
20272   function coreFileFetcher() {
20273     const ociVersion = package_default.dependencies["osm-community-index"] || package_default.devDependencies["osm-community-index"];
20274     const v2 = (0, import_vparse.default)(ociVersion);
20275     const ociVersionMinor = "".concat(v2.major, ".").concat(v2.minor);
20276     const presetsVersion = package_default.devDependencies["@openstreetmap/id-tagging-schema"];
20277     let _this = {};
20278     let _inflight4 = {};
20279     let _fileMap = {
20280       "address_formats": "data/address_formats.min.json",
20281       "imagery": "data/imagery.min.json",
20282       "intro_graph": "data/intro_graph.min.json",
20283       "keepRight": "data/keepRight.min.json",
20284       "languages": "data/languages.min.json",
20285       "locales": "locales/index.min.json",
20286       "phone_formats": "data/phone_formats.min.json",
20287       "qa_data": "data/qa_data.min.json",
20288       "shortcuts": "data/shortcuts.min.json",
20289       "territory_languages": "data/territory_languages.min.json",
20290       "oci_defaults": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/defaults.min.json",
20291       "oci_features": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/featureCollection.min.json",
20292       "oci_resources": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/resources.min.json",
20293       "presets_package": presetsCdnUrl.replace("{presets_version}", presetsVersion) + "package.json",
20294       "deprecated": presetsCdnUrl + "dist/deprecated.min.json",
20295       "discarded": presetsCdnUrl + "dist/discarded.min.json",
20296       "preset_categories": presetsCdnUrl + "dist/preset_categories.min.json",
20297       "preset_defaults": presetsCdnUrl + "dist/preset_defaults.min.json",
20298       "preset_fields": presetsCdnUrl + "dist/fields.min.json",
20299       "preset_presets": presetsCdnUrl + "dist/presets.min.json",
20300       "wmf_sitematrix": wmfSitematrixCdnUrl.replace("{version}", "0.1") + "wikipedia.min.json"
20301     };
20302     let _cachedData = {};
20303     _this.cache = () => _cachedData;
20304     _this.get = (which) => {
20305       if (_cachedData[which]) {
20306         return Promise.resolve(_cachedData[which]);
20307       }
20308       const file = _fileMap[which];
20309       const url = file && _this.asset(file);
20310       if (!url) {
20311         return Promise.reject('Unknown data file for "'.concat(which, '"'));
20312       }
20313       if (url.includes("{presets_version}")) {
20314         return _this.get("presets_package").then((result) => {
20315           const presetsVersion2 = result.version;
20316           return getUrl(url.replace("{presets_version}", presetsVersion2), which);
20317         });
20318       } else {
20319         return getUrl(url, which);
20320       }
20321     };
20322     function getUrl(url, which) {
20323       let prom = _inflight4[url];
20324       if (!prom) {
20325         _inflight4[url] = prom = fetch(url).then((response) => {
20326           if (!response.ok || !response.json) {
20327             throw new Error(response.status + " " + response.statusText);
20328           }
20329           if (response.status === 204 || response.status === 205) return;
20330           return response.json();
20331         }).then((result) => {
20332           delete _inflight4[url];
20333           if (!result) {
20334             throw new Error('No data loaded for "'.concat(which, '"'));
20335           }
20336           _cachedData[which] = result;
20337           return result;
20338         }).catch((err) => {
20339           delete _inflight4[url];
20340           throw err;
20341         });
20342       }
20343       return prom;
20344     }
20345     _this.fileMap = function(val) {
20346       if (!arguments.length) return _fileMap;
20347       _fileMap = val;
20348       return _this;
20349     };
20350     let _assetPath = "";
20351     _this.assetPath = function(val) {
20352       if (!arguments.length) return _assetPath;
20353       _assetPath = val;
20354       return _this;
20355     };
20356     let _assetMap = {};
20357     _this.assetMap = function(val) {
20358       if (!arguments.length) return _assetMap;
20359       _assetMap = val;
20360       return _this;
20361     };
20362     _this.asset = (val) => {
20363       if (/^http(s)?:\/\//i.test(val)) return val;
20364       const filename = _assetPath + val;
20365       return _assetMap[filename] || filename;
20366     };
20367     return _this;
20368   }
20369
20370   // node_modules/@rapideditor/country-coder/dist/country-coder.mjs
20371   var import_which_polygon = __toESM(require_which_polygon(), 1);
20372   var borders_default = { type: "FeatureCollection", features: [
20373     { type: "Feature", properties: { wikidata: "Q21", nameEn: "England", aliases: ["GB-ENG"], country: "GB", groups: ["Q23666", "Q3336843", "154", "150", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-6.03913, 51.13217], [-7.74976, 48.64773], [1.17405, 50.74239], [2.18458, 51.52087], [2.56575, 51.85301], [0.792, 57.56437], [-2.30613, 55.62698], [-2.17058, 55.45916], [-2.6095, 55.28488], [-2.63532, 55.19452], [-3.02906, 55.04606], [-3.09361, 54.94924], [-3.38407, 54.94278], [-4.1819, 54.57861], [-3.5082, 53.54318], [-3.08228, 53.25526], [-3.03675, 53.25092], [-2.92329, 53.19383], [-2.92022, 53.17685], [-2.98598, 53.15589], [-2.90649, 53.10964], [-2.87469, 53.12337], [-2.89131, 53.09374], [-2.83133, 52.99184], [-2.7251, 52.98389], [-2.72221, 52.92969], [-2.80549, 52.89428], [-2.85897, 52.94487], [-2.92401, 52.93836], [-2.97243, 52.9651], [-3.13576, 52.895], [-3.15744, 52.84947], [-3.16105, 52.79599], [-3.08734, 52.77504], [-3.01001, 52.76636], [-2.95581, 52.71794], [-3.01724, 52.72083], [-3.04398, 52.65435], [-3.13648, 52.58208], [-3.12926, 52.5286], [-3.09746, 52.53077], [-3.08662, 52.54811], [-3.00929, 52.57774], [-2.99701, 52.551], [-3.03603, 52.49969], [-3.13359, 52.49174], [-3.22971, 52.45344], [-3.22754, 52.42526], [-3.04687, 52.34504], [-2.95364, 52.3501], [-2.99701, 52.323], [-3.00785, 52.2753], [-3.09289, 52.20546], [-3.12638, 52.08114], [-2.97111, 51.90456], [-2.8818, 51.93196], [-2.78742, 51.88833], [-2.74277, 51.84367], [-2.66234, 51.83555], [-2.66336, 51.59504], [-3.20563, 51.31615], [-6.03913, 51.13217]]]] } },
20374     { type: "Feature", properties: { wikidata: "Q22", nameEn: "Scotland", aliases: ["GB-SCT"], country: "GB", groups: ["Q23666", "Q3336843", "154", "150", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44"] }, geometry: { type: "MultiPolygon", coordinates: [[[[0.792, 57.56437], [-0.3751, 61.32236], [-14.78497, 57.60709], [-6.82333, 55.83103], [-4.69044, 54.3629], [-3.38407, 54.94278], [-3.09361, 54.94924], [-3.02906, 55.04606], [-2.63532, 55.19452], [-2.6095, 55.28488], [-2.17058, 55.45916], [-2.30613, 55.62698], [0.792, 57.56437]]]] } },
20375     { type: "Feature", properties: { wikidata: "Q25", nameEn: "Wales", aliases: ["GB-WLS"], country: "GB", groups: ["Q23666", "Q3336843", "154", "150", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-3.5082, 53.54318], [-5.37267, 53.63269], [-6.03913, 51.13217], [-3.20563, 51.31615], [-2.66336, 51.59504], [-2.66234, 51.83555], [-2.74277, 51.84367], [-2.78742, 51.88833], [-2.8818, 51.93196], [-2.97111, 51.90456], [-3.12638, 52.08114], [-3.09289, 52.20546], [-3.00785, 52.2753], [-2.99701, 52.323], [-2.95364, 52.3501], [-3.04687, 52.34504], [-3.22754, 52.42526], [-3.22971, 52.45344], [-3.13359, 52.49174], [-3.03603, 52.49969], [-2.99701, 52.551], [-3.00929, 52.57774], [-3.08662, 52.54811], [-3.09746, 52.53077], [-3.12926, 52.5286], [-3.13648, 52.58208], [-3.04398, 52.65435], [-3.01724, 52.72083], [-2.95581, 52.71794], [-3.01001, 52.76636], [-3.08734, 52.77504], [-3.16105, 52.79599], [-3.15744, 52.84947], [-3.13576, 52.895], [-2.97243, 52.9651], [-2.92401, 52.93836], [-2.85897, 52.94487], [-2.80549, 52.89428], [-2.72221, 52.92969], [-2.7251, 52.98389], [-2.83133, 52.99184], [-2.89131, 53.09374], [-2.87469, 53.12337], [-2.90649, 53.10964], [-2.98598, 53.15589], [-2.92022, 53.17685], [-2.92329, 53.19383], [-3.03675, 53.25092], [-3.08228, 53.25526], [-3.5082, 53.54318]]]] } },
20376     { type: "Feature", properties: { wikidata: "Q26", nameEn: "Northern Ireland", aliases: ["GB-NIR"], country: "GB", groups: ["Q22890", "Q3336843", "154", "150", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-6.34755, 55.49206], [-7.2471, 55.06933], [-7.34464, 55.04688], [-7.4033, 55.00391], [-7.40004, 54.94498], [-7.44404, 54.9403], [-7.4473, 54.87003], [-7.47626, 54.83084], [-7.54508, 54.79401], [-7.54671, 54.74606], [-7.64449, 54.75265], [-7.75041, 54.7103], [-7.83352, 54.73854], [-7.93293, 54.66603], [-7.70315, 54.62077], [-7.8596, 54.53671], [-7.99812, 54.54427], [-8.04538, 54.48941], [-8.179, 54.46763], [-8.04555, 54.36292], [-7.87101, 54.29299], [-7.8596, 54.21779], [-7.81397, 54.20159], [-7.69501, 54.20731], [-7.55812, 54.12239], [-7.4799, 54.12239], [-7.44567, 54.1539], [-7.32834, 54.11475], [-7.30553, 54.11869], [-7.34005, 54.14698], [-7.29157, 54.17191], [-7.28017, 54.16714], [-7.29687, 54.1354], [-7.29493, 54.12013], [-7.26316, 54.13863], [-7.25012, 54.20063], [-7.14908, 54.22732], [-7.19145, 54.31296], [-7.02034, 54.4212], [-6.87775, 54.34682], [-6.85179, 54.29176], [-6.81583, 54.22791], [-6.74575, 54.18788], [-6.70175, 54.20218], [-6.6382, 54.17071], [-6.66264, 54.0666], [-6.62842, 54.03503], [-6.47849, 54.06947], [-6.36605, 54.07234], [-6.36279, 54.11248], [-6.32694, 54.09337], [-6.29003, 54.11278], [-6.26218, 54.09785], [-5.83481, 53.87749], [-4.69044, 54.3629], [-6.34755, 55.49206]]]] } },
20377     { type: "Feature", properties: { wikidata: "Q35", nameEn: "Denmark", country: "DK", groups: ["EU", "154", "150", "UN"], callingCodes: ["45"] }, geometry: { type: "MultiPolygon", coordinates: [[[[12.16597, 56.60205], [10.40861, 58.38489], [7.28637, 57.35913], [8.02459, 55.09613], [8.45719, 55.06747], [8.55769, 54.91837], [8.63979, 54.91069], [8.76387, 54.8948], [8.81178, 54.90518], [8.92795, 54.90452], [9.04629, 54.87249], [9.14275, 54.87421], [9.20571, 54.85841], [9.24631, 54.84726], [9.23445, 54.83432], [9.2474, 54.8112], [9.32771, 54.80602], [9.33849, 54.80233], [9.36496, 54.81749], [9.38532, 54.83968], [9.41213, 54.84254], [9.43155, 54.82586], [9.4659, 54.83131], [9.58937, 54.88785], [9.62734, 54.88057], [9.61187, 54.85548], [9.73563, 54.8247], [9.89314, 54.84171], [10.16755, 54.73883], [10.31111, 54.65968], [11.00303, 54.63689], [11.90309, 54.38543], [12.85844, 54.82438], [13.93395, 54.84044], [15.36991, 54.73263], [15.79951, 55.54655], [14.89259, 55.5623], [14.28399, 55.1553], [12.84405, 55.13257], [12.60345, 55.42675], [12.88472, 55.63369], [12.6372, 55.91371], [12.65312, 56.04345], [12.07466, 56.29488], [12.16597, 56.60205]]]] } },
20378     { type: "Feature", properties: { wikidata: "Q55", nameEn: "Netherlands", country: "NL", groups: ["EU", "155", "150", "UN"], callingCodes: ["31"] }, geometry: { type: "MultiPolygon", coordinates: [[[[5.45168, 54.20039], [2.56575, 51.85301], [3.36263, 51.37112], [3.38696, 51.33436], [3.35847, 51.31572], [3.38289, 51.27331], [3.41704, 51.25933], [3.43488, 51.24135], [3.52698, 51.2458], [3.51502, 51.28697], [3.58939, 51.30064], [3.78999, 51.25766], [3.78783, 51.2151], [3.90125, 51.20371], [3.97889, 51.22537], [4.01957, 51.24504], [4.05165, 51.24171], [4.16721, 51.29348], [4.24024, 51.35371], [4.21923, 51.37443], [4.33265, 51.37687], [4.34086, 51.35738], [4.39292, 51.35547], [4.43777, 51.36989], [4.38064, 51.41965], [4.39747, 51.43316], [4.38122, 51.44905], [4.47736, 51.4778], [4.5388, 51.48184], [4.54675, 51.47265], [4.52846, 51.45002], [4.53521, 51.4243], [4.57489, 51.4324], [4.65442, 51.42352], [4.72935, 51.48424], [4.74578, 51.48937], [4.77321, 51.50529], [4.78803, 51.50284], [4.84139, 51.4799], [4.82409, 51.44736], [4.82946, 51.4213], [4.78314, 51.43319], [4.76577, 51.43046], [4.77229, 51.41337], [4.78941, 51.41102], [4.84988, 51.41502], [4.90016, 51.41404], [4.92152, 51.39487], [5.00393, 51.44406], [5.0106, 51.47167], [5.03281, 51.48679], [5.04774, 51.47022], [5.07891, 51.4715], [5.10456, 51.43163], [5.07102, 51.39469], [5.13105, 51.34791], [5.13377, 51.31592], [5.16222, 51.31035], [5.2002, 51.32243], [5.24244, 51.30495], [5.22542, 51.26888], [5.23814, 51.26064], [5.26461, 51.26693], [5.29716, 51.26104], [5.33886, 51.26314], [5.347, 51.27502], [5.41672, 51.26248], [5.4407, 51.28169], [5.46519, 51.2849], [5.48476, 51.30053], [5.515, 51.29462], [5.5569, 51.26544], [5.5603, 51.22249], [5.65145, 51.19788], [5.65528, 51.18736], [5.70344, 51.1829], [5.74617, 51.18928], [5.77735, 51.17845], [5.77697, 51.1522], [5.82564, 51.16753], [5.85508, 51.14445], [5.80798, 51.11661], [5.8109, 51.10861], [5.83226, 51.10585], [5.82921, 51.09328], [5.79903, 51.09371], [5.79835, 51.05834], [5.77258, 51.06196], [5.75961, 51.03113], [5.77688, 51.02483], [5.76242, 50.99703], [5.71864, 50.96092], [5.72875, 50.95428], [5.74752, 50.96202], [5.75927, 50.95601], [5.74644, 50.94723], [5.72545, 50.92312], [5.72644, 50.91167], [5.71626, 50.90796], [5.69858, 50.91046], [5.67886, 50.88142], [5.64504, 50.87107], [5.64009, 50.84742], [5.65259, 50.82309], [5.70118, 50.80764], [5.68995, 50.79641], [5.70107, 50.7827], [5.68091, 50.75804], [5.69469, 50.75529], [5.72216, 50.76398], [5.73904, 50.75674], [5.74356, 50.7691], [5.76533, 50.78159], [5.77513, 50.78308], [5.80673, 50.7558], [5.84548, 50.76542], [5.84888, 50.75448], [5.88734, 50.77092], [5.89129, 50.75125], [5.89132, 50.75124], [5.95942, 50.7622], [5.97545, 50.75441], [6.01976, 50.75398], [6.02624, 50.77453], [5.97497, 50.79992], [5.98404, 50.80988], [6.00462, 50.80065], [6.02328, 50.81694], [6.01921, 50.84435], [6.05623, 50.8572], [6.05702, 50.85179], [6.07431, 50.84674], [6.07693, 50.86025], [6.08805, 50.87223], [6.07486, 50.89307], [6.09297, 50.92066], [6.01615, 50.93367], [6.02697, 50.98303], [5.95282, 50.98728], [5.90296, 50.97356], [5.90493, 51.00198], [5.87849, 51.01969], [5.86735, 51.05182], [5.9134, 51.06736], [5.9541, 51.03496], [5.98292, 51.07469], [6.16706, 51.15677], [6.17384, 51.19589], [6.07889, 51.17038], [6.07889, 51.24432], [6.16977, 51.33169], [6.22674, 51.36135], [6.22641, 51.39948], [6.20654, 51.40049], [6.21724, 51.48568], [6.18017, 51.54096], [6.09055, 51.60564], [6.11759, 51.65609], [6.02767, 51.6742], [6.04091, 51.71821], [5.95003, 51.7493], [5.98665, 51.76944], [5.94568, 51.82786], [5.99848, 51.83195], [6.06705, 51.86136], [6.10337, 51.84829], [6.16902, 51.84094], [6.11551, 51.89769], [6.15349, 51.90439], [6.21443, 51.86801], [6.29872, 51.86801], [6.30593, 51.84998], [6.40704, 51.82771], [6.38815, 51.87257], [6.47179, 51.85395], [6.50231, 51.86313], [6.58556, 51.89386], [6.68386, 51.91861], [6.72319, 51.89518], [6.82357, 51.96711], [6.83035, 51.9905], [6.68128, 52.05052], [6.76117, 52.11895], [6.83984, 52.11728], [6.97189, 52.20329], [6.9897, 52.2271], [7.03729, 52.22695], [7.06365, 52.23789], [7.02703, 52.27941], [7.07044, 52.37805], [7.03417, 52.40237], [6.99041, 52.47235], [6.94293, 52.43597], [6.69507, 52.488], [6.71641, 52.62905], [6.77307, 52.65375], [7.04557, 52.63318], [7.07253, 52.81083], [7.21694, 53.00742], [7.17898, 53.13817], [7.22681, 53.18165], [7.21679, 53.20058], [7.19052, 53.31866], [7.00198, 53.32672], [6.91025, 53.44221], [5.45168, 54.20039]], [[4.93295, 51.44945], [4.95244, 51.45207], [4.9524, 51.45014], [4.93909, 51.44632], [4.93295, 51.44945]], [[4.91493, 51.4353], [4.91935, 51.43634], [4.92227, 51.44252], [4.91811, 51.44621], [4.92287, 51.44741], [4.92811, 51.4437], [4.92566, 51.44273], [4.92815, 51.43856], [4.92879, 51.44161], [4.93544, 51.44634], [4.94025, 51.44193], [4.93416, 51.44185], [4.93471, 51.43861], [4.94265, 51.44003], [4.93986, 51.43064], [4.92952, 51.42984], [4.92652, 51.43329], [4.91493, 51.4353]]]] } },
20379     { type: "Feature", properties: { wikidata: "Q782", nameEn: "Hawaii", aliases: ["US-HI"], country: "US", groups: ["Q35657", "061", "009", "UN"], roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-177.8563, 29.18961], [-179.49839, 27.86265], [-151.6784, 9.55515], [-154.05867, 45.51124], [-177.5224, 27.7635], [-177.8563, 29.18961]]]] } },
20380     { type: "Feature", properties: { wikidata: "Q797", nameEn: "Alaska", aliases: ["US-AK"], country: "US", groups: ["Q35657", "021", "003", "019", "UN"], roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1"] }, geometry: { type: "MultiPolygon", coordinates: [[[[169.34848, 52.47228], [180, 51.0171], [179.84401, 55.10087], [169.34848, 52.47228]]], [[[-168.95635, 65.98512], [-169.03888, 65.48473], [-172.76104, 63.77445], [-179.55295, 57.62081], [-179.55295, 50.81807], [-133.92876, 54.62289], [-130.61931, 54.70835], [-130.64499, 54.76912], [-130.44184, 54.85377], [-130.27203, 54.97174], [-130.18765, 55.07744], [-130.08035, 55.21556], [-129.97513, 55.28029], [-130.15373, 55.74895], [-130.00857, 55.91344], [-130.00093, 56.00325], [-130.10173, 56.12178], [-130.33965, 56.10849], [-130.77769, 56.36185], [-131.8271, 56.62247], [-133.38523, 58.42773], [-133.84645, 58.73543], [-134.27175, 58.8634], [-134.48059, 59.13231], [-134.55699, 59.1297], [-134.7047, 59.2458], [-135.00267, 59.28745], [-135.03069, 59.56208], [-135.48007, 59.79937], [-136.31566, 59.59083], [-136.22381, 59.55526], [-136.33727, 59.44466], [-136.47323, 59.46617], [-136.52365, 59.16752], [-136.82619, 59.16198], [-137.4925, 58.89415], [-137.60623, 59.24465], [-138.62145, 59.76431], [-138.71149, 59.90728], [-139.05365, 59.99655], [-139.20603, 60.08896], [-139.05831, 60.35205], [-139.68991, 60.33693], [-139.98024, 60.18027], [-140.45648, 60.30919], [-140.5227, 60.22077], [-141.00116, 60.30648], [-140.97446, 84.39275], [-168.25765, 71.99091], [-168.95635, 65.98512]]]] } },
20381     { type: "Feature", properties: { wikidata: "Q3492", nameEn: "Sumatra", aliases: ["ID-SM"], country: "ID", groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["62"] }, geometry: { type: "MultiPolygon", coordinates: [[[[109.82788, 2.86812], [110.90339, 7.52694], [105.01437, 3.24936], [104.56723, 1.44271], [104.34728, 1.33529], [104.12282, 1.27714], [104.03085, 1.26954], [103.74084, 1.12902], [103.66049, 1.18825], [103.56591, 1.19719], [103.03657, 1.30383], [96.11174, 6.69841], [74.28481, -3.17525], [102.92489, -8.17146], [106.32259, -5.50116], [106.38511, -5.16715], [109.17017, -4.07401], [109.3962, -2.07276], [108.50935, -2.01066], [107.94791, 1.06924], [109.82788, 2.86812]]]] } },
20382     { type: "Feature", properties: { wikidata: "Q3757", nameEn: "Java", aliases: ["ID-JW"], country: "ID", groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["62"] }, geometry: { type: "MultiPolygon", coordinates: [[[[109.17017, -4.07401], [106.38511, -5.16715], [106.32259, -5.50116], [102.92489, -8.17146], [116.22542, -10.49172], [114.39575, -8.2889], [114.42235, -8.09762], [114.92859, -7.49253], [116.33992, -7.56171], [116.58433, -5.30385], [109.17017, -4.07401]]]] } },
20383     { type: "Feature", properties: { wikidata: "Q3795", nameEn: "Kalimantan", aliases: ["ID-KA"], country: "ID", groups: ["Q36117", "035", "142", "UN"], driveSide: "left", callingCodes: ["62"] }, geometry: { type: "MultiPolygon", coordinates: [[[[120.02464, 2.83703], [118.06469, 4.16638], [117.67641, 4.16535], [117.47313, 4.18857], [117.25801, 4.35108], [115.90217, 4.37708], [115.58276, 3.93499], [115.53713, 3.14776], [115.11343, 2.82879], [115.1721, 2.49671], [114.80706, 2.21665], [114.80706, 1.92351], [114.57892, 1.5], [114.03788, 1.44787], [113.64677, 1.23933], [113.01448, 1.42832], [113.021, 1.57819], [112.48648, 1.56516], [112.2127, 1.44135], [112.15679, 1.17004], [111.94553, 1.12016], [111.82846, 0.99349], [111.55434, 0.97864], [111.22979, 1.08326], [110.62374, 0.873], [110.49182, 0.88088], [110.35354, 0.98869], [109.66397, 1.60425], [109.66397, 1.79972], [109.57923, 1.80624], [109.53794, 1.91771], [109.62558, 1.99182], [109.82788, 2.86812], [107.94791, 1.06924], [108.50935, -2.01066], [109.3962, -2.07276], [109.17017, -4.07401], [116.58433, -5.30385], [120.02464, 2.83703]]]] } },
20384     { type: "Feature", properties: { wikidata: "Q3803", nameEn: "Lesser Sunda Islands", aliases: ["ID-NU"], country: "ID", groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["62"] }, geometry: { type: "MultiPolygon", coordinates: [[[[116.96967, -8.01483], [114.92859, -7.49253], [114.42235, -8.09762], [114.39575, -8.2889], [116.22542, -10.49172], [122.14954, -11.52517], [125.68138, -9.85176], [125.09025, -9.46406], [124.97892, -9.19281], [125.04044, -9.17093], [125.09434, -9.19669], [125.18907, -9.16434], [125.18632, -9.03142], [125.11764, -8.96359], [124.97742, -9.08128], [124.94011, -8.85617], [124.46701, -9.13002], [124.45971, -9.30263], [124.38554, -9.3582], [124.35258, -9.43002], [124.3535, -9.48493], [124.28115, -9.50453], [124.28115, -9.42189], [124.21247, -9.36904], [124.14517, -9.42324], [124.10539, -9.41206], [124.04286, -9.34243], [124.04628, -9.22671], [124.33472, -9.11416], [124.92337, -8.75859], [125.87688, -7.49892], [116.96967, -8.01483]]]] } },
20385     { type: "Feature", properties: { wikidata: "Q3812", nameEn: "Sulawesi", aliases: ["ID-SL"], country: "ID", groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["62"] }, geometry: { type: "MultiPolygon", coordinates: [[[[128.34321, 3.90322], [126.69413, 6.02692], [119.56457, 0.90759], [116.58433, -5.30385], [116.33992, -7.56171], [116.96967, -8.01483], [125.87688, -7.49892], [123.78965, -0.86805], [128.34321, 3.90322]]]] } },
20386     { type: "Feature", properties: { wikidata: "Q3827", nameEn: "Maluku Islands", aliases: ["ID-ML"], country: "ID", groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["62"] }, geometry: { type: "MultiPolygon", coordinates: [[[[129.63187, 2.21409], [128.34321, 3.90322], [123.78965, -0.86805], [125.87688, -7.49892], [125.58506, -7.95311], [125.87691, -8.31789], [127.42116, -8.22471], [127.55165, -9.05052], [135.49042, -9.2276], [135.35517, -5.01442], [132.8312, -4.70282], [130.8468, -2.61103], [128.40647, -2.30349], [129.71519, -0.24692], [129.63187, 2.21409]]]] } },
20387     { type: "Feature", properties: { wikidata: "Q3845", nameEn: "Western New Guinea", aliases: ["ID-PP"], country: "ID", groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["62"] }, geometry: { type: "MultiPolygon", coordinates: [[[[135.49042, -9.2276], [141.01842, -9.35091], [141.01763, -6.90181], [140.90448, -6.85033], [140.85295, -6.72996], [140.99813, -6.3233], [141.02352, 0.08993], [129.63187, 2.21409], [129.71519, -0.24692], [128.40647, -2.30349], [130.8468, -2.61103], [132.8312, -4.70282], [135.35517, -5.01442], [135.49042, -9.2276]]]] } },
20388     { type: "Feature", properties: { wikidata: "Q5765", nameEn: "Balearic Islands", aliases: ["ES-IB"], country: "ES", groups: ["EU", "039", "150", "UN"], callingCodes: ["34 971"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-2.27707, 35.35051], [5.10072, 39.89531], [3.75438, 42.33445], [-2.27707, 35.35051]]]] } },
20389     { type: "Feature", properties: { wikidata: "Q5823", nameEn: "Ceuta", aliases: ["ES-CE"], country: "ES", groups: ["EA", "EU", "015", "002", "UN"], level: "subterritory", callingCodes: ["34"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-5.38491, 35.92591], [-5.37338, 35.88417], [-5.35844, 35.87375], [-5.34379, 35.8711], [-5.21179, 35.90091], [-5.38491, 35.92591]]]] } },
20390     { type: "Feature", properties: { wikidata: "Q5831", nameEn: "Melilla", aliases: ["ES-ML"], country: "ES", groups: ["EA", "EU", "015", "002", "UN"], level: "subterritory", callingCodes: ["34"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-2.91909, 35.33927], [-2.96038, 35.31609], [-2.96648, 35.30475], [-2.96978, 35.29459], [-2.97035, 35.28852], [-2.96507, 35.28801], [-2.96826, 35.28296], [-2.96516, 35.27967], [-2.95431, 35.2728], [-2.95065, 35.26576], [-2.93893, 35.26737], [-2.92272, 35.27509], [-2.91909, 35.33927]]]] } },
20391     { type: "Feature", properties: { wikidata: "Q7835", nameEn: "Crimea", country: "RU", groups: ["151", "150", "UN"], level: "subterritory", callingCodes: ["7"] }, geometry: { type: "MultiPolygon", coordinates: [[[[33.5, 44], [36.4883, 45.0488], [36.475, 45.2411], [36.5049, 45.3136], [36.6545, 45.3417], [36.6645, 45.4514], [35.0498, 45.7683], [34.9601, 45.7563], [34.7991, 45.8101], [34.8015, 45.9005], [34.7548, 45.907], [34.6668, 45.9714], [34.6086, 45.9935], [34.5589, 45.9935], [34.5201, 45.951], [34.4873, 45.9427], [34.4415, 45.9599], [34.4122, 46.0025], [34.3391, 46.0611], [34.2511, 46.0532], [34.181, 46.068], [34.1293, 46.1049], [34.0731, 46.1177], [34.0527, 46.1084], [33.9155, 46.1594], [33.8523, 46.1986], [33.7972, 46.2048], [33.7405, 46.1855], [33.646, 46.2303], [33.6152, 46.2261], [33.6385, 46.1415], [33.6147, 46.1356], [33.5732, 46.1032], [33.5909, 46.0601], [33.5597, 46.0307], [31.5, 45.5], [33.5, 44]]]] } },
20392     { type: "Feature", properties: { wikidata: "Q12837", nameEn: "Iberia", level: "sharedLandform" }, geometry: null },
20393     { type: "Feature", properties: { wikidata: "Q14056", nameEn: "Jan Mayen", aliases: ["NO-22"], country: "NO", groups: ["SJ", "154", "150", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[-9.18243, 72.23144], [-10.71459, 70.09565], [-5.93364, 70.76368], [-9.18243, 72.23144]]]] } },
20394     { type: "Feature", properties: { wikidata: "Q19188", nameEn: "Mainland China", country: "CN", groups: ["030", "142", "UN"], callingCodes: ["86"] }, geometry: { type: "MultiPolygon", coordinates: [[[[125.6131, 53.07229], [125.17522, 53.20225], [124.46078, 53.21881], [123.86158, 53.49391], [123.26989, 53.54843], [122.85966, 53.47395], [122.35063, 53.49565], [121.39213, 53.31888], [120.85633, 53.28499], [120.0451, 52.7359], [120.04049, 52.58773], [120.46454, 52.63811], [120.71673, 52.54099], [120.61346, 52.32447], [120.77337, 52.20805], [120.65907, 51.93544], [120.10963, 51.671], [119.13553, 50.37412], [119.38598, 50.35162], [119.27996, 50.13348], [119.11003, 50.00276], [118.61623, 49.93809], [117.82343, 49.52696], [117.48208, 49.62324], [117.27597, 49.62544], [116.71193, 49.83813], [116.03781, 48.87014], [116.06565, 48.81716], [115.78876, 48.51781], [115.811, 48.25699], [115.52082, 48.15367], [115.57128, 47.91988], [115.94296, 47.67741], [116.21879, 47.88505], [116.4465, 47.83662], [116.67405, 47.89039], [116.9723, 47.87285], [117.37875, 47.63627], [117.50181, 47.77216], [117.80196, 48.01661], [118.03676, 48.00982], [118.11009, 48.04], [118.22677, 48.03853], [118.29654, 48.00246], [118.55766, 47.99277], [118.7564, 47.76947], [119.12343, 47.66458], [119.13995, 47.53997], [119.35892, 47.48104], [119.31964, 47.42617], [119.54918, 47.29505], [119.56019, 47.24874], [119.62403, 47.24575], [119.71209, 47.19192], [119.85518, 46.92196], [119.91242, 46.90091], [119.89261, 46.66423], [119.80455, 46.67631], [119.77373, 46.62947], [119.68127, 46.59015], [119.65265, 46.62342], [119.42827, 46.63783], [119.32827, 46.61433], [119.24978, 46.64761], [119.10448, 46.65516], [119.00541, 46.74273], [118.92616, 46.72765], [118.89974, 46.77139], [118.8337, 46.77742], [118.78747, 46.68689], [118.30534, 46.73519], [117.69554, 46.50991], [117.60748, 46.59771], [117.41782, 46.57862], [117.36609, 46.36335], [116.83166, 46.38637], [116.75551, 46.33083], [116.58612, 46.30211], [116.26678, 45.96479], [116.24012, 45.8778], [116.27366, 45.78637], [116.16989, 45.68603], [115.60329, 45.44717], [114.94546, 45.37377], [114.74612, 45.43585], [114.54801, 45.38337], [114.5166, 45.27189], [113.70918, 44.72891], [112.74662, 44.86297], [112.4164, 45.06858], [111.98695, 45.09074], [111.76275, 44.98032], [111.40498, 44.3461], [111.96289, 43.81596], [111.93776, 43.68709], [111.79758, 43.6637], [111.59087, 43.51207], [111.0149, 43.3289], [110.4327, 42.78293], [110.08401, 42.6411], [109.89402, 42.63111], [109.452, 42.44842], [109.00679, 42.45302], [108.84489, 42.40246], [107.57258, 42.40898], [107.49681, 42.46221], [107.29755, 42.41395], [107.24774, 42.36107], [106.76517, 42.28741], [105.0123, 41.63188], [104.51667, 41.66113], [104.52258, 41.8706], [103.92804, 41.78246], [102.72403, 42.14675], [102.07645, 42.22519], [101.80515, 42.50074], [100.84979, 42.67087], [100.33297, 42.68231], [99.50671, 42.56535], [97.1777, 42.7964], [96.37926, 42.72055], [96.35658, 42.90363], [95.89543, 43.2528], [95.52594, 43.99353], [95.32891, 44.02407], [95.39772, 44.2805], [95.01191, 44.25274], [94.71959, 44.35284], [94.10003, 44.71016], [93.51161, 44.95964], [91.64048, 45.07408], [90.89169, 45.19667], [90.65114, 45.49314], [90.70907, 45.73437], [91.03026, 46.04194], [90.99672, 46.14207], [90.89639, 46.30711], [91.07696, 46.57315], [91.0147, 46.58171], [91.03649, 46.72916], [90.84035, 46.99525], [90.76108, 46.99399], [90.48542, 47.30438], [90.48854, 47.41826], [90.33598, 47.68303], [90.10871, 47.7375], [90.06512, 47.88177], [89.76624, 47.82745], [89.55453, 48.0423], [89.0711, 47.98528], [88.93186, 48.10263], [88.8011, 48.11302], [88.58316, 48.21893], [88.58939, 48.34531], [87.96361, 48.58478], [88.0788, 48.71436], [87.73822, 48.89582], [87.88171, 48.95853], [87.81333, 49.17354], [87.48983, 49.13794], [87.478, 49.07403], [87.28386, 49.11626], [86.87238, 49.12432], [86.73568, 48.99918], [86.75343, 48.70331], [86.38069, 48.46064], [85.73581, 48.3939], [85.5169, 48.05493], [85.61067, 47.49753], [85.69696, 47.2898], [85.54294, 47.06171], [85.22443, 47.04816], [84.93995, 46.87399], [84.73077, 47.01394], [83.92184, 46.98912], [83.04622, 47.19053], [82.21792, 45.56619], [82.58474, 45.40027], [82.51374, 45.1755], [81.73278, 45.3504], [80.11169, 45.03352], [79.8987, 44.89957], [80.38384, 44.63073], [80.40229, 44.23319], [80.40031, 44.10986], [80.75156, 43.44948], [80.69718, 43.32589], [80.77771, 43.30065], [80.78817, 43.14235], [80.62913, 43.141], [80.3735, 43.01557], [80.58999, 42.9011], [80.38169, 42.83142], [80.26886, 42.8366], [80.16892, 42.61137], [80.26841, 42.23797], [80.17807, 42.21166], [80.17842, 42.03211], [79.92977, 42.04113], [78.3732, 41.39603], [78.15757, 41.38565], [78.12873, 41.23091], [77.81287, 41.14307], [77.76206, 41.01574], [77.52723, 41.00227], [77.3693, 41.0375], [77.28004, 41.0033], [76.99302, 41.0696], [76.75681, 40.95354], [76.5261, 40.46114], [76.33659, 40.3482], [75.96168, 40.38064], [75.91361, 40.2948], [75.69663, 40.28642], [75.5854, 40.66874], [75.22834, 40.45382], [75.08243, 40.43945], [74.82013, 40.52197], [74.78168, 40.44886], [74.85996, 40.32857], [74.69875, 40.34668], [74.35063, 40.09742], [74.25533, 40.13191], [73.97049, 40.04378], [73.83006, 39.76136], [73.9051, 39.75073], [73.92354, 39.69565], [73.94683, 39.60733], [73.87018, 39.47879], [73.59831, 39.46425], [73.59241, 39.40843], [73.5004, 39.38402], [73.55396, 39.3543], [73.54572, 39.27567], [73.60638, 39.24534], [73.75823, 39.023], [73.81728, 39.04007], [73.82964, 38.91517], [73.7445, 38.93867], [73.7033, 38.84782], [73.80656, 38.66449], [73.79806, 38.61106], [73.97933, 38.52945], [74.17022, 38.65504], [74.51217, 38.47034], [74.69619, 38.42947], [74.69894, 38.22155], [74.80331, 38.19889], [74.82665, 38.07359], [74.9063, 38.03033], [74.92416, 37.83428], [75.00935, 37.77486], [74.8912, 37.67576], [74.94338, 37.55501], [75.06011, 37.52779], [75.15899, 37.41443], [75.09719, 37.37297], [75.12328, 37.31839], [74.88887, 37.23275], [74.80605, 37.21565], [74.49981, 37.24518], [74.56453, 37.03023], [75.13839, 37.02622], [75.40481, 36.95382], [75.45562, 36.71971], [75.72737, 36.7529], [75.92391, 36.56986], [76.0324, 36.41198], [76.00906, 36.17511], [75.93028, 36.13136], [76.15325, 35.9264], [76.14913, 35.82848], [76.33453, 35.84296], [76.50961, 35.8908], [76.77323, 35.66062], [76.84539, 35.67356], [76.96624, 35.5932], [77.44277, 35.46132], [77.70232, 35.46244], [77.80532, 35.52058], [78.11664, 35.48022], [78.03466, 35.3785], [78.00033, 35.23954], [78.22692, 34.88771], [78.18435, 34.7998], [78.27781, 34.61484], [78.54964, 34.57283], [78.56475, 34.50835], [78.74465, 34.45174], [79.05364, 34.32482], [78.99802, 34.3027], [78.91769, 34.15452], [78.66225, 34.08858], [78.65657, 34.03195], [78.73367, 34.01121], [78.77349, 33.73871], [78.67599, 33.66445], [78.73636, 33.56521], [79.15252, 33.17156], [79.14016, 33.02545], [79.46562, 32.69668], [79.26768, 32.53277], [79.13174, 32.47766], [79.0979, 32.38051], [78.99322, 32.37948], [78.96713, 32.33655], [78.7831, 32.46873], [78.73916, 32.69438], [78.38897, 32.53938], [78.4645, 32.45367], [78.49609, 32.2762], [78.68754, 32.10256], [78.74404, 32.00384], [78.78036, 31.99478], [78.69933, 31.78723], [78.84516, 31.60631], [78.71032, 31.50197], [78.77898, 31.31209], [78.89344, 31.30481], [79.01931, 31.42817], [79.14016, 31.43403], [79.30694, 31.17357], [79.59884, 30.93943], [79.93255, 30.88288], [80.20721, 30.58541], [80.54504, 30.44936], [80.83343, 30.32023], [81.03953, 30.20059], [81.12842, 30.01395], [81.24362, 30.0126], [81.29032, 30.08806], [81.2623, 30.14596], [81.33355, 30.15303], [81.39928, 30.21862], [81.41018, 30.42153], [81.5459, 30.37688], [81.62033, 30.44703], [81.99082, 30.33423], [82.10135, 30.35439], [82.10757, 30.23745], [82.19475, 30.16884], [82.16984, 30.0692], [82.38622, 30.02608], [82.5341, 29.9735], [82.73024, 29.81695], [83.07116, 29.61957], [83.28131, 29.56813], [83.44787, 29.30513], [83.63156, 29.16249], [83.82303, 29.30513], [83.97559, 29.33091], [84.18107, 29.23451], [84.24801, 29.02783], [84.2231, 28.89571], [84.47528, 28.74023], [84.62317, 28.73887], [84.85511, 28.58041], [85.06059, 28.68562], [85.19135, 28.62825], [85.18668, 28.54076], [85.10729, 28.34092], [85.38127, 28.28336], [85.4233, 28.32996], [85.59765, 28.30529], [85.60854, 28.25045], [85.69105, 28.38475], [85.71907, 28.38064], [85.74864, 28.23126], [85.84672, 28.18187], [85.90743, 28.05144], [85.97813, 27.99023], [85.94946, 27.9401], [86.06309, 27.90021], [86.12069, 27.93047], [86.08333, 28.02121], [86.088, 28.09264], [86.18607, 28.17364], [86.22966, 27.9786], [86.42736, 27.91122], [86.51609, 27.96623], [86.56265, 28.09569], [86.74181, 28.10638], [86.75582, 28.04182], [87.03757, 27.94835], [87.11696, 27.84104], [87.56996, 27.84517], [87.72718, 27.80938], [87.82681, 27.95248], [88.13378, 27.88015], [88.1278, 27.95417], [88.25332, 27.9478], [88.54858, 28.06057], [88.63235, 28.12356], [88.83559, 28.01936], [88.88091, 27.85192], [88.77517, 27.45415], [88.82981, 27.38814], [88.91901, 27.32483], [88.93678, 27.33777], [88.96947, 27.30319], [89.00216, 27.32532], [88.95355, 27.4106], [88.97213, 27.51671], [89.0582, 27.60985], [89.12825, 27.62502], [89.59525, 28.16433], [89.79762, 28.23979], [90.13387, 28.19178], [90.58842, 28.02838], [90.69894, 28.07784], [91.20019, 27.98715], [91.25779, 28.07509], [91.46327, 28.0064], [91.48973, 27.93903], [91.5629, 27.84823], [91.6469, 27.76358], [91.84722, 27.76325], [91.87057, 27.7195], [92.27432, 27.89077], [92.32101, 27.79363], [92.42538, 27.80092], [92.7275, 27.98662], [92.73025, 28.05814], [92.65472, 28.07632], [92.67486, 28.15018], [92.93075, 28.25671], [93.14635, 28.37035], [93.18069, 28.50319], [93.44621, 28.67189], [93.72797, 28.68821], [94.35897, 29.01965], [94.2752, 29.11687], [94.69318, 29.31739], [94.81353, 29.17804], [95.0978, 29.14446], [95.11291, 29.09527], [95.2214, 29.10727], [95.26122, 29.07727], [95.3038, 29.13847], [95.41091, 29.13007], [95.50842, 29.13487], [95.72086, 29.20797], [95.75149, 29.32063], [95.84899, 29.31464], [96.05361, 29.38167], [96.31316, 29.18643], [96.18682, 29.11087], [96.20467, 29.02325], [96.3626, 29.10607], [96.61391, 28.72742], [96.40929, 28.51526], [96.48895, 28.42955], [96.6455, 28.61657], [96.85561, 28.4875], [96.88445, 28.39452], [96.98882, 28.32564], [97.1289, 28.3619], [97.34547, 28.21385], [97.41729, 28.29783], [97.47085, 28.2688], [97.50518, 28.49716], [97.56835, 28.55628], [97.70705, 28.5056], [97.79632, 28.33168], [97.90069, 28.3776], [98.15337, 28.12114], [98.13964, 27.9478], [98.32641, 27.51385], [98.42529, 27.55404], [98.43353, 27.67086], [98.69582, 27.56499], [98.7333, 26.85615], [98.77547, 26.61994], [98.72741, 26.36183], [98.67797, 26.24487], [98.7329, 26.17218], [98.66884, 26.09165], [98.63128, 26.15492], [98.57085, 26.11547], [98.60763, 26.01512], [98.70818, 25.86241], [98.63128, 25.79937], [98.54064, 25.85129], [98.40606, 25.61129], [98.31268, 25.55307], [98.25774, 25.6051], [98.16848, 25.62739], [98.18084, 25.56298], [98.12591, 25.50722], [98.14925, 25.41547], [97.92541, 25.20815], [97.83614, 25.2715], [97.77023, 25.11492], [97.72216, 25.08508], [97.72903, 24.91332], [97.79949, 24.85655], [97.76481, 24.8289], [97.73127, 24.83015], [97.70181, 24.84557], [97.64354, 24.79171], [97.56648, 24.76475], [97.56383, 24.75535], [97.5542, 24.74943], [97.54675, 24.74202], [97.56525, 24.72838], [97.56286, 24.54535], [97.52757, 24.43748], [97.60029, 24.4401], [97.66998, 24.45288], [97.7098, 24.35658], [97.65624, 24.33781], [97.66723, 24.30027], [97.71941, 24.29652], [97.76799, 24.26365], [97.72998, 24.2302], [97.72799, 24.18883], [97.75305, 24.16902], [97.72903, 24.12606], [97.62363, 24.00506], [97.5247, 23.94032], [97.64667, 23.84574], [97.72302, 23.89288], [97.79456, 23.94836], [97.79416, 23.95663], [97.84328, 23.97603], [97.86545, 23.97723], [97.88811, 23.97446], [97.8955, 23.97758], [97.89676, 23.97931], [97.89683, 23.98389], [97.88814, 23.98605], [97.88414, 23.99405], [97.88616, 24.00463], [97.90998, 24.02094], [97.93951, 24.01953], [97.98691, 24.03897], [97.99583, 24.04932], [98.04709, 24.07616], [98.05302, 24.07408], [98.05671, 24.07961], [98.0607, 24.07812], [98.06703, 24.08028], [98.07806, 24.07988], [98.20666, 24.11406], [98.54476, 24.13119], [98.59256, 24.08371], [98.85319, 24.13042], [98.87998, 24.15624], [98.89632, 24.10612], [98.67797, 23.9644], [98.68209, 23.80492], [98.79607, 23.77947], [98.82933, 23.72921], [98.81775, 23.694], [98.88396, 23.59555], [98.80294, 23.5345], [98.82877, 23.47908], [98.87683, 23.48995], [98.92104, 23.36946], [98.87573, 23.33038], [98.93958, 23.31414], [98.92515, 23.29535], [98.88597, 23.18656], [99.05975, 23.16382], [99.04601, 23.12215], [99.25741, 23.09025], [99.34127, 23.13099], [99.52214, 23.08218], [99.54218, 22.90014], [99.43537, 22.94086], [99.45654, 22.85726], [99.31243, 22.73893], [99.38247, 22.57544], [99.37972, 22.50188], [99.28771, 22.4105], [99.17318, 22.18025], [99.19176, 22.16983], [99.1552, 22.15874], [99.33166, 22.09656], [99.47585, 22.13345], [99.85351, 22.04183], [99.96612, 22.05965], [99.99084, 21.97053], [99.94003, 21.82782], [99.98654, 21.71064], [100.04956, 21.66843], [100.12679, 21.70539], [100.17486, 21.65306], [100.10757, 21.59945], [100.12542, 21.50365], [100.1625, 21.48704], [100.18447, 21.51898], [100.25863, 21.47043], [100.35201, 21.53176], [100.42892, 21.54325], [100.4811, 21.46148], [100.57861, 21.45637], [100.72143, 21.51898], [100.87265, 21.67396], [101.11744, 21.77659], [101.15156, 21.56129], [101.2124, 21.56422], [101.19349, 21.41959], [101.26912, 21.36482], [101.2229, 21.23271], [101.29326, 21.17254], [101.54563, 21.25668], [101.6068, 21.23329], [101.59491, 21.18621], [101.60886, 21.17947], [101.66977, 21.20004], [101.70548, 21.14911], [101.7622, 21.14813], [101.79266, 21.19025], [101.76745, 21.21571], [101.83887, 21.20983], [101.84412, 21.25291], [101.74014, 21.30967], [101.74224, 21.48276], [101.7727, 21.51794], [101.7475, 21.5873], [101.80001, 21.57461], [101.83257, 21.61562], [101.74555, 21.72852], [101.7791, 21.83019], [101.62566, 21.96574], [101.57525, 22.13026], [101.60675, 22.13513], [101.53638, 22.24794], [101.56789, 22.28876], [101.61306, 22.27515], [101.68973, 22.46843], [101.7685, 22.50337], [101.86828, 22.38397], [101.90714, 22.38688], [101.91344, 22.44417], [101.98487, 22.42766], [102.03633, 22.46164], [102.1245, 22.43372], [102.14099, 22.40092], [102.16621, 22.43336], [102.26428, 22.41321], [102.25339, 22.4607], [102.41061, 22.64184], [102.38415, 22.67919], [102.42618, 22.69212], [102.46665, 22.77108], [102.51802, 22.77969], [102.57095, 22.7036], [102.60675, 22.73376], [102.8636, 22.60735], [102.9321, 22.48659], [103.0722, 22.44775], [103.07843, 22.50097], [103.17961, 22.55705], [103.15782, 22.59873], [103.18895, 22.64471], [103.28079, 22.68063], [103.32282, 22.8127], [103.43179, 22.75816], [103.43646, 22.70648], [103.52675, 22.59155], [103.57812, 22.65764], [103.56255, 22.69499], [103.64506, 22.79979], [103.87904, 22.56683], [103.93286, 22.52703], [103.94513, 22.52553], [103.95191, 22.5134], [103.96352, 22.50584], [103.96783, 22.51173], [103.97384, 22.50634], [103.99247, 22.51958], [104.01088, 22.51823], [104.03734, 22.72945], [104.11384, 22.80363], [104.27084, 22.8457], [104.25683, 22.76534], [104.35593, 22.69353], [104.47225, 22.75813], [104.58122, 22.85571], [104.60457, 22.81841], [104.65283, 22.83419], [104.72755, 22.81984], [104.77114, 22.90017], [104.84942, 22.93631], [104.86765, 22.95178], [104.8334, 23.01484], [104.79478, 23.12934], [104.87382, 23.12854], [104.87992, 23.17141], [104.91435, 23.18666], [104.9486, 23.17235], [104.96532, 23.20463], [104.98712, 23.19176], [105.07002, 23.26248], [105.11672, 23.25247], [105.17276, 23.28679], [105.22569, 23.27249], [105.32376, 23.39684], [105.40782, 23.28107], [105.42805, 23.30824], [105.49966, 23.20669], [105.56037, 23.16806], [105.57594, 23.075], [105.72382, 23.06641], [105.8726, 22.92756], [105.90119, 22.94168], [105.99568, 22.94178], [106.00179, 22.99049], [106.19705, 22.98475], [106.27022, 22.87722], [106.34961, 22.86718], [106.49749, 22.91164], [106.51306, 22.94891], [106.55976, 22.92311], [106.60179, 22.92884], [106.6516, 22.86862], [106.6734, 22.89587], [106.71387, 22.88296], [106.71128, 22.85982], [106.78422, 22.81532], [106.81271, 22.8226], [106.83685, 22.8098], [106.82404, 22.7881], [106.76293, 22.73491], [106.72321, 22.63606], [106.71698, 22.58432], [106.65316, 22.5757], [106.61269, 22.60301], [106.58395, 22.474], [106.55665, 22.46498], [106.57221, 22.37], [106.55976, 22.34841], [106.6516, 22.33977], [106.69986, 22.22309], [106.67495, 22.1885], [106.6983, 22.15102], [106.70142, 22.02409], [106.68274, 21.99811], [106.69276, 21.96013], [106.72551, 21.97923], [106.74345, 22.00965], [106.81038, 21.97934], [106.9178, 21.97357], [106.92714, 21.93459], [106.97228, 21.92592], [106.99252, 21.95191], [107.05634, 21.92303], [107.06101, 21.88982], [107.00964, 21.85948], [107.02615, 21.81981], [107.10771, 21.79879], [107.20734, 21.71493], [107.24625, 21.7077], [107.29296, 21.74674], [107.35834, 21.6672], [107.35989, 21.60063], [107.38636, 21.59774], [107.41593, 21.64839], [107.47197, 21.6672], [107.49532, 21.62958], [107.49065, 21.59774], [107.54047, 21.5934], [107.56537, 21.61945], [107.66967, 21.60787], [107.80355, 21.66141], [107.86114, 21.65128], [107.90006, 21.5905], [107.92652, 21.58906], [107.95232, 21.5388], [107.96774, 21.53601], [107.97074, 21.54072], [107.97383, 21.53961], [107.97932, 21.54503], [108.02926, 21.54997], [108.0569, 21.53604], [108.10003, 21.47338], [108.00365, 17.98159], [111.60491, 13.57105], [118.41371, 24.06775], [118.11703, 24.39734], [118.28244, 24.51231], [118.35291, 24.51645], [118.42453, 24.54644], [118.6333, 24.46259], [119.42295, 25.0886], [119.98511, 25.37624], [119.78816, 26.2348], [120.0693, 26.3959], [120.5128, 26.536], [121.03532, 26.8787], [123.5458, 31.01942], [122.29378, 31.76513], [122.80525, 33.30571], [123.85601, 37.49093], [123.90497, 38.79949], [124.17532, 39.8232], [124.23201, 39.9248], [124.35029, 39.95639], [124.37089, 40.03004], [124.3322, 40.05573], [124.38556, 40.11047], [124.40719, 40.13655], [124.86913, 40.45387], [125.71172, 40.85223], [125.76869, 40.87908], [126.00335, 40.92835], [126.242, 41.15454], [126.53189, 41.35206], [126.60631, 41.65565], [126.90729, 41.79955], [127.17841, 41.59714], [127.29712, 41.49473], [127.92943, 41.44291], [128.02633, 41.42103], [128.03311, 41.39232], [128.12967, 41.37931], [128.18546, 41.41279], [128.20061, 41.40895], [128.30716, 41.60322], [128.15119, 41.74568], [128.04487, 42.01769], [128.94007, 42.03537], [128.96068, 42.06657], [129.15178, 42.17224], [129.22285, 42.26491], [129.22423, 42.3553], [129.28541, 42.41574], [129.42882, 42.44702], [129.54701, 42.37254], [129.60482, 42.44461], [129.72541, 42.43739], [129.75294, 42.59409], [129.77183, 42.69435], [129.7835, 42.76521], [129.80719, 42.79218], [129.83277, 42.86746], [129.85261, 42.96494], [129.8865, 43.00395], [129.95082, 43.01051], [129.96409, 42.97306], [130.12957, 42.98361], [130.09764, 42.91425], [130.26095, 42.9027], [130.23068, 42.80125], [130.2385, 42.71127], [130.41826, 42.6011], [130.44361, 42.54849], [130.50123, 42.61636], [130.55143, 42.52158], [130.62107, 42.58413], [130.56576, 42.68925], [130.40213, 42.70788], [130.44361, 42.76205], [130.66524, 42.84753], [131.02438, 42.86518], [131.02668, 42.91246], [131.135, 42.94114], [131.10274, 43.04734], [131.20414, 43.13654], [131.19031, 43.21385], [131.30324, 43.39498], [131.29402, 43.46695], [131.19492, 43.53047], [131.21105, 43.82383], [131.26176, 43.94011], [131.23583, 43.96085], [131.25484, 44.03131], [131.30365, 44.04262], [131.1108, 44.70266], [130.95639, 44.85154], [131.48415, 44.99513], [131.68466, 45.12374], [131.66852, 45.2196], [131.76532, 45.22609], [131.86903, 45.33636], [131.99417, 45.2567], [132.83978, 45.05916], [132.96373, 45.0212], [133.12293, 45.1332], [133.09279, 45.25693], [133.19419, 45.51913], [133.41083, 45.57723], [133.48457, 45.86203], [133.60442, 45.90053], [133.67569, 45.9759], [133.72695, 46.05576], [133.68047, 46.14697], [133.88097, 46.25066], [133.91496, 46.4274], [133.84104, 46.46681], [134.03538, 46.75668], [134.20016, 47.33458], [134.50898, 47.4812], [134.7671, 47.72051], [134.55508, 47.98651], [134.67098, 48.1564], [134.75328, 48.36763], [134.49516, 48.42884], [132.66989, 47.96491], [132.57309, 47.71741], [131.90448, 47.68011], [131.2635, 47.73325], [131.09871, 47.6852], [130.95985, 47.6957], [130.90915, 47.90623], [130.65103, 48.10052], [130.84462, 48.30942], [130.52147, 48.61745], [130.66946, 48.88251], [130.43232, 48.90844], [130.2355, 48.86741], [129.85416, 49.11067], [129.67598, 49.29596], [129.50685, 49.42398], [129.40398, 49.44194], [129.35317, 49.3481], [129.23232, 49.40353], [129.11153, 49.36813], [128.72896, 49.58676], [127.83476, 49.5748], [127.53516, 49.84306], [127.49299, 50.01251], [127.60515, 50.23503], [127.37384, 50.28393], [127.36009, 50.43787], [127.28765, 50.46585], [127.36335, 50.58306], [127.28165, 50.72075], [127.14586, 50.91152], [126.93135, 51.0841], [126.90369, 51.3238], [126.68349, 51.70607], [126.44606, 51.98254], [126.558, 52.13738], [125.6131, 53.07229]], [[113.56865, 22.20973], [113.57123, 22.20416], [113.60504, 22.20464], [113.63011, 22.10782], [113.57191, 22.07696], [113.54839, 22.10909], [113.54942, 22.14519], [113.54093, 22.15497], [113.52659, 22.18271], [113.53552, 22.20607], [113.53301, 22.21235], [113.53591, 22.21369], [113.54093, 22.21314], [113.54333, 22.21688], [113.5508, 22.21672], [113.56865, 22.20973]], [[114.50148, 22.15017], [113.92195, 22.13873], [113.83338, 22.1826], [113.81621, 22.2163], [113.86771, 22.42972], [114.03113, 22.5065], [114.05438, 22.5026], [114.05729, 22.51104], [114.06272, 22.51617], [114.07267, 22.51855], [114.07817, 22.52997], [114.08606, 22.53276], [114.09048, 22.53716], [114.09692, 22.53435], [114.1034, 22.5352], [114.11181, 22.52878], [114.11656, 22.53415], [114.12665, 22.54003], [114.13823, 22.54319], [114.1482, 22.54091], [114.15123, 22.55163], [114.1597, 22.56041], [114.17247, 22.55944], [114.18338, 22.55444], [114.20655, 22.55706], [114.22185, 22.55343], [114.22888, 22.5436], [114.25154, 22.55977], [114.44998, 22.55977], [114.50148, 22.15017]]]] } },
20395     { type: "Feature", properties: { wikidata: "Q22890", nameEn: "Ireland", level: "sharedLandform" }, geometry: null },
20396     { type: "Feature", properties: { wikidata: "Q23666", nameEn: "Great Britain", country: "GB", level: "sharedLandform" }, geometry: null },
20397     { type: "Feature", properties: { wikidata: "Q23681", nameEn: "Northern Cyprus", groups: ["Q644636", "145", "142"], driveSide: "left", callingCodes: ["90 392"] }, geometry: { type: "MultiPolygon", coordinates: [[[[33.67678, 35.03866], [33.67742, 35.05963], [33.68474, 35.06602], [33.69095, 35.06237], [33.70861, 35.07644], [33.7161, 35.07279], [33.70209, 35.04882], [33.71482, 35.03722], [33.73824, 35.05321], [33.76106, 35.04253], [33.78581, 35.05104], [33.82067, 35.07826], [33.84168, 35.06823], [33.8541, 35.07201], [33.87479, 35.08881], [33.87097, 35.09389], [33.87622, 35.10457], [33.87224, 35.12293], [33.88561, 35.12449], [33.88943, 35.12007], [33.88737, 35.11408], [33.89853, 35.11377], [33.91789, 35.08688], [33.91299, 35.07579], [33.90247, 35.07686], [33.89485, 35.06873], [33.88367, 35.07877], [33.85261, 35.0574], [33.8355, 35.05777], [33.82051, 35.0667], [33.8012, 35.04786], [33.81524, 35.04192], [33.83055, 35.02865], [33.82875, 35.01685], [33.84045, 35.00616], [33.85216, 35.00579], [33.85891, 35.001], [33.85621, 34.98956], [33.83505, 34.98108], [33.84811, 34.97075], [33.86432, 34.97592], [33.90075, 34.96623], [33.98684, 34.76642], [35.48515, 34.70851], [35.51152, 36.10954], [32.82353, 35.70297], [32.46489, 35.48584], [32.60361, 35.16647], [32.64864, 35.19967], [32.70947, 35.18328], [32.70779, 35.14127], [32.85733, 35.07742], [32.86406, 35.1043], [32.94471, 35.09422], [33.01192, 35.15639], [33.08249, 35.17319], [33.11105, 35.15639], [33.15138, 35.19504], [33.27068, 35.16815], [33.3072, 35.16816], [33.31955, 35.18096], [33.35056, 35.18328], [33.34964, 35.17803], [33.35596, 35.17942], [33.35612, 35.17402], [33.36569, 35.17479], [33.3717, 35.1788], [33.37248, 35.18698], [33.38575, 35.2018], [33.4076, 35.20062], [33.41675, 35.16325], [33.46813, 35.10564], [33.48136, 35.0636], [33.47825, 35.04103], [33.45178, 35.02078], [33.45256, 35.00288], [33.47666, 35.00701], [33.48915, 35.06594], [33.53975, 35.08151], [33.57478, 35.06049], [33.567, 35.04803], [33.59658, 35.03635], [33.61215, 35.0527], [33.63765, 35.03869], [33.67678, 35.03866]]]] } },
20398     { type: "Feature", properties: { wikidata: "Q25231", nameEn: "Svalbard", aliases: ["NO-21"], country: "NO", groups: ["SJ", "154", "150", "UN"], level: "subterritory", callingCodes: ["47 79"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-7.49892, 77.24208], [32.07813, 72.01005], [36.85549, 84.09565], [-7.49892, 77.24208]]]] } },
20399     { type: "Feature", properties: { wikidata: "Q25263", nameEn: "Azores", aliases: ["PT-20"], country: "PT", groups: ["Q3320166", "Q2914565", "Q105472", "EU", "039", "150", "UN"], callingCodes: ["351"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-23.12984, 40.26428], [-36.43765, 41.39418], [-22.54767, 33.34416], [-23.12984, 40.26428]]]] } },
20400     { type: "Feature", properties: { wikidata: "Q25359", nameEn: "Navassa Island", aliases: ["UM-76"], country: "US", groups: ["UM", "Q1352230", "029", "003", "419", "019", "UN"], level: "subterritory", roadSpeedUnit: "mph", roadHeightUnit: "ft" }, geometry: { type: "MultiPolygon", coordinates: [[[[-74.7289, 18.71009], [-75.71816, 18.46438], [-74.76465, 18.06252], [-74.7289, 18.71009]]]] } },
20401     { type: "Feature", properties: { wikidata: "Q25396", nameEn: "Bonaire", aliases: ["BQ-BO", "NL-BQ1"], country: "NL", groups: ["Q1451600", "BQ", "029", "003", "419", "019", "UN"], level: "subterritory", callingCodes: ["599 7"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-67.89186, 12.4116], [-68.90012, 12.62309], [-68.33524, 11.78151], [-68.01417, 11.77722], [-67.89186, 12.4116]]]] } },
20402     { type: "Feature", properties: { wikidata: "Q25528", nameEn: "Saba", aliases: ["BQ-SA", "NL-BQ2"], country: "NL", groups: ["Q1451600", "BQ", "029", "003", "419", "019", "UN"], level: "subterritory", callingCodes: ["599 4"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-63.07669, 17.79659], [-63.81314, 17.95045], [-63.22932, 17.32592], [-63.07669, 17.79659]]]] } },
20403     { type: "Feature", properties: { wikidata: "Q26180", nameEn: "Sint Eustatius", aliases: ["BQ-SE", "NL-BQ3"], country: "NL", groups: ["Q1451600", "BQ", "029", "003", "419", "019", "UN"], level: "subterritory", callingCodes: ["599 3"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-63.07669, 17.79659], [-63.34999, 16.94218], [-62.76692, 17.64353], [-63.07669, 17.79659]]]] } },
20404     { type: "Feature", properties: { wikidata: "Q26253", nameEn: "Madeira", aliases: ["PT-30"], country: "PT", groups: ["Q3320166", "Q2914565", "Q105472", "EU", "039", "150", "UN"], callingCodes: ["351"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-19.30302, 33.65304], [-16.04789, 29.65076], [-11.68307, 33.12333], [-19.30302, 33.65304]]]] } },
20405     { type: "Feature", properties: { wikidata: "Q26927", nameEn: "Lakshadweep", aliases: ["IN-LD"], country: "IN", groups: ["034", "142", "UN"], driveSide: "left", callingCodes: ["91"] }, geometry: { type: "MultiPolygon", coordinates: [[[[67.64074, 11.57295], [76.59015, 5.591], [72.67494, 13.58102], [67.64074, 11.57295]]]] } },
20406     { type: "Feature", properties: { wikidata: "Q27329", nameEn: "Asian Russia", country: "RU", groups: ["142", "UN"], callingCodes: ["7"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-179.99933, 64.74703], [-172.76104, 63.77445], [-169.03888, 65.48473], [-168.95635, 65.98512], [-168.25765, 71.99091], [-179.9843, 71.90735], [-179.99933, 64.74703]]], [[[59.99809, 51.98263], [60.19925, 51.99173], [60.48915, 52.15175], [60.72581, 52.15538], [60.78201, 52.22067], [61.05417, 52.35096], [60.98021, 52.50068], [60.84709, 52.52228], [60.84118, 52.63912], [60.71693, 52.66245], [60.71989, 52.75923], [61.05842, 52.92217], [61.23462, 53.03227], [62.0422, 52.96105], [62.12799, 52.99133], [62.14574, 53.09626], [61.19024, 53.30536], [61.14291, 53.41481], [61.29082, 53.50992], [61.37957, 53.45887], [61.57185, 53.50112], [61.55706, 53.57144], [60.90626, 53.62937], [61.22574, 53.80268], [61.14283, 53.90063], [60.99796, 53.93699], [61.26863, 53.92797], [61.3706, 54.08464], [61.47603, 54.08048], [61.56941, 53.95703], [61.65318, 54.02445], [62.03913, 53.94768], [62.00966, 54.04134], [62.38535, 54.03961], [62.45931, 53.90737], [62.56876, 53.94047], [62.58651, 54.05871], [63.80604, 54.27079], [63.91224, 54.20013], [64.02715, 54.22679], [63.97686, 54.29763], [64.97216, 54.4212], [65.11033, 54.33028], [65.24663, 54.35721], [65.20174, 54.55216], [68.21308, 54.98645], [68.26661, 55.09226], [68.19206, 55.18823], [68.90865, 55.38148], [69.34224, 55.36344], [69.74917, 55.35545], [70.19179, 55.1476], [70.76493, 55.3027], [70.96009, 55.10558], [71.08288, 54.71253], [71.24185, 54.64965], [71.08706, 54.33376], [71.10379, 54.13326], [71.96141, 54.17736], [72.17477, 54.36303], [72.43415, 53.92685], [72.71026, 54.1161], [73.37963, 53.96132], [73.74778, 54.07194], [73.68921, 53.86522], [73.25412, 53.61532], [73.39218, 53.44623], [75.07405, 53.80831], [75.43398, 53.98652], [75.3668, 54.07439], [76.91052, 54.4677], [76.82266, 54.1798], [76.44076, 54.16017], [76.54243, 53.99329], [77.90383, 53.29807], [79.11255, 52.01171], [80.08138, 50.77658], [80.4127, 50.95581], [80.44819, 51.20855], [80.80318, 51.28262], [81.16999, 51.15662], [81.06091, 50.94833], [81.41248, 50.97524], [81.46581, 50.77658], [81.94999, 50.79307], [82.55443, 50.75412], [83.14607, 51.00796], [83.8442, 50.87375], [84.29385, 50.27257], [84.99198, 50.06793], [85.24047, 49.60239], [86.18709, 49.50259], [86.63674, 49.80136], [86.79056, 49.74787], [86.61307, 49.60239], [86.82606, 49.51796], [87.03071, 49.25142], [87.31465, 49.23603], [87.28386, 49.11626], [87.478, 49.07403], [87.48983, 49.13794], [87.81333, 49.17354], [87.98977, 49.18147], [88.15543, 49.30314], [88.17223, 49.46934], [88.42449, 49.48821], [88.82499, 49.44808], [89.70687, 49.72535], [89.59711, 49.90851], [91.86048, 50.73734], [92.07173, 50.69585], [92.44714, 50.78762], [93.01109, 50.79001], [92.99595, 50.63183], [94.30823, 50.57498], [94.39258, 50.22193], [94.49477, 50.17832], [94.6121, 50.04239], [94.97166, 50.04725], [95.02465, 49.96941], [95.74757, 49.97915], [95.80056, 50.04239], [96.97388, 49.88413], [97.24639, 49.74737], [97.56811, 49.84265], [97.56432, 49.92801], [97.76871, 49.99861], [97.85197, 49.91339], [98.29481, 50.33561], [98.31373, 50.4996], [98.06393, 50.61262], [97.9693, 50.78044], [98.01472, 50.86652], [97.83305, 51.00248], [98.05257, 51.46696], [98.22053, 51.46579], [98.33222, 51.71832], [98.74142, 51.8637], [98.87768, 52.14563], [99.27888, 51.96876], [99.75578, 51.90108], [99.89203, 51.74903], [100.61116, 51.73028], [101.39085, 51.45753], [101.5044, 51.50467], [102.14032, 51.35566], [102.32194, 50.67982], [102.71178, 50.38873], [103.70343, 50.13952], [105.32528, 50.4648], [106.05562, 50.40582], [106.07865, 50.33474], [106.47156, 50.31909], [106.49628, 50.32436], [106.51122, 50.34408], [106.58373, 50.34044], [106.80326, 50.30177], [107.00007, 50.1977], [107.1174, 50.04239], [107.36407, 49.97612], [107.96116, 49.93191], [107.95387, 49.66659], [108.27937, 49.53167], [108.53969, 49.32325], [109.18017, 49.34709], [109.51325, 49.22859], [110.24373, 49.16676], [110.39891, 49.25083], [110.64493, 49.1816], [113.02647, 49.60772], [113.20216, 49.83356], [114.325, 50.28098], [114.9703, 50.19254], [115.26068, 49.97367], [115.73602, 49.87688], [116.22402, 50.04477], [116.62502, 49.92919], [116.71193, 49.83813], [117.27597, 49.62544], [117.48208, 49.62324], [117.82343, 49.52696], [118.61623, 49.93809], [119.11003, 50.00276], [119.27996, 50.13348], [119.38598, 50.35162], [119.13553, 50.37412], [120.10963, 51.671], [120.65907, 51.93544], [120.77337, 52.20805], [120.61346, 52.32447], [120.71673, 52.54099], [120.46454, 52.63811], [120.04049, 52.58773], [120.0451, 52.7359], [120.85633, 53.28499], [121.39213, 53.31888], [122.35063, 53.49565], [122.85966, 53.47395], [123.26989, 53.54843], [123.86158, 53.49391], [124.46078, 53.21881], [125.17522, 53.20225], [125.6131, 53.07229], [126.558, 52.13738], [126.44606, 51.98254], [126.68349, 51.70607], [126.90369, 51.3238], [126.93135, 51.0841], [127.14586, 50.91152], [127.28165, 50.72075], [127.36335, 50.58306], [127.28765, 50.46585], [127.36009, 50.43787], [127.37384, 50.28393], [127.60515, 50.23503], [127.49299, 50.01251], [127.53516, 49.84306], [127.83476, 49.5748], [128.72896, 49.58676], [129.11153, 49.36813], [129.23232, 49.40353], [129.35317, 49.3481], [129.40398, 49.44194], [129.50685, 49.42398], [129.67598, 49.29596], [129.85416, 49.11067], [130.2355, 48.86741], [130.43232, 48.90844], [130.66946, 48.88251], [130.52147, 48.61745], [130.84462, 48.30942], [130.65103, 48.10052], [130.90915, 47.90623], [130.95985, 47.6957], [131.09871, 47.6852], [131.2635, 47.73325], [131.90448, 47.68011], [132.57309, 47.71741], [132.66989, 47.96491], [134.49516, 48.42884], [134.75328, 48.36763], [134.67098, 48.1564], [134.55508, 47.98651], [134.7671, 47.72051], [134.50898, 47.4812], [134.20016, 47.33458], [134.03538, 46.75668], [133.84104, 46.46681], [133.91496, 46.4274], [133.88097, 46.25066], [133.68047, 46.14697], [133.72695, 46.05576], [133.67569, 45.9759], [133.60442, 45.90053], [133.48457, 45.86203], [133.41083, 45.57723], [133.19419, 45.51913], [133.09279, 45.25693], [133.12293, 45.1332], [132.96373, 45.0212], [132.83978, 45.05916], [131.99417, 45.2567], [131.86903, 45.33636], [131.76532, 45.22609], [131.66852, 45.2196], [131.68466, 45.12374], [131.48415, 44.99513], [130.95639, 44.85154], [131.1108, 44.70266], [131.30365, 44.04262], [131.25484, 44.03131], [131.23583, 43.96085], [131.26176, 43.94011], [131.21105, 43.82383], [131.19492, 43.53047], [131.29402, 43.46695], [131.30324, 43.39498], [131.19031, 43.21385], [131.20414, 43.13654], [131.10274, 43.04734], [131.135, 42.94114], [131.02668, 42.91246], [131.02438, 42.86518], [130.66524, 42.84753], [130.44361, 42.76205], [130.40213, 42.70788], [130.56576, 42.68925], [130.62107, 42.58413], [130.55143, 42.52158], [130.56835, 42.43281], [130.60805, 42.4317], [130.64181, 42.41422], [130.66367, 42.38024], [130.65022, 42.32281], [131.95041, 41.5445], [140.9182, 45.92937], [145.82343, 44.571], [145.23667, 43.76813], [153.94307, 38.42848], [180, 62.52334], [180, 71.53642], [155.31937, 81.93282], [76.13964, 83.37843], [64.18965, 69.94255], [66.1708, 67.61252], [61.98014, 65.72191], [60.74386, 64.95767], [59.63945, 64.78384], [59.80579, 64.13948], [59.24834, 63.01859], [59.61398, 62.44915], [59.36223, 61.3882], [59.50685, 60.91162], [58.3853, 59.487], [59.15636, 59.14682], [59.40376, 58.45822], [58.71104, 58.07475], [58.81412, 57.71602], [58.13789, 57.68097], [58.07604, 57.08308], [57.28024, 56.87898], [57.51527, 56.08729], [59.28419, 56.15739], [59.49035, 55.60486], [58.81825, 55.03378], [57.25137, 55.26262], [57.14829, 54.84204], [57.95234, 54.39672], [59.95217, 54.85853], [59.70487, 54.14846], [58.94336, 53.953], [58.79644, 52.43392], [59.22409, 52.28437], [59.25033, 52.46803], [60.17516, 52.39457], [60.17253, 52.25814], [59.91279, 52.06924], [59.99809, 51.98263]]]] } },
20407     { type: "Feature", properties: { wikidata: "Q34366", nameEn: "Tasmania", aliases: ["AU-TAS"], country: "AU", groups: ["053", "009", "UN"], driveSide: "left", callingCodes: ["61"] }, geometry: { type: "MultiPolygon", coordinates: [[[[123.64533, -39.13605], [159.69067, -56.28945], [159.74028, -39.1978], [123.64533, -39.13605]]]] } },
20408     { type: "Feature", properties: { wikidata: "Q34497", nameEn: "Saint Helena", aliases: ["SH-HL"], country: "GB", groups: ["SH", "BOTS", "011", "202", "002", "UN"], level: "subterritory", driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["290"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-8.3824, -13.9131], [-6.17428, -19.07236], [-3.29308, -15.22647], [-8.3824, -13.9131]]]] } },
20409     { type: "Feature", properties: { wikidata: "Q35657", nameEn: "US States", country: "US", level: "subcountryGroup" }, geometry: null },
20410     { type: "Feature", properties: { wikidata: "Q36117", nameEn: "Borneo", level: "sharedLandform" }, geometry: null },
20411     { type: "Feature", properties: { wikidata: "Q36678", nameEn: "West Bank", country: "PS", groups: ["145", "142"], callingCodes: ["970"] }, geometry: { type: "MultiPolygon", coordinates: [[[[35.47672, 31.49578], [35.55941, 31.76535], [35.52758, 31.9131], [35.54375, 31.96587], [35.52012, 32.04076], [35.57111, 32.21877], [35.55807, 32.38674], [35.42078, 32.41562], [35.41048, 32.43706], [35.41598, 32.45593], [35.42034, 32.46009], [35.40224, 32.50136], [35.35212, 32.52047], [35.30685, 32.51024], [35.29306, 32.50947], [35.25049, 32.52453], [35.2244, 32.55289], [35.15937, 32.50466], [35.10882, 32.4757], [35.10024, 32.47856], [35.09236, 32.47614], [35.08564, 32.46948], [35.07059, 32.4585], [35.05423, 32.41754], [35.05311, 32.4024], [35.0421, 32.38242], [35.05142, 32.3667], [35.04243, 32.35008], [35.01772, 32.33863], [35.01119, 32.28684], [35.02939, 32.2671], [35.01841, 32.23981], [34.98885, 32.20758], [34.95703, 32.19522], [34.96009, 32.17503], [34.99039, 32.14626], [34.98507, 32.12606], [34.99437, 32.10962], [34.9863, 32.09551], [35.00261, 32.027], [34.98682, 31.96935], [35.00124, 31.93264], [35.03489, 31.92448], [35.03978, 31.89276], [35.03489, 31.85919], [34.99712, 31.85569], [34.9724, 31.83352], [35.01978, 31.82944], [35.05617, 31.85685], [35.07677, 31.85627], [35.14174, 31.81325], [35.18603, 31.80901], [35.18169, 31.82542], [35.19461, 31.82687], [35.21469, 31.81835], [35.216, 31.83894], [35.21128, 31.863], [35.20381, 31.86716], [35.20673, 31.88151], [35.20791, 31.8821], [35.20945, 31.8815], [35.21016, 31.88237], [35.21276, 31.88153], [35.2136, 31.88241], [35.22014, 31.88264], [35.22294, 31.87889], [35.22567, 31.86745], [35.22817, 31.8638], [35.2249, 31.85433], [35.2304, 31.84222], [35.24816, 31.8458], [35.25753, 31.8387], [35.251, 31.83085], [35.26404, 31.82567], [35.25573, 31.81362], [35.26058, 31.79064], [35.25225, 31.7678], [35.26319, 31.74846], [35.25182, 31.73945], [35.24981, 31.72543], [35.2438, 31.7201], [35.24315, 31.71244], [35.23972, 31.70896], [35.22392, 31.71899], [35.21937, 31.71578], [35.20538, 31.72388], [35.18023, 31.72067], [35.16478, 31.73242], [35.15474, 31.73352], [35.15119, 31.73634], [35.13931, 31.73012], [35.12933, 31.7325], [35.11895, 31.71454], [35.10782, 31.71594], [35.08226, 31.69107], [35.00879, 31.65426], [34.95249, 31.59813], [34.9415, 31.55601], [34.94356, 31.50743], [34.93258, 31.47816], [34.89756, 31.43891], [34.87833, 31.39321], [34.88932, 31.37093], [34.92571, 31.34337], [35.02459, 31.35979], [35.13033, 31.3551], [35.22921, 31.37445], [35.39675, 31.49572], [35.47672, 31.49578]]]] } },
20412     { type: "Feature", properties: { wikidata: "Q37362", nameEn: "Akrotiri and Dhekelia", aliases: ["SBA"], country: "GB" }, geometry: null },
20413     { type: "Feature", properties: { wikidata: "Q38095", nameEn: "Gal\xE1pagos Islands", aliases: ["EC-W"], country: "EC", groups: ["005", "419", "019", "UN"], callingCodes: ["593"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-93.12365, 2.64343], [-92.46744, -2.52874], [-87.07749, -0.8849], [-93.12365, 2.64343]]]] } },
20414     { type: "Feature", properties: { wikidata: "Q39760", nameEn: "Gaza Strip", country: "PS", groups: ["145", "142"], callingCodes: ["970"] }, geometry: { type: "MultiPolygon", coordinates: [[[[34.052, 31.46619], [34.21853, 31.32363], [34.23572, 31.2966], [34.24012, 31.29591], [34.26742, 31.21998], [34.29417, 31.24194], [34.36523, 31.28963], [34.37381, 31.30598], [34.36505, 31.36404], [34.40077, 31.40926], [34.48892, 31.48365], [34.56797, 31.54197], [34.48681, 31.59711], [34.29262, 31.70393], [34.052, 31.46619]]]] } },
20415     { type: "Feature", properties: { wikidata: "Q40888", nameEn: "Andaman and Nicobar Islands", aliases: ["IN-AN"], country: "IN", groups: ["034", "142", "UN"], driveSide: "left", callingCodes: ["91"] }, geometry: { type: "MultiPolygon", coordinates: [[[[94.42132, 5.96581], [94.6371, 13.81803], [86.7822, 13.41052], [94.42132, 5.96581]]]] } },
20416     { type: "Feature", properties: { wikidata: "Q41684", nameEn: "Stewart Island", country: "NZ", groups: ["053", "009", "UN"], driveSide: "left", callingCodes: ["64"] }, geometry: { type: "MultiPolygon", coordinates: [[[[166.59185, -47.61313], [169.70504, -47.56021], [167.52103, -46.41337], [166.59185, -47.61313]]]] } },
20417     { type: "Feature", properties: { wikidata: "Q43296", nameEn: "Wake Island", aliases: ["WK", "WAK", "WKUM", "872", "UM-79"], country: "US", groups: ["UM", "Q1352230", "057", "009", "UN"], level: "subterritory", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1"] }, geometry: { type: "MultiPolygon", coordinates: [[[[167.34779, 18.97692], [166.67967, 20.14834], [165.82549, 18.97692], [167.34779, 18.97692]]]] } },
20418     { type: "Feature", properties: { wikidata: "Q46275", nameEn: "New Zealand Subantarctic Islands", country: "NZ", groups: ["Q851132", "053", "009", "UN"], driveSide: "left" }, geometry: { type: "MultiPolygon", coordinates: [[[[164.30551, -47.88072], [161.96603, -56.07661], [179.49541, -50.04657], [179.49541, -47.2902], [169.91032, -47.66283], [164.30551, -47.88072]]]] } },
20419     { type: "Feature", properties: { wikidata: "Q46395", nameEn: "British Overseas Territories", aliases: ["BOTS", "UKOTS"], country: "GB", level: "subcountryGroup" }, geometry: null },
20420     { type: "Feature", properties: { wikidata: "Q46772", nameEn: "Kerguelen Islands", country: "FR", groups: ["EU", "TF", "Q1451600", "014", "202", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[61.9216, -49.39746], [70.67507, -51.14192], [74.25129, -45.45074], [61.9216, -49.39746]]]] } },
20421     { type: "Feature", properties: { wikidata: "Q46879", nameEn: "Baker Island", aliases: ["UM-81"], country: "US", groups: ["UM", "Q1352230", "061", "009", "UN"], level: "subterritory", roadSpeedUnit: "mph", roadHeightUnit: "ft" }, geometry: { type: "MultiPolygon", coordinates: [[[[-175.33482, -1.40631], [-175.31323, 0.5442], [-177.91421, 0.39582], [-175.33482, -1.40631]]]] } },
20422     { type: "Feature", properties: { wikidata: "Q47863", nameEn: "Midway Atoll", aliases: ["MI", "MID", "MIUM", "488", "UM-71"], country: "US", groups: ["UM", "Q1352230", "061", "009", "UN"], level: "subterritory", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-176.29741, 29.09786], [-177.77531, 29.29793], [-177.5224, 27.7635], [-176.29741, 29.09786]]]] } },
20423     { type: "Feature", properties: { wikidata: "Q62218", nameEn: "Jarvis Island", aliases: ["UM-86"], country: "US", groups: ["UM", "Q1352230", "061", "009", "UN"], level: "subterritory", roadSpeedUnit: "mph", roadHeightUnit: "ft" }, geometry: { type: "MultiPolygon", coordinates: [[[[-160.42921, -1.4364], [-159.12443, 0.19975], [-160.38779, 0.30331], [-160.42921, -1.4364]]]] } },
20424     { type: "Feature", properties: { wikidata: "Q105472", nameEn: "Macaronesia", level: "sharedLandform" }, geometry: null },
20425     { type: "Feature", properties: { wikidata: "Q114935", nameEn: "Kermadec Islands", country: "NZ", groups: ["Q851132", "053", "009", "UN"], driveSide: "left", callingCodes: ["64"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-174.40891, -29.09438], [-180, -24.21376], [-179.96512, -35.00791], [-174.40891, -29.09438]]]] } },
20426     { type: "Feature", properties: { wikidata: "Q115459", nameEn: "Chatham Islands", aliases: ["NZ-CIT"], country: "NZ", groups: ["Q851132", "053", "009", "UN"], driveSide: "left", callingCodes: ["64"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-179.93224, -45.18423], [-172.47015, -45.17912], [-176.30998, -41.38382], [-179.93224, -45.18423]]]] } },
20427     { type: "Feature", properties: { wikidata: "Q118863", nameEn: "North Island", country: "NZ", groups: ["053", "009", "UN"], driveSide: "left", callingCodes: ["64"] }, geometry: { type: "MultiPolygon", coordinates: [[[[179.49541, -47.2902], [179.49541, -36.79303], [174.17679, -32.62487], [170.27492, -36.38133], [174.58663, -40.80446], [174.46634, -41.55028], [179.49541, -47.2902]]]] } },
20428     { type: "Feature", properties: { wikidata: "Q120755", nameEn: "South Island", country: "NZ", groups: ["053", "009", "UN"], driveSide: "left", callingCodes: ["64"] }, geometry: { type: "MultiPolygon", coordinates: [[[[169.70504, -47.56021], [179.49541, -47.2902], [174.46634, -41.55028], [174.58663, -40.80446], [170.27492, -36.38133], [166.56976, -39.94841], [164.8365, -46.0205], [167.52103, -46.41337], [169.70504, -47.56021]]]] } },
20429     { type: "Feature", properties: { wikidata: "Q123076", nameEn: "Palmyra Atoll", aliases: ["UM-95"], country: "US", groups: ["UM", "Q1352230", "061", "009", "UN"], level: "subterritory", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-161.06795, 5.2462], [-161.0731, 7.1291], [-163.24478, 5.24198], [-161.06795, 5.2462]]]] } },
20430     { type: "Feature", properties: { wikidata: "Q130574", nameEn: "Chafarinas Islands", country: "ES", groups: ["EU", "Q191011", "015", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[-2.40316, 35.16893], [-2.43262, 35.20652], [-2.45965, 35.16527], [-2.40316, 35.16893]]]] } },
20431     { type: "Feature", properties: { wikidata: "Q130895", nameEn: "Kingman Reef", aliases: ["UM-89"], country: "US", groups: ["UM", "Q1352230", "061", "009", "UN"], level: "subterritory", roadSpeedUnit: "mph", roadHeightUnit: "ft" }, geometry: { type: "MultiPolygon", coordinates: [[[[-161.0731, 7.1291], [-163.16627, 7.15036], [-163.24478, 5.24198], [-161.0731, 7.1291]]]] } },
20432     { type: "Feature", properties: { wikidata: "Q131008", nameEn: "Johnston Atoll", aliases: ["JT", "JTN", "JTUM", "396", "UM-67"], country: "US", groups: ["UM", "Q1352230", "061", "009", "UN"], level: "subterritory", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-170.65691, 16.57199], [-168.87689, 16.01159], [-169.2329, 17.4933], [-170.65691, 16.57199]]]] } },
20433     { type: "Feature", properties: { wikidata: "Q131305", nameEn: "Howland Island", aliases: ["UM-84"], country: "US", groups: ["UM", "Q1352230", "061", "009", "UN"], level: "subterritory", roadSpeedUnit: "mph", roadHeightUnit: "ft" }, geometry: { type: "MultiPolygon", coordinates: [[[[-177.91421, 0.39582], [-175.31323, 0.5442], [-176.74464, 2.28109], [-177.91421, 0.39582]]]] } },
20434     { type: "Feature", properties: { wikidata: "Q133888", nameEn: "Ashmore and Cartier Islands", country: "AU", groups: ["053", "009", "UN"], driveSide: "left", callingCodes: ["61"] }, geometry: { type: "MultiPolygon", coordinates: [[[[123.7463, -11.1783], [120.6877, -13.59408], [125.29076, -12.33139], [123.7463, -11.1783]]]] } },
20435     { type: "Feature", properties: { wikidata: "Q153732", nameEn: "Mariana Islands", level: "sharedLandform" }, geometry: null },
20436     { type: "Feature", properties: { wikidata: "Q172216", nameEn: "Coral Sea Islands", country: "AU", groups: ["053", "009", "UN"], driveSide: "left", callingCodes: ["61"] }, geometry: { type: "MultiPolygon", coordinates: [[[[159.77159, -28.41151], [156.73836, -14.50464], [145.2855, -9.62524], [147.69992, -17.5933], [152.93188, -20.92631], [154.02855, -24.43238], [159.77159, -28.41151]]]] } },
20437     { type: "Feature", properties: { wikidata: "Q179313", nameEn: "Alderney", country: "GB", groups: ["GG", "830", "Q185086", "154", "150", "UN"], level: "subterritory", driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44 01481"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-2.36485, 49.48223], [-2.09454, 49.46288], [-2.02963, 49.91866], [-2.49556, 49.79012], [-2.36485, 49.48223]]]] } },
20438     { type: "Feature", properties: { wikidata: "Q185086", nameEn: "Crown Dependencies", country: "GB", level: "subcountryGroup" }, geometry: null },
20439     { type: "Feature", properties: { wikidata: "Q190571", nameEn: "Scattered Islands", country: "FR", groups: ["EU", "TF", "Q1451600", "014", "202", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[53.53458, -16.36909], [54.96649, -16.28353], [54.61476, -15.02273], [53.53458, -16.36909]]], [[[38.55969, -20.75596], [40.68027, -23.38889], [43.52893, -15.62903], [38.55969, -20.75596]]], [[[47.03092, -11.05648], [47.11593, -12.08552], [47.96702, -11.46447], [47.03092, -11.05648]]]] } },
20440     { type: "Feature", properties: { wikidata: "Q191011", nameEn: "Plazas de soberan\xEDa", country: "ES" }, geometry: null },
20441     { type: "Feature", properties: { wikidata: "Q191146", nameEn: "Pe\xF1\xF3n de V\xE9lez de la Gomera", country: "ES", groups: ["EU", "Q191011", "015", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[-4.30191, 35.17419], [-4.30112, 35.17058], [-4.29436, 35.17149], [-4.30191, 35.17419]]]] } },
20442     { type: "Feature", properties: { wikidata: "Q201698", nameEn: "Crozet Islands", country: "FR", groups: ["EU", "TF", "Q1451600", "014", "202", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[55.03425, -43.65017], [46.31615, -46.28749], [54.5587, -47.93013], [55.03425, -43.65017]]]] } },
20443     { type: "Feature", properties: { wikidata: "Q578170", nameEn: "Contiguous United States", aliases: ["CONUS"], country: "US", groups: ["Q35657", "021", "003", "019", "UN"], roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-97.13927, 25.96583], [-96.92418, 25.97377], [-80.57035, 24.0565], [-78.91214, 27.76553], [-61.98255, 37.34815], [-67.16117, 44.20069], [-66.93432, 44.82597], [-66.96824, 44.83078], [-66.98249, 44.87071], [-66.96824, 44.90965], [-67.0216, 44.95333], [-67.11316, 45.11176], [-67.15965, 45.16179], [-67.19603, 45.16771], [-67.20349, 45.1722], [-67.22751, 45.16344], [-67.27039, 45.1934], [-67.29748, 45.18173], [-67.29754, 45.14865], [-67.34927, 45.122], [-67.48201, 45.27351], [-67.42394, 45.37969], [-67.50578, 45.48971], [-67.42144, 45.50584], [-67.43815, 45.59162], [-67.6049, 45.60725], [-67.80705, 45.69528], [-67.80653, 45.80022], [-67.75654, 45.82324], [-67.80961, 45.87531], [-67.75196, 45.91814], [-67.78111, 45.9392], [-67.78578, 47.06473], [-67.87993, 47.10377], [-67.94843, 47.1925], [-68.23244, 47.35712], [-68.37458, 47.35851], [-68.38332, 47.28723], [-68.57914, 47.28431], [-68.60575, 47.24659], [-68.70125, 47.24399], [-68.89222, 47.1807], [-69.05039, 47.2456], [-69.05073, 47.30076], [-69.05148, 47.42012], [-69.22119, 47.46461], [-69.99966, 46.69543], [-70.05812, 46.41768], [-70.18547, 46.35357], [-70.29078, 46.18832], [-70.23855, 46.1453], [-70.31025, 45.96424], [-70.24694, 45.95138], [-70.25976, 45.89675], [-70.41523, 45.79497], [-70.38934, 45.73215], [-70.54019, 45.67291], [-70.68516, 45.56964], [-70.72651, 45.49771], [-70.62518, 45.42286], [-70.65383, 45.37592], [-70.78372, 45.43269], [-70.82638, 45.39828], [-70.80236, 45.37444], [-70.84816, 45.22698], [-70.89864, 45.2398], [-70.91169, 45.29849], [-70.95193, 45.33895], [-71.0107, 45.34819], [-71.01866, 45.31573], [-71.08364, 45.30623], [-71.14568, 45.24128], [-71.19723, 45.25438], [-71.22338, 45.25184], [-71.29371, 45.29996], [-71.37133, 45.24624], [-71.44252, 45.2361], [-71.40364, 45.21382], [-71.42778, 45.12624], [-71.48735, 45.07784], [-71.50067, 45.01357], [-73.35025, 45.00942], [-74.32699, 44.99029], [-74.66689, 45.00646], [-74.8447, 45.00606], [-74.99101, 44.98051], [-75.01363, 44.95608], [-75.2193, 44.87821], [-75.41441, 44.76614], [-75.76813, 44.51537], [-75.8217, 44.43176], [-75.95947, 44.34463], [-76.00018, 44.34896], [-76.16285, 44.28262], [-76.1664, 44.23051], [-76.244, 44.19643], [-76.31222, 44.19894], [-76.35324, 44.13493], [-76.43859, 44.09393], [-76.79706, 43.63099], [-79.25796, 43.54052], [-79.06921, 43.26183], [-79.05512, 43.25375], [-79.05544, 43.21224], [-79.05002, 43.20133], [-79.05384, 43.17418], [-79.04652, 43.16396], [-79.0427, 43.13934], [-79.06881, 43.12029], [-79.05671, 43.10937], [-79.07486, 43.07845], [-79.01055, 43.06659], [-78.99941, 43.05612], [-79.02424, 43.01983], [-79.02074, 42.98444], [-78.98126, 42.97], [-78.96312, 42.95509], [-78.93224, 42.95229], [-78.90905, 42.93022], [-78.90712, 42.89733], [-78.93684, 42.82887], [-82.67862, 41.67615], [-83.11184, 41.95671], [-83.14962, 42.04089], [-83.12724, 42.2376], [-83.09837, 42.28877], [-83.07837, 42.30978], [-83.02253, 42.33045], [-82.82964, 42.37355], [-82.64242, 42.55594], [-82.58873, 42.54984], [-82.57583, 42.5718], [-82.51858, 42.611], [-82.51063, 42.66025], [-82.46613, 42.76615], [-82.4826, 42.8068], [-82.45331, 42.93139], [-82.4253, 42.95423], [-82.4146, 42.97626], [-82.42469, 42.992], [-82.48419, 45.30225], [-83.59589, 45.82131], [-83.43746, 45.99749], [-83.57017, 46.105], [-83.83329, 46.12169], [-83.90453, 46.05922], [-83.95399, 46.05634], [-84.1096, 46.23987], [-84.09756, 46.25512], [-84.11615, 46.2681], [-84.11254, 46.32329], [-84.13451, 46.39218], [-84.11196, 46.50248], [-84.12885, 46.53068], [-84.17723, 46.52753], [-84.1945, 46.54061], [-84.2264, 46.53337], [-84.26351, 46.49508], [-84.29893, 46.49127], [-84.34174, 46.50683], [-84.42101, 46.49853], [-84.4481, 46.48972], [-84.47607, 46.45225], [-84.55635, 46.45974], [-84.85871, 46.88881], [-88.37033, 48.30586], [-89.48837, 48.01412], [-89.57972, 48.00023], [-89.77248, 48.02607], [-89.89974, 47.98109], [-90.07418, 48.11043], [-90.56312, 48.09488], [-90.56444, 48.12184], [-90.75045, 48.09143], [-90.87588, 48.2484], [-91.08016, 48.18096], [-91.25025, 48.08522], [-91.43248, 48.04912], [-91.45829, 48.07454], [-91.58025, 48.04339], [-91.55649, 48.10611], [-91.70451, 48.11805], [-91.71231, 48.19875], [-91.86125, 48.21278], [-91.98929, 48.25409], [-92.05339, 48.35958], [-92.14732, 48.36578], [-92.202, 48.35252], [-92.26662, 48.35651], [-92.30939, 48.31251], [-92.27167, 48.25046], [-92.37185, 48.22259], [-92.48147, 48.36609], [-92.45588, 48.40624], [-92.50712, 48.44921], [-92.65606, 48.43471], [-92.71323, 48.46081], [-92.69927, 48.49573], [-92.62747, 48.50278], [-92.6342, 48.54133], [-92.7287, 48.54005], [-92.94973, 48.60866], [-93.25391, 48.64266], [-93.33946, 48.62787], [-93.3712, 48.60599], [-93.39758, 48.60364], [-93.40693, 48.60948], [-93.44472, 48.59147], [-93.47022, 48.54357], [-93.66382, 48.51845], [-93.79267, 48.51631], [-93.80939, 48.52439], [-93.80676, 48.58232], [-93.83288, 48.62745], [-93.85769, 48.63284], [-94.23215, 48.65202], [-94.25104, 48.65729], [-94.25172, 48.68404], [-94.27153, 48.70232], [-94.4174, 48.71049], [-94.44258, 48.69223], [-94.53826, 48.70216], [-94.54885, 48.71543], [-94.58903, 48.71803], [-94.69335, 48.77883], [-94.69669, 48.80918], [-94.70486, 48.82365], [-94.70087, 48.8339], [-94.687, 48.84077], [-94.75017, 49.09931], [-94.77355, 49.11998], [-94.82487, 49.29483], [-94.8159, 49.32299], [-94.85381, 49.32492], [-94.95681, 49.37035], [-94.99532, 49.36579], [-95.01419, 49.35647], [-95.05825, 49.35311], [-95.12903, 49.37056], [-95.15357, 49.384], [-95.15355, 48.9996], [-123.32163, 49.00419], [-123.0093, 48.83186], [-123.0093, 48.76586], [-123.26565, 48.6959], [-123.15614, 48.35395], [-123.50039, 48.21223], [-125.03842, 48.53282], [-133.98258, 38.06389], [-118.48109, 32.5991], [-117.1243, 32.53427], [-115.88053, 32.63624], [-114.71871, 32.71894], [-114.76736, 32.64094], [-114.80584, 32.62028], [-114.81141, 32.55543], [-114.79524, 32.55731], [-114.82011, 32.49609], [-111.07523, 31.33232], [-108.20979, 31.33316], [-108.20899, 31.78534], [-106.529, 31.784], [-106.52266, 31.77509], [-106.51251, 31.76922], [-106.50962, 31.76155], [-106.50111, 31.75714], [-106.48815, 31.74769], [-106.47298, 31.75054], [-106.46726, 31.75998], [-106.45244, 31.76523], [-106.43419, 31.75478], [-106.41773, 31.75196], [-106.38003, 31.73151], [-106.3718, 31.71165], [-106.34864, 31.69663], [-106.33419, 31.66303], [-106.30305, 31.62154], [-106.28084, 31.56173], [-106.24612, 31.54193], [-106.23711, 31.51262], [-106.20346, 31.46305], [-106.09025, 31.40569], [-106.00363, 31.39181], [-104.77674, 30.4236], [-104.5171, 29.64671], [-104.3969, 29.57105], [-104.39363, 29.55396], [-104.37752, 29.54255], [-103.15787, 28.93865], [-102.60596, 29.8192], [-101.47277, 29.7744], [-101.05686, 29.44738], [-101.01128, 29.36947], [-100.96725, 29.3477], [-100.94579, 29.34523], [-100.94056, 29.33371], [-100.87982, 29.296], [-100.79696, 29.24688], [-100.67294, 29.09744], [-100.63689, 28.90812], [-100.59809, 28.88197], [-100.52313, 28.75598], [-100.5075, 28.74066], [-100.51222, 28.70679], [-100.50029, 28.66117], [-99.55409, 27.61314], [-99.51478, 27.55836], [-99.52955, 27.49747], [-99.50208, 27.50021], [-99.48045, 27.49016], [-99.482, 27.47128], [-99.49744, 27.43746], [-99.53573, 27.30926], [-99.08477, 26.39849], [-99.03053, 26.41249], [-99.00546, 26.3925], [-98.35126, 26.15129], [-98.30491, 26.10475], [-98.27075, 26.09457], [-98.24603, 26.07191], [-97.97017, 26.05232], [-97.95155, 26.0625], [-97.66511, 26.01708], [-97.52025, 25.88518], [-97.49828, 25.89877], [-97.45669, 25.86874], [-97.42511, 25.83969], [-97.37332, 25.83854], [-97.35946, 25.92189], [-97.13927, 25.96583]]]] } },
20444     { type: "Feature", properties: { wikidata: "Q620634", nameEn: "Bir Tawil", groups: ["015", "002"], level: "territory" }, geometry: { type: "MultiPolygon", coordinates: [[[[33.17563, 22.00405], [33.57251, 21.72406], [33.99686, 21.76784], [34.0765, 22.00501], [33.17563, 22.00405]]]] } },
20445     { type: "Feature", properties: { wikidata: "Q639185", nameEn: "Peros Banhos", country: "GB", groups: ["IO", "BOTS", "014", "202", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[72.12587, -4.02588], [70.1848, -6.37445], [72.09518, -5.61768], [72.12587, -4.02588]]]] } },
20446     { type: "Feature", properties: { wikidata: "Q644636", nameEn: "Cyprus", level: "sharedLandform" }, geometry: null },
20447     { type: "Feature", properties: { wikidata: "Q851132", nameEn: "New Zealand Outlying Islands", country: "NZ", level: "subcountryGroup" }, geometry: null },
20448     { type: "Feature", properties: { wikidata: "Q875134", nameEn: "European Russia", country: "RU", groups: ["151", "150", "UN"], callingCodes: ["7"] }, geometry: { type: "MultiPolygon", coordinates: [[[[18.57853, 55.25302], [19.64312, 54.45423], [19.8038, 54.44203], [20.63871, 54.3706], [21.41123, 54.32395], [22.79705, 54.36264], [22.7253, 54.41732], [22.70208, 54.45312], [22.67788, 54.532], [22.71293, 54.56454], [22.68021, 54.58486], [22.7522, 54.63525], [22.74225, 54.64339], [22.75467, 54.6483], [22.73397, 54.66604], [22.73631, 54.72952], [22.87317, 54.79492], [22.85083, 54.88711], [22.76422, 54.92521], [22.68723, 54.9811], [22.65451, 54.97037], [22.60075, 55.01863], [22.58907, 55.07085], [22.47688, 55.04408], [22.31562, 55.0655], [22.14267, 55.05345], [22.11697, 55.02131], [22.06087, 55.02935], [22.02582, 55.05078], [22.03984, 55.07888], [21.99543, 55.08691], [21.96505, 55.07353], [21.85521, 55.09493], [21.64954, 55.1791], [21.55605, 55.20311], [21.51095, 55.18507], [21.46766, 55.21115], [21.38446, 55.29348], [21.35465, 55.28427], [21.26425, 55.24456], [20.95181, 55.27994], [20.60454, 55.40986], [18.57853, 55.25302]]], [[[26.32936, 60.00121], [26.90044, 59.63819], [27.85643, 59.58538], [28.04187, 59.47017], [28.19061, 59.39962], [28.21137, 59.38058], [28.20537, 59.36491], [28.19284, 59.35791], [28.14215, 59.28934], [28.00689, 59.28351], [27.90911, 59.24353], [27.87978, 59.18097], [27.80482, 59.1116], [27.74429, 58.98351], [27.36366, 58.78381], [27.55489, 58.39525], [27.48541, 58.22615], [27.62393, 58.09462], [27.67282, 57.92627], [27.81841, 57.89244], [27.78526, 57.83963], [27.56689, 57.83356], [27.50171, 57.78842], [27.52615, 57.72843], [27.3746, 57.66834], [27.40393, 57.62125], [27.31919, 57.57672], [27.34698, 57.52242], [27.56832, 57.53728], [27.52453, 57.42826], [27.86101, 57.29402], [27.66511, 56.83921], [27.86101, 56.88204], [28.04768, 56.59004], [28.13526, 56.57989], [28.10069, 56.524], [28.19057, 56.44637], [28.16599, 56.37806], [28.23716, 56.27588], [28.15217, 56.16964], [28.30571, 56.06035], [28.36888, 56.05805], [28.37987, 56.11399], [28.43068, 56.09407], [28.5529, 56.11705], [28.68337, 56.10173], [28.63668, 56.07262], [28.73418, 55.97131], [29.08299, 56.03427], [29.21717, 55.98971], [29.44692, 55.95978], [29.3604, 55.75862], [29.51283, 55.70294], [29.61446, 55.77716], [29.80672, 55.79569], [29.97975, 55.87281], [30.12136, 55.8358], [30.27776, 55.86819], [30.30987, 55.83592], [30.48257, 55.81066], [30.51346, 55.78982], [30.51037, 55.76568], [30.63344, 55.73079], [30.67464, 55.64176], [30.72957, 55.66268], [30.7845, 55.58514], [30.86003, 55.63169], [30.93419, 55.6185], [30.95204, 55.50667], [30.90123, 55.46621], [30.93144, 55.3914], [30.8257, 55.3313], [30.81946, 55.27931], [30.87944, 55.28223], [30.97369, 55.17134], [31.02071, 55.06167], [31.00972, 55.02783], [30.94243, 55.03964], [30.9081, 55.02232], [30.95754, 54.98609], [30.93144, 54.9585], [30.81759, 54.94064], [30.8264, 54.90062], [30.75165, 54.80699], [30.95479, 54.74346], [30.97127, 54.71967], [31.0262, 54.70698], [30.98226, 54.68872], [30.99187, 54.67046], [31.19339, 54.66947], [31.21399, 54.63113], [31.08543, 54.50361], [31.22945, 54.46585], [31.3177, 54.34067], [31.30791, 54.25315], [31.57002, 54.14535], [31.89599, 54.0837], [31.88744, 54.03653], [31.85019, 53.91801], [31.77028, 53.80015], [31.89137, 53.78099], [32.12621, 53.81586], [32.36663, 53.7166], [32.45717, 53.74039], [32.50112, 53.68594], [32.40499, 53.6656], [32.47777, 53.5548], [32.74968, 53.45597], [32.73257, 53.33494], [32.51725, 53.28431], [32.40773, 53.18856], [32.15368, 53.07594], [31.82373, 53.10042], [31.787, 53.18033], [31.62496, 53.22886], [31.56316, 53.19432], [31.40523, 53.21406], [31.36403, 53.13504], [31.3915, 53.09712], [31.33519, 53.08805], [31.32283, 53.04101], [31.24147, 53.031], [31.35667, 52.97854], [31.592, 52.79011], [31.57277, 52.71613], [31.50406, 52.69707], [31.63869, 52.55361], [31.56316, 52.51518], [31.61397, 52.48843], [31.62084, 52.33849], [31.57971, 52.32146], [31.70735, 52.26711], [31.6895, 52.1973], [31.77877, 52.18636], [31.7822, 52.11406], [31.81722, 52.09955], [31.85018, 52.11305], [31.96141, 52.08015], [31.92159, 52.05144], [32.08813, 52.03319], [32.23331, 52.08085], [32.2777, 52.10266], [32.34044, 52.1434], [32.33083, 52.23685], [32.38988, 52.24946], [32.3528, 52.32842], [32.54781, 52.32423], [32.69475, 52.25535], [32.85405, 52.27888], [32.89937, 52.2461], [33.18913, 52.3754], [33.51323, 52.35779], [33.48027, 52.31499], [33.55718, 52.30324], [33.78789, 52.37204], [34.05239, 52.20132], [34.11199, 52.14087], [34.09413, 52.00835], [34.41136, 51.82793], [34.42922, 51.72852], [34.07765, 51.67065], [34.17599, 51.63253], [34.30562, 51.5205], [34.22048, 51.4187], [34.33446, 51.363], [34.23009, 51.26429], [34.31661, 51.23936], [34.38802, 51.2746], [34.6613, 51.25053], [34.6874, 51.18], [34.82472, 51.17483], [34.97304, 51.2342], [35.14058, 51.23162], [35.12685, 51.16191], [35.20375, 51.04723], [35.31774, 51.08434], [35.40837, 51.04119], [35.32598, 50.94524], [35.39307, 50.92145], [35.41367, 50.80227], [35.47704, 50.77274], [35.48116, 50.66405], [35.39464, 50.64751], [35.47463, 50.49247], [35.58003, 50.45117], [35.61711, 50.35707], [35.73659, 50.35489], [35.80388, 50.41356], [35.8926, 50.43829], [36.06893, 50.45205], [36.20763, 50.3943], [36.30101, 50.29088], [36.47817, 50.31457], [36.58371, 50.28563], [36.56655, 50.2413], [36.64571, 50.218], [36.69377, 50.26982], [36.91762, 50.34963], [37.08468, 50.34935], [37.48204, 50.46079], [37.47243, 50.36277], [37.62486, 50.29966], [37.62879, 50.24481], [37.61113, 50.21976], [37.75807, 50.07896], [37.79515, 50.08425], [37.90776, 50.04194], [38.02999, 49.94482], [38.02999, 49.90592], [38.21675, 49.98104], [38.18517, 50.08161], [38.32524, 50.08866], [38.35408, 50.00664], [38.65688, 49.97176], [38.68677, 50.00904], [38.73311, 49.90238], [38.90477, 49.86787], [38.9391, 49.79524], [39.1808, 49.88911], [39.27968, 49.75976], [39.44496, 49.76067], [39.59142, 49.73758], [39.65047, 49.61761], [39.84548, 49.56064], [40.13249, 49.61672], [40.16683, 49.56865], [40.03636, 49.52321], [40.03087, 49.45452], [40.1141, 49.38798], [40.14912, 49.37681], [40.18331, 49.34996], [40.22176, 49.25683], [40.01988, 49.1761], [39.93437, 49.05709], [39.6836, 49.05121], [39.6683, 48.99454], [39.71353, 48.98959], [39.72649, 48.9754], [39.74874, 48.98675], [39.78368, 48.91596], [39.98967, 48.86901], [40.03636, 48.91957], [40.08168, 48.87443], [39.97182, 48.79398], [39.79466, 48.83739], [39.73104, 48.7325], [39.71765, 48.68673], [39.67226, 48.59368], [39.79764, 48.58668], [39.84548, 48.57821], [39.86196, 48.46633], [39.88794, 48.44226], [39.94847, 48.35055], [39.84136, 48.33321], [39.84273, 48.30947], [39.90041, 48.3049], [39.91465, 48.26743], [39.95248, 48.29972], [39.9693, 48.29904], [39.97325, 48.31399], [39.99241, 48.31768], [40.00752, 48.22445], [39.94847, 48.22811], [39.83724, 48.06501], [39.88256, 48.04482], [39.77544, 48.04206], [39.82213, 47.96396], [39.73935, 47.82876], [38.87979, 47.87719], [38.79628, 47.81109], [38.76379, 47.69346], [38.35062, 47.61631], [38.28679, 47.53552], [38.28954, 47.39255], [38.22225, 47.30788], [38.33074, 47.30508], [38.32112, 47.2585], [38.23049, 47.2324], [38.22955, 47.12069], [38.3384, 46.98085], [38.12112, 46.86078], [37.62608, 46.82615], [35.23066, 45.79231], [35.04991, 45.76827], [36.6645, 45.4514], [36.6545, 45.3417], [36.5049, 45.3136], [36.475, 45.2411], [36.4883, 45.0488], [33.5943, 44.03313], [39.81147, 43.06294], [40.0078, 43.38551], [40.00853, 43.40578], [40.01552, 43.42025], [40.01007, 43.42411], [40.03312, 43.44262], [40.04445, 43.47776], [40.10657, 43.57344], [40.65957, 43.56212], [41.64935, 43.22331], [42.40563, 43.23226], [42.66667, 43.13917], [42.75889, 43.19651], [43.03322, 43.08883], [43.0419, 43.02413], [43.81453, 42.74297], [43.73119, 42.62043], [43.95517, 42.55396], [44.54202, 42.75699], [44.70002, 42.74679], [44.80941, 42.61277], [44.88754, 42.74934], [45.15318, 42.70598], [45.36501, 42.55268], [45.78692, 42.48358], [45.61676, 42.20768], [46.42738, 41.91323], [46.5332, 41.87389], [46.58924, 41.80547], [46.75269, 41.8623], [46.8134, 41.76252], [47.00955, 41.63583], [46.99554, 41.59743], [47.03757, 41.55434], [47.10762, 41.59044], [47.34579, 41.27884], [47.49004, 41.26366], [47.54504, 41.20275], [47.62288, 41.22969], [47.75831, 41.19455], [47.87973, 41.21798], [48.07587, 41.49957], [48.22064, 41.51472], [48.2878, 41.56221], [48.40277, 41.60441], [48.42301, 41.65444], [48.55078, 41.77917], [48.5867, 41.84306], [48.80971, 41.95365], [49.2134, 44.84989], [49.88945, 46.04554], [49.32259, 46.26944], [49.16518, 46.38542], [48.54988, 46.56267], [48.51142, 46.69268], [49.01136, 46.72716], [48.52326, 47.4102], [48.45173, 47.40818], [48.15348, 47.74545], [47.64973, 47.76559], [47.41689, 47.83687], [47.38731, 47.68176], [47.12107, 47.83687], [47.11516, 48.27188], [46.49011, 48.43019], [46.78392, 48.95352], [47.00857, 49.04921], [47.04658, 49.19834], [46.78398, 49.34026], [46.9078, 49.86707], [47.18319, 49.93721], [47.34589, 50.09308], [47.30448, 50.30894], [47.58551, 50.47867], [48.10044, 50.09242], [48.24519, 49.86099], [48.42564, 49.82283], [48.68352, 49.89546], [48.90782, 50.02281], [48.57946, 50.63278], [48.86936, 50.61589], [49.12673, 50.78639], [49.41959, 50.85927], [49.39001, 51.09396], [49.76866, 51.11067], [49.97277, 51.2405], [50.26859, 51.28677], [50.59695, 51.61859], [51.26254, 51.68466], [51.301, 51.48799], [51.77431, 51.49536], [51.8246, 51.67916], [52.36119, 51.74161], [52.54329, 51.48444], [53.46165, 51.49445], [53.69299, 51.23466], [54.12248, 51.11542], [54.46331, 50.85554], [54.41894, 50.61214], [54.55797, 50.52006], [54.71476, 50.61214], [54.56685, 51.01958], [54.72067, 51.03261], [55.67774, 50.54508], [56.11398, 50.7471], [56.17906, 50.93204], [57.17302, 51.11253], [57.44221, 50.88354], [57.74986, 50.93017], [57.75578, 51.13852], [58.3208, 51.15151], [58.87974, 50.70852], [59.48928, 50.64216], [59.51886, 50.49937], [59.81172, 50.54451], [60.01288, 50.8163], [60.17262, 50.83312], [60.31914, 50.67705], [60.81833, 50.6629], [61.4431, 50.80679], [61.56889, 51.23679], [61.6813, 51.25716], [61.55114, 51.32746], [61.50677, 51.40687], [60.95655, 51.48615], [60.92401, 51.61124], [60.5424, 51.61675], [60.36787, 51.66815], [60.50986, 51.7964], [60.09867, 51.87135], [59.99809, 51.98263], [59.91279, 52.06924], [60.17253, 52.25814], [60.17516, 52.39457], [59.25033, 52.46803], [59.22409, 52.28437], [58.79644, 52.43392], [58.94336, 53.953], [59.70487, 54.14846], [59.95217, 54.85853], [57.95234, 54.39672], [57.14829, 54.84204], [57.25137, 55.26262], [58.81825, 55.03378], [59.49035, 55.60486], [59.28419, 56.15739], [57.51527, 56.08729], [57.28024, 56.87898], [58.07604, 57.08308], [58.13789, 57.68097], [58.81412, 57.71602], [58.71104, 58.07475], [59.40376, 58.45822], [59.15636, 59.14682], [58.3853, 59.487], [59.50685, 60.91162], [59.36223, 61.3882], [59.61398, 62.44915], [59.24834, 63.01859], [59.80579, 64.13948], [59.63945, 64.78384], [60.74386, 64.95767], [61.98014, 65.72191], [66.1708, 67.61252], [64.18965, 69.94255], [76.13964, 83.37843], [36.85549, 84.09565], [32.07813, 72.01005], [31.59909, 70.16571], [30.84095, 69.80584], [30.95011, 69.54699], [30.52662, 69.54699], [30.16363, 69.65244], [29.97205, 69.41623], [29.27631, 69.2811], [29.26623, 69.13794], [29.0444, 69.0119], [28.91738, 69.04774], [28.45957, 68.91417], [28.78224, 68.86696], [28.43941, 68.53366], [28.62982, 68.19816], [29.34179, 68.06655], [29.66955, 67.79872], [30.02041, 67.67523], [29.91155, 67.51507], [28.9839, 66.94139], [29.91155, 66.13863], [30.16363, 65.66935], [29.97205, 65.70256], [29.74013, 65.64025], [29.84096, 65.56945], [29.68972, 65.31803], [29.61914, 65.23791], [29.8813, 65.22101], [29.84096, 65.1109], [29.61914, 65.05993], [29.68972, 64.80789], [30.05271, 64.79072], [30.12329, 64.64862], [30.01238, 64.57513], [30.06279, 64.35782], [30.4762, 64.25728], [30.55687, 64.09036], [30.25437, 63.83364], [29.98213, 63.75795], [30.49637, 63.46666], [31.23244, 63.22239], [31.29294, 63.09035], [31.58535, 62.91642], [31.38369, 62.66284], [31.10136, 62.43042], [29.01829, 61.17448], [28.82816, 61.1233], [28.47974, 60.93365], [27.77352, 60.52722], [27.71177, 60.3893], [27.44953, 60.22766], [26.32936, 60.00121]]]] } },
20449     { type: "Feature", properties: { wikidata: "Q1083368", nameEn: "Mainland Finland", country: "FI", groups: ["EU", "154", "150", "UN"], callingCodes: ["358"] }, geometry: { type: "MultiPolygon", coordinates: [[[[29.12697, 69.69193], [28.36883, 69.81658], [28.32849, 69.88605], [27.97558, 69.99671], [27.95542, 70.0965], [27.57226, 70.06215], [27.05802, 69.92069], [26.64461, 69.96565], [26.40261, 69.91377], [25.96904, 69.68397], [25.69679, 69.27039], [25.75729, 68.99383], [25.61613, 68.89602], [25.42455, 68.90328], [25.12206, 68.78684], [25.10189, 68.63307], [24.93048, 68.61102], [24.90023, 68.55579], [24.74898, 68.65143], [24.18432, 68.73936], [24.02299, 68.81601], [23.781, 68.84514], [23.68017, 68.70276], [23.13064, 68.64684], [22.53321, 68.74393], [22.38367, 68.71561], [22.27276, 68.89514], [21.63833, 69.27485], [21.27827, 69.31281], [21.00732, 69.22755], [20.98641, 69.18809], [21.11099, 69.10291], [21.05775, 69.0356], [20.72171, 69.11874], [20.55258, 69.06069], [20.78802, 69.03087], [20.91658, 68.96764], [20.85104, 68.93142], [20.90649, 68.89696], [21.03001, 68.88969], [22.00429, 68.50692], [22.73028, 68.40881], [23.10336, 68.26551], [23.15377, 68.14759], [23.26469, 68.15134], [23.40081, 68.05545], [23.65793, 67.9497], [23.45627, 67.85297], [23.54701, 67.59306], [23.39577, 67.46974], [23.75372, 67.43688], [23.75372, 67.29914], [23.54701, 67.25435], [23.58735, 67.20752], [23.56214, 67.17038], [23.98563, 66.84149], [23.98059, 66.79585], [23.89488, 66.772], [23.85959, 66.56434], [23.63776, 66.43568], [23.67591, 66.3862], [23.64982, 66.30603], [23.71339, 66.21299], [23.90497, 66.15802], [24.15791, 65.85385], [24.14798, 65.83466], [24.15107, 65.81427], [24.14112, 65.39731], [20.15877, 63.06556], [19.23413, 60.61414], [20.96741, 60.71528], [21.15143, 60.54555], [21.08159, 60.20167], [21.02509, 60.12142], [21.35468, 59.67511], [20.5104, 59.15546], [26.32936, 60.00121], [27.44953, 60.22766], [27.71177, 60.3893], [27.77352, 60.52722], [28.47974, 60.93365], [28.82816, 61.1233], [29.01829, 61.17448], [31.10136, 62.43042], [31.38369, 62.66284], [31.58535, 62.91642], [31.29294, 63.09035], [31.23244, 63.22239], [30.49637, 63.46666], [29.98213, 63.75795], [30.25437, 63.83364], [30.55687, 64.09036], [30.4762, 64.25728], [30.06279, 64.35782], [30.01238, 64.57513], [30.12329, 64.64862], [30.05271, 64.79072], [29.68972, 64.80789], [29.61914, 65.05993], [29.84096, 65.1109], [29.8813, 65.22101], [29.61914, 65.23791], [29.68972, 65.31803], [29.84096, 65.56945], [29.74013, 65.64025], [29.97205, 65.70256], [30.16363, 65.66935], [29.91155, 66.13863], [28.9839, 66.94139], [29.91155, 67.51507], [30.02041, 67.67523], [29.66955, 67.79872], [29.34179, 68.06655], [28.62982, 68.19816], [28.43941, 68.53366], [28.78224, 68.86696], [28.45957, 68.91417], [28.91738, 69.04774], [28.81248, 69.11997], [28.8629, 69.22395], [29.31664, 69.47994], [29.12697, 69.69193]]]] } },
20450     { type: "Feature", properties: { wikidata: "Q1184963", nameEn: "Alhucemas Islands", country: "ES", groups: ["EU", "Q191011", "015", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[-3.90602, 35.21494], [-3.88372, 35.20767], [-3.89343, 35.22728], [-3.90602, 35.21494]]]] } },
20451     { type: "Feature", properties: { wikidata: "Q1298289", nameEn: "Egmont Islands", country: "GB", groups: ["IO", "BOTS", "014", "202", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[70.1848, -6.37445], [70.67958, -8.2663], [72.17991, -6.68509], [70.1848, -6.37445]]]] } },
20452     { type: "Feature", properties: { wikidata: "Q1352230", nameEn: "US Territories", country: "US", level: "subcountryGroup" }, geometry: null },
20453     { type: "Feature", properties: { wikidata: "Q1451600", nameEn: "Overseas Countries and Territories of the EU", aliases: ["OCT"], level: "subunion" }, geometry: null },
20454     { type: "Feature", properties: { wikidata: "Q1544253", nameEn: "Great Chagos Bank", country: "GB", groups: ["IO", "BOTS", "014", "202", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[70.1848, -6.37445], [72.17991, -6.68509], [73.20573, -5.20727], [70.1848, -6.37445]]]] } },
20455     { type: "Feature", properties: { wikidata: "Q1585511", nameEn: "Salomon Atoll", country: "GB", groups: ["IO", "BOTS", "014", "202", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[72.09518, -5.61768], [73.20573, -5.20727], [72.12587, -4.02588], [72.09518, -5.61768]]]] } },
20456     { type: "Feature", properties: { wikidata: "Q1681727", nameEn: "Saint-Paul and Amsterdam", country: "FR", groups: ["EU", "TF", "Q1451600", "014", "202", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[76.31747, -42.16264], [80.15867, -36.04977], [71.22311, -38.75287], [76.31747, -42.16264]]]] } },
20457     { type: "Feature", properties: { wikidata: "Q1901211", nameEn: "East Malaysia", country: "MY", groups: ["Q36117", "035", "142", "UN"], driveSide: "left", callingCodes: ["60"] }, geometry: { type: "MultiPolygon", coordinates: [[[[110.90339, 7.52694], [109.82788, 2.86812], [109.62558, 1.99182], [109.53794, 1.91771], [109.57923, 1.80624], [109.66397, 1.79972], [109.66397, 1.60425], [110.35354, 0.98869], [110.49182, 0.88088], [110.62374, 0.873], [111.22979, 1.08326], [111.55434, 0.97864], [111.82846, 0.99349], [111.94553, 1.12016], [112.15679, 1.17004], [112.2127, 1.44135], [112.48648, 1.56516], [113.021, 1.57819], [113.01448, 1.42832], [113.64677, 1.23933], [114.03788, 1.44787], [114.57892, 1.5], [114.80706, 1.92351], [114.80706, 2.21665], [115.1721, 2.49671], [115.11343, 2.82879], [115.53713, 3.14776], [115.58276, 3.93499], [115.90217, 4.37708], [117.25801, 4.35108], [117.47313, 4.18857], [117.67641, 4.16535], [118.06469, 4.16638], [118.93936, 4.09009], [119.52945, 5.35672], [117.98544, 6.27477], [117.93857, 6.89845], [117.17735, 7.52841], [116.79524, 7.43869], [115.02521, 5.35005], [115.16236, 5.01011], [115.15092, 4.87604], [115.20737, 4.8256], [115.27819, 4.63661], [115.2851, 4.42295], [115.36346, 4.33563], [115.31275, 4.30806], [115.09978, 4.39123], [115.07737, 4.53418], [115.04064, 4.63706], [115.02278, 4.74137], [115.02955, 4.82087], [115.05038, 4.90275], [114.99417, 4.88201], [114.96982, 4.81146], [114.88841, 4.81905], [114.8266, 4.75062], [114.77303, 4.72871], [114.83189, 4.42387], [114.88039, 4.4257], [114.78539, 4.12205], [114.64211, 4.00694], [114.49922, 4.13108], [114.4416, 4.27588], [114.32176, 4.2552], [114.32176, 4.34942], [114.26876, 4.49878], [114.15813, 4.57], [114.07448, 4.58441], [114.10166, 4.76112], [110.90339, 7.52694]]]] } },
20458     { type: "Feature", properties: { wikidata: "Q1973345", nameEn: "Peninsular Malaysia", country: "MY", groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["60"] }, geometry: { type: "MultiPolygon", coordinates: [[[[102.46318, 7.22462], [102.09086, 6.23546], [102.08127, 6.22679], [102.07732, 6.193], [102.09182, 6.14161], [102.01835, 6.05407], [101.99209, 6.04075], [101.97114, 6.01992], [101.9714, 6.00575], [101.94712, 5.98421], [101.92819, 5.85511], [101.91776, 5.84269], [101.89188, 5.8386], [101.80144, 5.74505], [101.75074, 5.79091], [101.69773, 5.75881], [101.58019, 5.93534], [101.25524, 5.78633], [101.25755, 5.71065], [101.14062, 5.61613], [100.98815, 5.79464], [101.02708, 5.91013], [101.087, 5.9193], [101.12388, 6.11411], [101.06165, 6.14161], [101.12618, 6.19431], [101.10313, 6.25617], [100.85884, 6.24929], [100.81045, 6.45086], [100.74822, 6.46231], [100.74361, 6.50811], [100.66986, 6.45086], [100.43027, 6.52389], [100.42351, 6.51762], [100.41791, 6.5189], [100.41152, 6.52299], [100.35413, 6.54932], [100.31929, 6.65413], [100.32607, 6.65933], [100.32671, 6.66526], [100.31884, 6.66423], [100.31618, 6.66781], [100.30828, 6.66462], [100.29651, 6.68439], [100.19511, 6.72559], [100.12, 6.42105], [100.0756, 6.4045], [99.91873, 6.50233], [99.50117, 6.44501], [99.31854, 5.99868], [99.75778, 3.86466], [103.03657, 1.30383], [103.56591, 1.19719], [103.62738, 1.35255], [103.67468, 1.43166], [103.7219, 1.46108], [103.74161, 1.4502], [103.76395, 1.45183], [103.81181, 1.47953], [103.86383, 1.46288], [103.89565, 1.42841], [103.93384, 1.42926], [104.00131, 1.42405], [104.02277, 1.4438], [104.04622, 1.44691], [104.07348, 1.43322], [104.08871, 1.42015], [104.09162, 1.39694], [104.08072, 1.35998], [104.12282, 1.27714], [104.34728, 1.33529], [104.56723, 1.44271], [105.01437, 3.24936], [102.46318, 7.22462]]]] } },
20459     { type: "Feature", properties: { wikidata: "Q2093907", nameEn: "Three Kings Islands", country: "NZ", groups: ["Q851132", "053", "009", "UN"], driveSide: "left" }, geometry: { type: "MultiPolygon", coordinates: [[[[174.17679, -32.62487], [170.93268, -32.97889], [171.97383, -34.64644], [174.17679, -32.62487]]]] } },
20460     { type: "Feature", properties: { wikidata: "Q2298216", nameEn: "Solander Islands", country: "NZ", groups: ["Q851132", "053", "009", "UN"], driveSide: "left" }, geometry: { type: "MultiPolygon", coordinates: [[[[167.39068, -46.49187], [166.5534, -46.39484], [166.84561, -46.84889], [167.39068, -46.49187]]]] } },
20461     { type: "Feature", properties: { wikidata: "Q2872203", nameEn: "Mainland Australia", country: "AU", groups: ["053", "009", "UN"], level: "subcountryGroup", driveSide: "left", callingCodes: ["61"] }, geometry: { type: "MultiPolygon", coordinates: [[[[88.16419, -23.49578], [123.64533, -39.13605], [159.74028, -39.1978], [159.76765, -29.76946], [154.02855, -24.43238], [152.93188, -20.92631], [147.69992, -17.5933], [145.2855, -9.62524], [143.87386, -9.02382], [143.29772, -9.33993], [142.48658, -9.36754], [142.19246, -9.15378], [141.88934, -9.36111], [141.01842, -9.35091], [135.49042, -9.2276], [127.55165, -9.05052], [125.29076, -12.33139], [88.16419, -23.49578]]]] } },
20462     { type: "Feature", properties: { wikidata: "Q2914565", nameEn: "Autonomous Regions of Portugal", country: "PT", level: "subcountryGroup" }, geometry: null },
20463     { type: "Feature", properties: { wikidata: "Q2915956", nameEn: "Mainland Portugal", country: "PT", groups: ["Q12837", "EU", "039", "150", "UN"], level: "subcountryGroup", callingCodes: ["351"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-10.39881, 36.12218], [-7.37282, 36.96896], [-7.39769, 37.16868], [-7.41133, 37.20314], [-7.41854, 37.23813], [-7.43227, 37.25152], [-7.43974, 37.38913], [-7.46878, 37.47127], [-7.51759, 37.56119], [-7.41981, 37.75729], [-7.33441, 37.81193], [-7.27314, 37.90145], [-7.24544, 37.98884], [-7.12648, 38.00296], [-7.10366, 38.04404], [-7.05966, 38.01966], [-7.00375, 38.01914], [-6.93418, 38.21454], [-7.09389, 38.17227], [-7.15581, 38.27597], [-7.32529, 38.44336], [-7.265, 38.61674], [-7.26174, 38.72107], [-7.03848, 38.87221], [-7.051, 38.907], [-6.95211, 39.0243], [-6.97004, 39.07619], [-7.04011, 39.11919], [-7.10692, 39.10275], [-7.14929, 39.11287], [-7.12811, 39.17101], [-7.23566, 39.20132], [-7.23403, 39.27579], [-7.3149, 39.34857], [-7.2927, 39.45847], [-7.49477, 39.58794], [-7.54121, 39.66717], [-7.33507, 39.64569], [-7.24707, 39.66576], [-7.01613, 39.66877], [-6.97492, 39.81488], [-6.91463, 39.86618], [-6.86737, 40.01986], [-6.94233, 40.10716], [-7.00589, 40.12087], [-7.02544, 40.18564], [-7.00426, 40.23169], [-6.86085, 40.26776], [-6.86085, 40.2976], [-6.80218, 40.33239], [-6.78426, 40.36468], [-6.84618, 40.42177], [-6.84944, 40.46394], [-6.7973, 40.51723], [-6.80218, 40.55067], [-6.84292, 40.56801], [-6.79567, 40.65955], [-6.82826, 40.74603], [-6.82337, 40.84472], [-6.79892, 40.84842], [-6.80707, 40.88047], [-6.84292, 40.89771], [-6.8527, 40.93958], [-6.9357, 41.02888], [-6.913, 41.03922], [-6.88843, 41.03027], [-6.84781, 41.02692], [-6.80942, 41.03629], [-6.79241, 41.05397], [-6.75655, 41.10187], [-6.77319, 41.13049], [-6.69711, 41.1858], [-6.68286, 41.21641], [-6.65046, 41.24725], [-6.55937, 41.24417], [-6.38551, 41.35274], [-6.38553, 41.38655], [-6.3306, 41.37677], [-6.26777, 41.48796], [-6.19128, 41.57638], [-6.29863, 41.66432], [-6.44204, 41.68258], [-6.49907, 41.65823], [-6.54633, 41.68623], [-6.56426, 41.74219], [-6.51374, 41.8758], [-6.56752, 41.88429], [-6.5447, 41.94371], [-6.58544, 41.96674], [-6.61967, 41.94008], [-6.75004, 41.94129], [-6.76959, 41.98734], [-6.81196, 41.99097], [-6.82174, 41.94493], [-6.94396, 41.94403], [-6.95537, 41.96553], [-6.98144, 41.9728], [-7.01078, 41.94977], [-7.07596, 41.94977], [-7.08574, 41.97401], [-7.14115, 41.98855], [-7.18549, 41.97515], [-7.18677, 41.88793], [-7.32366, 41.8406], [-7.37092, 41.85031], [-7.42864, 41.80589], [-7.42854, 41.83262], [-7.44759, 41.84451], [-7.45566, 41.86488], [-7.49803, 41.87095], [-7.52737, 41.83939], [-7.62188, 41.83089], [-7.58603, 41.87944], [-7.65774, 41.88308], [-7.69848, 41.90977], [-7.84188, 41.88065], [-7.88055, 41.84571], [-7.88751, 41.92553], [-7.90707, 41.92432], [-7.92336, 41.8758], [-7.9804, 41.87337], [-8.01136, 41.83453], [-8.0961, 41.81024], [-8.16455, 41.81753], [-8.16944, 41.87944], [-8.19551, 41.87459], [-8.2185, 41.91237], [-8.16232, 41.9828], [-8.08796, 42.01398], [-8.08847, 42.05767], [-8.11729, 42.08537], [-8.18178, 42.06436], [-8.19406, 42.12141], [-8.18947, 42.13853], [-8.1986, 42.15402], [-8.22406, 42.1328], [-8.24681, 42.13993], [-8.2732, 42.12396], [-8.29809, 42.106], [-8.32161, 42.10218], [-8.33912, 42.08358], [-8.36353, 42.09065], [-8.38323, 42.07683], [-8.40143, 42.08052], [-8.42512, 42.07199], [-8.44123, 42.08218], [-8.48185, 42.0811], [-8.52837, 42.07658], [-8.5252, 42.06264], [-8.54563, 42.0537], [-8.58086, 42.05147], [-8.59493, 42.05708], [-8.63791, 42.04691], [-8.64626, 42.03668], [-8.65832, 42.02972], [-8.6681, 41.99703], [-8.69071, 41.98862], [-8.7478, 41.96282], [-8.74606, 41.9469], [-8.75712, 41.92833], [-8.81794, 41.90375], [-8.87157, 41.86488], [-11.19304, 41.83075], [-10.39881, 36.12218]]]] } },
20464     { type: "Feature", properties: { wikidata: "Q3311985", nameEn: "Guernsey", country: "GB", groups: ["GG", "830", "Q185086", "154", "150", "UN"], level: "subterritory", driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44 01481"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-2.49556, 49.79012], [-3.28154, 49.57329], [-2.65349, 49.15373], [-2.36485, 49.48223], [-2.49556, 49.79012]]]] } },
20465     { type: "Feature", properties: { wikidata: "Q3320166", nameEn: "Outermost Regions of the EU", aliases: ["OMR"], level: "subunion" }, geometry: null },
20466     { type: "Feature", properties: { wikidata: "Q3336843", nameEn: "Countries of the United Kingdom", aliases: ["GB-UKM"], country: "GB", level: "subcountryGroup" }, geometry: null },
20467     { type: "Feature", properties: { wikidata: "Q6736667", nameEn: "Mainland India", country: "IN", groups: ["034", "142", "UN"], driveSide: "left", callingCodes: ["91"] }, geometry: { type: "MultiPolygon", coordinates: [[[[89.08044, 21.41871], [89.07114, 22.15335], [88.9367, 22.58527], [88.94614, 22.66941], [88.9151, 22.75228], [88.96713, 22.83346], [88.87063, 22.95235], [88.88327, 23.03885], [88.86377, 23.08759], [88.99148, 23.21134], [88.71133, 23.2492], [88.79254, 23.46028], [88.79351, 23.50535], [88.74841, 23.47361], [88.56507, 23.64044], [88.58087, 23.87105], [88.66189, 23.87607], [88.73743, 23.91751], [88.6976, 24.14703], [88.74841, 24.1959], [88.68801, 24.31464], [88.50934, 24.32474], [88.12296, 24.51301], [88.08786, 24.63232], [88.00683, 24.66477], [88.15515, 24.85806], [88.14004, 24.93529], [88.21832, 24.96642], [88.27325, 24.88796], [88.33917, 24.86803], [88.46277, 25.07468], [88.44766, 25.20149], [88.94067, 25.18534], [89.00463, 25.26583], [89.01105, 25.30303], [88.85278, 25.34679], [88.81296, 25.51546], [88.677, 25.46959], [88.4559, 25.59227], [88.45103, 25.66245], [88.242, 25.80811], [88.13138, 25.78773], [88.08804, 25.91334], [88.16581, 26.0238], [88.1844, 26.14417], [88.34757, 26.22216], [88.35153, 26.29123], [88.51649, 26.35923], [88.48749, 26.45855], [88.36938, 26.48683], [88.35153, 26.45241], [88.33093, 26.48929], [88.41196, 26.63837], [88.4298, 26.54489], [88.62144, 26.46783], [88.69485, 26.38353], [88.67837, 26.26291], [88.78961, 26.31093], [88.85004, 26.23211], [89.05328, 26.2469], [88.91321, 26.37984], [88.92357, 26.40711], [88.95612, 26.4564], [89.08899, 26.38845], [89.15869, 26.13708], [89.35953, 26.0077], [89.53515, 26.00382], [89.57101, 25.9682], [89.63968, 26.22595], [89.70201, 26.15138], [89.73581, 26.15818], [89.77865, 26.08387], [89.77728, 26.04254], [89.86592, 25.93115], [89.80585, 25.82489], [89.84388, 25.70042], [89.86129, 25.61714], [89.81208, 25.37244], [89.84086, 25.31854], [89.83371, 25.29548], [89.87629, 25.28337], [89.90478, 25.31038], [90.1155, 25.22686], [90.40034, 25.1534], [90.65042, 25.17788], [90.87427, 25.15799], [91.25517, 25.20677], [91.63648, 25.12846], [92.0316, 25.1834], [92.33957, 25.07593], [92.39147, 25.01471], [92.49887, 24.88796], [92.38626, 24.86055], [92.25854, 24.9191], [92.15796, 24.54435], [92.11662, 24.38997], [91.96603, 24.3799], [91.89258, 24.14674], [91.82596, 24.22345], [91.76004, 24.23848], [91.73257, 24.14703], [91.65292, 24.22095], [91.63782, 24.1132], [91.55542, 24.08687], [91.37414, 24.10693], [91.35741, 23.99072], [91.29587, 24.0041], [91.22308, 23.89616], [91.25192, 23.83463], [91.15579, 23.6599], [91.28293, 23.37538], [91.36453, 23.06612], [91.40848, 23.07117], [91.4035, 23.27522], [91.46615, 23.2328], [91.54993, 23.01051], [91.61571, 22.93929], [91.7324, 23.00043], [91.81634, 23.08001], [91.76417, 23.26619], [91.84789, 23.42235], [91.95642, 23.47361], [91.95093, 23.73284], [92.04706, 23.64229], [92.15417, 23.73409], [92.26541, 23.70392], [92.38214, 23.28705], [92.37665, 22.9435], [92.5181, 22.71441], [92.60029, 22.1522], [92.56616, 22.13554], [92.60949, 21.97638], [92.67532, 22.03547], [92.70416, 22.16017], [92.86208, 22.05456], [92.89504, 21.95143], [92.93899, 22.02656], [92.99804, 21.98964], [92.99255, 22.05965], [93.04885, 22.20595], [93.15734, 22.18687], [93.14224, 22.24535], [93.19991, 22.25425], [93.18206, 22.43716], [93.13537, 22.45873], [93.11477, 22.54374], [93.134, 22.59573], [93.09417, 22.69459], [93.134, 22.92498], [93.12988, 23.05772], [93.2878, 23.00464], [93.38478, 23.13698], [93.36862, 23.35426], [93.38781, 23.36139], [93.39981, 23.38828], [93.38805, 23.4728], [93.43475, 23.68299], [93.3908, 23.7622], [93.3908, 23.92925], [93.36059, 23.93176], [93.32351, 24.04468], [93.34735, 24.10151], [93.41415, 24.07854], [93.46633, 23.97067], [93.50616, 23.94432], [93.62871, 24.00922], [93.75952, 24.0003], [93.80279, 23.92549], [93.92089, 23.95812], [94.14081, 23.83333], [94.30215, 24.23752], [94.32362, 24.27692], [94.45279, 24.56656], [94.50729, 24.59281], [94.5526, 24.70764], [94.60204, 24.70889], [94.73937, 25.00545], [94.74212, 25.13606], [94.57458, 25.20318], [94.68032, 25.47003], [94.80117, 25.49359], [95.18556, 26.07338], [95.11428, 26.1019], [95.12801, 26.38397], [95.05798, 26.45408], [95.23513, 26.68499], [95.30339, 26.65372], [95.437, 26.7083], [95.81603, 27.01335], [95.93002, 27.04149], [96.04949, 27.19428], [96.15591, 27.24572], [96.40779, 27.29818], [96.55761, 27.29928], [96.73888, 27.36638], [96.88445, 27.25046], [96.85287, 27.2065], [96.89132, 27.17474], [97.14675, 27.09041], [97.17422, 27.14052], [96.91431, 27.45752], [96.90112, 27.62149], [97.29919, 27.92233], [97.35824, 27.87256], [97.38845, 28.01329], [97.35412, 28.06663], [97.31292, 28.06784], [97.34547, 28.21385], [97.1289, 28.3619], [96.98882, 28.32564], [96.88445, 28.39452], [96.85561, 28.4875], [96.6455, 28.61657], [96.48895, 28.42955], [96.40929, 28.51526], [96.61391, 28.72742], [96.3626, 29.10607], [96.20467, 29.02325], [96.18682, 29.11087], [96.31316, 29.18643], [96.05361, 29.38167], [95.84899, 29.31464], [95.75149, 29.32063], [95.72086, 29.20797], [95.50842, 29.13487], [95.41091, 29.13007], [95.3038, 29.13847], [95.26122, 29.07727], [95.2214, 29.10727], [95.11291, 29.09527], [95.0978, 29.14446], [94.81353, 29.17804], [94.69318, 29.31739], [94.2752, 29.11687], [94.35897, 29.01965], [93.72797, 28.68821], [93.44621, 28.67189], [93.18069, 28.50319], [93.14635, 28.37035], [92.93075, 28.25671], [92.67486, 28.15018], [92.65472, 28.07632], [92.73025, 28.05814], [92.7275, 27.98662], [92.42538, 27.80092], [92.32101, 27.79363], [92.27432, 27.89077], [91.87057, 27.7195], [91.84722, 27.76325], [91.6469, 27.76358], [91.55819, 27.6144], [91.65007, 27.48287], [92.01132, 27.47352], [92.12019, 27.27829], [92.04702, 27.26861], [92.03457, 27.07334], [92.11863, 26.893], [92.05523, 26.8692], [91.83181, 26.87318], [91.50067, 26.79223], [90.67715, 26.77215], [90.48504, 26.8594], [90.39271, 26.90704], [90.30402, 26.85098], [90.04535, 26.72422], [89.86124, 26.73307], [89.63369, 26.74402], [89.42349, 26.83727], [89.3901, 26.84225], [89.38319, 26.85963], [89.37913, 26.86224], [89.1926, 26.81329], [89.12825, 26.81661], [89.09554, 26.89089], [88.95807, 26.92668], [88.92301, 26.99286], [88.8714, 26.97488], [88.86984, 27.10937], [88.74219, 27.144], [88.91901, 27.32483], [88.82981, 27.38814], [88.77517, 27.45415], [88.88091, 27.85192], [88.83559, 28.01936], [88.63235, 28.12356], [88.54858, 28.06057], [88.25332, 27.9478], [88.1278, 27.95417], [88.13378, 27.88015], [88.1973, 27.85067], [88.19107, 27.79285], [88.04008, 27.49223], [88.07277, 27.43007], [88.01646, 27.21612], [88.01587, 27.21388], [87.9887, 27.11045], [88.11719, 26.98758], [88.13422, 26.98705], [88.12302, 26.95324], [88.19107, 26.75516], [88.1659, 26.68177], [88.16452, 26.64111], [88.09963, 26.54195], [88.09414, 26.43732], [88.00895, 26.36029], [87.90115, 26.44923], [87.89085, 26.48565], [87.84193, 26.43663], [87.7918, 26.46737], [87.76004, 26.40711], [87.67893, 26.43501], [87.66803, 26.40294], [87.59175, 26.38342], [87.55274, 26.40596], [87.51571, 26.43106], [87.46566, 26.44058], [87.37314, 26.40815], [87.34568, 26.34787], [87.26568, 26.37294], [87.26587, 26.40592], [87.24682, 26.4143], [87.18863, 26.40558], [87.14751, 26.40542], [87.09147, 26.45039], [87.0707, 26.58571], [87.04691, 26.58685], [87.01559, 26.53228], [86.95912, 26.52076], [86.94543, 26.52076], [86.82898, 26.43919], [86.76797, 26.45892], [86.74025, 26.42386], [86.69124, 26.45169], [86.62686, 26.46891], [86.61313, 26.48658], [86.57073, 26.49825], [86.54258, 26.53819], [86.49726, 26.54218], [86.31564, 26.61925], [86.26235, 26.61886], [86.22513, 26.58863], [86.13596, 26.60651], [86.02729, 26.66756], [85.8492, 26.56667], [85.85126, 26.60866], [85.83126, 26.61134], [85.76907, 26.63076], [85.72315, 26.67471], [85.73483, 26.79613], [85.66239, 26.84822], [85.61621, 26.86721], [85.59461, 26.85161], [85.5757, 26.85955], [85.56471, 26.84133], [85.47752, 26.79292], [85.34302, 26.74954], [85.21159, 26.75933], [85.18046, 26.80519], [85.19291, 26.86909], [85.15883, 26.86966], [85.02635, 26.85381], [85.05592, 26.88991], [85.00536, 26.89523], [84.97186, 26.9149], [84.96687, 26.95599], [84.85754, 26.98984], [84.82913, 27.01989], [84.793, 26.9968], [84.64496, 27.04669], [84.69166, 27.21294], [84.62161, 27.33885], [84.29315, 27.39], [84.25735, 27.44941], [84.21376, 27.45218], [84.10791, 27.52399], [84.02229, 27.43836], [83.93306, 27.44939], [83.86182, 27.4241], [83.85595, 27.35797], [83.61288, 27.47013], [83.39495, 27.4798], [83.38872, 27.39276], [83.35136, 27.33885], [83.29999, 27.32778], [83.2673, 27.36235], [83.27197, 27.38309], [83.19413, 27.45632], [82.94938, 27.46036], [82.93261, 27.50328], [82.74119, 27.49838], [82.70378, 27.72122], [82.46405, 27.6716], [82.06554, 27.92222], [81.97214, 27.93322], [81.91223, 27.84995], [81.47867, 28.08303], [81.48179, 28.12148], [81.38683, 28.17638], [81.32923, 28.13521], [81.19847, 28.36284], [81.03471, 28.40054], [80.55142, 28.69182], [80.50575, 28.6706], [80.52443, 28.54897], [80.44504, 28.63098], [80.37188, 28.63371], [80.12125, 28.82346], [80.06957, 28.82763], [80.05743, 28.91479], [80.18085, 29.13649], [80.23178, 29.11626], [80.26602, 29.13938], [80.24112, 29.21414], [80.28626, 29.20327], [80.31428, 29.30784], [80.24322, 29.44299], [80.37939, 29.57098], [80.41858, 29.63581], [80.38428, 29.68513], [80.36803, 29.73865], [80.41554, 29.79451], [80.43458, 29.80466], [80.48997, 29.79566], [80.56247, 29.86661], [80.57179, 29.91422], [80.60226, 29.95732], [80.67076, 29.95732], [80.8778, 30.13384], [80.86673, 30.17321], [80.91143, 30.22173], [80.92547, 30.17193], [81.03953, 30.20059], [80.83343, 30.32023], [80.54504, 30.44936], [80.20721, 30.58541], [79.93255, 30.88288], [79.59884, 30.93943], [79.30694, 31.17357], [79.14016, 31.43403], [79.01931, 31.42817], [78.89344, 31.30481], [78.77898, 31.31209], [78.71032, 31.50197], [78.84516, 31.60631], [78.69933, 31.78723], [78.78036, 31.99478], [78.74404, 32.00384], [78.68754, 32.10256], [78.49609, 32.2762], [78.4645, 32.45367], [78.38897, 32.53938], [78.73916, 32.69438], [78.7831, 32.46873], [78.96713, 32.33655], [78.99322, 32.37948], [79.0979, 32.38051], [79.13174, 32.47766], [79.26768, 32.53277], [79.46562, 32.69668], [79.14016, 33.02545], [79.15252, 33.17156], [78.73636, 33.56521], [78.67599, 33.66445], [78.77349, 33.73871], [78.73367, 34.01121], [78.65657, 34.03195], [78.66225, 34.08858], [78.91769, 34.15452], [78.99802, 34.3027], [79.05364, 34.32482], [78.74465, 34.45174], [78.56475, 34.50835], [78.54964, 34.57283], [78.27781, 34.61484], [78.18435, 34.7998], [78.22692, 34.88771], [78.00033, 35.23954], [78.03466, 35.3785], [78.11664, 35.48022], [77.80532, 35.52058], [77.70232, 35.46244], [77.44277, 35.46132], [76.96624, 35.5932], [76.84539, 35.67356], [76.77323, 35.66062], [76.75475, 35.52617], [76.85088, 35.39754], [76.93465, 35.39866], [77.11796, 35.05419], [76.99251, 34.93349], [76.87193, 34.96906], [76.74514, 34.92488], [76.74377, 34.84039], [76.67648, 34.76371], [76.47186, 34.78965], [76.15463, 34.6429], [76.04614, 34.67566], [75.75438, 34.51827], [75.38009, 34.55021], [75.01479, 34.64629], [74.6663, 34.703], [74.58083, 34.77386], [74.31239, 34.79626], [74.12897, 34.70073], [73.96423, 34.68244], [73.93401, 34.63386], [73.93951, 34.57169], [73.89419, 34.54568], [73.88732, 34.48911], [73.74999, 34.3781], [73.74862, 34.34183], [73.8475, 34.32935], [73.90517, 34.35317], [73.98208, 34.2522], [73.90677, 34.10504], [73.88732, 34.05105], [73.91341, 34.01235], [74.21554, 34.03853], [74.25262, 34.01577], [74.26086, 33.92237], [74.14001, 33.83002], [74.05898, 33.82089], [74.00891, 33.75437], [73.96423, 33.73071], [73.98968, 33.66155], [73.97367, 33.64061], [74.03576, 33.56718], [74.10115, 33.56392], [74.18121, 33.4745], [74.17983, 33.3679], [74.08782, 33.26232], [74.01366, 33.25199], [74.02144, 33.18908], [74.15374, 33.13477], [74.17571, 33.07495], [74.31854, 33.02891], [74.34875, 32.97823], [74.31227, 32.92795], [74.41467, 32.90563], [74.45312, 32.77755], [74.6289, 32.75561], [74.64675, 32.82604], [74.7113, 32.84219], [74.65345, 32.71225], [74.69542, 32.66792], [74.64424, 32.60985], [74.65251, 32.56416], [74.67431, 32.56676], [74.68362, 32.49298], [74.84725, 32.49075], [74.97634, 32.45367], [75.03265, 32.49538], [75.28259, 32.36556], [75.38046, 32.26836], [75.25649, 32.10187], [75.00793, 32.03786], [74.9269, 32.0658], [74.86236, 32.04485], [74.79919, 31.95983], [74.58907, 31.87824], [74.47771, 31.72227], [74.57498, 31.60382], [74.61517, 31.55698], [74.59319, 31.50197], [74.64713, 31.45605], [74.59773, 31.4136], [74.53223, 31.30321], [74.51629, 31.13829], [74.56023, 31.08303], [74.60281, 31.10419], [74.60006, 31.13711], [74.6852, 31.12771], [74.67971, 31.05479], [74.5616, 31.04153], [73.88993, 30.36305], [73.95736, 30.28466], [73.97225, 30.19829], [73.80299, 30.06969], [73.58665, 30.01848], [73.3962, 29.94707], [73.28094, 29.56646], [73.05886, 29.1878], [73.01337, 29.16422], [72.94272, 29.02487], [72.40402, 28.78283], [72.29495, 28.66367], [72.20329, 28.3869], [71.9244, 28.11555], [71.89921, 27.96035], [70.79054, 27.68423], [70.60927, 28.02178], [70.37307, 28.01208], [70.12502, 27.8057], [70.03136, 27.56627], [69.58519, 27.18109], [69.50904, 26.74892], [69.88555, 26.56836], [70.05584, 26.60398], [70.17532, 26.55362], [70.17532, 26.24118], [70.08193, 26.08094], [70.0985, 25.93238], [70.2687, 25.71156], [70.37444, 25.67443], [70.53649, 25.68928], [70.60378, 25.71898], [70.67382, 25.68186], [70.66695, 25.39314], [70.89148, 25.15064], [70.94002, 24.92843], [71.09405, 24.69017], [70.97594, 24.60904], [71.00341, 24.46038], [71.12838, 24.42662], [71.04461, 24.34657], [70.94985, 24.3791], [70.85784, 24.30903], [70.88393, 24.27398], [70.71502, 24.23517], [70.57906, 24.27774], [70.5667, 24.43787], [70.11712, 24.30915], [70.03428, 24.172], [69.73335, 24.17007], [69.59579, 24.29777], [69.29778, 24.28712], [69.19341, 24.25646], [69.07806, 24.29777], [68.97781, 24.26021], [68.90914, 24.33156], [68.7416, 24.31904], [68.74643, 23.97027], [68.39339, 23.96838], [68.20763, 23.85849], [68.11329, 23.53945], [76.59015, 5.591], [79.50447, 8.91876], [79.42124, 9.80115], [80.48418, 10.20786], [89.08044, 21.41871]]]] } },
20468     { type: "Feature", properties: { wikidata: "Q9143535", nameEn: "Akrotiri", country: "GB", groups: ["Q644636", "Q37362", "BOTS", "145", "142", "UN"], level: "subterritory", driveSide: "left", callingCodes: ["357"] }, geometry: { type: "MultiPolygon", coordinates: [[[[32.86014, 34.70585], [32.82717, 34.70622], [32.79433, 34.67883], [32.76136, 34.68318], [32.75515, 34.64985], [32.74412, 34.43926], [33.26744, 34.49942], [33.0138, 34.64424], [32.96968, 34.64046], [32.96718, 34.63446], [32.95891, 34.62919], [32.95323, 34.64075], [32.95471, 34.64528], [32.94976, 34.65204], [32.94796, 34.6587], [32.95325, 34.66462], [32.97079, 34.66112], [32.97736, 34.65277], [32.99014, 34.65518], [32.98668, 34.67268], [32.99135, 34.68061], [32.95539, 34.68471], [32.94683, 34.67907], [32.94379, 34.67111], [32.93693, 34.67027], [32.93449, 34.66241], [32.92807, 34.66736], [32.93043, 34.67091], [32.91398, 34.67343], [32.9068, 34.66102], [32.86167, 34.68734], [32.86014, 34.70585]]]] } },
20469     { type: "Feature", properties: { wikidata: "Q9206745", nameEn: "Dhekelia", country: "GB", groups: ["Q644636", "Q37362", "BOTS", "145", "142", "UN"], level: "subterritory", driveSide: "left", callingCodes: ["357"] }, geometry: { type: "MultiPolygon", coordinates: [[[[33.70575, 34.97947], [33.83531, 34.73974], [33.98684, 34.76642], [33.90075, 34.96623], [33.86432, 34.97592], [33.84811, 34.97075], [33.83505, 34.98108], [33.85621, 34.98956], [33.85891, 35.001], [33.85216, 35.00579], [33.84045, 35.00616], [33.82875, 35.01685], [33.83055, 35.02865], [33.81524, 35.04192], [33.8012, 35.04786], [33.82051, 35.0667], [33.8355, 35.05777], [33.85261, 35.0574], [33.88367, 35.07877], [33.89485, 35.06873], [33.90247, 35.07686], [33.91299, 35.07579], [33.91789, 35.08688], [33.89853, 35.11377], [33.88737, 35.11408], [33.88943, 35.12007], [33.88561, 35.12449], [33.87224, 35.12293], [33.87622, 35.10457], [33.87097, 35.09389], [33.87479, 35.08881], [33.8541, 35.07201], [33.84168, 35.06823], [33.82067, 35.07826], [33.78581, 35.05104], [33.76106, 35.04253], [33.73824, 35.05321], [33.71482, 35.03722], [33.70209, 35.04882], [33.7161, 35.07279], [33.70861, 35.07644], [33.69095, 35.06237], [33.68474, 35.06602], [33.67742, 35.05963], [33.67678, 35.03866], [33.69938, 35.03123], [33.69731, 35.01754], [33.71514, 35.00294], [33.70639, 34.99303], [33.70575, 34.97947]], [[33.77312, 34.9976], [33.77553, 34.99518], [33.78516, 34.99582], [33.79191, 34.98914], [33.78917, 34.98854], [33.78571, 34.98951], [33.78318, 34.98699], [33.78149, 34.98854], [33.77843, 34.988], [33.7778, 34.98981], [33.76738, 34.99188], [33.76605, 34.99543], [33.75682, 34.99916], [33.75994, 35.00113], [33.77312, 34.9976]], [[33.74144, 35.01053], [33.7343, 35.01178], [33.73781, 35.02181], [33.74265, 35.02329], [33.74983, 35.02274], [33.7492, 35.01319], [33.74144, 35.01053]]]] } },
20470     { type: "Feature", properties: { wikidata: "Q16390686", nameEn: "Peninsular Spain", country: "ES", groups: ["Q12837", "EU", "039", "150", "UN"], callingCodes: ["34"] }, geometry: { type: "MultiPolygon", coordinates: [[[[3.75438, 42.33445], [3.17156, 42.43545], [3.11379, 42.43646], [3.10027, 42.42621], [3.08167, 42.42748], [3.03734, 42.47363], [2.96518, 42.46692], [2.94283, 42.48174], [2.92107, 42.4573], [2.88413, 42.45938], [2.86983, 42.46843], [2.85675, 42.45444], [2.84335, 42.45724], [2.77464, 42.41046], [2.75497, 42.42578], [2.72056, 42.42298], [2.65311, 42.38771], [2.6747, 42.33974], [2.57934, 42.35808], [2.55516, 42.35351], [2.54382, 42.33406], [2.48457, 42.33933], [2.43508, 42.37568], [2.43299, 42.39423], [2.38504, 42.39977], [2.25551, 42.43757], [2.20578, 42.41633], [2.16599, 42.42314], [2.12789, 42.41291], [2.11621, 42.38393], [2.06241, 42.35906], [2.00488, 42.35399], [1.96482, 42.37787], [1.9574, 42.42401], [1.94084, 42.43039], [1.94061, 42.43333], [1.94292, 42.44316], [1.93663, 42.45439], [1.88853, 42.4501], [1.83037, 42.48395], [1.76335, 42.48863], [1.72515, 42.50338], [1.70571, 42.48867], [1.66826, 42.50779], [1.65674, 42.47125], [1.58933, 42.46275], [1.57953, 42.44957], [1.55937, 42.45808], [1.55073, 42.43299], [1.5127, 42.42959], [1.44529, 42.43724], [1.43838, 42.47848], [1.41648, 42.48315], [1.46661, 42.50949], [1.44759, 42.54431], [1.41245, 42.53539], [1.4234, 42.55959], [1.44529, 42.56722], [1.42512, 42.58292], [1.44197, 42.60217], [1.35562, 42.71944], [1.15928, 42.71407], [1.0804, 42.78569], [0.98292, 42.78754], [0.96166, 42.80629], [0.93089, 42.79154], [0.711, 42.86372], [0.66121, 42.84021], [0.65421, 42.75872], [0.67873, 42.69458], [0.40214, 42.69779], [0.36251, 42.72282], [0.29407, 42.67431], [0.25336, 42.7174], [0.17569, 42.73424], [-0.02468, 42.68513], [-0.10519, 42.72761], [-0.16141, 42.79535], [-0.17939, 42.78974], [-0.3122, 42.84788], [-0.38833, 42.80132], [-0.41319, 42.80776], [-0.44334, 42.79939], [-0.50863, 42.82713], [-0.55497, 42.77846], [-0.67637, 42.88303], [-0.69837, 42.87945], [-0.72608, 42.89318], [-0.73422, 42.91228], [-0.72037, 42.92541], [-0.75478, 42.96916], [-0.81652, 42.95166], [-0.97133, 42.96239], [-1.00963, 42.99279], [-1.10333, 43.0059], [-1.22881, 43.05534], [-1.25244, 43.04164], [-1.30531, 43.06859], [-1.30052, 43.09581], [-1.27118, 43.11961], [-1.32209, 43.1127], [-1.34419, 43.09665], [-1.35272, 43.02658], [-1.44067, 43.047], [-1.47555, 43.08372], [-1.41562, 43.12815], [-1.3758, 43.24511], [-1.40942, 43.27272], [-1.45289, 43.27049], [-1.50992, 43.29481], [-1.55963, 43.28828], [-1.57674, 43.25269], [-1.61341, 43.25269], [-1.63052, 43.28591], [-1.62481, 43.30726], [-1.69407, 43.31378], [-1.73074, 43.29481], [-1.7397, 43.32979], [-1.75079, 43.3317], [-1.75334, 43.34107], [-1.77068, 43.34396], [-1.78714, 43.35476], [-1.78332, 43.36399], [-1.79319, 43.37497], [-1.77289, 43.38957], [-1.81005, 43.59738], [-10.14298, 44.17365], [-11.19304, 41.83075], [-8.87157, 41.86488], [-8.81794, 41.90375], [-8.75712, 41.92833], [-8.74606, 41.9469], [-8.7478, 41.96282], [-8.69071, 41.98862], [-8.6681, 41.99703], [-8.65832, 42.02972], [-8.64626, 42.03668], [-8.63791, 42.04691], [-8.59493, 42.05708], [-8.58086, 42.05147], [-8.54563, 42.0537], [-8.5252, 42.06264], [-8.52837, 42.07658], [-8.48185, 42.0811], [-8.44123, 42.08218], [-8.42512, 42.07199], [-8.40143, 42.08052], [-8.38323, 42.07683], [-8.36353, 42.09065], [-8.33912, 42.08358], [-8.32161, 42.10218], [-8.29809, 42.106], [-8.2732, 42.12396], [-8.24681, 42.13993], [-8.22406, 42.1328], [-8.1986, 42.15402], [-8.18947, 42.13853], [-8.19406, 42.12141], [-8.18178, 42.06436], [-8.11729, 42.08537], [-8.08847, 42.05767], [-8.08796, 42.01398], [-8.16232, 41.9828], [-8.2185, 41.91237], [-8.19551, 41.87459], [-8.16944, 41.87944], [-8.16455, 41.81753], [-8.0961, 41.81024], [-8.01136, 41.83453], [-7.9804, 41.87337], [-7.92336, 41.8758], [-7.90707, 41.92432], [-7.88751, 41.92553], [-7.88055, 41.84571], [-7.84188, 41.88065], [-7.69848, 41.90977], [-7.65774, 41.88308], [-7.58603, 41.87944], [-7.62188, 41.83089], [-7.52737, 41.83939], [-7.49803, 41.87095], [-7.45566, 41.86488], [-7.44759, 41.84451], [-7.42854, 41.83262], [-7.42864, 41.80589], [-7.37092, 41.85031], [-7.32366, 41.8406], [-7.18677, 41.88793], [-7.18549, 41.97515], [-7.14115, 41.98855], [-7.08574, 41.97401], [-7.07596, 41.94977], [-7.01078, 41.94977], [-6.98144, 41.9728], [-6.95537, 41.96553], [-6.94396, 41.94403], [-6.82174, 41.94493], [-6.81196, 41.99097], [-6.76959, 41.98734], [-6.75004, 41.94129], [-6.61967, 41.94008], [-6.58544, 41.96674], [-6.5447, 41.94371], [-6.56752, 41.88429], [-6.51374, 41.8758], [-6.56426, 41.74219], [-6.54633, 41.68623], [-6.49907, 41.65823], [-6.44204, 41.68258], [-6.29863, 41.66432], [-6.19128, 41.57638], [-6.26777, 41.48796], [-6.3306, 41.37677], [-6.38553, 41.38655], [-6.38551, 41.35274], [-6.55937, 41.24417], [-6.65046, 41.24725], [-6.68286, 41.21641], [-6.69711, 41.1858], [-6.77319, 41.13049], [-6.75655, 41.10187], [-6.79241, 41.05397], [-6.80942, 41.03629], [-6.84781, 41.02692], [-6.88843, 41.03027], [-6.913, 41.03922], [-6.9357, 41.02888], [-6.8527, 40.93958], [-6.84292, 40.89771], [-6.80707, 40.88047], [-6.79892, 40.84842], [-6.82337, 40.84472], [-6.82826, 40.74603], [-6.79567, 40.65955], [-6.84292, 40.56801], [-6.80218, 40.55067], [-6.7973, 40.51723], [-6.84944, 40.46394], [-6.84618, 40.42177], [-6.78426, 40.36468], [-6.80218, 40.33239], [-6.86085, 40.2976], [-6.86085, 40.26776], [-7.00426, 40.23169], [-7.02544, 40.18564], [-7.00589, 40.12087], [-6.94233, 40.10716], [-6.86737, 40.01986], [-6.91463, 39.86618], [-6.97492, 39.81488], [-7.01613, 39.66877], [-7.24707, 39.66576], [-7.33507, 39.64569], [-7.54121, 39.66717], [-7.49477, 39.58794], [-7.2927, 39.45847], [-7.3149, 39.34857], [-7.23403, 39.27579], [-7.23566, 39.20132], [-7.12811, 39.17101], [-7.14929, 39.11287], [-7.10692, 39.10275], [-7.04011, 39.11919], [-6.97004, 39.07619], [-6.95211, 39.0243], [-7.051, 38.907], [-7.03848, 38.87221], [-7.26174, 38.72107], [-7.265, 38.61674], [-7.32529, 38.44336], [-7.15581, 38.27597], [-7.09389, 38.17227], [-6.93418, 38.21454], [-7.00375, 38.01914], [-7.05966, 38.01966], [-7.10366, 38.04404], [-7.12648, 38.00296], [-7.24544, 37.98884], [-7.27314, 37.90145], [-7.33441, 37.81193], [-7.41981, 37.75729], [-7.51759, 37.56119], [-7.46878, 37.47127], [-7.43974, 37.38913], [-7.43227, 37.25152], [-7.41854, 37.23813], [-7.41133, 37.20314], [-7.39769, 37.16868], [-7.37282, 36.96896], [-7.2725, 35.73269], [-5.10878, 36.05227], [-2.27707, 35.35051], [3.75438, 42.33445]], [[-5.27801, 36.14942], [-5.34064, 36.03744], [-5.40526, 36.15488], [-5.34536, 36.15501], [-5.33822, 36.15272], [-5.27801, 36.14942]]], [[[1.99838, 42.44682], [2.01564, 42.45171], [1.99216, 42.46208], [1.98579, 42.47486], [1.99766, 42.4858], [1.98916, 42.49351], [1.98022, 42.49569], [1.97697, 42.48568], [1.97227, 42.48487], [1.97003, 42.48081], [1.96215, 42.47854], [1.95606, 42.45785], [1.96125, 42.45364], [1.98378, 42.44697], [1.99838, 42.44682]]]] } },
20471     { type: "Feature", properties: { wikidata: "Q98059339", nameEn: "Mainland Norway", country: "NO", groups: ["154", "150", "UN"], callingCodes: ["47"] }, geometry: { type: "MultiPolygon", coordinates: [[[[10.40861, 58.38489], [10.64958, 58.89391], [11.08911, 58.98745], [11.15367, 59.07862], [11.34459, 59.11672], [11.4601, 58.99022], [11.45199, 58.89604], [11.65732, 58.90177], [11.8213, 59.24985], [11.69297, 59.59442], [11.92112, 59.69531], [11.87121, 59.86039], [12.15641, 59.8926], [12.36317, 59.99259], [12.52003, 60.13846], [12.59133, 60.50559], [12.2277, 61.02442], [12.69115, 61.06584], [12.86939, 61.35427], [12.57707, 61.56547], [12.40595, 61.57226], [12.14746, 61.7147], [12.29187, 62.25699], [12.07085, 62.6297], [12.19919, 63.00104], [11.98529, 63.27487], [12.19919, 63.47935], [12.14928, 63.59373], [12.74105, 64.02171], [13.23411, 64.09087], [13.98222, 64.00953], [14.16051, 64.18725], [14.11117, 64.46674], [13.64276, 64.58402], [14.50926, 65.31786], [14.53778, 66.12399], [15.05113, 66.15572], [15.49318, 66.28509], [15.37197, 66.48217], [16.35589, 67.06419], [16.39154, 67.21653], [16.09922, 67.4364], [16.12774, 67.52106], [16.38441, 67.52923], [16.7409, 67.91037], [17.30416, 68.11591], [17.90787, 67.96537], [18.13836, 68.20874], [18.1241, 68.53721], [18.39503, 68.58672], [18.63032, 68.50849], [18.97255, 68.52416], [19.93508, 68.35911], [20.22027, 68.48759], [19.95647, 68.55546], [20.22027, 68.67246], [20.33435, 68.80174], [20.28444, 68.93283], [20.0695, 69.04469], [20.55258, 69.06069], [20.72171, 69.11874], [21.05775, 69.0356], [21.11099, 69.10291], [20.98641, 69.18809], [21.00732, 69.22755], [21.27827, 69.31281], [21.63833, 69.27485], [22.27276, 68.89514], [22.38367, 68.71561], [22.53321, 68.74393], [23.13064, 68.64684], [23.68017, 68.70276], [23.781, 68.84514], [24.02299, 68.81601], [24.18432, 68.73936], [24.74898, 68.65143], [24.90023, 68.55579], [24.93048, 68.61102], [25.10189, 68.63307], [25.12206, 68.78684], [25.42455, 68.90328], [25.61613, 68.89602], [25.75729, 68.99383], [25.69679, 69.27039], [25.96904, 69.68397], [26.40261, 69.91377], [26.64461, 69.96565], [27.05802, 69.92069], [27.57226, 70.06215], [27.95542, 70.0965], [27.97558, 69.99671], [28.32849, 69.88605], [28.36883, 69.81658], [29.12697, 69.69193], [29.31664, 69.47994], [28.8629, 69.22395], [28.81248, 69.11997], [28.91738, 69.04774], [29.0444, 69.0119], [29.26623, 69.13794], [29.27631, 69.2811], [29.97205, 69.41623], [30.16363, 69.65244], [30.52662, 69.54699], [30.95011, 69.54699], [30.84095, 69.80584], [31.59909, 70.16571], [32.07813, 72.01005], [-11.60274, 67.73467], [7.28637, 57.35913], [10.40861, 58.38489]]]] } },
20472     { type: "Feature", properties: { wikidata: "Q98543636", nameEn: "Mainland Ecuador", country: "EC", groups: ["005", "419", "019", "UN"], callingCodes: ["593"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-84.52388, -3.36941], [-80.30602, -3.39149], [-80.20647, -3.431], [-80.24123, -3.46124], [-80.24586, -3.48677], [-80.23651, -3.48652], [-80.22629, -3.501], [-80.20535, -3.51667], [-80.21642, -3.5888], [-80.19848, -3.59249], [-80.18741, -3.63994], [-80.19926, -3.68894], [-80.13232, -3.90317], [-80.46386, -4.01342], [-80.4822, -4.05477], [-80.45023, -4.20938], [-80.32114, -4.21323], [-80.46386, -4.41516], [-80.39256, -4.48269], [-80.13945, -4.29786], [-79.79722, -4.47558], [-79.59402, -4.46848], [-79.26248, -4.95167], [-79.1162, -4.97774], [-79.01659, -5.01481], [-78.85149, -4.66795], [-78.68394, -4.60754], [-78.34362, -3.38633], [-78.24589, -3.39907], [-78.22642, -3.51113], [-78.14324, -3.47653], [-78.19369, -3.36431], [-77.94147, -3.05454], [-76.6324, -2.58397], [-76.05203, -2.12179], [-75.57429, -1.55961], [-75.3872, -0.9374], [-75.22862, -0.95588], [-75.22862, -0.60048], [-75.53615, -0.19213], [-75.60169, -0.18708], [-75.61997, -0.10012], [-75.40192, -0.17196], [-75.25764, -0.11943], [-75.82927, 0.09578], [-76.23441, 0.42294], [-76.41215, 0.38228], [-76.4094, 0.24015], [-76.89177, 0.24736], [-77.52001, 0.40782], [-77.49984, 0.64476], [-77.67815, 0.73863], [-77.66416, 0.81604], [-77.68613, 0.83029], [-77.7148, 0.85003], [-77.85677, 0.80197], [-78.42749, 1.15389], [-78.87137, 1.47457], [-82.12561, 4.00341], [-84.52388, -3.36941]]]] } },
20473     { type: "Feature", properties: { m49: "001", wikidata: "Q2", nameEn: "World", aliases: ["Earth", "Planet"], level: "world" }, geometry: null },
20474     { type: "Feature", properties: { m49: "002", wikidata: "Q15", nameEn: "Africa", level: "region" }, geometry: null },
20475     { type: "Feature", properties: { m49: "003", wikidata: "Q49", nameEn: "North America", level: "subregion" }, geometry: null },
20476     { type: "Feature", properties: { m49: "005", wikidata: "Q18", nameEn: "South America", level: "intermediateRegion" }, geometry: null },
20477     { type: "Feature", properties: { m49: "009", wikidata: "Q538", nameEn: "Oceania", level: "region" }, geometry: null },
20478     { type: "Feature", properties: { m49: "011", wikidata: "Q4412", nameEn: "Western Africa", level: "intermediateRegion" }, geometry: null },
20479     { type: "Feature", properties: { m49: "013", wikidata: "Q27611", nameEn: "Central America", level: "intermediateRegion" }, geometry: null },
20480     { type: "Feature", properties: { m49: "014", wikidata: "Q27407", nameEn: "Eastern Africa", level: "intermediateRegion" }, geometry: null },
20481     { type: "Feature", properties: { m49: "015", wikidata: "Q27381", nameEn: "Northern Africa", level: "subregion" }, geometry: null },
20482     { type: "Feature", properties: { m49: "017", wikidata: "Q27433", nameEn: "Middle Africa", level: "intermediateRegion" }, geometry: null },
20483     { type: "Feature", properties: { m49: "018", wikidata: "Q27394", nameEn: "Southern Africa", level: "intermediateRegion" }, geometry: null },
20484     { type: "Feature", properties: { m49: "019", wikidata: "Q828", nameEn: "Americas", level: "region" }, geometry: null },
20485     { type: "Feature", properties: { m49: "021", wikidata: "Q2017699", nameEn: "Northern America", level: "subregion" }, geometry: null },
20486     { type: "Feature", properties: { m49: "029", wikidata: "Q664609", nameEn: "Caribbean", level: "intermediateRegion" }, geometry: null },
20487     { type: "Feature", properties: { m49: "030", wikidata: "Q27231", nameEn: "Eastern Asia", level: "subregion" }, geometry: null },
20488     { type: "Feature", properties: { m49: "034", wikidata: "Q771405", nameEn: "Southern Asia", level: "subregion" }, geometry: null },
20489     { type: "Feature", properties: { m49: "035", wikidata: "Q11708", nameEn: "South-eastern Asia", level: "subregion" }, geometry: null },
20490     { type: "Feature", properties: { m49: "039", wikidata: "Q27449", nameEn: "Southern Europe", level: "subregion" }, geometry: null },
20491     { type: "Feature", properties: { m49: "053", wikidata: "Q45256", nameEn: "Australia and New Zealand", aliases: ["Australasia"], level: "subregion" }, geometry: null },
20492     { type: "Feature", properties: { m49: "054", wikidata: "Q37394", nameEn: "Melanesia", level: "subregion" }, geometry: null },
20493     { type: "Feature", properties: { m49: "057", wikidata: "Q3359409", nameEn: "Micronesia", level: "subregion" }, geometry: null },
20494     { type: "Feature", properties: { m49: "061", wikidata: "Q35942", nameEn: "Polynesia", level: "subregion" }, geometry: null },
20495     { type: "Feature", properties: { m49: "142", wikidata: "Q48", nameEn: "Asia", level: "region" }, geometry: null },
20496     { type: "Feature", properties: { m49: "143", wikidata: "Q27275", nameEn: "Central Asia", level: "subregion" }, geometry: null },
20497     { type: "Feature", properties: { m49: "145", wikidata: "Q27293", nameEn: "Western Asia", level: "subregion" }, geometry: null },
20498     { type: "Feature", properties: { m49: "150", wikidata: "Q46", nameEn: "Europe", level: "region" }, geometry: null },
20499     { type: "Feature", properties: { m49: "151", wikidata: "Q27468", nameEn: "Eastern Europe", level: "subregion" }, geometry: null },
20500     { type: "Feature", properties: { m49: "154", wikidata: "Q27479", nameEn: "Northern Europe", level: "subregion" }, geometry: null },
20501     { type: "Feature", properties: { m49: "155", wikidata: "Q27496", nameEn: "Western Europe", level: "subregion" }, geometry: null },
20502     { type: "Feature", properties: { m49: "202", wikidata: "Q132959", nameEn: "Sub-Saharan Africa", level: "subregion" }, geometry: null },
20503     { type: "Feature", properties: { m49: "419", wikidata: "Q72829598", nameEn: "Latin America and the Caribbean", level: "subregion" }, geometry: null },
20504     { type: "Feature", properties: { m49: "830", wikidata: "Q42314", nameEn: "Channel Islands", level: "intermediateRegion" }, geometry: null },
20505     { type: "Feature", properties: { iso1A2: "AC", iso1A3: "ASC", wikidata: "Q46197", nameEn: "Ascension Island", aliases: ["SH-AC"], country: "GB", groups: ["SH", "BOTS", "011", "202", "002", "UN"], isoStatus: "excRes", driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["247"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-14.82771, -8.70814], [-13.33271, -8.07391], [-14.91926, -6.63386], [-14.82771, -8.70814]]]] } },
20506     { type: "Feature", properties: { iso1A2: "AD", iso1A3: "AND", iso1N3: "020", wikidata: "Q228", nameEn: "Andorra", groups: ["Q12837", "039", "150", "UN"], callingCodes: ["376"] }, geometry: { type: "MultiPolygon", coordinates: [[[[1.72515, 42.50338], [1.73683, 42.55492], [1.7858, 42.57698], [1.72588, 42.59098], [1.73452, 42.61515], [1.68267, 42.62533], [1.6625, 42.61982], [1.63485, 42.62957], [1.60085, 42.62703], [1.55418, 42.65669], [1.50867, 42.64483], [1.48043, 42.65203], [1.46718, 42.63296], [1.47986, 42.61346], [1.44197, 42.60217], [1.42512, 42.58292], [1.44529, 42.56722], [1.4234, 42.55959], [1.41245, 42.53539], [1.44759, 42.54431], [1.46661, 42.50949], [1.41648, 42.48315], [1.43838, 42.47848], [1.44529, 42.43724], [1.5127, 42.42959], [1.55073, 42.43299], [1.55937, 42.45808], [1.57953, 42.44957], [1.58933, 42.46275], [1.65674, 42.47125], [1.66826, 42.50779], [1.70571, 42.48867], [1.72515, 42.50338]]]] } },
20507     { type: "Feature", properties: { iso1A2: "AE", iso1A3: "ARE", iso1N3: "784", wikidata: "Q878", nameEn: "United Arab Emirates", groups: ["145", "142", "UN"], callingCodes: ["971"] }, geometry: { type: "MultiPolygon", coordinates: [[[[56.26534, 25.62825], [56.25341, 25.61443], [56.26636, 25.60643], [56.25365, 25.60211], [56.20473, 25.61119], [56.18363, 25.65508], [56.14826, 25.66351], [56.13579, 25.73524], [56.17416, 25.77239], [56.13963, 25.82765], [56.19334, 25.9795], [56.15498, 26.06828], [56.08666, 26.05038], [55.81777, 26.18798], [55.14145, 25.62624], [53.97892, 24.64436], [52.82259, 25.51697], [52.35509, 25.00368], [52.02277, 24.75635], [51.83108, 24.71675], [51.58834, 24.66608], [51.41644, 24.39615], [51.58871, 24.27256], [51.59617, 24.12041], [52.56622, 22.94341], [55.13599, 22.63334], [55.2137, 22.71065], [55.22634, 23.10378], [55.57358, 23.669], [55.48677, 23.94946], [55.73301, 24.05994], [55.8308, 24.01633], [56.01799, 24.07426], [55.95472, 24.2172], [55.83367, 24.20193], [55.77658, 24.23476], [55.76558, 24.23227], [55.75257, 24.23466], [55.75382, 24.2466], [55.75939, 24.26114], [55.76781, 24.26209], [55.79145, 24.27914], [55.80747, 24.31069], [55.83395, 24.32776], [55.83271, 24.41521], [55.76461, 24.5287], [55.83271, 24.68567], [55.83408, 24.77858], [55.81348, 24.80102], [55.81116, 24.9116], [55.85094, 24.96858], [55.90849, 24.96771], [55.96316, 25.00857], [56.05715, 24.95727], [56.05106, 24.87461], [55.97467, 24.89639], [55.97836, 24.87673], [56.03535, 24.81161], [56.06128, 24.74457], [56.13684, 24.73699], [56.20062, 24.78565], [56.20568, 24.85063], [56.30269, 24.88334], [56.34873, 24.93205], [56.3227, 24.97284], [56.86325, 25.03856], [56.82555, 25.7713], [56.26534, 25.62825]], [[56.26062, 25.33108], [56.3005, 25.31815], [56.3111, 25.30107], [56.35172, 25.30681], [56.34438, 25.26653], [56.27628, 25.23404], [56.24341, 25.22867], [56.20872, 25.24104], [56.20838, 25.25668], [56.24465, 25.27505], [56.25008, 25.28843], [56.23362, 25.31253], [56.26062, 25.33108]]], [[[56.28423, 25.26344], [56.29379, 25.2754], [56.28102, 25.28486], [56.2716, 25.27916], [56.27086, 25.26128], [56.28423, 25.26344]]]] } },
20508     { type: "Feature", properties: { iso1A2: "AF", iso1A3: "AFG", iso1N3: "004", wikidata: "Q889", nameEn: "Afghanistan", groups: ["034", "142", "UN"], callingCodes: ["93"] }, geometry: { type: "MultiPolygon", coordinates: [[[[70.61526, 38.34774], [70.60407, 38.28046], [70.54673, 38.24541], [70.4898, 38.12546], [70.17206, 37.93276], [70.1863, 37.84296], [70.27694, 37.81258], [70.28243, 37.66706], [70.15015, 37.52519], [69.95971, 37.5659], [69.93362, 37.61378], [69.84435, 37.60616], [69.80041, 37.5746], [69.51888, 37.5844], [69.44954, 37.4869], [69.36645, 37.40462], [69.45022, 37.23315], [69.39529, 37.16752], [69.25152, 37.09426], [69.03274, 37.25174], [68.96407, 37.32603], [68.88168, 37.33368], [68.91189, 37.26704], [68.80889, 37.32494], [68.81438, 37.23862], [68.6798, 37.27906], [68.61851, 37.19815], [68.41888, 37.13906], [68.41201, 37.10402], [68.29253, 37.10621], [68.27605, 37.00977], [68.18542, 37.02074], [68.02194, 36.91923], [67.87917, 37.0591], [67.7803, 37.08978], [67.78329, 37.1834], [67.51868, 37.26102], [67.2581, 37.17216], [67.2224, 37.24545], [67.13039, 37.27168], [67.08232, 37.35469], [66.95598, 37.40162], [66.64699, 37.32958], [66.55743, 37.35409], [66.30993, 37.32409], [65.72274, 37.55438], [65.64137, 37.45061], [65.64263, 37.34388], [65.51778, 37.23881], [64.97945, 37.21913], [64.61141, 36.6351], [64.62514, 36.44311], [64.57295, 36.34362], [64.43288, 36.24401], [64.05385, 36.10433], [63.98519, 36.03773], [63.56496, 35.95106], [63.53475, 35.90881], [63.29579, 35.85985], [63.12276, 35.86208], [63.10318, 35.81782], [63.23262, 35.67487], [63.10079, 35.63024], [63.12276, 35.53196], [63.0898, 35.43131], [62.90853, 35.37086], [62.74098, 35.25432], [62.62288, 35.22067], [62.48006, 35.28796], [62.29878, 35.13312], [62.29191, 35.25964], [62.15871, 35.33278], [62.05709, 35.43803], [61.97743, 35.4604], [61.77693, 35.41341], [61.58742, 35.43803], [61.27371, 35.61482], [61.18187, 35.30249], [61.0991, 35.27845], [61.12831, 35.09938], [61.06926, 34.82139], [61.00197, 34.70631], [60.99922, 34.63064], [60.72316, 34.52857], [60.91321, 34.30411], [60.66502, 34.31539], [60.50209, 34.13992], [60.5838, 33.80793], [60.5485, 33.73422], [60.57762, 33.59772], [60.69573, 33.56054], [60.91133, 33.55596], [60.88908, 33.50219], [60.56485, 33.12944], [60.86191, 32.22565], [60.84541, 31.49561], [61.70929, 31.37391], [61.80569, 31.16167], [61.80957, 31.12576], [61.83257, 31.0452], [61.8335, 30.97669], [61.78268, 30.92724], [61.80829, 30.84224], [60.87231, 29.86514], [62.47751, 29.40782], [63.5876, 29.50456], [64.12966, 29.39157], [64.19796, 29.50407], [64.62116, 29.58903], [65.04005, 29.53957], [66.24175, 29.85181], [66.36042, 29.9583], [66.23609, 30.06321], [66.34869, 30.404], [66.28413, 30.57001], [66.39194, 30.9408], [66.42645, 30.95309], [66.58175, 30.97532], [66.68166, 31.07597], [66.72561, 31.20526], [66.83273, 31.26867], [67.04147, 31.31561], [67.03323, 31.24519], [67.29964, 31.19586], [67.78854, 31.33203], [67.7748, 31.4188], [67.62374, 31.40473], [67.58323, 31.52772], [67.72056, 31.52304], [67.86887, 31.63536], [68.00071, 31.6564], [68.1655, 31.82691], [68.25614, 31.80357], [68.27605, 31.75863], [68.44222, 31.76446], [68.57475, 31.83158], [68.6956, 31.75687], [68.79997, 31.61665], [68.91078, 31.59687], [68.95995, 31.64822], [69.00939, 31.62249], [69.11514, 31.70782], [69.20577, 31.85957], [69.3225, 31.93186], [69.27032, 32.14141], [69.27932, 32.29119], [69.23599, 32.45946], [69.2868, 32.53938], [69.38155, 32.56601], [69.44747, 32.6678], [69.43649, 32.7302], [69.38018, 32.76601], [69.47082, 32.85834], [69.5436, 32.8768], [69.49854, 32.88843], [69.49004, 33.01509], [69.57656, 33.09911], [69.71526, 33.09911], [69.79766, 33.13247], [69.85259, 33.09451], [70.02563, 33.14282], [70.07369, 33.22557], [70.13686, 33.21064], [70.32775, 33.34496], [70.17062, 33.53535], [70.20141, 33.64387], [70.14785, 33.6553], [70.14236, 33.71701], [70.00503, 33.73528], [69.85671, 33.93719], [69.87307, 33.9689], [69.90203, 34.04194], [70.54336, 33.9463], [70.88119, 33.97933], [71.07345, 34.06242], [71.06933, 34.10564], [71.09307, 34.11961], [71.09453, 34.13524], [71.13078, 34.16503], [71.12815, 34.26619], [71.17662, 34.36769], [71.02401, 34.44835], [71.0089, 34.54568], [71.11602, 34.63047], [71.08718, 34.69034], [71.28356, 34.80882], [71.29472, 34.87728], [71.50329, 34.97328], [71.49917, 35.00478], [71.55273, 35.02615], [71.52938, 35.09023], [71.67495, 35.21262], [71.5541, 35.28776], [71.54294, 35.31037], [71.65435, 35.4479], [71.49917, 35.6267], [71.55273, 35.71483], [71.37969, 35.95865], [71.19505, 36.04134], [71.60491, 36.39429], [71.80267, 36.49924], [72.18135, 36.71838], [72.6323, 36.84601], [73.82685, 36.91421], [74.04856, 36.82648], [74.43389, 37.00977], [74.53739, 36.96224], [74.56453, 37.03023], [74.49981, 37.24518], [74.80605, 37.21565], [74.88887, 37.23275], [74.8294, 37.3435], [74.68383, 37.3948], [74.56161, 37.37734], [74.41055, 37.3948], [74.23339, 37.41116], [74.20308, 37.34208], [73.8564, 37.26158], [73.82552, 37.22659], [73.64974, 37.23643], [73.61129, 37.27469], [73.76647, 37.33913], [73.77197, 37.4417], [73.29633, 37.46495], [73.06884, 37.31729], [72.79693, 37.22222], [72.66381, 37.02014], [72.54095, 37.00007], [72.31676, 36.98115], [71.83229, 36.68084], [71.67083, 36.67346], [71.57195, 36.74943], [71.51502, 36.89128], [71.48481, 36.93218], [71.46923, 36.99925], [71.45578, 37.03094], [71.43097, 37.05855], [71.44127, 37.11856], [71.4494, 37.18137], [71.4555, 37.21418], [71.47386, 37.2269], [71.48339, 37.23937], [71.4824, 37.24921], [71.48536, 37.26017], [71.50674, 37.31502], [71.49821, 37.31975], [71.4862, 37.33405], [71.47685, 37.40281], [71.49612, 37.4279], [71.5256, 37.47971], [71.50616, 37.50733], [71.49693, 37.53527], [71.5065, 37.60912], [71.51972, 37.61945], [71.54186, 37.69691], [71.55234, 37.73209], [71.53053, 37.76534], [71.54324, 37.77104], [71.55752, 37.78677], [71.59255, 37.79956], [71.58843, 37.92425], [71.51565, 37.95349], [71.32871, 37.88564], [71.296, 37.93403], [71.2809, 37.91995], [71.24969, 37.93031], [71.27278, 37.96496], [71.27622, 37.99946], [71.28922, 38.01272], [71.29878, 38.04429], [71.36444, 38.15358], [71.37803, 38.25641], [71.33869, 38.27335], [71.33114, 38.30339], [71.21291, 38.32797], [71.1451, 38.40106], [71.10957, 38.40671], [71.10592, 38.42077], [71.09542, 38.42517], [71.0556, 38.40176], [71.03545, 38.44779], [70.98693, 38.48862], [70.92728, 38.43021], [70.88719, 38.46826], [70.84376, 38.44688], [70.82538, 38.45394], [70.81697, 38.44507], [70.80521, 38.44447], [70.79766, 38.44944], [70.78702, 38.45031], [70.78581, 38.45502], [70.77132, 38.45548], [70.75455, 38.4252], [70.72485, 38.4131], [70.69807, 38.41861], [70.67438, 38.40597], [70.6761, 38.39144], [70.69189, 38.37031], [70.64966, 38.34999], [70.61526, 38.34774]]]] } },
20509     { type: "Feature", properties: { iso1A2: "AG", iso1A3: "ATG", iso1N3: "028", wikidata: "Q781", nameEn: "Antigua and Barbuda", groups: ["029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", callingCodes: ["1 268"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-61.66959, 18.6782], [-62.58307, 16.68909], [-62.1023, 16.97277], [-61.23098, 16.62484], [-61.66959, 18.6782]]]] } },
20510     { type: "Feature", properties: { iso1A2: "AI", iso1A3: "AIA", iso1N3: "660", wikidata: "Q25228", nameEn: "Anguilla", country: "GB", groups: ["BOTS", "029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", callingCodes: ["1 264"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-63.79029, 19.11219], [-63.35989, 18.06012], [-62.62718, 18.26185], [-63.79029, 19.11219]]]] } },
20511     { type: "Feature", properties: { iso1A2: "AL", iso1A3: "ALB", iso1N3: "008", wikidata: "Q222", nameEn: "Albania", groups: ["039", "150", "UN"], callingCodes: ["355"] }, geometry: { type: "MultiPolygon", coordinates: [[[[20.07761, 42.55582], [20.01834, 42.54622], [20.00842, 42.5109], [19.9324, 42.51699], [19.82333, 42.46581], [19.76549, 42.50237], [19.74731, 42.57422], [19.77375, 42.58517], [19.73244, 42.66299], [19.65972, 42.62774], [19.4836, 42.40831], [19.42352, 42.36546], [19.42, 42.33019], [19.28623, 42.17745], [19.40687, 42.10024], [19.37548, 42.06835], [19.36867, 42.02564], [19.37691, 41.96977], [19.34601, 41.95675], [19.33812, 41.90669], [19.37451, 41.8842], [19.37597, 41.84849], [19.26406, 41.74971], [19.0384, 40.35325], [19.95905, 39.82857], [19.97622, 39.78684], [19.92466, 39.69533], [19.98042, 39.6504], [20.00957, 39.69227], [20.05189, 39.69112], [20.12956, 39.65805], [20.15988, 39.652], [20.22376, 39.64532], [20.22707, 39.67459], [20.27412, 39.69884], [20.31961, 39.72799], [20.29152, 39.80421], [20.30804, 39.81563], [20.38572, 39.78516], [20.41475, 39.81437], [20.41546, 39.82832], [20.31135, 39.99438], [20.37911, 39.99058], [20.42373, 40.06777], [20.48487, 40.06271], [20.51297, 40.08168], [20.55593, 40.06524], [20.61081, 40.07866], [20.62566, 40.0897], [20.67162, 40.09433], [20.71789, 40.27739], [20.78234, 40.35803], [20.7906, 40.42726], [20.83688, 40.47882], [20.94925, 40.46625], [20.96908, 40.51526], [21.03932, 40.56299], [21.05833, 40.66586], [20.98134, 40.76046], [20.95752, 40.76982], [20.98396, 40.79109], [20.97887, 40.85475], [20.97693, 40.90103], [20.94305, 40.92399], [20.83671, 40.92752], [20.81567, 40.89662], [20.73504, 40.9081], [20.71634, 40.91781], [20.65558, 41.08009], [20.63454, 41.0889], [20.59832, 41.09066], [20.58546, 41.11179], [20.59715, 41.13644], [20.51068, 41.2323], [20.49432, 41.33679], [20.52119, 41.34381], [20.55976, 41.4087], [20.51301, 41.442], [20.49039, 41.49277], [20.45331, 41.51436], [20.45809, 41.5549], [20.52103, 41.56473], [20.55508, 41.58113], [20.51769, 41.65975], [20.52937, 41.69292], [20.51301, 41.72433], [20.53405, 41.78099], [20.57144, 41.7897], [20.55976, 41.87068], [20.59524, 41.8818], [20.57946, 41.91593], [20.63069, 41.94913], [20.59434, 42.03879], [20.55633, 42.08173], [20.56955, 42.12097], [20.48857, 42.25444], [20.3819, 42.3029], [20.34479, 42.32656], [20.24399, 42.32168], [20.21797, 42.41237], [20.17127, 42.50469], [20.07761, 42.55582]]]] } },
20512     { type: "Feature", properties: { iso1A2: "AM", iso1A3: "ARM", iso1N3: "051", wikidata: "Q399", nameEn: "Armenia", groups: ["145", "142", "UN"], callingCodes: ["374"] }, geometry: { type: "MultiPolygon", coordinates: [[[[45.0133, 41.29747], [44.93493, 41.25685], [44.81437, 41.30371], [44.80053, 41.25949], [44.81749, 41.23488], [44.84358, 41.23088], [44.89911, 41.21366], [44.87887, 41.20195], [44.82084, 41.21513], [44.72814, 41.20338], [44.61462, 41.24018], [44.59322, 41.1933], [44.46791, 41.18204], [44.34417, 41.2382], [44.34337, 41.20312], [44.32139, 41.2079], [44.18148, 41.24644], [44.16591, 41.19141], [43.84835, 41.16329], [43.74717, 41.1117], [43.67712, 41.13398], [43.4717, 41.12611], [43.44984, 41.0988], [43.47319, 41.02251], [43.58683, 40.98961], [43.67712, 40.93084], [43.67712, 40.84846], [43.74872, 40.7365], [43.7425, 40.66805], [43.63664, 40.54159], [43.54791, 40.47413], [43.60862, 40.43267], [43.59928, 40.34019], [43.71136, 40.16673], [43.65221, 40.14889], [43.65688, 40.11199], [43.92307, 40.01787], [44.1057, 40.03555], [44.1778, 40.02845], [44.26973, 40.04866], [44.46635, 39.97733], [44.61845, 39.8281], [44.75779, 39.7148], [44.88354, 39.74432], [44.92869, 39.72157], [45.06604, 39.79277], [45.18554, 39.67846], [45.17464, 39.58614], [45.21784, 39.58074], [45.23535, 39.61373], [45.30385, 39.61373], [45.29606, 39.57654], [45.46992, 39.49888], [45.70547, 39.60174], [45.80804, 39.56716], [45.83, 39.46487], [45.79225, 39.3695], [45.99774, 39.28931], [46.02303, 39.09978], [46.06973, 39.0744], [46.14785, 38.84206], [46.20601, 38.85262], [46.34059, 38.92076], [46.53497, 38.86548], [46.51805, 38.94982], [46.54296, 39.07078], [46.44022, 39.19636], [46.52584, 39.18912], [46.54141, 39.15895], [46.58032, 39.21204], [46.63481, 39.23013], [46.56476, 39.24942], [46.50093, 39.33736], [46.43244, 39.35181], [46.37795, 39.42039], [46.4013, 39.45405], [46.53051, 39.47809], [46.51027, 39.52373], [46.57721, 39.54414], [46.57098, 39.56694], [46.52117, 39.58734], [46.42465, 39.57534], [46.40286, 39.63651], [46.18493, 39.60533], [45.96543, 39.78859], [45.82533, 39.82925], [45.7833, 39.9475], [45.60895, 39.97733], [45.59806, 40.0131], [45.78642, 40.03218], [45.83779, 39.98925], [45.97944, 40.181], [45.95609, 40.27846], [45.65098, 40.37696], [45.42994, 40.53804], [45.45484, 40.57707], [45.35366, 40.65979], [45.4206, 40.7424], [45.55914, 40.78366], [45.60584, 40.87436], [45.40814, 40.97904], [45.44083, 41.01663], [45.39725, 41.02603], [45.35677, 40.99784], [45.28859, 41.03757], [45.26162, 41.0228], [45.25897, 41.0027], [45.1994, 41.04518], [45.16493, 41.05068], [45.1634, 41.08082], [45.1313, 41.09369], [45.12923, 41.06059], [45.06784, 41.05379], [45.08028, 41.10917], [45.19942, 41.13299], [45.1969, 41.168], [45.11811, 41.19967], [45.05201, 41.19211], [45.02932, 41.2101], [45.05497, 41.2464], [45.0133, 41.29747]], [[45.21324, 40.9817], [45.21219, 40.99001], [45.20518, 40.99348], [45.19312, 40.98998], [45.18382, 41.0066], [45.20625, 41.01484], [45.23487, 41.00226], [45.23095, 40.97828], [45.21324, 40.9817]], [[45.00864, 41.03411], [44.9903, 41.05657], [44.96031, 41.06345], [44.95383, 41.07553], [44.97169, 41.09176], [45.00864, 41.09407], [45.03406, 41.07931], [45.04517, 41.06653], [45.03792, 41.03938], [45.00864, 41.03411]]], [[[45.50279, 40.58424], [45.56071, 40.64765], [45.51825, 40.67382], [45.47927, 40.65023], [45.50279, 40.58424]]]] } },
20513     { type: "Feature", properties: { iso1A2: "AO", iso1A3: "AGO", iso1N3: "024", wikidata: "Q916", nameEn: "Angola", groups: ["017", "202", "002", "UN"], callingCodes: ["244"] }, geometry: { type: "MultiPolygon", coordinates: [[[[16.55507, -5.85631], [13.04371, -5.87078], [12.42245, -6.07585], [11.95767, -5.94705], [12.20376, -5.76338], [12.26557, -5.74031], [12.52318, -5.74353], [12.52301, -5.17481], [12.53599, -5.1618], [12.53586, -5.14658], [12.51589, -5.1332], [12.49815, -5.14058], [12.46297, -5.09408], [12.60251, -5.01715], [12.63465, -4.94632], [12.70868, -4.95505], [12.8733, -4.74346], [13.11195, -4.67745], [13.09648, -4.63739], [12.91489, -4.47907], [12.87096, -4.40315], [12.76844, -4.38709], [12.64835, -4.55937], [12.40964, -4.60609], [12.32324, -4.78415], [12.25587, -4.79437], [12.20901, -4.75642], [12.16068, -4.90089], [12.00924, -5.02627], [11.50888, -5.33417], [10.5065, -17.25284], [11.75063, -17.25013], [12.07076, -17.15165], [12.52111, -17.24495], [12.97145, -16.98567], [13.36212, -16.98048], [13.95896, -17.43141], [14.28743, -17.38814], [18.39229, -17.38927], [18.84226, -17.80375], [21.14283, -17.94318], [21.42741, -18.02787], [23.47474, -17.62877], [23.20038, -17.47563], [22.17217, -16.50269], [22.00323, -16.18028], [21.97988, -13.00148], [24.03339, -12.99091], [23.90937, -12.844], [24.06672, -12.29058], [23.98804, -12.13149], [24.02603, -11.15368], [24.00027, -10.89356], [23.86868, -11.02856], [23.45631, -10.946], [23.16602, -11.10577], [22.54205, -11.05784], [22.25951, -11.24911], [22.17954, -10.85884], [22.32604, -10.76291], [22.19039, -9.94628], [21.84856, -9.59871], [21.79824, -7.29628], [20.56263, -7.28566], [20.61689, -6.90876], [20.31846, -6.91953], [20.30218, -6.98955], [19.5469, -7.00195], [19.33698, -7.99743], [18.33635, -8.00126], [17.5828, -8.13784], [16.96282, -7.21787], [16.55507, -5.85631]]]] } },
20514     { type: "Feature", properties: { iso1A2: "AQ", iso1A3: "ATA", iso1N3: "010", wikidata: "Q51", nameEn: "Antarctica", level: "region", callingCodes: ["672"] }, geometry: { type: "MultiPolygon", coordinates: [[[[180, -60], [-180, -60], [-180, -90], [180, -90], [180, -60]]]] } },
20515     { type: "Feature", properties: { iso1A2: "AR", iso1A3: "ARG", iso1N3: "032", wikidata: "Q414", nameEn: "Argentina", aliases: ["RA"], groups: ["005", "419", "019", "UN"], callingCodes: ["54"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-72.31343, -50.58411], [-72.33873, -51.59954], [-71.99889, -51.98018], [-69.97824, -52.00845], [-68.41683, -52.33516], [-68.60702, -52.65781], [-68.60733, -54.9125], [-68.01394, -54.8753], [-67.46182, -54.92205], [-67.11046, -54.94199], [-66.07313, -55.19618], [-63.67376, -55.11859], [-54.78916, -36.21945], [-57.83001, -34.69099], [-58.34425, -34.15035], [-58.44442, -33.84033], [-58.40475, -33.11777], [-58.1224, -32.98842], [-58.22362, -32.52416], [-58.10036, -32.25338], [-58.20252, -31.86966], [-58.00076, -31.65016], [-58.0023, -31.53084], [-58.07569, -31.44916], [-57.98127, -31.3872], [-57.9908, -31.34924], [-57.86729, -31.06352], [-57.89476, -30.95994], [-57.8024, -30.77193], [-57.89115, -30.49572], [-57.64859, -30.35095], [-57.61478, -30.25165], [-57.65132, -30.19229], [-57.09386, -29.74211], [-56.81251, -29.48154], [-56.62789, -29.18073], [-56.57295, -29.11357], [-56.54171, -29.11447], [-56.05265, -28.62651], [-56.00458, -28.60421], [-56.01729, -28.51223], [-55.65418, -28.18304], [-55.6262, -28.17124], [-55.33303, -27.94661], [-55.16872, -27.86224], [-55.1349, -27.89759], [-54.90805, -27.73149], [-54.90159, -27.63132], [-54.67657, -27.57214], [-54.50416, -27.48232], [-54.41888, -27.40882], [-54.19268, -27.30751], [-54.19062, -27.27639], [-54.15978, -27.2889], [-53.80144, -27.09844], [-53.73372, -26.6131], [-53.68269, -26.33359], [-53.64505, -26.28089], [-53.64186, -26.25976], [-53.64632, -26.24798], [-53.63881, -26.25075], [-53.63739, -26.2496], [-53.65237, -26.23289], [-53.65018, -26.19501], [-53.73968, -26.10012], [-53.73391, -26.07006], [-53.7264, -26.0664], [-53.73086, -26.05842], [-53.73511, -26.04211], [-53.83691, -25.94849], [-53.90831, -25.55513], [-54.52926, -25.62846], [-54.5502, -25.58915], [-54.59398, -25.59224], [-54.62063, -25.91213], [-54.60664, -25.9691], [-54.67359, -25.98607], [-54.69333, -26.37705], [-54.70732, -26.45099], [-54.80868, -26.55669], [-55.00584, -26.78754], [-55.06351, -26.80195], [-55.16948, -26.96068], [-55.25243, -26.93808], [-55.39611, -26.97679], [-55.62322, -27.1941], [-55.59094, -27.32444], [-55.74475, -27.44485], [-55.89195, -27.3467], [-56.18313, -27.29851], [-56.85337, -27.5165], [-58.04205, -27.2387], [-58.59549, -27.29973], [-58.65321, -27.14028], [-58.3198, -26.83443], [-58.1188, -26.16704], [-57.87176, -25.93604], [-57.57431, -25.47269], [-57.80821, -25.13863], [-58.25492, -24.92528], [-58.33055, -24.97099], [-59.33886, -24.49935], [-59.45482, -24.34787], [-60.03367, -24.00701], [-60.28163, -24.04436], [-60.99754, -23.80934], [-61.0782, -23.62932], [-61.9756, -23.0507], [-62.22768, -22.55807], [-62.51761, -22.37684], [-62.64455, -22.25091], [-62.8078, -22.12534], [-62.81124, -21.9987], [-63.66482, -21.99918], [-63.68113, -22.0544], [-63.70963, -21.99934], [-63.93287, -21.99934], [-64.22918, -22.55807], [-64.31489, -22.88824], [-64.35108, -22.73282], [-64.4176, -22.67692], [-64.58888, -22.25035], [-64.67174, -22.18957], [-64.90014, -22.12136], [-64.99524, -22.08255], [-65.47435, -22.08908], [-65.57743, -22.07675], [-65.58694, -22.09794], [-65.61166, -22.09504], [-65.7467, -22.10105], [-65.9261, -21.93335], [-66.04832, -21.9187], [-66.03836, -21.84829], [-66.24077, -21.77837], [-66.29714, -22.08741], [-66.7298, -22.23644], [-67.18382, -22.81525], [-66.99632, -22.99839], [-67.33563, -24.04237], [-68.24825, -24.42596], [-68.56909, -24.69831], [-68.38372, -25.08636], [-68.57622, -25.32505], [-68.38372, -26.15353], [-68.56909, -26.28146], [-68.59048, -26.49861], [-68.27677, -26.90626], [-68.43363, -27.08414], [-68.77586, -27.16029], [-69.22504, -27.95042], [-69.66709, -28.44055], [-69.80969, -29.07185], [-69.99507, -29.28351], [-69.8596, -30.26131], [-70.14479, -30.36595], [-70.55832, -31.51559], [-69.88099, -33.34489], [-69.87386, -34.13344], [-70.49416, -35.24145], [-70.38008, -36.02375], [-70.95047, -36.4321], [-71.24279, -37.20264], [-70.89532, -38.6923], [-71.37826, -38.91474], [-71.92726, -40.72714], [-71.74901, -42.11711], [-72.15541, -42.15941], [-72.14828, -42.85321], [-71.64206, -43.64774], [-71.81318, -44.38097], [-71.16436, -44.46244], [-71.26418, -44.75684], [-72.06985, -44.81756], [-71.35687, -45.22075], [-71.75614, -45.61611], [-71.68577, -46.55385], [-71.94152, -47.13595], [-72.50478, -47.80586], [-72.27662, -48.28727], [-72.54042, -48.52392], [-72.56894, -48.81116], [-73.09655, -49.14342], [-73.45156, -49.79461], [-73.55259, -49.92488], [-73.15765, -50.78337], [-72.31343, -50.58411]]]] } },
20516     { type: "Feature", properties: { iso1A2: "AS", iso1A3: "ASM", iso1N3: "016", wikidata: "Q16641", nameEn: "American Samoa", aliases: ["US-AS"], country: "US", groups: ["Q1352230", "061", "009", "UN"], roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1 684"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-171.39864, -10.21587], [-170.99605, -15.1275], [-166.32598, -15.26169], [-171.39864, -10.21587]]]] } },
20517     { type: "Feature", properties: { iso1A2: "AT", iso1A3: "AUT", iso1N3: "040", wikidata: "Q40", nameEn: "Austria", groups: ["EU", "155", "150", "UN"], callingCodes: ["43"] }, geometry: { type: "MultiPolygon", coordinates: [[[[15.34823, 48.98444], [15.28305, 48.98831], [15.26177, 48.95766], [15.16358, 48.94278], [15.15534, 48.99056], [14.99878, 49.01444], [14.97612, 48.96983], [14.98917, 48.90082], [14.95072, 48.79101], [14.98032, 48.77959], [14.9782, 48.7766], [14.98112, 48.77524], [14.9758, 48.76857], [14.95641, 48.75915], [14.94773, 48.76268], [14.81545, 48.7874], [14.80821, 48.77711], [14.80584, 48.73489], [14.72756, 48.69502], [14.71794, 48.59794], [14.66762, 48.58215], [14.60808, 48.62881], [14.56139, 48.60429], [14.4587, 48.64695], [14.43076, 48.58855], [14.33909, 48.55852], [14.20691, 48.5898], [14.09104, 48.5943], [14.01482, 48.63788], [14.06151, 48.66873], [13.84023, 48.76988], [13.82266, 48.75544], [13.81863, 48.73257], [13.79337, 48.71375], [13.81791, 48.69832], [13.81283, 48.68426], [13.81901, 48.6761], [13.82609, 48.62345], [13.80038, 48.59487], [13.80519, 48.58026], [13.76921, 48.55324], [13.7513, 48.5624], [13.74816, 48.53058], [13.72802, 48.51208], [13.66113, 48.53558], [13.65186, 48.55092], [13.62508, 48.55501], [13.59705, 48.57013], [13.57535, 48.55912], [13.51291, 48.59023], [13.50131, 48.58091], [13.50663, 48.57506], [13.46967, 48.55157], [13.45214, 48.56472], [13.43695, 48.55776], [13.45727, 48.51092], [13.42527, 48.45711], [13.43929, 48.43386], [13.40709, 48.37292], [13.30897, 48.31575], [13.26039, 48.29422], [13.18093, 48.29577], [13.126, 48.27867], [13.0851, 48.27711], [13.02083, 48.25689], [12.95306, 48.20629], [12.87126, 48.20318], [12.84475, 48.16556], [12.836, 48.1647], [12.8362, 48.15876], [12.82673, 48.15245], [12.80676, 48.14979], [12.78595, 48.12445], [12.7617, 48.12796], [12.74973, 48.10885], [12.76141, 48.07373], [12.8549, 48.01122], [12.87476, 47.96195], [12.91683, 47.95647], [12.9211, 47.95135], [12.91985, 47.94069], [12.92668, 47.93879], [12.93419, 47.94063], [12.93642, 47.94436], [12.93886, 47.94046], [12.94163, 47.92927], [13.00588, 47.84374], [12.98543, 47.82896], [12.96311, 47.79957], [12.93202, 47.77302], [12.94371, 47.76281], [12.9353, 47.74788], [12.91711, 47.74026], [12.90274, 47.72513], [12.91333, 47.7178], [12.92969, 47.71094], [12.98578, 47.7078], [13.01382, 47.72116], [13.07692, 47.68814], [13.09562, 47.63304], [13.06407, 47.60075], [13.06641, 47.58577], [13.04537, 47.58183], [13.05355, 47.56291], [13.03252, 47.53373], [13.04537, 47.49426], [12.9998, 47.46267], [12.98344, 47.48716], [12.9624, 47.47452], [12.85256, 47.52741], [12.84672, 47.54556], [12.80699, 47.54477], [12.77427, 47.58025], [12.82101, 47.61493], [12.76492, 47.64485], [12.77777, 47.66689], [12.7357, 47.6787], [12.6071, 47.6741], [12.57438, 47.63238], [12.53816, 47.63553], [12.50076, 47.62293], [12.44117, 47.6741], [12.43883, 47.6977], [12.37222, 47.68433], [12.336, 47.69534], [12.27991, 47.68827], [12.26004, 47.67725], [12.24017, 47.69534], [12.26238, 47.73544], [12.2542, 47.7433], [12.22571, 47.71776], [12.18303, 47.70065], [12.16217, 47.70105], [12.16769, 47.68167], [12.18347, 47.66663], [12.18507, 47.65984], [12.19895, 47.64085], [12.20801, 47.61082], [12.20398, 47.60667], [12.18568, 47.6049], [12.17737, 47.60121], [12.18145, 47.61019], [12.17824, 47.61506], [12.13734, 47.60639], [12.05788, 47.61742], [12.02282, 47.61033], [12.0088, 47.62451], [11.85572, 47.60166], [11.84052, 47.58354], [11.63934, 47.59202], [11.60681, 47.57881], [11.58811, 47.55515], [11.58578, 47.52281], [11.52618, 47.50939], [11.4362, 47.51413], [11.38128, 47.47465], [11.4175, 47.44621], [11.33804, 47.44937], [11.29597, 47.42566], [11.27844, 47.39956], [11.22002, 47.3964], [11.25157, 47.43277], [11.20482, 47.43198], [11.12536, 47.41222], [11.11835, 47.39719], [10.97111, 47.39561], [10.97111, 47.41617], [10.98513, 47.42882], [10.92437, 47.46991], [10.93839, 47.48018], [10.90918, 47.48571], [10.87061, 47.4786], [10.86945, 47.5015], [10.91268, 47.51334], [10.88814, 47.53701], [10.77596, 47.51729], [10.7596, 47.53228], [10.6965, 47.54253], [10.68832, 47.55752], [10.63456, 47.5591], [10.60337, 47.56755], [10.56912, 47.53584], [10.48849, 47.54057], [10.47329, 47.58552], [10.43473, 47.58394], [10.44992, 47.5524], [10.4324, 47.50111], [10.44291, 47.48453], [10.46278, 47.47901], [10.47446, 47.43318], [10.4359, 47.41183], [10.4324, 47.38494], [10.39851, 47.37623], [10.33424, 47.30813], [10.23257, 47.27088], [10.17531, 47.27167], [10.17648, 47.29149], [10.2147, 47.31014], [10.19998, 47.32832], [10.23757, 47.37609], [10.22774, 47.38904], [10.2127, 47.38019], [10.17648, 47.38889], [10.16362, 47.36674], [10.11805, 47.37228], [10.09819, 47.35724], [10.06897, 47.40709], [10.1052, 47.4316], [10.09001, 47.46005], [10.07131, 47.45531], [10.03859, 47.48927], [10.00003, 47.48216], [9.96029, 47.53899], [9.92407, 47.53111], [9.87733, 47.54688], [9.87499, 47.52953], [9.8189, 47.54688], [9.82591, 47.58158], [9.80254, 47.59419], [9.76748, 47.5934], [9.72736, 47.53457], [9.55125, 47.53629], [9.56312, 47.49495], [9.58208, 47.48344], [9.59482, 47.46305], [9.60205, 47.46165], [9.60484, 47.46358], [9.60841, 47.47178], [9.62158, 47.45858], [9.62475, 47.45685], [9.6423, 47.45599], [9.65728, 47.45383], [9.65863, 47.44847], [9.64483, 47.43842], [9.6446, 47.43233], [9.65043, 47.41937], [9.65136, 47.40504], [9.6629, 47.39591], [9.67334, 47.39191], [9.67445, 47.38429], [9.6711, 47.37824], [9.66243, 47.37136], [9.65427, 47.36824], [9.62476, 47.36639], [9.59978, 47.34671], [9.58513, 47.31334], [9.55857, 47.29919], [9.54773, 47.2809], [9.53116, 47.27029], [9.56766, 47.24281], [9.55176, 47.22585], [9.56981, 47.21926], [9.58264, 47.20673], [9.56539, 47.17124], [9.62623, 47.14685], [9.63395, 47.08443], [9.61216, 47.07732], [9.60717, 47.06091], [9.87935, 47.01337], [9.88266, 46.93343], [9.98058, 46.91434], [10.10715, 46.84296], [10.22675, 46.86942], [10.24128, 46.93147], [10.30031, 46.92093], [10.36933, 47.00212], [10.48376, 46.93891], [10.47197, 46.85698], [10.54783, 46.84505], [10.66405, 46.87614], [10.75753, 46.82258], [10.72974, 46.78972], [11.00764, 46.76896], [11.10618, 46.92966], [11.33355, 46.99862], [11.50739, 47.00644], [11.74789, 46.98484], [12.19254, 47.09331], [12.21781, 47.03996], [12.11675, 47.01241], [12.2006, 46.88854], [12.27591, 46.88651], [12.38708, 46.71529], [12.59992, 46.6595], [12.94445, 46.60401], [13.27627, 46.56059], [13.64088, 46.53438], [13.7148, 46.5222], [13.89837, 46.52331], [14.00422, 46.48474], [14.04002, 46.49117], [14.12097, 46.47724], [14.15989, 46.43327], [14.28326, 46.44315], [14.314, 46.43327], [14.42608, 46.44614], [14.45877, 46.41717], [14.52176, 46.42617], [14.56463, 46.37208], [14.5942, 46.43434], [14.66892, 46.44936], [14.72185, 46.49974], [14.81836, 46.51046], [14.83549, 46.56614], [14.86419, 46.59411], [14.87129, 46.61], [14.92283, 46.60848], [14.96002, 46.63459], [14.98024, 46.6009], [15.01451, 46.641], [15.14215, 46.66131], [15.23711, 46.63994], [15.41235, 46.65556], [15.45514, 46.63697], [15.46906, 46.61321], [15.54431, 46.6312], [15.55333, 46.64988], [15.54533, 46.66985], [15.59826, 46.68908], [15.62317, 46.67947], [15.63255, 46.68069], [15.6365, 46.6894], [15.6543, 46.69228], [15.6543, 46.70616], [15.67411, 46.70735], [15.69523, 46.69823], [15.72279, 46.69548], [15.73823, 46.70011], [15.76771, 46.69863], [15.78518, 46.70712], [15.8162, 46.71897], [15.87691, 46.7211], [15.94864, 46.68769], [15.98512, 46.68463], [15.99988, 46.67947], [16.04036, 46.6549], [16.04347, 46.68694], [16.02808, 46.71094], [15.99769, 46.7266], [15.98432, 46.74991], [15.99126, 46.78199], [15.99054, 46.82772], [16.05786, 46.83927], [16.10983, 46.867], [16.19904, 46.94134], [16.22403, 46.939], [16.27594, 46.9643], [16.28202, 47.00159], [16.51369, 47.00084], [16.43936, 47.03548], [16.52176, 47.05747], [16.46134, 47.09395], [16.52863, 47.13974], [16.44932, 47.14418], [16.46442, 47.16845], [16.4523, 47.18812], [16.42801, 47.18422], [16.41739, 47.20649], [16.43663, 47.21127], [16.44142, 47.25079], [16.47782, 47.25918], [16.45104, 47.41181], [16.49908, 47.39416], [16.52414, 47.41007], [16.57152, 47.40868], [16.6718, 47.46139], [16.64821, 47.50155], [16.71059, 47.52692], [16.64193, 47.63114], [16.58699, 47.61772], [16.4222, 47.66537], [16.55129, 47.72268], [16.53514, 47.73837], [16.54779, 47.75074], [16.61183, 47.76171], [16.65679, 47.74197], [16.72089, 47.73469], [16.7511, 47.67878], [16.82938, 47.68432], [16.86509, 47.72268], [16.87538, 47.68895], [17.08893, 47.70928], [17.05048, 47.79377], [17.07039, 47.81129], [17.00997, 47.86245], [17.08275, 47.87719], [17.11022, 47.92461], [17.09786, 47.97336], [17.16001, 48.00636], [17.07039, 48.0317], [17.09168, 48.09366], [17.05735, 48.14179], [17.02919, 48.13996], [16.97701, 48.17385], [16.89461, 48.31332], [16.90903, 48.32519], [16.84243, 48.35258], [16.83317, 48.38138], [16.83588, 48.3844], [16.8497, 48.38321], [16.85204, 48.44968], [16.94611, 48.53614], [16.93955, 48.60371], [16.90354, 48.71541], [16.79779, 48.70998], [16.71883, 48.73806], [16.68518, 48.7281], [16.67008, 48.77699], [16.46134, 48.80865], [16.40915, 48.74576], [16.37345, 48.729], [16.06034, 48.75436], [15.84404, 48.86921], [15.78087, 48.87644], [15.75341, 48.8516], [15.6921, 48.85973], [15.61622, 48.89541], [15.51357, 48.91549], [15.48027, 48.94481], [15.34823, 48.98444]]]] } },
20518     { type: "Feature", properties: { iso1A2: "AU", iso1A3: "AUS", iso1N3: "036", wikidata: "Q408", nameEn: "Australia" }, geometry: null },
20519     { type: "Feature", properties: { iso1A2: "AW", iso1A3: "ABW", iso1N3: "533", wikidata: "Q21203", nameEn: "Aruba", aliases: ["NL-AW"], country: "NL", groups: ["Q1451600", "029", "003", "419", "019", "UN"], callingCodes: ["297"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-70.00823, 12.98375], [-70.35625, 12.58277], [-69.60231, 12.17], [-70.00823, 12.98375]]]] } },
20520     { type: "Feature", properties: { iso1A2: "AX", iso1A3: "ALA", iso1N3: "248", wikidata: "Q5689", nameEn: "\xC5land Islands", country: "FI", groups: ["EU", "154", "150", "UN"], callingCodes: ["358 18", "358 457"] }, geometry: { type: "MultiPolygon", coordinates: [[[[19.08191, 60.19152], [20.5104, 59.15546], [21.35468, 59.67511], [21.02509, 60.12142], [21.08159, 60.20167], [21.15143, 60.54555], [20.96741, 60.71528], [19.23413, 60.61414], [19.08191, 60.19152]]]] } },
20521     { type: "Feature", properties: { iso1A2: "AZ", iso1A3: "AZE", iso1N3: "031", wikidata: "Q227", nameEn: "Azerbaijan", groups: ["145", "142", "UN"], callingCodes: ["994"] }, geometry: { type: "MultiPolygon", coordinates: [[[[46.42738, 41.91323], [46.3984, 41.84399], [46.30863, 41.79133], [46.23962, 41.75811], [46.20538, 41.77205], [46.17891, 41.72094], [46.19759, 41.62327], [46.24429, 41.59883], [46.26531, 41.63339], [46.28182, 41.60089], [46.3253, 41.60912], [46.34039, 41.5947], [46.34126, 41.57454], [46.29794, 41.5724], [46.33925, 41.4963], [46.40307, 41.48464], [46.4669, 41.43331], [46.63658, 41.37727], [46.72375, 41.28609], [46.66148, 41.20533], [46.63969, 41.09515], [46.55096, 41.1104], [46.48558, 41.0576], [46.456, 41.09984], [46.37661, 41.10805], [46.27698, 41.19011], [46.13221, 41.19479], [45.95786, 41.17956], [45.80842, 41.2229], [45.69946, 41.29545], [45.75705, 41.35157], [45.71035, 41.36208], [45.68389, 41.3539], [45.45973, 41.45898], [45.4006, 41.42402], [45.31352, 41.47168], [45.26285, 41.46433], [45.1797, 41.42231], [45.09867, 41.34065], [45.0133, 41.29747], [45.05497, 41.2464], [45.02932, 41.2101], [45.05201, 41.19211], [45.11811, 41.19967], [45.1969, 41.168], [45.19942, 41.13299], [45.08028, 41.10917], [45.06784, 41.05379], [45.12923, 41.06059], [45.1313, 41.09369], [45.1634, 41.08082], [45.16493, 41.05068], [45.1994, 41.04518], [45.25897, 41.0027], [45.26162, 41.0228], [45.28859, 41.03757], [45.35677, 40.99784], [45.39725, 41.02603], [45.44083, 41.01663], [45.40814, 40.97904], [45.60584, 40.87436], [45.55914, 40.78366], [45.4206, 40.7424], [45.35366, 40.65979], [45.45484, 40.57707], [45.42994, 40.53804], [45.65098, 40.37696], [45.95609, 40.27846], [45.97944, 40.181], [45.83779, 39.98925], [45.78642, 40.03218], [45.59806, 40.0131], [45.60895, 39.97733], [45.7833, 39.9475], [45.82533, 39.82925], [45.96543, 39.78859], [46.18493, 39.60533], [46.40286, 39.63651], [46.42465, 39.57534], [46.52117, 39.58734], [46.57098, 39.56694], [46.57721, 39.54414], [46.51027, 39.52373], [46.53051, 39.47809], [46.4013, 39.45405], [46.37795, 39.42039], [46.43244, 39.35181], [46.50093, 39.33736], [46.56476, 39.24942], [46.63481, 39.23013], [46.58032, 39.21204], [46.54141, 39.15895], [46.52584, 39.18912], [46.44022, 39.19636], [46.54296, 39.07078], [46.51805, 38.94982], [46.53497, 38.86548], [46.75752, 39.03231], [46.83822, 39.13143], [46.92539, 39.16644], [46.95341, 39.13505], [47.05771, 39.20143], [47.05927, 39.24846], [47.31301, 39.37492], [47.38978, 39.45999], [47.50099, 39.49615], [47.84774, 39.66285], [47.98977, 39.70999], [48.34264, 39.42935], [48.37385, 39.37584], [48.15984, 39.30028], [48.12404, 39.25208], [48.15361, 39.19419], [48.31239, 39.09278], [48.33884, 39.03022], [48.28437, 38.97186], [48.08627, 38.94434], [48.07734, 38.91616], [48.01409, 38.90333], [48.02581, 38.82705], [48.24773, 38.71883], [48.3146, 38.59958], [48.45084, 38.61013], [48.58793, 38.45076], [48.62217, 38.40198], [48.70001, 38.40564], [48.78979, 38.45026], [48.81072, 38.44853], [48.84969, 38.45015], [48.88288, 38.43975], [52.39847, 39.43556], [48.80971, 41.95365], [48.5867, 41.84306], [48.55078, 41.77917], [48.42301, 41.65444], [48.40277, 41.60441], [48.2878, 41.56221], [48.22064, 41.51472], [48.07587, 41.49957], [47.87973, 41.21798], [47.75831, 41.19455], [47.62288, 41.22969], [47.54504, 41.20275], [47.49004, 41.26366], [47.34579, 41.27884], [47.10762, 41.59044], [47.03757, 41.55434], [46.99554, 41.59743], [47.00955, 41.63583], [46.8134, 41.76252], [46.75269, 41.8623], [46.58924, 41.80547], [46.5332, 41.87389], [46.42738, 41.91323]], [[45.50279, 40.58424], [45.47927, 40.65023], [45.51825, 40.67382], [45.56071, 40.64765], [45.50279, 40.58424]]], [[[45.00864, 41.03411], [45.03792, 41.03938], [45.04517, 41.06653], [45.03406, 41.07931], [45.00864, 41.09407], [44.97169, 41.09176], [44.95383, 41.07553], [44.96031, 41.06345], [44.9903, 41.05657], [45.00864, 41.03411]]], [[[45.21324, 40.9817], [45.23095, 40.97828], [45.23487, 41.00226], [45.20625, 41.01484], [45.18382, 41.0066], [45.19312, 40.98998], [45.20518, 40.99348], [45.21219, 40.99001], [45.21324, 40.9817]]], [[[45.46992, 39.49888], [45.29606, 39.57654], [45.30385, 39.61373], [45.23535, 39.61373], [45.21784, 39.58074], [45.17464, 39.58614], [45.18554, 39.67846], [45.06604, 39.79277], [44.92869, 39.72157], [44.88354, 39.74432], [44.75779, 39.7148], [44.80977, 39.65768], [44.81043, 39.62677], [44.88916, 39.59653], [44.96746, 39.42998], [45.05932, 39.36435], [45.08751, 39.35052], [45.16168, 39.21952], [45.30489, 39.18333], [45.40148, 39.09007], [45.40452, 39.07224], [45.44811, 39.04927], [45.44966, 38.99243], [45.6131, 38.964], [45.6155, 38.94304], [45.65172, 38.95199], [45.83883, 38.90768], [45.90266, 38.87739], [45.94624, 38.89072], [46.00228, 38.87376], [46.06766, 38.87861], [46.14785, 38.84206], [46.06973, 39.0744], [46.02303, 39.09978], [45.99774, 39.28931], [45.79225, 39.3695], [45.83, 39.46487], [45.80804, 39.56716], [45.70547, 39.60174], [45.46992, 39.49888]]]] } },
20522     { type: "Feature", properties: { iso1A2: "BA", iso1A3: "BIH", iso1N3: "070", wikidata: "Q225", nameEn: "Bosnia and Herzegovina", groups: ["039", "150", "UN"], callingCodes: ["387"] }, geometry: { type: "MultiPolygon", coordinates: [[[[17.84826, 45.04489], [17.66571, 45.13408], [17.59104, 45.10816], [17.51469, 45.10791], [17.47589, 45.12656], [17.45615, 45.12523], [17.4498, 45.16119], [17.41229, 45.13335], [17.33573, 45.14521], [17.32092, 45.16246], [17.26815, 45.18444], [17.25131, 45.14957], [17.24325, 45.146], [17.18438, 45.14764], [17.0415, 45.20759], [16.9385, 45.22742], [16.92405, 45.27607], [16.83804, 45.18951], [16.81137, 45.18434], [16.78219, 45.19002], [16.74845, 45.20393], [16.64962, 45.20714], [16.60194, 45.23042], [16.56559, 45.22307], [16.5501, 45.2212], [16.52982, 45.22713], [16.49155, 45.21153], [16.4634, 45.14522], [16.40023, 45.1147], [16.38309, 45.05955], [16.38219, 45.05139], [16.3749, 45.05206], [16.35863, 45.03529], [16.35404, 45.00241], [16.29036, 44.99732], [16.12153, 45.09616], [15.98412, 45.23088], [15.83512, 45.22459], [15.76371, 45.16508], [15.78842, 45.11519], [15.74585, 45.0638], [15.78568, 44.97401], [15.74723, 44.96818], [15.76096, 44.87045], [15.79472, 44.8455], [15.72584, 44.82334], [15.8255, 44.71501], [15.89348, 44.74964], [16.05828, 44.61538], [16.00884, 44.58605], [16.03012, 44.55572], [16.10566, 44.52586], [16.16814, 44.40679], [16.12969, 44.38275], [16.21346, 44.35231], [16.18688, 44.27012], [16.36864, 44.08263], [16.43662, 44.07523], [16.43629, 44.02826], [16.50528, 44.0244], [16.55472, 43.95326], [16.70922, 43.84887], [16.75316, 43.77157], [16.80736, 43.76011], [17.00585, 43.58037], [17.15828, 43.49376], [17.24411, 43.49376], [17.29699, 43.44542], [17.25579, 43.40353], [17.286, 43.33065], [17.46986, 43.16559], [17.64268, 43.08595], [17.70879, 42.97223], [17.5392, 42.92787], [17.6444, 42.88641], [17.68151, 42.92725], [17.7948, 42.89556], [17.80854, 42.9182], [17.88201, 42.83668], [18.24318, 42.6112], [18.36197, 42.61423], [18.43735, 42.55921], [18.49778, 42.58409], [18.53751, 42.57376], [18.55504, 42.58409], [18.52232, 42.62279], [18.57373, 42.64429], [18.54841, 42.68328], [18.54603, 42.69171], [18.55221, 42.69045], [18.56789, 42.72074], [18.47324, 42.74992], [18.45921, 42.81682], [18.47633, 42.85829], [18.4935, 42.86433], [18.49661, 42.89306], [18.49076, 42.95553], [18.52232, 43.01451], [18.66254, 43.03928], [18.64735, 43.14766], [18.66605, 43.2056], [18.71747, 43.2286], [18.6976, 43.25243], [18.76538, 43.29838], [18.85342, 43.32426], [18.84794, 43.33735], [18.83912, 43.34795], [18.90911, 43.36383], [18.95819, 43.32899], [18.95001, 43.29327], [19.00844, 43.24988], [19.04233, 43.30008], [19.08206, 43.29668], [19.08673, 43.31453], [19.04071, 43.397], [19.01078, 43.43854], [18.96053, 43.45042], [18.95469, 43.49367], [18.91379, 43.50299], [19.01078, 43.55806], [19.04934, 43.50384], [19.13933, 43.5282], [19.15685, 43.53943], [19.22807, 43.5264], [19.24774, 43.53061], [19.2553, 43.5938], [19.33426, 43.58833], [19.36653, 43.60921], [19.41941, 43.54056], [19.42696, 43.57987], [19.50455, 43.58385], [19.5176, 43.71403], [19.3986, 43.79668], [19.23465, 43.98764], [19.24363, 44.01502], [19.38439, 43.96611], [19.52515, 43.95573], [19.56498, 43.99922], [19.61836, 44.01464], [19.61991, 44.05254], [19.57467, 44.04716], [19.55999, 44.06894], [19.51167, 44.08158], [19.47321, 44.1193], [19.48386, 44.14332], [19.47338, 44.15034], [19.43905, 44.13088], [19.40927, 44.16722], [19.3588, 44.18353], [19.34773, 44.23244], [19.32464, 44.27185], [19.26945, 44.26957], [19.23306, 44.26097], [19.20508, 44.2917], [19.18328, 44.28383], [19.16741, 44.28648], [19.13332, 44.31492], [19.13556, 44.338], [19.11547, 44.34218], [19.1083, 44.3558], [19.11865, 44.36712], [19.10298, 44.36924], [19.10365, 44.37795], [19.10704, 44.38249], [19.10749, 44.39421], [19.11785, 44.40313], [19.14681, 44.41463], [19.14837, 44.45253], [19.12278, 44.50132], [19.13369, 44.52521], [19.16699, 44.52197], [19.26388, 44.65412], [19.32543, 44.74058], [19.36722, 44.88164], [19.18183, 44.92055], [19.01994, 44.85493], [18.8704, 44.85097], [18.76347, 44.90669], [18.76369, 44.93707], [18.80661, 44.93561], [18.78357, 44.97741], [18.65723, 45.07544], [18.47939, 45.05871], [18.41896, 45.11083], [18.32077, 45.1021], [18.24387, 45.13699], [18.1624, 45.07654], [18.03121, 45.12632], [18.01594, 45.15163], [17.99479, 45.14958], [17.97834, 45.13831], [17.97336, 45.12245], [17.93706, 45.08016], [17.87148, 45.04645], [17.84826, 45.04489]]]] } },
20523     { type: "Feature", properties: { iso1A2: "BB", iso1A3: "BRB", iso1N3: "052", wikidata: "Q244", nameEn: "Barbados", groups: ["029", "003", "419", "019", "UN"], driveSide: "left", callingCodes: ["1 246"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-58.56442, 13.24471], [-59.80731, 13.87556], [-59.82929, 12.70644], [-58.56442, 13.24471]]]] } },
20524     { type: "Feature", properties: { iso1A2: "BD", iso1A3: "BGD", iso1N3: "050", wikidata: "Q902", nameEn: "Bangladesh", groups: ["034", "142", "UN"], driveSide: "left", callingCodes: ["880"] }, geometry: { type: "MultiPolygon", coordinates: [[[[89.15869, 26.13708], [89.08899, 26.38845], [88.95612, 26.4564], [88.92357, 26.40711], [88.91321, 26.37984], [89.05328, 26.2469], [88.85004, 26.23211], [88.78961, 26.31093], [88.67837, 26.26291], [88.69485, 26.38353], [88.62144, 26.46783], [88.4298, 26.54489], [88.41196, 26.63837], [88.33093, 26.48929], [88.35153, 26.45241], [88.36938, 26.48683], [88.48749, 26.45855], [88.51649, 26.35923], [88.35153, 26.29123], [88.34757, 26.22216], [88.1844, 26.14417], [88.16581, 26.0238], [88.08804, 25.91334], [88.13138, 25.78773], [88.242, 25.80811], [88.45103, 25.66245], [88.4559, 25.59227], [88.677, 25.46959], [88.81296, 25.51546], [88.85278, 25.34679], [89.01105, 25.30303], [89.00463, 25.26583], [88.94067, 25.18534], [88.44766, 25.20149], [88.46277, 25.07468], [88.33917, 24.86803], [88.27325, 24.88796], [88.21832, 24.96642], [88.14004, 24.93529], [88.15515, 24.85806], [88.00683, 24.66477], [88.08786, 24.63232], [88.12296, 24.51301], [88.50934, 24.32474], [88.68801, 24.31464], [88.74841, 24.1959], [88.6976, 24.14703], [88.73743, 23.91751], [88.66189, 23.87607], [88.58087, 23.87105], [88.56507, 23.64044], [88.74841, 23.47361], [88.79351, 23.50535], [88.79254, 23.46028], [88.71133, 23.2492], [88.99148, 23.21134], [88.86377, 23.08759], [88.88327, 23.03885], [88.87063, 22.95235], [88.96713, 22.83346], [88.9151, 22.75228], [88.94614, 22.66941], [88.9367, 22.58527], [89.07114, 22.15335], [89.08044, 21.41871], [92.47409, 20.38654], [92.26071, 21.05697], [92.17752, 21.17445], [92.20087, 21.337], [92.37939, 21.47764], [92.43158, 21.37025], [92.55105, 21.3856], [92.60187, 21.24615], [92.68152, 21.28454], [92.59775, 21.6092], [92.62187, 21.87037], [92.60949, 21.97638], [92.56616, 22.13554], [92.60029, 22.1522], [92.5181, 22.71441], [92.37665, 22.9435], [92.38214, 23.28705], [92.26541, 23.70392], [92.15417, 23.73409], [92.04706, 23.64229], [91.95093, 23.73284], [91.95642, 23.47361], [91.84789, 23.42235], [91.76417, 23.26619], [91.81634, 23.08001], [91.7324, 23.00043], [91.61571, 22.93929], [91.54993, 23.01051], [91.46615, 23.2328], [91.4035, 23.27522], [91.40848, 23.07117], [91.36453, 23.06612], [91.28293, 23.37538], [91.15579, 23.6599], [91.25192, 23.83463], [91.22308, 23.89616], [91.29587, 24.0041], [91.35741, 23.99072], [91.37414, 24.10693], [91.55542, 24.08687], [91.63782, 24.1132], [91.65292, 24.22095], [91.73257, 24.14703], [91.76004, 24.23848], [91.82596, 24.22345], [91.89258, 24.14674], [91.96603, 24.3799], [92.11662, 24.38997], [92.15796, 24.54435], [92.25854, 24.9191], [92.38626, 24.86055], [92.49887, 24.88796], [92.39147, 25.01471], [92.33957, 25.07593], [92.0316, 25.1834], [91.63648, 25.12846], [91.25517, 25.20677], [90.87427, 25.15799], [90.65042, 25.17788], [90.40034, 25.1534], [90.1155, 25.22686], [89.90478, 25.31038], [89.87629, 25.28337], [89.83371, 25.29548], [89.84086, 25.31854], [89.81208, 25.37244], [89.86129, 25.61714], [89.84388, 25.70042], [89.80585, 25.82489], [89.86592, 25.93115], [89.77728, 26.04254], [89.77865, 26.08387], [89.73581, 26.15818], [89.70201, 26.15138], [89.63968, 26.22595], [89.57101, 25.9682], [89.53515, 26.00382], [89.35953, 26.0077], [89.15869, 26.13708]]]] } },
20525     { type: "Feature", properties: { iso1A2: "BE", iso1A3: "BEL", iso1N3: "056", wikidata: "Q31", nameEn: "Belgium", groups: ["EU", "155", "150", "UN"], callingCodes: ["32"] }, geometry: { type: "MultiPolygon", coordinates: [[[[4.93295, 51.44945], [4.93909, 51.44632], [4.9524, 51.45014], [4.95244, 51.45207], [4.93295, 51.44945]]], [[[4.91493, 51.4353], [4.92652, 51.43329], [4.92952, 51.42984], [4.93986, 51.43064], [4.94265, 51.44003], [4.93471, 51.43861], [4.93416, 51.44185], [4.94025, 51.44193], [4.93544, 51.44634], [4.92879, 51.44161], [4.92815, 51.43856], [4.92566, 51.44273], [4.92811, 51.4437], [4.92287, 51.44741], [4.91811, 51.44621], [4.92227, 51.44252], [4.91935, 51.43634], [4.91493, 51.4353]]], [[[4.82946, 51.4213], [4.82409, 51.44736], [4.84139, 51.4799], [4.78803, 51.50284], [4.77321, 51.50529], [4.74578, 51.48937], [4.72935, 51.48424], [4.65442, 51.42352], [4.57489, 51.4324], [4.53521, 51.4243], [4.52846, 51.45002], [4.54675, 51.47265], [4.5388, 51.48184], [4.47736, 51.4778], [4.38122, 51.44905], [4.39747, 51.43316], [4.38064, 51.41965], [4.43777, 51.36989], [4.39292, 51.35547], [4.34086, 51.35738], [4.33265, 51.37687], [4.21923, 51.37443], [4.24024, 51.35371], [4.16721, 51.29348], [4.05165, 51.24171], [4.01957, 51.24504], [3.97889, 51.22537], [3.90125, 51.20371], [3.78783, 51.2151], [3.78999, 51.25766], [3.58939, 51.30064], [3.51502, 51.28697], [3.52698, 51.2458], [3.43488, 51.24135], [3.41704, 51.25933], [3.38289, 51.27331], [3.35847, 51.31572], [3.38696, 51.33436], [3.36263, 51.37112], [2.56575, 51.85301], [2.18458, 51.52087], [2.55904, 51.07014], [2.57551, 51.00326], [2.63074, 50.94746], [2.59093, 50.91751], [2.63331, 50.81457], [2.71165, 50.81295], [2.81056, 50.71773], [2.8483, 50.72276], [2.86985, 50.7033], [2.87937, 50.70298], [2.88504, 50.70656], [2.90069, 50.69263], [2.91036, 50.6939], [2.90873, 50.702], [2.95019, 50.75138], [2.96778, 50.75242], [3.00537, 50.76588], [3.04314, 50.77674], [3.09163, 50.77717], [3.10614, 50.78303], [3.11206, 50.79416], [3.11987, 50.79188], [3.1257, 50.78603], [3.15017, 50.79031], [3.16476, 50.76843], [3.18339, 50.74981], [3.18811, 50.74025], [3.20064, 50.73547], [3.19017, 50.72569], [3.20845, 50.71662], [3.22042, 50.71019], [3.24593, 50.71389], [3.26063, 50.70086], [3.26141, 50.69151], [3.2536, 50.68977], [3.264, 50.67668], [3.23951, 50.6585], [3.2729, 50.60718], [3.28575, 50.52724], [3.37693, 50.49538], [3.44629, 50.51009], [3.47385, 50.53397], [3.51564, 50.5256], [3.49509, 50.48885], [3.5683, 50.50192], [3.58361, 50.49049], [3.61014, 50.49568], [3.64426, 50.46275], [3.66153, 50.45165], [3.67494, 50.40239], [3.67262, 50.38663], [3.65709, 50.36873], [3.66976, 50.34563], [3.71009, 50.30305], [3.70987, 50.3191], [3.73911, 50.34809], [3.84314, 50.35219], [3.90781, 50.32814], [3.96771, 50.34989], [4.0268, 50.35793], [4.0689, 50.3254], [4.10237, 50.31247], [4.10957, 50.30234], [4.11954, 50.30425], [4.13665, 50.25609], [4.16808, 50.25786], [4.15524, 50.2833], [4.17347, 50.28838], [4.17861, 50.27443], [4.20651, 50.27333], [4.21945, 50.25539], [4.15524, 50.21103], [4.16014, 50.19239], [4.13561, 50.13078], [4.20147, 50.13535], [4.23101, 50.06945], [4.16294, 50.04719], [4.13508, 50.01976], [4.14239, 49.98034], [4.20532, 49.95803], [4.31963, 49.97043], [4.35051, 49.95315], [4.43488, 49.94122], [4.51098, 49.94659], [4.5414, 49.96911], [4.68695, 49.99685], [4.70064, 50.09384], [4.75237, 50.11314], [4.82438, 50.16878], [4.83279, 50.15331], [4.88602, 50.15182], [4.8382, 50.06738], [4.78827, 49.95609], [4.88529, 49.9236], [4.85134, 49.86457], [4.86965, 49.82271], [4.85464, 49.78995], [4.96714, 49.79872], [5.09249, 49.76193], [5.14545, 49.70287], [5.26232, 49.69456], [5.31465, 49.66846], [5.33039, 49.6555], [5.30214, 49.63055], [5.3137, 49.61225], [5.33851, 49.61599], [5.34837, 49.62889], [5.3974, 49.61596], [5.43713, 49.5707], [5.46734, 49.52648], [5.46541, 49.49825], [5.55001, 49.52729], [5.60909, 49.51228], [5.64505, 49.55146], [5.75649, 49.54321], [5.7577, 49.55915], [5.77435, 49.56298], [5.79195, 49.55228], [5.81838, 49.54777], [5.84143, 49.5533], [5.84692, 49.55663], [5.8424, 49.56082], [5.87256, 49.57539], [5.86986, 49.58756], [5.84971, 49.58674], [5.84826, 49.5969], [5.8762, 49.60898], [5.87609, 49.62047], [5.88393, 49.62802], [5.88552, 49.63507], [5.90599, 49.63853], [5.90164, 49.6511], [5.9069, 49.66377], [5.86175, 49.67862], [5.86527, 49.69291], [5.88677, 49.70951], [5.86503, 49.72739], [5.84193, 49.72161], [5.82562, 49.72395], [5.83149, 49.74729], [5.82245, 49.75048], [5.78871, 49.7962], [5.75409, 49.79239], [5.74953, 49.81428], [5.74364, 49.82058], [5.74844, 49.82435], [5.7404, 49.83452], [5.74076, 49.83823], [5.74975, 49.83933], [5.74953, 49.84709], [5.75884, 49.84811], [5.74567, 49.85368], [5.75861, 49.85631], [5.75269, 49.8711], [5.78415, 49.87922], [5.73621, 49.89796], [5.77314, 49.93646], [5.77291, 49.96056], [5.80833, 49.96451], [5.81163, 49.97142], [5.83467, 49.97823], [5.83968, 49.9892], [5.82331, 49.99662], [5.81866, 50.01286], [5.8551, 50.02683], [5.86904, 50.04614], [5.85474, 50.06342], [5.8857, 50.07824], [5.89488, 50.11476], [5.95929, 50.13295], [5.96453, 50.17259], [6.02488, 50.18283], [6.03093, 50.16362], [6.06406, 50.15344], [6.08577, 50.17246], [6.12028, 50.16374], [6.1137, 50.13668], [6.1379, 50.12964], [6.15298, 50.14126], [6.14132, 50.14971], [6.14588, 50.17106], [6.18739, 50.1822], [6.18364, 50.20815], [6.16853, 50.2234], [6.208, 50.25179], [6.28797, 50.27458], [6.29949, 50.30887], [6.32488, 50.32333], [6.35701, 50.31139], [6.40641, 50.32425], [6.40785, 50.33557], [6.3688, 50.35898], [6.34406, 50.37994], [6.36852, 50.40776], [6.37219, 50.45397], [6.34005, 50.46083], [6.3465, 50.48833], [6.30809, 50.50058], [6.26637, 50.50272], [6.22335, 50.49578], [6.20599, 50.52089], [6.19193, 50.5212], [6.18716, 50.52653], [6.19579, 50.5313], [6.19735, 50.53576], [6.17802, 50.54179], [6.17739, 50.55875], [6.20281, 50.56952], [6.22581, 50.5907], [6.24005, 50.58732], [6.24888, 50.59869], [6.2476, 50.60392], [6.26957, 50.62444], [6.17852, 50.6245], [6.11707, 50.72231], [6.04428, 50.72861], [6.0406, 50.71848], [6.0326, 50.72647], [6.03889, 50.74618], [6.01976, 50.75398], [5.97545, 50.75441], [5.95942, 50.7622], [5.89132, 50.75124], [5.89129, 50.75125], [5.88734, 50.77092], [5.84888, 50.75448], [5.84548, 50.76542], [5.80673, 50.7558], [5.77513, 50.78308], [5.76533, 50.78159], [5.74356, 50.7691], [5.73904, 50.75674], [5.72216, 50.76398], [5.69469, 50.75529], [5.68091, 50.75804], [5.70107, 50.7827], [5.68995, 50.79641], [5.70118, 50.80764], [5.65259, 50.82309], [5.64009, 50.84742], [5.64504, 50.87107], [5.67886, 50.88142], [5.69858, 50.91046], [5.71626, 50.90796], [5.72644, 50.91167], [5.72545, 50.92312], [5.74644, 50.94723], [5.75927, 50.95601], [5.74752, 50.96202], [5.72875, 50.95428], [5.71864, 50.96092], [5.76242, 50.99703], [5.77688, 51.02483], [5.75961, 51.03113], [5.77258, 51.06196], [5.79835, 51.05834], [5.79903, 51.09371], [5.82921, 51.09328], [5.83226, 51.10585], [5.8109, 51.10861], [5.80798, 51.11661], [5.85508, 51.14445], [5.82564, 51.16753], [5.77697, 51.1522], [5.77735, 51.17845], [5.74617, 51.18928], [5.70344, 51.1829], [5.65528, 51.18736], [5.65145, 51.19788], [5.5603, 51.22249], [5.5569, 51.26544], [5.515, 51.29462], [5.48476, 51.30053], [5.46519, 51.2849], [5.4407, 51.28169], [5.41672, 51.26248], [5.347, 51.27502], [5.33886, 51.26314], [5.29716, 51.26104], [5.26461, 51.26693], [5.23814, 51.26064], [5.22542, 51.26888], [5.24244, 51.30495], [5.2002, 51.32243], [5.16222, 51.31035], [5.13377, 51.31592], [5.13105, 51.34791], [5.07102, 51.39469], [5.10456, 51.43163], [5.07891, 51.4715], [5.04774, 51.47022], [5.03281, 51.48679], [5.0106, 51.47167], [5.00393, 51.44406], [4.92152, 51.39487], [4.90016, 51.41404], [4.84988, 51.41502], [4.78941, 51.41102], [4.77229, 51.41337], [4.76577, 51.43046], [4.78314, 51.43319], [4.82946, 51.4213]]]] } },
20526     { type: "Feature", properties: { iso1A2: "BF", iso1A3: "BFA", iso1N3: "854", wikidata: "Q965", nameEn: "Burkina Faso", groups: ["011", "202", "002", "UN"], callingCodes: ["226"] }, geometry: { type: "MultiPolygon", coordinates: [[[[0.23859, 15.00135], [0.06588, 14.96961], [-0.24673, 15.07805], [-0.72004, 15.08655], [-1.05875, 14.7921], [-1.32166, 14.72774], [-1.68083, 14.50023], [-1.97945, 14.47709], [-1.9992, 14.19011], [-2.10223, 14.14878], [-2.47587, 14.29671], [-2.66175, 14.14713], [-2.84667, 14.05532], [-2.90831, 13.81174], [-2.88189, 13.64921], [-3.26407, 13.70699], [-3.28396, 13.5422], [-3.23599, 13.29035], [-3.43507, 13.27272], [-3.4313, 13.1588], [-3.54454, 13.1781], [-3.7911, 13.36665], [-3.96282, 13.38164], [-3.90558, 13.44375], [-3.96501, 13.49778], [-4.34477, 13.12927], [-4.21819, 12.95722], [-4.238, 12.71467], [-4.47356, 12.71252], [-4.41412, 12.31922], [-4.57703, 12.19875], [-4.54841, 12.1385], [-4.62546, 12.13204], [-4.62987, 12.06531], [-4.70692, 12.06746], [-4.72893, 12.01579], [-5.07897, 11.97918], [-5.26389, 11.84778], [-5.40258, 11.8327], [-5.26389, 11.75728], [-5.29251, 11.61715], [-5.22867, 11.60421], [-5.20665, 11.43811], [-5.25509, 11.36905], [-5.25949, 11.24816], [-5.32553, 11.21578], [-5.32994, 11.13371], [-5.49284, 11.07538], [-5.41579, 10.84628], [-5.47083, 10.75329], [-5.46643, 10.56074], [-5.51058, 10.43177], [-5.39602, 10.2929], [-5.12465, 10.29788], [-4.96453, 9.99923], [-4.96621, 9.89132], [-4.6426, 9.70696], [-4.31392, 9.60062], [-4.25999, 9.76012], [-3.69703, 9.94279], [-3.31779, 9.91125], [-3.27228, 9.84981], [-3.19306, 9.93781], [-3.16609, 9.85147], [-3.00765, 9.74019], [-2.93012, 9.57403], [-2.76494, 9.40778], [-2.68802, 9.49343], [-2.76534, 9.56589], [-2.74174, 9.83172], [-2.83108, 10.40252], [-2.94232, 10.64281], [-2.83373, 11.0067], [-0.67143, 10.99811], [-0.61937, 10.91305], [-0.44298, 11.04292], [-0.42391, 11.11661], [-0.38219, 11.12596], [-0.35955, 11.07801], [-0.28566, 11.12713], [-0.27374, 11.17157], [-0.13493, 11.14075], [0.50388, 11.01011], [0.48852, 10.98561], [0.50521, 10.98035], [0.4958, 10.93269], [0.66104, 10.99964], [0.91245, 10.99597], [0.9813, 11.08876], [1.03409, 11.04719], [1.42823, 11.46822], [2.00988, 11.42227], [2.29983, 11.68254], [2.39723, 11.89473], [2.05785, 12.35539], [2.26349, 12.41915], [0.99167, 13.10727], [0.99253, 13.37515], [1.18873, 13.31771], [1.21217, 13.37853], [1.24516, 13.33968], [1.28509, 13.35488], [1.24429, 13.39373], [1.20088, 13.38951], [1.02813, 13.46635], [0.99514, 13.5668], [0.77637, 13.64442], [0.77377, 13.6866], [0.61924, 13.68491], [0.38051, 14.05575], [0.16936, 14.51654], [0.23859, 15.00135]]]] } },
20527     { type: "Feature", properties: { iso1A2: "BG", iso1A3: "BGR", iso1N3: "100", wikidata: "Q219", nameEn: "Bulgaria", groups: ["EU", "151", "150", "UN"], callingCodes: ["359"] }, geometry: { type: "MultiPolygon", coordinates: [[[[23.05288, 43.79494], [22.85314, 43.84452], [22.83753, 43.88055], [22.87873, 43.9844], [23.01674, 44.01946], [23.04988, 44.07694], [22.67173, 44.21564], [22.61711, 44.16938], [22.61688, 44.06534], [22.41449, 44.00514], [22.35558, 43.81281], [22.41043, 43.69566], [22.47582, 43.6558], [22.53397, 43.47225], [22.82036, 43.33665], [22.89727, 43.22417], [23.00806, 43.19279], [22.98104, 43.11199], [22.89521, 43.03625], [22.78397, 42.98253], [22.74826, 42.88701], [22.54302, 42.87774], [22.43309, 42.82057], [22.4997, 42.74144], [22.43983, 42.56851], [22.55669, 42.50144], [22.51961, 42.3991], [22.47498, 42.3915], [22.45919, 42.33822], [22.34773, 42.31725], [22.38136, 42.30339], [22.47251, 42.20393], [22.50289, 42.19527], [22.51224, 42.15457], [22.67701, 42.06614], [22.86749, 42.02275], [22.90254, 41.87587], [22.96682, 41.77137], [23.01239, 41.76527], [23.03342, 41.71034], [22.95513, 41.63265], [22.96331, 41.35782], [22.93334, 41.34104], [23.1833, 41.31755], [23.21953, 41.33773], [23.22771, 41.37106], [23.31301, 41.40525], [23.33639, 41.36317], [23.40416, 41.39999], [23.52453, 41.40262], [23.63203, 41.37632], [23.67644, 41.41139], [23.76525, 41.40175], [23.80148, 41.43943], [23.89613, 41.45257], [23.91483, 41.47971], [23.96975, 41.44118], [24.06908, 41.46132], [24.06323, 41.53222], [24.10063, 41.54796], [24.18126, 41.51735], [24.27124, 41.57682], [24.30513, 41.51297], [24.52599, 41.56808], [24.61129, 41.42278], [24.71529, 41.41928], [24.8041, 41.34913], [24.82514, 41.4035], [24.86136, 41.39298], [24.90928, 41.40876], [24.942, 41.38685], [25.11611, 41.34212], [25.28322, 41.23411], [25.48187, 41.28506], [25.52394, 41.2798], [25.55082, 41.31667], [25.61042, 41.30614], [25.66183, 41.31316], [25.70507, 41.29209], [25.8266, 41.34563], [25.87919, 41.30526], [26.12926, 41.35878], [26.16548, 41.42278], [26.20288, 41.43943], [26.14796, 41.47533], [26.176, 41.50072], [26.17951, 41.55409], [26.14328, 41.55496], [26.15146, 41.60828], [26.07083, 41.64584], [26.06148, 41.70345], [26.16841, 41.74858], [26.21325, 41.73223], [26.22888, 41.74139], [26.2654, 41.71544], [26.30255, 41.70925], [26.35957, 41.71149], [26.32952, 41.73637], [26.33589, 41.76802], [26.36952, 41.82265], [26.53968, 41.82653], [26.57961, 41.90024], [26.56051, 41.92995], [26.62996, 41.97644], [26.79143, 41.97386], [26.95638, 42.00741], [27.03277, 42.0809], [27.08486, 42.08735], [27.19251, 42.06028], [27.22376, 42.10152], [27.27411, 42.10409], [27.45478, 41.96591], [27.52379, 41.93756], [27.55191, 41.90928], [27.69949, 41.97515], [27.81235, 41.94803], [27.83492, 41.99709], [27.91479, 41.97902], [28.02971, 41.98066], [28.32297, 41.98371], [29.24336, 43.70874], [28.23293, 43.76], [27.99558, 43.84193], [27.92008, 44.00761], [27.73468, 43.95326], [27.64542, 44.04958], [27.60834, 44.01206], [27.39757, 44.0141], [27.26845, 44.12602], [26.95141, 44.13555], [26.62712, 44.05698], [26.38764, 44.04356], [26.10115, 43.96908], [26.05584, 43.90925], [25.94911, 43.85745], [25.72792, 43.69263], [25.39528, 43.61866], [25.17144, 43.70261], [25.10718, 43.6831], [24.96682, 43.72693], [24.73542, 43.68523], [24.62281, 43.74082], [24.50264, 43.76314], [24.35364, 43.70211], [24.18149, 43.68218], [23.73978, 43.80627], [23.61687, 43.79289], [23.4507, 43.84936], [23.26772, 43.84843], [23.05288, 43.79494]]]] } },
20528     { type: "Feature", properties: { iso1A2: "BH", iso1A3: "BHR", iso1N3: "048", wikidata: "Q398", nameEn: "Bahrain", groups: ["145", "142", "UN"], callingCodes: ["973"] }, geometry: { type: "MultiPolygon", coordinates: [[[[50.93865, 26.30758], [50.71771, 26.73086], [50.38162, 26.53976], [50.26923, 26.08243], [50.302, 25.87592], [50.57069, 25.57887], [50.80824, 25.54641], [50.7801, 25.595], [50.86149, 25.6965], [50.81266, 25.88946], [50.93865, 26.30758]]]] } },
20529     { type: "Feature", properties: { iso1A2: "BI", iso1A3: "BDI", iso1N3: "108", wikidata: "Q967", nameEn: "Burundi", groups: ["014", "202", "002", "UN"], callingCodes: ["257"] }, geometry: { type: "MultiPolygon", coordinates: [[[[30.54501, -2.41404], [30.42933, -2.31064], [30.14034, -2.43626], [29.95911, -2.33348], [29.88237, -2.75105], [29.36805, -2.82933], [29.32234, -2.6483], [29.0562, -2.58632], [29.04081, -2.7416], [29.00167, -2.78523], [29.00404, -2.81978], [29.0505, -2.81774], [29.09119, -2.87871], [29.09797, -2.91935], [29.16037, -2.95457], [29.17258, -2.99385], [29.25633, -3.05471], [29.21463, -3.3514], [29.23708, -3.75856], [29.43673, -4.44845], [29.63827, -4.44681], [29.75109, -4.45836], [29.77289, -4.41733], [29.82885, -4.36153], [29.88172, -4.35743], [30.03323, -4.26631], [30.22042, -4.01738], [30.45915, -3.56532], [30.84165, -3.25152], [30.83823, -2.97837], [30.6675, -2.98987], [30.57926, -2.89791], [30.4987, -2.9573], [30.40662, -2.86151], [30.52747, -2.65841], [30.41789, -2.66266], [30.54501, -2.41404]]]] } },
20530     { type: "Feature", properties: { iso1A2: "BJ", iso1A3: "BEN", iso1N3: "204", wikidata: "Q962", nameEn: "Benin", aliases: ["DY"], groups: ["011", "202", "002", "UN"], callingCodes: ["229"] }, geometry: { type: "MultiPolygon", coordinates: [[[[3.59375, 11.70269], [3.48187, 11.86092], [3.31613, 11.88495], [3.25352, 12.01467], [2.83978, 12.40585], [2.6593, 12.30631], [2.37783, 12.24804], [2.39657, 12.10952], [2.45824, 11.98672], [2.39723, 11.89473], [2.29983, 11.68254], [2.00988, 11.42227], [1.42823, 11.46822], [1.03409, 11.04719], [0.9813, 11.08876], [0.91245, 10.99597], [0.8804, 10.803], [0.80358, 10.71459], [0.77666, 10.37665], [1.35507, 9.99525], [1.36624, 9.5951], [1.33675, 9.54765], [1.41746, 9.3226], [1.5649, 9.16941], [1.61838, 9.0527], [1.64249, 6.99562], [1.55877, 6.99737], [1.61812, 6.74843], [1.58105, 6.68619], [1.76906, 6.43189], [1.79826, 6.28221], [1.62913, 6.24075], [1.67336, 6.02702], [2.74181, 6.13349], [2.70566, 6.38038], [2.70464, 6.50831], [2.74334, 6.57291], [2.7325, 6.64057], [2.78204, 6.70514], [2.78823, 6.76356], [2.73405, 6.78508], [2.74024, 6.92802], [2.71702, 6.95722], [2.76965, 7.13543], [2.74489, 7.42565], [2.79442, 7.43486], [2.78668, 7.5116], [2.73405, 7.5423], [2.73095, 7.7755], [2.67523, 7.87825], [2.77907, 9.06924], [3.08017, 9.10006], [3.14147, 9.28375], [3.13928, 9.47167], [3.25093, 9.61632], [3.34726, 9.70696], [3.32099, 9.78032], [3.35383, 9.83641], [3.54429, 9.87739], [3.66908, 10.18136], [3.57275, 10.27185], [3.6844, 10.46351], [3.78292, 10.40538], [3.84243, 10.59316], [3.71505, 11.13015], [3.49175, 11.29765], [3.59375, 11.70269]]]] } },
20531     { type: "Feature", properties: { iso1A2: "BL", iso1A3: "BLM", iso1N3: "652", wikidata: "Q25362", nameEn: "Saint-Barth\xE9lemy", country: "FR", groups: ["EU", "Q1451600", "029", "003", "419", "019", "UN"], callingCodes: ["590"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-62.62718, 18.26185], [-63.1055, 17.86651], [-62.34423, 17.49165], [-62.62718, 18.26185]]]] } },
20532     { type: "Feature", properties: { iso1A2: "BM", iso1A3: "BMU", iso1N3: "060", wikidata: "Q23635", nameEn: "Bermuda", country: "GB", groups: ["BOTS", "021", "003", "019", "UN"], driveSide: "left", callingCodes: ["1 441"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-63.20987, 32.6953], [-65.31453, 32.68437], [-65.63955, 31.43417], [-63.20987, 32.6953]]]] } },
20533     { type: "Feature", properties: { iso1A2: "BN", iso1A3: "BRN", iso1N3: "096", wikidata: "Q921", nameEn: "Brunei", groups: ["Q36117", "035", "142", "UN"], driveSide: "left", callingCodes: ["673"] }, geometry: { type: "MultiPolygon", coordinates: [[[[115.16236, 5.01011], [115.02521, 5.35005], [114.10166, 4.76112], [114.07448, 4.58441], [114.15813, 4.57], [114.26876, 4.49878], [114.32176, 4.34942], [114.32176, 4.2552], [114.4416, 4.27588], [114.49922, 4.13108], [114.64211, 4.00694], [114.78539, 4.12205], [114.88039, 4.4257], [114.83189, 4.42387], [114.77303, 4.72871], [114.8266, 4.75062], [114.88841, 4.81905], [114.96982, 4.81146], [114.99417, 4.88201], [115.05038, 4.90275], [115.02955, 4.82087], [115.02278, 4.74137], [115.04064, 4.63706], [115.07737, 4.53418], [115.09978, 4.39123], [115.31275, 4.30806], [115.36346, 4.33563], [115.2851, 4.42295], [115.27819, 4.63661], [115.20737, 4.8256], [115.15092, 4.87604], [115.16236, 5.01011]]]] } },
20534     { type: "Feature", properties: { iso1A2: "BO", iso1A3: "BOL", iso1N3: "068", wikidata: "Q750", nameEn: "Bolivia", groups: ["005", "419", "019", "UN"], callingCodes: ["591"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-63.90248, -12.52544], [-64.22539, -12.45267], [-64.30708, -12.46398], [-64.99778, -11.98604], [-65.30027, -11.48749], [-65.28141, -10.86289], [-65.35402, -10.78685], [-65.37923, -10.35141], [-65.29019, -9.86253], [-65.40615, -9.63894], [-65.56244, -9.84266], [-65.68343, -9.75323], [-67.17784, -10.34016], [-68.71533, -11.14749], [-68.7651, -11.0496], [-68.75179, -11.03688], [-68.75265, -11.02383], [-68.74802, -11.00891], [-69.42792, -10.93451], [-69.47839, -10.95254], [-69.57156, -10.94555], [-68.98115, -11.8979], [-68.65044, -12.50689], [-68.85615, -12.87769], [-68.8864, -13.40792], [-69.05265, -13.68546], [-68.88135, -14.18639], [-69.36254, -14.94634], [-69.14856, -15.23478], [-69.40336, -15.61358], [-69.20291, -16.16668], [-69.09986, -16.22693], [-68.96238, -16.194], [-68.79464, -16.33272], [-68.98358, -16.42165], [-69.04027, -16.57214], [-69.00853, -16.66769], [-69.16896, -16.72233], [-69.62883, -17.28142], [-69.46863, -17.37466], [-69.46897, -17.4988], [-69.46623, -17.60518], [-69.34126, -17.72753], [-69.28671, -17.94844], [-69.07496, -18.03715], [-69.14807, -18.16893], [-69.07432, -18.28259], [-68.94987, -18.93302], [-68.87082, -19.06003], [-68.80602, -19.08355], [-68.61989, -19.27584], [-68.41218, -19.40499], [-68.66761, -19.72118], [-68.54611, -19.84651], [-68.57132, -20.03134], [-68.74273, -20.08817], [-68.7276, -20.46178], [-68.44023, -20.62701], [-68.55383, -20.7355], [-68.53957, -20.91542], [-68.40403, -20.94562], [-68.18816, -21.28614], [-67.85114, -22.87076], [-67.54284, -22.89771], [-67.18382, -22.81525], [-66.7298, -22.23644], [-66.29714, -22.08741], [-66.24077, -21.77837], [-66.03836, -21.84829], [-66.04832, -21.9187], [-65.9261, -21.93335], [-65.7467, -22.10105], [-65.61166, -22.09504], [-65.58694, -22.09794], [-65.57743, -22.07675], [-65.47435, -22.08908], [-64.99524, -22.08255], [-64.90014, -22.12136], [-64.67174, -22.18957], [-64.58888, -22.25035], [-64.4176, -22.67692], [-64.35108, -22.73282], [-64.31489, -22.88824], [-64.22918, -22.55807], [-63.93287, -21.99934], [-63.70963, -21.99934], [-63.68113, -22.0544], [-63.66482, -21.99918], [-62.81124, -21.9987], [-62.8078, -22.12534], [-62.64455, -22.25091], [-62.2757, -21.06657], [-62.26883, -20.55311], [-61.93912, -20.10053], [-61.73723, -19.63958], [-60.00638, -19.2981], [-59.06965, -19.29148], [-58.23216, -19.80058], [-58.16225, -20.16193], [-57.8496, -19.98346], [-58.14215, -19.76276], [-57.78463, -19.03259], [-57.71113, -19.03161], [-57.69134, -19.00544], [-57.71995, -18.97546], [-57.71995, -18.89573], [-57.76764, -18.90087], [-57.56807, -18.25655], [-57.48237, -18.24219], [-57.69877, -17.8431], [-57.73949, -17.56095], [-57.90082, -17.44555], [-57.99661, -17.5273], [-58.32935, -17.28195], [-58.5058, -16.80958], [-58.30918, -16.3699], [-58.32431, -16.25861], [-58.41506, -16.32636], [-60.16069, -16.26479], [-60.23797, -15.50267], [-60.58224, -15.09887], [-60.23968, -15.09515], [-60.27887, -14.63021], [-60.46037, -14.22496], [-60.48053, -13.77981], [-61.05527, -13.50054], [-61.81151, -13.49564], [-63.76259, -12.42952], [-63.90248, -12.52544]]]] } },
20535     { type: "Feature", properties: { iso1A2: "BQ", iso1A3: "BES", iso1N3: "535", wikidata: "Q27561", nameEn: "Caribbean Netherlands", country: "NL" }, geometry: null },
20536     { type: "Feature", properties: { iso1A2: "BR", iso1A3: "BRA", iso1N3: "076", wikidata: "Q155", nameEn: "Brazil", groups: ["005", "419", "019", "UN"], callingCodes: ["55"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-59.69361, 4.34069], [-59.78878, 4.45637], [-60.15953, 4.53456], [-60.04189, 4.69801], [-59.98129, 5.07097], [-60.20944, 5.28754], [-60.32352, 5.21299], [-60.73204, 5.20931], [-60.5802, 4.94312], [-60.86539, 4.70512], [-60.98303, 4.54167], [-61.15703, 4.49839], [-61.31457, 4.54167], [-61.29675, 4.44216], [-61.48569, 4.43149], [-61.54629, 4.2822], [-62.13094, 4.08309], [-62.44822, 4.18621], [-62.57656, 4.04754], [-62.74411, 4.03331], [-62.7655, 3.73099], [-62.98296, 3.59935], [-63.21111, 3.96219], [-63.4464, 3.9693], [-63.42233, 3.89995], [-63.50611, 3.83592], [-63.67099, 4.01731], [-63.70218, 3.91417], [-63.86082, 3.94796], [-63.99183, 3.90172], [-64.14512, 4.12932], [-64.57648, 4.12576], [-64.72977, 4.28931], [-64.84028, 4.24665], [-64.48379, 3.7879], [-64.02908, 2.79797], [-64.0257, 2.48156], [-63.39114, 2.4317], [-63.39827, 2.16098], [-64.06135, 1.94722], [-64.08274, 1.64792], [-64.34654, 1.35569], [-64.38932, 1.5125], [-65.11657, 1.12046], [-65.57288, 0.62856], [-65.50158, 0.92086], [-65.6727, 1.01353], [-66.28507, 0.74585], [-66.85795, 1.22998], [-67.08222, 1.17441], [-67.15784, 1.80439], [-67.299, 1.87494], [-67.40488, 2.22258], [-67.9292, 1.82455], [-68.18632, 2.00091], [-68.26699, 1.83463], [-68.18128, 1.72881], [-69.38621, 1.70865], [-69.53746, 1.76408], [-69.83491, 1.69353], [-69.82987, 1.07864], [-69.26017, 1.06856], [-69.14422, 0.84172], [-69.20976, 0.57958], [-69.47696, 0.71065], [-70.04162, 0.55437], [-70.03658, -0.19681], [-69.603, -0.51947], [-69.59796, -0.75136], [-69.4215, -1.01853], [-69.43395, -1.42219], [-69.94708, -4.2431], [-70.00888, -4.37833], [-70.11305, -4.27281], [-70.19582, -4.3607], [-70.33236, -4.15214], [-70.77601, -4.15717], [-70.96814, -4.36915], [-71.87003, -4.51661], [-72.64391, -5.0391], [-72.83973, -5.14765], [-73.24579, -6.05764], [-73.12983, -6.43852], [-73.73986, -6.87919], [-73.77011, -7.28944], [-73.96938, -7.58465], [-73.65485, -7.77897], [-73.76576, -7.89884], [-72.92886, -9.04074], [-73.21498, -9.40904], [-72.72216, -9.41397], [-72.31883, -9.5184], [-72.14742, -9.98049], [-71.23394, -9.9668], [-70.53373, -9.42628], [-70.58453, -9.58303], [-70.55429, -9.76692], [-70.62487, -9.80666], [-70.64134, -11.0108], [-70.51395, -10.92249], [-70.38791, -11.07096], [-69.90896, -10.92744], [-69.57835, -10.94051], [-69.57156, -10.94555], [-69.47839, -10.95254], [-69.42792, -10.93451], [-68.74802, -11.00891], [-68.75265, -11.02383], [-68.75179, -11.03688], [-68.7651, -11.0496], [-68.71533, -11.14749], [-67.17784, -10.34016], [-65.68343, -9.75323], [-65.56244, -9.84266], [-65.40615, -9.63894], [-65.29019, -9.86253], [-65.37923, -10.35141], [-65.35402, -10.78685], [-65.28141, -10.86289], [-65.30027, -11.48749], [-64.99778, -11.98604], [-64.30708, -12.46398], [-64.22539, -12.45267], [-63.90248, -12.52544], [-63.76259, -12.42952], [-61.81151, -13.49564], [-61.05527, -13.50054], [-60.48053, -13.77981], [-60.46037, -14.22496], [-60.27887, -14.63021], [-60.23968, -15.09515], [-60.58224, -15.09887], [-60.23797, -15.50267], [-60.16069, -16.26479], [-58.41506, -16.32636], [-58.32431, -16.25861], [-58.30918, -16.3699], [-58.5058, -16.80958], [-58.32935, -17.28195], [-57.99661, -17.5273], [-57.90082, -17.44555], [-57.73949, -17.56095], [-57.69877, -17.8431], [-57.48237, -18.24219], [-57.56807, -18.25655], [-57.76764, -18.90087], [-57.71995, -18.89573], [-57.71995, -18.97546], [-57.69134, -19.00544], [-57.71113, -19.03161], [-57.78463, -19.03259], [-58.14215, -19.76276], [-57.8496, -19.98346], [-58.16225, -20.16193], [-57.84536, -20.93155], [-57.93492, -21.65505], [-57.88239, -21.6868], [-57.94642, -21.73799], [-57.98625, -22.09157], [-56.6508, -22.28387], [-56.5212, -22.11556], [-56.45893, -22.08072], [-56.23206, -22.25347], [-55.8331, -22.29008], [-55.74941, -22.46436], [-55.741, -22.52018], [-55.72366, -22.5519], [-55.6986, -22.56268], [-55.68742, -22.58407], [-55.62493, -22.62765], [-55.63849, -22.95122], [-55.5446, -23.22811], [-55.52288, -23.2595], [-55.5555, -23.28237], [-55.43585, -23.87157], [-55.44117, -23.9185], [-55.41784, -23.9657], [-55.12292, -23.99669], [-55.0518, -23.98666], [-55.02691, -23.97317], [-54.6238, -23.83078], [-54.32807, -24.01865], [-54.28207, -24.07305], [-54.4423, -25.13381], [-54.62033, -25.46026], [-54.60196, -25.48397], [-54.59509, -25.53696], [-54.59398, -25.59224], [-54.5502, -25.58915], [-54.52926, -25.62846], [-53.90831, -25.55513], [-53.83691, -25.94849], [-53.73511, -26.04211], [-53.73086, -26.05842], [-53.7264, -26.0664], [-53.73391, -26.07006], [-53.73968, -26.10012], [-53.65018, -26.19501], [-53.65237, -26.23289], [-53.63739, -26.2496], [-53.63881, -26.25075], [-53.64632, -26.24798], [-53.64186, -26.25976], [-53.64505, -26.28089], [-53.68269, -26.33359], [-53.73372, -26.6131], [-53.80144, -27.09844], [-54.15978, -27.2889], [-54.19062, -27.27639], [-54.19268, -27.30751], [-54.41888, -27.40882], [-54.50416, -27.48232], [-54.67657, -27.57214], [-54.90159, -27.63132], [-54.90805, -27.73149], [-55.1349, -27.89759], [-55.16872, -27.86224], [-55.33303, -27.94661], [-55.6262, -28.17124], [-55.65418, -28.18304], [-56.01729, -28.51223], [-56.00458, -28.60421], [-56.05265, -28.62651], [-56.54171, -29.11447], [-56.57295, -29.11357], [-56.62789, -29.18073], [-56.81251, -29.48154], [-57.09386, -29.74211], [-57.65132, -30.19229], [-57.22502, -30.26121], [-56.90236, -30.02578], [-56.49267, -30.39471], [-56.4795, -30.3899], [-56.4619, -30.38457], [-55.87388, -31.05053], [-55.58866, -30.84117], [-55.5634, -30.8686], [-55.55373, -30.8732], [-55.55218, -30.88193], [-55.54572, -30.89051], [-55.53431, -30.89714], [-55.53276, -30.90218], [-55.52712, -30.89997], [-55.51862, -30.89828], [-55.50841, -30.9027], [-55.50821, -30.91349], [-54.17384, -31.86168], [-53.76024, -32.0751], [-53.39572, -32.58596], [-53.37671, -32.57005], [-53.1111, -32.71147], [-53.53459, -33.16843], [-53.52794, -33.68908], [-53.44031, -33.69344], [-53.39593, -33.75169], [-53.37138, -33.74313], [-52.83257, -34.01481], [-28.34015, -20.99094], [-28.99601, 1.86593], [-51.35485, 4.8383], [-51.63798, 4.51394], [-51.61983, 4.14596], [-51.79599, 3.89336], [-51.82312, 3.85825], [-51.85573, 3.83427], [-52.31787, 3.17896], [-52.6906, 2.37298], [-52.96539, 2.1881], [-53.78743, 2.34412], [-54.16286, 2.10779], [-54.6084, 2.32856], [-55.01919, 2.564], [-55.71493, 2.40342], [-55.96292, 2.53188], [-56.13054, 2.27723], [-55.92159, 2.05236], [-55.89863, 1.89861], [-55.99278, 1.83137], [-56.47045, 1.95135], [-56.7659, 1.89509], [-57.07092, 1.95304], [-57.09109, 2.01854], [-57.23981, 1.95808], [-57.35073, 1.98327], [-57.55743, 1.69605], [-57.77281, 1.73344], [-57.97336, 1.64566], [-58.01873, 1.51966], [-58.33887, 1.58014], [-58.4858, 1.48399], [-58.53571, 1.29154], [-58.84229, 1.17749], [-58.92072, 1.31293], [-59.25583, 1.40559], [-59.74066, 1.87596], [-59.7264, 2.27497], [-59.91177, 2.36759], [-59.99733, 2.92312], [-59.79769, 3.37162], [-59.86899, 3.57089], [-59.51963, 3.91951], [-59.73353, 4.20399], [-59.69361, 4.34069]]]] } },
20537     { type: "Feature", properties: { iso1A2: "BS", iso1A3: "BHS", iso1N3: "044", wikidata: "Q778", nameEn: "The Bahamas", groups: ["029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", callingCodes: ["1 242"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-72.98446, 20.4801], [-71.70065, 25.7637], [-78.91214, 27.76553], [-80.65727, 23.71953], [-72.98446, 20.4801]]]] } },
20538     { type: "Feature", properties: { iso1A2: "BT", iso1A3: "BTN", iso1N3: "064", wikidata: "Q917", nameEn: "Bhutan", groups: ["034", "142", "UN"], driveSide: "left", callingCodes: ["975"] }, geometry: { type: "MultiPolygon", coordinates: [[[[91.6469, 27.76358], [91.5629, 27.84823], [91.48973, 27.93903], [91.46327, 28.0064], [91.25779, 28.07509], [91.20019, 27.98715], [90.69894, 28.07784], [90.58842, 28.02838], [90.13387, 28.19178], [89.79762, 28.23979], [89.59525, 28.16433], [89.12825, 27.62502], [89.0582, 27.60985], [88.97213, 27.51671], [88.95355, 27.4106], [89.00216, 27.32532], [88.96947, 27.30319], [88.93678, 27.33777], [88.91901, 27.32483], [88.74219, 27.144], [88.86984, 27.10937], [88.8714, 26.97488], [88.92301, 26.99286], [88.95807, 26.92668], [89.09554, 26.89089], [89.12825, 26.81661], [89.1926, 26.81329], [89.37913, 26.86224], [89.38319, 26.85963], [89.3901, 26.84225], [89.42349, 26.83727], [89.63369, 26.74402], [89.86124, 26.73307], [90.04535, 26.72422], [90.30402, 26.85098], [90.39271, 26.90704], [90.48504, 26.8594], [90.67715, 26.77215], [91.50067, 26.79223], [91.83181, 26.87318], [92.05523, 26.8692], [92.11863, 26.893], [92.03457, 27.07334], [92.04702, 27.26861], [92.12019, 27.27829], [92.01132, 27.47352], [91.65007, 27.48287], [91.55819, 27.6144], [91.6469, 27.76358]]]] } },
20539     { type: "Feature", properties: { iso1A2: "BV", iso1A3: "BVT", iso1N3: "074", wikidata: "Q23408", nameEn: "Bouvet Island", country: "NO", groups: ["005", "419", "019", "UN"] }, geometry: { type: "MultiPolygon", coordinates: [[[[4.54042, -54.0949], [2.28941, -54.13089], [3.35353, -55.17558], [4.54042, -54.0949]]]] } },
20540     { type: "Feature", properties: { iso1A2: "BW", iso1A3: "BWA", iso1N3: "072", wikidata: "Q963", nameEn: "Botswana", groups: ["018", "202", "002", "UN"], driveSide: "left", callingCodes: ["267"] }, geometry: { type: "MultiPolygon", coordinates: [[[[25.26433, -17.79571], [25.16882, -17.78253], [25.05895, -17.84452], [24.95586, -17.79674], [24.73364, -17.89338], [24.71887, -17.9218], [24.6303, -17.9863], [24.57485, -18.07151], [24.40577, -17.95726], [24.19416, -18.01919], [23.61088, -18.4881], [23.29618, -17.99855], [23.0996, -18.00075], [21.45556, -18.31795], [20.99904, -18.31743], [20.99751, -22.00026], [19.99912, -21.99991], [19.99817, -24.76768], [20.02809, -24.78725], [20.03678, -24.81004], [20.29826, -24.94869], [20.64795, -25.47827], [20.86081, -26.14892], [20.61754, -26.4692], [20.63275, -26.78181], [20.68596, -26.9039], [20.87031, -26.80047], [21.13353, -26.86661], [21.37869, -26.82083], [21.69322, -26.86152], [21.7854, -26.79199], [21.77114, -26.69015], [21.83291, -26.65959], [21.90703, -26.66808], [22.06192, -26.61882], [22.21206, -26.3773], [22.41921, -26.23078], [22.56365, -26.19668], [22.70808, -25.99186], [22.86012, -25.50572], [23.03497, -25.29971], [23.47588, -25.29971], [23.9244, -25.64286], [24.18287, -25.62916], [24.36531, -25.773], [24.44703, -25.73021], [24.67319, -25.81749], [24.8946, -25.80723], [25.01718, -25.72507], [25.12266, -25.75931], [25.33076, -25.76616], [25.58543, -25.6343], [25.6643, -25.4491], [25.69661, -25.29284], [25.72702, -25.25503], [25.88571, -24.87802], [25.84295, -24.78661], [25.8515, -24.75727], [26.39409, -24.63468], [26.46346, -24.60358], [26.51667, -24.47219], [26.84165, -24.24885], [26.99749, -23.65486], [27.33768, -23.40917], [27.52393, -23.37952], [27.6066, -23.21894], [27.74154, -23.2137], [27.93539, -23.04941], [27.93729, -22.96194], [28.04752, -22.90243], [28.04562, -22.8394], [28.34874, -22.5694], [28.63287, -22.55887], [28.91889, -22.44299], [29.0151, -22.22907], [29.10881, -22.21202], [29.15268, -22.21399], [29.18974, -22.18599], [29.21955, -22.17771], [29.37703, -22.19581], [29.3533, -22.18363], [29.24648, -22.05967], [29.1974, -22.07472], [29.14501, -22.07275], [29.08495, -22.04867], [29.04108, -22.00563], [29.02191, -21.95665], [29.02191, -21.90647], [29.04023, -21.85864], [29.07763, -21.81877], [28.58114, -21.63455], [28.49942, -21.66634], [28.29416, -21.59037], [28.01669, -21.57624], [27.91407, -21.31621], [27.69171, -21.08409], [27.72972, -20.51735], [27.69361, -20.48531], [27.28865, -20.49873], [27.29831, -20.28935], [27.21278, -20.08244], [26.72246, -19.92707], [26.17227, -19.53709], [25.96226, -19.08152], [25.99837, -19.02943], [25.94326, -18.90362], [25.82353, -18.82808], [25.79217, -18.6355], [25.68859, -18.56165], [25.53465, -18.39041], [25.39972, -18.12691], [25.31799, -18.07091], [25.23909, -17.90832], [25.26433, -17.79571]]]] } },
20541     { type: "Feature", properties: { iso1A2: "BY", iso1A3: "BLR", iso1N3: "112", wikidata: "Q184", nameEn: "Belarus", groups: ["151", "150", "UN"], callingCodes: ["375"] }, geometry: { type: "MultiPolygon", coordinates: [[[[28.15217, 56.16964], [27.97865, 56.11849], [27.63065, 55.89687], [27.61683, 55.78558], [27.3541, 55.8089], [27.27804, 55.78299], [27.1559, 55.85032], [26.97153, 55.8102], [26.87448, 55.7172], [26.76872, 55.67658], [26.71802, 55.70645], [26.64888, 55.70515], [26.63231, 55.67968], [26.63167, 55.57887], [26.55094, 55.5093], [26.5522, 55.40277], [26.44937, 55.34832], [26.5709, 55.32572], [26.6714, 55.33902], [26.80929, 55.31642], [26.83266, 55.30444], [26.835, 55.28182], [26.73017, 55.24226], [26.72983, 55.21788], [26.68075, 55.19787], [26.69243, 55.16718], [26.54753, 55.14181], [26.51481, 55.16051], [26.46249, 55.12814], [26.35121, 55.1525], [26.30628, 55.12536], [26.23202, 55.10439], [26.26941, 55.08032], [26.20397, 54.99729], [26.13386, 54.98924], [26.05907, 54.94631], [25.99129, 54.95705], [25.89462, 54.93438], [25.74122, 54.80108], [25.75977, 54.57252], [25.68045, 54.5321], [25.64813, 54.48704], [25.62203, 54.4656], [25.63371, 54.42075], [25.5376, 54.33158], [25.55425, 54.31591], [25.68513, 54.31727], [25.78553, 54.23327], [25.78563, 54.15747], [25.71084, 54.16704], [25.64875, 54.1259], [25.54724, 54.14925], [25.51452, 54.17799], [25.56823, 54.25212], [25.509, 54.30267], [25.35559, 54.26544], [25.22705, 54.26271], [25.19199, 54.219], [25.0728, 54.13419], [24.991, 54.14241], [24.96894, 54.17589], [24.77131, 54.11091], [24.85311, 54.02862], [24.74279, 53.96663], [24.69185, 53.96543], [24.69652, 54.01901], [24.62275, 54.00217], [24.44411, 53.90076], [24.34128, 53.90076], [24.19638, 53.96405], [23.98837, 53.92554], [23.95098, 53.9613], [23.81309, 53.94205], [23.80543, 53.89558], [23.71726, 53.93379], [23.61677, 53.92691], [23.51284, 53.95052], [23.62004, 53.60942], [23.81995, 53.24131], [23.85657, 53.22923], [23.91393, 53.16469], [23.87548, 53.0831], [23.92184, 53.02079], [23.94689, 52.95919], [23.91805, 52.94016], [23.93763, 52.71332], [23.73615, 52.6149], [23.58296, 52.59868], [23.45112, 52.53774], [23.34141, 52.44845], [23.18196, 52.28812], [23.20071, 52.22848], [23.47859, 52.18215], [23.54314, 52.12148], [23.61, 52.11264], [23.64066, 52.07626], [23.68733, 51.9906], [23.61523, 51.92066], [23.62691, 51.78208], [23.53198, 51.74298], [23.57053, 51.55938], [23.56236, 51.53673], [23.62751, 51.50512], [23.6736, 51.50255], [23.60906, 51.62122], [23.7766, 51.66809], [23.91118, 51.63316], [23.8741, 51.59734], [23.99907, 51.58369], [24.13075, 51.66979], [24.3163, 51.75063], [24.29021, 51.80841], [24.37123, 51.88222], [24.98784, 51.91273], [25.20228, 51.97143], [25.46163, 51.92205], [25.73673, 51.91973], [25.80574, 51.94556], [25.83217, 51.92587], [26.00408, 51.92967], [26.19084, 51.86781], [26.39367, 51.87315], [26.46962, 51.80501], [26.69759, 51.82284], [26.80043, 51.75777], [26.9489, 51.73788], [26.99422, 51.76933], [27.20602, 51.77291], [27.20948, 51.66713], [27.26613, 51.65957], [27.24828, 51.60161], [27.47212, 51.61184], [27.51058, 51.5854], [27.55727, 51.63486], [27.71932, 51.60672], [27.67125, 51.50854], [27.76052, 51.47604], [27.85253, 51.62293], [27.91844, 51.61952], [27.95827, 51.56065], [28.10658, 51.57857], [28.23452, 51.66988], [28.37592, 51.54505], [28.47051, 51.59734], [28.64429, 51.5664], [28.69161, 51.44695], [28.73143, 51.46236], [28.75615, 51.41442], [28.78224, 51.45294], [28.76027, 51.48802], [28.81795, 51.55552], [28.95528, 51.59222], [28.99098, 51.56833], [29.1187, 51.65872], [29.16402, 51.64679], [29.20659, 51.56918], [29.25603, 51.57089], [29.25191, 51.49828], [29.32881, 51.37843], [29.42357, 51.4187], [29.49773, 51.39814], [29.54372, 51.48372], [29.7408, 51.53417], [29.77376, 51.4461], [30.17888, 51.51025], [30.34642, 51.42555], [30.36153, 51.33984], [30.56203, 51.25655], [30.64992, 51.35014], [30.51946, 51.59649], [30.68804, 51.82806], [30.76443, 51.89739], [30.90897, 52.00699], [30.95589, 52.07775], [31.13332, 52.1004], [31.25142, 52.04131], [31.38326, 52.12991], [31.7822, 52.11406], [31.77877, 52.18636], [31.6895, 52.1973], [31.70735, 52.26711], [31.57971, 52.32146], [31.62084, 52.33849], [31.61397, 52.48843], [31.56316, 52.51518], [31.63869, 52.55361], [31.50406, 52.69707], [31.57277, 52.71613], [31.592, 52.79011], [31.35667, 52.97854], [31.24147, 53.031], [31.32283, 53.04101], [31.33519, 53.08805], [31.3915, 53.09712], [31.36403, 53.13504], [31.40523, 53.21406], [31.56316, 53.19432], [31.62496, 53.22886], [31.787, 53.18033], [31.82373, 53.10042], [32.15368, 53.07594], [32.40773, 53.18856], [32.51725, 53.28431], [32.73257, 53.33494], [32.74968, 53.45597], [32.47777, 53.5548], [32.40499, 53.6656], [32.50112, 53.68594], [32.45717, 53.74039], [32.36663, 53.7166], [32.12621, 53.81586], [31.89137, 53.78099], [31.77028, 53.80015], [31.85019, 53.91801], [31.88744, 54.03653], [31.89599, 54.0837], [31.57002, 54.14535], [31.30791, 54.25315], [31.3177, 54.34067], [31.22945, 54.46585], [31.08543, 54.50361], [31.21399, 54.63113], [31.19339, 54.66947], [30.99187, 54.67046], [30.98226, 54.68872], [31.0262, 54.70698], [30.97127, 54.71967], [30.95479, 54.74346], [30.75165, 54.80699], [30.8264, 54.90062], [30.81759, 54.94064], [30.93144, 54.9585], [30.95754, 54.98609], [30.9081, 55.02232], [30.94243, 55.03964], [31.00972, 55.02783], [31.02071, 55.06167], [30.97369, 55.17134], [30.87944, 55.28223], [30.81946, 55.27931], [30.8257, 55.3313], [30.93144, 55.3914], [30.90123, 55.46621], [30.95204, 55.50667], [30.93419, 55.6185], [30.86003, 55.63169], [30.7845, 55.58514], [30.72957, 55.66268], [30.67464, 55.64176], [30.63344, 55.73079], [30.51037, 55.76568], [30.51346, 55.78982], [30.48257, 55.81066], [30.30987, 55.83592], [30.27776, 55.86819], [30.12136, 55.8358], [29.97975, 55.87281], [29.80672, 55.79569], [29.61446, 55.77716], [29.51283, 55.70294], [29.3604, 55.75862], [29.44692, 55.95978], [29.21717, 55.98971], [29.08299, 56.03427], [28.73418, 55.97131], [28.63668, 56.07262], [28.68337, 56.10173], [28.5529, 56.11705], [28.43068, 56.09407], [28.37987, 56.11399], [28.36888, 56.05805], [28.30571, 56.06035], [28.15217, 56.16964]]]] } },
20542     { type: "Feature", properties: { iso1A2: "BZ", iso1A3: "BLZ", iso1N3: "084", wikidata: "Q242", nameEn: "Belize", groups: ["013", "003", "419", "019", "UN"], roadSpeedUnit: "mph", callingCodes: ["501"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-88.3268, 18.49048], [-88.48242, 18.49164], [-88.71505, 18.0707], [-88.8716, 17.89535], [-89.03839, 18.0067], [-89.15105, 17.95104], [-89.14985, 17.81563], [-89.15025, 17.04813], [-89.22683, 15.88619], [-89.17418, 15.90898], [-89.02415, 15.9063], [-88.95358, 15.88698], [-88.40779, 16.09624], [-86.92368, 17.61462], [-87.84815, 18.18511], [-87.85693, 18.18266], [-87.86657, 18.19971], [-87.87604, 18.18313], [-87.90671, 18.15213], [-88.03165, 18.16657], [-88.03238, 18.41778], [-88.26593, 18.47617], [-88.29909, 18.47591], [-88.3268, 18.49048]]]] } },
20543     { type: "Feature", properties: { iso1A2: "CA", iso1A3: "CAN", iso1N3: "124", wikidata: "Q16", nameEn: "Canada", groups: ["021", "003", "019", "UN"], callingCodes: ["1"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-67.20349, 45.1722], [-67.19603, 45.16771], [-67.15965, 45.16179], [-67.11316, 45.11176], [-67.0216, 44.95333], [-66.96824, 44.90965], [-66.98249, 44.87071], [-66.96824, 44.83078], [-66.93432, 44.82597], [-67.16117, 44.20069], [-61.98255, 37.34815], [-56.27503, 47.39728], [-53.12387, 41.40385], [-46.37635, 57.3249], [-77.52957, 77.23408], [-68.21821, 80.48551], [-49.33696, 84.57952], [-140.97446, 84.39275], [-141.00116, 60.30648], [-140.5227, 60.22077], [-140.45648, 60.30919], [-139.98024, 60.18027], [-139.68991, 60.33693], [-139.05831, 60.35205], [-139.20603, 60.08896], [-139.05365, 59.99655], [-138.71149, 59.90728], [-138.62145, 59.76431], [-137.60623, 59.24465], [-137.4925, 58.89415], [-136.82619, 59.16198], [-136.52365, 59.16752], [-136.47323, 59.46617], [-136.33727, 59.44466], [-136.22381, 59.55526], [-136.31566, 59.59083], [-135.48007, 59.79937], [-135.03069, 59.56208], [-135.00267, 59.28745], [-134.7047, 59.2458], [-134.55699, 59.1297], [-134.48059, 59.13231], [-134.27175, 58.8634], [-133.84645, 58.73543], [-133.38523, 58.42773], [-131.8271, 56.62247], [-130.77769, 56.36185], [-130.33965, 56.10849], [-130.10173, 56.12178], [-130.00093, 56.00325], [-130.00857, 55.91344], [-130.15373, 55.74895], [-129.97513, 55.28029], [-130.08035, 55.21556], [-130.18765, 55.07744], [-130.27203, 54.97174], [-130.44184, 54.85377], [-130.64499, 54.76912], [-130.61931, 54.70835], [-133.92876, 54.62289], [-133.36909, 48.51151], [-125.03842, 48.53282], [-123.50039, 48.21223], [-123.15614, 48.35395], [-123.26565, 48.6959], [-123.0093, 48.76586], [-123.0093, 48.83186], [-123.32163, 49.00419], [-95.15355, 48.9996], [-95.15357, 49.384], [-95.12903, 49.37056], [-95.05825, 49.35311], [-95.01419, 49.35647], [-94.99532, 49.36579], [-94.95681, 49.37035], [-94.85381, 49.32492], [-94.8159, 49.32299], [-94.82487, 49.29483], [-94.77355, 49.11998], [-94.75017, 49.09931], [-94.687, 48.84077], [-94.70087, 48.8339], [-94.70486, 48.82365], [-94.69669, 48.80918], [-94.69335, 48.77883], [-94.58903, 48.71803], [-94.54885, 48.71543], [-94.53826, 48.70216], [-94.44258, 48.69223], [-94.4174, 48.71049], [-94.27153, 48.70232], [-94.25172, 48.68404], [-94.25104, 48.65729], [-94.23215, 48.65202], [-93.85769, 48.63284], [-93.83288, 48.62745], [-93.80676, 48.58232], [-93.80939, 48.52439], [-93.79267, 48.51631], [-93.66382, 48.51845], [-93.47022, 48.54357], [-93.44472, 48.59147], [-93.40693, 48.60948], [-93.39758, 48.60364], [-93.3712, 48.60599], [-93.33946, 48.62787], [-93.25391, 48.64266], [-92.94973, 48.60866], [-92.7287, 48.54005], [-92.6342, 48.54133], [-92.62747, 48.50278], [-92.69927, 48.49573], [-92.71323, 48.46081], [-92.65606, 48.43471], [-92.50712, 48.44921], [-92.45588, 48.40624], [-92.48147, 48.36609], [-92.37185, 48.22259], [-92.27167, 48.25046], [-92.30939, 48.31251], [-92.26662, 48.35651], [-92.202, 48.35252], [-92.14732, 48.36578], [-92.05339, 48.35958], [-91.98929, 48.25409], [-91.86125, 48.21278], [-91.71231, 48.19875], [-91.70451, 48.11805], [-91.55649, 48.10611], [-91.58025, 48.04339], [-91.45829, 48.07454], [-91.43248, 48.04912], [-91.25025, 48.08522], [-91.08016, 48.18096], [-90.87588, 48.2484], [-90.75045, 48.09143], [-90.56444, 48.12184], [-90.56312, 48.09488], [-90.07418, 48.11043], [-89.89974, 47.98109], [-89.77248, 48.02607], [-89.57972, 48.00023], [-89.48837, 48.01412], [-88.37033, 48.30586], [-84.85871, 46.88881], [-84.55635, 46.45974], [-84.47607, 46.45225], [-84.4481, 46.48972], [-84.42101, 46.49853], [-84.34174, 46.50683], [-84.29893, 46.49127], [-84.26351, 46.49508], [-84.2264, 46.53337], [-84.1945, 46.54061], [-84.17723, 46.52753], [-84.12885, 46.53068], [-84.11196, 46.50248], [-84.13451, 46.39218], [-84.11254, 46.32329], [-84.11615, 46.2681], [-84.09756, 46.25512], [-84.1096, 46.23987], [-83.95399, 46.05634], [-83.90453, 46.05922], [-83.83329, 46.12169], [-83.57017, 46.105], [-83.43746, 45.99749], [-83.59589, 45.82131], [-82.48419, 45.30225], [-82.42469, 42.992], [-82.4146, 42.97626], [-82.4253, 42.95423], [-82.45331, 42.93139], [-82.4826, 42.8068], [-82.46613, 42.76615], [-82.51063, 42.66025], [-82.51858, 42.611], [-82.57583, 42.5718], [-82.58873, 42.54984], [-82.64242, 42.55594], [-82.82964, 42.37355], [-83.02253, 42.33045], [-83.07837, 42.30978], [-83.09837, 42.28877], [-83.12724, 42.2376], [-83.14962, 42.04089], [-83.11184, 41.95671], [-82.67862, 41.67615], [-78.93684, 42.82887], [-78.90712, 42.89733], [-78.90905, 42.93022], [-78.93224, 42.95229], [-78.96312, 42.95509], [-78.98126, 42.97], [-79.02074, 42.98444], [-79.02424, 43.01983], [-78.99941, 43.05612], [-79.01055, 43.06659], [-79.07486, 43.07845], [-79.05671, 43.10937], [-79.06881, 43.12029], [-79.0427, 43.13934], [-79.04652, 43.16396], [-79.05384, 43.17418], [-79.05002, 43.20133], [-79.05544, 43.21224], [-79.05512, 43.25375], [-79.06921, 43.26183], [-79.25796, 43.54052], [-76.79706, 43.63099], [-76.43859, 44.09393], [-76.35324, 44.13493], [-76.31222, 44.19894], [-76.244, 44.19643], [-76.1664, 44.23051], [-76.16285, 44.28262], [-76.00018, 44.34896], [-75.95947, 44.34463], [-75.8217, 44.43176], [-75.76813, 44.51537], [-75.41441, 44.76614], [-75.2193, 44.87821], [-75.01363, 44.95608], [-74.99101, 44.98051], [-74.8447, 45.00606], [-74.66689, 45.00646], [-74.32699, 44.99029], [-73.35025, 45.00942], [-71.50067, 45.01357], [-71.48735, 45.07784], [-71.42778, 45.12624], [-71.40364, 45.21382], [-71.44252, 45.2361], [-71.37133, 45.24624], [-71.29371, 45.29996], [-71.22338, 45.25184], [-71.19723, 45.25438], [-71.14568, 45.24128], [-71.08364, 45.30623], [-71.01866, 45.31573], [-71.0107, 45.34819], [-70.95193, 45.33895], [-70.91169, 45.29849], [-70.89864, 45.2398], [-70.84816, 45.22698], [-70.80236, 45.37444], [-70.82638, 45.39828], [-70.78372, 45.43269], [-70.65383, 45.37592], [-70.62518, 45.42286], [-70.72651, 45.49771], [-70.68516, 45.56964], [-70.54019, 45.67291], [-70.38934, 45.73215], [-70.41523, 45.79497], [-70.25976, 45.89675], [-70.24694, 45.95138], [-70.31025, 45.96424], [-70.23855, 46.1453], [-70.29078, 46.18832], [-70.18547, 46.35357], [-70.05812, 46.41768], [-69.99966, 46.69543], [-69.22119, 47.46461], [-69.05148, 47.42012], [-69.05073, 47.30076], [-69.05039, 47.2456], [-68.89222, 47.1807], [-68.70125, 47.24399], [-68.60575, 47.24659], [-68.57914, 47.28431], [-68.38332, 47.28723], [-68.37458, 47.35851], [-68.23244, 47.35712], [-67.94843, 47.1925], [-67.87993, 47.10377], [-67.78578, 47.06473], [-67.78111, 45.9392], [-67.75196, 45.91814], [-67.80961, 45.87531], [-67.75654, 45.82324], [-67.80653, 45.80022], [-67.80705, 45.69528], [-67.6049, 45.60725], [-67.43815, 45.59162], [-67.42144, 45.50584], [-67.50578, 45.48971], [-67.42394, 45.37969], [-67.48201, 45.27351], [-67.34927, 45.122], [-67.29754, 45.14865], [-67.29748, 45.18173], [-67.27039, 45.1934], [-67.22751, 45.16344], [-67.20349, 45.1722]]]] } },
20544     { type: "Feature", properties: { iso1A2: "CC", iso1A3: "CCK", iso1N3: "166", wikidata: "Q36004", nameEn: "Cocos (Keeling) Islands", country: "AU", groups: ["053", "009", "UN"], driveSide: "left", callingCodes: ["61"] }, geometry: { type: "MultiPolygon", coordinates: [[[[96.61846, -10.82438], [96.02343, -12.68334], [97.93979, -12.33309], [96.61846, -10.82438]]]] } },
20545     { type: "Feature", properties: { iso1A2: "CD", iso1A3: "COD", iso1N3: "180", wikidata: "Q974", nameEn: "Democratic Republic of the Congo", aliases: ["ZR"], groups: ["017", "202", "002", "UN"], callingCodes: ["243"] }, geometry: { type: "MultiPolygon", coordinates: [[[[27.44012, 5.07349], [27.09575, 5.22305], [26.93064, 5.13535], [26.85579, 5.03887], [26.74572, 5.10685], [26.48595, 5.04984], [26.13371, 5.25594], [25.86073, 5.19455], [25.53271, 5.37431], [25.34558, 5.29101], [25.31256, 5.03668], [24.71816, 4.90509], [24.46719, 5.0915], [23.38847, 4.60013], [22.94817, 4.82392], [22.89094, 4.79321], [22.84691, 4.69887], [22.78526, 4.71423], [22.6928, 4.47285], [22.60915, 4.48821], [22.5431, 4.22041], [22.45504, 4.13039], [22.27682, 4.11347], [22.10721, 4.20723], [21.6405, 4.317], [21.55904, 4.25553], [21.25744, 4.33676], [21.21341, 4.29285], [21.11214, 4.33895], [21.08793, 4.39603], [20.90383, 4.44877], [20.60184, 4.42394], [18.62755, 3.47564], [18.63857, 3.19342], [18.10683, 2.26876], [18.08034, 1.58553], [17.85887, 1.04327], [17.86989, 0.58873], [17.95255, 0.48128], [17.93877, 0.32424], [17.81204, 0.23884], [17.66051, -0.26535], [17.72112, -0.52707], [17.32438, -0.99265], [16.97999, -1.12762], [16.70724, -1.45815], [16.50336, -1.8795], [16.16173, -2.16586], [16.22785, -2.59528], [16.1755, -3.25014], [16.21407, -3.2969], [15.89448, -3.9513], [15.53081, -4.042], [15.48121, -4.22062], [15.41785, -4.28381], [15.32693, -4.27282], [15.25411, -4.31121], [15.1978, -4.32388], [14.83101, -4.80838], [14.67948, -4.92093], [14.5059, -4.84956], [14.41499, -4.8825], [14.37366, -4.56125], [14.47284, -4.42941], [14.3957, -4.36623], [14.40672, -4.28381], [13.9108, -4.50906], [13.81162, -4.41842], [13.71794, -4.44864], [13.70417, -4.72601], [13.50305, -4.77818], [13.41764, -4.89897], [13.11182, -4.5942], [13.09648, -4.63739], [13.11195, -4.67745], [12.8733, -4.74346], [12.70868, -4.95505], [12.63465, -4.94632], [12.60251, -5.01715], [12.46297, -5.09408], [12.49815, -5.14058], [12.51589, -5.1332], [12.53586, -5.14658], [12.53599, -5.1618], [12.52301, -5.17481], [12.52318, -5.74353], [12.26557, -5.74031], [12.20376, -5.76338], [11.95767, -5.94705], [12.42245, -6.07585], [13.04371, -5.87078], [16.55507, -5.85631], [16.96282, -7.21787], [17.5828, -8.13784], [18.33635, -8.00126], [19.33698, -7.99743], [19.5469, -7.00195], [20.30218, -6.98955], [20.31846, -6.91953], [20.61689, -6.90876], [20.56263, -7.28566], [21.79824, -7.29628], [21.84856, -9.59871], [22.19039, -9.94628], [22.32604, -10.76291], [22.17954, -10.85884], [22.25951, -11.24911], [22.54205, -11.05784], [23.16602, -11.10577], [23.45631, -10.946], [23.86868, -11.02856], [24.00027, -10.89356], [24.34528, -11.06816], [24.42612, -11.44975], [25.34069, -11.19707], [25.33058, -11.65767], [26.01777, -11.91488], [26.88687, -12.01868], [27.04351, -11.61312], [27.22541, -11.60323], [27.21025, -11.76157], [27.59932, -12.22123], [28.33199, -12.41375], [29.01918, -13.41353], [29.60531, -13.21685], [29.65078, -13.41844], [29.81551, -13.44683], [29.8139, -12.14898], [29.48404, -12.23604], [29.4992, -12.43843], [29.18592, -12.37921], [28.48357, -11.87532], [28.37241, -11.57848], [28.65032, -10.65133], [28.62795, -9.92942], [28.68532, -9.78], [28.56208, -9.49122], [28.51627, -9.44726], [28.52636, -9.35379], [28.36562, -9.30091], [28.38526, -9.23393], [28.9711, -8.66935], [28.88917, -8.4831], [30.79243, -8.27382], [30.2567, -7.14121], [29.52552, -6.2731], [29.43673, -4.44845], [29.23708, -3.75856], [29.21463, -3.3514], [29.25633, -3.05471], [29.17258, -2.99385], [29.16037, -2.95457], [29.09797, -2.91935], [29.09119, -2.87871], [29.0505, -2.81774], [29.00404, -2.81978], [29.00167, -2.78523], [29.04081, -2.7416], [29.00357, -2.70596], [28.94346, -2.69124], [28.89793, -2.66111], [28.90226, -2.62385], [28.89288, -2.55848], [28.87943, -2.55165], [28.86193, -2.53185], [28.86209, -2.5231], [28.87497, -2.50887], [28.88846, -2.50493], [28.89342, -2.49017], [28.89132, -2.47557], [28.86846, -2.44866], [28.86826, -2.41888], [28.89601, -2.37321], [28.95642, -2.37321], [29.00051, -2.29001], [29.105, -2.27043], [29.17562, -2.12278], [29.11847, -1.90576], [29.24458, -1.69663], [29.24323, -1.66826], [29.36322, -1.50887], [29.45038, -1.5054], [29.53062, -1.40499], [29.59061, -1.39016], [29.58388, -0.89821], [29.63006, -0.8997], [29.62708, -0.71055], [29.67176, -0.55714], [29.67474, -0.47969], [29.65091, -0.46777], [29.72687, -0.08051], [29.7224, 0.07291], [29.77454, 0.16675], [29.81922, 0.16824], [29.87284, 0.39166], [29.97413, 0.52124], [29.95477, 0.64486], [29.98307, 0.84295], [30.1484, 0.89805], [30.22139, 0.99635], [30.24671, 1.14974], [30.48503, 1.21675], [31.30127, 2.11006], [31.28042, 2.17853], [31.20148, 2.2217], [31.1985, 2.29462], [31.12104, 2.27676], [31.07934, 2.30207], [31.06593, 2.35862], [30.96911, 2.41071], [30.91102, 2.33332], [30.83059, 2.42559], [30.74271, 2.43601], [30.75612, 2.5863], [30.8857, 2.83923], [30.8574, 2.9508], [30.77101, 3.04897], [30.84251, 3.26908], [30.93486, 3.40737], [30.94081, 3.50847], [30.85153, 3.48867], [30.85997, 3.5743], [30.80713, 3.60506], [30.78512, 3.67097], [30.56277, 3.62703], [30.57378, 3.74567], [30.55396, 3.84451], [30.47691, 3.83353], [30.27658, 3.95653], [30.22374, 3.93896], [30.1621, 4.10586], [30.06964, 4.13221], [29.79666, 4.37809], [29.82087, 4.56246], [29.49726, 4.7007], [29.43341, 4.50101], [29.22207, 4.34297], [29.03054, 4.48784], [28.8126, 4.48784], [28.6651, 4.42638], [28.20719, 4.35614], [27.79551, 4.59976], [27.76469, 4.79284], [27.65462, 4.89375], [27.56656, 4.89375], [27.44012, 5.07349]]]] } },
20546     { type: "Feature", properties: { iso1A2: "CF", iso1A3: "CAF", iso1N3: "140", wikidata: "Q929", nameEn: "Central African Republic", groups: ["017", "202", "002", "UN"], callingCodes: ["236"] }, geometry: { type: "MultiPolygon", coordinates: [[[[22.87758, 10.91915], [22.45889, 11.00246], [21.72139, 10.64136], [21.71479, 10.29932], [21.63553, 10.217], [21.52766, 10.2105], [21.34934, 9.95907], [21.26348, 9.97642], [20.82979, 9.44696], [20.36748, 9.11019], [19.06421, 9.00367], [18.86388, 8.87971], [19.11044, 8.68172], [18.79783, 8.25929], [18.67455, 8.22226], [18.62612, 8.14163], [18.64153, 8.08714], [18.6085, 8.05009], [18.02731, 8.01085], [17.93926, 7.95853], [17.67288, 7.98905], [16.8143, 7.53971], [16.6668, 7.67281], [16.658, 7.75353], [16.59415, 7.76444], [16.58315, 7.88657], [16.41583, 7.77971], [16.40703, 7.68809], [15.79942, 7.44149], [15.73118, 7.52006], [15.49743, 7.52179], [15.23397, 7.25135], [15.04717, 6.77085], [14.96311, 6.75693], [14.79966, 6.39043], [14.80122, 6.34866], [14.74206, 6.26356], [14.56149, 6.18928], [14.43073, 6.08867], [14.42917, 6.00508], [14.49455, 5.91683], [14.60974, 5.91838], [14.62375, 5.70466], [14.58951, 5.59777], [14.62531, 5.51411], [14.52724, 5.28319], [14.57083, 5.23979], [14.65489, 5.21343], [14.73383, 4.6135], [15.00825, 4.41458], [15.08609, 4.30282], [15.10644, 4.1362], [15.17482, 4.05131], [15.07686, 4.01805], [15.73522, 3.24348], [15.77725, 3.26835], [16.05449, 3.02306], [16.08252, 2.45708], [16.19357, 2.21537], [16.50126, 2.84739], [16.46701, 2.92512], [16.57598, 3.47999], [16.68283, 3.54257], [17.01746, 3.55136], [17.35649, 3.63045], [17.46876, 3.70515], [17.60966, 3.63705], [17.83421, 3.61068], [17.85842, 3.53378], [18.05656, 3.56893], [18.14902, 3.54476], [18.17323, 3.47665], [18.24148, 3.50302], [18.2723, 3.57992], [18.39558, 3.58212], [18.49245, 3.63924], [18.58711, 3.49423], [18.62755, 3.47564], [20.60184, 4.42394], [20.90383, 4.44877], [21.08793, 4.39603], [21.11214, 4.33895], [21.21341, 4.29285], [21.25744, 4.33676], [21.55904, 4.25553], [21.6405, 4.317], [22.10721, 4.20723], [22.27682, 4.11347], [22.45504, 4.13039], [22.5431, 4.22041], [22.60915, 4.48821], [22.6928, 4.47285], [22.78526, 4.71423], [22.84691, 4.69887], [22.89094, 4.79321], [22.94817, 4.82392], [23.38847, 4.60013], [24.46719, 5.0915], [24.71816, 4.90509], [25.31256, 5.03668], [25.34558, 5.29101], [25.53271, 5.37431], [25.86073, 5.19455], [26.13371, 5.25594], [26.48595, 5.04984], [26.74572, 5.10685], [26.85579, 5.03887], [26.93064, 5.13535], [27.09575, 5.22305], [27.44012, 5.07349], [27.26886, 5.25876], [27.23017, 5.37167], [27.28621, 5.56382], [27.22705, 5.62889], [27.22705, 5.71254], [26.51721, 6.09655], [26.58259, 6.1987], [26.32729, 6.36272], [26.38022, 6.63493], [25.90076, 7.09549], [25.37461, 7.33024], [25.35281, 7.42595], [25.20337, 7.50312], [25.20649, 7.61115], [25.29214, 7.66675], [25.25319, 7.8487], [24.98855, 7.96588], [24.85156, 8.16933], [24.35965, 8.26177], [24.13238, 8.36959], [24.25691, 8.69288], [23.51905, 8.71749], [23.59065, 8.99743], [23.44744, 8.99128], [23.4848, 9.16959], [23.56263, 9.19418], [23.64358, 9.28637], [23.64981, 9.44303], [23.62179, 9.53823], [23.69155, 9.67566], [23.67164, 9.86923], [23.3128, 10.45214], [23.02221, 10.69235], [22.87758, 10.91915]]]] } },
20547     { type: "Feature", properties: { iso1A2: "CG", iso1A3: "COG", iso1N3: "178", wikidata: "Q971", nameEn: "Republic of the Congo", groups: ["017", "202", "002", "UN"], callingCodes: ["242"] }, geometry: { type: "MultiPolygon", coordinates: [[[[18.62755, 3.47564], [18.58711, 3.49423], [18.49245, 3.63924], [18.39558, 3.58212], [18.2723, 3.57992], [18.24148, 3.50302], [18.17323, 3.47665], [18.14902, 3.54476], [18.05656, 3.56893], [17.85842, 3.53378], [17.83421, 3.61068], [17.60966, 3.63705], [17.46876, 3.70515], [17.35649, 3.63045], [17.01746, 3.55136], [16.68283, 3.54257], [16.57598, 3.47999], [16.46701, 2.92512], [16.50126, 2.84739], [16.19357, 2.21537], [16.15568, 2.18955], [16.08563, 2.19733], [16.05294, 1.9811], [16.14634, 1.70259], [16.02647, 1.65591], [16.02959, 1.76483], [15.48942, 1.98265], [15.34776, 1.91264], [15.22634, 2.03243], [15.00996, 1.98887], [14.61145, 2.17866], [13.29457, 2.16106], [13.13461, 1.57238], [13.25447, 1.32339], [13.15519, 1.23368], [13.89582, 1.4261], [14.25186, 1.39842], [14.48179, 0.9152], [14.26066, 0.57255], [14.10909, 0.58563], [13.88648, 0.26652], [13.90632, -0.2287], [14.06862, -0.20826], [14.2165, -0.38261], [14.41887, -0.44799], [14.52569, -0.57818], [14.41838, -1.89412], [14.25932, -1.97624], [14.23518, -2.15671], [14.16202, -2.23916], [14.23829, -2.33715], [14.10442, -2.49268], [13.85846, -2.46935], [13.92073, -2.35581], [13.75884, -2.09293], [13.47977, -2.43224], [13.02759, -2.33098], [12.82172, -1.91091], [12.61312, -1.8129], [12.44656, -1.92025], [12.47925, -2.32626], [12.04895, -2.41704], [11.96866, -2.33559], [11.74605, -2.39936], [11.57637, -2.33379], [11.64487, -2.61865], [11.5359, -2.85654], [11.64798, -2.81146], [11.80365, -3.00424], [11.70558, -3.0773], [11.70227, -3.17465], [11.96554, -3.30267], [11.8318, -3.5812], [11.92719, -3.62768], [11.87083, -3.71571], [11.68608, -3.68942], [11.57949, -3.52798], [11.48764, -3.51089], [11.22301, -3.69888], [11.12647, -3.94169], [10.75913, -4.39519], [11.50888, -5.33417], [12.00924, -5.02627], [12.16068, -4.90089], [12.20901, -4.75642], [12.25587, -4.79437], [12.32324, -4.78415], [12.40964, -4.60609], [12.64835, -4.55937], [12.76844, -4.38709], [12.87096, -4.40315], [12.91489, -4.47907], [13.09648, -4.63739], [13.11182, -4.5942], [13.41764, -4.89897], [13.50305, -4.77818], [13.70417, -4.72601], [13.71794, -4.44864], [13.81162, -4.41842], [13.9108, -4.50906], [14.40672, -4.28381], [14.3957, -4.36623], [14.47284, -4.42941], [14.37366, -4.56125], [14.41499, -4.8825], [14.5059, -4.84956], [14.67948, -4.92093], [14.83101, -4.80838], [15.1978, -4.32388], [15.25411, -4.31121], [15.32693, -4.27282], [15.41785, -4.28381], [15.48121, -4.22062], [15.53081, -4.042], [15.89448, -3.9513], [16.21407, -3.2969], [16.1755, -3.25014], [16.22785, -2.59528], [16.16173, -2.16586], [16.50336, -1.8795], [16.70724, -1.45815], [16.97999, -1.12762], [17.32438, -0.99265], [17.72112, -0.52707], [17.66051, -0.26535], [17.81204, 0.23884], [17.93877, 0.32424], [17.95255, 0.48128], [17.86989, 0.58873], [17.85887, 1.04327], [18.08034, 1.58553], [18.10683, 2.26876], [18.63857, 3.19342], [18.62755, 3.47564]]]] } },
20548     { type: "Feature", geometry: { type: "MultiPolygon", coordinates: [[[[8.72809, 47.69282], [8.72617, 47.69651], [8.73671, 47.7169], [8.70543, 47.73121], [8.74251, 47.75168], [8.71778, 47.76571], [8.68985, 47.75686], [8.68022, 47.78599], [8.65292, 47.80066], [8.64425, 47.76398], [8.62408, 47.7626], [8.61657, 47.79998], [8.56415, 47.80633], [8.56814, 47.78001], [8.48868, 47.77215], [8.45771, 47.7493], [8.44807, 47.72426], [8.40569, 47.69855], [8.4211, 47.68407], [8.40473, 47.67499], [8.41346, 47.66676], [8.42264, 47.66667], [8.44711, 47.65379], [8.4667, 47.65747], [8.46605, 47.64103], [8.49656, 47.64709], [8.5322, 47.64687], [8.52801, 47.66059], [8.56141, 47.67088], [8.57683, 47.66158], [8.6052, 47.67258], [8.61113, 47.66332], [8.62884, 47.65098], [8.62049, 47.63757], [8.60412, 47.63735], [8.61471, 47.64514], [8.60701, 47.65271], [8.59545, 47.64298], [8.60348, 47.61204], [8.57586, 47.59537], [8.55756, 47.62394], [8.51686, 47.63476], [8.50747, 47.61897], [8.45578, 47.60121], [8.46637, 47.58389], [8.48949, 47.588], [8.49431, 47.58107], [8.43235, 47.56617], [8.39477, 47.57826], [8.38273, 47.56608], [8.35512, 47.57014], [8.32735, 47.57133], [8.30277, 47.58607], [8.29524, 47.5919], [8.29722, 47.60603], [8.2824, 47.61225], [8.26313, 47.6103], [8.25863, 47.61571], [8.23809, 47.61204], [8.22577, 47.60385], [8.22011, 47.6181], [8.20617, 47.62141], [8.19378, 47.61636], [8.1652, 47.5945], [8.14947, 47.59558], [8.13823, 47.59147], [8.13662, 47.58432], [8.11543, 47.5841], [8.10395, 47.57918], [8.10002, 47.56504], [8.08557, 47.55768], [8.06663, 47.56374], [8.04383, 47.55443], [8.02136, 47.55096], [8.00113, 47.55616], [7.97581, 47.55493], [7.95682, 47.55789], [7.94494, 47.54511], [7.91251, 47.55031], [7.90673, 47.57674], [7.88664, 47.58854], [7.84412, 47.5841], [7.81901, 47.58798], [7.79486, 47.55691], [7.75261, 47.54599], [7.71961, 47.54219], [7.69642, 47.53297], [7.68101, 47.53232], [7.6656, 47.53752], [7.66174, 47.54554], [7.65083, 47.54662], [7.63338, 47.56256], [7.67655, 47.56435], [7.68904, 47.57133], [7.67115, 47.5871], [7.68486, 47.59601], [7.69385, 47.60099], [7.68229, 47.59905], [7.67395, 47.59212], [7.64599, 47.59695], [7.64213, 47.5944], [7.64309, 47.59151], [7.61929, 47.57683], [7.60459, 47.57869], [7.60523, 47.58519], [7.58945, 47.59017], [7.58386, 47.57536], [7.56684, 47.57785], [7.56548, 47.57617], [7.55689, 47.57232], [7.55652, 47.56779], [7.53634, 47.55553], [7.52831, 47.55347], [7.51723, 47.54578], [7.50873, 47.54546], [7.49691, 47.53821], [7.50588, 47.52856], [7.51904, 47.53515], [7.53199, 47.5284], [7.5229, 47.51644], [7.49804, 47.51798], [7.51076, 47.49651], [7.47534, 47.47932], [7.43356, 47.49712], [7.42923, 47.48628], [7.4583, 47.47216], [7.4462, 47.46264], [7.43088, 47.45846], [7.40308, 47.43638], [7.35603, 47.43432], [7.33526, 47.44186], [7.24669, 47.4205], [7.17026, 47.44312], [7.19583, 47.49455], [7.16249, 47.49025], [7.12781, 47.50371], [7.07425, 47.48863], [7.0231, 47.50522], [6.98425, 47.49432], [7.0024, 47.45264], [6.93953, 47.43388], [6.93744, 47.40714], [6.88542, 47.37262], [6.87959, 47.35335], [7.03125, 47.36996], [7.0564, 47.35134], [7.05305, 47.33304], [6.94316, 47.28747], [6.95108, 47.26428], [6.9508, 47.24338], [6.8489, 47.15933], [6.76788, 47.1208], [6.68823, 47.06616], [6.71531, 47.0494], [6.43341, 46.92703], [6.46456, 46.88865], [6.43216, 46.80336], [6.45209, 46.77502], [6.38351, 46.73171], [6.27135, 46.68251], [6.11084, 46.57649], [6.1567, 46.54402], [6.07269, 46.46244], [6.08427, 46.44305], [6.06407, 46.41676], [6.09926, 46.40768], [6.15016, 46.3778], [6.15985, 46.37721], [6.16987, 46.36759], [6.15738, 46.3491], [6.13876, 46.33844], [6.1198, 46.31157], [6.11697, 46.29547], [6.1013, 46.28512], [6.11926, 46.2634], [6.12446, 46.25059], [6.10071, 46.23772], [6.08563, 46.24651], [6.07072, 46.24085], [6.0633, 46.24583], [6.05029, 46.23518], [6.04602, 46.23127], [6.03342, 46.2383], [6.02461, 46.23313], [5.97542, 46.21525], [5.96515, 46.19638], [5.99573, 46.18587], [5.98846, 46.17046], [5.98188, 46.17392], [5.97508, 46.15863], [5.9641, 46.14412], [5.95781, 46.12925], [5.97893, 46.13303], [5.9871, 46.14499], [6.01791, 46.14228], [6.03614, 46.13712], [6.04564, 46.14031], [6.05203, 46.15191], [6.07491, 46.14879], [6.09199, 46.15191], [6.09926, 46.14373], [6.13397, 46.1406], [6.15305, 46.15194], [6.18116, 46.16187], [6.18871, 46.16644], [6.18707, 46.17999], [6.19552, 46.18401], [6.19807, 46.18369], [6.20539, 46.19163], [6.21114, 46.1927], [6.21273, 46.19409], [6.21603, 46.19507], [6.21844, 46.19837], [6.22222, 46.19888], [6.22175, 46.20045], [6.23544, 46.20714], [6.23913, 46.20511], [6.24821, 46.20531], [6.26007, 46.21165], [6.27694, 46.21566], [6.29663, 46.22688], [6.31041, 46.24417], [6.29474, 46.26221], [6.26749, 46.24745], [6.24952, 46.26255], [6.23775, 46.27822], [6.25137, 46.29014], [6.24826, 46.30175], [6.21981, 46.31304], [6.25432, 46.3632], [6.53358, 46.45431], [6.82312, 46.42661], [6.8024, 46.39171], [6.77152, 46.34784], [6.86052, 46.28512], [6.78968, 46.14058], [6.89321, 46.12548], [6.87868, 46.03855], [6.93862, 46.06502], [7.00946, 45.9944], [7.04151, 45.92435], [7.10685, 45.85653], [7.56343, 45.97421], [7.85949, 45.91485], [7.9049, 45.99945], [7.98881, 45.99867], [8.02906, 46.10331], [8.11383, 46.11577], [8.16866, 46.17817], [8.08814, 46.26692], [8.31162, 46.38044], [8.30648, 46.41587], [8.42464, 46.46367], [8.46317, 46.43712], [8.45032, 46.26869], [8.62242, 46.12112], [8.75697, 46.10395], [8.80778, 46.10085], [8.85617, 46.0748], [8.79414, 46.00913], [8.78585, 45.98973], [8.79362, 45.99207], [8.8319, 45.9879], [8.85121, 45.97239], [8.86688, 45.96135], [8.88904, 45.95465], [8.93649, 45.86775], [8.94372, 45.86587], [8.93504, 45.86245], [8.91129, 45.8388], [8.94737, 45.84285], [8.9621, 45.83707], [8.99663, 45.83466], [9.00324, 45.82055], [9.0298, 45.82127], [9.03279, 45.82865], [9.03793, 45.83548], [9.03505, 45.83976], [9.04059, 45.8464], [9.04546, 45.84968], [9.06642, 45.8761], [9.09065, 45.89906], [8.99257, 45.9698], [9.01618, 46.04928], [9.24503, 46.23616], [9.29226, 46.32717], [9.25502, 46.43743], [9.28136, 46.49685], [9.36128, 46.5081], [9.40487, 46.46621], [9.45936, 46.50873], [9.46117, 46.37481], [9.57015, 46.2958], [9.71273, 46.29266], [9.73086, 46.35071], [9.95249, 46.38045], [10.07055, 46.21668], [10.14439, 46.22992], [10.17862, 46.25626], [10.10506, 46.3372], [10.165, 46.41051], [10.03715, 46.44479], [10.10307, 46.61003], [10.23674, 46.63484], [10.25309, 46.57432], [10.46136, 46.53164], [10.49375, 46.62049], [10.44686, 46.64162], [10.40475, 46.63671], [10.38659, 46.67847], [10.47197, 46.85698], [10.48376, 46.93891], [10.36933, 47.00212], [10.30031, 46.92093], [10.24128, 46.93147], [10.22675, 46.86942], [10.10715, 46.84296], [9.98058, 46.91434], [9.88266, 46.93343], [9.87935, 47.01337], [9.60717, 47.06091], [9.55721, 47.04762], [9.54041, 47.06495], [9.47548, 47.05257], [9.47139, 47.06402], [9.51362, 47.08505], [9.52089, 47.10019], [9.51044, 47.13727], [9.48774, 47.17402], [9.4891, 47.19346], [9.50318, 47.22153], [9.52406, 47.24959], [9.53116, 47.27029], [9.54773, 47.2809], [9.55857, 47.29919], [9.58513, 47.31334], [9.59978, 47.34671], [9.62476, 47.36639], [9.65427, 47.36824], [9.66243, 47.37136], [9.6711, 47.37824], [9.67445, 47.38429], [9.67334, 47.39191], [9.6629, 47.39591], [9.65136, 47.40504], [9.65043, 47.41937], [9.6446, 47.43233], [9.64483, 47.43842], [9.65863, 47.44847], [9.65728, 47.45383], [9.6423, 47.45599], [9.62475, 47.45685], [9.62158, 47.45858], [9.60841, 47.47178], [9.60484, 47.46358], [9.60205, 47.46165], [9.59482, 47.46305], [9.58208, 47.48344], [9.56312, 47.49495], [9.55125, 47.53629], [9.25619, 47.65939], [9.18203, 47.65598], [9.17593, 47.65399], [9.1755, 47.65584], [9.1705, 47.65513], [9.15181, 47.66904], [9.13845, 47.66389], [9.09891, 47.67801], [9.02093, 47.6868], [8.94093, 47.65596], [8.89946, 47.64769], [8.87625, 47.65441], [8.87383, 47.67045], [8.85065, 47.68209], [8.86989, 47.70504], [8.82002, 47.71458], [8.80663, 47.73821], [8.77309, 47.72059], [8.76965, 47.7075], [8.79966, 47.70222], [8.79511, 47.67462], [8.75856, 47.68969], [8.72809, 47.69282]], [[8.95861, 45.96485], [8.96668, 45.98436], [8.97741, 45.98317], [8.97604, 45.96151], [8.95861, 45.96485]], [[8.70847, 47.68904], [8.68985, 47.69552], [8.66837, 47.68437], [8.65769, 47.68928], [8.67508, 47.6979], [8.66416, 47.71367], [8.70237, 47.71453], [8.71773, 47.69088], [8.70847, 47.68904]]]] }, properties: { iso1A2: "CH", iso1A3: "CHE", iso1N3: "756", wikidata: "Q39", nameEn: "Switzerland", groups: ["155", "150", "UN"], callingCodes: ["41"] } },
20549     { type: "Feature", properties: { iso1A2: "CI", iso1A3: "CIV", iso1N3: "384", wikidata: "Q1008", nameEn: "C\xF4te d'Ivoire", groups: ["011", "202", "002", "UN"], callingCodes: ["225"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-7.52774, 3.7105], [-3.34019, 4.17519], [-3.10675, 5.08515], [-3.11073, 5.12675], [-3.063, 5.13665], [-2.96554, 5.10397], [-2.95261, 5.12477], [-2.75502, 5.10657], [-2.73074, 5.1364], [-2.77625, 5.34621], [-2.72737, 5.34789], [-2.76614, 5.60963], [-2.85378, 5.65156], [-2.93132, 5.62137], [-2.96671, 5.6415], [-2.95323, 5.71865], [-3.01896, 5.71697], [-3.25999, 6.62521], [-3.21954, 6.74407], [-3.23327, 6.81744], [-2.95438, 7.23737], [-2.97822, 7.27165], [-2.92339, 7.60847], [-2.79467, 7.86002], [-2.78395, 7.94974], [-2.74819, 7.92613], [-2.67787, 8.02055], [-2.61232, 8.02645], [-2.62901, 8.11495], [-2.49037, 8.20872], [-2.58243, 8.7789], [-2.66357, 9.01771], [-2.77799, 9.04949], [-2.69814, 9.22717], [-2.68802, 9.49343], [-2.76494, 9.40778], [-2.93012, 9.57403], [-3.00765, 9.74019], [-3.16609, 9.85147], [-3.19306, 9.93781], [-3.27228, 9.84981], [-3.31779, 9.91125], [-3.69703, 9.94279], [-4.25999, 9.76012], [-4.31392, 9.60062], [-4.6426, 9.70696], [-4.96621, 9.89132], [-4.96453, 9.99923], [-5.12465, 10.29788], [-5.39602, 10.2929], [-5.51058, 10.43177], [-5.65135, 10.46767], [-5.78124, 10.43952], [-5.99478, 10.19694], [-6.18851, 10.24244], [-6.1731, 10.46983], [-6.24795, 10.74248], [-6.325, 10.68624], [-6.40646, 10.69922], [-6.42847, 10.5694], [-6.52974, 10.59104], [-6.63541, 10.66893], [-6.68164, 10.35074], [-6.93921, 10.35291], [-7.01186, 10.25111], [-6.97444, 10.21644], [-7.00966, 10.15794], [-7.0603, 10.14711], [-7.13331, 10.24877], [-7.3707, 10.24677], [-7.44555, 10.44602], [-7.52261, 10.4655], [-7.54462, 10.40921], [-7.63048, 10.46334], [-7.92107, 10.15577], [-7.97971, 10.17117], [-8.01225, 10.1021], [-8.11921, 10.04577], [-8.15652, 9.94288], [-8.09434, 9.86936], [-8.14657, 9.55062], [-8.03463, 9.39604], [-7.85056, 9.41812], [-7.90777, 9.20456], [-7.73862, 9.08422], [-7.92518, 8.99332], [-7.95503, 8.81146], [-7.69882, 8.66148], [-7.65653, 8.36873], [-7.92518, 8.50652], [-8.22991, 8.48438], [-8.2411, 8.24196], [-8.062, 8.16071], [-7.98675, 8.20134], [-7.99919, 8.11023], [-7.94695, 8.00925], [-8.06449, 8.04989], [-8.13414, 7.87991], [-8.09931, 7.78626], [-8.21374, 7.54466], [-8.4003, 7.6285], [-8.47114, 7.55676], [-8.41935, 7.51203], [-8.37458, 7.25794], [-8.29249, 7.1691], [-8.31736, 6.82837], [-8.59456, 6.50612], [-8.48652, 6.43797], [-8.45666, 6.49977], [-8.38453, 6.35887], [-8.3298, 6.36381], [-8.17557, 6.28222], [-8.00642, 6.31684], [-7.90692, 6.27728], [-7.83478, 6.20309], [-7.8497, 6.08932], [-7.79747, 6.07696], [-7.78254, 5.99037], [-7.70294, 5.90625], [-7.67309, 5.94337], [-7.48155, 5.80974], [-7.46165, 5.84934], [-7.43677, 5.84687], [-7.43926, 5.74787], [-7.37209, 5.61173], [-7.43428, 5.42355], [-7.36463, 5.32944], [-7.46165, 5.26256], [-7.48901, 5.14118], [-7.55369, 5.08667], [-7.53876, 4.94294], [-7.59349, 4.8909], [-7.53259, 4.35145], [-7.52774, 3.7105]]]] } },
20550     { type: "Feature", properties: { iso1A2: "CK", iso1A3: "COK", iso1N3: "184", wikidata: "Q26988", nameEn: "Cook Islands", country: "NZ", groups: ["061", "009", "UN"], driveSide: "left", callingCodes: ["682"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-168.15106, -10.26955], [-156.45576, -31.75456], [-156.48634, -15.52824], [-156.50903, -7.4975], [-168.15106, -10.26955]]]] } },
20551     { type: "Feature", properties: { iso1A2: "CL", iso1A3: "CHL", iso1N3: "152", wikidata: "Q298", nameEn: "Chile", groups: ["005", "419", "019", "UN"], callingCodes: ["56"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-68.60702, -52.65781], [-68.41683, -52.33516], [-69.97824, -52.00845], [-71.99889, -51.98018], [-72.33873, -51.59954], [-72.31343, -50.58411], [-73.15765, -50.78337], [-73.55259, -49.92488], [-73.45156, -49.79461], [-73.09655, -49.14342], [-72.56894, -48.81116], [-72.54042, -48.52392], [-72.27662, -48.28727], [-72.50478, -47.80586], [-71.94152, -47.13595], [-71.68577, -46.55385], [-71.75614, -45.61611], [-71.35687, -45.22075], [-72.06985, -44.81756], [-71.26418, -44.75684], [-71.16436, -44.46244], [-71.81318, -44.38097], [-71.64206, -43.64774], [-72.14828, -42.85321], [-72.15541, -42.15941], [-71.74901, -42.11711], [-71.92726, -40.72714], [-71.37826, -38.91474], [-70.89532, -38.6923], [-71.24279, -37.20264], [-70.95047, -36.4321], [-70.38008, -36.02375], [-70.49416, -35.24145], [-69.87386, -34.13344], [-69.88099, -33.34489], [-70.55832, -31.51559], [-70.14479, -30.36595], [-69.8596, -30.26131], [-69.99507, -29.28351], [-69.80969, -29.07185], [-69.66709, -28.44055], [-69.22504, -27.95042], [-68.77586, -27.16029], [-68.43363, -27.08414], [-68.27677, -26.90626], [-68.59048, -26.49861], [-68.56909, -26.28146], [-68.38372, -26.15353], [-68.57622, -25.32505], [-68.38372, -25.08636], [-68.56909, -24.69831], [-68.24825, -24.42596], [-67.33563, -24.04237], [-66.99632, -22.99839], [-67.18382, -22.81525], [-67.54284, -22.89771], [-67.85114, -22.87076], [-68.18816, -21.28614], [-68.40403, -20.94562], [-68.53957, -20.91542], [-68.55383, -20.7355], [-68.44023, -20.62701], [-68.7276, -20.46178], [-68.74273, -20.08817], [-68.57132, -20.03134], [-68.54611, -19.84651], [-68.66761, -19.72118], [-68.41218, -19.40499], [-68.61989, -19.27584], [-68.80602, -19.08355], [-68.87082, -19.06003], [-68.94987, -18.93302], [-69.07432, -18.28259], [-69.14807, -18.16893], [-69.07496, -18.03715], [-69.28671, -17.94844], [-69.34126, -17.72753], [-69.46623, -17.60518], [-69.46897, -17.4988], [-69.66483, -17.65083], [-69.79087, -17.65563], [-69.82868, -17.72048], [-69.75305, -17.94605], [-69.81607, -18.12582], [-69.96732, -18.25992], [-70.16394, -18.31737], [-70.31267, -18.31258], [-70.378, -18.3495], [-70.59118, -18.35072], [-113.52687, -26.52828], [-68.11646, -58.14883], [-66.07313, -55.19618], [-67.11046, -54.94199], [-67.46182, -54.92205], [-68.01394, -54.8753], [-68.60733, -54.9125], [-68.60702, -52.65781]]]] } },
20552     { type: "Feature", properties: { iso1A2: "CM", iso1A3: "CMR", iso1N3: "120", wikidata: "Q1009", nameEn: "Cameroon", groups: ["017", "202", "002", "UN"], callingCodes: ["237"] }, geometry: { type: "MultiPolygon", coordinates: [[[[14.83314, 12.62963], [14.55058, 12.78256], [14.56101, 12.91036], [14.46881, 13.08259], [14.08251, 13.0797], [14.20204, 12.53405], [14.17523, 12.41916], [14.22215, 12.36533], [14.4843, 12.35223], [14.6474, 12.17466], [14.61612, 11.7798], [14.55207, 11.72001], [14.64591, 11.66166], [14.6124, 11.51283], [14.17821, 11.23831], [13.97489, 11.30258], [13.78945, 11.00154], [13.7403, 11.00593], [13.70753, 10.94451], [13.73434, 10.9255], [13.54964, 10.61236], [13.5705, 10.53183], [13.43644, 10.13326], [13.34111, 10.12299], [13.25025, 10.03647], [13.25323, 10.00127], [13.286, 9.9822], [13.27409, 9.93232], [13.24132, 9.91031], [13.25025, 9.86042], [13.29941, 9.8296], [13.25472, 9.76795], [13.22642, 9.57266], [13.02385, 9.49334], [12.85628, 9.36698], [12.91958, 9.33905], [12.90022, 9.11411], [12.81085, 8.91992], [12.79, 8.75361], [12.71701, 8.7595], [12.68722, 8.65938], [12.44146, 8.6152], [12.4489, 8.52536], [12.26123, 8.43696], [12.24782, 8.17904], [12.19271, 8.10826], [12.20909, 7.97553], [11.99908, 7.67302], [12.01844, 7.52981], [11.93205, 7.47812], [11.84864, 7.26098], [11.87396, 7.09398], [11.63117, 6.9905], [11.55818, 6.86186], [11.57755, 6.74059], [11.51499, 6.60892], [11.42264, 6.5882], [11.42041, 6.53789], [11.09495, 6.51717], [11.09644, 6.68437], [10.94302, 6.69325], [10.8179, 6.83377], [10.83727, 6.9358], [10.60789, 7.06885], [10.59746, 7.14719], [10.57214, 7.16345], [10.53639, 6.93432], [10.21466, 6.88996], [10.15135, 7.03781], [9.86314, 6.77756], [9.77824, 6.79088], [9.70674, 6.51717], [9.51757, 6.43874], [8.84209, 5.82562], [8.88156, 5.78857], [8.83687, 5.68483], [8.92029, 5.58403], [8.78027, 5.1243], [8.60302, 4.87353], [8.34397, 4.30689], [9.22018, 3.72052], [9.81162, 2.33797], [9.82123, 2.35097], [9.83754, 2.32428], [9.83238, 2.29079], [9.84716, 2.24676], [9.89012, 2.20457], [9.90749, 2.20049], [9.991, 2.16561], [11.3561, 2.17217], [11.37116, 2.29975], [13.28534, 2.25716], [13.29457, 2.16106], [14.61145, 2.17866], [15.00996, 1.98887], [15.22634, 2.03243], [15.34776, 1.91264], [15.48942, 1.98265], [16.02959, 1.76483], [16.02647, 1.65591], [16.14634, 1.70259], [16.05294, 1.9811], [16.08563, 2.19733], [16.15568, 2.18955], [16.19357, 2.21537], [16.08252, 2.45708], [16.05449, 3.02306], [15.77725, 3.26835], [15.73522, 3.24348], [15.07686, 4.01805], [15.17482, 4.05131], [15.10644, 4.1362], [15.08609, 4.30282], [15.00825, 4.41458], [14.73383, 4.6135], [14.65489, 5.21343], [14.57083, 5.23979], [14.52724, 5.28319], [14.62531, 5.51411], [14.58951, 5.59777], [14.62375, 5.70466], [14.60974, 5.91838], [14.49455, 5.91683], [14.42917, 6.00508], [14.43073, 6.08867], [14.56149, 6.18928], [14.74206, 6.26356], [14.80122, 6.34866], [14.79966, 6.39043], [14.96311, 6.75693], [15.04717, 6.77085], [15.23397, 7.25135], [15.49743, 7.52179], [15.56964, 7.58936], [15.59272, 7.7696], [15.50743, 7.79302], [15.20426, 8.50892], [15.09484, 8.65982], [14.83566, 8.80557], [14.35707, 9.19611], [14.37094, 9.2954], [13.97544, 9.6365], [14.01793, 9.73169], [14.1317, 9.82413], [14.20411, 10.00055], [14.4673, 10.00264], [14.80082, 9.93818], [14.95722, 9.97926], [15.05999, 9.94845], [15.14043, 9.99246], [15.24618, 9.99246], [15.41408, 9.92876], [15.68761, 9.99344], [15.50535, 10.1098], [15.30874, 10.31063], [15.23724, 10.47764], [15.14936, 10.53915], [15.15532, 10.62846], [15.06737, 10.80921], [15.09127, 10.87431], [15.04957, 11.02347], [15.10021, 11.04101], [15.0585, 11.40481], [15.13149, 11.5537], [15.06595, 11.71126], [15.11579, 11.79313], [15.04808, 11.8731], [15.05786, 12.0608], [15.0349, 12.10698], [15.00146, 12.1223], [14.96952, 12.0925], [14.89019, 12.16593], [14.90827, 12.3269], [14.83314, 12.62963]]]] } },
20553     { type: "Feature", properties: { iso1A2: "CN", iso1A3: "CHN", iso1N3: "156", wikidata: "Q148", nameEn: "People's Republic of China" }, geometry: null },
20554     { type: "Feature", properties: { iso1A2: "CO", iso1A3: "COL", iso1N3: "170", wikidata: "Q739", nameEn: "Colombia", groups: ["005", "419", "019", "UN"], callingCodes: ["57"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-71.19849, 12.65801], [-81.58685, 18.0025], [-82.06974, 14.49418], [-82.56142, 11.91792], [-78.79327, 9.93766], [-77.58292, 9.22278], [-77.32389, 8.81247], [-77.45064, 8.49991], [-77.17257, 7.97422], [-77.57185, 7.51147], [-77.72514, 7.72348], [-77.72157, 7.47612], [-77.81426, 7.48319], [-77.89178, 7.22681], [-78.06168, 7.07793], [-82.12561, 4.00341], [-78.87137, 1.47457], [-78.42749, 1.15389], [-77.85677, 0.80197], [-77.7148, 0.85003], [-77.68613, 0.83029], [-77.66416, 0.81604], [-77.67815, 0.73863], [-77.49984, 0.64476], [-77.52001, 0.40782], [-76.89177, 0.24736], [-76.4094, 0.24015], [-76.41215, 0.38228], [-76.23441, 0.42294], [-75.82927, 0.09578], [-75.25764, -0.11943], [-75.18513, -0.0308], [-74.42701, -0.50218], [-74.26675, -0.97229], [-73.65312, -1.26222], [-72.92587, -2.44514], [-71.75223, -2.15058], [-70.94377, -2.23142], [-70.04609, -2.73906], [-70.71396, -3.7921], [-70.52393, -3.87553], [-70.3374, -3.79505], [-69.94708, -4.2431], [-69.43395, -1.42219], [-69.4215, -1.01853], [-69.59796, -0.75136], [-69.603, -0.51947], [-70.03658, -0.19681], [-70.04162, 0.55437], [-69.47696, 0.71065], [-69.20976, 0.57958], [-69.14422, 0.84172], [-69.26017, 1.06856], [-69.82987, 1.07864], [-69.83491, 1.69353], [-69.53746, 1.76408], [-69.38621, 1.70865], [-68.18128, 1.72881], [-68.26699, 1.83463], [-68.18632, 2.00091], [-67.9292, 1.82455], [-67.40488, 2.22258], [-67.299, 1.87494], [-67.15784, 1.80439], [-67.08222, 1.17441], [-66.85795, 1.22998], [-67.21967, 2.35778], [-67.65696, 2.81691], [-67.85862, 2.79173], [-67.85862, 2.86727], [-67.30945, 3.38393], [-67.50067, 3.75812], [-67.62671, 3.74303], [-67.85358, 4.53249], [-67.83341, 5.31104], [-67.59141, 5.5369], [-67.63914, 5.64963], [-67.58558, 5.84537], [-67.43513, 5.98835], [-67.4625, 6.20625], [-67.60654, 6.2891], [-69.41843, 6.1072], [-70.10716, 6.96516], [-70.7596, 7.09799], [-71.03941, 6.98163], [-71.37234, 7.01588], [-71.42212, 7.03854], [-71.44118, 7.02116], [-71.82441, 7.04314], [-72.04895, 7.03837], [-72.19437, 7.37034], [-72.43132, 7.40034], [-72.47415, 7.48928], [-72.45321, 7.57232], [-72.47827, 7.65604], [-72.46763, 7.79518], [-72.44454, 7.86031], [-72.46183, 7.90682], [-72.45806, 7.91141], [-72.47042, 7.92306], [-72.48183, 7.92909], [-72.48801, 7.94329], [-72.47213, 7.96106], [-72.39137, 8.03534], [-72.35163, 8.01163], [-72.36987, 8.19976], [-72.4042, 8.36513], [-72.65474, 8.61428], [-72.77415, 9.10165], [-72.94052, 9.10663], [-73.02119, 9.27584], [-73.36905, 9.16636], [-72.98085, 9.85253], [-72.88002, 10.44309], [-72.4767, 11.1117], [-72.24983, 11.14138], [-71.9675, 11.65536], [-71.3275, 11.85], [-70.92579, 11.96275], [-71.19849, 12.65801]]]] } },
20555     { type: "Feature", properties: { iso1A2: "CP", iso1A3: "CPT", wikidata: "Q161258", nameEn: "Clipperton Island", country: "FR", groups: ["EU", "013", "003", "019", "UN"], isoStatus: "excRes" }, geometry: { type: "MultiPolygon", coordinates: [[[[-110.36279, 9.79626], [-108.755, 9.84085], [-109.04145, 11.13245], [-110.36279, 9.79626]]]] } },
20556     { type: "Feature", properties: { iso1A2: "CQ", iso1A3: "CRQ", iso1N3: "680", m49: "680", wikidata: "Q3405693", ccTLD: null, nameEn: "Sark", country: "GB", groups: ["GG", "830", "Q185086", "154", "150", "UN"], level: "subterritory", isoStatus: "excRes", driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44 01481"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-2.36485, 49.48223], [-2.65349, 49.15373], [-2.09454, 49.46288], [-2.36485, 49.48223]]]] } },
20557     { type: "Feature", properties: { iso1A2: "CR", iso1A3: "CRI", iso1N3: "188", wikidata: "Q800", nameEn: "Costa Rica", groups: ["013", "003", "419", "019", "UN"], callingCodes: ["506"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-83.68276, 11.01562], [-83.66597, 10.79916], [-83.90838, 10.71161], [-84.68197, 11.07568], [-84.92439, 10.9497], [-85.60529, 11.22607], [-85.71223, 11.06868], [-86.14524, 11.09059], [-87.41779, 5.02401], [-82.94503, 7.93865], [-82.89978, 8.04083], [-82.89137, 8.05755], [-82.88641, 8.10219], [-82.9388, 8.26634], [-83.05209, 8.33394], [-82.93056, 8.43465], [-82.8679, 8.44042], [-82.8382, 8.48117], [-82.83322, 8.52464], [-82.83975, 8.54755], [-82.82739, 8.60153], [-82.8794, 8.6981], [-82.92068, 8.74832], [-82.91377, 8.774], [-82.88253, 8.83331], [-82.72126, 8.97125], [-82.93516, 9.07687], [-82.93516, 9.46741], [-82.84871, 9.4973], [-82.87919, 9.62645], [-82.77206, 9.59573], [-82.66667, 9.49746], [-82.61345, 9.49881], [-82.56507, 9.57279], [-82.51044, 9.65379], [-83.54024, 10.96805], [-83.68276, 11.01562]]]] } },
20558     { type: "Feature", properties: { iso1A2: "CU", iso1A3: "CUB", iso1N3: "192", wikidata: "Q241", nameEn: "Cuba", groups: ["029", "003", "419", "019", "UN"], callingCodes: ["53"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-73.62304, 20.6935], [-82.02215, 24.23074], [-85.77883, 21.92705], [-74.81171, 18.82201], [-73.62304, 20.6935]]]] } },
20559     { type: "Feature", properties: { iso1A2: "CV", iso1A3: "CPV", iso1N3: "132", wikidata: "Q1011", nameEn: "Cape Verde", groups: ["Q105472", "011", "202", "002", "UN"], callingCodes: ["238"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-28.81604, 14.57305], [-20.39702, 14.12816], [-23.37101, 19.134], [-28.81604, 14.57305]]]] } },
20560     { type: "Feature", properties: { iso1A2: "CW", iso1A3: "CUW", iso1N3: "531", wikidata: "Q25279", nameEn: "Cura\xE7ao", aliases: ["NL-CW"], country: "NL", groups: ["Q1451600", "029", "003", "419", "019", "UN"], callingCodes: ["599"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-68.90012, 12.62309], [-69.59009, 12.46019], [-68.99639, 11.79035], [-68.33524, 11.78151], [-68.90012, 12.62309]]]] } },
20561     { type: "Feature", properties: { iso1A2: "CX", iso1A3: "CXR", iso1N3: "162", wikidata: "Q31063", nameEn: "Christmas Island", country: "AU", groups: ["053", "009", "UN"], driveSide: "left", callingCodes: ["61"] }, geometry: { type: "MultiPolygon", coordinates: [[[[105.66835, -9.31927], [104.67494, -11.2566], [106.66176, -11.14349], [105.66835, -9.31927]]]] } },
20562     { type: "Feature", properties: { iso1A2: "CY", iso1A3: "CYP", iso1N3: "196", wikidata: "Q229", nameEn: "Republic of Cyprus", groups: ["Q644636", "EU", "145", "142", "UN"], driveSide: "left", callingCodes: ["357"] }, geometry: { type: "MultiPolygon", coordinates: [[[[32.46489, 35.48584], [30.15137, 34.08517], [32.74412, 34.43926], [32.75515, 34.64985], [32.76136, 34.68318], [32.79433, 34.67883], [32.82717, 34.70622], [32.86014, 34.70585], [32.86167, 34.68734], [32.9068, 34.66102], [32.91398, 34.67343], [32.93043, 34.67091], [32.92807, 34.66736], [32.93449, 34.66241], [32.93693, 34.67027], [32.94379, 34.67111], [32.94683, 34.67907], [32.95539, 34.68471], [32.99135, 34.68061], [32.98668, 34.67268], [32.99014, 34.65518], [32.97736, 34.65277], [32.97079, 34.66112], [32.95325, 34.66462], [32.94796, 34.6587], [32.94976, 34.65204], [32.95471, 34.64528], [32.95323, 34.64075], [32.95891, 34.62919], [32.96718, 34.63446], [32.96968, 34.64046], [33.0138, 34.64424], [33.26744, 34.49942], [33.83531, 34.73974], [33.70575, 34.97947], [33.70639, 34.99303], [33.71514, 35.00294], [33.69731, 35.01754], [33.69938, 35.03123], [33.67678, 35.03866], [33.63765, 35.03869], [33.61215, 35.0527], [33.59658, 35.03635], [33.567, 35.04803], [33.57478, 35.06049], [33.53975, 35.08151], [33.48915, 35.06594], [33.47666, 35.00701], [33.45256, 35.00288], [33.45178, 35.02078], [33.47825, 35.04103], [33.48136, 35.0636], [33.46813, 35.10564], [33.41675, 35.16325], [33.4076, 35.20062], [33.38575, 35.2018], [33.37248, 35.18698], [33.3717, 35.1788], [33.36569, 35.17479], [33.35612, 35.17402], [33.35596, 35.17942], [33.34964, 35.17803], [33.35056, 35.18328], [33.31955, 35.18096], [33.3072, 35.16816], [33.27068, 35.16815], [33.15138, 35.19504], [33.11105, 35.15639], [33.08249, 35.17319], [33.01192, 35.15639], [32.94471, 35.09422], [32.86406, 35.1043], [32.85733, 35.07742], [32.70779, 35.14127], [32.70947, 35.18328], [32.64864, 35.19967], [32.60361, 35.16647], [32.46489, 35.48584]]], [[[33.74144, 35.01053], [33.7492, 35.01319], [33.74983, 35.02274], [33.74265, 35.02329], [33.73781, 35.02181], [33.7343, 35.01178], [33.74144, 35.01053]]], [[[33.77312, 34.9976], [33.75994, 35.00113], [33.75682, 34.99916], [33.76605, 34.99543], [33.76738, 34.99188], [33.7778, 34.98981], [33.77843, 34.988], [33.78149, 34.98854], [33.78318, 34.98699], [33.78571, 34.98951], [33.78917, 34.98854], [33.79191, 34.98914], [33.78516, 34.99582], [33.77553, 34.99518], [33.77312, 34.9976]]]] } },
20563     { type: "Feature", properties: { iso1A2: "CZ", iso1A3: "CZE", iso1N3: "203", wikidata: "Q213", nameEn: "Czechia", groups: ["EU", "151", "150", "UN"], callingCodes: ["420"] }, geometry: { type: "MultiPolygon", coordinates: [[[[14.82803, 50.86966], [14.79139, 50.81438], [14.70661, 50.84096], [14.61993, 50.86049], [14.63434, 50.8883], [14.65259, 50.90513], [14.64802, 50.93241], [14.58024, 50.91443], [14.56374, 50.922], [14.59702, 50.96148], [14.59908, 50.98685], [14.58215, 50.99306], [14.56432, 51.01008], [14.53438, 51.00374], [14.53321, 51.01679], [14.49873, 51.02242], [14.50809, 51.0427], [14.49991, 51.04692], [14.49154, 51.04382], [14.49202, 51.02286], [14.45827, 51.03712], [14.41335, 51.02086], [14.30098, 51.05515], [14.25665, 50.98935], [14.28776, 50.97718], [14.32353, 50.98556], [14.32793, 50.97379], [14.30251, 50.96606], [14.31422, 50.95243], [14.39848, 50.93866], [14.38691, 50.89907], [14.30098, 50.88448], [14.27123, 50.89386], [14.24314, 50.88761], [14.22331, 50.86049], [14.02982, 50.80662], [13.98864, 50.8177], [13.89113, 50.78533], [13.89444, 50.74142], [13.82942, 50.7251], [13.76316, 50.73487], [13.70204, 50.71771], [13.65977, 50.73096], [13.52474, 50.70394], [13.53748, 50.67654], [13.5226, 50.64721], [13.49742, 50.63133], [13.46413, 50.60102], [13.42189, 50.61243], [13.37485, 50.64931], [13.37805, 50.627], [13.32264, 50.60317], [13.32594, 50.58009], [13.29454, 50.57904], [13.25158, 50.59268], [13.19043, 50.50237], [13.13424, 50.51709], [13.08301, 50.50132], [13.0312, 50.50944], [13.02038, 50.4734], [13.02147, 50.44763], [12.98433, 50.42016], [12.94058, 50.40944], [12.82465, 50.45738], [12.73476, 50.43237], [12.73044, 50.42268], [12.70731, 50.39948], [12.67261, 50.41949], [12.51356, 50.39694], [12.48747, 50.37278], [12.49214, 50.35228], [12.48256, 50.34784], [12.46643, 50.35527], [12.43722, 50.33774], [12.43371, 50.32506], [12.39924, 50.32302], [12.40158, 50.29521], [12.36594, 50.28289], [12.35425, 50.23993], [12.33263, 50.24367], [12.32445, 50.20442], [12.33847, 50.19432], [12.32596, 50.17146], [12.29232, 50.17524], [12.28063, 50.19544], [12.28755, 50.22429], [12.23943, 50.24594], [12.24791, 50.25525], [12.26953, 50.25189], [12.25119, 50.27079], [12.20823, 50.2729], [12.18013, 50.32146], [12.10907, 50.32041], [12.13716, 50.27396], [12.09287, 50.25032], [12.19335, 50.19997], [12.21484, 50.16399], [12.1917, 50.13434], [12.2073, 50.10315], [12.23709, 50.10213], [12.27433, 50.0771], [12.26111, 50.06331], [12.30798, 50.05719], [12.49908, 49.97305], [12.47264, 49.94222], [12.55197, 49.92094], [12.48256, 49.83575], [12.46603, 49.78882], [12.40489, 49.76321], [12.4462, 49.70233], [12.52553, 49.68415], [12.53544, 49.61888], [12.56188, 49.6146], [12.60155, 49.52887], [12.64782, 49.52565], [12.64121, 49.47628], [12.669, 49.42935], [12.71227, 49.42363], [12.75854, 49.3989], [12.78168, 49.34618], [12.88414, 49.33541], [12.88249, 49.35479], [12.94859, 49.34079], [13.03618, 49.30417], [13.02957, 49.27399], [13.05883, 49.26259], [13.17665, 49.16713], [13.17019, 49.14339], [13.20405, 49.12303], [13.23689, 49.11412], [13.28242, 49.1228], [13.39479, 49.04812], [13.40802, 48.98851], [13.50221, 48.93752], [13.50552, 48.97441], [13.58319, 48.96899], [13.61624, 48.9462], [13.67739, 48.87886], [13.73854, 48.88538], [13.76994, 48.83537], [13.78977, 48.83319], [13.8096, 48.77877], [13.84023, 48.76988], [14.06151, 48.66873], [14.01482, 48.63788], [14.09104, 48.5943], [14.20691, 48.5898], [14.33909, 48.55852], [14.43076, 48.58855], [14.4587, 48.64695], [14.56139, 48.60429], [14.60808, 48.62881], [14.66762, 48.58215], [14.71794, 48.59794], [14.72756, 48.69502], [14.80584, 48.73489], [14.80821, 48.77711], [14.81545, 48.7874], [14.94773, 48.76268], [14.95641, 48.75915], [14.9758, 48.76857], [14.98112, 48.77524], [14.9782, 48.7766], [14.98032, 48.77959], [14.95072, 48.79101], [14.98917, 48.90082], [14.97612, 48.96983], [14.99878, 49.01444], [15.15534, 48.99056], [15.16358, 48.94278], [15.26177, 48.95766], [15.28305, 48.98831], [15.34823, 48.98444], [15.48027, 48.94481], [15.51357, 48.91549], [15.61622, 48.89541], [15.6921, 48.85973], [15.75341, 48.8516], [15.78087, 48.87644], [15.84404, 48.86921], [16.06034, 48.75436], [16.37345, 48.729], [16.40915, 48.74576], [16.46134, 48.80865], [16.67008, 48.77699], [16.68518, 48.7281], [16.71883, 48.73806], [16.79779, 48.70998], [16.90354, 48.71541], [16.93955, 48.60371], [17.00215, 48.70887], [17.11202, 48.82925], [17.19355, 48.87602], [17.29054, 48.85546], [17.3853, 48.80936], [17.45671, 48.85004], [17.5295, 48.81117], [17.7094, 48.86721], [17.73126, 48.87885], [17.77944, 48.92318], [17.87831, 48.92679], [17.91814, 49.01784], [18.06885, 49.03157], [18.1104, 49.08624], [18.15022, 49.24518], [18.18456, 49.28909], [18.36446, 49.3267], [18.4139, 49.36517], [18.4084, 49.40003], [18.44686, 49.39467], [18.54848, 49.47059], [18.53063, 49.49022], [18.57183, 49.51162], [18.6144, 49.49824], [18.67757, 49.50895], [18.74761, 49.492], [18.84521, 49.51672], [18.84786, 49.5446], [18.80479, 49.6815], [18.72838, 49.68163], [18.69817, 49.70473], [18.62676, 49.71983], [18.62943, 49.74603], [18.62645, 49.75002], [18.61368, 49.75426], [18.61278, 49.7618], [18.57183, 49.83334], [18.60341, 49.86256], [18.57045, 49.87849], [18.57697, 49.91565], [18.54299, 49.92537], [18.54495, 49.9079], [18.53423, 49.89906], [18.41604, 49.93498], [18.33562, 49.94747], [18.33278, 49.92415], [18.31914, 49.91565], [18.27794, 49.93863], [18.27107, 49.96779], [18.21752, 49.97309], [18.20241, 49.99958], [18.10628, 50.00223], [18.07898, 50.04535], [18.03212, 50.06574], [18.00396, 50.04954], [18.04585, 50.03311], [18.04585, 50.01194], [18.00191, 50.01723], [17.86886, 49.97452], [17.77669, 50.02253], [17.7506, 50.07896], [17.6888, 50.12037], [17.66683, 50.10275], [17.59404, 50.16437], [17.70528, 50.18812], [17.76296, 50.23382], [17.72176, 50.25665], [17.74648, 50.29966], [17.69292, 50.32859], [17.67764, 50.28977], [17.58889, 50.27837], [17.3702, 50.28123], [17.34548, 50.2628], [17.34273, 50.32947], [17.27681, 50.32246], [17.19991, 50.3654], [17.19579, 50.38817], [17.14498, 50.38117], [17.1224, 50.39494], [16.89229, 50.45117], [16.85933, 50.41093], [16.90877, 50.38642], [16.94448, 50.31281], [16.99803, 50.30316], [17.02138, 50.27772], [16.99803, 50.25753], [17.02825, 50.23118], [17.00353, 50.21449], [16.98018, 50.24172], [16.8456, 50.20834], [16.7014, 50.09659], [16.63137, 50.1142], [16.55446, 50.16613], [16.56407, 50.21009], [16.42674, 50.32509], [16.39379, 50.3207], [16.3622, 50.34875], [16.36495, 50.37679], [16.30289, 50.38292], [16.28118, 50.36891], [16.22821, 50.41054], [16.21585, 50.40627], [16.19526, 50.43291], [16.31413, 50.50274], [16.34572, 50.49575], [16.44597, 50.58041], [16.33611, 50.66579], [16.23174, 50.67101], [16.20839, 50.63096], [16.10265, 50.66405], [16.02437, 50.60046], [15.98317, 50.61528], [16.0175, 50.63009], [15.97219, 50.69799], [15.87331, 50.67188], [15.81683, 50.75666], [15.73186, 50.73885], [15.43798, 50.80833], [15.3803, 50.77187], [15.36656, 50.83956], [15.2773, 50.8907], [15.27043, 50.97724], [15.2361, 50.99886], [15.1743, 50.9833], [15.16744, 51.01959], [15.11937, 50.99021], [15.10152, 51.01095], [15.06218, 51.02269], [15.03895, 51.0123], [15.02433, 51.0242], [14.96419, 50.99108], [15.01088, 50.97984], [14.99852, 50.86817], [14.82803, 50.86966]]]] } },
20564     { type: "Feature", properties: { iso1A2: "DE", iso1A3: "DEU", iso1N3: "276", wikidata: "Q183", nameEn: "Germany", groups: ["EU", "155", "150", "UN"], callingCodes: ["49"] }, geometry: { type: "MultiPolygon", coordinates: [[[[8.70847, 47.68904], [8.71773, 47.69088], [8.70237, 47.71453], [8.66416, 47.71367], [8.67508, 47.6979], [8.65769, 47.68928], [8.66837, 47.68437], [8.68985, 47.69552], [8.70847, 47.68904]]], [[[8.72617, 47.69651], [8.72809, 47.69282], [8.75856, 47.68969], [8.79511, 47.67462], [8.79966, 47.70222], [8.76965, 47.7075], [8.77309, 47.72059], [8.80663, 47.73821], [8.82002, 47.71458], [8.86989, 47.70504], [8.85065, 47.68209], [8.87383, 47.67045], [8.87625, 47.65441], [8.89946, 47.64769], [8.94093, 47.65596], [9.02093, 47.6868], [9.09891, 47.67801], [9.13845, 47.66389], [9.15181, 47.66904], [9.1705, 47.65513], [9.1755, 47.65584], [9.17593, 47.65399], [9.18203, 47.65598], [9.25619, 47.65939], [9.55125, 47.53629], [9.72736, 47.53457], [9.76748, 47.5934], [9.80254, 47.59419], [9.82591, 47.58158], [9.8189, 47.54688], [9.87499, 47.52953], [9.87733, 47.54688], [9.92407, 47.53111], [9.96029, 47.53899], [10.00003, 47.48216], [10.03859, 47.48927], [10.07131, 47.45531], [10.09001, 47.46005], [10.1052, 47.4316], [10.06897, 47.40709], [10.09819, 47.35724], [10.11805, 47.37228], [10.16362, 47.36674], [10.17648, 47.38889], [10.2127, 47.38019], [10.22774, 47.38904], [10.23757, 47.37609], [10.19998, 47.32832], [10.2147, 47.31014], [10.17648, 47.29149], [10.17531, 47.27167], [10.23257, 47.27088], [10.33424, 47.30813], [10.39851, 47.37623], [10.4324, 47.38494], [10.4359, 47.41183], [10.47446, 47.43318], [10.46278, 47.47901], [10.44291, 47.48453], [10.4324, 47.50111], [10.44992, 47.5524], [10.43473, 47.58394], [10.47329, 47.58552], [10.48849, 47.54057], [10.56912, 47.53584], [10.60337, 47.56755], [10.63456, 47.5591], [10.68832, 47.55752], [10.6965, 47.54253], [10.7596, 47.53228], [10.77596, 47.51729], [10.88814, 47.53701], [10.91268, 47.51334], [10.86945, 47.5015], [10.87061, 47.4786], [10.90918, 47.48571], [10.93839, 47.48018], [10.92437, 47.46991], [10.98513, 47.42882], [10.97111, 47.41617], [10.97111, 47.39561], [11.11835, 47.39719], [11.12536, 47.41222], [11.20482, 47.43198], [11.25157, 47.43277], [11.22002, 47.3964], [11.27844, 47.39956], [11.29597, 47.42566], [11.33804, 47.44937], [11.4175, 47.44621], [11.38128, 47.47465], [11.4362, 47.51413], [11.52618, 47.50939], [11.58578, 47.52281], [11.58811, 47.55515], [11.60681, 47.57881], [11.63934, 47.59202], [11.84052, 47.58354], [11.85572, 47.60166], [12.0088, 47.62451], [12.02282, 47.61033], [12.05788, 47.61742], [12.13734, 47.60639], [12.17824, 47.61506], [12.18145, 47.61019], [12.17737, 47.60121], [12.18568, 47.6049], [12.20398, 47.60667], [12.20801, 47.61082], [12.19895, 47.64085], [12.18507, 47.65984], [12.18347, 47.66663], [12.16769, 47.68167], [12.16217, 47.70105], [12.18303, 47.70065], [12.22571, 47.71776], [12.2542, 47.7433], [12.26238, 47.73544], [12.24017, 47.69534], [12.26004, 47.67725], [12.27991, 47.68827], [12.336, 47.69534], [12.37222, 47.68433], [12.43883, 47.6977], [12.44117, 47.6741], [12.50076, 47.62293], [12.53816, 47.63553], [12.57438, 47.63238], [12.6071, 47.6741], [12.7357, 47.6787], [12.77777, 47.66689], [12.76492, 47.64485], [12.82101, 47.61493], [12.77427, 47.58025], [12.80699, 47.54477], [12.84672, 47.54556], [12.85256, 47.52741], [12.9624, 47.47452], [12.98344, 47.48716], [12.9998, 47.46267], [13.04537, 47.49426], [13.03252, 47.53373], [13.05355, 47.56291], [13.04537, 47.58183], [13.06641, 47.58577], [13.06407, 47.60075], [13.09562, 47.63304], [13.07692, 47.68814], [13.01382, 47.72116], [12.98578, 47.7078], [12.92969, 47.71094], [12.91333, 47.7178], [12.90274, 47.72513], [12.91711, 47.74026], [12.9353, 47.74788], [12.94371, 47.76281], [12.93202, 47.77302], [12.96311, 47.79957], [12.98543, 47.82896], [13.00588, 47.84374], [12.94163, 47.92927], [12.93886, 47.94046], [12.93642, 47.94436], [12.93419, 47.94063], [12.92668, 47.93879], [12.91985, 47.94069], [12.9211, 47.95135], [12.91683, 47.95647], [12.87476, 47.96195], [12.8549, 48.01122], [12.76141, 48.07373], [12.74973, 48.10885], [12.7617, 48.12796], [12.78595, 48.12445], [12.80676, 48.14979], [12.82673, 48.15245], [12.8362, 48.15876], [12.836, 48.1647], [12.84475, 48.16556], [12.87126, 48.20318], [12.95306, 48.20629], [13.02083, 48.25689], [13.0851, 48.27711], [13.126, 48.27867], [13.18093, 48.29577], [13.26039, 48.29422], [13.30897, 48.31575], [13.40709, 48.37292], [13.43929, 48.43386], [13.42527, 48.45711], [13.45727, 48.51092], [13.43695, 48.55776], [13.45214, 48.56472], [13.46967, 48.55157], [13.50663, 48.57506], [13.50131, 48.58091], [13.51291, 48.59023], [13.57535, 48.55912], [13.59705, 48.57013], [13.62508, 48.55501], [13.65186, 48.55092], [13.66113, 48.53558], [13.72802, 48.51208], [13.74816, 48.53058], [13.7513, 48.5624], [13.76921, 48.55324], [13.80519, 48.58026], [13.80038, 48.59487], [13.82609, 48.62345], [13.81901, 48.6761], [13.81283, 48.68426], [13.81791, 48.69832], [13.79337, 48.71375], [13.81863, 48.73257], [13.82266, 48.75544], [13.84023, 48.76988], [13.8096, 48.77877], [13.78977, 48.83319], [13.76994, 48.83537], [13.73854, 48.88538], [13.67739, 48.87886], [13.61624, 48.9462], [13.58319, 48.96899], [13.50552, 48.97441], [13.50221, 48.93752], [13.40802, 48.98851], [13.39479, 49.04812], [13.28242, 49.1228], [13.23689, 49.11412], [13.20405, 49.12303], [13.17019, 49.14339], [13.17665, 49.16713], [13.05883, 49.26259], [13.02957, 49.27399], [13.03618, 49.30417], [12.94859, 49.34079], [12.88249, 49.35479], [12.88414, 49.33541], [12.78168, 49.34618], [12.75854, 49.3989], [12.71227, 49.42363], [12.669, 49.42935], [12.64121, 49.47628], [12.64782, 49.52565], [12.60155, 49.52887], [12.56188, 49.6146], [12.53544, 49.61888], [12.52553, 49.68415], [12.4462, 49.70233], [12.40489, 49.76321], [12.46603, 49.78882], [12.48256, 49.83575], [12.55197, 49.92094], [12.47264, 49.94222], [12.49908, 49.97305], [12.30798, 50.05719], [12.26111, 50.06331], [12.27433, 50.0771], [12.23709, 50.10213], [12.2073, 50.10315], [12.1917, 50.13434], [12.21484, 50.16399], [12.19335, 50.19997], [12.09287, 50.25032], [12.13716, 50.27396], [12.10907, 50.32041], [12.18013, 50.32146], [12.20823, 50.2729], [12.25119, 50.27079], [12.26953, 50.25189], [12.24791, 50.25525], [12.23943, 50.24594], [12.28755, 50.22429], [12.28063, 50.19544], [12.29232, 50.17524], [12.32596, 50.17146], [12.33847, 50.19432], [12.32445, 50.20442], [12.33263, 50.24367], [12.35425, 50.23993], [12.36594, 50.28289], [12.40158, 50.29521], [12.39924, 50.32302], [12.43371, 50.32506], [12.43722, 50.33774], [12.46643, 50.35527], [12.48256, 50.34784], [12.49214, 50.35228], [12.48747, 50.37278], [12.51356, 50.39694], [12.67261, 50.41949], [12.70731, 50.39948], [12.73044, 50.42268], [12.73476, 50.43237], [12.82465, 50.45738], [12.94058, 50.40944], [12.98433, 50.42016], [13.02147, 50.44763], [13.02038, 50.4734], [13.0312, 50.50944], [13.08301, 50.50132], [13.13424, 50.51709], [13.19043, 50.50237], [13.25158, 50.59268], [13.29454, 50.57904], [13.32594, 50.58009], [13.32264, 50.60317], [13.37805, 50.627], [13.37485, 50.64931], [13.42189, 50.61243], [13.46413, 50.60102], [13.49742, 50.63133], [13.5226, 50.64721], [13.53748, 50.67654], [13.52474, 50.70394], [13.65977, 50.73096], [13.70204, 50.71771], [13.76316, 50.73487], [13.82942, 50.7251], [13.89444, 50.74142], [13.89113, 50.78533], [13.98864, 50.8177], [14.02982, 50.80662], [14.22331, 50.86049], [14.24314, 50.88761], [14.27123, 50.89386], [14.30098, 50.88448], [14.38691, 50.89907], [14.39848, 50.93866], [14.31422, 50.95243], [14.30251, 50.96606], [14.32793, 50.97379], [14.32353, 50.98556], [14.28776, 50.97718], [14.25665, 50.98935], [14.30098, 51.05515], [14.41335, 51.02086], [14.45827, 51.03712], [14.49202, 51.02286], [14.49154, 51.04382], [14.49991, 51.04692], [14.50809, 51.0427], [14.49873, 51.02242], [14.53321, 51.01679], [14.53438, 51.00374], [14.56432, 51.01008], [14.58215, 50.99306], [14.59908, 50.98685], [14.59702, 50.96148], [14.56374, 50.922], [14.58024, 50.91443], [14.64802, 50.93241], [14.65259, 50.90513], [14.63434, 50.8883], [14.61993, 50.86049], [14.70661, 50.84096], [14.79139, 50.81438], [14.82803, 50.86966], [14.81664, 50.88148], [14.89681, 50.9422], [14.89252, 50.94999], [14.92942, 50.99744], [14.95529, 51.04552], [14.97938, 51.07742], [14.98229, 51.11354], [14.99689, 51.12205], [14.99079, 51.14284], [14.99646, 51.14365], [15.00083, 51.14974], [14.99414, 51.15813], [14.99311, 51.16249], [15.0047, 51.16874], [15.01242, 51.21285], [15.04288, 51.28387], [14.98008, 51.33449], [14.96899, 51.38367], [14.9652, 51.44793], [14.94749, 51.47155], [14.73219, 51.52922], [14.72652, 51.53902], [14.73047, 51.54606], [14.71125, 51.56209], [14.7727, 51.61263], [14.75759, 51.62318], [14.75392, 51.67445], [14.69065, 51.70842], [14.66386, 51.73282], [14.64625, 51.79472], [14.60493, 51.80473], [14.59089, 51.83302], [14.6588, 51.88359], [14.6933, 51.9044], [14.70601, 51.92944], [14.7177, 51.94048], [14.72163, 51.95188], [14.71836, 51.95606], [14.7139, 51.95643], [14.70488, 51.97679], [14.71339, 52.00337], [14.76026, 52.06624], [14.72971, 52.09167], [14.6917, 52.10283], [14.67683, 52.13936], [14.70616, 52.16927], [14.68344, 52.19612], [14.71319, 52.22144], [14.70139, 52.25038], [14.58149, 52.28007], [14.56378, 52.33838], [14.55228, 52.35264], [14.54423, 52.42568], [14.63056, 52.48993], [14.60081, 52.53116], [14.6289, 52.57136], [14.61073, 52.59847], [14.22071, 52.81175], [14.13806, 52.82392], [14.12256, 52.84311], [14.15873, 52.87715], [14.14056, 52.95786], [14.25954, 53.00264], [14.35044, 53.05829], [14.38679, 53.13669], [14.36696, 53.16444], [14.37853, 53.20405], [14.40662, 53.21098], [14.45125, 53.26241], [14.44133, 53.27427], [14.4215, 53.27724], [14.35209, 53.49506], [14.3273, 53.50587], [14.30416, 53.55499], [14.31904, 53.61581], [14.2853, 53.63392], [14.28477, 53.65955], [14.27133, 53.66613], [14.2836, 53.67721], [14.26782, 53.69866], [14.27249, 53.74464], [14.21323, 53.8664], [14.20823, 53.90776], [14.18544, 53.91258], [14.20647, 53.91671], [14.22634, 53.9291], [14.20811, 54.12784], [13.93395, 54.84044], [12.85844, 54.82438], [11.90309, 54.38543], [11.00303, 54.63689], [10.31111, 54.65968], [10.16755, 54.73883], [9.89314, 54.84171], [9.73563, 54.8247], [9.61187, 54.85548], [9.62734, 54.88057], [9.58937, 54.88785], [9.4659, 54.83131], [9.43155, 54.82586], [9.41213, 54.84254], [9.38532, 54.83968], [9.36496, 54.81749], [9.33849, 54.80233], [9.32771, 54.80602], [9.2474, 54.8112], [9.23445, 54.83432], [9.24631, 54.84726], [9.20571, 54.85841], [9.14275, 54.87421], [9.04629, 54.87249], [8.92795, 54.90452], [8.81178, 54.90518], [8.76387, 54.8948], [8.63979, 54.91069], [8.55769, 54.91837], [8.45719, 55.06747], [8.02459, 55.09613], [5.45168, 54.20039], [6.91025, 53.44221], [7.00198, 53.32672], [7.19052, 53.31866], [7.21679, 53.20058], [7.22681, 53.18165], [7.17898, 53.13817], [7.21694, 53.00742], [7.07253, 52.81083], [7.04557, 52.63318], [6.77307, 52.65375], [6.71641, 52.62905], [6.69507, 52.488], [6.94293, 52.43597], [6.99041, 52.47235], [7.03417, 52.40237], [7.07044, 52.37805], [7.02703, 52.27941], [7.06365, 52.23789], [7.03729, 52.22695], [6.9897, 52.2271], [6.97189, 52.20329], [6.83984, 52.11728], [6.76117, 52.11895], [6.68128, 52.05052], [6.83035, 51.9905], [6.82357, 51.96711], [6.72319, 51.89518], [6.68386, 51.91861], [6.58556, 51.89386], [6.50231, 51.86313], [6.47179, 51.85395], [6.38815, 51.87257], [6.40704, 51.82771], [6.30593, 51.84998], [6.29872, 51.86801], [6.21443, 51.86801], [6.15349, 51.90439], [6.11551, 51.89769], [6.16902, 51.84094], [6.10337, 51.84829], [6.06705, 51.86136], [5.99848, 51.83195], [5.94568, 51.82786], [5.98665, 51.76944], [5.95003, 51.7493], [6.04091, 51.71821], [6.02767, 51.6742], [6.11759, 51.65609], [6.09055, 51.60564], [6.18017, 51.54096], [6.21724, 51.48568], [6.20654, 51.40049], [6.22641, 51.39948], [6.22674, 51.36135], [6.16977, 51.33169], [6.07889, 51.24432], [6.07889, 51.17038], [6.17384, 51.19589], [6.16706, 51.15677], [5.98292, 51.07469], [5.9541, 51.03496], [5.9134, 51.06736], [5.86735, 51.05182], [5.87849, 51.01969], [5.90493, 51.00198], [5.90296, 50.97356], [5.95282, 50.98728], [6.02697, 50.98303], [6.01615, 50.93367], [6.09297, 50.92066], [6.07486, 50.89307], [6.08805, 50.87223], [6.07693, 50.86025], [6.07431, 50.84674], [6.05702, 50.85179], [6.05623, 50.8572], [6.01921, 50.84435], [6.02328, 50.81694], [6.00462, 50.80065], [5.98404, 50.80988], [5.97497, 50.79992], [6.02624, 50.77453], [6.01976, 50.75398], [6.03889, 50.74618], [6.0326, 50.72647], [6.0406, 50.71848], [6.04428, 50.72861], [6.11707, 50.72231], [6.17852, 50.6245], [6.26957, 50.62444], [6.2476, 50.60392], [6.24888, 50.59869], [6.24005, 50.58732], [6.22581, 50.5907], [6.20281, 50.56952], [6.17739, 50.55875], [6.17802, 50.54179], [6.19735, 50.53576], [6.19579, 50.5313], [6.18716, 50.52653], [6.19193, 50.5212], [6.20599, 50.52089], [6.22335, 50.49578], [6.26637, 50.50272], [6.30809, 50.50058], [6.3465, 50.48833], [6.34005, 50.46083], [6.37219, 50.45397], [6.36852, 50.40776], [6.34406, 50.37994], [6.3688, 50.35898], [6.40785, 50.33557], [6.40641, 50.32425], [6.35701, 50.31139], [6.32488, 50.32333], [6.29949, 50.30887], [6.28797, 50.27458], [6.208, 50.25179], [6.16853, 50.2234], [6.18364, 50.20815], [6.18739, 50.1822], [6.14588, 50.17106], [6.14132, 50.14971], [6.15298, 50.14126], [6.1379, 50.12964], [6.12055, 50.09171], [6.11274, 50.05916], [6.13458, 50.04141], [6.13044, 50.02929], [6.14666, 50.02207], [6.13794, 50.01466], [6.13273, 50.02019], [6.1295, 50.01849], [6.13806, 50.01056], [6.14948, 50.00908], [6.14147, 49.99563], [6.1701, 49.98518], [6.16466, 49.97086], [6.17872, 49.9537], [6.18554, 49.95622], [6.18045, 49.96611], [6.19089, 49.96991], [6.19856, 49.95053], [6.22094, 49.94955], [6.22608, 49.929], [6.21882, 49.92403], [6.22926, 49.92096], [6.23496, 49.89972], [6.26146, 49.88203], [6.28874, 49.87592], [6.29692, 49.86685], [6.30963, 49.87021], [6.32303, 49.85133], [6.32098, 49.83728], [6.33585, 49.83785], [6.34267, 49.84974], [6.36576, 49.85032], [6.40022, 49.82029], [6.42521, 49.81591], [6.42905, 49.81091], [6.44131, 49.81443], [6.45425, 49.81164], [6.47111, 49.82263], [6.48718, 49.81267], [6.50647, 49.80916], [6.51215, 49.80124], [6.52121, 49.81338], [6.53122, 49.80666], [6.52169, 49.79787], [6.50534, 49.78952], [6.51669, 49.78336], [6.51056, 49.77515], [6.51828, 49.76855], [6.51646, 49.75961], [6.50174, 49.75292], [6.50193, 49.73291], [6.51805, 49.72425], [6.51397, 49.72058], [6.50261, 49.72718], [6.49535, 49.72645], [6.49694, 49.72205], [6.5042, 49.71808], [6.50647, 49.71353], [6.49785, 49.71118], [6.48014, 49.69767], [6.46048, 49.69092], [6.44654, 49.67799], [6.42937, 49.66857], [6.42726, 49.66078], [6.43768, 49.66021], [6.4413, 49.65722], [6.41861, 49.61723], [6.39822, 49.60081], [6.385, 49.59946], [6.37464, 49.58886], [6.38342, 49.5799], [6.38024, 49.57593], [6.36676, 49.57813], [6.35825, 49.57053], [6.38228, 49.55855], [6.38072, 49.55171], [6.35666, 49.52931], [6.36788, 49.50377], [6.36907, 49.48931], [6.36778, 49.46937], [6.38352, 49.46463], [6.39168, 49.4667], [6.40274, 49.46546], [6.42432, 49.47683], [6.55404, 49.42464], [6.533, 49.40748], [6.60091, 49.36864], [6.58807, 49.35358], [6.572, 49.35027], [6.60186, 49.31055], [6.66583, 49.28065], [6.69274, 49.21661], [6.71843, 49.2208], [6.73256, 49.20486], [6.71137, 49.18808], [6.73765, 49.16375], [6.78265, 49.16793], [6.83385, 49.15162], [6.84703, 49.15734], [6.86225, 49.18185], [6.85016, 49.19354], [6.85119, 49.20038], [6.83555, 49.21249], [6.85939, 49.22376], [6.89298, 49.20863], [6.91875, 49.22261], [6.93831, 49.2223], [6.94028, 49.21641], [6.95963, 49.203], [6.97273, 49.2099], [7.01318, 49.19018], [7.03459, 49.19096], [7.0274, 49.17042], [7.03178, 49.15734], [7.04662, 49.13724], [7.04409, 49.12123], [7.04843, 49.11422], [7.05548, 49.11185], [7.06642, 49.11415], [7.07162, 49.1255], [7.09007, 49.13094], [7.07859, 49.15031], [7.10715, 49.15631], [7.10384, 49.13787], [7.12504, 49.14253], [7.1358, 49.1282], [7.1593, 49.1204], [7.23473, 49.12971], [7.29514, 49.11426], [7.3195, 49.14231], [7.35995, 49.14399], [7.3662, 49.17308], [7.44052, 49.18354], [7.44455, 49.16765], [7.49473, 49.17], [7.49172, 49.13915], [7.53012, 49.09818], [7.56416, 49.08136], [7.62575, 49.07654], [7.63618, 49.05428], [7.75948, 49.04562], [7.79557, 49.06583], [7.86386, 49.03499], [7.93641, 49.05544], [7.97783, 49.03161], [8.14189, 48.97833], [8.22604, 48.97352], [8.20031, 48.95856], [8.19989, 48.95825], [8.12813, 48.87985], [8.10253, 48.81829], [8.06802, 48.78957], [8.0326, 48.79017], [8.01534, 48.76085], [7.96994, 48.75606], [7.96812, 48.72491], [7.89002, 48.66317], [7.84098, 48.64217], [7.80057, 48.5857], [7.80167, 48.54758], [7.80647, 48.51239], [7.76833, 48.48945], [7.73109, 48.39192], [7.74562, 48.32736], [7.69022, 48.30018], [7.6648, 48.22219], [7.57137, 48.12292], [7.56966, 48.03265], [7.62302, 47.97898], [7.55673, 47.87371], [7.52921, 47.77747], [7.54761, 47.72912], [7.53722, 47.71635], [7.51266, 47.70197], [7.51915, 47.68335], [7.52067, 47.66437], [7.53384, 47.65115], [7.5591, 47.63849], [7.57423, 47.61628], [7.58851, 47.60794], [7.59301, 47.60058], [7.58945, 47.59017], [7.60523, 47.58519], [7.60459, 47.57869], [7.61929, 47.57683], [7.64309, 47.59151], [7.64213, 47.5944], [7.64599, 47.59695], [7.67395, 47.59212], [7.68229, 47.59905], [7.69385, 47.60099], [7.68486, 47.59601], [7.67115, 47.5871], [7.68904, 47.57133], [7.67655, 47.56435], [7.63338, 47.56256], [7.65083, 47.54662], [7.66174, 47.54554], [7.6656, 47.53752], [7.68101, 47.53232], [7.69642, 47.53297], [7.71961, 47.54219], [7.75261, 47.54599], [7.79486, 47.55691], [7.81901, 47.58798], [7.84412, 47.5841], [7.88664, 47.58854], [7.90673, 47.57674], [7.91251, 47.55031], [7.94494, 47.54511], [7.95682, 47.55789], [7.97581, 47.55493], [8.00113, 47.55616], [8.02136, 47.55096], [8.04383, 47.55443], [8.06663, 47.56374], [8.08557, 47.55768], [8.10002, 47.56504], [8.10395, 47.57918], [8.11543, 47.5841], [8.13662, 47.58432], [8.13823, 47.59147], [8.14947, 47.59558], [8.1652, 47.5945], [8.19378, 47.61636], [8.20617, 47.62141], [8.22011, 47.6181], [8.22577, 47.60385], [8.23809, 47.61204], [8.25863, 47.61571], [8.26313, 47.6103], [8.2824, 47.61225], [8.29722, 47.60603], [8.29524, 47.5919], [8.30277, 47.58607], [8.32735, 47.57133], [8.35512, 47.57014], [8.38273, 47.56608], [8.39477, 47.57826], [8.43235, 47.56617], [8.49431, 47.58107], [8.48949, 47.588], [8.46637, 47.58389], [8.45578, 47.60121], [8.50747, 47.61897], [8.51686, 47.63476], [8.55756, 47.62394], [8.57586, 47.59537], [8.60348, 47.61204], [8.59545, 47.64298], [8.60701, 47.65271], [8.61471, 47.64514], [8.60412, 47.63735], [8.62049, 47.63757], [8.62884, 47.65098], [8.61113, 47.66332], [8.6052, 47.67258], [8.57683, 47.66158], [8.56141, 47.67088], [8.52801, 47.66059], [8.5322, 47.64687], [8.49656, 47.64709], [8.46605, 47.64103], [8.4667, 47.65747], [8.44711, 47.65379], [8.42264, 47.66667], [8.41346, 47.66676], [8.40473, 47.67499], [8.4211, 47.68407], [8.40569, 47.69855], [8.44807, 47.72426], [8.45771, 47.7493], [8.48868, 47.77215], [8.56814, 47.78001], [8.56415, 47.80633], [8.61657, 47.79998], [8.62408, 47.7626], [8.64425, 47.76398], [8.65292, 47.80066], [8.68022, 47.78599], [8.68985, 47.75686], [8.71778, 47.76571], [8.74251, 47.75168], [8.70543, 47.73121], [8.73671, 47.7169], [8.72617, 47.69651]]]] } },
20565     { type: "Feature", properties: { iso1A2: "DG", iso1A3: "DGA", wikidata: "Q184851", nameEn: "Diego Garcia", country: "GB", groups: ["IO", "BOTS", "014", "202", "002", "UN"], isoStatus: "excRes", callingCodes: ["246"] }, geometry: { type: "MultiPolygon", coordinates: [[[[73.14823, -7.76302], [73.09982, -6.07324], [71.43792, -7.73904], [73.14823, -7.76302]]]] } },
20566     { type: "Feature", properties: { iso1A2: "DJ", iso1A3: "DJI", iso1N3: "262", wikidata: "Q977", nameEn: "Djibouti", groups: ["014", "202", "002", "UN"], callingCodes: ["253"] }, geometry: { type: "MultiPolygon", coordinates: [[[[43.90659, 12.3823], [43.90659, 12.3823], [43.32909, 12.59711], [43.29075, 12.79154], [42.86195, 12.58747], [42.7996, 12.42629], [42.6957, 12.36201], [42.46941, 12.52661], [42.4037, 12.46478], [41.95461, 11.81157], [41.82878, 11.72361], [41.77727, 11.49902], [41.8096, 11.33606], [41.80056, 10.97127], [42.06302, 10.92599], [42.13691, 10.97586], [42.42669, 10.98493], [42.62989, 11.09711], [42.75111, 11.06992], [42.79037, 10.98493], [42.95776, 10.98533], [43.90659, 12.3823]]]] } },
20567     { type: "Feature", properties: { iso1A2: "DK", iso1A3: "DNK", iso1N3: "208", wikidata: "Q756617", nameEn: "Kingdom of Denmark" }, geometry: null },
20568     { type: "Feature", properties: { iso1A2: "DM", iso1A3: "DMA", iso1N3: "212", wikidata: "Q784", nameEn: "Dominica", groups: ["029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", callingCodes: ["1 767"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-61.32485, 14.91445], [-60.86656, 15.82603], [-61.95646, 15.5094], [-61.32485, 14.91445]]]] } },
20569     { type: "Feature", properties: { iso1A2: "DO", iso1A3: "DOM", iso1N3: "214", wikidata: "Q786", nameEn: "Dominican Republic", groups: ["029", "003", "419", "019", "UN"], callingCodes: ["1 809", "1 829", "1 849"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-67.87844, 21.7938], [-72.38946, 20.27111], [-71.77419, 19.73128], [-71.75865, 19.70231], [-71.7429, 19.58445], [-71.71449, 19.55364], [-71.71268, 19.53374], [-71.6802, 19.45008], [-71.69448, 19.37866], [-71.77766, 19.33823], [-71.73229, 19.26686], [-71.62642, 19.21212], [-71.65337, 19.11759], [-71.69938, 19.10916], [-71.71088, 19.08353], [-71.74088, 19.0437], [-71.88102, 18.95007], [-71.77766, 18.95007], [-71.72624, 18.87802], [-71.71885, 18.78423], [-71.82556, 18.62551], [-71.95412, 18.64939], [-72.00201, 18.62312], [-71.88102, 18.50125], [-71.90875, 18.45821], [-71.69952, 18.34101], [-71.78271, 18.18302], [-71.75465, 18.14405], [-71.74994, 18.11115], [-71.73783, 18.07177], [-71.75671, 18.03456], [-72.29523, 17.48026], [-68.39466, 16.14167], [-67.87844, 21.7938]]]] } },
20570     { type: "Feature", properties: { iso1A2: "DZ", iso1A3: "DZA", iso1N3: "012", wikidata: "Q262", nameEn: "Algeria", groups: ["015", "002", "UN"], callingCodes: ["213"] }, geometry: { type: "MultiPolygon", coordinates: [[[[8.59123, 37.14286], [5.10072, 39.89531], [-2.27707, 35.35051], [-2.21248, 35.08532], [-2.21445, 35.04378], [-2.04734, 34.93218], [-1.97833, 34.93218], [-1.97469, 34.886], [-1.73707, 34.74226], [-1.84569, 34.61907], [-1.69788, 34.48056], [-1.78042, 34.39018], [-1.64666, 34.10405], [-1.73494, 33.71721], [-1.59508, 33.59929], [-1.67067, 33.27084], [-1.46249, 33.0499], [-1.54244, 32.95499], [-1.37794, 32.73628], [-0.9912, 32.52467], [-1.24998, 32.32993], [-1.24453, 32.1917], [-1.15735, 32.12096], [-1.22829, 32.07832], [-2.46166, 32.16603], [-2.93873, 32.06557], [-2.82784, 31.79459], [-3.66314, 31.6339], [-3.66386, 31.39202], [-3.77647, 31.31912], [-3.77103, 31.14984], [-3.54944, 31.0503], [-3.65418, 30.85566], [-3.64735, 30.67539], [-4.31774, 30.53229], [-4.6058, 30.28343], [-5.21671, 29.95253], [-5.58831, 29.48103], [-5.72121, 29.52322], [-5.75616, 29.61407], [-6.69965, 29.51623], [-6.78351, 29.44634], [-6.95824, 29.50924], [-7.61585, 29.36252], [-8.6715, 28.71194], [-8.66879, 27.6666], [-8.66674, 27.31569], [-4.83423, 24.99935], [1.15698, 21.12843], [1.20992, 20.73533], [3.24648, 19.81703], [3.12501, 19.1366], [3.36082, 18.9745], [4.26651, 19.14224], [5.8153, 19.45101], [7.38361, 20.79165], [7.48273, 20.87258], [11.96886, 23.51735], [11.62498, 24.26669], [11.41061, 24.21456], [10.85323, 24.5595], [10.33159, 24.5465], [10.02432, 24.98124], [10.03146, 25.35635], [9.38834, 26.19288], [9.51696, 26.39148], [9.89569, 26.57696], [9.78136, 29.40961], [9.3876, 30.16738], [9.55544, 30.23971], [9.07483, 32.07865], [8.35999, 32.50101], [8.31895, 32.83483], [8.1179, 33.05086], [8.11433, 33.10175], [7.83028, 33.18851], [7.73687, 33.42114], [7.54088, 33.7726], [7.52851, 34.06493], [7.66174, 34.20167], [7.74207, 34.16492], [7.81242, 34.21841], [7.86264, 34.3987], [8.20482, 34.57575], [8.29655, 34.72798], [8.25189, 34.92009], [8.30727, 34.95378], [8.3555, 35.10007], [8.47318, 35.23376], [8.30329, 35.29884], [8.36086, 35.47774], [8.35371, 35.66373], [8.26472, 35.73669], [8.2626, 35.91733], [8.40731, 36.42208], [8.18936, 36.44939], [8.16167, 36.48817], [8.47609, 36.66607], [8.46537, 36.7706], [8.57613, 36.78062], [8.67706, 36.8364], [8.62972, 36.86499], [8.64044, 36.9401], [8.59123, 37.14286]]]] } },
20571     { type: "Feature", properties: { iso1A2: "EA", wikidata: "Q28868874", nameEn: "Ceuta, Melilla", country: "ES", level: "territory", isoStatus: "excRes" }, geometry: null },
20572     { type: "Feature", properties: { iso1A2: "EC", iso1A3: "ECU", iso1N3: "218", wikidata: "Q736", nameEn: "Ecuador" }, geometry: null },
20573     { type: "Feature", properties: { iso1A2: "EE", iso1A3: "EST", iso1N3: "233", wikidata: "Q191", nameEn: "Estonia", aliases: ["EW"], groups: ["EU", "154", "150", "UN"], callingCodes: ["372"] }, geometry: { type: "MultiPolygon", coordinates: [[[[26.32936, 60.00121], [20.5104, 59.15546], [19.84909, 57.57876], [22.80496, 57.87798], [23.20055, 57.56697], [24.26221, 57.91787], [24.3579, 57.87471], [25.19484, 58.0831], [25.28237, 57.98539], [25.29581, 58.08288], [25.73499, 57.90193], [26.05949, 57.84744], [26.0324, 57.79037], [26.02456, 57.78342], [26.027, 57.78158], [26.0266, 57.77441], [26.02069, 57.77169], [26.02415, 57.76865], [26.03332, 57.7718], [26.0543, 57.76105], [26.08098, 57.76619], [26.2029, 57.7206], [26.1866, 57.6849], [26.29253, 57.59244], [26.46527, 57.56885], [26.54675, 57.51813], [26.90364, 57.62823], [27.34698, 57.52242], [27.31919, 57.57672], [27.40393, 57.62125], [27.3746, 57.66834], [27.52615, 57.72843], [27.50171, 57.78842], [27.56689, 57.83356], [27.78526, 57.83963], [27.81841, 57.89244], [27.67282, 57.92627], [27.62393, 58.09462], [27.48541, 58.22615], [27.55489, 58.39525], [27.36366, 58.78381], [27.74429, 58.98351], [27.80482, 59.1116], [27.87978, 59.18097], [27.90911, 59.24353], [28.00689, 59.28351], [28.14215, 59.28934], [28.19284, 59.35791], [28.20537, 59.36491], [28.21137, 59.38058], [28.19061, 59.39962], [28.04187, 59.47017], [27.85643, 59.58538], [26.90044, 59.63819], [26.32936, 60.00121]]]] } },
20574     { type: "Feature", properties: { iso1A2: "EG", iso1A3: "EGY", iso1N3: "818", wikidata: "Q79", nameEn: "Egypt", groups: ["015", "002", "UN"], callingCodes: ["20"] }, geometry: { type: "MultiPolygon", coordinates: [[[[33.62659, 31.82938], [26.92891, 33.39516], [24.8458, 31.39877], [25.01077, 30.73861], [24.71117, 30.17441], [24.99968, 29.24574], [24.99885, 21.99535], [33.17563, 22.00405], [34.0765, 22.00501], [37.8565, 22.00903], [34.4454, 27.91479], [34.8812, 29.36878], [34.92298, 29.45305], [34.26742, 31.21998], [34.24012, 31.29591], [34.23572, 31.2966], [34.21853, 31.32363], [34.052, 31.46619], [33.62659, 31.82938]]]] } },
20575     { type: "Feature", properties: { iso1A2: "EH", iso1A3: "ESH", iso1N3: "732", wikidata: "Q6250", nameEn: "Western Sahara", groups: ["015", "002"], callingCodes: ["212"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-8.66879, 27.6666], [-8.77527, 27.66663], [-8.71787, 26.9898], [-9.08698, 26.98639], [-9.56957, 26.90042], [-9.81998, 26.71379], [-10.68417, 26.90984], [-11.35695, 26.8505], [-11.23622, 26.72023], [-11.38635, 26.611], [-11.62052, 26.05229], [-12.06001, 26.04442], [-12.12281, 25.13682], [-12.92147, 24.39502], [-13.00628, 24.01923], [-13.75627, 23.77231], [-14.10361, 22.75501], [-14.1291, 22.41636], [-14.48112, 22.00886], [-14.47329, 21.63839], [-14.78487, 21.36587], [-16.44269, 21.39745], [-16.9978, 21.36239], [-17.02707, 21.34022], [-17.21511, 21.34226], [-17.35589, 20.80492], [-17.0471, 20.76408], [-17.0695, 20.85742], [-17.06781, 20.92697], [-17.0396, 20.9961], [-17.0357, 21.05368], [-16.99806, 21.12142], [-16.95474, 21.33997], [-13.01525, 21.33343], [-13.08438, 22.53866], [-13.15313, 22.75649], [-13.10753, 22.89493], [-13.00412, 23.02297], [-12.5741, 23.28975], [-12.36213, 23.3187], [-12.14969, 23.41935], [-12.00251, 23.4538], [-12.0002, 25.9986], [-8.66721, 25.99918], [-8.66674, 27.31569], [-8.66879, 27.6666]]]] } },
20576     { type: "Feature", properties: { iso1A2: "ER", iso1A3: "ERI", iso1N3: "232", wikidata: "Q986", nameEn: "Eritrea", groups: ["014", "202", "002", "UN"], callingCodes: ["291"] }, geometry: { type: "MultiPolygon", coordinates: [[[[40.99158, 15.81743], [39.63762, 18.37348], [38.57727, 17.98125], [38.45916, 17.87167], [38.37133, 17.66269], [38.13362, 17.53906], [37.50967, 17.32199], [37.42694, 17.04041], [36.99777, 17.07172], [36.92193, 16.23451], [36.76371, 15.80831], [36.69761, 15.75323], [36.54276, 15.23478], [36.44337, 15.14963], [36.54376, 14.25597], [36.56536, 14.26177], [36.55659, 14.28237], [36.63364, 14.31172], [36.85787, 14.32201], [37.01622, 14.2561], [37.09486, 14.27155], [37.13206, 14.40746], [37.3106, 14.44657], [37.47319, 14.2149], [37.528, 14.18413], [37.91287, 14.89447], [38.0364, 14.72745], [38.25562, 14.67287], [38.3533, 14.51323], [38.45748, 14.41445], [38.78306, 14.4754], [38.98058, 14.54895], [39.02834, 14.63717], [39.16074, 14.65187], [39.14772, 14.61827], [39.19547, 14.56996], [39.23888, 14.56365], [39.26927, 14.48801], [39.2302, 14.44598], [39.2519, 14.40393], [39.37685, 14.54402], [39.52756, 14.49011], [39.50585, 14.55735], [39.58182, 14.60987], [39.76632, 14.54264], [39.9443, 14.41024], [40.07236, 14.54264], [40.14649, 14.53969], [40.21128, 14.39342], [40.25686, 14.41445], [40.9167, 14.11152], [41.25097, 13.60787], [41.62864, 13.38626], [42.05841, 12.80912], [42.21469, 12.75832], [42.2798, 12.6355], [42.4037, 12.46478], [42.46941, 12.52661], [42.6957, 12.36201], [42.7996, 12.42629], [42.86195, 12.58747], [43.29075, 12.79154], [40.99158, 15.81743]]]] } },
20577     { type: "Feature", properties: { iso1A2: "ES", iso1A3: "ESP", iso1N3: "724", wikidata: "Q29", nameEn: "Spain" }, geometry: null },
20578     { type: "Feature", properties: { iso1A2: "ET", iso1A3: "ETH", iso1N3: "231", wikidata: "Q115", nameEn: "Ethiopia", groups: ["014", "202", "002", "UN"], callingCodes: ["251"] }, geometry: { type: "MultiPolygon", coordinates: [[[[42.4037, 12.46478], [42.2798, 12.6355], [42.21469, 12.75832], [42.05841, 12.80912], [41.62864, 13.38626], [41.25097, 13.60787], [40.9167, 14.11152], [40.25686, 14.41445], [40.21128, 14.39342], [40.14649, 14.53969], [40.07236, 14.54264], [39.9443, 14.41024], [39.76632, 14.54264], [39.58182, 14.60987], [39.50585, 14.55735], [39.52756, 14.49011], [39.37685, 14.54402], [39.2519, 14.40393], [39.2302, 14.44598], [39.26927, 14.48801], [39.23888, 14.56365], [39.19547, 14.56996], [39.14772, 14.61827], [39.16074, 14.65187], [39.02834, 14.63717], [38.98058, 14.54895], [38.78306, 14.4754], [38.45748, 14.41445], [38.3533, 14.51323], [38.25562, 14.67287], [38.0364, 14.72745], [37.91287, 14.89447], [37.528, 14.18413], [37.47319, 14.2149], [37.3106, 14.44657], [37.13206, 14.40746], [37.09486, 14.27155], [37.01622, 14.2561], [36.85787, 14.32201], [36.63364, 14.31172], [36.55659, 14.28237], [36.56536, 14.26177], [36.54376, 14.25597], [36.44653, 13.95666], [36.48824, 13.83954], [36.38993, 13.56459], [36.24545, 13.36759], [36.13374, 12.92665], [36.16651, 12.88019], [36.14268, 12.70879], [36.01458, 12.72478], [35.70476, 12.67101], [35.24302, 11.91132], [35.11492, 11.85156], [35.05832, 11.71158], [35.09556, 11.56278], [34.95704, 11.24448], [35.01215, 11.19626], [34.93172, 10.95946], [34.97789, 10.91559], [34.97491, 10.86147], [34.86916, 10.78832], [34.86618, 10.74588], [34.77532, 10.69027], [34.77383, 10.74588], [34.59062, 10.89072], [34.4372, 10.781], [34.2823, 10.53508], [34.34783, 10.23914], [34.32102, 10.11599], [34.22718, 10.02506], [34.20484, 9.9033], [34.13186, 9.7492], [34.08717, 9.55243], [34.10229, 9.50238], [34.14304, 9.04654], [34.14453, 8.60204], [34.01346, 8.50041], [33.89579, 8.4842], [33.87195, 8.41938], [33.71407, 8.3678], [33.66938, 8.44442], [33.54575, 8.47094], [33.3119, 8.45474], [33.19721, 8.40317], [33.1853, 8.29264], [33.18083, 8.13047], [33.08401, 8.05822], [33.0006, 7.90333], [33.04944, 7.78989], [33.24637, 7.77939], [33.32531, 7.71297], [33.44745, 7.7543], [33.71407, 7.65983], [33.87642, 7.5491], [34.02984, 7.36449], [34.03878, 7.27437], [34.01495, 7.25664], [34.19369, 7.12807], [34.19369, 7.04382], [34.35753, 6.91963], [34.47669, 6.91076], [34.53925, 6.82794], [34.53776, 6.74808], [34.65096, 6.72589], [34.77459, 6.5957], [34.87736, 6.60161], [35.01738, 6.46991], [34.96227, 6.26415], [35.00546, 5.89387], [35.12611, 5.68937], [35.13058, 5.62118], [35.31188, 5.50106], [35.29938, 5.34042], [35.50792, 5.42431], [35.8576, 5.33413], [35.81968, 5.10757], [35.82118, 4.77382], [35.9419, 4.61933], [35.95449, 4.53244], [36.03924, 4.44406], [36.84474, 4.44518], [37.07724, 4.33503], [38.14168, 3.62487], [38.45812, 3.60445], [38.52336, 3.62551], [38.91938, 3.51198], [39.07736, 3.5267], [39.19954, 3.47834], [39.49444, 3.45521], [39.51551, 3.40895], [39.55132, 3.39634], [39.58339, 3.47434], [39.76808, 3.67058], [39.86043, 3.86974], [40.77498, 4.27683], [41.1754, 3.94079], [41.89488, 3.97375], [42.07619, 4.17667], [42.55853, 4.20518], [42.84526, 4.28357], [42.97746, 4.44032], [43.04177, 4.57923], [43.40263, 4.79289], [44.02436, 4.9451], [44.98104, 4.91821], [47.97917, 8.00124], [47.92477, 8.00111], [46.99339, 7.9989], [44.19222, 8.93028], [43.32613, 9.59205], [43.23518, 9.84605], [43.0937, 9.90579], [42.87643, 10.18441], [42.69452, 10.62672], [42.95776, 10.98533], [42.79037, 10.98493], [42.75111, 11.06992], [42.62989, 11.09711], [42.42669, 10.98493], [42.13691, 10.97586], [42.06302, 10.92599], [41.80056, 10.97127], [41.8096, 11.33606], [41.77727, 11.49902], [41.82878, 11.72361], [41.95461, 11.81157], [42.4037, 12.46478]]]] } },
20579     { type: "Feature", properties: { iso1A2: "EU", iso1A3: "EUE", wikidata: "Q458", nameEn: "European Union", level: "union", isoStatus: "excRes" }, geometry: null },
20580     { type: "Feature", properties: { iso1A2: "FI", iso1A3: "FIN", iso1N3: "246", wikidata: "Q33", nameEn: "Finland", aliases: ["SF"] }, geometry: null },
20581     { type: "Feature", properties: { iso1A2: "FJ", iso1A3: "FJI", iso1N3: "242", wikidata: "Q712", nameEn: "Fiji", groups: ["054", "009", "UN"], driveSide: "left", callingCodes: ["679"] }, geometry: { type: "MultiPolygon", coordinates: [[[[174.245, -23.1974], [179.99999, -22.5], [179.99999, -11.5], [174, -11.5], [174.245, -23.1974]]], [[[-176.76826, -14.95183], [-180, -14.96041], [-180, -22.90585], [-176.74538, -22.89767], [-176.76826, -14.95183]]]] } },
20582     { type: "Feature", properties: { iso1A2: "FK", iso1A3: "FLK", iso1N3: "238", wikidata: "Q9648", nameEn: "Falkland Islands", country: "GB", groups: ["BOTS", "005", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["500"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-63.67376, -55.11859], [-54.56126, -51.26248], [-61.26735, -50.63919], [-63.67376, -55.11859]]]] } },
20583     { type: "Feature", properties: { iso1A2: "FM", iso1A3: "FSM", iso1N3: "583", wikidata: "Q702", nameEn: "Federated States of Micronesia", groups: ["057", "009", "UN"], roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["691"] }, geometry: { type: "MultiPolygon", coordinates: [[[[138.20583, 13.3783], [136.27107, 6.73747], [156.88247, -1.39237], [165.19726, 6.22546], [138.20583, 13.3783]]]] } },
20584     { type: "Feature", properties: { iso1A2: "FO", iso1A3: "FRO", iso1N3: "234", wikidata: "Q4628", nameEn: "Faroe Islands", country: "DK", groups: ["154", "150", "UN"], callingCodes: ["298"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-8.51774, 62.35338], [-6.51083, 60.95272], [-5.70102, 62.77194], [-8.51774, 62.35338]]]] } },
20585     { type: "Feature", properties: { iso1A2: "FR", iso1A3: "FRA", iso1N3: "250", wikidata: "Q142", nameEn: "France" }, geometry: null },
20586     { type: "Feature", properties: { iso1A2: "FX", iso1A3: "FXX", iso1N3: "249", wikidata: "Q212429", nameEn: "Metropolitan France", country: "FR", groups: ["EU", "155", "150", "UN"], isoStatus: "excRes", callingCodes: ["33"] }, geometry: { type: "MultiPolygon", coordinates: [[[[2.55904, 51.07014], [2.18458, 51.52087], [1.17405, 50.74239], [-2.02963, 49.91866], [-2.09454, 49.46288], [-1.83944, 49.23037], [-2.00491, 48.86706], [-2.65349, 49.15373], [-6.28985, 48.93406], [-1.81005, 43.59738], [-1.77289, 43.38957], [-1.79319, 43.37497], [-1.78332, 43.36399], [-1.78714, 43.35476], [-1.77068, 43.34396], [-1.75334, 43.34107], [-1.75079, 43.3317], [-1.7397, 43.32979], [-1.73074, 43.29481], [-1.69407, 43.31378], [-1.62481, 43.30726], [-1.63052, 43.28591], [-1.61341, 43.25269], [-1.57674, 43.25269], [-1.55963, 43.28828], [-1.50992, 43.29481], [-1.45289, 43.27049], [-1.40942, 43.27272], [-1.3758, 43.24511], [-1.41562, 43.12815], [-1.47555, 43.08372], [-1.44067, 43.047], [-1.35272, 43.02658], [-1.34419, 43.09665], [-1.32209, 43.1127], [-1.27118, 43.11961], [-1.30052, 43.09581], [-1.30531, 43.06859], [-1.25244, 43.04164], [-1.22881, 43.05534], [-1.10333, 43.0059], [-1.00963, 42.99279], [-0.97133, 42.96239], [-0.81652, 42.95166], [-0.75478, 42.96916], [-0.72037, 42.92541], [-0.73422, 42.91228], [-0.72608, 42.89318], [-0.69837, 42.87945], [-0.67637, 42.88303], [-0.55497, 42.77846], [-0.50863, 42.82713], [-0.44334, 42.79939], [-0.41319, 42.80776], [-0.38833, 42.80132], [-0.3122, 42.84788], [-0.17939, 42.78974], [-0.16141, 42.79535], [-0.10519, 42.72761], [-0.02468, 42.68513], [0.17569, 42.73424], [0.25336, 42.7174], [0.29407, 42.67431], [0.36251, 42.72282], [0.40214, 42.69779], [0.67873, 42.69458], [0.65421, 42.75872], [0.66121, 42.84021], [0.711, 42.86372], [0.93089, 42.79154], [0.96166, 42.80629], [0.98292, 42.78754], [1.0804, 42.78569], [1.15928, 42.71407], [1.35562, 42.71944], [1.44197, 42.60217], [1.47986, 42.61346], [1.46718, 42.63296], [1.48043, 42.65203], [1.50867, 42.64483], [1.55418, 42.65669], [1.60085, 42.62703], [1.63485, 42.62957], [1.6625, 42.61982], [1.68267, 42.62533], [1.73452, 42.61515], [1.72588, 42.59098], [1.7858, 42.57698], [1.73683, 42.55492], [1.72515, 42.50338], [1.76335, 42.48863], [1.83037, 42.48395], [1.88853, 42.4501], [1.93663, 42.45439], [1.94292, 42.44316], [1.94061, 42.43333], [1.94084, 42.43039], [1.9574, 42.42401], [1.96482, 42.37787], [2.00488, 42.35399], [2.06241, 42.35906], [2.11621, 42.38393], [2.12789, 42.41291], [2.16599, 42.42314], [2.20578, 42.41633], [2.25551, 42.43757], [2.38504, 42.39977], [2.43299, 42.39423], [2.43508, 42.37568], [2.48457, 42.33933], [2.54382, 42.33406], [2.55516, 42.35351], [2.57934, 42.35808], [2.6747, 42.33974], [2.65311, 42.38771], [2.72056, 42.42298], [2.75497, 42.42578], [2.77464, 42.41046], [2.84335, 42.45724], [2.85675, 42.45444], [2.86983, 42.46843], [2.88413, 42.45938], [2.92107, 42.4573], [2.94283, 42.48174], [2.96518, 42.46692], [3.03734, 42.47363], [3.08167, 42.42748], [3.10027, 42.42621], [3.11379, 42.43646], [3.17156, 42.43545], [3.75438, 42.33445], [7.60802, 41.05927], [10.09675, 41.44089], [9.56115, 43.20816], [7.50102, 43.51859], [7.42422, 43.72209], [7.40903, 43.7296], [7.41113, 43.73156], [7.41291, 43.73168], [7.41298, 43.73311], [7.41233, 43.73439], [7.42062, 43.73977], [7.42299, 43.74176], [7.42443, 43.74087], [7.42809, 43.74396], [7.43013, 43.74895], [7.43624, 43.75014], [7.43708, 43.75197], [7.4389, 43.75151], [7.4379, 43.74963], [7.47823, 43.73341], [7.53006, 43.78405], [7.50423, 43.84345], [7.49355, 43.86551], [7.51162, 43.88301], [7.56075, 43.89932], [7.56858, 43.94506], [7.60771, 43.95772], [7.65266, 43.9763], [7.66848, 43.99943], [7.6597, 44.03009], [7.72508, 44.07578], [7.66878, 44.12795], [7.68694, 44.17487], [7.63245, 44.17877], [7.62155, 44.14881], [7.36364, 44.11882], [7.34547, 44.14359], [7.27827, 44.1462], [7.16929, 44.20352], [7.00764, 44.23736], [6.98221, 44.28289], [6.89171, 44.36637], [6.88784, 44.42043], [6.94504, 44.43112], [6.86233, 44.49834], [6.85507, 44.53072], [6.96042, 44.62129], [6.95133, 44.66264], [7.00582, 44.69364], [7.07484, 44.68073], [7.00401, 44.78782], [7.02217, 44.82519], [6.93499, 44.8664], [6.90774, 44.84322], [6.75518, 44.89915], [6.74519, 44.93661], [6.74791, 45.01939], [6.66981, 45.02324], [6.62803, 45.11175], [6.7697, 45.16044], [6.85144, 45.13226], [6.96706, 45.20841], [7.07074, 45.21228], [7.13115, 45.25386], [7.10572, 45.32924], [7.18019, 45.40071], [7.00037, 45.509], [6.98948, 45.63869], [6.80785, 45.71864], [6.80785, 45.83265], [6.95315, 45.85163], [7.04151, 45.92435], [7.00946, 45.9944], [6.93862, 46.06502], [6.87868, 46.03855], [6.89321, 46.12548], [6.78968, 46.14058], [6.86052, 46.28512], [6.77152, 46.34784], [6.8024, 46.39171], [6.82312, 46.42661], [6.53358, 46.45431], [6.25432, 46.3632], [6.21981, 46.31304], [6.24826, 46.30175], [6.25137, 46.29014], [6.23775, 46.27822], [6.24952, 46.26255], [6.26749, 46.24745], [6.29474, 46.26221], [6.31041, 46.24417], [6.29663, 46.22688], [6.27694, 46.21566], [6.26007, 46.21165], [6.24821, 46.20531], [6.23913, 46.20511], [6.23544, 46.20714], [6.22175, 46.20045], [6.22222, 46.19888], [6.21844, 46.19837], [6.21603, 46.19507], [6.21273, 46.19409], [6.21114, 46.1927], [6.20539, 46.19163], [6.19807, 46.18369], [6.19552, 46.18401], [6.18707, 46.17999], [6.18871, 46.16644], [6.18116, 46.16187], [6.15305, 46.15194], [6.13397, 46.1406], [6.09926, 46.14373], [6.09199, 46.15191], [6.07491, 46.14879], [6.05203, 46.15191], [6.04564, 46.14031], [6.03614, 46.13712], [6.01791, 46.14228], [5.9871, 46.14499], [5.97893, 46.13303], [5.95781, 46.12925], [5.9641, 46.14412], [5.97508, 46.15863], [5.98188, 46.17392], [5.98846, 46.17046], [5.99573, 46.18587], [5.96515, 46.19638], [5.97542, 46.21525], [6.02461, 46.23313], [6.03342, 46.2383], [6.04602, 46.23127], [6.05029, 46.23518], [6.0633, 46.24583], [6.07072, 46.24085], [6.08563, 46.24651], [6.10071, 46.23772], [6.12446, 46.25059], [6.11926, 46.2634], [6.1013, 46.28512], [6.11697, 46.29547], [6.1198, 46.31157], [6.13876, 46.33844], [6.15738, 46.3491], [6.16987, 46.36759], [6.15985, 46.37721], [6.15016, 46.3778], [6.09926, 46.40768], [6.06407, 46.41676], [6.08427, 46.44305], [6.07269, 46.46244], [6.1567, 46.54402], [6.11084, 46.57649], [6.27135, 46.68251], [6.38351, 46.73171], [6.45209, 46.77502], [6.43216, 46.80336], [6.46456, 46.88865], [6.43341, 46.92703], [6.71531, 47.0494], [6.68823, 47.06616], [6.76788, 47.1208], [6.8489, 47.15933], [6.9508, 47.24338], [6.95108, 47.26428], [6.94316, 47.28747], [7.05305, 47.33304], [7.0564, 47.35134], [7.03125, 47.36996], [6.87959, 47.35335], [6.88542, 47.37262], [6.93744, 47.40714], [6.93953, 47.43388], [7.0024, 47.45264], [6.98425, 47.49432], [7.0231, 47.50522], [7.07425, 47.48863], [7.12781, 47.50371], [7.16249, 47.49025], [7.19583, 47.49455], [7.17026, 47.44312], [7.24669, 47.4205], [7.33526, 47.44186], [7.35603, 47.43432], [7.40308, 47.43638], [7.43088, 47.45846], [7.4462, 47.46264], [7.4583, 47.47216], [7.42923, 47.48628], [7.43356, 47.49712], [7.47534, 47.47932], [7.51076, 47.49651], [7.49804, 47.51798], [7.5229, 47.51644], [7.53199, 47.5284], [7.51904, 47.53515], [7.50588, 47.52856], [7.49691, 47.53821], [7.50873, 47.54546], [7.51723, 47.54578], [7.52831, 47.55347], [7.53634, 47.55553], [7.55652, 47.56779], [7.55689, 47.57232], [7.56548, 47.57617], [7.56684, 47.57785], [7.58386, 47.57536], [7.58945, 47.59017], [7.59301, 47.60058], [7.58851, 47.60794], [7.57423, 47.61628], [7.5591, 47.63849], [7.53384, 47.65115], [7.52067, 47.66437], [7.51915, 47.68335], [7.51266, 47.70197], [7.53722, 47.71635], [7.54761, 47.72912], [7.52921, 47.77747], [7.55673, 47.87371], [7.62302, 47.97898], [7.56966, 48.03265], [7.57137, 48.12292], [7.6648, 48.22219], [7.69022, 48.30018], [7.74562, 48.32736], [7.73109, 48.39192], [7.76833, 48.48945], [7.80647, 48.51239], [7.80167, 48.54758], [7.80057, 48.5857], [7.84098, 48.64217], [7.89002, 48.66317], [7.96812, 48.72491], [7.96994, 48.75606], [8.01534, 48.76085], [8.0326, 48.79017], [8.06802, 48.78957], [8.10253, 48.81829], [8.12813, 48.87985], [8.19989, 48.95825], [8.20031, 48.95856], [8.22604, 48.97352], [8.14189, 48.97833], [7.97783, 49.03161], [7.93641, 49.05544], [7.86386, 49.03499], [7.79557, 49.06583], [7.75948, 49.04562], [7.63618, 49.05428], [7.62575, 49.07654], [7.56416, 49.08136], [7.53012, 49.09818], [7.49172, 49.13915], [7.49473, 49.17], [7.44455, 49.16765], [7.44052, 49.18354], [7.3662, 49.17308], [7.35995, 49.14399], [7.3195, 49.14231], [7.29514, 49.11426], [7.23473, 49.12971], [7.1593, 49.1204], [7.1358, 49.1282], [7.12504, 49.14253], [7.10384, 49.13787], [7.10715, 49.15631], [7.07859, 49.15031], [7.09007, 49.13094], [7.07162, 49.1255], [7.06642, 49.11415], [7.05548, 49.11185], [7.04843, 49.11422], [7.04409, 49.12123], [7.04662, 49.13724], [7.03178, 49.15734], [7.0274, 49.17042], [7.03459, 49.19096], [7.01318, 49.19018], [6.97273, 49.2099], [6.95963, 49.203], [6.94028, 49.21641], [6.93831, 49.2223], [6.91875, 49.22261], [6.89298, 49.20863], [6.85939, 49.22376], [6.83555, 49.21249], [6.85119, 49.20038], [6.85016, 49.19354], [6.86225, 49.18185], [6.84703, 49.15734], [6.83385, 49.15162], [6.78265, 49.16793], [6.73765, 49.16375], [6.71137, 49.18808], [6.73256, 49.20486], [6.71843, 49.2208], [6.69274, 49.21661], [6.66583, 49.28065], [6.60186, 49.31055], [6.572, 49.35027], [6.58807, 49.35358], [6.60091, 49.36864], [6.533, 49.40748], [6.55404, 49.42464], [6.42432, 49.47683], [6.40274, 49.46546], [6.39168, 49.4667], [6.38352, 49.46463], [6.36778, 49.46937], [6.3687, 49.4593], [6.28818, 49.48465], [6.27875, 49.503], [6.25029, 49.50609], [6.2409, 49.51408], [6.19543, 49.50536], [6.17386, 49.50934], [6.15366, 49.50226], [6.16115, 49.49297], [6.14321, 49.48796], [6.12814, 49.49365], [6.12346, 49.4735], [6.10325, 49.4707], [6.09845, 49.46351], [6.10072, 49.45268], [6.08373, 49.45594], [6.07887, 49.46399], [6.05553, 49.46663], [6.04176, 49.44801], [6.02743, 49.44845], [6.02648, 49.45451], [5.97693, 49.45513], [5.96876, 49.49053], [5.94224, 49.49608], [5.94128, 49.50034], [5.86571, 49.50015], [5.83389, 49.52152], [5.83467, 49.52717], [5.84466, 49.53027], [5.83648, 49.5425], [5.81664, 49.53775], [5.80871, 49.5425], [5.81838, 49.54777], [5.79195, 49.55228], [5.77435, 49.56298], [5.7577, 49.55915], [5.75649, 49.54321], [5.64505, 49.55146], [5.60909, 49.51228], [5.55001, 49.52729], [5.46541, 49.49825], [5.46734, 49.52648], [5.43713, 49.5707], [5.3974, 49.61596], [5.34837, 49.62889], [5.33851, 49.61599], [5.3137, 49.61225], [5.30214, 49.63055], [5.33039, 49.6555], [5.31465, 49.66846], [5.26232, 49.69456], [5.14545, 49.70287], [5.09249, 49.76193], [4.96714, 49.79872], [4.85464, 49.78995], [4.86965, 49.82271], [4.85134, 49.86457], [4.88529, 49.9236], [4.78827, 49.95609], [4.8382, 50.06738], [4.88602, 50.15182], [4.83279, 50.15331], [4.82438, 50.16878], [4.75237, 50.11314], [4.70064, 50.09384], [4.68695, 49.99685], [4.5414, 49.96911], [4.51098, 49.94659], [4.43488, 49.94122], [4.35051, 49.95315], [4.31963, 49.97043], [4.20532, 49.95803], [4.14239, 49.98034], [4.13508, 50.01976], [4.16294, 50.04719], [4.23101, 50.06945], [4.20147, 50.13535], [4.13561, 50.13078], [4.16014, 50.19239], [4.15524, 50.21103], [4.21945, 50.25539], [4.20651, 50.27333], [4.17861, 50.27443], [4.17347, 50.28838], [4.15524, 50.2833], [4.16808, 50.25786], [4.13665, 50.25609], [4.11954, 50.30425], [4.10957, 50.30234], [4.10237, 50.31247], [4.0689, 50.3254], [4.0268, 50.35793], [3.96771, 50.34989], [3.90781, 50.32814], [3.84314, 50.35219], [3.73911, 50.34809], [3.70987, 50.3191], [3.71009, 50.30305], [3.66976, 50.34563], [3.65709, 50.36873], [3.67262, 50.38663], [3.67494, 50.40239], [3.66153, 50.45165], [3.64426, 50.46275], [3.61014, 50.49568], [3.58361, 50.49049], [3.5683, 50.50192], [3.49509, 50.48885], [3.51564, 50.5256], [3.47385, 50.53397], [3.44629, 50.51009], [3.37693, 50.49538], [3.28575, 50.52724], [3.2729, 50.60718], [3.23951, 50.6585], [3.264, 50.67668], [3.2536, 50.68977], [3.26141, 50.69151], [3.26063, 50.70086], [3.24593, 50.71389], [3.22042, 50.71019], [3.20845, 50.71662], [3.19017, 50.72569], [3.20064, 50.73547], [3.18811, 50.74025], [3.18339, 50.74981], [3.16476, 50.76843], [3.15017, 50.79031], [3.1257, 50.78603], [3.11987, 50.79188], [3.11206, 50.79416], [3.10614, 50.78303], [3.09163, 50.77717], [3.04314, 50.77674], [3.00537, 50.76588], [2.96778, 50.75242], [2.95019, 50.75138], [2.90873, 50.702], [2.91036, 50.6939], [2.90069, 50.69263], [2.88504, 50.70656], [2.87937, 50.70298], [2.86985, 50.7033], [2.8483, 50.72276], [2.81056, 50.71773], [2.71165, 50.81295], [2.63331, 50.81457], [2.59093, 50.91751], [2.63074, 50.94746], [2.57551, 51.00326], [2.55904, 51.07014]], [[1.99838, 42.44682], [1.98378, 42.44697], [1.96125, 42.45364], [1.95606, 42.45785], [1.96215, 42.47854], [1.97003, 42.48081], [1.97227, 42.48487], [1.97697, 42.48568], [1.98022, 42.49569], [1.98916, 42.49351], [1.99766, 42.4858], [1.98579, 42.47486], [1.99216, 42.46208], [2.01564, 42.45171], [1.99838, 42.44682]]]] } },
20587     { type: "Feature", properties: { iso1A2: "GA", iso1A3: "GAB", iso1N3: "266", wikidata: "Q1000", nameEn: "Gabon", groups: ["017", "202", "002", "UN"], callingCodes: ["241"] }, geometry: { type: "MultiPolygon", coordinates: [[[[13.29457, 2.16106], [13.28534, 2.25716], [11.37116, 2.29975], [11.3561, 2.17217], [11.35307, 1.00251], [9.79648, 1.0019], [9.75065, 1.06753], [9.66433, 1.06723], [7.24416, -0.64092], [10.75913, -4.39519], [11.12647, -3.94169], [11.22301, -3.69888], [11.48764, -3.51089], [11.57949, -3.52798], [11.68608, -3.68942], [11.87083, -3.71571], [11.92719, -3.62768], [11.8318, -3.5812], [11.96554, -3.30267], [11.70227, -3.17465], [11.70558, -3.0773], [11.80365, -3.00424], [11.64798, -2.81146], [11.5359, -2.85654], [11.64487, -2.61865], [11.57637, -2.33379], [11.74605, -2.39936], [11.96866, -2.33559], [12.04895, -2.41704], [12.47925, -2.32626], [12.44656, -1.92025], [12.61312, -1.8129], [12.82172, -1.91091], [13.02759, -2.33098], [13.47977, -2.43224], [13.75884, -2.09293], [13.92073, -2.35581], [13.85846, -2.46935], [14.10442, -2.49268], [14.23829, -2.33715], [14.16202, -2.23916], [14.23518, -2.15671], [14.25932, -1.97624], [14.41838, -1.89412], [14.52569, -0.57818], [14.41887, -0.44799], [14.2165, -0.38261], [14.06862, -0.20826], [13.90632, -0.2287], [13.88648, 0.26652], [14.10909, 0.58563], [14.26066, 0.57255], [14.48179, 0.9152], [14.25186, 1.39842], [13.89582, 1.4261], [13.15519, 1.23368], [13.25447, 1.32339], [13.13461, 1.57238], [13.29457, 2.16106]]]] } },
20588     { type: "Feature", properties: { iso1A2: "GB", iso1A3: "GBR", iso1N3: "826", wikidata: "Q145", ccTLD: ".uk", nameEn: "United Kingdom", aliases: ["UK"] }, geometry: null },
20589     { type: "Feature", properties: { iso1A2: "GD", iso1A3: "GRD", iso1N3: "308", wikidata: "Q769", nameEn: "Grenada", aliases: ["WG"], groups: ["029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", callingCodes: ["1 473"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-62.64026, 12.69984], [-61.77886, 11.36496], [-59.94058, 12.34011], [-62.64026, 12.69984]]]] } },
20590     { type: "Feature", properties: { iso1A2: "GE", iso1A3: "GEO", iso1N3: "268", wikidata: "Q230", nameEn: "Georgia", groups: ["145", "142", "UN"], callingCodes: ["995"] }, geometry: { type: "MultiPolygon", coordinates: [[[[46.42738, 41.91323], [45.61676, 42.20768], [45.78692, 42.48358], [45.36501, 42.55268], [45.15318, 42.70598], [44.88754, 42.74934], [44.80941, 42.61277], [44.70002, 42.74679], [44.54202, 42.75699], [43.95517, 42.55396], [43.73119, 42.62043], [43.81453, 42.74297], [43.0419, 43.02413], [43.03322, 43.08883], [42.75889, 43.19651], [42.66667, 43.13917], [42.40563, 43.23226], [41.64935, 43.22331], [40.65957, 43.56212], [40.10657, 43.57344], [40.04445, 43.47776], [40.03312, 43.44262], [40.01007, 43.42411], [40.01552, 43.42025], [40.00853, 43.40578], [40.0078, 43.38551], [39.81147, 43.06294], [40.89217, 41.72528], [41.54366, 41.52185], [41.7148, 41.4932], [41.7124, 41.47417], [41.81939, 41.43621], [41.95134, 41.52466], [42.26387, 41.49346], [42.51772, 41.43606], [42.59202, 41.58183], [42.72794, 41.59714], [42.84471, 41.58912], [42.78995, 41.50126], [42.84899, 41.47265], [42.8785, 41.50516], [43.02956, 41.37891], [43.21707, 41.30331], [43.13373, 41.25503], [43.1945, 41.25242], [43.23096, 41.17536], [43.36118, 41.2028], [43.44973, 41.17666], [43.4717, 41.12611], [43.67712, 41.13398], [43.74717, 41.1117], [43.84835, 41.16329], [44.16591, 41.19141], [44.18148, 41.24644], [44.32139, 41.2079], [44.34337, 41.20312], [44.34417, 41.2382], [44.46791, 41.18204], [44.59322, 41.1933], [44.61462, 41.24018], [44.72814, 41.20338], [44.82084, 41.21513], [44.87887, 41.20195], [44.89911, 41.21366], [44.84358, 41.23088], [44.81749, 41.23488], [44.80053, 41.25949], [44.81437, 41.30371], [44.93493, 41.25685], [45.0133, 41.29747], [45.09867, 41.34065], [45.1797, 41.42231], [45.26285, 41.46433], [45.31352, 41.47168], [45.4006, 41.42402], [45.45973, 41.45898], [45.68389, 41.3539], [45.71035, 41.36208], [45.75705, 41.35157], [45.69946, 41.29545], [45.80842, 41.2229], [45.95786, 41.17956], [46.13221, 41.19479], [46.27698, 41.19011], [46.37661, 41.10805], [46.456, 41.09984], [46.48558, 41.0576], [46.55096, 41.1104], [46.63969, 41.09515], [46.66148, 41.20533], [46.72375, 41.28609], [46.63658, 41.37727], [46.4669, 41.43331], [46.40307, 41.48464], [46.33925, 41.4963], [46.29794, 41.5724], [46.34126, 41.57454], [46.34039, 41.5947], [46.3253, 41.60912], [46.28182, 41.60089], [46.26531, 41.63339], [46.24429, 41.59883], [46.19759, 41.62327], [46.17891, 41.72094], [46.20538, 41.77205], [46.23962, 41.75811], [46.30863, 41.79133], [46.3984, 41.84399], [46.42738, 41.91323]]]] } },
20591     { type: "Feature", properties: { iso1A2: "GF", iso1A3: "GUF", iso1N3: "254", wikidata: "Q3769", nameEn: "French Guiana", country: "FR", groups: ["Q3320166", "EU", "005", "419", "019", "UN"], callingCodes: ["594"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-51.35485, 4.8383], [-53.7094, 6.2264], [-54.01074, 5.68785], [-54.01877, 5.52789], [-54.26916, 5.26909], [-54.4717, 4.91964], [-54.38444, 4.13222], [-54.19367, 3.84387], [-54.05128, 3.63557], [-53.98914, 3.627], [-53.9849, 3.58697], [-54.28534, 2.67798], [-54.42864, 2.42442], [-54.6084, 2.32856], [-54.16286, 2.10779], [-53.78743, 2.34412], [-52.96539, 2.1881], [-52.6906, 2.37298], [-52.31787, 3.17896], [-51.85573, 3.83427], [-51.82312, 3.85825], [-51.79599, 3.89336], [-51.61983, 4.14596], [-51.63798, 4.51394], [-51.35485, 4.8383]]]] } },
20592     { type: "Feature", properties: { iso1A2: "GG", iso1A3: "GGY", iso1N3: "831", wikidata: "Q25230", nameEn: "Bailiwick of Guernsey", country: "GB" }, geometry: null },
20593     { type: "Feature", properties: { iso1A2: "GH", iso1A3: "GHA", iso1N3: "288", wikidata: "Q117", nameEn: "Ghana", groups: ["011", "202", "002", "UN"], callingCodes: ["233"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-0.13493, 11.14075], [-0.27374, 11.17157], [-0.28566, 11.12713], [-0.35955, 11.07801], [-0.38219, 11.12596], [-0.42391, 11.11661], [-0.44298, 11.04292], [-0.61937, 10.91305], [-0.67143, 10.99811], [-2.83373, 11.0067], [-2.94232, 10.64281], [-2.83108, 10.40252], [-2.74174, 9.83172], [-2.76534, 9.56589], [-2.68802, 9.49343], [-2.69814, 9.22717], [-2.77799, 9.04949], [-2.66357, 9.01771], [-2.58243, 8.7789], [-2.49037, 8.20872], [-2.62901, 8.11495], [-2.61232, 8.02645], [-2.67787, 8.02055], [-2.74819, 7.92613], [-2.78395, 7.94974], [-2.79467, 7.86002], [-2.92339, 7.60847], [-2.97822, 7.27165], [-2.95438, 7.23737], [-3.23327, 6.81744], [-3.21954, 6.74407], [-3.25999, 6.62521], [-3.01896, 5.71697], [-2.95323, 5.71865], [-2.96671, 5.6415], [-2.93132, 5.62137], [-2.85378, 5.65156], [-2.76614, 5.60963], [-2.72737, 5.34789], [-2.77625, 5.34621], [-2.73074, 5.1364], [-2.75502, 5.10657], [-2.95261, 5.12477], [-2.96554, 5.10397], [-3.063, 5.13665], [-3.11073, 5.12675], [-3.10675, 5.08515], [-3.34019, 4.17519], [1.07031, 5.15655], [1.27574, 5.93551], [1.19771, 6.11522], [1.19966, 6.17069], [1.09187, 6.17074], [1.05969, 6.22998], [1.03108, 6.24064], [0.99652, 6.33779], [0.89283, 6.33779], [0.71048, 6.53083], [0.74862, 6.56517], [0.63659, 6.63857], [0.6497, 6.73682], [0.58176, 6.76049], [0.57406, 6.80348], [0.52853, 6.82921], [0.56508, 6.92971], [0.52098, 6.94391], [0.52217, 6.9723], [0.59606, 7.01252], [0.65327, 7.31643], [0.62943, 7.41099], [0.57223, 7.39326], [0.52455, 7.45354], [0.51979, 7.58706], [0.58295, 7.62368], [0.62943, 7.85751], [0.58891, 8.12779], [0.6056, 8.13959], [0.61156, 8.18324], [0.5913, 8.19622], [0.63897, 8.25873], [0.73432, 8.29529], [0.64731, 8.48866], [0.47211, 8.59945], [0.37319, 8.75262], [0.52455, 8.87746], [0.45424, 9.04581], [0.56388, 9.40697], [0.49118, 9.48339], [0.36485, 9.49749], [0.33148, 9.44812], [0.25758, 9.42696], [0.2254, 9.47869], [0.31241, 9.50337], [0.30406, 9.521], [0.2409, 9.52335], [0.23851, 9.57389], [0.38153, 9.58682], [0.36008, 9.6256], [0.29334, 9.59387], [0.26712, 9.66437], [0.28261, 9.69022], [0.32313, 9.6491], [0.34816, 9.66907], [0.34816, 9.71607], [0.32075, 9.72781], [0.36366, 10.03309], [0.41252, 10.02018], [0.41371, 10.06361], [0.35293, 10.09412], [0.39584, 10.31112], [0.33028, 10.30408], [0.29453, 10.41546], [0.18846, 10.4096], [0.12886, 10.53149], [-0.05945, 10.63458], [-0.09141, 10.7147], [-0.07327, 10.71845], [-0.07183, 10.76794], [-0.0228, 10.81916], [-0.02685, 10.8783], [-908e-5, 10.91644], [-63e-4, 10.96417], [0.03355, 10.9807], [0.02395, 11.06229], [342e-5, 11.08317], [-514e-5, 11.10763], [-0.0275, 11.11202], [-0.05733, 11.08628], [-0.14462, 11.10811], [-0.13493, 11.14075]]]] } },
20594     { type: "Feature", properties: { iso1A2: "GI", iso1A3: "GIB", iso1N3: "292", wikidata: "Q1410", nameEn: "Gibraltar", country: "GB", groups: ["Q12837", "BOTS", "039", "150", "UN"], callingCodes: ["350"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-5.34064, 36.03744], [-5.27801, 36.14942], [-5.33822, 36.15272], [-5.34536, 36.15501], [-5.40526, 36.15488], [-5.34064, 36.03744]]]] } },
20595     { type: "Feature", properties: { iso1A2: "GL", iso1A3: "GRL", iso1N3: "304", wikidata: "Q223", nameEn: "Greenland", country: "DK", groups: ["Q1451600", "021", "003", "019", "UN"], callingCodes: ["299"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-49.33696, 84.57952], [-68.21821, 80.48551], [-77.52957, 77.23408], [-46.37635, 57.3249], [-9.68082, 72.73731], [-5.7106, 84.28058], [-49.33696, 84.57952]]]] } },
20596     { type: "Feature", properties: { iso1A2: "GM", iso1A3: "GMB", iso1N3: "270", wikidata: "Q1005", nameEn: "The Gambia", groups: ["011", "202", "002", "UN"], callingCodes: ["220"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-15.14917, 13.57989], [-14.36795, 13.23033], [-13.79409, 13.34472], [-13.8955, 13.59126], [-14.34721, 13.46578], [-14.93719, 13.80173], [-15.36504, 13.79313], [-15.47902, 13.58758], [-17.43598, 13.59273], [-17.43966, 13.04579], [-16.74676, 13.06025], [-16.69343, 13.16791], [-15.80355, 13.16729], [-15.80478, 13.34832], [-15.26908, 13.37768], [-15.14917, 13.57989]]]] } },
20597     { type: "Feature", properties: { iso1A2: "GN", iso1A3: "GIN", iso1N3: "324", wikidata: "Q1006", nameEn: "Guinea", groups: ["011", "202", "002", "UN"], callingCodes: ["224"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-11.37536, 12.40788], [-11.46267, 12.44559], [-11.91331, 12.42008], [-12.35415, 12.32758], [-12.87336, 12.51892], [-13.06603, 12.49342], [-13.05296, 12.64003], [-13.70523, 12.68013], [-13.7039, 12.60313], [-13.65089, 12.49515], [-13.64168, 12.42764], [-13.70851, 12.24978], [-13.92745, 12.24077], [-13.94589, 12.16869], [-13.7039, 12.00869], [-13.7039, 11.70195], [-14.09799, 11.63649], [-14.26623, 11.67486], [-14.31513, 11.60713], [-14.51173, 11.49708], [-14.66677, 11.51188], [-14.77786, 11.36323], [-14.95993, 10.99244], [-15.07174, 10.89557], [-15.96748, 10.162], [-14.36218, 8.64107], [-13.29911, 9.04245], [-13.18586, 9.0925], [-13.08953, 9.0409], [-12.94095, 9.26335], [-12.76788, 9.3133], [-12.47254, 9.86834], [-12.24262, 9.92386], [-12.12634, 9.87203], [-11.91023, 9.93927], [-11.89624, 9.99763], [-11.2118, 10.00098], [-10.6534, 9.29919], [-10.74484, 9.07998], [-10.5783, 9.06386], [-10.56197, 8.81225], [-10.47707, 8.67669], [-10.61422, 8.5314], [-10.70565, 8.29235], [-10.63934, 8.35326], [-10.54891, 8.31174], [-10.37257, 8.48941], [-10.27575, 8.48711], [-10.203, 8.47991], [-10.14579, 8.52665], [-10.05375, 8.50697], [-10.05873, 8.42578], [-9.77763, 8.54633], [-9.47415, 8.35195], [-9.50898, 8.18455], [-9.41445, 8.02448], [-9.44928, 7.9284], [-9.35724, 7.74111], [-9.37465, 7.62032], [-9.48161, 7.37122], [-9.41943, 7.41809], [-9.305, 7.42056], [-9.20798, 7.38109], [-9.18311, 7.30461], [-9.09107, 7.1985], [-8.93435, 7.2824], [-8.85724, 7.26019], [-8.8448, 7.35149], [-8.72789, 7.51429], [-8.67814, 7.69428], [-8.55874, 7.70167], [-8.55874, 7.62525], [-8.47114, 7.55676], [-8.4003, 7.6285], [-8.21374, 7.54466], [-8.09931, 7.78626], [-8.13414, 7.87991], [-8.06449, 8.04989], [-7.94695, 8.00925], [-7.99919, 8.11023], [-7.98675, 8.20134], [-8.062, 8.16071], [-8.2411, 8.24196], [-8.22991, 8.48438], [-7.92518, 8.50652], [-7.65653, 8.36873], [-7.69882, 8.66148], [-7.95503, 8.81146], [-7.92518, 8.99332], [-7.73862, 9.08422], [-7.90777, 9.20456], [-7.85056, 9.41812], [-8.03463, 9.39604], [-8.14657, 9.55062], [-8.09434, 9.86936], [-8.15652, 9.94288], [-8.11921, 10.04577], [-8.01225, 10.1021], [-7.97971, 10.17117], [-7.9578, 10.2703], [-8.10207, 10.44649], [-8.22711, 10.41722], [-8.32614, 10.69273], [-8.2667, 10.91762], [-8.35083, 11.06234], [-8.66923, 10.99397], [-8.40058, 11.37466], [-8.80854, 11.66715], [-8.94784, 12.34842], [-9.13689, 12.50875], [-9.38067, 12.48446], [-9.32097, 12.29009], [-9.63938, 12.18312], [-9.714, 12.0226], [-10.30604, 12.24634], [-10.71897, 11.91552], [-10.80355, 12.1053], [-10.99758, 12.24634], [-11.24136, 12.01286], [-11.50006, 12.17826], [-11.37536, 12.40788]]]] } },
20598     { type: "Feature", properties: { iso1A2: "GP", iso1A3: "GLP", iso1N3: "312", wikidata: "Q17012", nameEn: "Guadeloupe", country: "FR", groups: ["Q3320166", "EU", "029", "003", "419", "019", "UN"], callingCodes: ["590"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-60.03183, 16.1129], [-61.60296, 16.73066], [-63.00549, 15.26166], [-60.03183, 16.1129]]]] } },
20599     { type: "Feature", properties: { iso1A2: "GQ", iso1A3: "GNQ", iso1N3: "226", wikidata: "Q983", nameEn: "Equatorial Guinea", groups: ["017", "202", "002", "UN"], callingCodes: ["240"] }, geometry: { type: "MultiPolygon", coordinates: [[[[9.22018, 3.72052], [8.34397, 4.30689], [7.71762, 0.6674], [3.35016, -3.29031], [9.66433, 1.06723], [9.75065, 1.06753], [9.79648, 1.0019], [11.35307, 1.00251], [11.3561, 2.17217], [9.991, 2.16561], [9.90749, 2.20049], [9.89012, 2.20457], [9.84716, 2.24676], [9.83238, 2.29079], [9.83754, 2.32428], [9.82123, 2.35097], [9.81162, 2.33797], [9.22018, 3.72052]]]] } },
20600     { type: "Feature", properties: { iso1A2: "GR", iso1A3: "GRC", iso1N3: "300", wikidata: "Q41", nameEn: "Greece", aliases: ["EL"], groups: ["EU", "039", "150", "UN"], callingCodes: ["30"] }, geometry: { type: "MultiPolygon", coordinates: [[[[26.03489, 40.73051], [26.0754, 40.72772], [26.08638, 40.73214], [26.12495, 40.74283], [26.12854, 40.77339], [26.15685, 40.80709], [26.21351, 40.83298], [26.20856, 40.86048], [26.26169, 40.9168], [26.29441, 40.89119], [26.28623, 40.93005], [26.32259, 40.94042], [26.35894, 40.94292], [26.33297, 40.98388], [26.3606, 41.02027], [26.31928, 41.07386], [26.32259, 41.24929], [26.39861, 41.25053], [26.5209, 41.33993], [26.5837, 41.32131], [26.62997, 41.34613], [26.61767, 41.42281], [26.59742, 41.48058], [26.59196, 41.60491], [26.5209, 41.62592], [26.47958, 41.67037], [26.35957, 41.71149], [26.30255, 41.70925], [26.2654, 41.71544], [26.22888, 41.74139], [26.21325, 41.73223], [26.16841, 41.74858], [26.06148, 41.70345], [26.07083, 41.64584], [26.15146, 41.60828], [26.14328, 41.55496], [26.17951, 41.55409], [26.176, 41.50072], [26.14796, 41.47533], [26.20288, 41.43943], [26.16548, 41.42278], [26.12926, 41.35878], [25.87919, 41.30526], [25.8266, 41.34563], [25.70507, 41.29209], [25.66183, 41.31316], [25.61042, 41.30614], [25.55082, 41.31667], [25.52394, 41.2798], [25.48187, 41.28506], [25.28322, 41.23411], [25.11611, 41.34212], [24.942, 41.38685], [24.90928, 41.40876], [24.86136, 41.39298], [24.82514, 41.4035], [24.8041, 41.34913], [24.71529, 41.41928], [24.61129, 41.42278], [24.52599, 41.56808], [24.30513, 41.51297], [24.27124, 41.57682], [24.18126, 41.51735], [24.10063, 41.54796], [24.06323, 41.53222], [24.06908, 41.46132], [23.96975, 41.44118], [23.91483, 41.47971], [23.89613, 41.45257], [23.80148, 41.43943], [23.76525, 41.40175], [23.67644, 41.41139], [23.63203, 41.37632], [23.52453, 41.40262], [23.40416, 41.39999], [23.33639, 41.36317], [23.31301, 41.40525], [23.22771, 41.37106], [23.21953, 41.33773], [23.1833, 41.31755], [22.93334, 41.34104], [22.81199, 41.3398], [22.76408, 41.32225], [22.74538, 41.16321], [22.71266, 41.13945], [22.65306, 41.18168], [22.62852, 41.14385], [22.58295, 41.11568], [22.5549, 41.13065], [22.42285, 41.11921], [22.26744, 41.16409], [22.17629, 41.15969], [22.1424, 41.12449], [22.06527, 41.15617], [21.90869, 41.09191], [21.91102, 41.04786], [21.7556, 40.92525], [21.69601, 40.9429], [21.57448, 40.86076], [21.53007, 40.90759], [21.41555, 40.9173], [21.35595, 40.87578], [21.25779, 40.86165], [21.21105, 40.8855], [21.15262, 40.85546], [20.97887, 40.85475], [20.98396, 40.79109], [20.95752, 40.76982], [20.98134, 40.76046], [21.05833, 40.66586], [21.03932, 40.56299], [20.96908, 40.51526], [20.94925, 40.46625], [20.83688, 40.47882], [20.7906, 40.42726], [20.78234, 40.35803], [20.71789, 40.27739], [20.67162, 40.09433], [20.62566, 40.0897], [20.61081, 40.07866], [20.55593, 40.06524], [20.51297, 40.08168], [20.48487, 40.06271], [20.42373, 40.06777], [20.37911, 39.99058], [20.31135, 39.99438], [20.41546, 39.82832], [20.41475, 39.81437], [20.38572, 39.78516], [20.30804, 39.81563], [20.29152, 39.80421], [20.31961, 39.72799], [20.27412, 39.69884], [20.22707, 39.67459], [20.22376, 39.64532], [20.15988, 39.652], [20.12956, 39.65805], [20.05189, 39.69112], [20.00957, 39.69227], [19.98042, 39.6504], [19.92466, 39.69533], [19.97622, 39.78684], [19.95905, 39.82857], [19.0384, 40.35325], [19.20409, 39.7532], [22.5213, 33.45682], [29.73302, 35.92555], [29.69611, 36.10365], [29.61805, 36.14179], [29.61002, 36.1731], [29.48192, 36.18377], [29.30783, 36.01033], [28.23708, 36.56812], [27.95037, 36.46155], [27.89482, 36.69898], [27.46117, 36.53789], [27.24613, 36.71622], [27.45627, 36.9008], [27.20312, 36.94571], [27.14757, 37.32], [26.95583, 37.64989], [26.99377, 37.69034], [27.16428, 37.72343], [27.05537, 37.9131], [26.21136, 38.17558], [26.24183, 38.44695], [26.32173, 38.48731], [26.21136, 38.65436], [26.61814, 38.81372], [26.70773, 39.0312], [26.43357, 39.43096], [25.94257, 39.39358], [25.61285, 40.17161], [26.04292, 40.3958], [25.94795, 40.72797], [26.03489, 40.73051]]]] } },
20601     { type: "Feature", properties: { iso1A2: "GS", iso1A3: "SGS", iso1N3: "239", wikidata: "Q35086", nameEn: "South Georgia and South Sandwich Islands", country: "GB", groups: ["BOTS", "005", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["500"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-35.26394, -43.68272], [-53.39656, -59.87088], [-22.31757, -59.85974], [-35.26394, -43.68272]]]] } },
20602     { type: "Feature", properties: { iso1A2: "GT", iso1A3: "GTM", iso1N3: "320", wikidata: "Q774", nameEn: "Guatemala", groups: ["013", "003", "419", "019", "UN"], callingCodes: ["502"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-89.14985, 17.81563], [-90.98678, 17.81655], [-90.99199, 17.25192], [-91.43809, 17.25373], [-91.04436, 16.92175], [-90.69064, 16.70697], [-90.61212, 16.49832], [-90.40499, 16.40524], [-90.44567, 16.07573], [-91.73182, 16.07371], [-92.20983, 15.26077], [-92.0621, 15.07406], [-92.1454, 14.98143], [-92.1423, 14.88647], [-92.18161, 14.84147], [-92.1454, 14.6804], [-92.2261, 14.53423], [-92.37213, 14.39277], [-90.55276, 12.8866], [-90.11344, 13.73679], [-90.10505, 13.85104], [-89.88937, 14.0396], [-89.81807, 14.07073], [-89.76103, 14.02923], [-89.73251, 14.04133], [-89.75569, 14.07073], [-89.70756, 14.1537], [-89.61844, 14.21937], [-89.52397, 14.22628], [-89.50614, 14.26084], [-89.58814, 14.33165], [-89.57441, 14.41637], [-89.39028, 14.44561], [-89.34776, 14.43013], [-89.35189, 14.47553], [-89.23719, 14.58046], [-89.15653, 14.57802], [-89.13132, 14.71582], [-89.23467, 14.85596], [-89.15149, 14.97775], [-89.18048, 14.99967], [-89.15149, 15.07392], [-88.97343, 15.14039], [-88.32467, 15.63665], [-88.31459, 15.66942], [-88.24022, 15.69247], [-88.22552, 15.72294], [-88.20359, 16.03858], [-88.40779, 16.09624], [-88.95358, 15.88698], [-89.02415, 15.9063], [-89.17418, 15.90898], [-89.22683, 15.88619], [-89.15025, 17.04813], [-89.14985, 17.81563]]]] } },
20603     { type: "Feature", properties: { iso1A2: "GU", iso1A3: "GUM", iso1N3: "316", wikidata: "Q16635", nameEn: "Guam", aliases: ["US-GU"], country: "US", groups: ["Q1352230", "Q153732", "057", "009", "UN"], roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1 671"] }, geometry: { type: "MultiPolygon", coordinates: [[[[146.25931, 13.85876], [143.82485, 13.92273], [144.61642, 12.82462], [146.25931, 13.85876]]]] } },
20604     { type: "Feature", properties: { iso1A2: "GW", iso1A3: "GNB", iso1N3: "624", wikidata: "Q1007", nameEn: "Guinea-Bissau", groups: ["011", "202", "002", "UN"], callingCodes: ["245"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-14.31513, 11.60713], [-14.26623, 11.67486], [-14.09799, 11.63649], [-13.7039, 11.70195], [-13.7039, 12.00869], [-13.94589, 12.16869], [-13.92745, 12.24077], [-13.70851, 12.24978], [-13.64168, 12.42764], [-13.65089, 12.49515], [-13.7039, 12.60313], [-13.70523, 12.68013], [-15.17582, 12.6847], [-15.67302, 12.42974], [-16.20591, 12.46157], [-16.38191, 12.36449], [-16.70562, 12.34803], [-17.4623, 11.92379], [-15.96748, 10.162], [-15.07174, 10.89557], [-14.95993, 10.99244], [-14.77786, 11.36323], [-14.66677, 11.51188], [-14.51173, 11.49708], [-14.31513, 11.60713]]]] } },
20605     { type: "Feature", properties: { iso1A2: "GY", iso1A3: "GUY", iso1N3: "328", wikidata: "Q734", nameEn: "Guyana", groups: ["005", "419", "019", "UN"], driveSide: "left", callingCodes: ["592"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-56.84822, 6.73257], [-59.54058, 8.6862], [-59.98508, 8.53046], [-59.85562, 8.35213], [-59.80661, 8.28906], [-59.83156, 8.23261], [-59.97059, 8.20791], [-60.02407, 8.04557], [-60.38056, 7.8302], [-60.51959, 7.83373], [-60.64793, 7.56877], [-60.71923, 7.55817], [-60.59802, 7.33194], [-60.63367, 7.25061], [-60.54098, 7.14804], [-60.44116, 7.20817], [-60.28074, 7.1162], [-60.39419, 6.94847], [-60.54873, 6.8631], [-61.13632, 6.70922], [-61.20762, 6.58174], [-61.15058, 6.19558], [-61.4041, 5.95304], [-60.73204, 5.20931], [-60.32352, 5.21299], [-60.20944, 5.28754], [-59.98129, 5.07097], [-60.04189, 4.69801], [-60.15953, 4.53456], [-59.78878, 4.45637], [-59.69361, 4.34069], [-59.73353, 4.20399], [-59.51963, 3.91951], [-59.86899, 3.57089], [-59.79769, 3.37162], [-59.99733, 2.92312], [-59.91177, 2.36759], [-59.7264, 2.27497], [-59.74066, 1.87596], [-59.25583, 1.40559], [-58.92072, 1.31293], [-58.84229, 1.17749], [-58.53571, 1.29154], [-58.4858, 1.48399], [-58.33887, 1.58014], [-58.01873, 1.51966], [-57.97336, 1.64566], [-57.77281, 1.73344], [-57.55743, 1.69605], [-57.35073, 1.98327], [-57.23981, 1.95808], [-57.09109, 2.01854], [-57.07092, 1.95304], [-56.7659, 1.89509], [-56.47045, 1.95135], [-56.55439, 2.02003], [-56.70519, 2.02964], [-57.35891, 3.32121], [-58.0307, 3.95513], [-57.8699, 4.89394], [-57.37442, 5.0208], [-57.22536, 5.15605], [-57.31629, 5.33714], [-56.84822, 6.73257]]]] } },
20606     { type: "Feature", properties: { iso1A2: "HK", iso1A3: "HKG", iso1N3: "344", wikidata: "Q8646", nameEn: "Hong Kong", country: "CN", groups: ["030", "142", "UN"], driveSide: "left", callingCodes: ["852"] }, geometry: { type: "MultiPolygon", coordinates: [[[[113.92195, 22.13873], [114.50148, 22.15017], [114.44998, 22.55977], [114.25154, 22.55977], [114.22888, 22.5436], [114.22185, 22.55343], [114.20655, 22.55706], [114.18338, 22.55444], [114.17247, 22.55944], [114.1597, 22.56041], [114.15123, 22.55163], [114.1482, 22.54091], [114.13823, 22.54319], [114.12665, 22.54003], [114.11656, 22.53415], [114.11181, 22.52878], [114.1034, 22.5352], [114.09692, 22.53435], [114.09048, 22.53716], [114.08606, 22.53276], [114.07817, 22.52997], [114.07267, 22.51855], [114.06272, 22.51617], [114.05729, 22.51104], [114.05438, 22.5026], [114.03113, 22.5065], [113.86771, 22.42972], [113.81621, 22.2163], [113.83338, 22.1826], [113.92195, 22.13873]]]] } },
20607     { type: "Feature", properties: { iso1A2: "HM", iso1A3: "HMD", iso1N3: "334", wikidata: "Q131198", nameEn: "Heard Island and McDonald Islands", country: "AU", groups: ["053", "009", "UN"], driveSide: "left" }, geometry: { type: "MultiPolygon", coordinates: [[[[71.08716, -53.87687], [75.44182, -53.99822], [72.87012, -51.48322], [71.08716, -53.87687]]]] } },
20608     { type: "Feature", properties: { iso1A2: "HN", iso1A3: "HND", iso1N3: "340", wikidata: "Q783", nameEn: "Honduras", groups: ["013", "003", "419", "019", "UN"], callingCodes: ["504"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-83.86109, 17.73736], [-88.20359, 16.03858], [-88.22552, 15.72294], [-88.24022, 15.69247], [-88.31459, 15.66942], [-88.32467, 15.63665], [-88.97343, 15.14039], [-89.15149, 15.07392], [-89.18048, 14.99967], [-89.15149, 14.97775], [-89.23467, 14.85596], [-89.13132, 14.71582], [-89.15653, 14.57802], [-89.23719, 14.58046], [-89.35189, 14.47553], [-89.34776, 14.43013], [-89.04187, 14.33644], [-88.94608, 14.20207], [-88.85785, 14.17763], [-88.815, 14.11652], [-88.73182, 14.10919], [-88.70661, 14.04317], [-88.49738, 13.97224], [-88.48982, 13.86458], [-88.25791, 13.91108], [-88.23018, 13.99915], [-88.07641, 13.98447], [-88.00331, 13.86948], [-87.7966, 13.91353], [-87.68821, 13.80829], [-87.73106, 13.75443], [-87.78148, 13.52906], [-87.71657, 13.50577], [-87.72115, 13.46083], [-87.73841, 13.44169], [-87.77354, 13.45767], [-87.83467, 13.44655], [-87.84675, 13.41078], [-87.80177, 13.35689], [-87.73714, 13.32715], [-87.69751, 13.25228], [-87.55124, 13.12523], [-87.37107, 12.98646], [-87.06306, 13.00892], [-87.03785, 12.98682], [-86.93197, 13.05313], [-86.93383, 13.18677], [-86.87066, 13.30641], [-86.71267, 13.30348], [-86.76812, 13.79605], [-86.35219, 13.77157], [-86.14801, 14.04317], [-86.00685, 14.08474], [-86.03458, 13.99181], [-85.75477, 13.8499], [-85.73964, 13.9698], [-85.45762, 14.11304], [-85.32149, 14.2562], [-85.18602, 14.24929], [-85.1575, 14.53934], [-84.90082, 14.80489], [-84.82596, 14.82212], [-84.70119, 14.68078], [-84.48373, 14.63249], [-84.10584, 14.76353], [-83.89551, 14.76697], [-83.62101, 14.89448], [-83.49268, 15.01158], [-83.13724, 15.00002], [-83.04763, 15.03256], [-82.06974, 14.49418], [-81.58685, 18.0025], [-83.86109, 17.73736]]]] } },
20609     { type: "Feature", properties: { iso1A2: "HR", iso1A3: "HRV", iso1N3: "191", wikidata: "Q224", nameEn: "Croatia", groups: ["EU", "039", "150", "UN"], callingCodes: ["385"] }, geometry: { type: "MultiPolygon", coordinates: [[[[17.6444, 42.88641], [17.5392, 42.92787], [17.70879, 42.97223], [17.64268, 43.08595], [17.46986, 43.16559], [17.286, 43.33065], [17.25579, 43.40353], [17.29699, 43.44542], [17.24411, 43.49376], [17.15828, 43.49376], [17.00585, 43.58037], [16.80736, 43.76011], [16.75316, 43.77157], [16.70922, 43.84887], [16.55472, 43.95326], [16.50528, 44.0244], [16.43629, 44.02826], [16.43662, 44.07523], [16.36864, 44.08263], [16.18688, 44.27012], [16.21346, 44.35231], [16.12969, 44.38275], [16.16814, 44.40679], [16.10566, 44.52586], [16.03012, 44.55572], [16.00884, 44.58605], [16.05828, 44.61538], [15.89348, 44.74964], [15.8255, 44.71501], [15.72584, 44.82334], [15.79472, 44.8455], [15.76096, 44.87045], [15.74723, 44.96818], [15.78568, 44.97401], [15.74585, 45.0638], [15.78842, 45.11519], [15.76371, 45.16508], [15.83512, 45.22459], [15.98412, 45.23088], [16.12153, 45.09616], [16.29036, 44.99732], [16.35404, 45.00241], [16.35863, 45.03529], [16.3749, 45.05206], [16.38219, 45.05139], [16.38309, 45.05955], [16.40023, 45.1147], [16.4634, 45.14522], [16.49155, 45.21153], [16.52982, 45.22713], [16.5501, 45.2212], [16.56559, 45.22307], [16.60194, 45.23042], [16.64962, 45.20714], [16.74845, 45.20393], [16.78219, 45.19002], [16.81137, 45.18434], [16.83804, 45.18951], [16.92405, 45.27607], [16.9385, 45.22742], [17.0415, 45.20759], [17.18438, 45.14764], [17.24325, 45.146], [17.25131, 45.14957], [17.26815, 45.18444], [17.32092, 45.16246], [17.33573, 45.14521], [17.41229, 45.13335], [17.4498, 45.16119], [17.45615, 45.12523], [17.47589, 45.12656], [17.51469, 45.10791], [17.59104, 45.10816], [17.66571, 45.13408], [17.84826, 45.04489], [17.87148, 45.04645], [17.93706, 45.08016], [17.97336, 45.12245], [17.97834, 45.13831], [17.99479, 45.14958], [18.01594, 45.15163], [18.03121, 45.12632], [18.1624, 45.07654], [18.24387, 45.13699], [18.32077, 45.1021], [18.41896, 45.11083], [18.47939, 45.05871], [18.65723, 45.07544], [18.78357, 44.97741], [18.80661, 44.93561], [18.76369, 44.93707], [18.76347, 44.90669], [18.8704, 44.85097], [19.01994, 44.85493], [18.98957, 44.90645], [19.02871, 44.92541], [19.06853, 44.89915], [19.15573, 44.95409], [19.05205, 44.97692], [19.1011, 45.01191], [19.07952, 45.14668], [19.14063, 45.12972], [19.19144, 45.17863], [19.43589, 45.17137], [19.41941, 45.23475], [19.28208, 45.23813], [19.10774, 45.29547], [18.97446, 45.37528], [18.99918, 45.49333], [19.08364, 45.48804], [19.07471, 45.53086], [18.94562, 45.53712], [18.88776, 45.57253], [18.96691, 45.66731], [18.90305, 45.71863], [18.85783, 45.85493], [18.81394, 45.91329], [18.80211, 45.87995], [18.6792, 45.92057], [18.57483, 45.80772], [18.44368, 45.73972], [18.12439, 45.78905], [18.08869, 45.76511], [17.99805, 45.79671], [17.87377, 45.78522], [17.66545, 45.84207], [17.56821, 45.93728], [17.35672, 45.95209], [17.14592, 46.16697], [16.8903, 46.28122], [16.8541, 46.36255], [16.7154, 46.39523], [16.6639, 46.45203], [16.59527, 46.47524], [16.52604, 46.47831], [16.5007, 46.49644], [16.44036, 46.5171], [16.38771, 46.53608], [16.37193, 46.55008], [16.29793, 46.5121], [16.26733, 46.51505], [16.26759, 46.50566], [16.23961, 46.49653], [16.25124, 46.48067], [16.27398, 46.42875], [16.27329, 46.41467], [16.30162, 46.40437], [16.30233, 46.37837], [16.18824, 46.38282], [16.14859, 46.40547], [16.05281, 46.39141], [16.05065, 46.3833], [16.07314, 46.36458], [16.07616, 46.3463], [15.97965, 46.30652], [15.79284, 46.25811], [15.78817, 46.21719], [15.75479, 46.20336], [15.75436, 46.21969], [15.67395, 46.22478], [15.6434, 46.21396], [15.64904, 46.19229], [15.59909, 46.14761], [15.6083, 46.11992], [15.62317, 46.09103], [15.72977, 46.04682], [15.71246, 46.01196], [15.70327, 46.00015], [15.70636, 45.92116], [15.67967, 45.90455], [15.68383, 45.88867], [15.68232, 45.86819], [15.70411, 45.8465], [15.66662, 45.84085], [15.64185, 45.82915], [15.57952, 45.84953], [15.52234, 45.82195], [15.47325, 45.8253], [15.47531, 45.79802], [15.40836, 45.79491], [15.25423, 45.72275], [15.30872, 45.69014], [15.34919, 45.71623], [15.4057, 45.64727], [15.38952, 45.63682], [15.34214, 45.64702], [15.34695, 45.63382], [15.31027, 45.6303], [15.27747, 45.60504], [15.29837, 45.5841], [15.30249, 45.53224], [15.38188, 45.48752], [15.33051, 45.45258], [15.27758, 45.46678], [15.16862, 45.42309], [15.05187, 45.49079], [15.02385, 45.48533], [14.92266, 45.52788], [14.90554, 45.47769], [14.81992, 45.45913], [14.80124, 45.49515], [14.71718, 45.53442], [14.68605, 45.53006], [14.69694, 45.57366], [14.59576, 45.62812], [14.60977, 45.66403], [14.57397, 45.67165], [14.53816, 45.6205], [14.5008, 45.60852], [14.49769, 45.54424], [14.36693, 45.48642], [14.32487, 45.47142], [14.27681, 45.4902], [14.26611, 45.48239], [14.24239, 45.50607], [14.22371, 45.50388], [14.20348, 45.46896], [14.07116, 45.48752], [14.00578, 45.52352], [13.96063, 45.50825], [13.99488, 45.47551], [13.97309, 45.45258], [13.90771, 45.45149], [13.88124, 45.42637], [13.81742, 45.43729], [13.7785, 45.46787], [13.67398, 45.4436], [13.62902, 45.45898], [13.56979, 45.4895], [13.45644, 45.59464], [13.05142, 45.33128], [13.12821, 44.48877], [16.15283, 42.18525], [18.45131, 42.21682], [18.54128, 42.39171], [18.52152, 42.42302], [18.43588, 42.48556], [18.44307, 42.51077], [18.43735, 42.55921], [18.36197, 42.61423], [18.24318, 42.6112], [17.88201, 42.83668], [17.80854, 42.9182], [17.7948, 42.89556], [17.68151, 42.92725], [17.6444, 42.88641]]]] } },
20610     { type: "Feature", properties: { iso1A2: "HT", iso1A3: "HTI", iso1N3: "332", wikidata: "Q790", nameEn: "Haiti", aliases: ["RH"], groups: ["029", "003", "419", "019", "UN"], callingCodes: ["509"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-71.71885, 18.78423], [-71.72624, 18.87802], [-71.77766, 18.95007], [-71.88102, 18.95007], [-71.74088, 19.0437], [-71.71088, 19.08353], [-71.69938, 19.10916], [-71.65337, 19.11759], [-71.62642, 19.21212], [-71.73229, 19.26686], [-71.77766, 19.33823], [-71.69448, 19.37866], [-71.6802, 19.45008], [-71.71268, 19.53374], [-71.71449, 19.55364], [-71.7429, 19.58445], [-71.75865, 19.70231], [-71.77419, 19.73128], [-72.38946, 20.27111], [-73.37289, 20.43199], [-74.7289, 18.71009], [-74.76465, 18.06252], [-72.29523, 17.48026], [-71.75671, 18.03456], [-71.73783, 18.07177], [-71.74994, 18.11115], [-71.75465, 18.14405], [-71.78271, 18.18302], [-71.69952, 18.34101], [-71.90875, 18.45821], [-71.88102, 18.50125], [-72.00201, 18.62312], [-71.95412, 18.64939], [-71.82556, 18.62551], [-71.71885, 18.78423]]]] } },
20611     { type: "Feature", properties: { iso1A2: "HU", iso1A3: "HUN", iso1N3: "348", wikidata: "Q28", nameEn: "Hungary", groups: ["EU", "151", "150", "UN"], callingCodes: ["36"] }, geometry: { type: "MultiPolygon", coordinates: [[[[21.72525, 48.34628], [21.67134, 48.3989], [21.6068, 48.50365], [21.44063, 48.58456], [21.11516, 48.49546], [20.83248, 48.5824], [20.5215, 48.53336], [20.29943, 48.26104], [20.24312, 48.2784], [19.92452, 48.1283], [19.63338, 48.25006], [19.52489, 48.19791], [19.47957, 48.09437], [19.28182, 48.08336], [19.23924, 48.0595], [19.01952, 48.07052], [18.82176, 48.04206], [18.76134, 47.97499], [18.76821, 47.87469], [18.8506, 47.82308], [18.74074, 47.8157], [18.66521, 47.76772], [18.56496, 47.76588], [18.29305, 47.73541], [18.02938, 47.75665], [17.71215, 47.7548], [17.23699, 48.02094], [17.16001, 48.00636], [17.09786, 47.97336], [17.11022, 47.92461], [17.08275, 47.87719], [17.00997, 47.86245], [17.07039, 47.81129], [17.05048, 47.79377], [17.08893, 47.70928], [16.87538, 47.68895], [16.86509, 47.72268], [16.82938, 47.68432], [16.7511, 47.67878], [16.72089, 47.73469], [16.65679, 47.74197], [16.61183, 47.76171], [16.54779, 47.75074], [16.53514, 47.73837], [16.55129, 47.72268], [16.4222, 47.66537], [16.58699, 47.61772], [16.64193, 47.63114], [16.71059, 47.52692], [16.64821, 47.50155], [16.6718, 47.46139], [16.57152, 47.40868], [16.52414, 47.41007], [16.49908, 47.39416], [16.45104, 47.41181], [16.47782, 47.25918], [16.44142, 47.25079], [16.43663, 47.21127], [16.41739, 47.20649], [16.42801, 47.18422], [16.4523, 47.18812], [16.46442, 47.16845], [16.44932, 47.14418], [16.52863, 47.13974], [16.46134, 47.09395], [16.52176, 47.05747], [16.43936, 47.03548], [16.51369, 47.00084], [16.28202, 47.00159], [16.27594, 46.9643], [16.22403, 46.939], [16.19904, 46.94134], [16.10983, 46.867], [16.14365, 46.8547], [16.15711, 46.85434], [16.21892, 46.86961], [16.2365, 46.87775], [16.2941, 46.87137], [16.34547, 46.83836], [16.3408, 46.80641], [16.31303, 46.79838], [16.30966, 46.7787], [16.37816, 46.69975], [16.42641, 46.69228], [16.41863, 46.66238], [16.38594, 46.6549], [16.39217, 46.63673], [16.50139, 46.56684], [16.52885, 46.53303], [16.52604, 46.5051], [16.59527, 46.47524], [16.6639, 46.45203], [16.7154, 46.39523], [16.8541, 46.36255], [16.8903, 46.28122], [17.14592, 46.16697], [17.35672, 45.95209], [17.56821, 45.93728], [17.66545, 45.84207], [17.87377, 45.78522], [17.99805, 45.79671], [18.08869, 45.76511], [18.12439, 45.78905], [18.44368, 45.73972], [18.57483, 45.80772], [18.6792, 45.92057], [18.80211, 45.87995], [18.81394, 45.91329], [18.99712, 45.93537], [19.01284, 45.96529], [19.0791, 45.96458], [19.10388, 46.04015], [19.14543, 45.9998], [19.28826, 45.99694], [19.52473, 46.1171], [19.56113, 46.16824], [19.66007, 46.19005], [19.81491, 46.1313], [19.93508, 46.17553], [20.01816, 46.17696], [20.03533, 46.14509], [20.09713, 46.17315], [20.26068, 46.12332], [20.28324, 46.1438], [20.35573, 46.16629], [20.45377, 46.14405], [20.49718, 46.18721], [20.63863, 46.12728], [20.76085, 46.21002], [20.74574, 46.25467], [20.86797, 46.28884], [21.06572, 46.24897], [21.16872, 46.30118], [21.28061, 46.44941], [21.26929, 46.4993], [21.33214, 46.63035], [21.43926, 46.65109], [21.5151, 46.72147], [21.48935, 46.7577], [21.52028, 46.84118], [21.59307, 46.86935], [21.59581, 46.91628], [21.68645, 46.99595], [21.648, 47.03902], [21.78395, 47.11104], [21.94463, 47.38046], [22.01055, 47.37767], [22.03389, 47.42508], [22.00917, 47.50492], [22.31816, 47.76126], [22.41979, 47.7391], [22.46559, 47.76583], [22.67247, 47.7871], [22.76617, 47.8417], [22.77991, 47.87211], [22.89849, 47.95851], [22.84276, 47.98602], [22.87847, 48.04665], [22.81804, 48.11363], [22.73427, 48.12005], [22.66835, 48.09162], [22.58733, 48.10813], [22.59007, 48.15121], [22.49806, 48.25189], [22.38133, 48.23726], [22.2083, 48.42534], [22.14689, 48.4005], [21.83339, 48.36242], [21.8279, 48.33321], [21.72525, 48.34628]]]] } },
20612     { type: "Feature", properties: { iso1A2: "IC", wikidata: "Q5813", nameEn: "Canary Islands", country: "ES", groups: ["Q3320166", "Q105472", "EU", "039", "150", "UN"], isoStatus: "excRes", callingCodes: ["34"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-12.00985, 30.24121], [-25.3475, 27.87574], [-14.43883, 27.02969], [-12.00985, 30.24121]]]] } },
20613     { type: "Feature", properties: { iso1A2: "ID", iso1A3: "IDN", iso1N3: "360", wikidata: "Q252", nameEn: "Indonesia", aliases: ["RI"] }, geometry: null },
20614     { type: "Feature", geometry: { type: "MultiPolygon", coordinates: [[[[-6.26218, 54.09785], [-6.29003, 54.11278], [-6.32694, 54.09337], [-6.36279, 54.11248], [-6.36605, 54.07234], [-6.47849, 54.06947], [-6.62842, 54.03503], [-6.66264, 54.0666], [-6.6382, 54.17071], [-6.70175, 54.20218], [-6.74575, 54.18788], [-6.81583, 54.22791], [-6.85179, 54.29176], [-6.87775, 54.34682], [-7.02034, 54.4212], [-7.19145, 54.31296], [-7.14908, 54.22732], [-7.25012, 54.20063], [-7.26316, 54.13863], [-7.29493, 54.12013], [-7.29687, 54.1354], [-7.28017, 54.16714], [-7.29157, 54.17191], [-7.34005, 54.14698], [-7.30553, 54.11869], [-7.32834, 54.11475], [-7.44567, 54.1539], [-7.4799, 54.12239], [-7.55812, 54.12239], [-7.69501, 54.20731], [-7.81397, 54.20159], [-7.8596, 54.21779], [-7.87101, 54.29299], [-8.04555, 54.36292], [-8.179, 54.46763], [-8.04538, 54.48941], [-7.99812, 54.54427], [-7.8596, 54.53671], [-7.70315, 54.62077], [-7.93293, 54.66603], [-7.83352, 54.73854], [-7.75041, 54.7103], [-7.64449, 54.75265], [-7.54671, 54.74606], [-7.54508, 54.79401], [-7.47626, 54.83084], [-7.4473, 54.87003], [-7.44404, 54.9403], [-7.40004, 54.94498], [-7.4033, 55.00391], [-7.34464, 55.04688], [-7.2471, 55.06933], [-6.34755, 55.49206], [-7.75229, 55.93854], [-11.75, 54], [-11, 51], [-6.03913, 51.13217], [-5.37267, 53.63269], [-6.26218, 54.09785]]]] }, properties: { iso1A2: "IE", iso1A3: "IRL", iso1N3: "372", wikidata: "Q27", nameEn: "Republic of Ireland", groups: ["EU", "Q22890", "154", "150", "UN"], driveSide: "left", callingCodes: ["353"] } },
20615     { type: "Feature", properties: { iso1A2: "IL", iso1A3: "ISR", iso1N3: "376", wikidata: "Q801", nameEn: "Israel", groups: ["145", "142", "UN"], callingCodes: ["972"] }, geometry: { type: "MultiPolygon", coordinates: [[[[34.052, 31.46619], [34.29262, 31.70393], [34.48681, 31.59711], [34.56797, 31.54197], [34.48892, 31.48365], [34.40077, 31.40926], [34.36505, 31.36404], [34.37381, 31.30598], [34.36523, 31.28963], [34.29417, 31.24194], [34.26742, 31.21998], [34.92298, 29.45305], [34.97718, 29.54294], [34.98207, 29.58147], [35.02147, 29.66343], [35.14108, 30.07374], [35.19183, 30.34636], [35.16218, 30.43535], [35.19595, 30.50297], [35.21379, 30.60401], [35.29311, 30.71365], [35.33456, 30.81224], [35.33984, 30.8802], [35.41371, 30.95565], [35.43658, 31.12444], [35.40316, 31.25535], [35.47672, 31.49578], [35.39675, 31.49572], [35.22921, 31.37445], [35.13033, 31.3551], [35.02459, 31.35979], [34.92571, 31.34337], [34.88932, 31.37093], [34.87833, 31.39321], [34.89756, 31.43891], [34.93258, 31.47816], [34.94356, 31.50743], [34.9415, 31.55601], [34.95249, 31.59813], [35.00879, 31.65426], [35.08226, 31.69107], [35.10782, 31.71594], [35.11895, 31.71454], [35.12933, 31.7325], [35.13931, 31.73012], [35.15119, 31.73634], [35.15474, 31.73352], [35.16478, 31.73242], [35.18023, 31.72067], [35.20538, 31.72388], [35.21937, 31.71578], [35.22392, 31.71899], [35.23972, 31.70896], [35.24315, 31.71244], [35.2438, 31.7201], [35.24981, 31.72543], [35.25182, 31.73945], [35.26319, 31.74846], [35.25225, 31.7678], [35.26058, 31.79064], [35.25573, 31.81362], [35.26404, 31.82567], [35.251, 31.83085], [35.25753, 31.8387], [35.24816, 31.8458], [35.2304, 31.84222], [35.2249, 31.85433], [35.22817, 31.8638], [35.22567, 31.86745], [35.22294, 31.87889], [35.22014, 31.88264], [35.2136, 31.88241], [35.21276, 31.88153], [35.21016, 31.88237], [35.20945, 31.8815], [35.20791, 31.8821], [35.20673, 31.88151], [35.20381, 31.86716], [35.21128, 31.863], [35.216, 31.83894], [35.21469, 31.81835], [35.19461, 31.82687], [35.18169, 31.82542], [35.18603, 31.80901], [35.14174, 31.81325], [35.07677, 31.85627], [35.05617, 31.85685], [35.01978, 31.82944], [34.9724, 31.83352], [34.99712, 31.85569], [35.03489, 31.85919], [35.03978, 31.89276], [35.03489, 31.92448], [35.00124, 31.93264], [34.98682, 31.96935], [35.00261, 32.027], [34.9863, 32.09551], [34.99437, 32.10962], [34.98507, 32.12606], [34.99039, 32.14626], [34.96009, 32.17503], [34.95703, 32.19522], [34.98885, 32.20758], [35.01841, 32.23981], [35.02939, 32.2671], [35.01119, 32.28684], [35.01772, 32.33863], [35.04243, 32.35008], [35.05142, 32.3667], [35.0421, 32.38242], [35.05311, 32.4024], [35.05423, 32.41754], [35.07059, 32.4585], [35.08564, 32.46948], [35.09236, 32.47614], [35.10024, 32.47856], [35.10882, 32.4757], [35.15937, 32.50466], [35.2244, 32.55289], [35.25049, 32.52453], [35.29306, 32.50947], [35.30685, 32.51024], [35.35212, 32.52047], [35.40224, 32.50136], [35.42034, 32.46009], [35.41598, 32.45593], [35.41048, 32.43706], [35.42078, 32.41562], [35.55807, 32.38674], [35.55494, 32.42687], [35.57485, 32.48669], [35.56614, 32.64393], [35.59813, 32.65159], [35.61669, 32.67999], [35.66527, 32.681], [35.68467, 32.70715], [35.75983, 32.74803], [35.78745, 32.77938], [35.83758, 32.82817], [35.84021, 32.8725], [35.87012, 32.91976], [35.89298, 32.9456], [35.87188, 32.98028], [35.84802, 33.1031], [35.81911, 33.11077], [35.81911, 33.1336], [35.84285, 33.16673], [35.83846, 33.19397], [35.81647, 33.2028], [35.81295, 33.24841], [35.77513, 33.27342], [35.813, 33.3172], [35.77477, 33.33609], [35.62019, 33.27278], [35.62283, 33.24226], [35.58502, 33.26653], [35.58326, 33.28381], [35.56523, 33.28969], [35.55555, 33.25844], [35.54544, 33.25513], [35.54808, 33.236], [35.5362, 33.23196], [35.54228, 33.19865], [35.52573, 33.11921], [35.50335, 33.114], [35.50272, 33.09056], [35.448, 33.09264], [35.43059, 33.06659], [35.35223, 33.05617], [35.31429, 33.10515], [35.1924, 33.08743], [35.10645, 33.09318], [34.78515, 33.20368], [33.62659, 31.82938], [34.052, 31.46619]]]] } },
20616     { type: "Feature", properties: { iso1A2: "IM", iso1A3: "IMN", iso1N3: "833", wikidata: "Q9676", nameEn: "Isle of Man", country: "GB", groups: ["Q185086", "154", "150", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44 01624", "44 07624", "44 07524", "44 07924"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-3.98763, 54.07351], [-4.1819, 54.57861], [-5.6384, 53.81157], [-3.98763, 54.07351]]]] } },
20617     { type: "Feature", properties: { iso1A2: "IN", iso1A3: "IND", iso1N3: "356", wikidata: "Q668", nameEn: "India" }, geometry: null },
20618     { type: "Feature", properties: { iso1A2: "IO", iso1A3: "IOT", iso1N3: "086", wikidata: "Q43448", nameEn: "British Indian Ocean Territory", country: "GB" }, geometry: null },
20619     { type: "Feature", properties: { iso1A2: "IQ", iso1A3: "IRQ", iso1N3: "368", wikidata: "Q796", nameEn: "Iraq", groups: ["145", "142", "UN"], callingCodes: ["964"] }, geometry: { type: "MultiPolygon", coordinates: [[[[42.78887, 37.38615], [42.56725, 37.14878], [42.35724, 37.10998], [42.36697, 37.0627], [41.81736, 36.58782], [41.40058, 36.52502], [41.28864, 36.35368], [41.2564, 36.06012], [41.37027, 35.84095], [41.38184, 35.62502], [41.26569, 35.42708], [41.21654, 35.1508], [41.2345, 34.80049], [41.12388, 34.65742], [40.97676, 34.39788], [40.64314, 34.31604], [38.79171, 33.37328], [39.08202, 32.50304], [38.98762, 32.47694], [39.04251, 32.30203], [39.26157, 32.35555], [39.29903, 32.23259], [40.01521, 32.05667], [42.97601, 30.72204], [42.97796, 30.48295], [44.72255, 29.19736], [46.42415, 29.05947], [46.5527, 29.10283], [46.89695, 29.50584], [47.15166, 30.01044], [47.37192, 30.10421], [47.7095, 30.10453], [48.01114, 29.98906], [48.06782, 30.02906], [48.17332, 30.02448], [48.40479, 29.85763], [48.59531, 29.66815], [48.83867, 29.78572], [48.61441, 29.93675], [48.51011, 29.96238], [48.44785, 30.00148], [48.4494, 30.04456], [48.43384, 30.08233], [48.38869, 30.11062], [48.38714, 30.13485], [48.41671, 30.17254], [48.41117, 30.19846], [48.26393, 30.3408], [48.24385, 30.33846], [48.21279, 30.31644], [48.19425, 30.32796], [48.18321, 30.39703], [48.14585, 30.44133], [48.02443, 30.4789], [48.03221, 30.9967], [47.68219, 31.00004], [47.6804, 31.39086], [47.86337, 31.78422], [47.64771, 32.07666], [47.52474, 32.15972], [47.57144, 32.20583], [47.37529, 32.47808], [47.17218, 32.45393], [46.46788, 32.91992], [46.32298, 32.9731], [46.17198, 32.95612], [46.09103, 32.98354], [46.15175, 33.07229], [46.03966, 33.09577], [46.05367, 33.13097], [46.11905, 33.11924], [46.20623, 33.20395], [45.99919, 33.5082], [45.86687, 33.49263], [45.96183, 33.55751], [45.89801, 33.63661], [45.77814, 33.60938], [45.50261, 33.94968], [45.42789, 33.9458], [45.41077, 33.97421], [45.47264, 34.03099], [45.56176, 34.15088], [45.58667, 34.30147], [45.53552, 34.35148], [45.49171, 34.3439], [45.46697, 34.38221], [45.43879, 34.45949], [45.51883, 34.47692], [45.53219, 34.60441], [45.59074, 34.55558], [45.60224, 34.55057], [45.73923, 34.54416], [45.70031, 34.69277], [45.65672, 34.7222], [45.68284, 34.76624], [45.70031, 34.82322], [45.73641, 34.83975], [45.79682, 34.85133], [45.78904, 34.91135], [45.86532, 34.89858], [45.89477, 34.95805], [45.87864, 35.03441], [45.92173, 35.0465], [45.92203, 35.09538], [45.93108, 35.08148], [45.94756, 35.09188], [46.06508, 35.03699], [46.07747, 35.0838], [46.11763, 35.07551], [46.19116, 35.11097], [46.15642, 35.1268], [46.16229, 35.16984], [46.19738, 35.18536], [46.18457, 35.22561], [46.11367, 35.23729], [46.15474, 35.2883], [46.13152, 35.32548], [46.05358, 35.38568], [45.98453, 35.49848], [46.01518, 35.52012], [45.97584, 35.58132], [46.03028, 35.57416], [46.01307, 35.59756], [46.0165, 35.61501], [45.99452, 35.63574], [46.0117, 35.65059], [46.01631, 35.69139], [46.23736, 35.71414], [46.34166, 35.78363], [46.32921, 35.82655], [46.17198, 35.8013], [46.08325, 35.8581], [45.94711, 35.82218], [45.89784, 35.83708], [45.81442, 35.82107], [45.76145, 35.79898], [45.6645, 35.92872], [45.60018, 35.96069], [45.55245, 35.99943], [45.46594, 36.00042], [45.38275, 35.97156], [45.33916, 35.99424], [45.37652, 36.06222], [45.37312, 36.09917], [45.32235, 36.17383], [45.30038, 36.27769], [45.26261, 36.3001], [45.27394, 36.35846], [45.23953, 36.43257], [45.11811, 36.40751], [45.00759, 36.5402], [45.06985, 36.62645], [45.06985, 36.6814], [45.01537, 36.75128], [44.84725, 36.77622], [44.83479, 36.81362], [44.90173, 36.86096], [44.91199, 36.91468], [44.89862, 37.01897], [44.81611, 37.04383], [44.75229, 37.11958], [44.78319, 37.1431], [44.76698, 37.16162], [44.63179, 37.19229], [44.42631, 37.05825], [44.38117, 37.05825], [44.35315, 37.04955], [44.35937, 37.02843], [44.30645, 36.97373], [44.25975, 36.98119], [44.18503, 37.09551], [44.22239, 37.15756], [44.27998, 37.16501], [44.2613, 37.25055], [44.13521, 37.32486], [44.02002, 37.33229], [43.90949, 37.22453], [43.84878, 37.22205], [43.82699, 37.19477], [43.8052, 37.22825], [43.7009, 37.23692], [43.63085, 37.21957], [43.56702, 37.25675], [43.50787, 37.24436], [43.33508, 37.33105], [43.30083, 37.30629], [43.11403, 37.37436], [42.93705, 37.32015], [42.78887, 37.38615]]]] } },
20620     { type: "Feature", properties: { iso1A2: "IR", iso1A3: "IRN", iso1N3: "364", wikidata: "Q794", nameEn: "Iran", groups: ["034", "142", "UN"], callingCodes: ["98"] }, geometry: { type: "MultiPolygon", coordinates: [[[[44.96746, 39.42998], [44.88916, 39.59653], [44.81043, 39.62677], [44.71806, 39.71124], [44.65422, 39.72163], [44.6137, 39.78393], [44.47298, 39.68788], [44.48111, 39.61579], [44.41849, 39.56659], [44.42832, 39.4131], [44.37921, 39.4131], [44.29818, 39.378], [44.22452, 39.4169], [44.03667, 39.39223], [44.1043, 39.19842], [44.20946, 39.13975], [44.18863, 38.93881], [44.30322, 38.81581], [44.26155, 38.71427], [44.28065, 38.6465], [44.32058, 38.62752], [44.3207, 38.49799], [44.3119, 38.37887], [44.38309, 38.36117], [44.44386, 38.38295], [44.50115, 38.33939], [44.42476, 38.25763], [44.22509, 37.88859], [44.3883, 37.85433], [44.45948, 37.77065], [44.55498, 37.783], [44.62096, 37.71985], [44.56887, 37.6429], [44.61401, 37.60165], [44.58449, 37.45018], [44.81021, 37.2915], [44.75986, 37.21549], [44.7868, 37.16644], [44.78319, 37.1431], [44.75229, 37.11958], [44.81611, 37.04383], [44.89862, 37.01897], [44.91199, 36.91468], [44.90173, 36.86096], [44.83479, 36.81362], [44.84725, 36.77622], [45.01537, 36.75128], [45.06985, 36.6814], [45.06985, 36.62645], [45.00759, 36.5402], [45.11811, 36.40751], [45.23953, 36.43257], [45.27394, 36.35846], [45.26261, 36.3001], [45.30038, 36.27769], [45.32235, 36.17383], [45.37312, 36.09917], [45.37652, 36.06222], [45.33916, 35.99424], [45.38275, 35.97156], [45.46594, 36.00042], [45.55245, 35.99943], [45.60018, 35.96069], [45.6645, 35.92872], [45.76145, 35.79898], [45.81442, 35.82107], [45.89784, 35.83708], [45.94711, 35.82218], [46.08325, 35.8581], [46.17198, 35.8013], [46.32921, 35.82655], [46.34166, 35.78363], [46.23736, 35.71414], [46.01631, 35.69139], [46.0117, 35.65059], [45.99452, 35.63574], [46.0165, 35.61501], [46.01307, 35.59756], [46.03028, 35.57416], [45.97584, 35.58132], [46.01518, 35.52012], [45.98453, 35.49848], [46.05358, 35.38568], [46.13152, 35.32548], [46.15474, 35.2883], [46.11367, 35.23729], [46.18457, 35.22561], [46.19738, 35.18536], [46.16229, 35.16984], [46.15642, 35.1268], [46.19116, 35.11097], [46.11763, 35.07551], [46.07747, 35.0838], [46.06508, 35.03699], [45.94756, 35.09188], [45.93108, 35.08148], [45.92203, 35.09538], [45.92173, 35.0465], [45.87864, 35.03441], [45.89477, 34.95805], [45.86532, 34.89858], [45.78904, 34.91135], [45.79682, 34.85133], [45.73641, 34.83975], [45.70031, 34.82322], [45.68284, 34.76624], [45.65672, 34.7222], [45.70031, 34.69277], [45.73923, 34.54416], [45.60224, 34.55057], [45.59074, 34.55558], [45.53219, 34.60441], [45.51883, 34.47692], [45.43879, 34.45949], [45.46697, 34.38221], [45.49171, 34.3439], [45.53552, 34.35148], [45.58667, 34.30147], [45.56176, 34.15088], [45.47264, 34.03099], [45.41077, 33.97421], [45.42789, 33.9458], [45.50261, 33.94968], [45.77814, 33.60938], [45.89801, 33.63661], [45.96183, 33.55751], [45.86687, 33.49263], [45.99919, 33.5082], [46.20623, 33.20395], [46.11905, 33.11924], [46.05367, 33.13097], [46.03966, 33.09577], [46.15175, 33.07229], [46.09103, 32.98354], [46.17198, 32.95612], [46.32298, 32.9731], [46.46788, 32.91992], [47.17218, 32.45393], [47.37529, 32.47808], [47.57144, 32.20583], [47.52474, 32.15972], [47.64771, 32.07666], [47.86337, 31.78422], [47.6804, 31.39086], [47.68219, 31.00004], [48.03221, 30.9967], [48.02443, 30.4789], [48.14585, 30.44133], [48.18321, 30.39703], [48.19425, 30.32796], [48.21279, 30.31644], [48.24385, 30.33846], [48.26393, 30.3408], [48.41117, 30.19846], [48.41671, 30.17254], [48.38714, 30.13485], [48.38869, 30.11062], [48.43384, 30.08233], [48.4494, 30.04456], [48.44785, 30.00148], [48.51011, 29.96238], [48.61441, 29.93675], [48.83867, 29.78572], [49.98877, 27.87827], [50.37726, 27.89227], [54.39838, 25.68383], [55.14145, 25.62624], [55.81777, 26.18798], [56.2644, 26.58649], [56.68954, 26.76645], [56.79239, 26.41236], [56.82555, 25.7713], [56.86325, 25.03856], [61.46682, 24.57869], [61.6433, 25.27541], [61.683, 25.66638], [61.83968, 25.7538], [61.83831, 26.07249], [61.89391, 26.26251], [62.05117, 26.31647], [62.21304, 26.26601], [62.31484, 26.528], [62.77352, 26.64099], [63.1889, 26.65072], [63.18688, 26.83844], [63.25005, 26.84212], [63.25005, 27.08692], [63.32283, 27.14437], [63.19649, 27.25674], [62.80604, 27.22412], [62.79684, 27.34381], [62.84905, 27.47627], [62.7638, 28.02992], [62.79412, 28.28108], [62.59499, 28.24842], [62.40259, 28.42703], [61.93581, 28.55284], [61.65978, 28.77937], [61.53765, 29.00507], [61.31508, 29.38903], [60.87231, 29.86514], [61.80829, 30.84224], [61.78268, 30.92724], [61.8335, 30.97669], [61.83257, 31.0452], [61.80957, 31.12576], [61.80569, 31.16167], [61.70929, 31.37391], [60.84541, 31.49561], [60.86191, 32.22565], [60.56485, 33.12944], [60.88908, 33.50219], [60.91133, 33.55596], [60.69573, 33.56054], [60.57762, 33.59772], [60.5485, 33.73422], [60.5838, 33.80793], [60.50209, 34.13992], [60.66502, 34.31539], [60.91321, 34.30411], [60.72316, 34.52857], [60.99922, 34.63064], [61.00197, 34.70631], [61.06926, 34.82139], [61.12831, 35.09938], [61.0991, 35.27845], [61.18187, 35.30249], [61.27371, 35.61482], [61.22719, 35.67038], [61.26152, 35.80749], [61.22444, 35.92879], [61.12007, 35.95992], [61.22719, 36.12759], [61.1393, 36.38782], [61.18187, 36.55348], [61.14516, 36.64644], [60.34767, 36.63214], [60.00768, 37.04102], [59.74678, 37.12499], [59.55178, 37.13594], [59.39385, 37.34257], [59.39797, 37.47892], [59.33507, 37.53146], [59.22905, 37.51161], [58.9338, 37.67374], [58.6921, 37.64548], [58.5479, 37.70526], [58.47786, 37.6433], [58.39959, 37.63134], [58.22999, 37.6856], [58.21399, 37.77281], [57.79534, 37.89299], [57.35042, 37.98546], [57.37236, 38.09321], [57.21169, 38.28965], [57.03453, 38.18717], [56.73928, 38.27887], [56.62255, 38.24005], [56.43303, 38.26054], [56.32454, 38.18502], [56.33278, 38.08132], [55.97847, 38.08024], [55.76561, 38.12238], [55.44152, 38.08564], [55.13412, 37.94705], [54.851, 37.75739], [54.77684, 37.62264], [54.81804, 37.61285], [54.77822, 37.51597], [54.67247, 37.43532], [54.58664, 37.45809], [54.36211, 37.34912], [54.24565, 37.32047], [53.89734, 37.3464], [48.88288, 38.43975], [48.84969, 38.45015], [48.81072, 38.44853], [48.78979, 38.45026], [48.70001, 38.40564], [48.62217, 38.40198], [48.58793, 38.45076], [48.45084, 38.61013], [48.3146, 38.59958], [48.24773, 38.71883], [48.02581, 38.82705], [48.01409, 38.90333], [48.07734, 38.91616], [48.08627, 38.94434], [48.28437, 38.97186], [48.33884, 39.03022], [48.31239, 39.09278], [48.15361, 39.19419], [48.12404, 39.25208], [48.15984, 39.30028], [48.37385, 39.37584], [48.34264, 39.42935], [47.98977, 39.70999], [47.84774, 39.66285], [47.50099, 39.49615], [47.38978, 39.45999], [47.31301, 39.37492], [47.05927, 39.24846], [47.05771, 39.20143], [46.95341, 39.13505], [46.92539, 39.16644], [46.83822, 39.13143], [46.75752, 39.03231], [46.53497, 38.86548], [46.34059, 38.92076], [46.20601, 38.85262], [46.14785, 38.84206], [46.06766, 38.87861], [46.00228, 38.87376], [45.94624, 38.89072], [45.90266, 38.87739], [45.83883, 38.90768], [45.65172, 38.95199], [45.6155, 38.94304], [45.6131, 38.964], [45.44966, 38.99243], [45.44811, 39.04927], [45.40452, 39.07224], [45.40148, 39.09007], [45.30489, 39.18333], [45.16168, 39.21952], [45.08751, 39.35052], [45.05932, 39.36435], [44.96746, 39.42998]]]] } },
20621     { type: "Feature", properties: { iso1A2: "IS", iso1A3: "ISL", iso1N3: "352", wikidata: "Q189", nameEn: "Iceland", groups: ["154", "150", "UN"], callingCodes: ["354"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-33.15676, 62.62995], [-8.25539, 63.0423], [-15.70914, 69.67442], [-33.15676, 62.62995]]]] } },
20622     { type: "Feature", properties: { iso1A2: "IT", iso1A3: "ITA", iso1N3: "380", wikidata: "Q38", nameEn: "Italy", groups: ["EU", "039", "150", "UN"], callingCodes: ["39"] }, geometry: { type: "MultiPolygon", coordinates: [[[[8.95861, 45.96485], [8.97604, 45.96151], [8.97741, 45.98317], [8.96668, 45.98436], [8.95861, 45.96485]]], [[[7.63035, 43.57419], [9.56115, 43.20816], [10.09675, 41.44089], [7.60802, 41.05927], [7.89009, 38.19924], [11.2718, 37.6713], [12.13667, 34.20326], [14.02721, 36.53141], [17.67657, 35.68918], [18.83516, 40.36999], [16.15283, 42.18525], [13.12821, 44.48877], [13.05142, 45.33128], [13.45644, 45.59464], [13.6076, 45.64761], [13.7198, 45.59352], [13.74587, 45.59811], [13.78445, 45.5825], [13.84106, 45.58185], [13.86771, 45.59898], [13.8695, 45.60835], [13.9191, 45.6322], [13.87933, 45.65207], [13.83422, 45.68703], [13.83332, 45.70855], [13.8235, 45.7176], [13.66986, 45.79955], [13.59784, 45.8072], [13.58858, 45.83503], [13.57563, 45.8425], [13.58644, 45.88173], [13.59565, 45.89446], [13.60857, 45.89907], [13.61931, 45.91782], [13.63815, 45.93607], [13.6329, 45.94894], [13.64307, 45.98326], [13.63458, 45.98947], [13.62074, 45.98388], [13.58903, 45.99009], [13.56759, 45.96991], [13.52963, 45.96588], [13.50104, 45.98078], [13.47474, 46.00546], [13.49702, 46.01832], [13.50998, 46.04498], [13.49568, 46.04839], [13.50104, 46.05986], [13.57072, 46.09022], [13.64053, 46.13587], [13.66472, 46.17392], [13.64451, 46.18966], [13.56682, 46.18703], [13.56114, 46.2054], [13.47587, 46.22725], [13.42218, 46.20758], [13.37671, 46.29668], [13.44808, 46.33507], [13.43418, 46.35992], [13.47019, 46.3621], [13.5763, 46.40915], [13.5763, 46.42613], [13.59777, 46.44137], [13.68684, 46.43881], [13.7148, 46.5222], [13.64088, 46.53438], [13.27627, 46.56059], [12.94445, 46.60401], [12.59992, 46.6595], [12.38708, 46.71529], [12.27591, 46.88651], [12.2006, 46.88854], [12.11675, 47.01241], [12.21781, 47.03996], [12.19254, 47.09331], [11.74789, 46.98484], [11.50739, 47.00644], [11.33355, 46.99862], [11.10618, 46.92966], [11.00764, 46.76896], [10.72974, 46.78972], [10.75753, 46.82258], [10.66405, 46.87614], [10.54783, 46.84505], [10.47197, 46.85698], [10.38659, 46.67847], [10.40475, 46.63671], [10.44686, 46.64162], [10.49375, 46.62049], [10.46136, 46.53164], [10.25309, 46.57432], [10.23674, 46.63484], [10.10307, 46.61003], [10.03715, 46.44479], [10.165, 46.41051], [10.10506, 46.3372], [10.17862, 46.25626], [10.14439, 46.22992], [10.07055, 46.21668], [9.95249, 46.38045], [9.73086, 46.35071], [9.71273, 46.29266], [9.57015, 46.2958], [9.46117, 46.37481], [9.45936, 46.50873], [9.40487, 46.46621], [9.36128, 46.5081], [9.28136, 46.49685], [9.25502, 46.43743], [9.29226, 46.32717], [9.24503, 46.23616], [9.01618, 46.04928], [8.99257, 45.9698], [9.09065, 45.89906], [9.06642, 45.8761], [9.04546, 45.84968], [9.04059, 45.8464], [9.03505, 45.83976], [9.03793, 45.83548], [9.03279, 45.82865], [9.0298, 45.82127], [9.00324, 45.82055], [8.99663, 45.83466], [8.9621, 45.83707], [8.94737, 45.84285], [8.91129, 45.8388], [8.93504, 45.86245], [8.94372, 45.86587], [8.93649, 45.86775], [8.88904, 45.95465], [8.86688, 45.96135], [8.85121, 45.97239], [8.8319, 45.9879], [8.79362, 45.99207], [8.78585, 45.98973], [8.79414, 46.00913], [8.85617, 46.0748], [8.80778, 46.10085], [8.75697, 46.10395], [8.62242, 46.12112], [8.45032, 46.26869], [8.46317, 46.43712], [8.42464, 46.46367], [8.30648, 46.41587], [8.31162, 46.38044], [8.08814, 46.26692], [8.16866, 46.17817], [8.11383, 46.11577], [8.02906, 46.10331], [7.98881, 45.99867], [7.9049, 45.99945], [7.85949, 45.91485], [7.56343, 45.97421], [7.10685, 45.85653], [7.04151, 45.92435], [6.95315, 45.85163], [6.80785, 45.83265], [6.80785, 45.71864], [6.98948, 45.63869], [7.00037, 45.509], [7.18019, 45.40071], [7.10572, 45.32924], [7.13115, 45.25386], [7.07074, 45.21228], [6.96706, 45.20841], [6.85144, 45.13226], [6.7697, 45.16044], [6.62803, 45.11175], [6.66981, 45.02324], [6.74791, 45.01939], [6.74519, 44.93661], [6.75518, 44.89915], [6.90774, 44.84322], [6.93499, 44.8664], [7.02217, 44.82519], [7.00401, 44.78782], [7.07484, 44.68073], [7.00582, 44.69364], [6.95133, 44.66264], [6.96042, 44.62129], [6.85507, 44.53072], [6.86233, 44.49834], [6.94504, 44.43112], [6.88784, 44.42043], [6.89171, 44.36637], [6.98221, 44.28289], [7.00764, 44.23736], [7.16929, 44.20352], [7.27827, 44.1462], [7.34547, 44.14359], [7.36364, 44.11882], [7.62155, 44.14881], [7.63245, 44.17877], [7.68694, 44.17487], [7.66878, 44.12795], [7.72508, 44.07578], [7.6597, 44.03009], [7.66848, 43.99943], [7.65266, 43.9763], [7.60771, 43.95772], [7.56858, 43.94506], [7.56075, 43.89932], [7.51162, 43.88301], [7.49355, 43.86551], [7.50423, 43.84345], [7.53006, 43.78405], [7.63035, 43.57419]], [[12.45181, 41.90056], [12.44834, 41.90095], [12.44582, 41.90194], [12.44815, 41.90326], [12.44984, 41.90545], [12.45091, 41.90625], [12.45543, 41.90738], [12.45561, 41.90629], [12.45762, 41.9058], [12.45755, 41.9033], [12.45826, 41.90281], [12.45834, 41.90174], [12.4577, 41.90115], [12.45691, 41.90125], [12.45626, 41.90172], [12.45435, 41.90143], [12.45446, 41.90028], [12.45181, 41.90056]], [[12.45648, 43.89369], [12.44184, 43.90498], [12.41641, 43.89991], [12.40935, 43.9024], [12.41233, 43.90956], [12.40733, 43.92379], [12.41551, 43.92984], [12.41165, 43.93769], [12.40506, 43.94325], [12.40415, 43.95485], [12.41414, 43.95273], [12.42005, 43.9578], [12.43662, 43.95698], [12.44684, 43.96597], [12.46205, 43.97463], [12.47853, 43.98052], [12.49406, 43.98492], [12.50678, 43.99113], [12.51463, 43.99122], [12.5154, 43.98508], [12.51064, 43.98165], [12.51109, 43.97201], [12.50622, 43.97131], [12.50875, 43.96198], [12.50655, 43.95796], [12.51427, 43.94897], [12.51553, 43.94096], [12.50496, 43.93017], [12.50269, 43.92363], [12.49724, 43.92248], [12.49247, 43.91774], [12.49429, 43.90973], [12.48771, 43.89706], [12.45648, 43.89369]]]] } },
20623     { type: "Feature", properties: { iso1A2: "JE", iso1A3: "JEY", iso1N3: "832", wikidata: "Q785", nameEn: "Bailiwick of Jersey", country: "GB", groups: ["830", "Q185086", "154", "150", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44 01534"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-2.00491, 48.86706], [-1.83944, 49.23037], [-2.09454, 49.46288], [-2.65349, 49.15373], [-2.00491, 48.86706]]]] } },
20624     { type: "Feature", properties: { iso1A2: "JM", iso1A3: "JAM", iso1N3: "388", wikidata: "Q766", nameEn: "Jamaica", aliases: ["JA"], groups: ["029", "003", "419", "019", "UN"], driveSide: "left", callingCodes: ["1 876", "1 658"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-74.09729, 17.36817], [-78.9741, 19.59515], [-78.34606, 16.57862], [-74.09729, 17.36817]]]] } },
20625     { type: "Feature", properties: { iso1A2: "JO", iso1A3: "JOR", iso1N3: "400", wikidata: "Q810", nameEn: "Jordan", groups: ["145", "142", "UN"], callingCodes: ["962"] }, geometry: { type: "MultiPolygon", coordinates: [[[[39.04251, 32.30203], [38.98762, 32.47694], [39.08202, 32.50304], [38.79171, 33.37328], [36.83946, 32.31293], [36.40959, 32.37908], [36.23948, 32.50108], [36.20875, 32.49529], [36.20379, 32.52751], [36.08074, 32.51463], [36.02239, 32.65911], [35.96633, 32.66237], [35.93307, 32.71966], [35.88405, 32.71321], [35.75983, 32.74803], [35.68467, 32.70715], [35.66527, 32.681], [35.61669, 32.67999], [35.59813, 32.65159], [35.56614, 32.64393], [35.57485, 32.48669], [35.55494, 32.42687], [35.55807, 32.38674], [35.57111, 32.21877], [35.52012, 32.04076], [35.54375, 31.96587], [35.52758, 31.9131], [35.55941, 31.76535], [35.47672, 31.49578], [35.40316, 31.25535], [35.43658, 31.12444], [35.41371, 30.95565], [35.33984, 30.8802], [35.33456, 30.81224], [35.29311, 30.71365], [35.21379, 30.60401], [35.19595, 30.50297], [35.16218, 30.43535], [35.19183, 30.34636], [35.14108, 30.07374], [35.02147, 29.66343], [34.98207, 29.58147], [34.97718, 29.54294], [34.92298, 29.45305], [34.8812, 29.36878], [36.07081, 29.18469], [36.50005, 29.49696], [36.75083, 29.86903], [37.4971, 29.99949], [37.66395, 30.33245], [37.99354, 30.49998], [36.99791, 31.50081], [38.99233, 31.99721], [39.29903, 32.23259], [39.26157, 32.35555], [39.04251, 32.30203]]]] } },
20626     { type: "Feature", properties: { iso1A2: "JP", iso1A3: "JPN", iso1N3: "392", wikidata: "Q17", nameEn: "Japan", groups: ["030", "142", "UN"], driveSide: "left", callingCodes: ["81"] }, geometry: { type: "MultiPolygon", coordinates: [[[[145.82361, 43.38904], [145.23667, 43.76813], [145.82343, 44.571], [140.9182, 45.92937], [133.61399, 37.41], [129.2669, 34.87122], [122.26612, 25.98197], [123.92912, 17.8782], [155.16731, 23.60141], [145.82361, 43.38904]]]] } },
20627     { type: "Feature", properties: { iso1A2: "KE", iso1A3: "KEN", iso1N3: "404", wikidata: "Q114", nameEn: "Kenya", groups: ["014", "202", "002", "UN"], driveSide: "left", callingCodes: ["254"] }, geometry: { type: "MultiPolygon", coordinates: [[[[35.9419, 4.61933], [35.51424, 4.61643], [35.42366, 4.76969], [35.47843, 4.91872], [35.30992, 4.90402], [35.34151, 5.02364], [34.47601, 4.72162], [33.9873, 4.23316], [34.06046, 4.15235], [34.15429, 3.80464], [34.45815, 3.67385], [34.44922, 3.51627], [34.39112, 3.48802], [34.41794, 3.44342], [34.40006, 3.37949], [34.45815, 3.18319], [34.56242, 3.11478], [34.60114, 2.93034], [34.65774, 2.8753], [34.73967, 2.85447], [34.78137, 2.76223], [34.77244, 2.70272], [34.95267, 2.47209], [34.90947, 2.42447], [34.98692, 1.97348], [34.9899, 1.6668], [34.92734, 1.56109], [34.87819, 1.5596], [34.7918, 1.36752], [34.82606, 1.30944], [34.82606, 1.26626], [34.80223, 1.22754], [34.67562, 1.21265], [34.58029, 1.14712], [34.57427, 1.09868], [34.52369, 1.10692], [34.43349, 0.85254], [34.40041, 0.80266], [34.31516, 0.75693], [34.27345, 0.63182], [34.20196, 0.62289], [34.13493, 0.58118], [34.11408, 0.48884], [34.08727, 0.44713], [34.10067, 0.36372], [33.90936, 0.10581], [33.98449, -0.13079], [33.9264, -0.54188], [33.93107, -0.99298], [34.02286, -1.00779], [34.03084, -1.05101], [34.0824, -1.02264], [37.67199, -3.06222], [37.71745, -3.304], [37.5903, -3.42735], [37.63099, -3.50723], [37.75036, -3.54243], [37.81321, -3.69179], [39.21631, -4.67835], [39.44306, -4.93877], [39.62121, -4.68136], [41.75542, -1.85308], [41.56362, -1.66375], [41.56, -1.59812], [41.00099, -0.83068], [40.98767, 2.82959], [41.31368, 3.14314], [41.89488, 3.97375], [41.1754, 3.94079], [40.77498, 4.27683], [39.86043, 3.86974], [39.76808, 3.67058], [39.58339, 3.47434], [39.55132, 3.39634], [39.51551, 3.40895], [39.49444, 3.45521], [39.19954, 3.47834], [39.07736, 3.5267], [38.91938, 3.51198], [38.52336, 3.62551], [38.45812, 3.60445], [38.14168, 3.62487], [37.07724, 4.33503], [36.84474, 4.44518], [36.03924, 4.44406], [35.95449, 4.53244], [35.9419, 4.61933]]]] } },
20628     { type: "Feature", properties: { iso1A2: "KG", iso1A3: "KGZ", iso1N3: "417", wikidata: "Q813", nameEn: "Kyrgyzstan", groups: ["143", "142", "UN"], callingCodes: ["996"] }, geometry: { type: "MultiPolygon", coordinates: [[[[74.88756, 42.98612], [74.75, 42.99029], [74.70331, 43.02519], [74.64615, 43.05881], [74.57491, 43.13702], [74.22489, 43.24657], [73.55634, 43.03071], [73.50992, 42.82356], [73.44393, 42.43098], [71.88792, 42.83578], [71.62405, 42.76613], [71.53272, 42.8014], [71.2724, 42.77853], [71.22785, 42.69248], [71.17807, 42.67381], [71.15232, 42.60486], [70.97717, 42.50147], [70.85973, 42.30188], [70.94483, 42.26238], [71.13263, 42.28356], [71.28719, 42.18033], [70.69777, 41.92554], [70.17682, 41.5455], [70.48909, 41.40335], [70.67586, 41.47953], [70.78572, 41.36419], [70.77885, 41.24813], [70.86263, 41.23833], [70.9615, 41.16393], [71.02193, 41.19494], [71.11806, 41.15359], [71.25813, 41.18796], [71.27187, 41.11015], [71.34877, 41.16807], [71.40198, 41.09436], [71.46148, 41.13958], [71.43814, 41.19644], [71.46688, 41.31883], [71.57227, 41.29175], [71.6787, 41.42111], [71.65914, 41.49599], [71.73054, 41.54713], [71.71132, 41.43012], [71.76625, 41.4466], [71.83914, 41.3546], [71.91457, 41.2982], [71.85964, 41.19081], [72.07249, 41.11739], [72.10745, 41.15483], [72.16433, 41.16483], [72.17594, 41.15522], [72.14864, 41.13363], [72.1792, 41.10621], [72.21061, 41.05607], [72.17594, 41.02377], [72.18339, 40.99571], [72.324, 41.03381], [72.34026, 41.04539], [72.34757, 41.06104], [72.36138, 41.04384], [72.38511, 41.02785], [72.45206, 41.03018], [72.48742, 40.97136], [72.55109, 40.96046], [72.59136, 40.86947], [72.68157, 40.84942], [72.84291, 40.85512], [72.94454, 40.8094], [73.01869, 40.84681], [73.13267, 40.83512], [73.13412, 40.79122], [73.0612, 40.76678], [72.99133, 40.76457], [72.93296, 40.73089], [72.8722, 40.71111], [72.85372, 40.7116], [72.84754, 40.67229], [72.80137, 40.67856], [72.74866, 40.60873], [72.74894, 40.59592], [72.75982, 40.57273], [72.74862, 40.57131], [72.74768, 40.58051], [72.73995, 40.58409], [72.69579, 40.59778], [72.66713, 40.59076], [72.66713, 40.5219], [72.47795, 40.5532], [72.40517, 40.61917], [72.34406, 40.60144], [72.41714, 40.55736], [72.38384, 40.51535], [72.41513, 40.50856], [72.44191, 40.48222], [72.40346, 40.4007], [72.24368, 40.46091], [72.18648, 40.49893], [71.96401, 40.31907], [72.05464, 40.27586], [71.85002, 40.25647], [71.82646, 40.21872], [71.73054, 40.14818], [71.71719, 40.17886], [71.69621, 40.18492], [71.70569, 40.20391], [71.68386, 40.26984], [71.61931, 40.26775], [71.61725, 40.20615], [71.51549, 40.22986], [71.51215, 40.26943], [71.4246, 40.28619], [71.36663, 40.31593], [71.13042, 40.34106], [71.05901, 40.28765], [70.95789, 40.28761], [70.9818, 40.22392], [70.80495, 40.16813], [70.7928, 40.12797], [70.65827, 40.0981], [70.65946, 39.9878], [70.58912, 39.95211], [70.55033, 39.96619], [70.47557, 39.93216], [70.57384, 39.99394], [70.58297, 40.00891], [70.01283, 40.23288], [69.67001, 40.10639], [69.64704, 40.12165], [69.57615, 40.10524], [69.55555, 40.12296], [69.53794, 40.11833], [69.53855, 40.0887], [69.5057, 40.03277], [69.53615, 39.93991], [69.43557, 39.92877], [69.43134, 39.98431], [69.35649, 40.01994], [69.26938, 39.8127], [69.3594, 39.52516], [69.68677, 39.59281], [69.87491, 39.53882], [70.11111, 39.58223], [70.2869, 39.53141], [70.44757, 39.60128], [70.64087, 39.58792], [70.7854, 39.38933], [71.06418, 39.41586], [71.08752, 39.50704], [71.49814, 39.61397], [71.55856, 39.57588], [71.5517, 39.45722], [71.62688, 39.44056], [71.76816, 39.45456], [71.80164, 39.40631], [71.7522, 39.32031], [71.79202, 39.27355], [71.90601, 39.27674], [72.04059, 39.36704], [72.09689, 39.26823], [72.17242, 39.2661], [72.23834, 39.17248], [72.33173, 39.33093], [72.62027, 39.39696], [72.85934, 39.35116], [73.18454, 39.35536], [73.31912, 39.38615], [73.45096, 39.46677], [73.59831, 39.46425], [73.87018, 39.47879], [73.94683, 39.60733], [73.92354, 39.69565], [73.9051, 39.75073], [73.83006, 39.76136], [73.97049, 40.04378], [74.25533, 40.13191], [74.35063, 40.09742], [74.69875, 40.34668], [74.85996, 40.32857], [74.78168, 40.44886], [74.82013, 40.52197], [75.08243, 40.43945], [75.22834, 40.45382], [75.5854, 40.66874], [75.69663, 40.28642], [75.91361, 40.2948], [75.96168, 40.38064], [76.33659, 40.3482], [76.5261, 40.46114], [76.75681, 40.95354], [76.99302, 41.0696], [77.28004, 41.0033], [77.3693, 41.0375], [77.52723, 41.00227], [77.76206, 41.01574], [77.81287, 41.14307], [78.12873, 41.23091], [78.15757, 41.38565], [78.3732, 41.39603], [79.92977, 42.04113], [80.17842, 42.03211], [80.17807, 42.21166], [79.97364, 42.42816], [79.52921, 42.44778], [79.19763, 42.804], [78.91502, 42.76839], [78.48469, 42.89649], [75.82823, 42.94848], [75.72174, 42.79672], [75.29966, 42.86183], [75.22619, 42.85528], [74.88756, 42.98612]], [[70.74189, 39.86319], [70.63105, 39.77923], [70.59667, 39.83542], [70.54998, 39.85137], [70.52631, 39.86989], [70.53651, 39.89155], [70.74189, 39.86319]], [[71.86463, 39.98598], [71.84316, 39.95582], [71.7504, 39.93701], [71.71511, 39.96348], [71.78838, 40.01404], [71.86463, 39.98598]], [[71.21139, 40.03369], [71.1427, 39.95026], [71.23067, 39.93581], [71.16101, 39.88423], [71.10531, 39.91354], [71.04979, 39.89808], [71.10501, 39.95568], [71.09063, 39.99], [71.11668, 39.99291], [71.11037, 40.01984], [71.01035, 40.05481], [71.00236, 40.18154], [71.06305, 40.1771], [71.12218, 40.03052], [71.21139, 40.03369]]]] } },
20629     { type: "Feature", properties: { iso1A2: "KH", iso1A3: "KHM", iso1N3: "116", wikidata: "Q424", nameEn: "Cambodia", groups: ["035", "142", "UN"], callingCodes: ["855"] }, geometry: { type: "MultiPolygon", coordinates: [[[[105.87328, 11.55953], [105.81645, 11.56876], [105.80867, 11.60536], [105.8507, 11.66635], [105.88962, 11.67854], [105.95188, 11.63738], [106.00792, 11.7197], [106.02038, 11.77457], [106.06708, 11.77761], [106.13158, 11.73283], [106.18539, 11.75171], [106.26478, 11.72122], [106.30525, 11.67549], [106.37219, 11.69836], [106.44691, 11.66787], [106.45158, 11.68616], [106.41577, 11.76999], [106.44535, 11.8279], [106.44068, 11.86294], [106.4687, 11.86751], [106.4111, 11.97413], [106.70687, 11.96956], [106.79405, 12.0807], [106.92325, 12.06548], [106.99953, 12.08983], [107.15831, 12.27547], [107.34511, 12.33327], [107.42917, 12.24657], [107.4463, 12.29373], [107.55059, 12.36824], [107.5755, 12.52177], [107.55993, 12.7982], [107.49611, 12.88926], [107.49144, 13.01215], [107.62843, 13.3668], [107.61909, 13.52577], [107.53503, 13.73908], [107.45252, 13.78897], [107.46498, 13.91593], [107.44318, 13.99751], [107.38247, 13.99147], [107.35757, 14.02319], [107.37158, 14.07906], [107.33577, 14.11832], [107.40427, 14.24509], [107.39493, 14.32655], [107.44941, 14.41552], [107.48521, 14.40346], [107.52569, 14.54665], [107.52102, 14.59034], [107.55371, 14.628], [107.54361, 14.69092], [107.47238, 14.61523], [107.44435, 14.52785], [107.37897, 14.54443], [107.3276, 14.58812], [107.29803, 14.58963], [107.26534, 14.54292], [107.256, 14.48716], [107.21241, 14.48716], [107.17038, 14.41782], [107.09722, 14.3937], [107.03962, 14.45099], [107.04585, 14.41782], [106.98825, 14.36806], [106.9649, 14.3198], [106.90574, 14.33639], [106.8497, 14.29416], [106.80767, 14.31226], [106.73762, 14.42687], [106.63333, 14.44194], [106.59908, 14.50977], [106.57106, 14.50525], [106.54148, 14.59565], [106.50723, 14.58963], [106.45898, 14.55045], [106.47766, 14.50977], [106.43874, 14.52032], [106.40916, 14.45249], [106.32355, 14.44043], [106.25194, 14.48415], [106.21302, 14.36203], [106.00131, 14.36957], [105.99509, 14.32734], [106.02311, 14.30623], [106.04801, 14.20363], [106.10872, 14.18401], [106.11962, 14.11307], [106.18656, 14.06324], [106.16632, 14.01794], [106.10094, 13.98471], [106.10405, 13.9137], [105.90791, 13.92881], [105.78182, 14.02247], [105.78338, 14.08438], [105.5561, 14.15684], [105.44869, 14.10703], [105.36775, 14.09948], [105.2759, 14.17496], [105.20894, 14.34967], [105.17748, 14.34432], [105.14012, 14.23873], [105.08408, 14.20402], [105.02804, 14.23722], [104.97667, 14.38806], [104.69335, 14.42726], [104.55014, 14.36091], [104.27616, 14.39861], [103.93836, 14.3398], [103.70175, 14.38052], [103.71109, 14.4348], [103.53518, 14.42575], [103.39353, 14.35639], [103.16469, 14.33075], [102.93275, 14.19044], [102.91251, 14.01531], [102.77864, 13.93374], [102.72727, 13.77806], [102.56848, 13.69366], [102.5481, 13.6589], [102.58635, 13.6286], [102.62483, 13.60883], [102.57573, 13.60461], [102.5358, 13.56933], [102.44601, 13.5637], [102.36859, 13.57488], [102.33828, 13.55613], [102.361, 13.50551], [102.35563, 13.47307], [102.35692, 13.38274], [102.34611, 13.35618], [102.36001, 13.31142], [102.36146, 13.26006], [102.43422, 13.09061], [102.46011, 13.08057], [102.52275, 12.99813], [102.48694, 12.97537], [102.49335, 12.92711], [102.53053, 12.77506], [102.4994, 12.71736], [102.51963, 12.66117], [102.57567, 12.65358], [102.7796, 12.43781], [102.78116, 12.40284], [102.73134, 12.37091], [102.70176, 12.1686], [102.77026, 12.06815], [102.78427, 11.98746], [102.83957, 11.8519], [102.90973, 11.75613], [102.91449, 11.65512], [102.52395, 11.25257], [102.47649, 9.66162], [103.99198, 10.48391], [104.43778, 10.42386], [104.47963, 10.43046], [104.49869, 10.4057], [104.59018, 10.53073], [104.87933, 10.52833], [104.95094, 10.64003], [105.09571, 10.72722], [105.02722, 10.89236], [105.08326, 10.95656], [105.11449, 10.96332], [105.34011, 10.86179], [105.42884, 10.96878], [105.50045, 10.94586], [105.77751, 11.03671], [105.86376, 10.89839], [105.84603, 10.85873], [105.93403, 10.83853], [105.94535, 10.9168], [106.06708, 10.8098], [106.18539, 10.79451], [106.14301, 10.98176], [106.20095, 10.97795], [106.1757, 11.07301], [106.1527, 11.10476], [106.10444, 11.07879], [105.86782, 11.28343], [105.88962, 11.43605], [105.87328, 11.55953]]]] } },
20630     { type: "Feature", properties: { iso1A2: "KI", iso1A3: "KIR", iso1N3: "296", wikidata: "Q710", nameEn: "Kiribati", groups: ["057", "009", "UN"], driveSide: "left", callingCodes: ["686"] }, geometry: { type: "MultiPolygon", coordinates: [[[[169, 3.9], [169, -3.5], [178, -3.5], [178, 3.9], [169, 3.9]]], [[[-161.06795, 5.2462], [-158.12991, -1.86122], [-175.33482, -1.40631], [-175.31804, -7.54825], [-156.50903, -7.4975], [-156.48634, -15.52824], [-135.59706, -4.70473], [-161.06795, 5.2462]]]] } },
20631     { type: "Feature", properties: { iso1A2: "KM", iso1A3: "COM", iso1N3: "174", wikidata: "Q970", nameEn: "Comoros", groups: ["014", "202", "002", "UN"], callingCodes: ["269"] }, geometry: { type: "MultiPolygon", coordinates: [[[[42.63904, -10.02522], [43.28731, -13.97126], [45.4971, -11.75965], [42.63904, -10.02522]]]] } },
20632     { type: "Feature", properties: { iso1A2: "KN", iso1A3: "KNA", iso1N3: "659", wikidata: "Q763", nameEn: "St. Kitts and Nevis", groups: ["029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", callingCodes: ["1 869"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-62.29333, 17.43155], [-62.76692, 17.64353], [-63.09677, 17.21372], [-62.63813, 16.65446], [-62.29333, 17.43155]]]] } },
20633     { type: "Feature", properties: { iso1A2: "KP", iso1A3: "PRK", iso1N3: "408", wikidata: "Q423", nameEn: "North Korea", groups: ["030", "142", "UN"], callingCodes: ["850"] }, geometry: { type: "MultiPolygon", coordinates: [[[[130.26095, 42.9027], [130.09764, 42.91425], [130.12957, 42.98361], [129.96409, 42.97306], [129.95082, 43.01051], [129.8865, 43.00395], [129.85261, 42.96494], [129.83277, 42.86746], [129.80719, 42.79218], [129.7835, 42.76521], [129.77183, 42.69435], [129.75294, 42.59409], [129.72541, 42.43739], [129.60482, 42.44461], [129.54701, 42.37254], [129.42882, 42.44702], [129.28541, 42.41574], [129.22423, 42.3553], [129.22285, 42.26491], [129.15178, 42.17224], [128.96068, 42.06657], [128.94007, 42.03537], [128.04487, 42.01769], [128.15119, 41.74568], [128.30716, 41.60322], [128.20061, 41.40895], [128.18546, 41.41279], [128.12967, 41.37931], [128.03311, 41.39232], [128.02633, 41.42103], [127.92943, 41.44291], [127.29712, 41.49473], [127.17841, 41.59714], [126.90729, 41.79955], [126.60631, 41.65565], [126.53189, 41.35206], [126.242, 41.15454], [126.00335, 40.92835], [125.76869, 40.87908], [125.71172, 40.85223], [124.86913, 40.45387], [124.40719, 40.13655], [124.38556, 40.11047], [124.3322, 40.05573], [124.37089, 40.03004], [124.35029, 39.95639], [124.23201, 39.9248], [124.17532, 39.8232], [123.90497, 38.79949], [123.85601, 37.49093], [124.67666, 38.05679], [124.84224, 37.977], [124.87921, 37.80827], [125.06408, 37.66334], [125.37112, 37.62643], [125.81159, 37.72949], [126.13074, 37.70512], [126.18776, 37.74728], [126.19097, 37.81462], [126.24402, 37.83113], [126.43239, 37.84095], [126.46818, 37.80873], [126.56709, 37.76857], [126.59918, 37.76364], [126.66067, 37.7897], [126.68793, 37.83728], [126.68793, 37.9175], [126.67023, 37.95852], [126.84961, 38.0344], [126.88106, 38.10246], [126.95887, 38.1347], [126.95338, 38.17735], [127.04479, 38.25518], [127.15749, 38.30722], [127.38727, 38.33227], [127.49672, 38.30647], [127.55013, 38.32257], [128.02917, 38.31861], [128.27652, 38.41657], [128.31105, 38.58462], [128.37487, 38.62345], [128.65655, 38.61914], [131.95041, 41.5445], [130.65022, 42.32281], [130.66367, 42.38024], [130.64181, 42.41422], [130.60805, 42.4317], [130.56835, 42.43281], [130.55143, 42.52158], [130.50123, 42.61636], [130.44361, 42.54849], [130.41826, 42.6011], [130.2385, 42.71127], [130.23068, 42.80125], [130.26095, 42.9027]]]] } },
20634     { type: "Feature", properties: { iso1A2: "KR", iso1A3: "KOR", iso1N3: "410", wikidata: "Q884", nameEn: "South Korea", groups: ["030", "142", "UN"], callingCodes: ["82"] }, geometry: { type: "MultiPolygon", coordinates: [[[[133.11729, 37.53115], [128.65655, 38.61914], [128.37487, 38.62345], [128.31105, 38.58462], [128.27652, 38.41657], [128.02917, 38.31861], [127.55013, 38.32257], [127.49672, 38.30647], [127.38727, 38.33227], [127.15749, 38.30722], [127.04479, 38.25518], [126.95338, 38.17735], [126.95887, 38.1347], [126.88106, 38.10246], [126.84961, 38.0344], [126.67023, 37.95852], [126.68793, 37.9175], [126.68793, 37.83728], [126.66067, 37.7897], [126.59918, 37.76364], [126.56709, 37.76857], [126.46818, 37.80873], [126.43239, 37.84095], [126.24402, 37.83113], [126.19097, 37.81462], [126.18776, 37.74728], [126.13074, 37.70512], [125.81159, 37.72949], [125.37112, 37.62643], [125.06408, 37.66334], [124.87921, 37.80827], [124.84224, 37.977], [124.67666, 38.05679], [123.85601, 37.49093], [122.80525, 33.30571], [125.99728, 32.63328], [129.2669, 34.87122], [133.11729, 37.53115]]]] } },
20635     { type: "Feature", properties: { iso1A2: "KW", iso1A3: "KWT", iso1N3: "414", wikidata: "Q817", nameEn: "Kuwait", groups: ["145", "142", "UN"], callingCodes: ["965"] }, geometry: { type: "MultiPolygon", coordinates: [[[[49.00421, 28.81495], [48.59531, 29.66815], [48.40479, 29.85763], [48.17332, 30.02448], [48.06782, 30.02906], [48.01114, 29.98906], [47.7095, 30.10453], [47.37192, 30.10421], [47.15166, 30.01044], [46.89695, 29.50584], [46.5527, 29.10283], [47.46202, 29.0014], [47.58376, 28.83382], [47.59863, 28.66798], [47.70561, 28.5221], [48.42991, 28.53628], [49.00421, 28.81495]]]] } },
20636     { type: "Feature", properties: { iso1A2: "KY", iso1A3: "CYM", iso1N3: "136", wikidata: "Q5785", nameEn: "Cayman Islands", country: "GB", groups: ["BOTS", "029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1 345"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-82.11509, 19.60401], [-80.36068, 18.11751], [-79.32727, 20.06742], [-82.11509, 19.60401]]]] } },
20637     { type: "Feature", properties: { iso1A2: "KZ", iso1A3: "KAZ", iso1N3: "398", wikidata: "Q232", nameEn: "Kazakhstan", groups: ["143", "142", "UN"], callingCodes: ["7"] }, geometry: { type: "MultiPolygon", coordinates: [[[[68.90865, 55.38148], [68.19206, 55.18823], [68.26661, 55.09226], [68.21308, 54.98645], [65.20174, 54.55216], [65.24663, 54.35721], [65.11033, 54.33028], [64.97216, 54.4212], [63.97686, 54.29763], [64.02715, 54.22679], [63.91224, 54.20013], [63.80604, 54.27079], [62.58651, 54.05871], [62.56876, 53.94047], [62.45931, 53.90737], [62.38535, 54.03961], [62.00966, 54.04134], [62.03913, 53.94768], [61.65318, 54.02445], [61.56941, 53.95703], [61.47603, 54.08048], [61.3706, 54.08464], [61.26863, 53.92797], [60.99796, 53.93699], [61.14283, 53.90063], [61.22574, 53.80268], [60.90626, 53.62937], [61.55706, 53.57144], [61.57185, 53.50112], [61.37957, 53.45887], [61.29082, 53.50992], [61.14291, 53.41481], [61.19024, 53.30536], [62.14574, 53.09626], [62.12799, 52.99133], [62.0422, 52.96105], [61.23462, 53.03227], [61.05842, 52.92217], [60.71989, 52.75923], [60.71693, 52.66245], [60.84118, 52.63912], [60.84709, 52.52228], [60.98021, 52.50068], [61.05417, 52.35096], [60.78201, 52.22067], [60.72581, 52.15538], [60.48915, 52.15175], [60.19925, 51.99173], [59.99809, 51.98263], [60.09867, 51.87135], [60.50986, 51.7964], [60.36787, 51.66815], [60.5424, 51.61675], [60.92401, 51.61124], [60.95655, 51.48615], [61.50677, 51.40687], [61.55114, 51.32746], [61.6813, 51.25716], [61.56889, 51.23679], [61.4431, 50.80679], [60.81833, 50.6629], [60.31914, 50.67705], [60.17262, 50.83312], [60.01288, 50.8163], [59.81172, 50.54451], [59.51886, 50.49937], [59.48928, 50.64216], [58.87974, 50.70852], [58.3208, 51.15151], [57.75578, 51.13852], [57.74986, 50.93017], [57.44221, 50.88354], [57.17302, 51.11253], [56.17906, 50.93204], [56.11398, 50.7471], [55.67774, 50.54508], [54.72067, 51.03261], [54.56685, 51.01958], [54.71476, 50.61214], [54.55797, 50.52006], [54.41894, 50.61214], [54.46331, 50.85554], [54.12248, 51.11542], [53.69299, 51.23466], [53.46165, 51.49445], [52.54329, 51.48444], [52.36119, 51.74161], [51.8246, 51.67916], [51.77431, 51.49536], [51.301, 51.48799], [51.26254, 51.68466], [50.59695, 51.61859], [50.26859, 51.28677], [49.97277, 51.2405], [49.76866, 51.11067], [49.39001, 51.09396], [49.41959, 50.85927], [49.12673, 50.78639], [48.86936, 50.61589], [48.57946, 50.63278], [48.90782, 50.02281], [48.68352, 49.89546], [48.42564, 49.82283], [48.24519, 49.86099], [48.10044, 50.09242], [47.58551, 50.47867], [47.30448, 50.30894], [47.34589, 50.09308], [47.18319, 49.93721], [46.9078, 49.86707], [46.78398, 49.34026], [47.04658, 49.19834], [47.00857, 49.04921], [46.78392, 48.95352], [46.49011, 48.43019], [47.11516, 48.27188], [47.12107, 47.83687], [47.38731, 47.68176], [47.41689, 47.83687], [47.64973, 47.76559], [48.15348, 47.74545], [48.45173, 47.40818], [48.52326, 47.4102], [49.01136, 46.72716], [48.51142, 46.69268], [48.54988, 46.56267], [49.16518, 46.38542], [49.32259, 46.26944], [49.88945, 46.04554], [49.2134, 44.84989], [52.26048, 41.69249], [52.47884, 41.78034], [52.97575, 42.1308], [54.20635, 42.38477], [54.95182, 41.92424], [55.45471, 41.25609], [56.00314, 41.32584], [55.97584, 44.99322], [55.97584, 44.99328], [55.97584, 44.99338], [55.97584, 44.99343], [55.97584, 44.99348], [55.97584, 44.99353], [55.97584, 44.99359], [55.97584, 44.99369], [55.97584, 44.99374], [55.97584, 44.99384], [55.97584, 44.9939], [55.97584, 44.994], [55.97584, 44.99405], [55.97584, 44.99415], [55.97584, 44.99421], [55.97584, 44.99426], [55.97584, 44.99431], [55.97584, 44.99436], [55.97584, 44.99441], [55.97594, 44.99446], [55.97605, 44.99452], [55.97605, 44.99457], [55.97605, 44.99462], [55.97605, 44.99467], [55.97605, 44.99477], [55.97615, 44.99477], [55.97615, 44.99483], [55.97615, 44.99493], [55.97615, 44.99498], [55.97615, 44.99503], [55.97615, 44.99508], [55.97625, 44.99514], [55.97636, 44.99519], [55.97636, 44.99524], [55.97646, 44.99529], [55.97646, 44.99534], [55.97656, 44.99539], [55.97667, 44.99545], [55.97677, 44.9955], [55.97677, 44.99555], [55.97677, 44.9956], [55.97687, 44.9956], [55.97698, 44.99565], [55.97698, 44.9957], [55.97708, 44.99576], [55.97718, 44.99581], [55.97729, 44.99586], [55.97739, 44.99586], [55.97739, 44.99591], [55.97749, 44.99591], [55.9776, 44.99591], [55.9777, 44.99596], [55.9777, 44.99601], [55.9778, 44.99607], [55.97791, 44.99607], [55.97801, 44.99607], [55.97801, 44.99612], [55.97811, 44.99617], [55.97822, 44.99617], [55.97832, 44.99622], [55.97842, 44.99622], [58.59711, 45.58671], [61.01475, 44.41383], [62.01711, 43.51008], [63.34656, 43.64003], [64.53885, 43.56941], [64.96464, 43.74748], [65.18666, 43.48835], [65.53277, 43.31856], [65.85194, 42.85481], [66.09482, 42.93426], [66.00546, 41.94455], [66.53302, 41.87388], [66.69129, 41.1311], [67.9644, 41.14611], [67.98511, 41.02794], [68.08273, 41.08148], [68.1271, 41.0324], [67.96736, 40.83798], [68.49983, 40.56437], [68.63, 40.59358], [68.58444, 40.91447], [68.49983, 40.99669], [68.62221, 41.03019], [68.65662, 40.93861], [68.73945, 40.96989], [68.7217, 41.05025], [69.01308, 41.22804], [69.05006, 41.36183], [69.15137, 41.43078], [69.17701, 41.43769], [69.18528, 41.45175], [69.20439, 41.45391], [69.22671, 41.46298], [69.23332, 41.45847], [69.25059, 41.46693], [69.29778, 41.43673], [69.35554, 41.47211], [69.37468, 41.46555], [69.45081, 41.46246], [69.39485, 41.51518], [69.45751, 41.56863], [69.49545, 41.545], [70.94483, 42.26238], [70.85973, 42.30188], [70.97717, 42.50147], [71.15232, 42.60486], [71.17807, 42.67381], [71.22785, 42.69248], [71.2724, 42.77853], [71.53272, 42.8014], [71.62405, 42.76613], [71.88792, 42.83578], [73.44393, 42.43098], [73.50992, 42.82356], [73.55634, 43.03071], [74.22489, 43.24657], [74.57491, 43.13702], [74.64615, 43.05881], [74.70331, 43.02519], [74.75, 42.99029], [74.88756, 42.98612], [75.22619, 42.85528], [75.29966, 42.86183], [75.72174, 42.79672], [75.82823, 42.94848], [78.48469, 42.89649], [78.91502, 42.76839], [79.19763, 42.804], [79.52921, 42.44778], [79.97364, 42.42816], [80.17807, 42.21166], [80.26841, 42.23797], [80.16892, 42.61137], [80.26886, 42.8366], [80.38169, 42.83142], [80.58999, 42.9011], [80.3735, 43.01557], [80.62913, 43.141], [80.78817, 43.14235], [80.77771, 43.30065], [80.69718, 43.32589], [80.75156, 43.44948], [80.40031, 44.10986], [80.40229, 44.23319], [80.38384, 44.63073], [79.8987, 44.89957], [80.11169, 45.03352], [81.73278, 45.3504], [82.51374, 45.1755], [82.58474, 45.40027], [82.21792, 45.56619], [83.04622, 47.19053], [83.92184, 46.98912], [84.73077, 47.01394], [84.93995, 46.87399], [85.22443, 47.04816], [85.54294, 47.06171], [85.69696, 47.2898], [85.61067, 47.49753], [85.5169, 48.05493], [85.73581, 48.3939], [86.38069, 48.46064], [86.75343, 48.70331], [86.73568, 48.99918], [86.87238, 49.12432], [87.28386, 49.11626], [87.31465, 49.23603], [87.03071, 49.25142], [86.82606, 49.51796], [86.61307, 49.60239], [86.79056, 49.74787], [86.63674, 49.80136], [86.18709, 49.50259], [85.24047, 49.60239], [84.99198, 50.06793], [84.29385, 50.27257], [83.8442, 50.87375], [83.14607, 51.00796], [82.55443, 50.75412], [81.94999, 50.79307], [81.46581, 50.77658], [81.41248, 50.97524], [81.06091, 50.94833], [81.16999, 51.15662], [80.80318, 51.28262], [80.44819, 51.20855], [80.4127, 50.95581], [80.08138, 50.77658], [79.11255, 52.01171], [77.90383, 53.29807], [76.54243, 53.99329], [76.44076, 54.16017], [76.82266, 54.1798], [76.91052, 54.4677], [75.3668, 54.07439], [75.43398, 53.98652], [75.07405, 53.80831], [73.39218, 53.44623], [73.25412, 53.61532], [73.68921, 53.86522], [73.74778, 54.07194], [73.37963, 53.96132], [72.71026, 54.1161], [72.43415, 53.92685], [72.17477, 54.36303], [71.96141, 54.17736], [71.10379, 54.13326], [71.08706, 54.33376], [71.24185, 54.64965], [71.08288, 54.71253], [70.96009, 55.10558], [70.76493, 55.3027], [70.19179, 55.1476], [69.74917, 55.35545], [69.34224, 55.36344], [68.90865, 55.38148]]]] } },
20638     { type: "Feature", properties: { iso1A2: "LA", iso1A3: "LAO", iso1N3: "418", wikidata: "Q819", nameEn: "Laos", groups: ["035", "142", "UN"], callingCodes: ["856"] }, geometry: { type: "MultiPolygon", coordinates: [[[[102.1245, 22.43372], [102.03633, 22.46164], [101.98487, 22.42766], [101.91344, 22.44417], [101.90714, 22.38688], [101.86828, 22.38397], [101.7685, 22.50337], [101.68973, 22.46843], [101.61306, 22.27515], [101.56789, 22.28876], [101.53638, 22.24794], [101.60675, 22.13513], [101.57525, 22.13026], [101.62566, 21.96574], [101.7791, 21.83019], [101.74555, 21.72852], [101.83257, 21.61562], [101.80001, 21.57461], [101.7475, 21.5873], [101.7727, 21.51794], [101.74224, 21.48276], [101.74014, 21.30967], [101.84412, 21.25291], [101.83887, 21.20983], [101.76745, 21.21571], [101.79266, 21.19025], [101.7622, 21.14813], [101.70548, 21.14911], [101.66977, 21.20004], [101.60886, 21.17947], [101.59491, 21.18621], [101.6068, 21.23329], [101.54563, 21.25668], [101.29326, 21.17254], [101.2229, 21.23271], [101.26912, 21.36482], [101.19349, 21.41959], [101.2124, 21.56422], [101.15156, 21.56129], [101.16198, 21.52808], [101.00234, 21.39612], [100.80173, 21.2934], [100.72716, 21.31786], [100.63578, 21.05639], [100.55281, 21.02796], [100.50974, 20.88574], [100.64628, 20.88279], [100.60112, 20.8347], [100.51079, 20.82194], [100.36375, 20.82783], [100.1957, 20.68247], [100.08404, 20.36626], [100.09999, 20.31614], [100.09337, 20.26293], [100.11785, 20.24787], [100.1712, 20.24324], [100.16668, 20.2986], [100.22076, 20.31598], [100.25769, 20.3992], [100.33383, 20.4028], [100.37439, 20.35156], [100.41473, 20.25625], [100.44992, 20.23644], [100.4537, 20.19971], [100.47567, 20.19133], [100.51052, 20.14928], [100.55218, 20.17741], [100.58808, 20.15791], [100.5094, 19.87904], [100.398, 19.75047], [100.49604, 19.53504], [100.58219, 19.49164], [100.64606, 19.55884], [100.77231, 19.48324], [100.90302, 19.61901], [101.08928, 19.59748], [101.26545, 19.59242], [101.26991, 19.48324], [101.21347, 19.46223], [101.20604, 19.35296], [101.24911, 19.33334], [101.261, 19.12717], [101.35606, 19.04716], [101.25803, 18.89545], [101.22832, 18.73377], [101.27585, 18.68875], [101.06047, 18.43247], [101.18227, 18.34367], [101.15108, 18.25624], [101.19118, 18.2125], [101.1793, 18.0544], [101.02185, 17.87637], [100.96541, 17.57926], [101.15108, 17.47586], [101.44667, 17.7392], [101.72294, 17.92867], [101.78087, 18.07559], [101.88485, 18.02474], [102.11359, 18.21532], [102.45523, 17.97106], [102.59234, 17.96127], [102.60971, 17.95411], [102.61432, 17.92273], [102.5896, 17.84889], [102.59485, 17.83537], [102.68194, 17.80151], [102.69946, 17.81686], [102.67543, 17.84529], [102.68538, 17.86653], [102.75954, 17.89561], [102.79044, 17.93612], [102.81988, 17.94233], [102.86323, 17.97531], [102.95812, 18.0054], [102.9912, 17.9949], [103.01998, 17.97095], [103.0566, 18.00144], [103.07823, 18.03833], [103.07343, 18.12351], [103.1493, 18.17799], [103.14994, 18.23172], [103.17093, 18.2618], [103.29757, 18.30475], [103.23818, 18.34875], [103.24779, 18.37807], [103.30977, 18.4341], [103.41044, 18.4486], [103.47773, 18.42841], [103.60957, 18.40528], [103.699, 18.34125], [103.82449, 18.33979], [103.85642, 18.28666], [103.93916, 18.33914], [103.97725, 18.33631], [104.06533, 18.21656], [104.10927, 18.10826], [104.21776, 17.99335], [104.2757, 17.86139], [104.35432, 17.82871], [104.45404, 17.66788], [104.69867, 17.53038], [104.80061, 17.39367], [104.80716, 17.19025], [104.73712, 17.01404], [104.7373, 16.91125], [104.76442, 16.84752], [104.7397, 16.81005], [104.76099, 16.69302], [104.73349, 16.565], [104.88057, 16.37311], [105.00262, 16.25627], [105.06204, 16.09792], [105.42001, 16.00657], [105.38508, 15.987], [105.34115, 15.92737], [105.37959, 15.84074], [105.42285, 15.76971], [105.46573, 15.74742], [105.61756, 15.68792], [105.60446, 15.53301], [105.58191, 15.41031], [105.47635, 15.3796], [105.4692, 15.33709], [105.50662, 15.32054], [105.58043, 15.32724], [105.46661, 15.13132], [105.61162, 15.00037], [105.5121, 14.80802], [105.53864, 14.55731], [105.43783, 14.43865], [105.20894, 14.34967], [105.2759, 14.17496], [105.36775, 14.09948], [105.44869, 14.10703], [105.5561, 14.15684], [105.78338, 14.08438], [105.78182, 14.02247], [105.90791, 13.92881], [106.10405, 13.9137], [106.10094, 13.98471], [106.16632, 14.01794], [106.18656, 14.06324], [106.11962, 14.11307], [106.10872, 14.18401], [106.04801, 14.20363], [106.02311, 14.30623], [105.99509, 14.32734], [106.00131, 14.36957], [106.21302, 14.36203], [106.25194, 14.48415], [106.32355, 14.44043], [106.40916, 14.45249], [106.43874, 14.52032], [106.47766, 14.50977], [106.45898, 14.55045], [106.50723, 14.58963], [106.54148, 14.59565], [106.57106, 14.50525], [106.59908, 14.50977], [106.63333, 14.44194], [106.73762, 14.42687], [106.80767, 14.31226], [106.8497, 14.29416], [106.90574, 14.33639], [106.9649, 14.3198], [106.98825, 14.36806], [107.04585, 14.41782], [107.03962, 14.45099], [107.09722, 14.3937], [107.17038, 14.41782], [107.21241, 14.48716], [107.256, 14.48716], [107.26534, 14.54292], [107.29803, 14.58963], [107.3276, 14.58812], [107.37897, 14.54443], [107.44435, 14.52785], [107.47238, 14.61523], [107.54361, 14.69092], [107.51579, 14.79282], [107.59285, 14.87795], [107.48277, 14.93751], [107.46516, 15.00982], [107.61486, 15.0566], [107.61926, 15.13949], [107.58844, 15.20111], [107.62587, 15.2266], [107.60605, 15.37524], [107.62367, 15.42193], [107.53341, 15.40496], [107.50699, 15.48771], [107.3815, 15.49832], [107.34408, 15.62345], [107.27583, 15.62769], [107.27143, 15.71459], [107.21859, 15.74638], [107.21419, 15.83747], [107.34188, 15.89464], [107.39471, 15.88829], [107.46296, 16.01106], [107.44975, 16.08511], [107.33968, 16.05549], [107.25822, 16.13587], [107.14595, 16.17816], [107.15035, 16.26271], [107.09091, 16.3092], [107.02597, 16.31132], [106.97385, 16.30204], [106.96638, 16.34938], [106.88067, 16.43594], [106.88727, 16.52671], [106.84104, 16.55415], [106.74418, 16.41904], [106.65832, 16.47816], [106.66052, 16.56892], [106.61477, 16.60713], [106.58267, 16.6012], [106.59013, 16.62259], [106.55485, 16.68704], [106.55265, 16.86831], [106.52183, 16.87884], [106.51963, 16.92097], [106.54824, 16.92729], [106.55045, 17.0031], [106.50862, 16.9673], [106.43597, 17.01362], [106.31929, 17.20509], [106.29287, 17.3018], [106.24444, 17.24714], [106.18991, 17.28227], [106.09019, 17.36399], [105.85744, 17.63221], [105.76612, 17.67147], [105.60381, 17.89356], [105.64784, 17.96687], [105.46292, 18.22008], [105.38366, 18.15315], [105.15942, 18.38691], [105.10408, 18.43533], [105.1327, 18.58355], [105.19654, 18.64196], [105.12829, 18.70453], [104.64617, 18.85668], [104.5361, 18.97747], [103.87125, 19.31854], [104.06058, 19.43484], [104.10832, 19.51575], [104.05617, 19.61743], [104.06498, 19.66926], [104.23229, 19.70242], [104.41281, 19.70035], [104.53169, 19.61743], [104.64837, 19.62365], [104.68359, 19.72729], [104.8355, 19.80395], [104.8465, 19.91783], [104.9874, 20.09573], [104.91695, 20.15567], [104.86852, 20.14121], [104.61315, 20.24452], [104.62195, 20.36633], [104.72102, 20.40554], [104.66158, 20.47774], [104.47886, 20.37459], [104.40621, 20.3849], [104.38199, 20.47155], [104.63957, 20.6653], [104.27412, 20.91433], [104.11121, 20.96779], [103.98024, 20.91531], [103.82282, 20.8732], [103.73478, 20.6669], [103.68633, 20.66324], [103.45737, 20.82382], [103.38032, 20.79501], [103.21497, 20.89832], [103.12055, 20.89994], [103.03469, 21.05821], [102.97745, 21.05821], [102.89825, 21.24707], [102.80794, 21.25736], [102.88939, 21.3107], [102.94223, 21.46034], [102.86297, 21.4255], [102.98846, 21.58936], [102.97965, 21.74076], [102.86077, 21.71213], [102.85637, 21.84501], [102.81894, 21.83888], [102.82115, 21.73667], [102.74189, 21.66713], [102.67145, 21.65894], [102.62301, 21.91447], [102.49092, 21.99002], [102.51734, 22.02676], [102.18712, 22.30403], [102.14099, 22.40092], [102.1245, 22.43372]]]] } },
20639     { type: "Feature", properties: { iso1A2: "LB", iso1A3: "LBN", iso1N3: "422", wikidata: "Q822", nameEn: "Lebanon", aliases: ["RL"], groups: ["145", "142", "UN"], callingCodes: ["961"] }, geometry: { type: "MultiPolygon", coordinates: [[[[35.94816, 33.47886], [35.94465, 33.52774], [36.05723, 33.57904], [35.9341, 33.6596], [36.06778, 33.82927], [36.14517, 33.85118], [36.3967, 33.83365], [36.38263, 33.86579], [36.28589, 33.91981], [36.41078, 34.05253], [36.50576, 34.05982], [36.5128, 34.09916], [36.62537, 34.20251], [36.59195, 34.2316], [36.58667, 34.27667], [36.60778, 34.31009], [36.56556, 34.31881], [36.53039, 34.3798], [36.55853, 34.41609], [36.46179, 34.46541], [36.4442, 34.50165], [36.34745, 34.5002], [36.3369, 34.52629], [36.39846, 34.55672], [36.41429, 34.61175], [36.45299, 34.59438], [36.46003, 34.6378], [36.42941, 34.62505], [36.35384, 34.65447], [36.35135, 34.68516], [36.32399, 34.69334], [36.29165, 34.62991], [35.98718, 34.64977], [35.97386, 34.63322], [35.48515, 34.70851], [34.78515, 33.20368], [35.10645, 33.09318], [35.1924, 33.08743], [35.31429, 33.10515], [35.35223, 33.05617], [35.43059, 33.06659], [35.448, 33.09264], [35.50272, 33.09056], [35.50335, 33.114], [35.52573, 33.11921], [35.54228, 33.19865], [35.5362, 33.23196], [35.54808, 33.236], [35.54544, 33.25513], [35.55555, 33.25844], [35.56523, 33.28969], [35.58326, 33.28381], [35.58502, 33.26653], [35.62283, 33.24226], [35.62019, 33.27278], [35.77477, 33.33609], [35.81324, 33.36354], [35.82577, 33.40479], [35.88668, 33.43183], [35.94816, 33.47886]]]] } },
20640     { type: "Feature", properties: { iso1A2: "LC", iso1A3: "LCA", iso1N3: "662", wikidata: "Q760", nameEn: "St. Lucia", aliases: ["WL"], groups: ["029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", callingCodes: ["1 758"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-59.95997, 14.20285], [-61.69315, 14.26451], [-59.94058, 12.34011], [-59.95997, 14.20285]]]] } },
20641     { type: "Feature", properties: { iso1A2: "LI", iso1A3: "LIE", iso1N3: "438", wikidata: "Q347", nameEn: "Liechtenstein", aliases: ["FL"], groups: ["155", "150", "UN"], callingCodes: ["423"] }, geometry: { type: "MultiPolygon", coordinates: [[[[9.60717, 47.06091], [9.61216, 47.07732], [9.63395, 47.08443], [9.62623, 47.14685], [9.56539, 47.17124], [9.58264, 47.20673], [9.56981, 47.21926], [9.55176, 47.22585], [9.56766, 47.24281], [9.53116, 47.27029], [9.52406, 47.24959], [9.50318, 47.22153], [9.4891, 47.19346], [9.48774, 47.17402], [9.51044, 47.13727], [9.52089, 47.10019], [9.51362, 47.08505], [9.47139, 47.06402], [9.47548, 47.05257], [9.54041, 47.06495], [9.55721, 47.04762], [9.60717, 47.06091]]]] } },
20642     { type: "Feature", properties: { iso1A2: "LK", iso1A3: "LKA", iso1N3: "144", wikidata: "Q854", nameEn: "Sri Lanka", groups: ["034", "142", "UN"], driveSide: "left", callingCodes: ["94"] }, geometry: { type: "MultiPolygon", coordinates: [[[[76.59015, 5.591], [85.15017, 5.21497], [80.48418, 10.20786], [79.42124, 9.80115], [79.50447, 8.91876], [76.59015, 5.591]]]] } },
20643     { type: "Feature", properties: { iso1A2: "LR", iso1A3: "LBR", iso1N3: "430", wikidata: "Q1014", nameEn: "Liberia", groups: ["011", "202", "002", "UN"], callingCodes: ["231"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-8.47114, 7.55676], [-8.55874, 7.62525], [-8.55874, 7.70167], [-8.67814, 7.69428], [-8.72789, 7.51429], [-8.8448, 7.35149], [-8.85724, 7.26019], [-8.93435, 7.2824], [-9.09107, 7.1985], [-9.18311, 7.30461], [-9.20798, 7.38109], [-9.305, 7.42056], [-9.41943, 7.41809], [-9.48161, 7.37122], [-9.37465, 7.62032], [-9.35724, 7.74111], [-9.44928, 7.9284], [-9.41445, 8.02448], [-9.50898, 8.18455], [-9.47415, 8.35195], [-9.77763, 8.54633], [-10.05873, 8.42578], [-10.05375, 8.50697], [-10.14579, 8.52665], [-10.203, 8.47991], [-10.27575, 8.48711], [-10.30084, 8.30008], [-10.31635, 8.28554], [-10.29839, 8.21283], [-10.35227, 8.15223], [-10.45023, 8.15627], [-10.51554, 8.1393], [-10.57523, 8.04829], [-10.60492, 8.04072], [-10.60422, 7.7739], [-11.29417, 7.21576], [-11.4027, 6.97746], [-11.50429, 6.92704], [-12.15048, 6.15992], [-7.52774, 3.7105], [-7.53259, 4.35145], [-7.59349, 4.8909], [-7.53876, 4.94294], [-7.55369, 5.08667], [-7.48901, 5.14118], [-7.46165, 5.26256], [-7.36463, 5.32944], [-7.43428, 5.42355], [-7.37209, 5.61173], [-7.43926, 5.74787], [-7.43677, 5.84687], [-7.46165, 5.84934], [-7.48155, 5.80974], [-7.67309, 5.94337], [-7.70294, 5.90625], [-7.78254, 5.99037], [-7.79747, 6.07696], [-7.8497, 6.08932], [-7.83478, 6.20309], [-7.90692, 6.27728], [-8.00642, 6.31684], [-8.17557, 6.28222], [-8.3298, 6.36381], [-8.38453, 6.35887], [-8.45666, 6.49977], [-8.48652, 6.43797], [-8.59456, 6.50612], [-8.31736, 6.82837], [-8.29249, 7.1691], [-8.37458, 7.25794], [-8.41935, 7.51203], [-8.47114, 7.55676]]]] } },
20644     { type: "Feature", properties: { iso1A2: "LS", iso1A3: "LSO", iso1N3: "426", wikidata: "Q1013", nameEn: "Lesotho", groups: ["018", "202", "002", "UN"], driveSide: "left", callingCodes: ["266"] }, geometry: { type: "MultiPolygon", coordinates: [[[[29.33204, -29.45598], [29.44883, -29.3772], [29.40524, -29.21246], [28.68043, -28.58744], [28.65091, -28.57025], [28.40612, -28.6215], [28.30518, -28.69531], [28.2348, -28.69471], [28.1317, -28.7293], [28.02503, -28.85991], [27.98675, -28.8787], [27.9392, -28.84864], [27.88933, -28.88156], [27.8907, -28.91612], [27.75458, -28.89839], [27.55974, -29.18954], [27.5158, -29.2261], [27.54258, -29.25575], [27.48679, -29.29349], [27.45125, -29.29708], [27.47254, -29.31968], [27.4358, -29.33465], [27.33464, -29.48161], [27.01016, -29.65439], [27.09489, -29.72796], [27.22719, -30.00718], [27.29603, -30.05473], [27.32555, -30.14785], [27.40778, -30.14577], [27.37293, -30.19401], [27.36649, -30.27246], [27.38108, -30.33456], [27.45452, -30.32239], [27.56901, -30.42504], [27.56781, -30.44562], [27.62137, -30.50509], [27.6521, -30.51707], [27.67819, -30.53437], [27.69467, -30.55862], [27.74814, -30.60635], [28.12073, -30.68072], [28.2319, -30.28476], [28.399, -30.1592], [28.68627, -30.12885], [28.80222, -30.10579], [28.9338, -30.05072], [29.16548, -29.91706], [29.12553, -29.76266], [29.28545, -29.58456], [29.33204, -29.45598]]]] } },
20645     { type: "Feature", properties: { iso1A2: "LT", iso1A3: "LTU", iso1N3: "440", wikidata: "Q37", nameEn: "Lithuania", groups: ["EU", "154", "150", "UN"], callingCodes: ["370"] }, geometry: { type: "MultiPolygon", coordinates: [[[[24.89005, 56.46666], [24.83686, 56.41565], [24.70022, 56.40483], [24.57353, 56.31525], [24.58143, 56.29125], [24.42746, 56.26522], [24.32334, 56.30226], [24.13139, 56.24881], [24.02657, 56.3231], [23.75726, 56.37282], [23.49803, 56.34307], [23.40486, 56.37689], [23.31606, 56.3827], [23.17312, 56.36795], [23.09531, 56.30511], [22.96988, 56.41213], [22.83048, 56.367], [22.69354, 56.36284], [22.56441, 56.39305], [22.3361, 56.4016], [22.09728, 56.42851], [22.00548, 56.41508], [21.74558, 56.33181], [21.57888, 56.31406], [21.49736, 56.29106], [21.24644, 56.16917], [21.15016, 56.07818], [20.68447, 56.04073], [20.60454, 55.40986], [20.95181, 55.27994], [21.26425, 55.24456], [21.35465, 55.28427], [21.38446, 55.29348], [21.46766, 55.21115], [21.51095, 55.18507], [21.55605, 55.20311], [21.64954, 55.1791], [21.85521, 55.09493], [21.96505, 55.07353], [21.99543, 55.08691], [22.03984, 55.07888], [22.02582, 55.05078], [22.06087, 55.02935], [22.11697, 55.02131], [22.14267, 55.05345], [22.31562, 55.0655], [22.47688, 55.04408], [22.58907, 55.07085], [22.60075, 55.01863], [22.65451, 54.97037], [22.68723, 54.9811], [22.76422, 54.92521], [22.85083, 54.88711], [22.87317, 54.79492], [22.73631, 54.72952], [22.73397, 54.66604], [22.75467, 54.6483], [22.74225, 54.64339], [22.7522, 54.63525], [22.68021, 54.58486], [22.71293, 54.56454], [22.67788, 54.532], [22.70208, 54.45312], [22.7253, 54.41732], [22.79705, 54.36264], [22.83756, 54.40827], [23.00584, 54.38514], [22.99649, 54.35927], [23.05726, 54.34565], [23.04323, 54.31567], [23.104, 54.29794], [23.13905, 54.31567], [23.15526, 54.31076], [23.15938, 54.29894], [23.24656, 54.25701], [23.3494, 54.25155], [23.39525, 54.21672], [23.42418, 54.17911], [23.45223, 54.17775], [23.49196, 54.14764], [23.52702, 54.04622], [23.48261, 53.98855], [23.51284, 53.95052], [23.61677, 53.92691], [23.71726, 53.93379], [23.80543, 53.89558], [23.81309, 53.94205], [23.95098, 53.9613], [23.98837, 53.92554], [24.19638, 53.96405], [24.34128, 53.90076], [24.44411, 53.90076], [24.62275, 54.00217], [24.69652, 54.01901], [24.69185, 53.96543], [24.74279, 53.96663], [24.85311, 54.02862], [24.77131, 54.11091], [24.96894, 54.17589], [24.991, 54.14241], [25.0728, 54.13419], [25.19199, 54.219], [25.22705, 54.26271], [25.35559, 54.26544], [25.509, 54.30267], [25.56823, 54.25212], [25.51452, 54.17799], [25.54724, 54.14925], [25.64875, 54.1259], [25.71084, 54.16704], [25.78563, 54.15747], [25.78553, 54.23327], [25.68513, 54.31727], [25.55425, 54.31591], [25.5376, 54.33158], [25.63371, 54.42075], [25.62203, 54.4656], [25.64813, 54.48704], [25.68045, 54.5321], [25.75977, 54.57252], [25.74122, 54.80108], [25.89462, 54.93438], [25.99129, 54.95705], [26.05907, 54.94631], [26.13386, 54.98924], [26.20397, 54.99729], [26.26941, 55.08032], [26.23202, 55.10439], [26.30628, 55.12536], [26.35121, 55.1525], [26.46249, 55.12814], [26.51481, 55.16051], [26.54753, 55.14181], [26.69243, 55.16718], [26.68075, 55.19787], [26.72983, 55.21788], [26.73017, 55.24226], [26.835, 55.28182], [26.83266, 55.30444], [26.80929, 55.31642], [26.6714, 55.33902], [26.5709, 55.32572], [26.44937, 55.34832], [26.5522, 55.40277], [26.55094, 55.5093], [26.63167, 55.57887], [26.63231, 55.67968], [26.58248, 55.6754], [26.46661, 55.70375], [26.39561, 55.71156], [26.18509, 55.86813], [26.03815, 55.95884], [25.90047, 56.0013], [25.85893, 56.00188], [25.81773, 56.05444], [25.69246, 56.08892], [25.68588, 56.14725], [25.53621, 56.16663], [25.39751, 56.15707], [25.23099, 56.19147], [25.09325, 56.1878], [25.05762, 56.26742], [24.89005, 56.46666]]]] } },
20646     { type: "Feature", properties: { iso1A2: "LU", iso1A3: "LUX", iso1N3: "442", wikidata: "Q32", nameEn: "Luxembourg", groups: ["EU", "155", "150", "UN"], callingCodes: ["352"] }, geometry: { type: "MultiPolygon", coordinates: [[[[6.1379, 50.12964], [6.1137, 50.13668], [6.12028, 50.16374], [6.08577, 50.17246], [6.06406, 50.15344], [6.03093, 50.16362], [6.02488, 50.18283], [5.96453, 50.17259], [5.95929, 50.13295], [5.89488, 50.11476], [5.8857, 50.07824], [5.85474, 50.06342], [5.86904, 50.04614], [5.8551, 50.02683], [5.81866, 50.01286], [5.82331, 49.99662], [5.83968, 49.9892], [5.83467, 49.97823], [5.81163, 49.97142], [5.80833, 49.96451], [5.77291, 49.96056], [5.77314, 49.93646], [5.73621, 49.89796], [5.78415, 49.87922], [5.75269, 49.8711], [5.75861, 49.85631], [5.74567, 49.85368], [5.75884, 49.84811], [5.74953, 49.84709], [5.74975, 49.83933], [5.74076, 49.83823], [5.7404, 49.83452], [5.74844, 49.82435], [5.74364, 49.82058], [5.74953, 49.81428], [5.75409, 49.79239], [5.78871, 49.7962], [5.82245, 49.75048], [5.83149, 49.74729], [5.82562, 49.72395], [5.84193, 49.72161], [5.86503, 49.72739], [5.88677, 49.70951], [5.86527, 49.69291], [5.86175, 49.67862], [5.9069, 49.66377], [5.90164, 49.6511], [5.90599, 49.63853], [5.88552, 49.63507], [5.88393, 49.62802], [5.87609, 49.62047], [5.8762, 49.60898], [5.84826, 49.5969], [5.84971, 49.58674], [5.86986, 49.58756], [5.87256, 49.57539], [5.8424, 49.56082], [5.84692, 49.55663], [5.84143, 49.5533], [5.81838, 49.54777], [5.80871, 49.5425], [5.81664, 49.53775], [5.83648, 49.5425], [5.84466, 49.53027], [5.83467, 49.52717], [5.83389, 49.52152], [5.86571, 49.50015], [5.94128, 49.50034], [5.94224, 49.49608], [5.96876, 49.49053], [5.97693, 49.45513], [6.02648, 49.45451], [6.02743, 49.44845], [6.04176, 49.44801], [6.05553, 49.46663], [6.07887, 49.46399], [6.08373, 49.45594], [6.10072, 49.45268], [6.09845, 49.46351], [6.10325, 49.4707], [6.12346, 49.4735], [6.12814, 49.49365], [6.14321, 49.48796], [6.16115, 49.49297], [6.15366, 49.50226], [6.17386, 49.50934], [6.19543, 49.50536], [6.2409, 49.51408], [6.25029, 49.50609], [6.27875, 49.503], [6.28818, 49.48465], [6.3687, 49.4593], [6.36778, 49.46937], [6.36907, 49.48931], [6.36788, 49.50377], [6.35666, 49.52931], [6.38072, 49.55171], [6.38228, 49.55855], [6.35825, 49.57053], [6.36676, 49.57813], [6.38024, 49.57593], [6.38342, 49.5799], [6.37464, 49.58886], [6.385, 49.59946], [6.39822, 49.60081], [6.41861, 49.61723], [6.4413, 49.65722], [6.43768, 49.66021], [6.42726, 49.66078], [6.42937, 49.66857], [6.44654, 49.67799], [6.46048, 49.69092], [6.48014, 49.69767], [6.49785, 49.71118], [6.50647, 49.71353], [6.5042, 49.71808], [6.49694, 49.72205], [6.49535, 49.72645], [6.50261, 49.72718], [6.51397, 49.72058], [6.51805, 49.72425], [6.50193, 49.73291], [6.50174, 49.75292], [6.51646, 49.75961], [6.51828, 49.76855], [6.51056, 49.77515], [6.51669, 49.78336], [6.50534, 49.78952], [6.52169, 49.79787], [6.53122, 49.80666], [6.52121, 49.81338], [6.51215, 49.80124], [6.50647, 49.80916], [6.48718, 49.81267], [6.47111, 49.82263], [6.45425, 49.81164], [6.44131, 49.81443], [6.42905, 49.81091], [6.42521, 49.81591], [6.40022, 49.82029], [6.36576, 49.85032], [6.34267, 49.84974], [6.33585, 49.83785], [6.32098, 49.83728], [6.32303, 49.85133], [6.30963, 49.87021], [6.29692, 49.86685], [6.28874, 49.87592], [6.26146, 49.88203], [6.23496, 49.89972], [6.22926, 49.92096], [6.21882, 49.92403], [6.22608, 49.929], [6.22094, 49.94955], [6.19856, 49.95053], [6.19089, 49.96991], [6.18045, 49.96611], [6.18554, 49.95622], [6.17872, 49.9537], [6.16466, 49.97086], [6.1701, 49.98518], [6.14147, 49.99563], [6.14948, 50.00908], [6.13806, 50.01056], [6.1295, 50.01849], [6.13273, 50.02019], [6.13794, 50.01466], [6.14666, 50.02207], [6.13044, 50.02929], [6.13458, 50.04141], [6.11274, 50.05916], [6.12055, 50.09171], [6.1379, 50.12964]]]] } },
20647     { type: "Feature", properties: { iso1A2: "LV", iso1A3: "LVA", iso1N3: "428", wikidata: "Q211", nameEn: "Latvia", groups: ["EU", "154", "150", "UN"], callingCodes: ["371"] }, geometry: { type: "MultiPolygon", coordinates: [[[[27.34698, 57.52242], [26.90364, 57.62823], [26.54675, 57.51813], [26.46527, 57.56885], [26.29253, 57.59244], [26.1866, 57.6849], [26.2029, 57.7206], [26.08098, 57.76619], [26.0543, 57.76105], [26.03332, 57.7718], [26.02415, 57.76865], [26.02069, 57.77169], [26.0266, 57.77441], [26.027, 57.78158], [26.02456, 57.78342], [26.0324, 57.79037], [26.05949, 57.84744], [25.73499, 57.90193], [25.29581, 58.08288], [25.28237, 57.98539], [25.19484, 58.0831], [24.3579, 57.87471], [24.26221, 57.91787], [23.20055, 57.56697], [22.80496, 57.87798], [19.84909, 57.57876], [19.64795, 57.06466], [20.68447, 56.04073], [21.15016, 56.07818], [21.24644, 56.16917], [21.49736, 56.29106], [21.57888, 56.31406], [21.74558, 56.33181], [22.00548, 56.41508], [22.09728, 56.42851], [22.3361, 56.4016], [22.56441, 56.39305], [22.69354, 56.36284], [22.83048, 56.367], [22.96988, 56.41213], [23.09531, 56.30511], [23.17312, 56.36795], [23.31606, 56.3827], [23.40486, 56.37689], [23.49803, 56.34307], [23.75726, 56.37282], [24.02657, 56.3231], [24.13139, 56.24881], [24.32334, 56.30226], [24.42746, 56.26522], [24.58143, 56.29125], [24.57353, 56.31525], [24.70022, 56.40483], [24.83686, 56.41565], [24.89005, 56.46666], [25.05762, 56.26742], [25.09325, 56.1878], [25.23099, 56.19147], [25.39751, 56.15707], [25.53621, 56.16663], [25.68588, 56.14725], [25.69246, 56.08892], [25.81773, 56.05444], [25.85893, 56.00188], [25.90047, 56.0013], [26.03815, 55.95884], [26.18509, 55.86813], [26.39561, 55.71156], [26.46661, 55.70375], [26.58248, 55.6754], [26.63231, 55.67968], [26.64888, 55.70515], [26.71802, 55.70645], [26.76872, 55.67658], [26.87448, 55.7172], [26.97153, 55.8102], [27.1559, 55.85032], [27.27804, 55.78299], [27.3541, 55.8089], [27.61683, 55.78558], [27.63065, 55.89687], [27.97865, 56.11849], [28.15217, 56.16964], [28.23716, 56.27588], [28.16599, 56.37806], [28.19057, 56.44637], [28.10069, 56.524], [28.13526, 56.57989], [28.04768, 56.59004], [27.86101, 56.88204], [27.66511, 56.83921], [27.86101, 57.29402], [27.52453, 57.42826], [27.56832, 57.53728], [27.34698, 57.52242]]]] } },
20648     { type: "Feature", properties: { iso1A2: "LY", iso1A3: "LBY", iso1N3: "434", wikidata: "Q1016", nameEn: "Libya", groups: ["015", "002", "UN"], callingCodes: ["218"] }, geometry: { type: "MultiPolygon", coordinates: [[[[26.92891, 33.39516], [11.58941, 33.36891], [11.55852, 33.1409], [11.51549, 33.09826], [11.46037, 32.6307], [11.57828, 32.48013], [11.53898, 32.4138], [11.04234, 32.2145], [10.7315, 31.97235], [10.62788, 31.96629], [10.48497, 31.72956], [10.31364, 31.72648], [10.12239, 31.42098], [10.29516, 30.90337], [9.88152, 30.34074], [9.76848, 30.34366], [9.55544, 30.23971], [9.3876, 30.16738], [9.78136, 29.40961], [9.89569, 26.57696], [9.51696, 26.39148], [9.38834, 26.19288], [10.03146, 25.35635], [10.02432, 24.98124], [10.33159, 24.5465], [10.85323, 24.5595], [11.41061, 24.21456], [11.62498, 24.26669], [11.96886, 23.51735], [13.5631, 23.16574], [14.22918, 22.61719], [14.99751, 23.00539], [15.99566, 23.49639], [23.99539, 19.49944], [23.99715, 20.00038], [24.99794, 19.99661], [24.99885, 21.99535], [24.99968, 29.24574], [24.71117, 30.17441], [25.01077, 30.73861], [24.8458, 31.39877], [26.92891, 33.39516]]]] } },
20649     { type: "Feature", properties: { iso1A2: "MA", iso1A3: "MAR", iso1N3: "504", wikidata: "Q1028", nameEn: "Morocco", groups: ["015", "002", "UN"], callingCodes: ["212"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-2.27707, 35.35051], [-5.10878, 36.05227], [-7.2725, 35.73269], [-14.43883, 27.02969], [-17.27295, 21.93519], [-17.21511, 21.34226], [-17.02707, 21.34022], [-16.9978, 21.36239], [-16.44269, 21.39745], [-14.78487, 21.36587], [-14.47329, 21.63839], [-14.48112, 22.00886], [-14.1291, 22.41636], [-14.10361, 22.75501], [-13.75627, 23.77231], [-13.00628, 24.01923], [-12.92147, 24.39502], [-12.12281, 25.13682], [-12.06001, 26.04442], [-11.62052, 26.05229], [-11.38635, 26.611], [-11.23622, 26.72023], [-11.35695, 26.8505], [-10.68417, 26.90984], [-9.81998, 26.71379], [-9.56957, 26.90042], [-9.08698, 26.98639], [-8.71787, 26.9898], [-8.77527, 27.66663], [-8.66879, 27.6666], [-8.6715, 28.71194], [-7.61585, 29.36252], [-6.95824, 29.50924], [-6.78351, 29.44634], [-6.69965, 29.51623], [-5.75616, 29.61407], [-5.72121, 29.52322], [-5.58831, 29.48103], [-5.21671, 29.95253], [-4.6058, 30.28343], [-4.31774, 30.53229], [-3.64735, 30.67539], [-3.65418, 30.85566], [-3.54944, 31.0503], [-3.77103, 31.14984], [-3.77647, 31.31912], [-3.66386, 31.39202], [-3.66314, 31.6339], [-2.82784, 31.79459], [-2.93873, 32.06557], [-2.46166, 32.16603], [-1.22829, 32.07832], [-1.15735, 32.12096], [-1.24453, 32.1917], [-1.24998, 32.32993], [-0.9912, 32.52467], [-1.37794, 32.73628], [-1.54244, 32.95499], [-1.46249, 33.0499], [-1.67067, 33.27084], [-1.59508, 33.59929], [-1.73494, 33.71721], [-1.64666, 34.10405], [-1.78042, 34.39018], [-1.69788, 34.48056], [-1.84569, 34.61907], [-1.73707, 34.74226], [-1.97469, 34.886], [-1.97833, 34.93218], [-2.04734, 34.93218], [-2.21445, 35.04378], [-2.21248, 35.08532], [-2.27707, 35.35051]], [[-2.91909, 35.33927], [-2.92272, 35.27509], [-2.93893, 35.26737], [-2.95065, 35.26576], [-2.95431, 35.2728], [-2.96516, 35.27967], [-2.96826, 35.28296], [-2.96507, 35.28801], [-2.97035, 35.28852], [-2.96978, 35.29459], [-2.96648, 35.30475], [-2.96038, 35.31609], [-2.91909, 35.33927]], [[-3.90602, 35.21494], [-3.89343, 35.22728], [-3.88372, 35.20767], [-3.90602, 35.21494]], [[-4.30191, 35.17419], [-4.29436, 35.17149], [-4.30112, 35.17058], [-4.30191, 35.17419]], [[-2.40316, 35.16893], [-2.45965, 35.16527], [-2.43262, 35.20652], [-2.40316, 35.16893]], [[-5.38491, 35.92591], [-5.21179, 35.90091], [-5.34379, 35.8711], [-5.35844, 35.87375], [-5.37338, 35.88417], [-5.38491, 35.92591]]]] } },
20650     { type: "Feature", properties: { iso1A2: "MC", iso1A3: "MCO", iso1N3: "492", wikidata: "Q235", nameEn: "Monaco", groups: ["155", "150", "UN"], callingCodes: ["377"] }, geometry: { type: "MultiPolygon", coordinates: [[[[7.47823, 43.73341], [7.4379, 43.74963], [7.4389, 43.75151], [7.43708, 43.75197], [7.43624, 43.75014], [7.43013, 43.74895], [7.42809, 43.74396], [7.42443, 43.74087], [7.42299, 43.74176], [7.42062, 43.73977], [7.41233, 43.73439], [7.41298, 43.73311], [7.41291, 43.73168], [7.41113, 43.73156], [7.40903, 43.7296], [7.42422, 43.72209], [7.47823, 43.73341]]]] } },
20651     { type: "Feature", properties: { iso1A2: "MD", iso1A3: "MDA", iso1N3: "498", wikidata: "Q217", nameEn: "Moldova", groups: ["151", "150", "UN"], callingCodes: ["373"] }, geometry: { type: "MultiPolygon", coordinates: [[[[27.74422, 48.45926], [27.6658, 48.44034], [27.59027, 48.46311], [27.5889, 48.49224], [27.46942, 48.454], [27.44333, 48.41209], [27.37741, 48.41026], [27.37604, 48.44398], [27.32159, 48.4434], [27.27855, 48.37534], [27.13434, 48.37288], [27.08078, 48.43214], [27.0231, 48.42485], [27.03821, 48.37653], [26.93384, 48.36558], [26.85556, 48.41095], [26.71274, 48.40388], [26.82809, 48.31629], [26.79239, 48.29071], [26.6839, 48.35828], [26.62823, 48.25804], [26.81161, 48.25049], [26.87708, 48.19919], [26.94265, 48.1969], [26.98042, 48.15752], [26.96119, 48.13003], [27.04118, 48.12522], [27.02985, 48.09083], [27.15622, 47.98538], [27.1618, 47.92391], [27.29069, 47.73722], [27.25519, 47.71366], [27.32202, 47.64009], [27.3979, 47.59473], [27.47942, 47.48113], [27.55731, 47.46637], [27.60263, 47.32507], [27.68706, 47.28962], [27.73172, 47.29248], [27.81892, 47.1381], [28.09095, 46.97621], [28.12173, 46.82283], [28.24808, 46.64305], [28.22281, 46.50481], [28.25769, 46.43334], [28.18902, 46.35283], [28.19864, 46.31869], [28.10937, 46.22852], [28.13684, 46.18099], [28.08612, 46.01105], [28.13111, 45.92819], [28.16568, 45.6421], [28.08927, 45.6051], [28.18741, 45.47358], [28.21139, 45.46895], [28.30201, 45.54744], [28.41836, 45.51715], [28.43072, 45.48538], [28.51449, 45.49982], [28.49252, 45.56716], [28.54196, 45.58062], [28.51587, 45.6613], [28.47879, 45.66994], [28.52823, 45.73803], [28.70401, 45.78019], [28.69852, 45.81753], [28.78503, 45.83475], [28.74383, 45.96664], [28.98004, 46.00385], [29.00613, 46.04962], [28.94643, 46.09176], [29.06656, 46.19716], [28.94953, 46.25852], [28.98478, 46.31803], [29.004, 46.31495], [28.9306, 46.45699], [29.01241, 46.46177], [29.02409, 46.49582], [29.23547, 46.55435], [29.24886, 46.37912], [29.35357, 46.49505], [29.49914, 46.45889], [29.5939, 46.35472], [29.6763, 46.36041], [29.66359, 46.4215], [29.74496, 46.45605], [29.88329, 46.35851], [29.94114, 46.40114], [30.09103, 46.38694], [30.16794, 46.40967], [30.02511, 46.45132], [29.88916, 46.54302], [29.94409, 46.56002], [29.9743, 46.75325], [29.94522, 46.80055], [29.98814, 46.82358], [29.87405, 46.88199], [29.75458, 46.8604], [29.72986, 46.92234], [29.57056, 46.94766], [29.62137, 47.05069], [29.61038, 47.09932], [29.53044, 47.07851], [29.49732, 47.12878], [29.57696, 47.13581], [29.54996, 47.24962], [29.59665, 47.25521], [29.5733, 47.36508], [29.48678, 47.36043], [29.47854, 47.30366], [29.39889, 47.30179], [29.3261, 47.44664], [29.18603, 47.43387], [29.11743, 47.55001], [29.22414, 47.60012], [29.22242, 47.73607], [29.27255, 47.79953], [29.20663, 47.80367], [29.27804, 47.88893], [29.19839, 47.89261], [29.1723, 47.99013], [28.9306, 47.96255], [28.8414, 48.03392], [28.85232, 48.12506], [28.69896, 48.13106], [28.53921, 48.17453], [28.48428, 48.0737], [28.42454, 48.12047], [28.43701, 48.15832], [28.38712, 48.17567], [28.34009, 48.13147], [28.30609, 48.14018], [28.30586, 48.1597], [28.34912, 48.1787], [28.36996, 48.20543], [28.35519, 48.24957], [28.32508, 48.23384], [28.2856, 48.23202], [28.19314, 48.20749], [28.17666, 48.25963], [28.07504, 48.23494], [28.09873, 48.3124], [28.04527, 48.32661], [27.95883, 48.32368], [27.88391, 48.36699], [27.87533, 48.4037], [27.81902, 48.41874], [27.79225, 48.44244], [27.74422, 48.45926]]]] } },
20652     { type: "Feature", properties: { iso1A2: "ME", iso1A3: "MNE", iso1N3: "499", wikidata: "Q236", nameEn: "Montenegro", groups: ["039", "150", "UN"], callingCodes: ["382"] }, geometry: { type: "MultiPolygon", coordinates: [[[[19.22807, 43.5264], [19.15685, 43.53943], [19.13933, 43.5282], [19.04934, 43.50384], [19.01078, 43.55806], [18.91379, 43.50299], [18.95469, 43.49367], [18.96053, 43.45042], [19.01078, 43.43854], [19.04071, 43.397], [19.08673, 43.31453], [19.08206, 43.29668], [19.04233, 43.30008], [19.00844, 43.24988], [18.95001, 43.29327], [18.95819, 43.32899], [18.90911, 43.36383], [18.83912, 43.34795], [18.84794, 43.33735], [18.85342, 43.32426], [18.76538, 43.29838], [18.6976, 43.25243], [18.71747, 43.2286], [18.66605, 43.2056], [18.64735, 43.14766], [18.66254, 43.03928], [18.52232, 43.01451], [18.49076, 42.95553], [18.49661, 42.89306], [18.4935, 42.86433], [18.47633, 42.85829], [18.45921, 42.81682], [18.47324, 42.74992], [18.56789, 42.72074], [18.55221, 42.69045], [18.54603, 42.69171], [18.54841, 42.68328], [18.57373, 42.64429], [18.52232, 42.62279], [18.55504, 42.58409], [18.53751, 42.57376], [18.49778, 42.58409], [18.43735, 42.55921], [18.44307, 42.51077], [18.43588, 42.48556], [18.52152, 42.42302], [18.54128, 42.39171], [18.45131, 42.21682], [19.26406, 41.74971], [19.37597, 41.84849], [19.37451, 41.8842], [19.33812, 41.90669], [19.34601, 41.95675], [19.37691, 41.96977], [19.36867, 42.02564], [19.37548, 42.06835], [19.40687, 42.10024], [19.28623, 42.17745], [19.42, 42.33019], [19.42352, 42.36546], [19.4836, 42.40831], [19.65972, 42.62774], [19.73244, 42.66299], [19.77375, 42.58517], [19.74731, 42.57422], [19.76549, 42.50237], [19.82333, 42.46581], [19.9324, 42.51699], [20.00842, 42.5109], [20.01834, 42.54622], [20.07761, 42.55582], [20.0969, 42.65559], [20.02915, 42.71147], [20.02088, 42.74789], [20.04898, 42.77701], [20.2539, 42.76245], [20.27869, 42.81945], [20.35692, 42.8335], [20.34528, 42.90676], [20.16415, 42.97177], [20.14896, 42.99058], [20.12325, 42.96237], [20.05431, 42.99571], [20.04729, 43.02732], [19.98887, 43.0538], [19.96549, 43.11098], [19.92576, 43.08539], [19.79255, 43.11951], [19.76918, 43.16044], [19.64063, 43.19027], [19.62661, 43.2286], [19.54598, 43.25158], [19.52962, 43.31623], [19.48171, 43.32644], [19.44315, 43.38846], [19.22229, 43.47926], [19.22807, 43.5264]]]] } },
20653     { type: "Feature", properties: { iso1A2: "MF", iso1A3: "MAF", iso1N3: "663", wikidata: "Q126125", nameEn: "Saint-Martin", country: "FR", groups: ["Q3320166", "EU", "029", "003", "419", "019", "UN"], callingCodes: ["590"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-62.93924, 18.02904], [-62.62718, 18.26185], [-63.35989, 18.06012], [-63.33064, 17.9615], [-63.13502, 18.05445], [-63.11042, 18.05339], [-63.09686, 18.04608], [-63.07759, 18.04943], [-63.0579, 18.06614], [-63.04039, 18.05619], [-63.02323, 18.05757], [-62.93924, 18.02904]]]] } },
20654     { type: "Feature", properties: { iso1A2: "MG", iso1A3: "MDG", iso1N3: "450", wikidata: "Q1019", nameEn: "Madagascar", aliases: ["RM"], groups: ["014", "202", "002", "UN"], callingCodes: ["261"] }, geometry: { type: "MultiPolygon", coordinates: [[[[51.93891, -10.85085], [45.84651, -12.77177], [42.14681, -19.63341], [45.80092, -33.00974], [51.93891, -10.85085]]]] } },
20655     { type: "Feature", properties: { iso1A2: "MH", iso1A3: "MHL", iso1N3: "584", wikidata: "Q709", nameEn: "Marshall Islands", groups: ["057", "009", "UN"], roadSpeedUnit: "mph", callingCodes: ["692"] }, geometry: { type: "MultiPolygon", coordinates: [[[[169, 3.9], [173.53711, 5.70687], [169.29099, 15.77133], [159.04653, 10.59067], [169, 3.9]]]] } },
20656     { type: "Feature", properties: { iso1A2: "MK", iso1A3: "MKD", iso1N3: "807", wikidata: "Q221", nameEn: "North Macedonia", groups: ["039", "150", "UN"], callingCodes: ["389"] }, geometry: { type: "MultiPolygon", coordinates: [[[[22.34773, 42.31725], [22.29275, 42.34913], [22.29605, 42.37477], [22.16384, 42.32103], [22.02908, 42.29848], [21.94405, 42.34669], [21.91595, 42.30392], [21.84654, 42.3247], [21.77176, 42.2648], [21.70111, 42.23789], [21.58992, 42.25915], [21.52145, 42.24465], [21.50823, 42.27156], [21.43882, 42.2789], [21.43882, 42.23609], [21.38428, 42.24465], [21.30496, 42.1418], [21.29913, 42.13954], [21.31983, 42.10993], [21.22728, 42.08909], [21.16614, 42.19815], [21.11491, 42.20794], [20.75464, 42.05229], [20.76786, 41.91839], [20.68523, 41.85318], [20.59524, 41.8818], [20.55976, 41.87068], [20.57144, 41.7897], [20.53405, 41.78099], [20.51301, 41.72433], [20.52937, 41.69292], [20.51769, 41.65975], [20.55508, 41.58113], [20.52103, 41.56473], [20.45809, 41.5549], [20.45331, 41.51436], [20.49039, 41.49277], [20.51301, 41.442], [20.55976, 41.4087], [20.52119, 41.34381], [20.49432, 41.33679], [20.51068, 41.2323], [20.59715, 41.13644], [20.58546, 41.11179], [20.59832, 41.09066], [20.63454, 41.0889], [20.65558, 41.08009], [20.71634, 40.91781], [20.73504, 40.9081], [20.81567, 40.89662], [20.83671, 40.92752], [20.94305, 40.92399], [20.97693, 40.90103], [20.97887, 40.85475], [21.15262, 40.85546], [21.21105, 40.8855], [21.25779, 40.86165], [21.35595, 40.87578], [21.41555, 40.9173], [21.53007, 40.90759], [21.57448, 40.86076], [21.69601, 40.9429], [21.7556, 40.92525], [21.91102, 41.04786], [21.90869, 41.09191], [22.06527, 41.15617], [22.1424, 41.12449], [22.17629, 41.15969], [22.26744, 41.16409], [22.42285, 41.11921], [22.5549, 41.13065], [22.58295, 41.11568], [22.62852, 41.14385], [22.65306, 41.18168], [22.71266, 41.13945], [22.74538, 41.16321], [22.76408, 41.32225], [22.81199, 41.3398], [22.93334, 41.34104], [22.96331, 41.35782], [22.95513, 41.63265], [23.03342, 41.71034], [23.01239, 41.76527], [22.96682, 41.77137], [22.90254, 41.87587], [22.86749, 42.02275], [22.67701, 42.06614], [22.51224, 42.15457], [22.50289, 42.19527], [22.47251, 42.20393], [22.38136, 42.30339], [22.34773, 42.31725]]]] } },
20657     { type: "Feature", properties: { iso1A2: "ML", iso1A3: "MLI", iso1N3: "466", wikidata: "Q912", nameEn: "Mali", groups: ["011", "202", "002", "UN"], callingCodes: ["223"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-4.83423, 24.99935], [-6.57191, 25.0002], [-5.60725, 16.49919], [-5.33435, 16.33354], [-5.50165, 15.50061], [-9.32979, 15.50032], [-9.31106, 15.69412], [-9.33314, 15.7044], [-9.44673, 15.60553], [-9.40447, 15.4396], [-10.71721, 15.4223], [-10.90932, 15.11001], [-11.43483, 15.62339], [-11.70705, 15.51558], [-11.94903, 14.76143], [-12.23936, 14.76324], [-11.93043, 13.84505], [-12.06897, 13.71049], [-11.83345, 13.33333], [-11.63025, 13.39174], [-11.39935, 12.97808], [-11.37536, 12.40788], [-11.50006, 12.17826], [-11.24136, 12.01286], [-10.99758, 12.24634], [-10.80355, 12.1053], [-10.71897, 11.91552], [-10.30604, 12.24634], [-9.714, 12.0226], [-9.63938, 12.18312], [-9.32097, 12.29009], [-9.38067, 12.48446], [-9.13689, 12.50875], [-8.94784, 12.34842], [-8.80854, 11.66715], [-8.40058, 11.37466], [-8.66923, 10.99397], [-8.35083, 11.06234], [-8.2667, 10.91762], [-8.32614, 10.69273], [-8.22711, 10.41722], [-8.10207, 10.44649], [-7.9578, 10.2703], [-7.97971, 10.17117], [-7.92107, 10.15577], [-7.63048, 10.46334], [-7.54462, 10.40921], [-7.52261, 10.4655], [-7.44555, 10.44602], [-7.3707, 10.24677], [-7.13331, 10.24877], [-7.0603, 10.14711], [-7.00966, 10.15794], [-6.97444, 10.21644], [-7.01186, 10.25111], [-6.93921, 10.35291], [-6.68164, 10.35074], [-6.63541, 10.66893], [-6.52974, 10.59104], [-6.42847, 10.5694], [-6.40646, 10.69922], [-6.325, 10.68624], [-6.24795, 10.74248], [-6.1731, 10.46983], [-6.18851, 10.24244], [-5.99478, 10.19694], [-5.78124, 10.43952], [-5.65135, 10.46767], [-5.51058, 10.43177], [-5.46643, 10.56074], [-5.47083, 10.75329], [-5.41579, 10.84628], [-5.49284, 11.07538], [-5.32994, 11.13371], [-5.32553, 11.21578], [-5.25949, 11.24816], [-5.25509, 11.36905], [-5.20665, 11.43811], [-5.22867, 11.60421], [-5.29251, 11.61715], [-5.26389, 11.75728], [-5.40258, 11.8327], [-5.26389, 11.84778], [-5.07897, 11.97918], [-4.72893, 12.01579], [-4.70692, 12.06746], [-4.62987, 12.06531], [-4.62546, 12.13204], [-4.54841, 12.1385], [-4.57703, 12.19875], [-4.41412, 12.31922], [-4.47356, 12.71252], [-4.238, 12.71467], [-4.21819, 12.95722], [-4.34477, 13.12927], [-3.96501, 13.49778], [-3.90558, 13.44375], [-3.96282, 13.38164], [-3.7911, 13.36665], [-3.54454, 13.1781], [-3.4313, 13.1588], [-3.43507, 13.27272], [-3.23599, 13.29035], [-3.28396, 13.5422], [-3.26407, 13.70699], [-2.88189, 13.64921], [-2.90831, 13.81174], [-2.84667, 14.05532], [-2.66175, 14.14713], [-2.47587, 14.29671], [-2.10223, 14.14878], [-1.9992, 14.19011], [-1.97945, 14.47709], [-1.68083, 14.50023], [-1.32166, 14.72774], [-1.05875, 14.7921], [-0.72004, 15.08655], [-0.24673, 15.07805], [0.06588, 14.96961], [0.23859, 15.00135], [0.72632, 14.95898], [0.96711, 14.98275], [1.31275, 15.27978], [3.01806, 15.34571], [3.03134, 15.42221], [3.50368, 15.35934], [4.19893, 16.39923], [4.21787, 17.00118], [4.26762, 17.00432], [4.26651, 19.14224], [3.36082, 18.9745], [3.12501, 19.1366], [3.24648, 19.81703], [1.20992, 20.73533], [1.15698, 21.12843], [-4.83423, 24.99935]]]] } },
20658     { type: "Feature", properties: { iso1A2: "MM", iso1A3: "MMR", iso1N3: "104", wikidata: "Q836", nameEn: "Myanmar", aliases: ["Burma", "BU"], groups: ["035", "142", "UN"], callingCodes: ["95"] }, geometry: { type: "MultiPolygon", coordinates: [[[[92.62187, 21.87037], [92.59775, 21.6092], [92.68152, 21.28454], [92.60187, 21.24615], [92.55105, 21.3856], [92.43158, 21.37025], [92.37939, 21.47764], [92.20087, 21.337], [92.17752, 21.17445], [92.26071, 21.05697], [92.47409, 20.38654], [92.61042, 13.76986], [94.6371, 13.81803], [97.63455, 9.60854], [98.12555, 9.44056], [98.33094, 9.91973], [98.47298, 9.95782], [98.52291, 9.92389], [98.55174, 9.92804], [98.7391, 10.31488], [98.81944, 10.52761], [98.77275, 10.62548], [98.78511, 10.68351], [98.86819, 10.78336], [99.0069, 10.85485], [98.99701, 10.92962], [99.02337, 10.97217], [99.06938, 10.94857], [99.32756, 11.28545], [99.31573, 11.32081], [99.39485, 11.3925], [99.47598, 11.62434], [99.5672, 11.62732], [99.64108, 11.78948], [99.64891, 11.82699], [99.53424, 12.02317], [99.56445, 12.14805], [99.47519, 12.1353], [99.409, 12.60603], [99.29254, 12.68921], [99.18905, 12.84799], [99.18748, 12.9898], [99.10646, 13.05804], [99.12225, 13.19847], [99.20617, 13.20575], [99.16695, 13.72621], [98.97356, 14.04868], [98.56762, 14.37701], [98.24874, 14.83013], [98.18821, 15.13125], [98.22, 15.21327], [98.30446, 15.30667], [98.40522, 15.25268], [98.41906, 15.27103], [98.39351, 15.34177], [98.4866, 15.39154], [98.56027, 15.33471], [98.58598, 15.46821], [98.541, 15.65406], [98.59853, 15.87197], [98.57019, 16.04578], [98.69585, 16.13353], [98.8376, 16.11706], [98.92656, 16.36425], [98.84485, 16.42354], [98.68074, 16.27068], [98.63817, 16.47424], [98.57912, 16.55983], [98.5695, 16.62826], [98.51113, 16.64503], [98.51833, 16.676], [98.51472, 16.68521], [98.51579, 16.69433], [98.51043, 16.70107], [98.49713, 16.69022], [98.50253, 16.7139], [98.46994, 16.73613], [98.53833, 16.81934], [98.49603, 16.8446], [98.52624, 16.89979], [98.39441, 17.06266], [98.34566, 17.04822], [98.10439, 17.33847], [98.11185, 17.36829], [97.91829, 17.54504], [97.76407, 17.71595], [97.66794, 17.88005], [97.73723, 17.97912], [97.60841, 18.23846], [97.64116, 18.29778], [97.56219, 18.33885], [97.50383, 18.26844], [97.34522, 18.54596], [97.36444, 18.57138], [97.5258, 18.4939], [97.76752, 18.58097], [97.73836, 18.88478], [97.66487, 18.9371], [97.73654, 18.9812], [97.73797, 19.04261], [97.83479, 19.09972], [97.84024, 19.22217], [97.78606, 19.26769], [97.84186, 19.29526], [97.78769, 19.39429], [97.88423, 19.5041], [97.84715, 19.55782], [98.04364, 19.65755], [98.03314, 19.80941], [98.13829, 19.78541], [98.24884, 19.67876], [98.51182, 19.71303], [98.56065, 19.67807], [98.83661, 19.80931], [98.98679, 19.7419], [99.0735, 20.10298], [99.20328, 20.12877], [99.416, 20.08614], [99.52943, 20.14811], [99.5569, 20.20676], [99.46077, 20.36198], [99.46008, 20.39673], [99.68255, 20.32077], [99.81096, 20.33687], [99.86383, 20.44371], [99.88211, 20.44488], [99.88451, 20.44596], [99.89168, 20.44548], [99.89301, 20.44311], [99.89692, 20.44789], [99.90499, 20.4487], [99.91616, 20.44986], [99.95721, 20.46301], [100.08404, 20.36626], [100.1957, 20.68247], [100.36375, 20.82783], [100.51079, 20.82194], [100.60112, 20.8347], [100.64628, 20.88279], [100.50974, 20.88574], [100.55281, 21.02796], [100.63578, 21.05639], [100.72716, 21.31786], [100.80173, 21.2934], [101.00234, 21.39612], [101.16198, 21.52808], [101.15156, 21.56129], [101.11744, 21.77659], [100.87265, 21.67396], [100.72143, 21.51898], [100.57861, 21.45637], [100.4811, 21.46148], [100.42892, 21.54325], [100.35201, 21.53176], [100.25863, 21.47043], [100.18447, 21.51898], [100.1625, 21.48704], [100.12542, 21.50365], [100.10757, 21.59945], [100.17486, 21.65306], [100.12679, 21.70539], [100.04956, 21.66843], [99.98654, 21.71064], [99.94003, 21.82782], [99.99084, 21.97053], [99.96612, 22.05965], [99.85351, 22.04183], [99.47585, 22.13345], [99.33166, 22.09656], [99.1552, 22.15874], [99.19176, 22.16983], [99.17318, 22.18025], [99.28771, 22.4105], [99.37972, 22.50188], [99.38247, 22.57544], [99.31243, 22.73893], [99.45654, 22.85726], [99.43537, 22.94086], [99.54218, 22.90014], [99.52214, 23.08218], [99.34127, 23.13099], [99.25741, 23.09025], [99.04601, 23.12215], [99.05975, 23.16382], [98.88597, 23.18656], [98.92515, 23.29535], [98.93958, 23.31414], [98.87573, 23.33038], [98.92104, 23.36946], [98.87683, 23.48995], [98.82877, 23.47908], [98.80294, 23.5345], [98.88396, 23.59555], [98.81775, 23.694], [98.82933, 23.72921], [98.79607, 23.77947], [98.68209, 23.80492], [98.67797, 23.9644], [98.89632, 24.10612], [98.87998, 24.15624], [98.85319, 24.13042], [98.59256, 24.08371], [98.54476, 24.13119], [98.20666, 24.11406], [98.07806, 24.07988], [98.06703, 24.08028], [98.0607, 24.07812], [98.05671, 24.07961], [98.05302, 24.07408], [98.04709, 24.07616], [97.99583, 24.04932], [97.98691, 24.03897], [97.93951, 24.01953], [97.90998, 24.02094], [97.88616, 24.00463], [97.88414, 23.99405], [97.88814, 23.98605], [97.89683, 23.98389], [97.89676, 23.97931], [97.8955, 23.97758], [97.88811, 23.97446], [97.86545, 23.97723], [97.84328, 23.97603], [97.79416, 23.95663], [97.79456, 23.94836], [97.72302, 23.89288], [97.64667, 23.84574], [97.5247, 23.94032], [97.62363, 24.00506], [97.72903, 24.12606], [97.75305, 24.16902], [97.72799, 24.18883], [97.72998, 24.2302], [97.76799, 24.26365], [97.71941, 24.29652], [97.66723, 24.30027], [97.65624, 24.33781], [97.7098, 24.35658], [97.66998, 24.45288], [97.60029, 24.4401], [97.52757, 24.43748], [97.56286, 24.54535], [97.56525, 24.72838], [97.54675, 24.74202], [97.5542, 24.74943], [97.56383, 24.75535], [97.56648, 24.76475], [97.64354, 24.79171], [97.70181, 24.84557], [97.73127, 24.83015], [97.76481, 24.8289], [97.79949, 24.85655], [97.72903, 24.91332], [97.72216, 25.08508], [97.77023, 25.11492], [97.83614, 25.2715], [97.92541, 25.20815], [98.14925, 25.41547], [98.12591, 25.50722], [98.18084, 25.56298], [98.16848, 25.62739], [98.25774, 25.6051], [98.31268, 25.55307], [98.40606, 25.61129], [98.54064, 25.85129], [98.63128, 25.79937], [98.70818, 25.86241], [98.60763, 26.01512], [98.57085, 26.11547], [98.63128, 26.15492], [98.66884, 26.09165], [98.7329, 26.17218], [98.67797, 26.24487], [98.72741, 26.36183], [98.77547, 26.61994], [98.7333, 26.85615], [98.69582, 27.56499], [98.43353, 27.67086], [98.42529, 27.55404], [98.32641, 27.51385], [98.13964, 27.9478], [98.15337, 28.12114], [97.90069, 28.3776], [97.79632, 28.33168], [97.70705, 28.5056], [97.56835, 28.55628], [97.50518, 28.49716], [97.47085, 28.2688], [97.41729, 28.29783], [97.34547, 28.21385], [97.31292, 28.06784], [97.35412, 28.06663], [97.38845, 28.01329], [97.35824, 27.87256], [97.29919, 27.92233], [96.90112, 27.62149], [96.91431, 27.45752], [97.17422, 27.14052], [97.14675, 27.09041], [96.89132, 27.17474], [96.85287, 27.2065], [96.88445, 27.25046], [96.73888, 27.36638], [96.55761, 27.29928], [96.40779, 27.29818], [96.15591, 27.24572], [96.04949, 27.19428], [95.93002, 27.04149], [95.81603, 27.01335], [95.437, 26.7083], [95.30339, 26.65372], [95.23513, 26.68499], [95.05798, 26.45408], [95.12801, 26.38397], [95.11428, 26.1019], [95.18556, 26.07338], [94.80117, 25.49359], [94.68032, 25.47003], [94.57458, 25.20318], [94.74212, 25.13606], [94.73937, 25.00545], [94.60204, 24.70889], [94.5526, 24.70764], [94.50729, 24.59281], [94.45279, 24.56656], [94.32362, 24.27692], [94.30215, 24.23752], [94.14081, 23.83333], [93.92089, 23.95812], [93.80279, 23.92549], [93.75952, 24.0003], [93.62871, 24.00922], [93.50616, 23.94432], [93.46633, 23.97067], [93.41415, 24.07854], [93.34735, 24.10151], [93.32351, 24.04468], [93.36059, 23.93176], [93.3908, 23.92925], [93.3908, 23.7622], [93.43475, 23.68299], [93.38805, 23.4728], [93.39981, 23.38828], [93.38781, 23.36139], [93.36862, 23.35426], [93.38478, 23.13698], [93.2878, 23.00464], [93.12988, 23.05772], [93.134, 22.92498], [93.09417, 22.69459], [93.134, 22.59573], [93.11477, 22.54374], [93.13537, 22.45873], [93.18206, 22.43716], [93.19991, 22.25425], [93.14224, 22.24535], [93.15734, 22.18687], [93.04885, 22.20595], [92.99255, 22.05965], [92.99804, 21.98964], [92.93899, 22.02656], [92.89504, 21.95143], [92.86208, 22.05456], [92.70416, 22.16017], [92.67532, 22.03547], [92.60949, 21.97638], [92.62187, 21.87037]]]] } },
20659     { type: "Feature", properties: { iso1A2: "MN", iso1A3: "MNG", iso1N3: "496", wikidata: "Q711", nameEn: "Mongolia", groups: ["030", "142", "UN"], callingCodes: ["976"] }, geometry: { type: "MultiPolygon", coordinates: [[[[102.14032, 51.35566], [101.5044, 51.50467], [101.39085, 51.45753], [100.61116, 51.73028], [99.89203, 51.74903], [99.75578, 51.90108], [99.27888, 51.96876], [98.87768, 52.14563], [98.74142, 51.8637], [98.33222, 51.71832], [98.22053, 51.46579], [98.05257, 51.46696], [97.83305, 51.00248], [98.01472, 50.86652], [97.9693, 50.78044], [98.06393, 50.61262], [98.31373, 50.4996], [98.29481, 50.33561], [97.85197, 49.91339], [97.76871, 49.99861], [97.56432, 49.92801], [97.56811, 49.84265], [97.24639, 49.74737], [96.97388, 49.88413], [95.80056, 50.04239], [95.74757, 49.97915], [95.02465, 49.96941], [94.97166, 50.04725], [94.6121, 50.04239], [94.49477, 50.17832], [94.39258, 50.22193], [94.30823, 50.57498], [92.99595, 50.63183], [93.01109, 50.79001], [92.44714, 50.78762], [92.07173, 50.69585], [91.86048, 50.73734], [89.59711, 49.90851], [89.70687, 49.72535], [88.82499, 49.44808], [88.42449, 49.48821], [88.17223, 49.46934], [88.15543, 49.30314], [87.98977, 49.18147], [87.81333, 49.17354], [87.88171, 48.95853], [87.73822, 48.89582], [88.0788, 48.71436], [87.96361, 48.58478], [88.58939, 48.34531], [88.58316, 48.21893], [88.8011, 48.11302], [88.93186, 48.10263], [89.0711, 47.98528], [89.55453, 48.0423], [89.76624, 47.82745], [90.06512, 47.88177], [90.10871, 47.7375], [90.33598, 47.68303], [90.48854, 47.41826], [90.48542, 47.30438], [90.76108, 46.99399], [90.84035, 46.99525], [91.03649, 46.72916], [91.0147, 46.58171], [91.07696, 46.57315], [90.89639, 46.30711], [90.99672, 46.14207], [91.03026, 46.04194], [90.70907, 45.73437], [90.65114, 45.49314], [90.89169, 45.19667], [91.64048, 45.07408], [93.51161, 44.95964], [94.10003, 44.71016], [94.71959, 44.35284], [95.01191, 44.25274], [95.39772, 44.2805], [95.32891, 44.02407], [95.52594, 43.99353], [95.89543, 43.2528], [96.35658, 42.90363], [96.37926, 42.72055], [97.1777, 42.7964], [99.50671, 42.56535], [100.33297, 42.68231], [100.84979, 42.67087], [101.80515, 42.50074], [102.07645, 42.22519], [102.72403, 42.14675], [103.92804, 41.78246], [104.52258, 41.8706], [104.51667, 41.66113], [105.0123, 41.63188], [106.76517, 42.28741], [107.24774, 42.36107], [107.29755, 42.41395], [107.49681, 42.46221], [107.57258, 42.40898], [108.84489, 42.40246], [109.00679, 42.45302], [109.452, 42.44842], [109.89402, 42.63111], [110.08401, 42.6411], [110.4327, 42.78293], [111.0149, 43.3289], [111.59087, 43.51207], [111.79758, 43.6637], [111.93776, 43.68709], [111.96289, 43.81596], [111.40498, 44.3461], [111.76275, 44.98032], [111.98695, 45.09074], [112.4164, 45.06858], [112.74662, 44.86297], [113.70918, 44.72891], [114.5166, 45.27189], [114.54801, 45.38337], [114.74612, 45.43585], [114.94546, 45.37377], [115.60329, 45.44717], [116.16989, 45.68603], [116.27366, 45.78637], [116.24012, 45.8778], [116.26678, 45.96479], [116.58612, 46.30211], [116.75551, 46.33083], [116.83166, 46.38637], [117.36609, 46.36335], [117.41782, 46.57862], [117.60748, 46.59771], [117.69554, 46.50991], [118.30534, 46.73519], [118.78747, 46.68689], [118.8337, 46.77742], [118.89974, 46.77139], [118.92616, 46.72765], [119.00541, 46.74273], [119.10448, 46.65516], [119.24978, 46.64761], [119.32827, 46.61433], [119.42827, 46.63783], [119.65265, 46.62342], [119.68127, 46.59015], [119.77373, 46.62947], [119.80455, 46.67631], [119.89261, 46.66423], [119.91242, 46.90091], [119.85518, 46.92196], [119.71209, 47.19192], [119.62403, 47.24575], [119.56019, 47.24874], [119.54918, 47.29505], [119.31964, 47.42617], [119.35892, 47.48104], [119.13995, 47.53997], [119.12343, 47.66458], [118.7564, 47.76947], [118.55766, 47.99277], [118.29654, 48.00246], [118.22677, 48.03853], [118.11009, 48.04], [118.03676, 48.00982], [117.80196, 48.01661], [117.50181, 47.77216], [117.37875, 47.63627], [116.9723, 47.87285], [116.67405, 47.89039], [116.4465, 47.83662], [116.21879, 47.88505], [115.94296, 47.67741], [115.57128, 47.91988], [115.52082, 48.15367], [115.811, 48.25699], [115.78876, 48.51781], [116.06565, 48.81716], [116.03781, 48.87014], [116.71193, 49.83813], [116.62502, 49.92919], [116.22402, 50.04477], [115.73602, 49.87688], [115.26068, 49.97367], [114.9703, 50.19254], [114.325, 50.28098], [113.20216, 49.83356], [113.02647, 49.60772], [110.64493, 49.1816], [110.39891, 49.25083], [110.24373, 49.16676], [109.51325, 49.22859], [109.18017, 49.34709], [108.53969, 49.32325], [108.27937, 49.53167], [107.95387, 49.66659], [107.96116, 49.93191], [107.36407, 49.97612], [107.1174, 50.04239], [107.00007, 50.1977], [106.80326, 50.30177], [106.58373, 50.34044], [106.51122, 50.34408], [106.49628, 50.32436], [106.47156, 50.31909], [106.07865, 50.33474], [106.05562, 50.40582], [105.32528, 50.4648], [103.70343, 50.13952], [102.71178, 50.38873], [102.32194, 50.67982], [102.14032, 51.35566]]]] } },
20660     { type: "Feature", properties: { iso1A2: "MO", iso1A3: "MAC", iso1N3: "446", wikidata: "Q14773", nameEn: "Macau", aliases: ["Macao"], country: "CN", groups: ["030", "142", "UN"], driveSide: "left", callingCodes: ["853"] }, geometry: { type: "MultiPolygon", coordinates: [[[[113.54942, 22.14519], [113.54839, 22.10909], [113.57191, 22.07696], [113.63011, 22.10782], [113.60504, 22.20464], [113.57123, 22.20416], [113.56865, 22.20973], [113.5508, 22.21672], [113.54333, 22.21688], [113.54093, 22.21314], [113.53593, 22.2137], [113.53301, 22.21235], [113.53552, 22.20607], [113.52659, 22.18271], [113.54093, 22.15497], [113.54942, 22.14519]]]] } },
20661     { type: "Feature", properties: { iso1A2: "MP", iso1A3: "MNP", iso1N3: "580", wikidata: "Q16644", nameEn: "Northern Mariana Islands", aliases: ["US-MP"], country: "US", groups: ["Q1352230", "Q153732", "057", "009", "UN"], roadSpeedUnit: "mph", callingCodes: ["1 670"] }, geometry: { type: "MultiPolygon", coordinates: [[[[135.52896, 14.32623], [152.19114, 13.63487], [145.05972, 21.28731], [135.52896, 14.32623]]]] } },
20662     { type: "Feature", properties: { iso1A2: "MQ", iso1A3: "MTQ", iso1N3: "474", wikidata: "Q17054", nameEn: "Martinique", country: "FR", groups: ["Q3320166", "EU", "029", "003", "419", "019", "UN"], callingCodes: ["596"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-59.95997, 14.20285], [-61.07821, 15.25109], [-61.69315, 14.26451], [-59.95997, 14.20285]]]] } },
20663     { type: "Feature", properties: { iso1A2: "MR", iso1A3: "MRT", iso1N3: "478", wikidata: "Q1025", nameEn: "Mauritania", groups: ["011", "202", "002", "UN"], callingCodes: ["222"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-5.60725, 16.49919], [-6.57191, 25.0002], [-4.83423, 24.99935], [-8.66674, 27.31569], [-8.66721, 25.99918], [-12.0002, 25.9986], [-12.00251, 23.4538], [-12.14969, 23.41935], [-12.36213, 23.3187], [-12.5741, 23.28975], [-13.00412, 23.02297], [-13.10753, 22.89493], [-13.15313, 22.75649], [-13.08438, 22.53866], [-13.01525, 21.33343], [-16.95474, 21.33997], [-16.99806, 21.12142], [-17.0357, 21.05368], [-17.0396, 20.9961], [-17.06781, 20.92697], [-17.0695, 20.85742], [-17.0471, 20.76408], [-17.15288, 16.07139], [-16.50854, 16.09032], [-16.48967, 16.0496], [-16.44814, 16.09753], [-16.4429, 16.20605], [-16.27016, 16.51565], [-15.6509, 16.50315], [-15.00557, 16.64997], [-14.32144, 16.61495], [-13.80075, 16.13961], [-13.43135, 16.09022], [-13.11029, 15.52116], [-12.23936, 14.76324], [-11.94903, 14.76143], [-11.70705, 15.51558], [-11.43483, 15.62339], [-10.90932, 15.11001], [-10.71721, 15.4223], [-9.40447, 15.4396], [-9.44673, 15.60553], [-9.33314, 15.7044], [-9.31106, 15.69412], [-9.32979, 15.50032], [-5.50165, 15.50061], [-5.33435, 16.33354], [-5.60725, 16.49919]]]] } },
20664     { type: "Feature", properties: { iso1A2: "MS", iso1A3: "MSR", iso1N3: "500", wikidata: "Q13353", nameEn: "Montserrat", country: "GB", groups: ["BOTS", "029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1 664"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-61.91508, 16.51165], [-62.1023, 16.97277], [-62.58307, 16.68909], [-61.91508, 16.51165]]]] } },
20665     { type: "Feature", properties: { iso1A2: "MT", iso1A3: "MLT", iso1N3: "470", wikidata: "Q233", nameEn: "Malta", groups: ["EU", "039", "150", "UN"], driveSide: "left", callingCodes: ["356"] }, geometry: { type: "MultiPolygon", coordinates: [[[[15.70991, 35.79901], [14.07544, 36.41525], [13.27636, 35.20764], [15.70991, 35.79901]]]] } },
20666     { type: "Feature", properties: { iso1A2: "MU", iso1A3: "MUS", iso1N3: "480", wikidata: "Q1027", nameEn: "Mauritius", groups: ["014", "202", "002", "UN"], driveSide: "left", callingCodes: ["230"] }, geometry: { type: "MultiPolygon", coordinates: [[[[56.09755, -9.55401], [57.50644, -31.92637], [68.4673, -19.15185], [56.09755, -9.55401]]]] } },
20667     { type: "Feature", properties: { iso1A2: "MV", iso1A3: "MDV", iso1N3: "462", wikidata: "Q826", nameEn: "Maldives", groups: ["034", "142", "UN"], driveSide: "left", callingCodes: ["960"] }, geometry: { type: "MultiPolygon", coordinates: [[[[71.9161, 8.55531], [72.57428, -3.7623], [76.59015, 5.591], [71.9161, 8.55531]]]] } },
20668     { type: "Feature", properties: { iso1A2: "MW", iso1A3: "MWI", iso1N3: "454", wikidata: "Q1020", nameEn: "Malawi", groups: ["014", "202", "002", "UN"], driveSide: "left", callingCodes: ["265"] }, geometry: { type: "MultiPolygon", coordinates: [[[[33.48052, -9.62442], [33.31581, -9.48554], [33.14925, -9.49322], [32.99397, -9.36712], [32.95389, -9.40138], [33.00476, -9.5133], [33.00256, -9.63053], [33.05485, -9.61316], [33.10163, -9.66525], [33.12144, -9.58929], [33.2095, -9.61099], [33.31517, -9.82364], [33.36581, -9.81063], [33.37902, -9.9104], [33.31297, -10.05133], [33.53863, -10.20148], [33.54797, -10.36077], [33.70675, -10.56896], [33.47636, -10.78465], [33.28022, -10.84428], [33.25998, -10.88862], [33.39697, -11.15296], [33.29267, -11.3789], [33.29267, -11.43536], [33.23663, -11.40637], [33.24252, -11.59302], [33.32692, -11.59248], [33.33937, -11.91252], [33.25998, -12.14242], [33.3705, -12.34931], [33.47636, -12.32498], [33.54485, -12.35996], [33.37517, -12.54085], [33.28177, -12.54692], [33.18837, -12.61377], [33.05917, -12.59554], [32.94397, -12.76868], [32.96733, -12.88251], [33.02181, -12.88707], [32.98289, -13.12671], [33.0078, -13.19492], [32.86113, -13.47292], [32.84176, -13.52794], [32.73683, -13.57682], [32.68436, -13.55769], [32.66468, -13.60019], [32.68654, -13.64268], [32.7828, -13.64805], [32.84528, -13.71576], [32.76962, -13.77224], [32.79015, -13.80755], [32.88985, -13.82956], [32.99042, -13.95689], [33.02977, -14.05022], [33.07568, -13.98447], [33.16749, -13.93992], [33.24249, -14.00019], [33.66677, -14.61306], [33.7247, -14.4989], [33.88503, -14.51652], [33.92898, -14.47929], [34.08588, -14.48893], [34.18733, -14.43823], [34.22355, -14.43607], [34.34453, -14.3985], [34.35843, -14.38652], [34.39277, -14.39467], [34.4192, -14.43191], [34.44641, -14.47746], [34.45053, -14.49873], [34.47628, -14.53363], [34.48932, -14.53646], [34.49636, -14.55091], [34.52366, -14.5667], [34.53962, -14.59776], [34.55112, -14.64494], [34.53516, -14.67782], [34.52057, -14.68263], [34.54503, -14.74672], [34.567, -14.77345], [34.61522, -14.99583], [34.57503, -15.30619], [34.43126, -15.44778], [34.44981, -15.60864], [34.25195, -15.90321], [34.43126, -16.04737], [34.40344, -16.20923], [35.04805, -16.83167], [35.13771, -16.81687], [35.17017, -16.93521], [35.04805, -17.00027], [35.0923, -17.13235], [35.3062, -17.1244], [35.27065, -16.93817], [35.30929, -16.82871], [35.27219, -16.69402], [35.14235, -16.56812], [35.25828, -16.4792], [35.30157, -16.2211], [35.43355, -16.11371], [35.52365, -16.15414], [35.70107, -16.10147], [35.80487, -16.03907], [35.85303, -15.41913], [35.78799, -15.17428], [35.91812, -14.89514], [35.87212, -14.89478], [35.86945, -14.67481], [35.5299, -14.27714], [35.47989, -14.15594], [34.86229, -13.48958], [34.60253, -13.48487], [34.37831, -12.17408], [34.46088, -12.0174], [34.70739, -12.15652], [34.82903, -12.04837], [34.57917, -11.87849], [34.64241, -11.57499], [34.96296, -11.57354], [34.91153, -11.39799], [34.79375, -11.32245], [34.63305, -11.11731], [34.61161, -11.01611], [34.67047, -10.93796], [34.65946, -10.6828], [34.57581, -10.56271], [34.51911, -10.12279], [34.54499, -10.0678], [34.03865, -9.49398], [33.95829, -9.54066], [33.9638, -9.62206], [33.93298, -9.71647], [33.76677, -9.58516], [33.48052, -9.62442]]]] } },
20669     { type: "Feature", properties: { iso1A2: "MX", iso1A3: "MEX", iso1N3: "484", wikidata: "Q96", nameEn: "Mexico", groups: ["013", "003", "419", "019", "UN"], callingCodes: ["52"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-117.1243, 32.53427], [-118.48109, 32.5991], [-120.12904, 18.41089], [-92.37213, 14.39277], [-92.2261, 14.53423], [-92.1454, 14.6804], [-92.18161, 14.84147], [-92.1423, 14.88647], [-92.1454, 14.98143], [-92.0621, 15.07406], [-92.20983, 15.26077], [-91.73182, 16.07371], [-90.44567, 16.07573], [-90.40499, 16.40524], [-90.61212, 16.49832], [-90.69064, 16.70697], [-91.04436, 16.92175], [-91.43809, 17.25373], [-90.99199, 17.25192], [-90.98678, 17.81655], [-89.14985, 17.81563], [-89.15105, 17.95104], [-89.03839, 18.0067], [-88.8716, 17.89535], [-88.71505, 18.0707], [-88.48242, 18.49164], [-88.3268, 18.49048], [-88.29909, 18.47591], [-88.26593, 18.47617], [-88.03238, 18.41778], [-88.03165, 18.16657], [-87.90671, 18.15213], [-87.87604, 18.18313], [-87.86657, 18.19971], [-87.85693, 18.18266], [-87.84815, 18.18511], [-86.92368, 17.61462], [-85.9092, 21.8218], [-96.92418, 25.97377], [-97.13927, 25.96583], [-97.35946, 25.92189], [-97.37332, 25.83854], [-97.42511, 25.83969], [-97.45669, 25.86874], [-97.49828, 25.89877], [-97.52025, 25.88518], [-97.66511, 26.01708], [-97.95155, 26.0625], [-97.97017, 26.05232], [-98.24603, 26.07191], [-98.27075, 26.09457], [-98.30491, 26.10475], [-98.35126, 26.15129], [-99.00546, 26.3925], [-99.03053, 26.41249], [-99.08477, 26.39849], [-99.53573, 27.30926], [-99.49744, 27.43746], [-99.482, 27.47128], [-99.48045, 27.49016], [-99.50208, 27.50021], [-99.52955, 27.49747], [-99.51478, 27.55836], [-99.55409, 27.61314], [-100.50029, 28.66117], [-100.51222, 28.70679], [-100.5075, 28.74066], [-100.52313, 28.75598], [-100.59809, 28.88197], [-100.63689, 28.90812], [-100.67294, 29.09744], [-100.79696, 29.24688], [-100.87982, 29.296], [-100.94056, 29.33371], [-100.94579, 29.34523], [-100.96725, 29.3477], [-101.01128, 29.36947], [-101.05686, 29.44738], [-101.47277, 29.7744], [-102.60596, 29.8192], [-103.15787, 28.93865], [-104.37752, 29.54255], [-104.39363, 29.55396], [-104.3969, 29.57105], [-104.5171, 29.64671], [-104.77674, 30.4236], [-106.00363, 31.39181], [-106.09025, 31.40569], [-106.20346, 31.46305], [-106.23711, 31.51262], [-106.24612, 31.54193], [-106.28084, 31.56173], [-106.30305, 31.62154], [-106.33419, 31.66303], [-106.34864, 31.69663], [-106.3718, 31.71165], [-106.38003, 31.73151], [-106.41773, 31.75196], [-106.43419, 31.75478], [-106.45244, 31.76523], [-106.46726, 31.75998], [-106.47298, 31.75054], [-106.48815, 31.74769], [-106.50111, 31.75714], [-106.50962, 31.76155], [-106.51251, 31.76922], [-106.52266, 31.77509], [-106.529, 31.784], [-108.20899, 31.78534], [-108.20979, 31.33316], [-111.07523, 31.33232], [-114.82011, 32.49609], [-114.79524, 32.55731], [-114.81141, 32.55543], [-114.80584, 32.62028], [-114.76736, 32.64094], [-114.71871, 32.71894], [-115.88053, 32.63624], [-117.1243, 32.53427]]]] } },
20670     { type: "Feature", properties: { iso1A2: "MY", iso1A3: "MYS", iso1N3: "458", wikidata: "Q833", nameEn: "Malaysia" }, geometry: null },
20671     { type: "Feature", properties: { iso1A2: "MZ", iso1A3: "MOZ", iso1N3: "508", wikidata: "Q1029", nameEn: "Mozambique", groups: ["014", "202", "002", "UN"], driveSide: "left", callingCodes: ["258"] }, geometry: { type: "MultiPolygon", coordinates: [[[[40.74206, -10.25691], [40.44265, -10.4618], [40.00295, -10.80255], [39.58249, -10.96043], [39.24395, -11.17433], [38.88996, -11.16978], [38.47258, -11.4199], [38.21598, -11.27289], [37.93618, -11.26228], [37.8388, -11.3123], [37.76614, -11.53352], [37.3936, -11.68949], [36.80309, -11.56836], [36.62068, -11.72884], [36.19094, -11.70008], [36.19094, -11.57593], [35.82767, -11.41081], [35.63599, -11.55927], [34.96296, -11.57354], [34.64241, -11.57499], [34.57917, -11.87849], [34.82903, -12.04837], [34.70739, -12.15652], [34.46088, -12.0174], [34.37831, -12.17408], [34.60253, -13.48487], [34.86229, -13.48958], [35.47989, -14.15594], [35.5299, -14.27714], [35.86945, -14.67481], [35.87212, -14.89478], [35.91812, -14.89514], [35.78799, -15.17428], [35.85303, -15.41913], [35.80487, -16.03907], [35.70107, -16.10147], [35.52365, -16.15414], [35.43355, -16.11371], [35.30157, -16.2211], [35.25828, -16.4792], [35.14235, -16.56812], [35.27219, -16.69402], [35.30929, -16.82871], [35.27065, -16.93817], [35.3062, -17.1244], [35.0923, -17.13235], [35.04805, -17.00027], [35.17017, -16.93521], [35.13771, -16.81687], [35.04805, -16.83167], [34.40344, -16.20923], [34.43126, -16.04737], [34.25195, -15.90321], [34.44981, -15.60864], [34.43126, -15.44778], [34.57503, -15.30619], [34.61522, -14.99583], [34.567, -14.77345], [34.54503, -14.74672], [34.52057, -14.68263], [34.53516, -14.67782], [34.55112, -14.64494], [34.53962, -14.59776], [34.52366, -14.5667], [34.49636, -14.55091], [34.48932, -14.53646], [34.47628, -14.53363], [34.45053, -14.49873], [34.44641, -14.47746], [34.4192, -14.43191], [34.39277, -14.39467], [34.35843, -14.38652], [34.34453, -14.3985], [34.22355, -14.43607], [34.18733, -14.43823], [34.08588, -14.48893], [33.92898, -14.47929], [33.88503, -14.51652], [33.7247, -14.4989], [33.66677, -14.61306], [33.24249, -14.00019], [30.22098, -14.99447], [30.41902, -15.62269], [30.42568, -15.9962], [30.91597, -15.99924], [30.97761, -16.05848], [31.13171, -15.98019], [31.30563, -16.01193], [31.42451, -16.15154], [31.67988, -16.19595], [31.90223, -16.34388], [31.91324, -16.41569], [32.02772, -16.43892], [32.28529, -16.43892], [32.42838, -16.4727], [32.71017, -16.59932], [32.69917, -16.66893], [32.78943, -16.70267], [32.97655, -16.70689], [32.91051, -16.89446], [32.84113, -16.92259], [32.96554, -17.11971], [33.00517, -17.30477], [33.0426, -17.3468], [32.96554, -17.48964], [32.98536, -17.55891], [33.0492, -17.60298], [32.94133, -17.99705], [33.03159, -18.35054], [33.02278, -18.4696], [32.88629, -18.51344], [32.88629, -18.58023], [32.95013, -18.69079], [32.9017, -18.7992], [32.82465, -18.77419], [32.70137, -18.84712], [32.73439, -18.92628], [32.69917, -18.94293], [32.72118, -19.02204], [32.84006, -19.0262], [32.87088, -19.09279], [32.85107, -19.29238], [32.77966, -19.36098], [32.78282, -19.47513], [32.84446, -19.48343], [32.84666, -19.68462], [32.95013, -19.67219], [33.06461, -19.77787], [33.01178, -20.02007], [32.93032, -20.03868], [32.85987, -20.16686], [32.85987, -20.27841], [32.66174, -20.56106], [32.55167, -20.56312], [32.48122, -20.63319], [32.51644, -20.91929], [32.37115, -21.133], [32.48236, -21.32873], [32.41234, -21.31246], [31.38336, -22.36919], [31.30611, -22.422], [31.55779, -23.176], [31.56539, -23.47268], [31.67942, -23.60858], [31.70223, -23.72695], [31.77445, -23.90082], [31.87707, -23.95293], [31.90368, -24.18892], [31.9835, -24.29983], [32.03196, -25.10785], [32.01676, -25.38117], [31.97875, -25.46356], [32.00631, -25.65044], [31.92649, -25.84216], [31.974, -25.95387], [32.00916, -25.999], [32.08599, -26.00978], [32.10435, -26.15656], [32.07352, -26.40185], [32.13409, -26.5317], [32.13315, -26.84345], [32.19409, -26.84032], [32.22302, -26.84136], [32.29584, -26.852], [32.35222, -26.86027], [34.51034, -26.91792], [42.99868, -12.65261], [40.74206, -10.25691]]]] } },
20672     { type: "Feature", properties: { iso1A2: "NA", iso1A3: "NAM", iso1N3: "516", wikidata: "Q1030", nameEn: "Namibia", groups: ["018", "202", "002", "UN"], driveSide: "left", callingCodes: ["264"] }, geometry: { type: "MultiPolygon", coordinates: [[[[14.28743, -17.38814], [13.95896, -17.43141], [13.36212, -16.98048], [12.97145, -16.98567], [12.52111, -17.24495], [12.07076, -17.15165], [11.75063, -17.25013], [10.5065, -17.25284], [12.51595, -32.27486], [16.45332, -28.63117], [16.46592, -28.57126], [16.59922, -28.53246], [16.90446, -28.057], [17.15405, -28.08573], [17.4579, -28.68718], [18.99885, -28.89165], [19.99882, -28.42622], [19.99817, -24.76768], [19.99912, -21.99991], [20.99751, -22.00026], [20.99904, -18.31743], [21.45556, -18.31795], [23.0996, -18.00075], [23.29618, -17.99855], [23.61088, -18.4881], [24.19416, -18.01919], [24.40577, -17.95726], [24.57485, -18.07151], [24.6303, -17.9863], [24.71887, -17.9218], [24.73364, -17.89338], [24.95586, -17.79674], [25.05895, -17.84452], [25.16882, -17.78253], [25.26433, -17.79571], [25.00198, -17.58221], [24.70864, -17.49501], [24.5621, -17.52963], [24.38712, -17.46818], [24.32811, -17.49082], [24.23619, -17.47489], [23.47474, -17.62877], [21.42741, -18.02787], [21.14283, -17.94318], [18.84226, -17.80375], [18.39229, -17.38927], [14.28743, -17.38814]]]] } },
20673     { type: "Feature", properties: { iso1A2: "NC", iso1A3: "NCL", iso1N3: "540", wikidata: "Q33788", nameEn: "New Caledonia", country: "FR", groups: ["EU", "Q1451600", "054", "009", "UN"], callingCodes: ["687"] }, geometry: { type: "MultiPolygon", coordinates: [[[[159.77159, -28.41151], [174.245, -23.1974], [156.73836, -14.50464], [159.77159, -28.41151]]]] } },
20674     { type: "Feature", properties: { iso1A2: "NE", iso1A3: "NER", iso1N3: "562", wikidata: "Q1032", nameEn: "Niger", aliases: ["RN"], groups: ["011", "202", "002", "UN"], callingCodes: ["227"] }, geometry: { type: "MultiPolygon", coordinates: [[[[14.22918, 22.61719], [13.5631, 23.16574], [11.96886, 23.51735], [7.48273, 20.87258], [7.38361, 20.79165], [5.8153, 19.45101], [4.26651, 19.14224], [4.26762, 17.00432], [4.21787, 17.00118], [4.19893, 16.39923], [3.50368, 15.35934], [3.03134, 15.42221], [3.01806, 15.34571], [1.31275, 15.27978], [0.96711, 14.98275], [0.72632, 14.95898], [0.23859, 15.00135], [0.16936, 14.51654], [0.38051, 14.05575], [0.61924, 13.68491], [0.77377, 13.6866], [0.77637, 13.64442], [0.99514, 13.5668], [1.02813, 13.46635], [1.20088, 13.38951], [1.24429, 13.39373], [1.28509, 13.35488], [1.24516, 13.33968], [1.21217, 13.37853], [1.18873, 13.31771], [0.99253, 13.37515], [0.99167, 13.10727], [2.26349, 12.41915], [2.05785, 12.35539], [2.39723, 11.89473], [2.45824, 11.98672], [2.39657, 12.10952], [2.37783, 12.24804], [2.6593, 12.30631], [2.83978, 12.40585], [3.25352, 12.01467], [3.31613, 11.88495], [3.48187, 11.86092], [3.59375, 11.70269], [3.61075, 11.69181], [3.67988, 11.75429], [3.67122, 11.80865], [3.63063, 11.83042], [3.61955, 11.91847], [3.67775, 11.97599], [3.63136, 12.11826], [3.66364, 12.25884], [3.65111, 12.52223], [3.94339, 12.74979], [4.10006, 12.98862], [4.14367, 13.17189], [4.14186, 13.47586], [4.23456, 13.47725], [4.4668, 13.68286], [4.87425, 13.78], [4.9368, 13.7345], [5.07396, 13.75052], [5.21026, 13.73627], [5.27797, 13.75474], [5.35437, 13.83567], [5.52957, 13.8845], [6.15771, 13.64564], [6.27411, 13.67835], [6.43053, 13.6006], [6.69617, 13.34057], [6.94445, 12.99825], [7.0521, 13.00076], [7.12676, 13.02445], [7.22399, 13.1293], [7.39241, 13.09717], [7.81085, 13.34902], [8.07997, 13.30847], [8.25185, 13.20369], [8.41853, 13.06166], [8.49493, 13.07519], [8.60431, 13.01768], [8.64251, 12.93985], [8.97413, 12.83661], [9.65995, 12.80614], [10.00373, 13.18171], [10.19993, 13.27129], [10.46731, 13.28819], [10.66004, 13.36422], [11.4535, 13.37773], [11.88236, 13.2527], [12.04209, 13.14452], [12.16189, 13.10056], [12.19315, 13.12423], [12.47095, 13.06673], [12.58033, 13.27805], [12.6793, 13.29157], [12.87376, 13.48919], [13.05085, 13.53984], [13.19844, 13.52802], [13.33213, 13.71195], [13.6302, 13.71094], [13.47559, 14.40881], [13.48259, 14.46704], [13.68573, 14.55276], [13.67878, 14.64013], [13.809, 14.72915], [13.78991, 14.87519], [13.86301, 15.04043], [14.37425, 15.72591], [15.50373, 16.89649], [15.6032, 18.77402], [15.75098, 19.93002], [15.99632, 20.35364], [15.6721, 20.70069], [15.59841, 20.74039], [15.56004, 20.79488], [15.55382, 20.86507], [15.57248, 20.92138], [15.62515, 20.95395], [15.28332, 21.44557], [15.20213, 21.49365], [15.19692, 21.99339], [14.99751, 23.00539], [14.22918, 22.61719]]]] } },
20675     { type: "Feature", properties: { iso1A2: "NF", iso1A3: "NFK", iso1N3: "574", wikidata: "Q31057", nameEn: "Norfolk Island", country: "AU", groups: ["053", "009", "UN"], driveSide: "left", callingCodes: ["672 3"] }, geometry: { type: "MultiPolygon", coordinates: [[[[169.82316, -28.16667], [166.29505, -28.29175], [167.94076, -30.60745], [169.82316, -28.16667]]]] } },
20676     { type: "Feature", properties: { iso1A2: "NG", iso1A3: "NGA", iso1N3: "566", wikidata: "Q1033", nameEn: "Nigeria", groups: ["011", "202", "002", "UN"], callingCodes: ["234"] }, geometry: { type: "MultiPolygon", coordinates: [[[[6.15771, 13.64564], [5.52957, 13.8845], [5.35437, 13.83567], [5.27797, 13.75474], [5.21026, 13.73627], [5.07396, 13.75052], [4.9368, 13.7345], [4.87425, 13.78], [4.4668, 13.68286], [4.23456, 13.47725], [4.14186, 13.47586], [4.14367, 13.17189], [4.10006, 12.98862], [3.94339, 12.74979], [3.65111, 12.52223], [3.66364, 12.25884], [3.63136, 12.11826], [3.67775, 11.97599], [3.61955, 11.91847], [3.63063, 11.83042], [3.67122, 11.80865], [3.67988, 11.75429], [3.61075, 11.69181], [3.59375, 11.70269], [3.49175, 11.29765], [3.71505, 11.13015], [3.84243, 10.59316], [3.78292, 10.40538], [3.6844, 10.46351], [3.57275, 10.27185], [3.66908, 10.18136], [3.54429, 9.87739], [3.35383, 9.83641], [3.32099, 9.78032], [3.34726, 9.70696], [3.25093, 9.61632], [3.13928, 9.47167], [3.14147, 9.28375], [3.08017, 9.10006], [2.77907, 9.06924], [2.67523, 7.87825], [2.73095, 7.7755], [2.73405, 7.5423], [2.78668, 7.5116], [2.79442, 7.43486], [2.74489, 7.42565], [2.76965, 7.13543], [2.71702, 6.95722], [2.74024, 6.92802], [2.73405, 6.78508], [2.78823, 6.76356], [2.78204, 6.70514], [2.7325, 6.64057], [2.74334, 6.57291], [2.70464, 6.50831], [2.70566, 6.38038], [2.74181, 6.13349], [5.87055, 3.78489], [8.34397, 4.30689], [8.60302, 4.87353], [8.78027, 5.1243], [8.92029, 5.58403], [8.83687, 5.68483], [8.88156, 5.78857], [8.84209, 5.82562], [9.51757, 6.43874], [9.70674, 6.51717], [9.77824, 6.79088], [9.86314, 6.77756], [10.15135, 7.03781], [10.21466, 6.88996], [10.53639, 6.93432], [10.57214, 7.16345], [10.59746, 7.14719], [10.60789, 7.06885], [10.83727, 6.9358], [10.8179, 6.83377], [10.94302, 6.69325], [11.09644, 6.68437], [11.09495, 6.51717], [11.42041, 6.53789], [11.42264, 6.5882], [11.51499, 6.60892], [11.57755, 6.74059], [11.55818, 6.86186], [11.63117, 6.9905], [11.87396, 7.09398], [11.84864, 7.26098], [11.93205, 7.47812], [12.01844, 7.52981], [11.99908, 7.67302], [12.20909, 7.97553], [12.19271, 8.10826], [12.24782, 8.17904], [12.26123, 8.43696], [12.4489, 8.52536], [12.44146, 8.6152], [12.68722, 8.65938], [12.71701, 8.7595], [12.79, 8.75361], [12.81085, 8.91992], [12.90022, 9.11411], [12.91958, 9.33905], [12.85628, 9.36698], [13.02385, 9.49334], [13.22642, 9.57266], [13.25472, 9.76795], [13.29941, 9.8296], [13.25025, 9.86042], [13.24132, 9.91031], [13.27409, 9.93232], [13.286, 9.9822], [13.25323, 10.00127], [13.25025, 10.03647], [13.34111, 10.12299], [13.43644, 10.13326], [13.5705, 10.53183], [13.54964, 10.61236], [13.73434, 10.9255], [13.70753, 10.94451], [13.7403, 11.00593], [13.78945, 11.00154], [13.97489, 11.30258], [14.17821, 11.23831], [14.6124, 11.51283], [14.64591, 11.66166], [14.55207, 11.72001], [14.61612, 11.7798], [14.6474, 12.17466], [14.4843, 12.35223], [14.22215, 12.36533], [14.17523, 12.41916], [14.20204, 12.53405], [14.08251, 13.0797], [13.6302, 13.71094], [13.33213, 13.71195], [13.19844, 13.52802], [13.05085, 13.53984], [12.87376, 13.48919], [12.6793, 13.29157], [12.58033, 13.27805], [12.47095, 13.06673], [12.19315, 13.12423], [12.16189, 13.10056], [12.04209, 13.14452], [11.88236, 13.2527], [11.4535, 13.37773], [10.66004, 13.36422], [10.46731, 13.28819], [10.19993, 13.27129], [10.00373, 13.18171], [9.65995, 12.80614], [8.97413, 12.83661], [8.64251, 12.93985], [8.60431, 13.01768], [8.49493, 13.07519], [8.41853, 13.06166], [8.25185, 13.20369], [8.07997, 13.30847], [7.81085, 13.34902], [7.39241, 13.09717], [7.22399, 13.1293], [7.12676, 13.02445], [7.0521, 13.00076], [6.94445, 12.99825], [6.69617, 13.34057], [6.43053, 13.6006], [6.27411, 13.67835], [6.15771, 13.64564]]]] } },
20677     { type: "Feature", properties: { iso1A2: "NI", iso1A3: "NIC", iso1N3: "558", wikidata: "Q811", nameEn: "Nicaragua", groups: ["013", "003", "419", "019", "UN"], callingCodes: ["505"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-83.13724, 15.00002], [-83.49268, 15.01158], [-83.62101, 14.89448], [-83.89551, 14.76697], [-84.10584, 14.76353], [-84.48373, 14.63249], [-84.70119, 14.68078], [-84.82596, 14.82212], [-84.90082, 14.80489], [-85.1575, 14.53934], [-85.18602, 14.24929], [-85.32149, 14.2562], [-85.45762, 14.11304], [-85.73964, 13.9698], [-85.75477, 13.8499], [-86.03458, 13.99181], [-86.00685, 14.08474], [-86.14801, 14.04317], [-86.35219, 13.77157], [-86.76812, 13.79605], [-86.71267, 13.30348], [-86.87066, 13.30641], [-86.93383, 13.18677], [-86.93197, 13.05313], [-87.03785, 12.98682], [-87.06306, 13.00892], [-87.37107, 12.98646], [-87.55124, 13.12523], [-87.7346, 13.13228], [-88.11443, 12.63306], [-86.14524, 11.09059], [-85.71223, 11.06868], [-85.60529, 11.22607], [-84.92439, 10.9497], [-84.68197, 11.07568], [-83.90838, 10.71161], [-83.66597, 10.79916], [-83.68276, 11.01562], [-82.56142, 11.91792], [-82.06974, 14.49418], [-83.04763, 15.03256], [-83.13724, 15.00002]]]] } },
20678     { type: "Feature", properties: { iso1A2: "NL", iso1A3: "NLD", iso1N3: "528", wikidata: "Q29999", nameEn: "Kingdom of the Netherlands" }, geometry: null },
20679     { type: "Feature", properties: { iso1A2: "NO", iso1A3: "NOR", iso1N3: "578", wikidata: "Q20", nameEn: "Norway" }, geometry: null },
20680     { type: "Feature", properties: { iso1A2: "NP", iso1A3: "NPL", iso1N3: "524", wikidata: "Q837", nameEn: "Nepal", groups: ["034", "142", "UN"], driveSide: "left", callingCodes: ["977"] }, geometry: { type: "MultiPolygon", coordinates: [[[[88.13378, 27.88015], [87.82681, 27.95248], [87.72718, 27.80938], [87.56996, 27.84517], [87.11696, 27.84104], [87.03757, 27.94835], [86.75582, 28.04182], [86.74181, 28.10638], [86.56265, 28.09569], [86.51609, 27.96623], [86.42736, 27.91122], [86.22966, 27.9786], [86.18607, 28.17364], [86.088, 28.09264], [86.08333, 28.02121], [86.12069, 27.93047], [86.06309, 27.90021], [85.94946, 27.9401], [85.97813, 27.99023], [85.90743, 28.05144], [85.84672, 28.18187], [85.74864, 28.23126], [85.71907, 28.38064], [85.69105, 28.38475], [85.60854, 28.25045], [85.59765, 28.30529], [85.4233, 28.32996], [85.38127, 28.28336], [85.10729, 28.34092], [85.18668, 28.54076], [85.19135, 28.62825], [85.06059, 28.68562], [84.85511, 28.58041], [84.62317, 28.73887], [84.47528, 28.74023], [84.2231, 28.89571], [84.24801, 29.02783], [84.18107, 29.23451], [83.97559, 29.33091], [83.82303, 29.30513], [83.63156, 29.16249], [83.44787, 29.30513], [83.28131, 29.56813], [83.07116, 29.61957], [82.73024, 29.81695], [82.5341, 29.9735], [82.38622, 30.02608], [82.16984, 30.0692], [82.19475, 30.16884], [82.10757, 30.23745], [82.10135, 30.35439], [81.99082, 30.33423], [81.62033, 30.44703], [81.5459, 30.37688], [81.41018, 30.42153], [81.39928, 30.21862], [81.33355, 30.15303], [81.2623, 30.14596], [81.29032, 30.08806], [81.24362, 30.0126], [81.12842, 30.01395], [81.03953, 30.20059], [80.92547, 30.17193], [80.91143, 30.22173], [80.86673, 30.17321], [80.8778, 30.13384], [80.67076, 29.95732], [80.60226, 29.95732], [80.57179, 29.91422], [80.56247, 29.86661], [80.48997, 29.79566], [80.43458, 29.80466], [80.41554, 29.79451], [80.36803, 29.73865], [80.38428, 29.68513], [80.41858, 29.63581], [80.37939, 29.57098], [80.24322, 29.44299], [80.31428, 29.30784], [80.28626, 29.20327], [80.24112, 29.21414], [80.26602, 29.13938], [80.23178, 29.11626], [80.18085, 29.13649], [80.05743, 28.91479], [80.06957, 28.82763], [80.12125, 28.82346], [80.37188, 28.63371], [80.44504, 28.63098], [80.52443, 28.54897], [80.50575, 28.6706], [80.55142, 28.69182], [81.03471, 28.40054], [81.19847, 28.36284], [81.32923, 28.13521], [81.38683, 28.17638], [81.48179, 28.12148], [81.47867, 28.08303], [81.91223, 27.84995], [81.97214, 27.93322], [82.06554, 27.92222], [82.46405, 27.6716], [82.70378, 27.72122], [82.74119, 27.49838], [82.93261, 27.50328], [82.94938, 27.46036], [83.19413, 27.45632], [83.27197, 27.38309], [83.2673, 27.36235], [83.29999, 27.32778], [83.35136, 27.33885], [83.38872, 27.39276], [83.39495, 27.4798], [83.61288, 27.47013], [83.85595, 27.35797], [83.86182, 27.4241], [83.93306, 27.44939], [84.02229, 27.43836], [84.10791, 27.52399], [84.21376, 27.45218], [84.25735, 27.44941], [84.29315, 27.39], [84.62161, 27.33885], [84.69166, 27.21294], [84.64496, 27.04669], [84.793, 26.9968], [84.82913, 27.01989], [84.85754, 26.98984], [84.96687, 26.95599], [84.97186, 26.9149], [85.00536, 26.89523], [85.05592, 26.88991], [85.02635, 26.85381], [85.15883, 26.86966], [85.19291, 26.86909], [85.18046, 26.80519], [85.21159, 26.75933], [85.34302, 26.74954], [85.47752, 26.79292], [85.56471, 26.84133], [85.5757, 26.85955], [85.59461, 26.85161], [85.61621, 26.86721], [85.66239, 26.84822], [85.73483, 26.79613], [85.72315, 26.67471], [85.76907, 26.63076], [85.83126, 26.61134], [85.85126, 26.60866], [85.8492, 26.56667], [86.02729, 26.66756], [86.13596, 26.60651], [86.22513, 26.58863], [86.26235, 26.61886], [86.31564, 26.61925], [86.49726, 26.54218], [86.54258, 26.53819], [86.57073, 26.49825], [86.61313, 26.48658], [86.62686, 26.46891], [86.69124, 26.45169], [86.74025, 26.42386], [86.76797, 26.45892], [86.82898, 26.43919], [86.94543, 26.52076], [86.95912, 26.52076], [87.01559, 26.53228], [87.04691, 26.58685], [87.0707, 26.58571], [87.09147, 26.45039], [87.14751, 26.40542], [87.18863, 26.40558], [87.24682, 26.4143], [87.26587, 26.40592], [87.26568, 26.37294], [87.34568, 26.34787], [87.37314, 26.40815], [87.46566, 26.44058], [87.51571, 26.43106], [87.55274, 26.40596], [87.59175, 26.38342], [87.66803, 26.40294], [87.67893, 26.43501], [87.76004, 26.40711], [87.7918, 26.46737], [87.84193, 26.43663], [87.89085, 26.48565], [87.90115, 26.44923], [88.00895, 26.36029], [88.09414, 26.43732], [88.09963, 26.54195], [88.16452, 26.64111], [88.1659, 26.68177], [88.19107, 26.75516], [88.12302, 26.95324], [88.13422, 26.98705], [88.11719, 26.98758], [87.9887, 27.11045], [88.01587, 27.21388], [88.01646, 27.21612], [88.07277, 27.43007], [88.04008, 27.49223], [88.19107, 27.79285], [88.1973, 27.85067], [88.13378, 27.88015]]]] } },
20681     { type: "Feature", properties: { iso1A2: "NR", iso1A3: "NRU", iso1N3: "520", wikidata: "Q697", nameEn: "Nauru", groups: ["057", "009", "UN"], driveSide: "left", callingCodes: ["674"] }, geometry: { type: "MultiPolygon", coordinates: [[[[166.95155, 0.14829], [166.21778, -0.7977], [167.60042, -0.88259], [166.95155, 0.14829]]]] } },
20682     { type: "Feature", properties: { iso1A2: "NU", iso1A3: "NIU", iso1N3: "570", wikidata: "Q34020", nameEn: "Niue", country: "NZ", groups: ["061", "009", "UN"], driveSide: "left", callingCodes: ["683"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-170.83899, -18.53439], [-170.82274, -20.44429], [-168.63096, -18.60489], [-170.83899, -18.53439]]]] } },
20683     { type: "Feature", properties: { iso1A2: "NZ", iso1A3: "NZL", iso1N3: "554", wikidata: "Q664", nameEn: "New Zealand" }, geometry: null },
20684     { type: "Feature", properties: { iso1A2: "OM", iso1A3: "OMN", iso1N3: "512", wikidata: "Q842", nameEn: "Oman", groups: ["145", "142", "UN"], callingCodes: ["968"] }, geometry: { type: "MultiPolygon", coordinates: [[[[56.82555, 25.7713], [56.79239, 26.41236], [56.68954, 26.76645], [56.2644, 26.58649], [55.81777, 26.18798], [56.08666, 26.05038], [56.15498, 26.06828], [56.19334, 25.9795], [56.13963, 25.82765], [56.17416, 25.77239], [56.13579, 25.73524], [56.14826, 25.66351], [56.18363, 25.65508], [56.20473, 25.61119], [56.25365, 25.60211], [56.26636, 25.60643], [56.25341, 25.61443], [56.26534, 25.62825], [56.82555, 25.7713]]], [[[56.26062, 25.33108], [56.23362, 25.31253], [56.25008, 25.28843], [56.24465, 25.27505], [56.20838, 25.25668], [56.20872, 25.24104], [56.24341, 25.22867], [56.27628, 25.23404], [56.34438, 25.26653], [56.35172, 25.30681], [56.3111, 25.30107], [56.3005, 25.31815], [56.26062, 25.33108]], [[56.28423, 25.26344], [56.27086, 25.26128], [56.2716, 25.27916], [56.28102, 25.28486], [56.29379, 25.2754], [56.28423, 25.26344]]], [[[61.45114, 22.55394], [56.86325, 25.03856], [56.3227, 24.97284], [56.34873, 24.93205], [56.30269, 24.88334], [56.20568, 24.85063], [56.20062, 24.78565], [56.13684, 24.73699], [56.06128, 24.74457], [56.03535, 24.81161], [55.97836, 24.87673], [55.97467, 24.89639], [56.05106, 24.87461], [56.05715, 24.95727], [55.96316, 25.00857], [55.90849, 24.96771], [55.85094, 24.96858], [55.81116, 24.9116], [55.81348, 24.80102], [55.83408, 24.77858], [55.83271, 24.68567], [55.76461, 24.5287], [55.83271, 24.41521], [55.83395, 24.32776], [55.80747, 24.31069], [55.79145, 24.27914], [55.76781, 24.26209], [55.75939, 24.26114], [55.75382, 24.2466], [55.75257, 24.23466], [55.76558, 24.23227], [55.77658, 24.23476], [55.83367, 24.20193], [55.95472, 24.2172], [56.01799, 24.07426], [55.8308, 24.01633], [55.73301, 24.05994], [55.48677, 23.94946], [55.57358, 23.669], [55.22634, 23.10378], [55.2137, 22.71065], [55.66469, 21.99658], [54.99756, 20.00083], [52.00311, 19.00083], [52.78009, 17.35124], [52.74267, 17.29519], [52.81185, 17.28568], [57.49095, 8.14549], [61.45114, 22.55394]]]] } },
20685     { type: "Feature", properties: { iso1A2: "PA", iso1A3: "PAN", iso1N3: "591", wikidata: "Q804", nameEn: "Panama", groups: ["013", "003", "419", "019", "UN"], callingCodes: ["507"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-77.32389, 8.81247], [-77.58292, 9.22278], [-78.79327, 9.93766], [-82.51044, 9.65379], [-82.56507, 9.57279], [-82.61345, 9.49881], [-82.66667, 9.49746], [-82.77206, 9.59573], [-82.87919, 9.62645], [-82.84871, 9.4973], [-82.93516, 9.46741], [-82.93516, 9.07687], [-82.72126, 8.97125], [-82.88253, 8.83331], [-82.91377, 8.774], [-82.92068, 8.74832], [-82.8794, 8.6981], [-82.82739, 8.60153], [-82.83975, 8.54755], [-82.83322, 8.52464], [-82.8382, 8.48117], [-82.8679, 8.44042], [-82.93056, 8.43465], [-83.05209, 8.33394], [-82.9388, 8.26634], [-82.88641, 8.10219], [-82.89137, 8.05755], [-82.89978, 8.04083], [-82.94503, 7.93865], [-82.13751, 6.97312], [-78.06168, 7.07793], [-77.89178, 7.22681], [-77.81426, 7.48319], [-77.72157, 7.47612], [-77.72514, 7.72348], [-77.57185, 7.51147], [-77.17257, 7.97422], [-77.45064, 8.49991], [-77.32389, 8.81247]]]] } },
20686     { type: "Feature", properties: { iso1A2: "PE", iso1A3: "PER", iso1N3: "604", wikidata: "Q419", nameEn: "Peru", groups: ["005", "419", "019", "UN"], callingCodes: ["51"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-74.26675, -0.97229], [-74.42701, -0.50218], [-75.18513, -0.0308], [-75.25764, -0.11943], [-75.40192, -0.17196], [-75.61997, -0.10012], [-75.60169, -0.18708], [-75.53615, -0.19213], [-75.22862, -0.60048], [-75.22862, -0.95588], [-75.3872, -0.9374], [-75.57429, -1.55961], [-76.05203, -2.12179], [-76.6324, -2.58397], [-77.94147, -3.05454], [-78.19369, -3.36431], [-78.14324, -3.47653], [-78.22642, -3.51113], [-78.24589, -3.39907], [-78.34362, -3.38633], [-78.68394, -4.60754], [-78.85149, -4.66795], [-79.01659, -5.01481], [-79.1162, -4.97774], [-79.26248, -4.95167], [-79.59402, -4.46848], [-79.79722, -4.47558], [-80.13945, -4.29786], [-80.39256, -4.48269], [-80.46386, -4.41516], [-80.32114, -4.21323], [-80.45023, -4.20938], [-80.4822, -4.05477], [-80.46386, -4.01342], [-80.13232, -3.90317], [-80.19926, -3.68894], [-80.18741, -3.63994], [-80.19848, -3.59249], [-80.21642, -3.5888], [-80.20535, -3.51667], [-80.22629, -3.501], [-80.23651, -3.48652], [-80.24586, -3.48677], [-80.24123, -3.46124], [-80.20647, -3.431], [-80.30602, -3.39149], [-84.52388, -3.36941], [-85.71054, -21.15413], [-70.59118, -18.35072], [-70.378, -18.3495], [-70.31267, -18.31258], [-70.16394, -18.31737], [-69.96732, -18.25992], [-69.81607, -18.12582], [-69.75305, -17.94605], [-69.82868, -17.72048], [-69.79087, -17.65563], [-69.66483, -17.65083], [-69.46897, -17.4988], [-69.46863, -17.37466], [-69.62883, -17.28142], [-69.16896, -16.72233], [-69.00853, -16.66769], [-69.04027, -16.57214], [-68.98358, -16.42165], [-68.79464, -16.33272], [-68.96238, -16.194], [-69.09986, -16.22693], [-69.20291, -16.16668], [-69.40336, -15.61358], [-69.14856, -15.23478], [-69.36254, -14.94634], [-68.88135, -14.18639], [-69.05265, -13.68546], [-68.8864, -13.40792], [-68.85615, -12.87769], [-68.65044, -12.50689], [-68.98115, -11.8979], [-69.57156, -10.94555], [-69.57835, -10.94051], [-69.90896, -10.92744], [-70.38791, -11.07096], [-70.51395, -10.92249], [-70.64134, -11.0108], [-70.62487, -9.80666], [-70.55429, -9.76692], [-70.58453, -9.58303], [-70.53373, -9.42628], [-71.23394, -9.9668], [-72.14742, -9.98049], [-72.31883, -9.5184], [-72.72216, -9.41397], [-73.21498, -9.40904], [-72.92886, -9.04074], [-73.76576, -7.89884], [-73.65485, -7.77897], [-73.96938, -7.58465], [-73.77011, -7.28944], [-73.73986, -6.87919], [-73.12983, -6.43852], [-73.24579, -6.05764], [-72.83973, -5.14765], [-72.64391, -5.0391], [-71.87003, -4.51661], [-70.96814, -4.36915], [-70.77601, -4.15717], [-70.33236, -4.15214], [-70.19582, -4.3607], [-70.11305, -4.27281], [-70.00888, -4.37833], [-69.94708, -4.2431], [-70.3374, -3.79505], [-70.52393, -3.87553], [-70.71396, -3.7921], [-70.04609, -2.73906], [-70.94377, -2.23142], [-71.75223, -2.15058], [-72.92587, -2.44514], [-73.65312, -1.26222], [-74.26675, -0.97229]]]] } },
20687     { type: "Feature", properties: { iso1A2: "PF", iso1A3: "PYF", iso1N3: "258", wikidata: "Q30971", nameEn: "French Polynesia", country: "FR", groups: ["EU", "Q1451600", "061", "009", "UN"], callingCodes: ["689"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-135.59706, -4.70473], [-156.48634, -15.52824], [-156.45576, -31.75456], [-133.59543, -28.4709], [-135.59706, -4.70473]]]] } },
20688     { type: "Feature", properties: { iso1A2: "PG", iso1A3: "PNG", iso1N3: "598", wikidata: "Q691", nameEn: "Papua New Guinea", groups: ["054", "009", "UN"], driveSide: "left", callingCodes: ["675"] }, geometry: { type: "MultiPolygon", coordinates: [[[[141.03157, 2.12829], [140.99813, -6.3233], [140.85295, -6.72996], [140.90448, -6.85033], [141.01763, -6.90181], [141.01842, -9.35091], [141.88934, -9.36111], [142.19246, -9.15378], [142.48658, -9.36754], [143.29772, -9.33993], [143.87386, -9.02382], [145.2855, -9.62524], [156.73836, -14.50464], [154.74815, -7.33315], [155.60735, -6.92266], [155.69784, -6.92661], [155.92557, -6.84664], [156.03993, -6.65703], [156.03296, -6.55528], [160.43769, -4.17974], [141.03157, 2.12829]]]] } },
20689     { type: "Feature", properties: { iso1A2: "PH", iso1A3: "PHL", iso1N3: "608", wikidata: "Q928", nameEn: "Philippines", aliases: ["PI", "RP"], groups: ["035", "142", "UN"], callingCodes: ["63"] }, geometry: { type: "MultiPolygon", coordinates: [[[[129.19694, 7.84182], [121.8109, 21.77688], [120.69238, 21.52331], [118.82252, 14.67191], [115.39742, 10.92666], [116.79524, 7.43869], [117.17735, 7.52841], [117.93857, 6.89845], [117.98544, 6.27477], [119.52945, 5.35672], [118.93936, 4.09009], [118.06469, 4.16638], [121.14448, 2.12444], [129.19694, 7.84182]]]] } },
20690     { type: "Feature", properties: { iso1A2: "PK", iso1A3: "PAK", iso1N3: "586", wikidata: "Q843", nameEn: "Pakistan", groups: ["034", "142", "UN"], driveSide: "left", callingCodes: ["92"] }, geometry: { type: "MultiPolygon", coordinates: [[[[75.72737, 36.7529], [75.45562, 36.71971], [75.40481, 36.95382], [75.13839, 37.02622], [74.56453, 37.03023], [74.53739, 36.96224], [74.43389, 37.00977], [74.04856, 36.82648], [73.82685, 36.91421], [72.6323, 36.84601], [72.18135, 36.71838], [71.80267, 36.49924], [71.60491, 36.39429], [71.19505, 36.04134], [71.37969, 35.95865], [71.55273, 35.71483], [71.49917, 35.6267], [71.65435, 35.4479], [71.54294, 35.31037], [71.5541, 35.28776], [71.67495, 35.21262], [71.52938, 35.09023], [71.55273, 35.02615], [71.49917, 35.00478], [71.50329, 34.97328], [71.29472, 34.87728], [71.28356, 34.80882], [71.08718, 34.69034], [71.11602, 34.63047], [71.0089, 34.54568], [71.02401, 34.44835], [71.17662, 34.36769], [71.12815, 34.26619], [71.13078, 34.16503], [71.09453, 34.13524], [71.09307, 34.11961], [71.06933, 34.10564], [71.07345, 34.06242], [70.88119, 33.97933], [70.54336, 33.9463], [69.90203, 34.04194], [69.87307, 33.9689], [69.85671, 33.93719], [70.00503, 33.73528], [70.14236, 33.71701], [70.14785, 33.6553], [70.20141, 33.64387], [70.17062, 33.53535], [70.32775, 33.34496], [70.13686, 33.21064], [70.07369, 33.22557], [70.02563, 33.14282], [69.85259, 33.09451], [69.79766, 33.13247], [69.71526, 33.09911], [69.57656, 33.09911], [69.49004, 33.01509], [69.49854, 32.88843], [69.5436, 32.8768], [69.47082, 32.85834], [69.38018, 32.76601], [69.43649, 32.7302], [69.44747, 32.6678], [69.38155, 32.56601], [69.2868, 32.53938], [69.23599, 32.45946], [69.27932, 32.29119], [69.27032, 32.14141], [69.3225, 31.93186], [69.20577, 31.85957], [69.11514, 31.70782], [69.00939, 31.62249], [68.95995, 31.64822], [68.91078, 31.59687], [68.79997, 31.61665], [68.6956, 31.75687], [68.57475, 31.83158], [68.44222, 31.76446], [68.27605, 31.75863], [68.25614, 31.80357], [68.1655, 31.82691], [68.00071, 31.6564], [67.86887, 31.63536], [67.72056, 31.52304], [67.58323, 31.52772], [67.62374, 31.40473], [67.7748, 31.4188], [67.78854, 31.33203], [67.29964, 31.19586], [67.03323, 31.24519], [67.04147, 31.31561], [66.83273, 31.26867], [66.72561, 31.20526], [66.68166, 31.07597], [66.58175, 30.97532], [66.42645, 30.95309], [66.39194, 30.9408], [66.28413, 30.57001], [66.34869, 30.404], [66.23609, 30.06321], [66.36042, 29.9583], [66.24175, 29.85181], [65.04005, 29.53957], [64.62116, 29.58903], [64.19796, 29.50407], [64.12966, 29.39157], [63.5876, 29.50456], [62.47751, 29.40782], [60.87231, 29.86514], [61.31508, 29.38903], [61.53765, 29.00507], [61.65978, 28.77937], [61.93581, 28.55284], [62.40259, 28.42703], [62.59499, 28.24842], [62.79412, 28.28108], [62.7638, 28.02992], [62.84905, 27.47627], [62.79684, 27.34381], [62.80604, 27.22412], [63.19649, 27.25674], [63.32283, 27.14437], [63.25005, 27.08692], [63.25005, 26.84212], [63.18688, 26.83844], [63.1889, 26.65072], [62.77352, 26.64099], [62.31484, 26.528], [62.21304, 26.26601], [62.05117, 26.31647], [61.89391, 26.26251], [61.83831, 26.07249], [61.83968, 25.7538], [61.683, 25.66638], [61.6433, 25.27541], [61.46682, 24.57869], [68.11329, 23.53945], [68.20763, 23.85849], [68.39339, 23.96838], [68.74643, 23.97027], [68.7416, 24.31904], [68.90914, 24.33156], [68.97781, 24.26021], [69.07806, 24.29777], [69.19341, 24.25646], [69.29778, 24.28712], [69.59579, 24.29777], [69.73335, 24.17007], [70.03428, 24.172], [70.11712, 24.30915], [70.5667, 24.43787], [70.57906, 24.27774], [70.71502, 24.23517], [70.88393, 24.27398], [70.85784, 24.30903], [70.94985, 24.3791], [71.04461, 24.34657], [71.12838, 24.42662], [71.00341, 24.46038], [70.97594, 24.60904], [71.09405, 24.69017], [70.94002, 24.92843], [70.89148, 25.15064], [70.66695, 25.39314], [70.67382, 25.68186], [70.60378, 25.71898], [70.53649, 25.68928], [70.37444, 25.67443], [70.2687, 25.71156], [70.0985, 25.93238], [70.08193, 26.08094], [70.17532, 26.24118], [70.17532, 26.55362], [70.05584, 26.60398], [69.88555, 26.56836], [69.50904, 26.74892], [69.58519, 27.18109], [70.03136, 27.56627], [70.12502, 27.8057], [70.37307, 28.01208], [70.60927, 28.02178], [70.79054, 27.68423], [71.89921, 27.96035], [71.9244, 28.11555], [72.20329, 28.3869], [72.29495, 28.66367], [72.40402, 28.78283], [72.94272, 29.02487], [73.01337, 29.16422], [73.05886, 29.1878], [73.28094, 29.56646], [73.3962, 29.94707], [73.58665, 30.01848], [73.80299, 30.06969], [73.97225, 30.19829], [73.95736, 30.28466], [73.88993, 30.36305], [74.5616, 31.04153], [74.67971, 31.05479], [74.6852, 31.12771], [74.60006, 31.13711], [74.60281, 31.10419], [74.56023, 31.08303], [74.51629, 31.13829], [74.53223, 31.30321], [74.59773, 31.4136], [74.64713, 31.45605], [74.59319, 31.50197], [74.61517, 31.55698], [74.57498, 31.60382], [74.47771, 31.72227], [74.58907, 31.87824], [74.79919, 31.95983], [74.86236, 32.04485], [74.9269, 32.0658], [75.00793, 32.03786], [75.25649, 32.10187], [75.38046, 32.26836], [75.28259, 32.36556], [75.03265, 32.49538], [74.97634, 32.45367], [74.84725, 32.49075], [74.68362, 32.49298], [74.67431, 32.56676], [74.65251, 32.56416], [74.64424, 32.60985], [74.69542, 32.66792], [74.65345, 32.71225], [74.7113, 32.84219], [74.64675, 32.82604], [74.6289, 32.75561], [74.45312, 32.77755], [74.41467, 32.90563], [74.31227, 32.92795], [74.34875, 32.97823], [74.31854, 33.02891], [74.17571, 33.07495], [74.15374, 33.13477], [74.02144, 33.18908], [74.01366, 33.25199], [74.08782, 33.26232], [74.17983, 33.3679], [74.18121, 33.4745], [74.10115, 33.56392], [74.03576, 33.56718], [73.97367, 33.64061], [73.98968, 33.66155], [73.96423, 33.73071], [74.00891, 33.75437], [74.05898, 33.82089], [74.14001, 33.83002], [74.26086, 33.92237], [74.25262, 34.01577], [74.21554, 34.03853], [73.91341, 34.01235], [73.88732, 34.05105], [73.90677, 34.10504], [73.98208, 34.2522], [73.90517, 34.35317], [73.8475, 34.32935], [73.74862, 34.34183], [73.74999, 34.3781], [73.88732, 34.48911], [73.89419, 34.54568], [73.93951, 34.57169], [73.93401, 34.63386], [73.96423, 34.68244], [74.12897, 34.70073], [74.31239, 34.79626], [74.58083, 34.77386], [74.6663, 34.703], [75.01479, 34.64629], [75.38009, 34.55021], [75.75438, 34.51827], [76.04614, 34.67566], [76.15463, 34.6429], [76.47186, 34.78965], [76.67648, 34.76371], [76.74377, 34.84039], [76.74514, 34.92488], [76.87193, 34.96906], [76.99251, 34.93349], [77.11796, 35.05419], [76.93465, 35.39866], [76.85088, 35.39754], [76.75475, 35.52617], [76.77323, 35.66062], [76.50961, 35.8908], [76.33453, 35.84296], [76.14913, 35.82848], [76.15325, 35.9264], [75.93028, 36.13136], [76.00906, 36.17511], [76.0324, 36.41198], [75.92391, 36.56986], [75.72737, 36.7529]]]] } },
20691     { type: "Feature", properties: { iso1A2: "PL", iso1A3: "POL", iso1N3: "616", wikidata: "Q36", nameEn: "Poland", groups: ["EU", "151", "150", "UN"], callingCodes: ["48"] }, geometry: { type: "MultiPolygon", coordinates: [[[[18.57853, 55.25302], [14.20811, 54.12784], [14.22634, 53.9291], [14.20647, 53.91671], [14.18544, 53.91258], [14.20823, 53.90776], [14.21323, 53.8664], [14.27249, 53.74464], [14.26782, 53.69866], [14.2836, 53.67721], [14.27133, 53.66613], [14.28477, 53.65955], [14.2853, 53.63392], [14.31904, 53.61581], [14.30416, 53.55499], [14.3273, 53.50587], [14.35209, 53.49506], [14.4215, 53.27724], [14.44133, 53.27427], [14.45125, 53.26241], [14.40662, 53.21098], [14.37853, 53.20405], [14.36696, 53.16444], [14.38679, 53.13669], [14.35044, 53.05829], [14.25954, 53.00264], [14.14056, 52.95786], [14.15873, 52.87715], [14.12256, 52.84311], [14.13806, 52.82392], [14.22071, 52.81175], [14.61073, 52.59847], [14.6289, 52.57136], [14.60081, 52.53116], [14.63056, 52.48993], [14.54423, 52.42568], [14.55228, 52.35264], [14.56378, 52.33838], [14.58149, 52.28007], [14.70139, 52.25038], [14.71319, 52.22144], [14.68344, 52.19612], [14.70616, 52.16927], [14.67683, 52.13936], [14.6917, 52.10283], [14.72971, 52.09167], [14.76026, 52.06624], [14.71339, 52.00337], [14.70488, 51.97679], [14.7139, 51.95643], [14.71836, 51.95606], [14.72163, 51.95188], [14.7177, 51.94048], [14.70601, 51.92944], [14.6933, 51.9044], [14.6588, 51.88359], [14.59089, 51.83302], [14.60493, 51.80473], [14.64625, 51.79472], [14.66386, 51.73282], [14.69065, 51.70842], [14.75392, 51.67445], [14.75759, 51.62318], [14.7727, 51.61263], [14.71125, 51.56209], [14.73047, 51.54606], [14.72652, 51.53902], [14.73219, 51.52922], [14.94749, 51.47155], [14.9652, 51.44793], [14.96899, 51.38367], [14.98008, 51.33449], [15.04288, 51.28387], [15.01242, 51.21285], [15.0047, 51.16874], [14.99311, 51.16249], [14.99414, 51.15813], [15.00083, 51.14974], [14.99646, 51.14365], [14.99079, 51.14284], [14.99689, 51.12205], [14.98229, 51.11354], [14.97938, 51.07742], [14.95529, 51.04552], [14.92942, 50.99744], [14.89252, 50.94999], [14.89681, 50.9422], [14.81664, 50.88148], [14.82803, 50.86966], [14.99852, 50.86817], [15.01088, 50.97984], [14.96419, 50.99108], [15.02433, 51.0242], [15.03895, 51.0123], [15.06218, 51.02269], [15.10152, 51.01095], [15.11937, 50.99021], [15.16744, 51.01959], [15.1743, 50.9833], [15.2361, 50.99886], [15.27043, 50.97724], [15.2773, 50.8907], [15.36656, 50.83956], [15.3803, 50.77187], [15.43798, 50.80833], [15.73186, 50.73885], [15.81683, 50.75666], [15.87331, 50.67188], [15.97219, 50.69799], [16.0175, 50.63009], [15.98317, 50.61528], [16.02437, 50.60046], [16.10265, 50.66405], [16.20839, 50.63096], [16.23174, 50.67101], [16.33611, 50.66579], [16.44597, 50.58041], [16.34572, 50.49575], [16.31413, 50.50274], [16.19526, 50.43291], [16.21585, 50.40627], [16.22821, 50.41054], [16.28118, 50.36891], [16.30289, 50.38292], [16.36495, 50.37679], [16.3622, 50.34875], [16.39379, 50.3207], [16.42674, 50.32509], [16.56407, 50.21009], [16.55446, 50.16613], [16.63137, 50.1142], [16.7014, 50.09659], [16.8456, 50.20834], [16.98018, 50.24172], [17.00353, 50.21449], [17.02825, 50.23118], [16.99803, 50.25753], [17.02138, 50.27772], [16.99803, 50.30316], [16.94448, 50.31281], [16.90877, 50.38642], [16.85933, 50.41093], [16.89229, 50.45117], [17.1224, 50.39494], [17.14498, 50.38117], [17.19579, 50.38817], [17.19991, 50.3654], [17.27681, 50.32246], [17.34273, 50.32947], [17.34548, 50.2628], [17.3702, 50.28123], [17.58889, 50.27837], [17.67764, 50.28977], [17.69292, 50.32859], [17.74648, 50.29966], [17.72176, 50.25665], [17.76296, 50.23382], [17.70528, 50.18812], [17.59404, 50.16437], [17.66683, 50.10275], [17.6888, 50.12037], [17.7506, 50.07896], [17.77669, 50.02253], [17.86886, 49.97452], [18.00191, 50.01723], [18.04585, 50.01194], [18.04585, 50.03311], [18.00396, 50.04954], [18.03212, 50.06574], [18.07898, 50.04535], [18.10628, 50.00223], [18.20241, 49.99958], [18.21752, 49.97309], [18.27107, 49.96779], [18.27794, 49.93863], [18.31914, 49.91565], [18.33278, 49.92415], [18.33562, 49.94747], [18.41604, 49.93498], [18.53423, 49.89906], [18.54495, 49.9079], [18.54299, 49.92537], [18.57697, 49.91565], [18.57045, 49.87849], [18.60341, 49.86256], [18.57183, 49.83334], [18.61278, 49.7618], [18.61368, 49.75426], [18.62645, 49.75002], [18.62943, 49.74603], [18.62676, 49.71983], [18.69817, 49.70473], [18.72838, 49.68163], [18.80479, 49.6815], [18.84786, 49.5446], [18.84521, 49.51672], [18.94536, 49.52143], [18.97283, 49.49914], [18.9742, 49.39557], [19.18019, 49.41165], [19.25435, 49.53391], [19.36009, 49.53747], [19.37795, 49.574], [19.45348, 49.61583], [19.52626, 49.57311], [19.53313, 49.52856], [19.57845, 49.46077], [19.64162, 49.45184], [19.6375, 49.40897], [19.72127, 49.39288], [19.78581, 49.41701], [19.82237, 49.27806], [19.75286, 49.20751], [19.86409, 49.19316], [19.90529, 49.23532], [19.98494, 49.22904], [20.08238, 49.1813], [20.13738, 49.31685], [20.21977, 49.35265], [20.31453, 49.34817], [20.31728, 49.39914], [20.39939, 49.3896], [20.46422, 49.41612], [20.5631, 49.375], [20.61666, 49.41791], [20.72274, 49.41813], [20.77971, 49.35383], [20.9229, 49.29626], [20.98733, 49.30774], [21.09799, 49.37176], [21.041, 49.41791], [21.12477, 49.43666], [21.19756, 49.4054], [21.27858, 49.45988], [21.43376, 49.41433], [21.62328, 49.4447], [21.77983, 49.35443], [21.82927, 49.39467], [21.96385, 49.3437], [22.04427, 49.22136], [22.56155, 49.08865], [22.89122, 49.00725], [22.86336, 49.10513], [22.72009, 49.20288], [22.748, 49.32759], [22.69444, 49.49378], [22.64534, 49.53094], [22.78304, 49.65543], [22.80261, 49.69098], [22.83179, 49.69875], [22.99329, 49.84249], [23.28221, 50.0957], [23.67635, 50.33385], [23.71382, 50.38248], [23.79445, 50.40481], [23.99563, 50.41289], [24.03668, 50.44507], [24.07048, 50.5071], [24.0996, 50.60752], [24.0595, 50.71625], [23.95925, 50.79271], [23.99254, 50.83847], [24.0952, 50.83262], [24.14524, 50.86128], [24.04576, 50.90196], [23.92217, 51.00836], [23.90376, 51.07697], [23.80678, 51.18405], [23.63858, 51.32182], [23.69905, 51.40871], [23.62751, 51.50512], [23.56236, 51.53673], [23.57053, 51.55938], [23.53198, 51.74298], [23.62691, 51.78208], [23.61523, 51.92066], [23.68733, 51.9906], [23.64066, 52.07626], [23.61, 52.11264], [23.54314, 52.12148], [23.47859, 52.18215], [23.20071, 52.22848], [23.18196, 52.28812], [23.34141, 52.44845], [23.45112, 52.53774], [23.58296, 52.59868], [23.73615, 52.6149], [23.93763, 52.71332], [23.91805, 52.94016], [23.94689, 52.95919], [23.92184, 53.02079], [23.87548, 53.0831], [23.91393, 53.16469], [23.85657, 53.22923], [23.81995, 53.24131], [23.62004, 53.60942], [23.51284, 53.95052], [23.48261, 53.98855], [23.52702, 54.04622], [23.49196, 54.14764], [23.45223, 54.17775], [23.42418, 54.17911], [23.39525, 54.21672], [23.3494, 54.25155], [23.24656, 54.25701], [23.15938, 54.29894], [23.15526, 54.31076], [23.13905, 54.31567], [23.104, 54.29794], [23.04323, 54.31567], [23.05726, 54.34565], [22.99649, 54.35927], [23.00584, 54.38514], [22.83756, 54.40827], [22.79705, 54.36264], [21.41123, 54.32395], [20.63871, 54.3706], [19.8038, 54.44203], [19.64312, 54.45423], [18.57853, 55.25302]]]] } },
20692     { type: "Feature", properties: { iso1A2: "PM", iso1A3: "SPM", iso1N3: "666", wikidata: "Q34617", nameEn: "Saint Pierre and Miquelon", country: "FR", groups: ["EU", "Q1451600", "021", "003", "019", "UN"], callingCodes: ["508"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-56.72993, 46.65575], [-55.90758, 46.6223], [-56.27503, 47.39728], [-56.72993, 46.65575]]]] } },
20693     { type: "Feature", properties: { iso1A2: "PN", iso1A3: "PCN", iso1N3: "612", wikidata: "Q35672", nameEn: "Pitcairn Islands", country: "GB", groups: ["BOTS", "061", "009", "UN"], driveSide: "left", callingCodes: ["64"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-133.59543, -28.4709], [-122.0366, -24.55017], [-133.61511, -21.93325], [-133.59543, -28.4709]]]] } },
20694     { type: "Feature", properties: { iso1A2: "PR", iso1A3: "PRI", iso1N3: "630", wikidata: "Q1183", nameEn: "Puerto Rico", aliases: ["US-PR"], country: "US", groups: ["Q1352230", "029", "003", "419", "019", "UN"], roadSpeedUnit: "mph", callingCodes: ["1 787", "1 939"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-65.27974, 17.56928], [-65.02435, 18.73231], [-67.99519, 18.97186], [-68.23894, 17.84663], [-65.27974, 17.56928]]]] } },
20695     { type: "Feature", properties: { iso1A2: "PS", iso1A3: "PSE", iso1N3: "275", wikidata: "Q219060", nameEn: "Palestine" }, geometry: null },
20696     { type: "Feature", properties: { iso1A2: "PT", iso1A3: "PRT", iso1N3: "620", wikidata: "Q45", nameEn: "Portugal" }, geometry: null },
20697     { type: "Feature", properties: { iso1A2: "PW", iso1A3: "PLW", iso1N3: "585", wikidata: "Q695", nameEn: "Palau", groups: ["057", "009", "UN"], roadSpeedUnit: "mph", callingCodes: ["680"] }, geometry: { type: "MultiPolygon", coordinates: [[[[128.97621, 3.08804], [136.39296, 1.54187], [136.04605, 12.45908], [128.97621, 3.08804]]]] } },
20698     { type: "Feature", properties: { iso1A2: "PY", iso1A3: "PRY", iso1N3: "600", wikidata: "Q733", nameEn: "Paraguay", groups: ["005", "419", "019", "UN"], callingCodes: ["595"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-58.16225, -20.16193], [-58.23216, -19.80058], [-59.06965, -19.29148], [-60.00638, -19.2981], [-61.73723, -19.63958], [-61.93912, -20.10053], [-62.26883, -20.55311], [-62.2757, -21.06657], [-62.64455, -22.25091], [-62.51761, -22.37684], [-62.22768, -22.55807], [-61.9756, -23.0507], [-61.0782, -23.62932], [-60.99754, -23.80934], [-60.28163, -24.04436], [-60.03367, -24.00701], [-59.45482, -24.34787], [-59.33886, -24.49935], [-58.33055, -24.97099], [-58.25492, -24.92528], [-57.80821, -25.13863], [-57.57431, -25.47269], [-57.87176, -25.93604], [-58.1188, -26.16704], [-58.3198, -26.83443], [-58.65321, -27.14028], [-58.59549, -27.29973], [-58.04205, -27.2387], [-56.85337, -27.5165], [-56.18313, -27.29851], [-55.89195, -27.3467], [-55.74475, -27.44485], [-55.59094, -27.32444], [-55.62322, -27.1941], [-55.39611, -26.97679], [-55.25243, -26.93808], [-55.16948, -26.96068], [-55.06351, -26.80195], [-55.00584, -26.78754], [-54.80868, -26.55669], [-54.70732, -26.45099], [-54.69333, -26.37705], [-54.67359, -25.98607], [-54.60664, -25.9691], [-54.62063, -25.91213], [-54.59398, -25.59224], [-54.59509, -25.53696], [-54.60196, -25.48397], [-54.62033, -25.46026], [-54.4423, -25.13381], [-54.28207, -24.07305], [-54.32807, -24.01865], [-54.6238, -23.83078], [-55.02691, -23.97317], [-55.0518, -23.98666], [-55.12292, -23.99669], [-55.41784, -23.9657], [-55.44117, -23.9185], [-55.43585, -23.87157], [-55.5555, -23.28237], [-55.52288, -23.2595], [-55.5446, -23.22811], [-55.63849, -22.95122], [-55.62493, -22.62765], [-55.68742, -22.58407], [-55.6986, -22.56268], [-55.72366, -22.5519], [-55.741, -22.52018], [-55.74941, -22.46436], [-55.8331, -22.29008], [-56.23206, -22.25347], [-56.45893, -22.08072], [-56.5212, -22.11556], [-56.6508, -22.28387], [-57.98625, -22.09157], [-57.94642, -21.73799], [-57.88239, -21.6868], [-57.93492, -21.65505], [-57.84536, -20.93155], [-58.16225, -20.16193]]]] } },
20699     { type: "Feature", properties: { iso1A2: "QA", iso1A3: "QAT", iso1N3: "634", wikidata: "Q846", nameEn: "Qatar", groups: ["145", "142", "UN"], callingCodes: ["974"] }, geometry: { type: "MultiPolygon", coordinates: [[[[50.92992, 24.54396], [51.09638, 24.46907], [51.29972, 24.50747], [51.39468, 24.62785], [51.58834, 24.66608], [51.83108, 24.71675], [51.83682, 26.70231], [50.93865, 26.30758], [50.81266, 25.88946], [50.86149, 25.6965], [50.7801, 25.595], [50.80824, 25.54641], [50.57069, 25.57887], [50.8133, 24.74049], [50.92992, 24.54396]]]] } },
20700     { type: "Feature", properties: { iso1A2: "RE", iso1A3: "REU", iso1N3: "638", wikidata: "Q17070", nameEn: "R\xE9union", country: "FR", groups: ["Q3320166", "EU", "014", "202", "002", "UN"], callingCodes: ["262"] }, geometry: { type: "MultiPolygon", coordinates: [[[[53.37984, -21.23941], [56.73473, -21.9174], [56.62373, -20.2711], [53.37984, -21.23941]]]] } },
20701     { type: "Feature", properties: { iso1A2: "RO", iso1A3: "ROU", iso1N3: "642", wikidata: "Q218", nameEn: "Romania", groups: ["EU", "151", "150", "UN"], callingCodes: ["40"] }, geometry: { type: "MultiPolygon", coordinates: [[[[27.15622, 47.98538], [27.02985, 48.09083], [27.04118, 48.12522], [26.96119, 48.13003], [26.98042, 48.15752], [26.94265, 48.1969], [26.87708, 48.19919], [26.81161, 48.25049], [26.62823, 48.25804], [26.55202, 48.22445], [26.33504, 48.18418], [26.17711, 47.99246], [26.05901, 47.9897], [25.77723, 47.93919], [25.63878, 47.94924], [25.23778, 47.89403], [25.11144, 47.75203], [24.88896, 47.7234], [24.81893, 47.82031], [24.70632, 47.84428], [24.61994, 47.95062], [24.43578, 47.97131], [24.34926, 47.9244], [24.22566, 47.90231], [24.11281, 47.91487], [24.06466, 47.95317], [24.02999, 47.95087], [24.00801, 47.968], [23.98553, 47.96076], [23.96337, 47.96672], [23.94192, 47.94868], [23.89352, 47.94512], [23.8602, 47.9329], [23.80904, 47.98142], [23.75188, 47.99705], [23.66262, 47.98786], [23.63894, 48.00293], [23.5653, 48.00499], [23.52803, 48.01818], [23.4979, 47.96858], [23.33577, 48.0237], [23.27397, 48.08245], [23.15999, 48.12188], [23.1133, 48.08061], [23.08858, 48.00716], [23.0158, 47.99338], [22.92241, 48.02002], [22.94301, 47.96672], [22.89849, 47.95851], [22.77991, 47.87211], [22.76617, 47.8417], [22.67247, 47.7871], [22.46559, 47.76583], [22.41979, 47.7391], [22.31816, 47.76126], [22.00917, 47.50492], [22.03389, 47.42508], [22.01055, 47.37767], [21.94463, 47.38046], [21.78395, 47.11104], [21.648, 47.03902], [21.68645, 46.99595], [21.59581, 46.91628], [21.59307, 46.86935], [21.52028, 46.84118], [21.48935, 46.7577], [21.5151, 46.72147], [21.43926, 46.65109], [21.33214, 46.63035], [21.26929, 46.4993], [21.28061, 46.44941], [21.16872, 46.30118], [21.06572, 46.24897], [20.86797, 46.28884], [20.74574, 46.25467], [20.76085, 46.21002], [20.63863, 46.12728], [20.49718, 46.18721], [20.45377, 46.14405], [20.35573, 46.16629], [20.28324, 46.1438], [20.26068, 46.12332], [20.35862, 45.99356], [20.54818, 45.89939], [20.65645, 45.82801], [20.70069, 45.7493], [20.77416, 45.75601], [20.78446, 45.78522], [20.82364, 45.77738], [20.80361, 45.65875], [20.76798, 45.60969], [20.83321, 45.53567], [20.77217, 45.49788], [20.86026, 45.47295], [20.87948, 45.42743], [21.09894, 45.30144], [21.17612, 45.32566], [21.20392, 45.2677], [21.29398, 45.24148], [21.48278, 45.19557], [21.51299, 45.15345], [21.4505, 45.04294], [21.35855, 45.01941], [21.54938, 44.9327], [21.56328, 44.89502], [21.48202, 44.87199], [21.44013, 44.87613], [21.35643, 44.86364], [21.38802, 44.78133], [21.55007, 44.77304], [21.60019, 44.75208], [21.61942, 44.67059], [21.67504, 44.67107], [21.71692, 44.65349], [21.7795, 44.66165], [21.99364, 44.63395], [22.08016, 44.49844], [22.13234, 44.47444], [22.18315, 44.48179], [22.30844, 44.6619], [22.45301, 44.7194], [22.61917, 44.61489], [22.69196, 44.61587], [22.76749, 44.54446], [22.70981, 44.51852], [22.61368, 44.55719], [22.56493, 44.53419], [22.54021, 44.47836], [22.45436, 44.47258], [22.56012, 44.30712], [22.68166, 44.28206], [22.67173, 44.21564], [23.04988, 44.07694], [23.01674, 44.01946], [22.87873, 43.9844], [22.83753, 43.88055], [22.85314, 43.84452], [23.05288, 43.79494], [23.26772, 43.84843], [23.4507, 43.84936], [23.61687, 43.79289], [23.73978, 43.80627], [24.18149, 43.68218], [24.35364, 43.70211], [24.50264, 43.76314], [24.62281, 43.74082], [24.73542, 43.68523], [24.96682, 43.72693], [25.10718, 43.6831], [25.17144, 43.70261], [25.39528, 43.61866], [25.72792, 43.69263], [25.94911, 43.85745], [26.05584, 43.90925], [26.10115, 43.96908], [26.38764, 44.04356], [26.62712, 44.05698], [26.95141, 44.13555], [27.26845, 44.12602], [27.39757, 44.0141], [27.60834, 44.01206], [27.64542, 44.04958], [27.73468, 43.95326], [27.92008, 44.00761], [27.99558, 43.84193], [28.23293, 43.76], [29.24336, 43.70874], [30.04414, 45.08461], [29.69272, 45.19227], [29.65428, 45.25629], [29.68175, 45.26885], [29.59798, 45.38857], [29.42632, 45.44545], [29.24779, 45.43388], [28.96077, 45.33164], [28.94292, 45.28045], [28.81383, 45.3384], [28.78911, 45.24179], [28.71358, 45.22631], [28.5735, 45.24759], [28.34554, 45.32102], [28.28504, 45.43907], [28.21139, 45.46895], [28.18741, 45.47358], [28.08927, 45.6051], [28.16568, 45.6421], [28.13111, 45.92819], [28.08612, 46.01105], [28.13684, 46.18099], [28.10937, 46.22852], [28.19864, 46.31869], [28.18902, 46.35283], [28.25769, 46.43334], [28.22281, 46.50481], [28.24808, 46.64305], [28.12173, 46.82283], [28.09095, 46.97621], [27.81892, 47.1381], [27.73172, 47.29248], [27.68706, 47.28962], [27.60263, 47.32507], [27.55731, 47.46637], [27.47942, 47.48113], [27.3979, 47.59473], [27.32202, 47.64009], [27.25519, 47.71366], [27.29069, 47.73722], [27.1618, 47.92391], [27.15622, 47.98538]]]] } },
20702     { type: "Feature", properties: { iso1A2: "RS", iso1A3: "SRB", iso1N3: "688", wikidata: "Q403", nameEn: "Serbia", groups: ["039", "150", "UN"], callingCodes: ["381"] }, geometry: { type: "MultiPolygon", coordinates: [[[[19.66007, 46.19005], [19.56113, 46.16824], [19.52473, 46.1171], [19.28826, 45.99694], [19.14543, 45.9998], [19.10388, 46.04015], [19.0791, 45.96458], [19.01284, 45.96529], [18.99712, 45.93537], [18.81394, 45.91329], [18.85783, 45.85493], [18.90305, 45.71863], [18.96691, 45.66731], [18.88776, 45.57253], [18.94562, 45.53712], [19.07471, 45.53086], [19.08364, 45.48804], [18.99918, 45.49333], [18.97446, 45.37528], [19.10774, 45.29547], [19.28208, 45.23813], [19.41941, 45.23475], [19.43589, 45.17137], [19.19144, 45.17863], [19.14063, 45.12972], [19.07952, 45.14668], [19.1011, 45.01191], [19.05205, 44.97692], [19.15573, 44.95409], [19.06853, 44.89915], [19.02871, 44.92541], [18.98957, 44.90645], [19.01994, 44.85493], [19.18183, 44.92055], [19.36722, 44.88164], [19.32543, 44.74058], [19.26388, 44.65412], [19.16699, 44.52197], [19.13369, 44.52521], [19.12278, 44.50132], [19.14837, 44.45253], [19.14681, 44.41463], [19.11785, 44.40313], [19.10749, 44.39421], [19.10704, 44.38249], [19.10365, 44.37795], [19.10298, 44.36924], [19.11865, 44.36712], [19.1083, 44.3558], [19.11547, 44.34218], [19.13556, 44.338], [19.13332, 44.31492], [19.16741, 44.28648], [19.18328, 44.28383], [19.20508, 44.2917], [19.23306, 44.26097], [19.26945, 44.26957], [19.32464, 44.27185], [19.34773, 44.23244], [19.3588, 44.18353], [19.40927, 44.16722], [19.43905, 44.13088], [19.47338, 44.15034], [19.48386, 44.14332], [19.47321, 44.1193], [19.51167, 44.08158], [19.55999, 44.06894], [19.57467, 44.04716], [19.61991, 44.05254], [19.61836, 44.01464], [19.56498, 43.99922], [19.52515, 43.95573], [19.38439, 43.96611], [19.24363, 44.01502], [19.23465, 43.98764], [19.3986, 43.79668], [19.5176, 43.71403], [19.50455, 43.58385], [19.42696, 43.57987], [19.41941, 43.54056], [19.36653, 43.60921], [19.33426, 43.58833], [19.2553, 43.5938], [19.24774, 43.53061], [19.22807, 43.5264], [19.22229, 43.47926], [19.44315, 43.38846], [19.48171, 43.32644], [19.52962, 43.31623], [19.54598, 43.25158], [19.62661, 43.2286], [19.64063, 43.19027], [19.76918, 43.16044], [19.79255, 43.11951], [19.92576, 43.08539], [19.96549, 43.11098], [19.98887, 43.0538], [20.04729, 43.02732], [20.05431, 42.99571], [20.12325, 42.96237], [20.14896, 42.99058], [20.16415, 42.97177], [20.34528, 42.90676], [20.35692, 42.8335], [20.40594, 42.84853], [20.43734, 42.83157], [20.53484, 42.8885], [20.48692, 42.93208], [20.59929, 43.01067], [20.64557, 43.00826], [20.69515, 43.09641], [20.59929, 43.20492], [20.68688, 43.21335], [20.73811, 43.25068], [20.82145, 43.26769], [20.88685, 43.21697], [20.83727, 43.17842], [20.96287, 43.12416], [21.00749, 43.13984], [21.05378, 43.10707], [21.08952, 43.13471], [21.14465, 43.11089], [21.16734, 42.99694], [21.2041, 43.02277], [21.23877, 43.00848], [21.23534, 42.95523], [21.2719, 42.8994], [21.32974, 42.90424], [21.36941, 42.87397], [21.44047, 42.87276], [21.39045, 42.74888], [21.47498, 42.74695], [21.59154, 42.72643], [21.58755, 42.70418], [21.6626, 42.67813], [21.75025, 42.70125], [21.79413, 42.65923], [21.75672, 42.62695], [21.7327, 42.55041], [21.70522, 42.54176], [21.7035, 42.51899], [21.62556, 42.45106], [21.64209, 42.41081], [21.62887, 42.37664], [21.59029, 42.38042], [21.57021, 42.3647], [21.53467, 42.36809], [21.5264, 42.33634], [21.56772, 42.30946], [21.58992, 42.25915], [21.70111, 42.23789], [21.77176, 42.2648], [21.84654, 42.3247], [21.91595, 42.30392], [21.94405, 42.34669], [22.02908, 42.29848], [22.16384, 42.32103], [22.29605, 42.37477], [22.29275, 42.34913], [22.34773, 42.31725], [22.45919, 42.33822], [22.47498, 42.3915], [22.51961, 42.3991], [22.55669, 42.50144], [22.43983, 42.56851], [22.4997, 42.74144], [22.43309, 42.82057], [22.54302, 42.87774], [22.74826, 42.88701], [22.78397, 42.98253], [22.89521, 43.03625], [22.98104, 43.11199], [23.00806, 43.19279], [22.89727, 43.22417], [22.82036, 43.33665], [22.53397, 43.47225], [22.47582, 43.6558], [22.41043, 43.69566], [22.35558, 43.81281], [22.41449, 44.00514], [22.61688, 44.06534], [22.61711, 44.16938], [22.67173, 44.21564], [22.68166, 44.28206], [22.56012, 44.30712], [22.45436, 44.47258], [22.54021, 44.47836], [22.56493, 44.53419], [22.61368, 44.55719], [22.70981, 44.51852], [22.76749, 44.54446], [22.69196, 44.61587], [22.61917, 44.61489], [22.45301, 44.7194], [22.30844, 44.6619], [22.18315, 44.48179], [22.13234, 44.47444], [22.08016, 44.49844], [21.99364, 44.63395], [21.7795, 44.66165], [21.71692, 44.65349], [21.67504, 44.67107], [21.61942, 44.67059], [21.60019, 44.75208], [21.55007, 44.77304], [21.38802, 44.78133], [21.35643, 44.86364], [21.44013, 44.87613], [21.48202, 44.87199], [21.56328, 44.89502], [21.54938, 44.9327], [21.35855, 45.01941], [21.4505, 45.04294], [21.51299, 45.15345], [21.48278, 45.19557], [21.29398, 45.24148], [21.20392, 45.2677], [21.17612, 45.32566], [21.09894, 45.30144], [20.87948, 45.42743], [20.86026, 45.47295], [20.77217, 45.49788], [20.83321, 45.53567], [20.76798, 45.60969], [20.80361, 45.65875], [20.82364, 45.77738], [20.78446, 45.78522], [20.77416, 45.75601], [20.70069, 45.7493], [20.65645, 45.82801], [20.54818, 45.89939], [20.35862, 45.99356], [20.26068, 46.12332], [20.09713, 46.17315], [20.03533, 46.14509], [20.01816, 46.17696], [19.93508, 46.17553], [19.81491, 46.1313], [19.66007, 46.19005]]]] } },
20703     { type: "Feature", properties: { iso1A2: "RU", iso1A3: "RUS", iso1N3: "643", wikidata: "Q159", nameEn: "Russia" }, geometry: null },
20704     { type: "Feature", properties: { iso1A2: "RW", iso1A3: "RWA", iso1N3: "646", wikidata: "Q1037", nameEn: "Rwanda", groups: ["014", "202", "002", "UN"], callingCodes: ["250"] }, geometry: { type: "MultiPolygon", coordinates: [[[[30.47194, -1.0555], [30.35212, -1.06896], [30.16369, -1.34303], [29.912, -1.48269], [29.82657, -1.31187], [29.59061, -1.39016], [29.53062, -1.40499], [29.45038, -1.5054], [29.36322, -1.50887], [29.24323, -1.66826], [29.24458, -1.69663], [29.11847, -1.90576], [29.17562, -2.12278], [29.105, -2.27043], [29.00051, -2.29001], [28.95642, -2.37321], [28.89601, -2.37321], [28.86826, -2.41888], [28.86846, -2.44866], [28.89132, -2.47557], [28.89342, -2.49017], [28.88846, -2.50493], [28.87497, -2.50887], [28.86209, -2.5231], [28.86193, -2.53185], [28.87943, -2.55165], [28.89288, -2.55848], [28.90226, -2.62385], [28.89793, -2.66111], [28.94346, -2.69124], [29.00357, -2.70596], [29.04081, -2.7416], [29.0562, -2.58632], [29.32234, -2.6483], [29.36805, -2.82933], [29.88237, -2.75105], [29.95911, -2.33348], [30.14034, -2.43626], [30.42933, -2.31064], [30.54501, -2.41404], [30.83915, -2.35795], [30.89303, -2.08223], [30.80802, -1.91477], [30.84079, -1.64652], [30.71974, -1.43244], [30.57123, -1.33264], [30.50889, -1.16412], [30.45116, -1.10641], [30.47194, -1.0555]]]] } },
20705     { type: "Feature", properties: { iso1A2: "SA", iso1A3: "SAU", iso1N3: "682", wikidata: "Q851", nameEn: "Saudi Arabia", groups: ["145", "142", "UN"], callingCodes: ["966"] }, geometry: { type: "MultiPolygon", coordinates: [[[[40.01521, 32.05667], [39.29903, 32.23259], [38.99233, 31.99721], [36.99791, 31.50081], [37.99354, 30.49998], [37.66395, 30.33245], [37.4971, 29.99949], [36.75083, 29.86903], [36.50005, 29.49696], [36.07081, 29.18469], [34.8812, 29.36878], [34.4454, 27.91479], [37.8565, 22.00903], [39.63762, 18.37348], [40.99158, 15.81743], [42.15205, 16.40211], [42.76801, 16.40371], [42.94625, 16.39721], [42.94351, 16.49467], [42.97215, 16.51093], [43.11601, 16.53166], [43.15274, 16.67248], [43.22066, 16.65179], [43.21325, 16.74416], [43.25857, 16.75304], [43.26303, 16.79479], [43.24801, 16.80613], [43.22956, 16.80613], [43.22012, 16.83932], [43.18338, 16.84852], [43.1398, 16.90696], [43.19328, 16.94703], [43.1813, 16.98438], [43.18233, 17.02673], [43.23967, 17.03428], [43.17787, 17.14717], [43.20156, 17.25901], [43.32653, 17.31179], [43.22533, 17.38343], [43.29185, 17.53224], [43.43005, 17.56148], [43.70631, 17.35762], [44.50126, 17.47475], [46.31018, 17.20464], [46.76494, 17.29151], [47.00571, 16.94765], [47.48245, 17.10808], [47.58351, 17.50366], [48.19996, 18.20584], [49.04884, 18.59899], [52.00311, 19.00083], [54.99756, 20.00083], [55.66469, 21.99658], [55.2137, 22.71065], [55.13599, 22.63334], [52.56622, 22.94341], [51.59617, 24.12041], [51.58871, 24.27256], [51.41644, 24.39615], [51.58834, 24.66608], [51.39468, 24.62785], [51.29972, 24.50747], [51.09638, 24.46907], [50.92992, 24.54396], [50.8133, 24.74049], [50.57069, 25.57887], [50.302, 25.87592], [50.26923, 26.08243], [50.38162, 26.53976], [50.71771, 26.73086], [50.37726, 27.89227], [49.98877, 27.87827], [49.00421, 28.81495], [48.42991, 28.53628], [47.70561, 28.5221], [47.59863, 28.66798], [47.58376, 28.83382], [47.46202, 29.0014], [46.5527, 29.10283], [46.42415, 29.05947], [44.72255, 29.19736], [42.97796, 30.48295], [42.97601, 30.72204], [40.01521, 32.05667]]]] } },
20706     { type: "Feature", properties: { iso1A2: "SB", iso1A3: "SLB", iso1N3: "090", wikidata: "Q685", nameEn: "Solomon Islands", groups: ["054", "009", "UN"], driveSide: "left", callingCodes: ["677"] }, geometry: { type: "MultiPolygon", coordinates: [[[[172.71443, -12.01327], [160.43769, -4.17974], [156.03296, -6.55528], [156.03993, -6.65703], [155.92557, -6.84664], [155.69784, -6.92661], [155.60735, -6.92266], [154.74815, -7.33315], [156.73836, -14.50464], [172.71443, -12.01327]]]] } },
20707     { type: "Feature", properties: { iso1A2: "SC", iso1A3: "SYC", iso1N3: "690", wikidata: "Q1042", nameEn: "Seychelles", groups: ["014", "202", "002", "UN"], driveSide: "left", callingCodes: ["248"] }, geometry: { type: "MultiPolygon", coordinates: [[[[43.75112, -10.38913], [54.83239, -10.93575], [66.3222, 5.65313], [43.75112, -10.38913]]]] } },
20708     { type: "Feature", properties: { iso1A2: "SD", iso1A3: "SDN", iso1N3: "729", wikidata: "Q1049", nameEn: "Sudan", groups: ["015", "002", "UN"], callingCodes: ["249"] }, geometry: { type: "MultiPolygon", coordinates: [[[[37.8565, 22.00903], [34.0765, 22.00501], [33.99686, 21.76784], [33.57251, 21.72406], [33.17563, 22.00405], [24.99885, 21.99535], [24.99794, 19.99661], [23.99715, 20.00038], [23.99539, 19.49944], [23.99997, 15.69575], [23.62785, 15.7804], [23.38812, 15.69649], [23.10792, 15.71297], [22.93201, 15.55107], [22.92579, 15.47007], [22.99584, 15.40105], [22.99584, 15.22989], [22.66115, 14.86308], [22.70474, 14.69149], [22.38562, 14.58907], [22.44944, 14.24986], [22.55997, 14.23024], [22.5553, 14.11704], [22.22995, 13.96754], [22.08674, 13.77863], [22.29689, 13.3731], [22.1599, 13.19281], [22.02914, 13.13976], [21.94819, 13.05637], [21.81432, 12.81362], [21.89371, 12.68001], [21.98711, 12.63292], [22.15679, 12.66634], [22.22684, 12.74682], [22.46345, 12.61925], [22.38873, 12.45514], [22.50548, 12.16769], [22.48369, 12.02766], [22.64092, 12.07485], [22.54907, 11.64372], [22.7997, 11.40424], [22.93124, 11.41645], [22.97249, 11.21955], [22.87758, 10.91915], [23.02221, 10.69235], [23.3128, 10.45214], [23.67164, 9.86923], [23.69155, 9.67566], [24.09319, 9.66572], [24.12744, 9.73784], [24.49389, 9.79962], [24.84653, 9.80643], [24.97739, 9.9081], [25.05688, 10.06776], [25.0918, 10.33718], [25.78141, 10.42599], [25.93163, 10.38159], [25.93241, 10.17941], [26.21338, 9.91545], [26.35815, 9.57946], [26.70685, 9.48735], [27.14427, 9.62858], [27.90704, 9.61323], [28.99983, 9.67155], [29.06988, 9.74826], [29.53844, 9.75133], [29.54, 10.07949], [29.94629, 10.29245], [30.00389, 10.28633], [30.53005, 9.95992], [30.82893, 9.71451], [30.84605, 9.7498], [31.28504, 9.75287], [31.77539, 10.28939], [31.99177, 10.65065], [32.46967, 11.04662], [32.39358, 11.18207], [32.39578, 11.70208], [32.10079, 11.95203], [32.73921, 11.95203], [32.73921, 12.22757], [33.25876, 12.22111], [33.13988, 11.43248], [33.26977, 10.83632], [33.24645, 10.77913], [33.52294, 10.64382], [33.66604, 10.44254], [33.80913, 10.32994], [33.90159, 10.17179], [33.96984, 10.15446], [33.99185, 9.99623], [33.96323, 9.80972], [33.9082, 9.762], [33.87958, 9.49937], [34.10229, 9.50238], [34.08717, 9.55243], [34.13186, 9.7492], [34.20484, 9.9033], [34.22718, 10.02506], [34.32102, 10.11599], [34.34783, 10.23914], [34.2823, 10.53508], [34.4372, 10.781], [34.59062, 10.89072], [34.77383, 10.74588], [34.77532, 10.69027], [34.86618, 10.74588], [34.86916, 10.78832], [34.97491, 10.86147], [34.97789, 10.91559], [34.93172, 10.95946], [35.01215, 11.19626], [34.95704, 11.24448], [35.09556, 11.56278], [35.05832, 11.71158], [35.11492, 11.85156], [35.24302, 11.91132], [35.70476, 12.67101], [36.01458, 12.72478], [36.14268, 12.70879], [36.16651, 12.88019], [36.13374, 12.92665], [36.24545, 13.36759], [36.38993, 13.56459], [36.48824, 13.83954], [36.44653, 13.95666], [36.54376, 14.25597], [36.44337, 15.14963], [36.54276, 15.23478], [36.69761, 15.75323], [36.76371, 15.80831], [36.92193, 16.23451], [36.99777, 17.07172], [37.42694, 17.04041], [37.50967, 17.32199], [38.13362, 17.53906], [38.37133, 17.66269], [38.45916, 17.87167], [38.57727, 17.98125], [39.63762, 18.37348], [37.8565, 22.00903]]]] } },
20709     { type: "Feature", properties: { iso1A2: "SE", iso1A3: "SWE", iso1N3: "752", wikidata: "Q34", nameEn: "Sweden", groups: ["EU", "154", "150", "UN"], callingCodes: ["46"] }, geometry: { type: "MultiPolygon", coordinates: [[[[24.15791, 65.85385], [23.90497, 66.15802], [23.71339, 66.21299], [23.64982, 66.30603], [23.67591, 66.3862], [23.63776, 66.43568], [23.85959, 66.56434], [23.89488, 66.772], [23.98059, 66.79585], [23.98563, 66.84149], [23.56214, 67.17038], [23.58735, 67.20752], [23.54701, 67.25435], [23.75372, 67.29914], [23.75372, 67.43688], [23.39577, 67.46974], [23.54701, 67.59306], [23.45627, 67.85297], [23.65793, 67.9497], [23.40081, 68.05545], [23.26469, 68.15134], [23.15377, 68.14759], [23.10336, 68.26551], [22.73028, 68.40881], [22.00429, 68.50692], [21.03001, 68.88969], [20.90649, 68.89696], [20.85104, 68.93142], [20.91658, 68.96764], [20.78802, 69.03087], [20.55258, 69.06069], [20.0695, 69.04469], [20.28444, 68.93283], [20.33435, 68.80174], [20.22027, 68.67246], [19.95647, 68.55546], [20.22027, 68.48759], [19.93508, 68.35911], [18.97255, 68.52416], [18.63032, 68.50849], [18.39503, 68.58672], [18.1241, 68.53721], [18.13836, 68.20874], [17.90787, 67.96537], [17.30416, 68.11591], [16.7409, 67.91037], [16.38441, 67.52923], [16.12774, 67.52106], [16.09922, 67.4364], [16.39154, 67.21653], [16.35589, 67.06419], [15.37197, 66.48217], [15.49318, 66.28509], [15.05113, 66.15572], [14.53778, 66.12399], [14.50926, 65.31786], [13.64276, 64.58402], [14.11117, 64.46674], [14.16051, 64.18725], [13.98222, 64.00953], [13.23411, 64.09087], [12.74105, 64.02171], [12.14928, 63.59373], [12.19919, 63.47935], [11.98529, 63.27487], [12.19919, 63.00104], [12.07085, 62.6297], [12.29187, 62.25699], [12.14746, 61.7147], [12.40595, 61.57226], [12.57707, 61.56547], [12.86939, 61.35427], [12.69115, 61.06584], [12.2277, 61.02442], [12.59133, 60.50559], [12.52003, 60.13846], [12.36317, 59.99259], [12.15641, 59.8926], [11.87121, 59.86039], [11.92112, 59.69531], [11.69297, 59.59442], [11.8213, 59.24985], [11.65732, 58.90177], [11.45199, 58.89604], [11.4601, 58.99022], [11.34459, 59.11672], [11.15367, 59.07862], [11.08911, 58.98745], [10.64958, 58.89391], [10.40861, 58.38489], [12.16597, 56.60205], [12.07466, 56.29488], [12.65312, 56.04345], [12.6372, 55.91371], [12.88472, 55.63369], [12.60345, 55.42675], [12.84405, 55.13257], [14.28399, 55.1553], [14.89259, 55.5623], [15.79951, 55.54655], [19.64795, 57.06466], [19.84909, 57.57876], [20.5104, 59.15546], [19.08191, 60.19152], [19.23413, 60.61414], [20.15877, 63.06556], [24.14112, 65.39731], [24.15107, 65.81427], [24.14798, 65.83466], [24.15791, 65.85385]]]] } },
20710     { type: "Feature", properties: { iso1A2: "SG", iso1A3: "SGP", iso1N3: "702", wikidata: "Q334", nameEn: "Singapore", groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["65"] }, geometry: { type: "MultiPolygon", coordinates: [[[[104.00131, 1.42405], [103.93384, 1.42926], [103.89565, 1.42841], [103.86383, 1.46288], [103.81181, 1.47953], [103.76395, 1.45183], [103.74161, 1.4502], [103.7219, 1.46108], [103.67468, 1.43166], [103.62738, 1.35255], [103.56591, 1.19719], [103.66049, 1.18825], [103.74084, 1.12902], [104.03085, 1.26954], [104.12282, 1.27714], [104.08072, 1.35998], [104.09162, 1.39694], [104.08871, 1.42015], [104.07348, 1.43322], [104.04622, 1.44691], [104.02277, 1.4438], [104.00131, 1.42405]]]] } },
20711     { type: "Feature", properties: { iso1A2: "SH", iso1A3: "SHN", iso1N3: "654", wikidata: "Q192184", nameEn: "Saint Helena, Ascension and Tristan da Cunha", country: "GB" }, geometry: null },
20712     { type: "Feature", properties: { iso1A2: "SI", iso1A3: "SVN", iso1N3: "705", wikidata: "Q215", nameEn: "Slovenia", groups: ["EU", "039", "150", "UN"], callingCodes: ["386"] }, geometry: { type: "MultiPolygon", coordinates: [[[[16.50139, 46.56684], [16.39217, 46.63673], [16.38594, 46.6549], [16.41863, 46.66238], [16.42641, 46.69228], [16.37816, 46.69975], [16.30966, 46.7787], [16.31303, 46.79838], [16.3408, 46.80641], [16.34547, 46.83836], [16.2941, 46.87137], [16.2365, 46.87775], [16.21892, 46.86961], [16.15711, 46.85434], [16.14365, 46.8547], [16.10983, 46.867], [16.05786, 46.83927], [15.99054, 46.82772], [15.99126, 46.78199], [15.98432, 46.74991], [15.99769, 46.7266], [16.02808, 46.71094], [16.04347, 46.68694], [16.04036, 46.6549], [15.99988, 46.67947], [15.98512, 46.68463], [15.94864, 46.68769], [15.87691, 46.7211], [15.8162, 46.71897], [15.78518, 46.70712], [15.76771, 46.69863], [15.73823, 46.70011], [15.72279, 46.69548], [15.69523, 46.69823], [15.67411, 46.70735], [15.6543, 46.70616], [15.6543, 46.69228], [15.6365, 46.6894], [15.63255, 46.68069], [15.62317, 46.67947], [15.59826, 46.68908], [15.54533, 46.66985], [15.55333, 46.64988], [15.54431, 46.6312], [15.46906, 46.61321], [15.45514, 46.63697], [15.41235, 46.65556], [15.23711, 46.63994], [15.14215, 46.66131], [15.01451, 46.641], [14.98024, 46.6009], [14.96002, 46.63459], [14.92283, 46.60848], [14.87129, 46.61], [14.86419, 46.59411], [14.83549, 46.56614], [14.81836, 46.51046], [14.72185, 46.49974], [14.66892, 46.44936], [14.5942, 46.43434], [14.56463, 46.37208], [14.52176, 46.42617], [14.45877, 46.41717], [14.42608, 46.44614], [14.314, 46.43327], [14.28326, 46.44315], [14.15989, 46.43327], [14.12097, 46.47724], [14.04002, 46.49117], [14.00422, 46.48474], [13.89837, 46.52331], [13.7148, 46.5222], [13.68684, 46.43881], [13.59777, 46.44137], [13.5763, 46.42613], [13.5763, 46.40915], [13.47019, 46.3621], [13.43418, 46.35992], [13.44808, 46.33507], [13.37671, 46.29668], [13.42218, 46.20758], [13.47587, 46.22725], [13.56114, 46.2054], [13.56682, 46.18703], [13.64451, 46.18966], [13.66472, 46.17392], [13.64053, 46.13587], [13.57072, 46.09022], [13.50104, 46.05986], [13.49568, 46.04839], [13.50998, 46.04498], [13.49702, 46.01832], [13.47474, 46.00546], [13.50104, 45.98078], [13.52963, 45.96588], [13.56759, 45.96991], [13.58903, 45.99009], [13.62074, 45.98388], [13.63458, 45.98947], [13.64307, 45.98326], [13.6329, 45.94894], [13.63815, 45.93607], [13.61931, 45.91782], [13.60857, 45.89907], [13.59565, 45.89446], [13.58644, 45.88173], [13.57563, 45.8425], [13.58858, 45.83503], [13.59784, 45.8072], [13.66986, 45.79955], [13.8235, 45.7176], [13.83332, 45.70855], [13.83422, 45.68703], [13.87933, 45.65207], [13.9191, 45.6322], [13.8695, 45.60835], [13.86771, 45.59898], [13.84106, 45.58185], [13.78445, 45.5825], [13.74587, 45.59811], [13.7198, 45.59352], [13.6076, 45.64761], [13.45644, 45.59464], [13.56979, 45.4895], [13.62902, 45.45898], [13.67398, 45.4436], [13.7785, 45.46787], [13.81742, 45.43729], [13.88124, 45.42637], [13.90771, 45.45149], [13.97309, 45.45258], [13.99488, 45.47551], [13.96063, 45.50825], [14.00578, 45.52352], [14.07116, 45.48752], [14.20348, 45.46896], [14.22371, 45.50388], [14.24239, 45.50607], [14.26611, 45.48239], [14.27681, 45.4902], [14.32487, 45.47142], [14.36693, 45.48642], [14.49769, 45.54424], [14.5008, 45.60852], [14.53816, 45.6205], [14.57397, 45.67165], [14.60977, 45.66403], [14.59576, 45.62812], [14.69694, 45.57366], [14.68605, 45.53006], [14.71718, 45.53442], [14.80124, 45.49515], [14.81992, 45.45913], [14.90554, 45.47769], [14.92266, 45.52788], [15.02385, 45.48533], [15.05187, 45.49079], [15.16862, 45.42309], [15.27758, 45.46678], [15.33051, 45.45258], [15.38188, 45.48752], [15.30249, 45.53224], [15.29837, 45.5841], [15.27747, 45.60504], [15.31027, 45.6303], [15.34695, 45.63382], [15.34214, 45.64702], [15.38952, 45.63682], [15.4057, 45.64727], [15.34919, 45.71623], [15.30872, 45.69014], [15.25423, 45.72275], [15.40836, 45.79491], [15.47531, 45.79802], [15.47325, 45.8253], [15.52234, 45.82195], [15.57952, 45.84953], [15.64185, 45.82915], [15.66662, 45.84085], [15.70411, 45.8465], [15.68232, 45.86819], [15.68383, 45.88867], [15.67967, 45.90455], [15.70636, 45.92116], [15.70327, 46.00015], [15.71246, 46.01196], [15.72977, 46.04682], [15.62317, 46.09103], [15.6083, 46.11992], [15.59909, 46.14761], [15.64904, 46.19229], [15.6434, 46.21396], [15.67395, 46.22478], [15.75436, 46.21969], [15.75479, 46.20336], [15.78817, 46.21719], [15.79284, 46.25811], [15.97965, 46.30652], [16.07616, 46.3463], [16.07314, 46.36458], [16.05065, 46.3833], [16.05281, 46.39141], [16.14859, 46.40547], [16.18824, 46.38282], [16.30233, 46.37837], [16.30162, 46.40437], [16.27329, 46.41467], [16.27398, 46.42875], [16.25124, 46.48067], [16.23961, 46.49653], [16.26759, 46.50566], [16.26733, 46.51505], [16.29793, 46.5121], [16.37193, 46.55008], [16.38771, 46.53608], [16.44036, 46.5171], [16.5007, 46.49644], [16.52604, 46.47831], [16.59527, 46.47524], [16.52604, 46.5051], [16.52885, 46.53303], [16.50139, 46.56684]]]] } },
20713     { type: "Feature", properties: { iso1A2: "SJ", iso1A3: "SJM", iso1N3: "744", wikidata: "Q842829", nameEn: "Svalbard and Jan Mayen", country: "NO" }, geometry: null },
20714     { type: "Feature", properties: { iso1A2: "SK", iso1A3: "SVK", iso1N3: "703", wikidata: "Q214", nameEn: "Slovakia", groups: ["EU", "151", "150", "UN"], callingCodes: ["421"] }, geometry: { type: "MultiPolygon", coordinates: [[[[19.82237, 49.27806], [19.78581, 49.41701], [19.72127, 49.39288], [19.6375, 49.40897], [19.64162, 49.45184], [19.57845, 49.46077], [19.53313, 49.52856], [19.52626, 49.57311], [19.45348, 49.61583], [19.37795, 49.574], [19.36009, 49.53747], [19.25435, 49.53391], [19.18019, 49.41165], [18.9742, 49.39557], [18.97283, 49.49914], [18.94536, 49.52143], [18.84521, 49.51672], [18.74761, 49.492], [18.67757, 49.50895], [18.6144, 49.49824], [18.57183, 49.51162], [18.53063, 49.49022], [18.54848, 49.47059], [18.44686, 49.39467], [18.4084, 49.40003], [18.4139, 49.36517], [18.36446, 49.3267], [18.18456, 49.28909], [18.15022, 49.24518], [18.1104, 49.08624], [18.06885, 49.03157], [17.91814, 49.01784], [17.87831, 48.92679], [17.77944, 48.92318], [17.73126, 48.87885], [17.7094, 48.86721], [17.5295, 48.81117], [17.45671, 48.85004], [17.3853, 48.80936], [17.29054, 48.85546], [17.19355, 48.87602], [17.11202, 48.82925], [17.00215, 48.70887], [16.93955, 48.60371], [16.94611, 48.53614], [16.85204, 48.44968], [16.8497, 48.38321], [16.83588, 48.3844], [16.83317, 48.38138], [16.84243, 48.35258], [16.90903, 48.32519], [16.89461, 48.31332], [16.97701, 48.17385], [17.02919, 48.13996], [17.05735, 48.14179], [17.09168, 48.09366], [17.07039, 48.0317], [17.16001, 48.00636], [17.23699, 48.02094], [17.71215, 47.7548], [18.02938, 47.75665], [18.29305, 47.73541], [18.56496, 47.76588], [18.66521, 47.76772], [18.74074, 47.8157], [18.8506, 47.82308], [18.76821, 47.87469], [18.76134, 47.97499], [18.82176, 48.04206], [19.01952, 48.07052], [19.23924, 48.0595], [19.28182, 48.08336], [19.47957, 48.09437], [19.52489, 48.19791], [19.63338, 48.25006], [19.92452, 48.1283], [20.24312, 48.2784], [20.29943, 48.26104], [20.5215, 48.53336], [20.83248, 48.5824], [21.11516, 48.49546], [21.44063, 48.58456], [21.6068, 48.50365], [21.67134, 48.3989], [21.72525, 48.34628], [21.8279, 48.33321], [21.83339, 48.36242], [22.14689, 48.4005], [22.16023, 48.56548], [22.21379, 48.6218], [22.34151, 48.68893], [22.42934, 48.92857], [22.48296, 48.99172], [22.54338, 49.01424], [22.56155, 49.08865], [22.04427, 49.22136], [21.96385, 49.3437], [21.82927, 49.39467], [21.77983, 49.35443], [21.62328, 49.4447], [21.43376, 49.41433], [21.27858, 49.45988], [21.19756, 49.4054], [21.12477, 49.43666], [21.041, 49.41791], [21.09799, 49.37176], [20.98733, 49.30774], [20.9229, 49.29626], [20.77971, 49.35383], [20.72274, 49.41813], [20.61666, 49.41791], [20.5631, 49.375], [20.46422, 49.41612], [20.39939, 49.3896], [20.31728, 49.39914], [20.31453, 49.34817], [20.21977, 49.35265], [20.13738, 49.31685], [20.08238, 49.1813], [19.98494, 49.22904], [19.90529, 49.23532], [19.86409, 49.19316], [19.75286, 49.20751], [19.82237, 49.27806]]]] } },
20715     { type: "Feature", properties: { iso1A2: "SL", iso1A3: "SLE", iso1N3: "694", wikidata: "Q1044", nameEn: "Sierra Leone", groups: ["011", "202", "002", "UN"], callingCodes: ["232"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-10.27575, 8.48711], [-10.37257, 8.48941], [-10.54891, 8.31174], [-10.63934, 8.35326], [-10.70565, 8.29235], [-10.61422, 8.5314], [-10.47707, 8.67669], [-10.56197, 8.81225], [-10.5783, 9.06386], [-10.74484, 9.07998], [-10.6534, 9.29919], [-11.2118, 10.00098], [-11.89624, 9.99763], [-11.91023, 9.93927], [-12.12634, 9.87203], [-12.24262, 9.92386], [-12.47254, 9.86834], [-12.76788, 9.3133], [-12.94095, 9.26335], [-13.08953, 9.0409], [-13.18586, 9.0925], [-13.29911, 9.04245], [-14.36218, 8.64107], [-12.15048, 6.15992], [-11.50429, 6.92704], [-11.4027, 6.97746], [-11.29417, 7.21576], [-10.60422, 7.7739], [-10.60492, 8.04072], [-10.57523, 8.04829], [-10.51554, 8.1393], [-10.45023, 8.15627], [-10.35227, 8.15223], [-10.29839, 8.21283], [-10.31635, 8.28554], [-10.30084, 8.30008], [-10.27575, 8.48711]]]] } },
20716     { type: "Feature", properties: { iso1A2: "SM", iso1A3: "SMR", iso1N3: "674", wikidata: "Q238", nameEn: "San Marino", groups: ["039", "150", "UN"], callingCodes: ["378"] }, geometry: { type: "MultiPolygon", coordinates: [[[[12.45648, 43.89369], [12.48771, 43.89706], [12.49429, 43.90973], [12.49247, 43.91774], [12.49724, 43.92248], [12.50269, 43.92363], [12.50496, 43.93017], [12.51553, 43.94096], [12.51427, 43.94897], [12.50655, 43.95796], [12.50875, 43.96198], [12.50622, 43.97131], [12.51109, 43.97201], [12.51064, 43.98165], [12.5154, 43.98508], [12.51463, 43.99122], [12.50678, 43.99113], [12.49406, 43.98492], [12.47853, 43.98052], [12.46205, 43.97463], [12.44684, 43.96597], [12.43662, 43.95698], [12.42005, 43.9578], [12.41414, 43.95273], [12.40415, 43.95485], [12.40506, 43.94325], [12.41165, 43.93769], [12.41551, 43.92984], [12.40733, 43.92379], [12.41233, 43.90956], [12.40935, 43.9024], [12.41641, 43.89991], [12.44184, 43.90498], [12.45648, 43.89369]]]] } },
20717     { type: "Feature", properties: { iso1A2: "SN", iso1A3: "SEN", iso1N3: "686", wikidata: "Q1041", nameEn: "Senegal", groups: ["011", "202", "002", "UN"], callingCodes: ["221"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-14.32144, 16.61495], [-15.00557, 16.64997], [-15.6509, 16.50315], [-16.27016, 16.51565], [-16.4429, 16.20605], [-16.44814, 16.09753], [-16.48967, 16.0496], [-16.50854, 16.09032], [-17.15288, 16.07139], [-18.35085, 14.63444], [-17.43598, 13.59273], [-15.47902, 13.58758], [-15.36504, 13.79313], [-14.93719, 13.80173], [-14.34721, 13.46578], [-13.8955, 13.59126], [-13.79409, 13.34472], [-14.36795, 13.23033], [-15.14917, 13.57989], [-15.26908, 13.37768], [-15.80478, 13.34832], [-15.80355, 13.16729], [-16.69343, 13.16791], [-16.74676, 13.06025], [-17.43966, 13.04579], [-17.4623, 11.92379], [-16.70562, 12.34803], [-16.38191, 12.36449], [-16.20591, 12.46157], [-15.67302, 12.42974], [-15.17582, 12.6847], [-13.70523, 12.68013], [-13.05296, 12.64003], [-13.06603, 12.49342], [-12.87336, 12.51892], [-12.35415, 12.32758], [-11.91331, 12.42008], [-11.46267, 12.44559], [-11.37536, 12.40788], [-11.39935, 12.97808], [-11.63025, 13.39174], [-11.83345, 13.33333], [-12.06897, 13.71049], [-11.93043, 13.84505], [-12.23936, 14.76324], [-13.11029, 15.52116], [-13.43135, 16.09022], [-13.80075, 16.13961], [-14.32144, 16.61495]]]] } },
20718     { type: "Feature", properties: { iso1A2: "SO", iso1A3: "SOM", iso1N3: "706", wikidata: "Q1045", nameEn: "Somalia", groups: ["014", "202", "002", "UN"], callingCodes: ["252"] }, geometry: { type: "MultiPolygon", coordinates: [[[[51.12877, 12.56479], [43.90659, 12.3823], [42.95776, 10.98533], [42.69452, 10.62672], [42.87643, 10.18441], [43.0937, 9.90579], [43.23518, 9.84605], [43.32613, 9.59205], [44.19222, 8.93028], [46.99339, 7.9989], [47.92477, 8.00111], [47.97917, 8.00124], [44.98104, 4.91821], [44.02436, 4.9451], [43.40263, 4.79289], [43.04177, 4.57923], [42.97746, 4.44032], [42.84526, 4.28357], [42.55853, 4.20518], [42.07619, 4.17667], [41.89488, 3.97375], [41.31368, 3.14314], [40.98767, 2.82959], [41.00099, -0.83068], [41.56, -1.59812], [41.56362, -1.66375], [41.75542, -1.85308], [57.49095, 8.14549], [51.12877, 12.56479]]]] } },
20719     { type: "Feature", properties: { iso1A2: "SR", iso1A3: "SUR", iso1N3: "740", wikidata: "Q730", nameEn: "Suriname", groups: ["005", "419", "019", "UN"], driveSide: "left", callingCodes: ["597"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-54.26916, 5.26909], [-54.01877, 5.52789], [-54.01074, 5.68785], [-53.7094, 6.2264], [-56.84822, 6.73257], [-57.31629, 5.33714], [-57.22536, 5.15605], [-57.37442, 5.0208], [-57.8699, 4.89394], [-58.0307, 3.95513], [-57.35891, 3.32121], [-56.70519, 2.02964], [-56.55439, 2.02003], [-56.47045, 1.95135], [-55.99278, 1.83137], [-55.89863, 1.89861], [-55.92159, 2.05236], [-56.13054, 2.27723], [-55.96292, 2.53188], [-55.71493, 2.40342], [-55.01919, 2.564], [-54.6084, 2.32856], [-54.42864, 2.42442], [-54.28534, 2.67798], [-53.9849, 3.58697], [-53.98914, 3.627], [-54.05128, 3.63557], [-54.19367, 3.84387], [-54.38444, 4.13222], [-54.4717, 4.91964], [-54.26916, 5.26909]]]] } },
20720     { type: "Feature", properties: { iso1A2: "SS", iso1A3: "SSD", iso1N3: "728", wikidata: "Q958", nameEn: "South Sudan", groups: ["014", "202", "002", "UN"], callingCodes: ["211"] }, geometry: { type: "MultiPolygon", coordinates: [[[[34.10229, 9.50238], [33.87958, 9.49937], [33.9082, 9.762], [33.96323, 9.80972], [33.99185, 9.99623], [33.96984, 10.15446], [33.90159, 10.17179], [33.80913, 10.32994], [33.66604, 10.44254], [33.52294, 10.64382], [33.24645, 10.77913], [33.26977, 10.83632], [33.13988, 11.43248], [33.25876, 12.22111], [32.73921, 12.22757], [32.73921, 11.95203], [32.10079, 11.95203], [32.39578, 11.70208], [32.39358, 11.18207], [32.46967, 11.04662], [31.99177, 10.65065], [31.77539, 10.28939], [31.28504, 9.75287], [30.84605, 9.7498], [30.82893, 9.71451], [30.53005, 9.95992], [30.00389, 10.28633], [29.94629, 10.29245], [29.54, 10.07949], [29.53844, 9.75133], [29.06988, 9.74826], [28.99983, 9.67155], [27.90704, 9.61323], [27.14427, 9.62858], [26.70685, 9.48735], [26.35815, 9.57946], [26.21338, 9.91545], [25.93241, 10.17941], [25.93163, 10.38159], [25.78141, 10.42599], [25.0918, 10.33718], [25.05688, 10.06776], [24.97739, 9.9081], [24.84653, 9.80643], [24.49389, 9.79962], [24.12744, 9.73784], [24.09319, 9.66572], [23.69155, 9.67566], [23.62179, 9.53823], [23.64981, 9.44303], [23.64358, 9.28637], [23.56263, 9.19418], [23.4848, 9.16959], [23.44744, 8.99128], [23.59065, 8.99743], [23.51905, 8.71749], [24.25691, 8.69288], [24.13238, 8.36959], [24.35965, 8.26177], [24.85156, 8.16933], [24.98855, 7.96588], [25.25319, 7.8487], [25.29214, 7.66675], [25.20649, 7.61115], [25.20337, 7.50312], [25.35281, 7.42595], [25.37461, 7.33024], [25.90076, 7.09549], [26.38022, 6.63493], [26.32729, 6.36272], [26.58259, 6.1987], [26.51721, 6.09655], [27.22705, 5.71254], [27.22705, 5.62889], [27.28621, 5.56382], [27.23017, 5.37167], [27.26886, 5.25876], [27.44012, 5.07349], [27.56656, 4.89375], [27.65462, 4.89375], [27.76469, 4.79284], [27.79551, 4.59976], [28.20719, 4.35614], [28.6651, 4.42638], [28.8126, 4.48784], [29.03054, 4.48784], [29.22207, 4.34297], [29.43341, 4.50101], [29.49726, 4.7007], [29.82087, 4.56246], [29.79666, 4.37809], [30.06964, 4.13221], [30.1621, 4.10586], [30.22374, 3.93896], [30.27658, 3.95653], [30.47691, 3.83353], [30.55396, 3.84451], [30.57378, 3.74567], [30.56277, 3.62703], [30.78512, 3.67097], [30.80713, 3.60506], [30.85997, 3.5743], [30.85153, 3.48867], [30.97601, 3.693], [31.16666, 3.79853], [31.29476, 3.8015], [31.50478, 3.67814], [31.50776, 3.63652], [31.72075, 3.74354], [31.81459, 3.82083], [31.86821, 3.78664], [31.96205, 3.6499], [31.95907, 3.57408], [32.05187, 3.589], [32.08491, 3.56287], [32.08866, 3.53543], [32.19888, 3.50867], [32.20782, 3.6053], [32.41337, 3.748], [32.72021, 3.77327], [32.89746, 3.81339], [33.02852, 3.89296], [33.18356, 3.77812], [33.51264, 3.75068], [33.9873, 4.23316], [34.47601, 4.72162], [35.34151, 5.02364], [35.30992, 4.90402], [35.47843, 4.91872], [35.42366, 4.76969], [35.51424, 4.61643], [35.9419, 4.61933], [35.82118, 4.77382], [35.81968, 5.10757], [35.8576, 5.33413], [35.50792, 5.42431], [35.29938, 5.34042], [35.31188, 5.50106], [35.13058, 5.62118], [35.12611, 5.68937], [35.00546, 5.89387], [34.96227, 6.26415], [35.01738, 6.46991], [34.87736, 6.60161], [34.77459, 6.5957], [34.65096, 6.72589], [34.53776, 6.74808], [34.53925, 6.82794], [34.47669, 6.91076], [34.35753, 6.91963], [34.19369, 7.04382], [34.19369, 7.12807], [34.01495, 7.25664], [34.03878, 7.27437], [34.02984, 7.36449], [33.87642, 7.5491], [33.71407, 7.65983], [33.44745, 7.7543], [33.32531, 7.71297], [33.24637, 7.77939], [33.04944, 7.78989], [33.0006, 7.90333], [33.08401, 8.05822], [33.18083, 8.13047], [33.1853, 8.29264], [33.19721, 8.40317], [33.3119, 8.45474], [33.54575, 8.47094], [33.66938, 8.44442], [33.71407, 8.3678], [33.87195, 8.41938], [33.89579, 8.4842], [34.01346, 8.50041], [34.14453, 8.60204], [34.14304, 9.04654], [34.10229, 9.50238]]]] } },
20721     { type: "Feature", properties: { iso1A2: "ST", iso1A3: "STP", iso1N3: "678", wikidata: "Q1039", nameEn: "S\xE3o Tom\xE9 and Principe", groups: ["017", "202", "002", "UN"], callingCodes: ["239"] }, geometry: { type: "MultiPolygon", coordinates: [[[[4.34149, 1.91417], [6.6507, -0.28606], [7.9035, 1.92304], [4.34149, 1.91417]]]] } },
20722     { type: "Feature", properties: { iso1A2: "SV", iso1A3: "SLV", iso1N3: "222", wikidata: "Q792", nameEn: "El Salvador", groups: ["013", "003", "419", "019", "UN"], callingCodes: ["503"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-89.34776, 14.43013], [-89.39028, 14.44561], [-89.57441, 14.41637], [-89.58814, 14.33165], [-89.50614, 14.26084], [-89.52397, 14.22628], [-89.61844, 14.21937], [-89.70756, 14.1537], [-89.75569, 14.07073], [-89.73251, 14.04133], [-89.76103, 14.02923], [-89.81807, 14.07073], [-89.88937, 14.0396], [-90.10505, 13.85104], [-90.11344, 13.73679], [-90.55276, 12.8866], [-88.11443, 12.63306], [-87.7346, 13.13228], [-87.55124, 13.12523], [-87.69751, 13.25228], [-87.73714, 13.32715], [-87.80177, 13.35689], [-87.84675, 13.41078], [-87.83467, 13.44655], [-87.77354, 13.45767], [-87.73841, 13.44169], [-87.72115, 13.46083], [-87.71657, 13.50577], [-87.78148, 13.52906], [-87.73106, 13.75443], [-87.68821, 13.80829], [-87.7966, 13.91353], [-88.00331, 13.86948], [-88.07641, 13.98447], [-88.23018, 13.99915], [-88.25791, 13.91108], [-88.48982, 13.86458], [-88.49738, 13.97224], [-88.70661, 14.04317], [-88.73182, 14.10919], [-88.815, 14.11652], [-88.85785, 14.17763], [-88.94608, 14.20207], [-89.04187, 14.33644], [-89.34776, 14.43013]]]] } },
20723     { type: "Feature", properties: { iso1A2: "SX", iso1A3: "SXM", iso1N3: "534", wikidata: "Q26273", nameEn: "Sint Maarten", aliases: ["NL-SX"], country: "NL", groups: ["Q1451600", "029", "003", "419", "019", "UN"], callingCodes: ["1 721"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-63.33064, 17.9615], [-63.1055, 17.86651], [-62.93924, 18.02904], [-63.02323, 18.05757], [-63.04039, 18.05619], [-63.0579, 18.06614], [-63.07759, 18.04943], [-63.09686, 18.04608], [-63.11042, 18.05339], [-63.13502, 18.05445], [-63.33064, 17.9615]]]] } },
20724     { type: "Feature", properties: { iso1A2: "SY", iso1A3: "SYR", iso1N3: "760", wikidata: "Q858", nameEn: "Syria", groups: ["145", "142", "UN"], callingCodes: ["963"] }, geometry: { type: "MultiPolygon", coordinates: [[[[42.23683, 37.2863], [42.21548, 37.28026], [42.20454, 37.28715], [42.22381, 37.30238], [42.22257, 37.31395], [42.2112, 37.32491], [42.19301, 37.31323], [42.18225, 37.28569], [42.00894, 37.17209], [41.515, 37.08084], [41.21937, 37.07665], [40.90856, 37.13147], [40.69136, 37.0996], [39.81589, 36.75538], [39.21538, 36.66834], [39.03217, 36.70911], [38.74042, 36.70629], [38.55908, 36.84429], [38.38859, 36.90064], [38.21064, 36.91842], [37.81974, 36.76055], [37.68048, 36.75065], [37.49103, 36.66904], [37.47253, 36.63243], [37.21988, 36.6736], [37.16177, 36.66069], [37.10894, 36.6704], [37.08279, 36.63495], [37.02088, 36.66422], [37.01647, 36.69512], [37.04619, 36.71101], [37.04399, 36.73483], [36.99886, 36.74012], [36.99557, 36.75997], [36.66727, 36.82901], [36.61581, 36.74629], [36.62681, 36.71189], [36.57398, 36.65186], [36.58829, 36.58295], [36.54206, 36.49539], [36.6081, 36.33772], [36.65653, 36.33861], [36.68672, 36.23677], [36.6125, 36.22592], [36.50463, 36.2419], [36.4617, 36.20461], [36.39206, 36.22088], [36.37474, 36.01163], [36.33956, 35.98687], [36.30099, 36.00985], [36.28338, 36.00273], [36.29769, 35.96086], [36.27678, 35.94839], [36.25366, 35.96264], [36.19973, 35.95195], [36.17441, 35.92076], [36.1623, 35.80925], [36.14029, 35.81015], [36.13919, 35.83692], [36.11827, 35.85923], [35.99829, 35.88242], [36.01844, 35.92403], [36.00514, 35.94113], [35.98499, 35.94107], [35.931, 35.92109], [35.51152, 36.10954], [35.48515, 34.70851], [35.97386, 34.63322], [35.98718, 34.64977], [36.29165, 34.62991], [36.32399, 34.69334], [36.35135, 34.68516], [36.35384, 34.65447], [36.42941, 34.62505], [36.46003, 34.6378], [36.45299, 34.59438], [36.41429, 34.61175], [36.39846, 34.55672], [36.3369, 34.52629], [36.34745, 34.5002], [36.4442, 34.50165], [36.46179, 34.46541], [36.55853, 34.41609], [36.53039, 34.3798], [36.56556, 34.31881], [36.60778, 34.31009], [36.58667, 34.27667], [36.59195, 34.2316], [36.62537, 34.20251], [36.5128, 34.09916], [36.50576, 34.05982], [36.41078, 34.05253], [36.28589, 33.91981], [36.38263, 33.86579], [36.3967, 33.83365], [36.14517, 33.85118], [36.06778, 33.82927], [35.9341, 33.6596], [36.05723, 33.57904], [35.94465, 33.52774], [35.94816, 33.47886], [35.88668, 33.43183], [35.82577, 33.40479], [35.81324, 33.36354], [35.77477, 33.33609], [35.813, 33.3172], [35.77513, 33.27342], [35.81295, 33.24841], [35.81647, 33.2028], [35.83846, 33.19397], [35.84285, 33.16673], [35.81911, 33.1336], [35.81911, 33.11077], [35.84802, 33.1031], [35.87188, 32.98028], [35.89298, 32.9456], [35.87012, 32.91976], [35.84021, 32.8725], [35.83758, 32.82817], [35.78745, 32.77938], [35.75983, 32.74803], [35.88405, 32.71321], [35.93307, 32.71966], [35.96633, 32.66237], [36.02239, 32.65911], [36.08074, 32.51463], [36.20379, 32.52751], [36.20875, 32.49529], [36.23948, 32.50108], [36.40959, 32.37908], [36.83946, 32.31293], [38.79171, 33.37328], [40.64314, 34.31604], [40.97676, 34.39788], [41.12388, 34.65742], [41.2345, 34.80049], [41.21654, 35.1508], [41.26569, 35.42708], [41.38184, 35.62502], [41.37027, 35.84095], [41.2564, 36.06012], [41.28864, 36.35368], [41.40058, 36.52502], [41.81736, 36.58782], [42.36697, 37.0627], [42.35724, 37.10998], [42.32313, 37.17814], [42.34735, 37.22548], [42.2824, 37.2798], [42.26039, 37.27017], [42.23683, 37.2863]]]] } },
20725     { type: "Feature", properties: { iso1A2: "SZ", iso1A3: "SWZ", iso1N3: "748", wikidata: "Q1050", nameEn: "Eswatini", aliases: ["Swaziland"], groups: ["018", "202", "002", "UN"], driveSide: "left", callingCodes: ["268"] }, geometry: { type: "MultiPolygon", coordinates: [[[[31.86881, -25.99973], [31.4175, -25.71886], [31.31237, -25.7431], [31.13073, -25.91558], [30.95819, -26.26303], [30.78927, -26.48271], [30.81101, -26.84722], [30.88826, -26.79622], [30.97757, -26.92706], [30.96088, -27.0245], [31.15027, -27.20151], [31.49834, -27.31549], [31.97592, -27.31675], [31.97463, -27.11057], [32.00893, -26.8096], [32.09664, -26.80721], [32.13315, -26.84345], [32.13409, -26.5317], [32.07352, -26.40185], [32.10435, -26.15656], [32.08599, -26.00978], [32.00916, -25.999], [31.974, -25.95387], [31.86881, -25.99973]]]] } },
20726     { type: "Feature", properties: { iso1A2: "TA", iso1A3: "TAA", wikidata: "Q220982", nameEn: "Tristan da Cunha", aliases: ["SH-TA"], country: "GB", groups: ["SH", "BOTS", "011", "202", "002", "UN"], isoStatus: "excRes", driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["290 8", "44 20"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-13.38232, -34.07258], [-16.67337, -41.9188], [-5.88482, -41.4829], [-13.38232, -34.07258]]]] } },
20727     { type: "Feature", properties: { iso1A2: "TC", iso1A3: "TCA", iso1N3: "796", wikidata: "Q18221", nameEn: "Turks and Caicos Islands", country: "GB", groups: ["BOTS", "029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1 649"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-71.70065, 25.7637], [-72.98446, 20.4801], [-69.80718, 21.35956], [-71.70065, 25.7637]]]] } },
20728     { type: "Feature", properties: { iso1A2: "TD", iso1A3: "TCD", iso1N3: "148", wikidata: "Q657", nameEn: "Chad", groups: ["017", "202", "002", "UN"], callingCodes: ["235"] }, geometry: { type: "MultiPolygon", coordinates: [[[[23.99539, 19.49944], [15.99566, 23.49639], [14.99751, 23.00539], [15.19692, 21.99339], [15.20213, 21.49365], [15.28332, 21.44557], [15.62515, 20.95395], [15.57248, 20.92138], [15.55382, 20.86507], [15.56004, 20.79488], [15.59841, 20.74039], [15.6721, 20.70069], [15.99632, 20.35364], [15.75098, 19.93002], [15.6032, 18.77402], [15.50373, 16.89649], [14.37425, 15.72591], [13.86301, 15.04043], [13.78991, 14.87519], [13.809, 14.72915], [13.67878, 14.64013], [13.68573, 14.55276], [13.48259, 14.46704], [13.47559, 14.40881], [13.6302, 13.71094], [14.08251, 13.0797], [14.46881, 13.08259], [14.56101, 12.91036], [14.55058, 12.78256], [14.83314, 12.62963], [14.90827, 12.3269], [14.89019, 12.16593], [14.96952, 12.0925], [15.00146, 12.1223], [15.0349, 12.10698], [15.05786, 12.0608], [15.04808, 11.8731], [15.11579, 11.79313], [15.06595, 11.71126], [15.13149, 11.5537], [15.0585, 11.40481], [15.10021, 11.04101], [15.04957, 11.02347], [15.09127, 10.87431], [15.06737, 10.80921], [15.15532, 10.62846], [15.14936, 10.53915], [15.23724, 10.47764], [15.30874, 10.31063], [15.50535, 10.1098], [15.68761, 9.99344], [15.41408, 9.92876], [15.24618, 9.99246], [15.14043, 9.99246], [15.05999, 9.94845], [14.95722, 9.97926], [14.80082, 9.93818], [14.4673, 10.00264], [14.20411, 10.00055], [14.1317, 9.82413], [14.01793, 9.73169], [13.97544, 9.6365], [14.37094, 9.2954], [14.35707, 9.19611], [14.83566, 8.80557], [15.09484, 8.65982], [15.20426, 8.50892], [15.50743, 7.79302], [15.59272, 7.7696], [15.56964, 7.58936], [15.49743, 7.52179], [15.73118, 7.52006], [15.79942, 7.44149], [16.40703, 7.68809], [16.41583, 7.77971], [16.58315, 7.88657], [16.59415, 7.76444], [16.658, 7.75353], [16.6668, 7.67281], [16.8143, 7.53971], [17.67288, 7.98905], [17.93926, 7.95853], [18.02731, 8.01085], [18.6085, 8.05009], [18.64153, 8.08714], [18.62612, 8.14163], [18.67455, 8.22226], [18.79783, 8.25929], [19.11044, 8.68172], [18.86388, 8.87971], [19.06421, 9.00367], [20.36748, 9.11019], [20.82979, 9.44696], [21.26348, 9.97642], [21.34934, 9.95907], [21.52766, 10.2105], [21.63553, 10.217], [21.71479, 10.29932], [21.72139, 10.64136], [22.45889, 11.00246], [22.87758, 10.91915], [22.97249, 11.21955], [22.93124, 11.41645], [22.7997, 11.40424], [22.54907, 11.64372], [22.64092, 12.07485], [22.48369, 12.02766], [22.50548, 12.16769], [22.38873, 12.45514], [22.46345, 12.61925], [22.22684, 12.74682], [22.15679, 12.66634], [21.98711, 12.63292], [21.89371, 12.68001], [21.81432, 12.81362], [21.94819, 13.05637], [22.02914, 13.13976], [22.1599, 13.19281], [22.29689, 13.3731], [22.08674, 13.77863], [22.22995, 13.96754], [22.5553, 14.11704], [22.55997, 14.23024], [22.44944, 14.24986], [22.38562, 14.58907], [22.70474, 14.69149], [22.66115, 14.86308], [22.99584, 15.22989], [22.99584, 15.40105], [22.92579, 15.47007], [22.93201, 15.55107], [23.10792, 15.71297], [23.38812, 15.69649], [23.62785, 15.7804], [23.99997, 15.69575], [23.99539, 19.49944]]]] } },
20729     { type: "Feature", properties: { iso1A2: "TF", iso1A3: "ATF", iso1N3: "260", wikidata: "Q129003", nameEn: "French Southern Territories", country: "FR", groups: ["EU", "UN"] }, geometry: null },
20730     { type: "Feature", properties: { iso1A2: "TG", iso1A3: "TGO", iso1N3: "768", wikidata: "Q945", nameEn: "Togo", groups: ["011", "202", "002", "UN"], callingCodes: ["228"] }, geometry: { type: "MultiPolygon", coordinates: [[[[0.50388, 11.01011], [-0.13493, 11.14075], [-0.14462, 11.10811], [-0.05733, 11.08628], [-0.0275, 11.11202], [-514e-5, 11.10763], [342e-5, 11.08317], [0.02395, 11.06229], [0.03355, 10.9807], [-63e-4, 10.96417], [-908e-5, 10.91644], [-0.02685, 10.8783], [-0.0228, 10.81916], [-0.07183, 10.76794], [-0.07327, 10.71845], [-0.09141, 10.7147], [-0.05945, 10.63458], [0.12886, 10.53149], [0.18846, 10.4096], [0.29453, 10.41546], [0.33028, 10.30408], [0.39584, 10.31112], [0.35293, 10.09412], [0.41371, 10.06361], [0.41252, 10.02018], [0.36366, 10.03309], [0.32075, 9.72781], [0.34816, 9.71607], [0.34816, 9.66907], [0.32313, 9.6491], [0.28261, 9.69022], [0.26712, 9.66437], [0.29334, 9.59387], [0.36008, 9.6256], [0.38153, 9.58682], [0.23851, 9.57389], [0.2409, 9.52335], [0.30406, 9.521], [0.31241, 9.50337], [0.2254, 9.47869], [0.25758, 9.42696], [0.33148, 9.44812], [0.36485, 9.49749], [0.49118, 9.48339], [0.56388, 9.40697], [0.45424, 9.04581], [0.52455, 8.87746], [0.37319, 8.75262], [0.47211, 8.59945], [0.64731, 8.48866], [0.73432, 8.29529], [0.63897, 8.25873], [0.5913, 8.19622], [0.61156, 8.18324], [0.6056, 8.13959], [0.58891, 8.12779], [0.62943, 7.85751], [0.58295, 7.62368], [0.51979, 7.58706], [0.52455, 7.45354], [0.57223, 7.39326], [0.62943, 7.41099], [0.65327, 7.31643], [0.59606, 7.01252], [0.52217, 6.9723], [0.52098, 6.94391], [0.56508, 6.92971], [0.52853, 6.82921], [0.57406, 6.80348], [0.58176, 6.76049], [0.6497, 6.73682], [0.63659, 6.63857], [0.74862, 6.56517], [0.71048, 6.53083], [0.89283, 6.33779], [0.99652, 6.33779], [1.03108, 6.24064], [1.05969, 6.22998], [1.09187, 6.17074], [1.19966, 6.17069], [1.19771, 6.11522], [1.27574, 5.93551], [1.67336, 6.02702], [1.62913, 6.24075], [1.79826, 6.28221], [1.76906, 6.43189], [1.58105, 6.68619], [1.61812, 6.74843], [1.55877, 6.99737], [1.64249, 6.99562], [1.61838, 9.0527], [1.5649, 9.16941], [1.41746, 9.3226], [1.33675, 9.54765], [1.36624, 9.5951], [1.35507, 9.99525], [0.77666, 10.37665], [0.80358, 10.71459], [0.8804, 10.803], [0.91245, 10.99597], [0.66104, 10.99964], [0.4958, 10.93269], [0.50521, 10.98035], [0.48852, 10.98561], [0.50388, 11.01011]]]] } },
20731     { type: "Feature", properties: { iso1A2: "TH", iso1A3: "THA", iso1N3: "764", wikidata: "Q869", nameEn: "Thailand", groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["66"] }, geometry: { type: "MultiPolygon", coordinates: [[[[100.08404, 20.36626], [99.95721, 20.46301], [99.91616, 20.44986], [99.90499, 20.4487], [99.89692, 20.44789], [99.89301, 20.44311], [99.89168, 20.44548], [99.88451, 20.44596], [99.88211, 20.44488], [99.86383, 20.44371], [99.81096, 20.33687], [99.68255, 20.32077], [99.46008, 20.39673], [99.46077, 20.36198], [99.5569, 20.20676], [99.52943, 20.14811], [99.416, 20.08614], [99.20328, 20.12877], [99.0735, 20.10298], [98.98679, 19.7419], [98.83661, 19.80931], [98.56065, 19.67807], [98.51182, 19.71303], [98.24884, 19.67876], [98.13829, 19.78541], [98.03314, 19.80941], [98.04364, 19.65755], [97.84715, 19.55782], [97.88423, 19.5041], [97.78769, 19.39429], [97.84186, 19.29526], [97.78606, 19.26769], [97.84024, 19.22217], [97.83479, 19.09972], [97.73797, 19.04261], [97.73654, 18.9812], [97.66487, 18.9371], [97.73836, 18.88478], [97.76752, 18.58097], [97.5258, 18.4939], [97.36444, 18.57138], [97.34522, 18.54596], [97.50383, 18.26844], [97.56219, 18.33885], [97.64116, 18.29778], [97.60841, 18.23846], [97.73723, 17.97912], [97.66794, 17.88005], [97.76407, 17.71595], [97.91829, 17.54504], [98.11185, 17.36829], [98.10439, 17.33847], [98.34566, 17.04822], [98.39441, 17.06266], [98.52624, 16.89979], [98.49603, 16.8446], [98.53833, 16.81934], [98.46994, 16.73613], [98.50253, 16.7139], [98.49713, 16.69022], [98.51043, 16.70107], [98.51579, 16.69433], [98.51472, 16.68521], [98.51833, 16.676], [98.51113, 16.64503], [98.5695, 16.62826], [98.57912, 16.55983], [98.63817, 16.47424], [98.68074, 16.27068], [98.84485, 16.42354], [98.92656, 16.36425], [98.8376, 16.11706], [98.69585, 16.13353], [98.57019, 16.04578], [98.59853, 15.87197], [98.541, 15.65406], [98.58598, 15.46821], [98.56027, 15.33471], [98.4866, 15.39154], [98.39351, 15.34177], [98.41906, 15.27103], [98.40522, 15.25268], [98.30446, 15.30667], [98.22, 15.21327], [98.18821, 15.13125], [98.24874, 14.83013], [98.56762, 14.37701], [98.97356, 14.04868], [99.16695, 13.72621], [99.20617, 13.20575], [99.12225, 13.19847], [99.10646, 13.05804], [99.18748, 12.9898], [99.18905, 12.84799], [99.29254, 12.68921], [99.409, 12.60603], [99.47519, 12.1353], [99.56445, 12.14805], [99.53424, 12.02317], [99.64891, 11.82699], [99.64108, 11.78948], [99.5672, 11.62732], [99.47598, 11.62434], [99.39485, 11.3925], [99.31573, 11.32081], [99.32756, 11.28545], [99.06938, 10.94857], [99.02337, 10.97217], [98.99701, 10.92962], [99.0069, 10.85485], [98.86819, 10.78336], [98.78511, 10.68351], [98.77275, 10.62548], [98.81944, 10.52761], [98.7391, 10.31488], [98.55174, 9.92804], [98.52291, 9.92389], [98.47298, 9.95782], [98.33094, 9.91973], [98.12555, 9.44056], [97.63455, 9.60854], [97.19814, 8.18901], [99.31854, 5.99868], [99.50117, 6.44501], [99.91873, 6.50233], [100.0756, 6.4045], [100.12, 6.42105], [100.19511, 6.72559], [100.29651, 6.68439], [100.30828, 6.66462], [100.31618, 6.66781], [100.31884, 6.66423], [100.32671, 6.66526], [100.32607, 6.65933], [100.31929, 6.65413], [100.35413, 6.54932], [100.41152, 6.52299], [100.41791, 6.5189], [100.42351, 6.51762], [100.43027, 6.52389], [100.66986, 6.45086], [100.74361, 6.50811], [100.74822, 6.46231], [100.81045, 6.45086], [100.85884, 6.24929], [101.10313, 6.25617], [101.12618, 6.19431], [101.06165, 6.14161], [101.12388, 6.11411], [101.087, 5.9193], [101.02708, 5.91013], [100.98815, 5.79464], [101.14062, 5.61613], [101.25755, 5.71065], [101.25524, 5.78633], [101.58019, 5.93534], [101.69773, 5.75881], [101.75074, 5.79091], [101.80144, 5.74505], [101.89188, 5.8386], [101.91776, 5.84269], [101.92819, 5.85511], [101.94712, 5.98421], [101.9714, 6.00575], [101.97114, 6.01992], [101.99209, 6.04075], [102.01835, 6.05407], [102.09182, 6.14161], [102.07732, 6.193], [102.08127, 6.22679], [102.09086, 6.23546], [102.46318, 7.22462], [102.47649, 9.66162], [102.52395, 11.25257], [102.91449, 11.65512], [102.90973, 11.75613], [102.83957, 11.8519], [102.78427, 11.98746], [102.77026, 12.06815], [102.70176, 12.1686], [102.73134, 12.37091], [102.78116, 12.40284], [102.7796, 12.43781], [102.57567, 12.65358], [102.51963, 12.66117], [102.4994, 12.71736], [102.53053, 12.77506], [102.49335, 12.92711], [102.48694, 12.97537], [102.52275, 12.99813], [102.46011, 13.08057], [102.43422, 13.09061], [102.36146, 13.26006], [102.36001, 13.31142], [102.34611, 13.35618], [102.35692, 13.38274], [102.35563, 13.47307], [102.361, 13.50551], [102.33828, 13.55613], [102.36859, 13.57488], [102.44601, 13.5637], [102.5358, 13.56933], [102.57573, 13.60461], [102.62483, 13.60883], [102.58635, 13.6286], [102.5481, 13.6589], [102.56848, 13.69366], [102.72727, 13.77806], [102.77864, 13.93374], [102.91251, 14.01531], [102.93275, 14.19044], [103.16469, 14.33075], [103.39353, 14.35639], [103.53518, 14.42575], [103.71109, 14.4348], [103.70175, 14.38052], [103.93836, 14.3398], [104.27616, 14.39861], [104.55014, 14.36091], [104.69335, 14.42726], [104.97667, 14.38806], [105.02804, 14.23722], [105.08408, 14.20402], [105.14012, 14.23873], [105.17748, 14.34432], [105.20894, 14.34967], [105.43783, 14.43865], [105.53864, 14.55731], [105.5121, 14.80802], [105.61162, 15.00037], [105.46661, 15.13132], [105.58043, 15.32724], [105.50662, 15.32054], [105.4692, 15.33709], [105.47635, 15.3796], [105.58191, 15.41031], [105.60446, 15.53301], [105.61756, 15.68792], [105.46573, 15.74742], [105.42285, 15.76971], [105.37959, 15.84074], [105.34115, 15.92737], [105.38508, 15.987], [105.42001, 16.00657], [105.06204, 16.09792], [105.00262, 16.25627], [104.88057, 16.37311], [104.73349, 16.565], [104.76099, 16.69302], [104.7397, 16.81005], [104.76442, 16.84752], [104.7373, 16.91125], [104.73712, 17.01404], [104.80716, 17.19025], [104.80061, 17.39367], [104.69867, 17.53038], [104.45404, 17.66788], [104.35432, 17.82871], [104.2757, 17.86139], [104.21776, 17.99335], [104.10927, 18.10826], [104.06533, 18.21656], [103.97725, 18.33631], [103.93916, 18.33914], [103.85642, 18.28666], [103.82449, 18.33979], [103.699, 18.34125], [103.60957, 18.40528], [103.47773, 18.42841], [103.41044, 18.4486], [103.30977, 18.4341], [103.24779, 18.37807], [103.23818, 18.34875], [103.29757, 18.30475], [103.17093, 18.2618], [103.14994, 18.23172], [103.1493, 18.17799], [103.07343, 18.12351], [103.07823, 18.03833], [103.0566, 18.00144], [103.01998, 17.97095], [102.9912, 17.9949], [102.95812, 18.0054], [102.86323, 17.97531], [102.81988, 17.94233], [102.79044, 17.93612], [102.75954, 17.89561], [102.68538, 17.86653], [102.67543, 17.84529], [102.69946, 17.81686], [102.68194, 17.80151], [102.59485, 17.83537], [102.5896, 17.84889], [102.61432, 17.92273], [102.60971, 17.95411], [102.59234, 17.96127], [102.45523, 17.97106], [102.11359, 18.21532], [101.88485, 18.02474], [101.78087, 18.07559], [101.72294, 17.92867], [101.44667, 17.7392], [101.15108, 17.47586], [100.96541, 17.57926], [101.02185, 17.87637], [101.1793, 18.0544], [101.19118, 18.2125], [101.15108, 18.25624], [101.18227, 18.34367], [101.06047, 18.43247], [101.27585, 18.68875], [101.22832, 18.73377], [101.25803, 18.89545], [101.35606, 19.04716], [101.261, 19.12717], [101.24911, 19.33334], [101.20604, 19.35296], [101.21347, 19.46223], [101.26991, 19.48324], [101.26545, 19.59242], [101.08928, 19.59748], [100.90302, 19.61901], [100.77231, 19.48324], [100.64606, 19.55884], [100.58219, 19.49164], [100.49604, 19.53504], [100.398, 19.75047], [100.5094, 19.87904], [100.58808, 20.15791], [100.55218, 20.17741], [100.51052, 20.14928], [100.47567, 20.19133], [100.4537, 20.19971], [100.44992, 20.23644], [100.41473, 20.25625], [100.37439, 20.35156], [100.33383, 20.4028], [100.25769, 20.3992], [100.22076, 20.31598], [100.16668, 20.2986], [100.1712, 20.24324], [100.11785, 20.24787], [100.09337, 20.26293], [100.09999, 20.31614], [100.08404, 20.36626]]]] } },
20732     { type: "Feature", properties: { iso1A2: "TJ", iso1A3: "TJK", iso1N3: "762", wikidata: "Q863", nameEn: "Tajikistan", groups: ["143", "142", "UN"], callingCodes: ["992"] }, geometry: { type: "MultiPolygon", coordinates: [[[[70.45251, 41.04438], [70.38028, 41.02014], [70.36655, 40.90296], [69.69434, 40.62615], [69.59441, 40.70181], [69.53021, 40.77621], [69.38327, 40.7918], [69.32834, 40.70233], [69.3455, 40.57988], [69.2643, 40.57506], [69.21063, 40.54469], [69.27066, 40.49274], [69.28525, 40.41894], [69.30774, 40.36102], [69.33794, 40.34819], [69.32833, 40.29794], [69.30808, 40.2821], [69.24817, 40.30357], [69.25229, 40.26362], [69.30104, 40.24502], [69.30448, 40.18774], [69.2074, 40.21488], [69.15659, 40.2162], [69.04544, 40.22904], [68.85832, 40.20885], [68.84357, 40.18604], [68.79276, 40.17555], [68.77902, 40.20492], [68.5332, 40.14826], [68.52771, 40.11676], [68.62796, 40.07789], [69.01523, 40.15771], [69.01935, 40.11466], [68.96579, 40.06949], [68.84906, 40.04952], [68.93695, 39.91167], [68.88889, 39.87163], [68.63071, 39.85265], [68.61972, 39.68905], [68.54166, 39.53929], [68.12053, 39.56317], [67.70992, 39.66156], [67.62889, 39.60234], [67.44899, 39.57799], [67.46547, 39.53564], [67.39681, 39.52505], [67.46822, 39.46146], [67.45998, 39.315], [67.36522, 39.31287], [67.33226, 39.23739], [67.67833, 39.14479], [67.68915, 39.00775], [68.09704, 39.02589], [68.19743, 38.85985], [68.06948, 38.82115], [68.12877, 38.73677], [68.05598, 38.71641], [68.0807, 38.64136], [68.05873, 38.56087], [68.11366, 38.47169], [68.06274, 38.39435], [68.13289, 38.40822], [68.40343, 38.19484], [68.27159, 37.91477], [68.12635, 37.93], [67.81566, 37.43107], [67.8474, 37.31594], [67.78329, 37.1834], [67.7803, 37.08978], [67.87917, 37.0591], [68.02194, 36.91923], [68.18542, 37.02074], [68.27605, 37.00977], [68.29253, 37.10621], [68.41201, 37.10402], [68.41888, 37.13906], [68.61851, 37.19815], [68.6798, 37.27906], [68.81438, 37.23862], [68.80889, 37.32494], [68.91189, 37.26704], [68.88168, 37.33368], [68.96407, 37.32603], [69.03274, 37.25174], [69.25152, 37.09426], [69.39529, 37.16752], [69.45022, 37.23315], [69.36645, 37.40462], [69.44954, 37.4869], [69.51888, 37.5844], [69.80041, 37.5746], [69.84435, 37.60616], [69.93362, 37.61378], [69.95971, 37.5659], [70.15015, 37.52519], [70.28243, 37.66706], [70.27694, 37.81258], [70.1863, 37.84296], [70.17206, 37.93276], [70.4898, 38.12546], [70.54673, 38.24541], [70.60407, 38.28046], [70.61526, 38.34774], [70.64966, 38.34999], [70.69189, 38.37031], [70.6761, 38.39144], [70.67438, 38.40597], [70.69807, 38.41861], [70.72485, 38.4131], [70.75455, 38.4252], [70.77132, 38.45548], [70.78581, 38.45502], [70.78702, 38.45031], [70.79766, 38.44944], [70.80521, 38.44447], [70.81697, 38.44507], [70.82538, 38.45394], [70.84376, 38.44688], [70.88719, 38.46826], [70.92728, 38.43021], [70.98693, 38.48862], [71.03545, 38.44779], [71.0556, 38.40176], [71.09542, 38.42517], [71.10592, 38.42077], [71.10957, 38.40671], [71.1451, 38.40106], [71.21291, 38.32797], [71.33114, 38.30339], [71.33869, 38.27335], [71.37803, 38.25641], [71.36444, 38.15358], [71.29878, 38.04429], [71.28922, 38.01272], [71.27622, 37.99946], [71.27278, 37.96496], [71.24969, 37.93031], [71.2809, 37.91995], [71.296, 37.93403], [71.32871, 37.88564], [71.51565, 37.95349], [71.58843, 37.92425], [71.59255, 37.79956], [71.55752, 37.78677], [71.54324, 37.77104], [71.53053, 37.76534], [71.55234, 37.73209], [71.54186, 37.69691], [71.51972, 37.61945], [71.5065, 37.60912], [71.49693, 37.53527], [71.50616, 37.50733], [71.5256, 37.47971], [71.49612, 37.4279], [71.47685, 37.40281], [71.4862, 37.33405], [71.49821, 37.31975], [71.50674, 37.31502], [71.48536, 37.26017], [71.4824, 37.24921], [71.48339, 37.23937], [71.47386, 37.2269], [71.4555, 37.21418], [71.4494, 37.18137], [71.44127, 37.11856], [71.43097, 37.05855], [71.45578, 37.03094], [71.46923, 36.99925], [71.48481, 36.93218], [71.51502, 36.89128], [71.57195, 36.74943], [71.67083, 36.67346], [71.83229, 36.68084], [72.31676, 36.98115], [72.54095, 37.00007], [72.66381, 37.02014], [72.79693, 37.22222], [73.06884, 37.31729], [73.29633, 37.46495], [73.77197, 37.4417], [73.76647, 37.33913], [73.61129, 37.27469], [73.64974, 37.23643], [73.82552, 37.22659], [73.8564, 37.26158], [74.20308, 37.34208], [74.23339, 37.41116], [74.41055, 37.3948], [74.56161, 37.37734], [74.68383, 37.3948], [74.8294, 37.3435], [74.88887, 37.23275], [75.12328, 37.31839], [75.09719, 37.37297], [75.15899, 37.41443], [75.06011, 37.52779], [74.94338, 37.55501], [74.8912, 37.67576], [75.00935, 37.77486], [74.92416, 37.83428], [74.9063, 38.03033], [74.82665, 38.07359], [74.80331, 38.19889], [74.69894, 38.22155], [74.69619, 38.42947], [74.51217, 38.47034], [74.17022, 38.65504], [73.97933, 38.52945], [73.79806, 38.61106], [73.80656, 38.66449], [73.7033, 38.84782], [73.7445, 38.93867], [73.82964, 38.91517], [73.81728, 39.04007], [73.75823, 39.023], [73.60638, 39.24534], [73.54572, 39.27567], [73.55396, 39.3543], [73.5004, 39.38402], [73.59241, 39.40843], [73.59831, 39.46425], [73.45096, 39.46677], [73.31912, 39.38615], [73.18454, 39.35536], [72.85934, 39.35116], [72.62027, 39.39696], [72.33173, 39.33093], [72.23834, 39.17248], [72.17242, 39.2661], [72.09689, 39.26823], [72.04059, 39.36704], [71.90601, 39.27674], [71.79202, 39.27355], [71.7522, 39.32031], [71.80164, 39.40631], [71.76816, 39.45456], [71.62688, 39.44056], [71.5517, 39.45722], [71.55856, 39.57588], [71.49814, 39.61397], [71.08752, 39.50704], [71.06418, 39.41586], [70.7854, 39.38933], [70.64087, 39.58792], [70.44757, 39.60128], [70.2869, 39.53141], [70.11111, 39.58223], [69.87491, 39.53882], [69.68677, 39.59281], [69.3594, 39.52516], [69.26938, 39.8127], [69.35649, 40.01994], [69.43134, 39.98431], [69.43557, 39.92877], [69.53615, 39.93991], [69.5057, 40.03277], [69.53855, 40.0887], [69.53794, 40.11833], [69.55555, 40.12296], [69.57615, 40.10524], [69.64704, 40.12165], [69.67001, 40.10639], [70.01283, 40.23288], [70.58297, 40.00891], [70.57384, 39.99394], [70.47557, 39.93216], [70.55033, 39.96619], [70.58912, 39.95211], [70.65946, 39.9878], [70.65827, 40.0981], [70.7928, 40.12797], [70.80495, 40.16813], [70.9818, 40.22392], [70.8607, 40.217], [70.62342, 40.17396], [70.56394, 40.26421], [70.57149, 40.3442], [70.37511, 40.38605], [70.32626, 40.45174], [70.49871, 40.52503], [70.80009, 40.72825], [70.45251, 41.04438]]], [[[70.68112, 40.90612], [70.6158, 40.97661], [70.56077, 41.00642], [70.54223, 40.98787], [70.57501, 40.98941], [70.6721, 40.90555], [70.68112, 40.90612]]], [[[70.74189, 39.86319], [70.53651, 39.89155], [70.52631, 39.86989], [70.54998, 39.85137], [70.59667, 39.83542], [70.63105, 39.77923], [70.74189, 39.86319]]]] } },
20733     { type: "Feature", properties: { iso1A2: "TK", iso1A3: "TKL", iso1N3: "772", wikidata: "Q36823", nameEn: "Tokelau", country: "NZ", groups: ["061", "009", "UN"], driveSide: "left", callingCodes: ["690"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-168.251, -9.44289], [-174.18635, -7.80441], [-174.17993, -10.13616], [-168.251, -9.44289]]]] } },
20734     { type: "Feature", properties: { iso1A2: "TL", iso1A3: "TLS", iso1N3: "626", wikidata: "Q574", nameEn: "East Timor", aliases: ["Timor-Leste", "TP"], groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["670"] }, geometry: { type: "MultiPolygon", coordinates: [[[[124.46701, -9.13002], [124.94011, -8.85617], [124.97742, -9.08128], [125.11764, -8.96359], [125.18632, -9.03142], [125.18907, -9.16434], [125.09434, -9.19669], [125.04044, -9.17093], [124.97892, -9.19281], [125.09025, -9.46406], [125.68138, -9.85176], [127.55165, -9.05052], [127.42116, -8.22471], [125.87691, -8.31789], [125.58506, -7.95311], [124.92337, -8.75859], [124.33472, -9.11416], [124.04628, -9.22671], [124.04286, -9.34243], [124.10539, -9.41206], [124.14517, -9.42324], [124.21247, -9.36904], [124.28115, -9.42189], [124.28115, -9.50453], [124.3535, -9.48493], [124.35258, -9.43002], [124.38554, -9.3582], [124.45971, -9.30263], [124.46701, -9.13002]]]] } },
20735     { type: "Feature", properties: { iso1A2: "TM", iso1A3: "TKM", iso1N3: "795", wikidata: "Q874", nameEn: "Turkmenistan", groups: ["143", "142", "UN"], callingCodes: ["993"] }, geometry: { type: "MultiPolygon", coordinates: [[[[60.5078, 41.21694], [60.06581, 41.4363], [60.18117, 41.60082], [60.06032, 41.76287], [60.08504, 41.80997], [60.33223, 41.75058], [59.95046, 41.97966], [60.0356, 42.01028], [60.04659, 42.08982], [59.96419, 42.1428], [60.00539, 42.212], [59.94633, 42.27655], [59.4341, 42.29738], [59.2955, 42.37064], [59.17317, 42.52248], [58.93422, 42.5407], [58.6266, 42.79314], [58.57991, 42.64988], [58.27504, 42.69632], [58.14321, 42.62159], [58.29427, 42.56497], [58.51674, 42.30348], [58.40688, 42.29535], [58.3492, 42.43335], [57.99214, 42.50021], [57.90975, 42.4374], [57.92897, 42.24047], [57.84932, 42.18555], [57.6296, 42.16519], [57.30275, 42.14076], [57.03633, 41.92043], [56.96218, 41.80383], [57.03359, 41.41777], [57.13796, 41.36625], [57.03423, 41.25435], [56.00314, 41.32584], [55.45471, 41.25609], [54.95182, 41.92424], [54.20635, 42.38477], [52.97575, 42.1308], [52.47884, 41.78034], [52.26048, 41.69249], [51.7708, 40.29239], [53.89734, 37.3464], [54.24565, 37.32047], [54.36211, 37.34912], [54.58664, 37.45809], [54.67247, 37.43532], [54.77822, 37.51597], [54.81804, 37.61285], [54.77684, 37.62264], [54.851, 37.75739], [55.13412, 37.94705], [55.44152, 38.08564], [55.76561, 38.12238], [55.97847, 38.08024], [56.33278, 38.08132], [56.32454, 38.18502], [56.43303, 38.26054], [56.62255, 38.24005], [56.73928, 38.27887], [57.03453, 38.18717], [57.21169, 38.28965], [57.37236, 38.09321], [57.35042, 37.98546], [57.79534, 37.89299], [58.21399, 37.77281], [58.22999, 37.6856], [58.39959, 37.63134], [58.47786, 37.6433], [58.5479, 37.70526], [58.6921, 37.64548], [58.9338, 37.67374], [59.22905, 37.51161], [59.33507, 37.53146], [59.39797, 37.47892], [59.39385, 37.34257], [59.55178, 37.13594], [59.74678, 37.12499], [60.00768, 37.04102], [60.34767, 36.63214], [61.14516, 36.64644], [61.18187, 36.55348], [61.1393, 36.38782], [61.22719, 36.12759], [61.12007, 35.95992], [61.22444, 35.92879], [61.26152, 35.80749], [61.22719, 35.67038], [61.27371, 35.61482], [61.58742, 35.43803], [61.77693, 35.41341], [61.97743, 35.4604], [62.05709, 35.43803], [62.15871, 35.33278], [62.29191, 35.25964], [62.29878, 35.13312], [62.48006, 35.28796], [62.62288, 35.22067], [62.74098, 35.25432], [62.90853, 35.37086], [63.0898, 35.43131], [63.12276, 35.53196], [63.10079, 35.63024], [63.23262, 35.67487], [63.10318, 35.81782], [63.12276, 35.86208], [63.29579, 35.85985], [63.53475, 35.90881], [63.56496, 35.95106], [63.98519, 36.03773], [64.05385, 36.10433], [64.43288, 36.24401], [64.57295, 36.34362], [64.62514, 36.44311], [64.61141, 36.6351], [64.97945, 37.21913], [65.51778, 37.23881], [65.64263, 37.34388], [65.64137, 37.45061], [65.72274, 37.55438], [66.30993, 37.32409], [66.55743, 37.35409], [66.52303, 37.39827], [66.65761, 37.45497], [66.52852, 37.58568], [66.53676, 37.80084], [66.67684, 37.96776], [66.56697, 38.0435], [66.41042, 38.02403], [66.24013, 38.16238], [65.83913, 38.25733], [65.55873, 38.29052], [64.32576, 38.98691], [64.19086, 38.95561], [63.70778, 39.22349], [63.6913, 39.27666], [62.43337, 39.98528], [62.34273, 40.43206], [62.11751, 40.58242], [61.87856, 41.12257], [61.4446, 41.29407], [61.39732, 41.19873], [61.33199, 41.14946], [61.22212, 41.14946], [61.03261, 41.25691], [60.5078, 41.21694]]]] } },
20736     { type: "Feature", properties: { iso1A2: "TN", iso1A3: "TUN", iso1N3: "788", wikidata: "Q948", nameEn: "Tunisia", groups: ["015", "002", "UN"], callingCodes: ["216"] }, geometry: { type: "MultiPolygon", coordinates: [[[[11.2718, 37.6713], [7.89009, 38.19924], [8.59123, 37.14286], [8.64044, 36.9401], [8.62972, 36.86499], [8.67706, 36.8364], [8.57613, 36.78062], [8.46537, 36.7706], [8.47609, 36.66607], [8.16167, 36.48817], [8.18936, 36.44939], [8.40731, 36.42208], [8.2626, 35.91733], [8.26472, 35.73669], [8.35371, 35.66373], [8.36086, 35.47774], [8.30329, 35.29884], [8.47318, 35.23376], [8.3555, 35.10007], [8.30727, 34.95378], [8.25189, 34.92009], [8.29655, 34.72798], [8.20482, 34.57575], [7.86264, 34.3987], [7.81242, 34.21841], [7.74207, 34.16492], [7.66174, 34.20167], [7.52851, 34.06493], [7.54088, 33.7726], [7.73687, 33.42114], [7.83028, 33.18851], [8.11433, 33.10175], [8.1179, 33.05086], [8.31895, 32.83483], [8.35999, 32.50101], [9.07483, 32.07865], [9.55544, 30.23971], [9.76848, 30.34366], [9.88152, 30.34074], [10.29516, 30.90337], [10.12239, 31.42098], [10.31364, 31.72648], [10.48497, 31.72956], [10.62788, 31.96629], [10.7315, 31.97235], [11.04234, 32.2145], [11.53898, 32.4138], [11.57828, 32.48013], [11.46037, 32.6307], [11.51549, 33.09826], [11.55852, 33.1409], [11.58941, 33.36891], [11.2718, 37.6713]]]] } },
20737     { type: "Feature", properties: { iso1A2: "TO", iso1A3: "TON", iso1N3: "776", wikidata: "Q678", nameEn: "Tonga", groups: ["061", "009", "UN"], driveSide: "left", callingCodes: ["676"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-176.74538, -22.89767], [-180, -22.90585], [-180, -24.21376], [-173.10761, -24.19665], [-173.13438, -14.94228], [-176.76826, -14.95183], [-176.74538, -22.89767]]]] } },
20738     { type: "Feature", properties: { iso1A2: "TR", iso1A3: "TUR", iso1N3: "792", wikidata: "Q43", nameEn: "Turkey", groups: ["145", "142", "UN"], callingCodes: ["90"] }, geometry: { type: "MultiPolygon", coordinates: [[[[41.54366, 41.52185], [40.89217, 41.72528], [34.8305, 42.4581], [28.32297, 41.98371], [28.02971, 41.98066], [27.91479, 41.97902], [27.83492, 41.99709], [27.81235, 41.94803], [27.69949, 41.97515], [27.55191, 41.90928], [27.52379, 41.93756], [27.45478, 41.96591], [27.27411, 42.10409], [27.22376, 42.10152], [27.19251, 42.06028], [27.08486, 42.08735], [27.03277, 42.0809], [26.95638, 42.00741], [26.79143, 41.97386], [26.62996, 41.97644], [26.56051, 41.92995], [26.57961, 41.90024], [26.53968, 41.82653], [26.36952, 41.82265], [26.33589, 41.76802], [26.32952, 41.73637], [26.35957, 41.71149], [26.47958, 41.67037], [26.5209, 41.62592], [26.59196, 41.60491], [26.59742, 41.48058], [26.61767, 41.42281], [26.62997, 41.34613], [26.5837, 41.32131], [26.5209, 41.33993], [26.39861, 41.25053], [26.32259, 41.24929], [26.31928, 41.07386], [26.3606, 41.02027], [26.33297, 40.98388], [26.35894, 40.94292], [26.32259, 40.94042], [26.28623, 40.93005], [26.29441, 40.89119], [26.26169, 40.9168], [26.20856, 40.86048], [26.21351, 40.83298], [26.15685, 40.80709], [26.12854, 40.77339], [26.12495, 40.74283], [26.08638, 40.73214], [26.0754, 40.72772], [26.03489, 40.73051], [25.94795, 40.72797], [26.04292, 40.3958], [25.61285, 40.17161], [25.94257, 39.39358], [26.43357, 39.43096], [26.70773, 39.0312], [26.61814, 38.81372], [26.21136, 38.65436], [26.32173, 38.48731], [26.24183, 38.44695], [26.21136, 38.17558], [27.05537, 37.9131], [27.16428, 37.72343], [26.99377, 37.69034], [26.95583, 37.64989], [27.14757, 37.32], [27.20312, 36.94571], [27.45627, 36.9008], [27.24613, 36.71622], [27.46117, 36.53789], [27.89482, 36.69898], [27.95037, 36.46155], [28.23708, 36.56812], [29.30783, 36.01033], [29.48192, 36.18377], [29.61002, 36.1731], [29.61805, 36.14179], [29.69611, 36.10365], [29.73302, 35.92555], [32.82353, 35.70297], [35.51152, 36.10954], [35.931, 35.92109], [35.98499, 35.94107], [36.00514, 35.94113], [36.01844, 35.92403], [35.99829, 35.88242], [36.11827, 35.85923], [36.13919, 35.83692], [36.14029, 35.81015], [36.1623, 35.80925], [36.17441, 35.92076], [36.19973, 35.95195], [36.25366, 35.96264], [36.27678, 35.94839], [36.29769, 35.96086], [36.28338, 36.00273], [36.30099, 36.00985], [36.33956, 35.98687], [36.37474, 36.01163], [36.39206, 36.22088], [36.4617, 36.20461], [36.50463, 36.2419], [36.6125, 36.22592], [36.68672, 36.23677], [36.65653, 36.33861], [36.6081, 36.33772], [36.54206, 36.49539], [36.58829, 36.58295], [36.57398, 36.65186], [36.62681, 36.71189], [36.61581, 36.74629], [36.66727, 36.82901], [36.99557, 36.75997], [36.99886, 36.74012], [37.04399, 36.73483], [37.04619, 36.71101], [37.01647, 36.69512], [37.02088, 36.66422], [37.08279, 36.63495], [37.10894, 36.6704], [37.16177, 36.66069], [37.21988, 36.6736], [37.47253, 36.63243], [37.49103, 36.66904], [37.68048, 36.75065], [37.81974, 36.76055], [38.21064, 36.91842], [38.38859, 36.90064], [38.55908, 36.84429], [38.74042, 36.70629], [39.03217, 36.70911], [39.21538, 36.66834], [39.81589, 36.75538], [40.69136, 37.0996], [40.90856, 37.13147], [41.21937, 37.07665], [41.515, 37.08084], [42.00894, 37.17209], [42.18225, 37.28569], [42.19301, 37.31323], [42.2112, 37.32491], [42.22257, 37.31395], [42.22381, 37.30238], [42.20454, 37.28715], [42.21548, 37.28026], [42.23683, 37.2863], [42.26039, 37.27017], [42.2824, 37.2798], [42.34735, 37.22548], [42.32313, 37.17814], [42.35724, 37.10998], [42.56725, 37.14878], [42.78887, 37.38615], [42.93705, 37.32015], [43.11403, 37.37436], [43.30083, 37.30629], [43.33508, 37.33105], [43.50787, 37.24436], [43.56702, 37.25675], [43.63085, 37.21957], [43.7009, 37.23692], [43.8052, 37.22825], [43.82699, 37.19477], [43.84878, 37.22205], [43.90949, 37.22453], [44.02002, 37.33229], [44.13521, 37.32486], [44.2613, 37.25055], [44.27998, 37.16501], [44.22239, 37.15756], [44.18503, 37.09551], [44.25975, 36.98119], [44.30645, 36.97373], [44.35937, 37.02843], [44.35315, 37.04955], [44.38117, 37.05825], [44.42631, 37.05825], [44.63179, 37.19229], [44.76698, 37.16162], [44.78319, 37.1431], [44.7868, 37.16644], [44.75986, 37.21549], [44.81021, 37.2915], [44.58449, 37.45018], [44.61401, 37.60165], [44.56887, 37.6429], [44.62096, 37.71985], [44.55498, 37.783], [44.45948, 37.77065], [44.3883, 37.85433], [44.22509, 37.88859], [44.42476, 38.25763], [44.50115, 38.33939], [44.44386, 38.38295], [44.38309, 38.36117], [44.3119, 38.37887], [44.3207, 38.49799], [44.32058, 38.62752], [44.28065, 38.6465], [44.26155, 38.71427], [44.30322, 38.81581], [44.18863, 38.93881], [44.20946, 39.13975], [44.1043, 39.19842], [44.03667, 39.39223], [44.22452, 39.4169], [44.29818, 39.378], [44.37921, 39.4131], [44.42832, 39.4131], [44.41849, 39.56659], [44.48111, 39.61579], [44.47298, 39.68788], [44.6137, 39.78393], [44.65422, 39.72163], [44.71806, 39.71124], [44.81043, 39.62677], [44.80977, 39.65768], [44.75779, 39.7148], [44.61845, 39.8281], [44.46635, 39.97733], [44.26973, 40.04866], [44.1778, 40.02845], [44.1057, 40.03555], [43.92307, 40.01787], [43.65688, 40.11199], [43.65221, 40.14889], [43.71136, 40.16673], [43.59928, 40.34019], [43.60862, 40.43267], [43.54791, 40.47413], [43.63664, 40.54159], [43.7425, 40.66805], [43.74872, 40.7365], [43.67712, 40.84846], [43.67712, 40.93084], [43.58683, 40.98961], [43.47319, 41.02251], [43.44984, 41.0988], [43.4717, 41.12611], [43.44973, 41.17666], [43.36118, 41.2028], [43.23096, 41.17536], [43.1945, 41.25242], [43.13373, 41.25503], [43.21707, 41.30331], [43.02956, 41.37891], [42.8785, 41.50516], [42.84899, 41.47265], [42.78995, 41.50126], [42.84471, 41.58912], [42.72794, 41.59714], [42.59202, 41.58183], [42.51772, 41.43606], [42.26387, 41.49346], [41.95134, 41.52466], [41.81939, 41.43621], [41.7124, 41.47417], [41.7148, 41.4932], [41.54366, 41.52185]]]] } },
20739     { type: "Feature", properties: { iso1A2: "TT", iso1A3: "TTO", iso1N3: "780", wikidata: "Q754", nameEn: "Trinidad and Tobago", groups: ["029", "003", "419", "019", "UN"], driveSide: "left", callingCodes: ["1 868"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-61.62505, 11.18974], [-62.08693, 10.04435], [-60.89962, 9.81445], [-60.07172, 11.77667], [-61.62505, 11.18974]]]] } },
20740     { type: "Feature", properties: { iso1A2: "TV", iso1A3: "TUV", iso1N3: "798", wikidata: "Q672", nameEn: "Tuvalu", groups: ["061", "009", "UN"], driveSide: "left", callingCodes: ["688"] }, geometry: { type: "MultiPolygon", coordinates: [[[[174, -5], [174, -11.5], [179.99999, -11.5], [179.99999, -5], [174, -5]]]] } },
20741     { type: "Feature", properties: { iso1A2: "TW", iso1A3: "TWN", iso1N3: "158", wikidata: "Q865", nameEn: "Taiwan", aliases: ["RC"], groups: ["030", "142"], callingCodes: ["886"] }, geometry: { type: "MultiPolygon", coordinates: [[[[121.8109, 21.77688], [122.26612, 25.98197], [120.5128, 26.536], [120.0693, 26.3959], [119.78816, 26.2348], [119.98511, 25.37624], [119.42295, 25.0886], [118.6333, 24.46259], [118.42453, 24.54644], [118.35291, 24.51645], [118.28244, 24.51231], [118.11703, 24.39734], [120.69238, 21.52331], [121.8109, 21.77688]]]] } },
20742     { type: "Feature", properties: { iso1A2: "TZ", iso1A3: "TZA", iso1N3: "834", wikidata: "Q924", nameEn: "Tanzania", groups: ["014", "202", "002", "UN"], driveSide: "left", callingCodes: ["255"] }, geometry: { type: "MultiPolygon", coordinates: [[[[30.80408, -0.99911], [30.76635, -0.9852], [30.70631, -1.01175], [30.64166, -1.06601], [30.47194, -1.0555], [30.45116, -1.10641], [30.50889, -1.16412], [30.57123, -1.33264], [30.71974, -1.43244], [30.84079, -1.64652], [30.80802, -1.91477], [30.89303, -2.08223], [30.83915, -2.35795], [30.54501, -2.41404], [30.41789, -2.66266], [30.52747, -2.65841], [30.40662, -2.86151], [30.4987, -2.9573], [30.57926, -2.89791], [30.6675, -2.98987], [30.83823, -2.97837], [30.84165, -3.25152], [30.45915, -3.56532], [30.22042, -4.01738], [30.03323, -4.26631], [29.88172, -4.35743], [29.82885, -4.36153], [29.77289, -4.41733], [29.75109, -4.45836], [29.63827, -4.44681], [29.43673, -4.44845], [29.52552, -6.2731], [30.2567, -7.14121], [30.79243, -8.27382], [31.00796, -8.58615], [31.37533, -8.60769], [31.57147, -8.70619], [31.57147, -8.81388], [31.71158, -8.91386], [31.81587, -8.88618], [31.94663, -8.93846], [31.94196, -9.02303], [31.98866, -9.07069], [32.08206, -9.04609], [32.16146, -9.05993], [32.25486, -9.13371], [32.43543, -9.11988], [32.49147, -9.14754], [32.53661, -9.24281], [32.75611, -9.28583], [32.76233, -9.31963], [32.95389, -9.40138], [32.99397, -9.36712], [33.14925, -9.49322], [33.31581, -9.48554], [33.48052, -9.62442], [33.76677, -9.58516], [33.93298, -9.71647], [33.9638, -9.62206], [33.95829, -9.54066], [34.03865, -9.49398], [34.54499, -10.0678], [34.51911, -10.12279], [34.57581, -10.56271], [34.65946, -10.6828], [34.67047, -10.93796], [34.61161, -11.01611], [34.63305, -11.11731], [34.79375, -11.32245], [34.91153, -11.39799], [34.96296, -11.57354], [35.63599, -11.55927], [35.82767, -11.41081], [36.19094, -11.57593], [36.19094, -11.70008], [36.62068, -11.72884], [36.80309, -11.56836], [37.3936, -11.68949], [37.76614, -11.53352], [37.8388, -11.3123], [37.93618, -11.26228], [38.21598, -11.27289], [38.47258, -11.4199], [38.88996, -11.16978], [39.24395, -11.17433], [39.58249, -10.96043], [40.00295, -10.80255], [40.44265, -10.4618], [40.74206, -10.25691], [40.14328, -4.64201], [39.62121, -4.68136], [39.44306, -4.93877], [39.21631, -4.67835], [37.81321, -3.69179], [37.75036, -3.54243], [37.63099, -3.50723], [37.5903, -3.42735], [37.71745, -3.304], [37.67199, -3.06222], [34.0824, -1.02264], [34.03084, -1.05101], [34.02286, -1.00779], [33.93107, -0.99298], [30.80408, -0.99911]]]] } },
20743     { type: "Feature", properties: { iso1A2: "UA", iso1A3: "UKR", iso1N3: "804", wikidata: "Q212", nameEn: "Ukraine", groups: ["151", "150", "UN"], callingCodes: ["380"] }, geometry: { type: "MultiPolygon", coordinates: [[[[33.57318, 46.10317], [33.61467, 46.13561], [33.63854, 46.14147], [33.61517, 46.22615], [33.646, 46.23028], [33.74047, 46.18555], [33.79715, 46.20482], [33.85234, 46.19863], [33.91549, 46.15938], [34.05272, 46.10838], [34.07311, 46.11769], [34.12929, 46.10494], [34.181, 46.06804], [34.25111, 46.0532], [34.33912, 46.06114], [34.41221, 46.00245], [34.44155, 45.95995], [34.48729, 45.94267], [34.52011, 45.95097], [34.55889, 45.99347], [34.60861, 45.99347], [34.66679, 45.97136], [34.75479, 45.90705], [34.80153, 45.90047], [34.79905, 45.81009], [34.96015, 45.75634], [35.23066, 45.79231], [37.62608, 46.82615], [38.12112, 46.86078], [38.3384, 46.98085], [38.22955, 47.12069], [38.23049, 47.2324], [38.32112, 47.2585], [38.33074, 47.30508], [38.22225, 47.30788], [38.28954, 47.39255], [38.28679, 47.53552], [38.35062, 47.61631], [38.76379, 47.69346], [38.79628, 47.81109], [38.87979, 47.87719], [39.73935, 47.82876], [39.82213, 47.96396], [39.77544, 48.04206], [39.88256, 48.04482], [39.83724, 48.06501], [39.94847, 48.22811], [40.00752, 48.22445], [39.99241, 48.31768], [39.97325, 48.31399], [39.9693, 48.29904], [39.95248, 48.29972], [39.91465, 48.26743], [39.90041, 48.3049], [39.84273, 48.30947], [39.84136, 48.33321], [39.94847, 48.35055], [39.88794, 48.44226], [39.86196, 48.46633], [39.84548, 48.57821], [39.79764, 48.58668], [39.67226, 48.59368], [39.71765, 48.68673], [39.73104, 48.7325], [39.79466, 48.83739], [39.97182, 48.79398], [40.08168, 48.87443], [40.03636, 48.91957], [39.98967, 48.86901], [39.78368, 48.91596], [39.74874, 48.98675], [39.72649, 48.9754], [39.71353, 48.98959], [39.6683, 48.99454], [39.6836, 49.05121], [39.93437, 49.05709], [40.01988, 49.1761], [40.22176, 49.25683], [40.18331, 49.34996], [40.14912, 49.37681], [40.1141, 49.38798], [40.03087, 49.45452], [40.03636, 49.52321], [40.16683, 49.56865], [40.13249, 49.61672], [39.84548, 49.56064], [39.65047, 49.61761], [39.59142, 49.73758], [39.44496, 49.76067], [39.27968, 49.75976], [39.1808, 49.88911], [38.9391, 49.79524], [38.90477, 49.86787], [38.73311, 49.90238], [38.68677, 50.00904], [38.65688, 49.97176], [38.35408, 50.00664], [38.32524, 50.08866], [38.18517, 50.08161], [38.21675, 49.98104], [38.02999, 49.90592], [38.02999, 49.94482], [37.90776, 50.04194], [37.79515, 50.08425], [37.75807, 50.07896], [37.61113, 50.21976], [37.62879, 50.24481], [37.62486, 50.29966], [37.47243, 50.36277], [37.48204, 50.46079], [37.08468, 50.34935], [36.91762, 50.34963], [36.69377, 50.26982], [36.64571, 50.218], [36.56655, 50.2413], [36.58371, 50.28563], [36.47817, 50.31457], [36.30101, 50.29088], [36.20763, 50.3943], [36.06893, 50.45205], [35.8926, 50.43829], [35.80388, 50.41356], [35.73659, 50.35489], [35.61711, 50.35707], [35.58003, 50.45117], [35.47463, 50.49247], [35.39464, 50.64751], [35.48116, 50.66405], [35.47704, 50.77274], [35.41367, 50.80227], [35.39307, 50.92145], [35.32598, 50.94524], [35.40837, 51.04119], [35.31774, 51.08434], [35.20375, 51.04723], [35.12685, 51.16191], [35.14058, 51.23162], [34.97304, 51.2342], [34.82472, 51.17483], [34.6874, 51.18], [34.6613, 51.25053], [34.38802, 51.2746], [34.31661, 51.23936], [34.23009, 51.26429], [34.33446, 51.363], [34.22048, 51.4187], [34.30562, 51.5205], [34.17599, 51.63253], [34.07765, 51.67065], [34.42922, 51.72852], [34.41136, 51.82793], [34.09413, 52.00835], [34.11199, 52.14087], [34.05239, 52.20132], [33.78789, 52.37204], [33.55718, 52.30324], [33.48027, 52.31499], [33.51323, 52.35779], [33.18913, 52.3754], [32.89937, 52.2461], [32.85405, 52.27888], [32.69475, 52.25535], [32.54781, 52.32423], [32.3528, 52.32842], [32.38988, 52.24946], [32.33083, 52.23685], [32.34044, 52.1434], [32.2777, 52.10266], [32.23331, 52.08085], [32.08813, 52.03319], [31.92159, 52.05144], [31.96141, 52.08015], [31.85018, 52.11305], [31.81722, 52.09955], [31.7822, 52.11406], [31.38326, 52.12991], [31.25142, 52.04131], [31.13332, 52.1004], [30.95589, 52.07775], [30.90897, 52.00699], [30.76443, 51.89739], [30.68804, 51.82806], [30.51946, 51.59649], [30.64992, 51.35014], [30.56203, 51.25655], [30.36153, 51.33984], [30.34642, 51.42555], [30.17888, 51.51025], [29.77376, 51.4461], [29.7408, 51.53417], [29.54372, 51.48372], [29.49773, 51.39814], [29.42357, 51.4187], [29.32881, 51.37843], [29.25191, 51.49828], [29.25603, 51.57089], [29.20659, 51.56918], [29.16402, 51.64679], [29.1187, 51.65872], [28.99098, 51.56833], [28.95528, 51.59222], [28.81795, 51.55552], [28.76027, 51.48802], [28.78224, 51.45294], [28.75615, 51.41442], [28.73143, 51.46236], [28.69161, 51.44695], [28.64429, 51.5664], [28.47051, 51.59734], [28.37592, 51.54505], [28.23452, 51.66988], [28.10658, 51.57857], [27.95827, 51.56065], [27.91844, 51.61952], [27.85253, 51.62293], [27.76052, 51.47604], [27.67125, 51.50854], [27.71932, 51.60672], [27.55727, 51.63486], [27.51058, 51.5854], [27.47212, 51.61184], [27.24828, 51.60161], [27.26613, 51.65957], [27.20948, 51.66713], [27.20602, 51.77291], [26.99422, 51.76933], [26.9489, 51.73788], [26.80043, 51.75777], [26.69759, 51.82284], [26.46962, 51.80501], [26.39367, 51.87315], [26.19084, 51.86781], [26.00408, 51.92967], [25.83217, 51.92587], [25.80574, 51.94556], [25.73673, 51.91973], [25.46163, 51.92205], [25.20228, 51.97143], [24.98784, 51.91273], [24.37123, 51.88222], [24.29021, 51.80841], [24.3163, 51.75063], [24.13075, 51.66979], [23.99907, 51.58369], [23.8741, 51.59734], [23.91118, 51.63316], [23.7766, 51.66809], [23.60906, 51.62122], [23.6736, 51.50255], [23.62751, 51.50512], [23.69905, 51.40871], [23.63858, 51.32182], [23.80678, 51.18405], [23.90376, 51.07697], [23.92217, 51.00836], [24.04576, 50.90196], [24.14524, 50.86128], [24.0952, 50.83262], [23.99254, 50.83847], [23.95925, 50.79271], [24.0595, 50.71625], [24.0996, 50.60752], [24.07048, 50.5071], [24.03668, 50.44507], [23.99563, 50.41289], [23.79445, 50.40481], [23.71382, 50.38248], [23.67635, 50.33385], [23.28221, 50.0957], [22.99329, 49.84249], [22.83179, 49.69875], [22.80261, 49.69098], [22.78304, 49.65543], [22.64534, 49.53094], [22.69444, 49.49378], [22.748, 49.32759], [22.72009, 49.20288], [22.86336, 49.10513], [22.89122, 49.00725], [22.56155, 49.08865], [22.54338, 49.01424], [22.48296, 48.99172], [22.42934, 48.92857], [22.34151, 48.68893], [22.21379, 48.6218], [22.16023, 48.56548], [22.14689, 48.4005], [22.2083, 48.42534], [22.38133, 48.23726], [22.49806, 48.25189], [22.59007, 48.15121], [22.58733, 48.10813], [22.66835, 48.09162], [22.73427, 48.12005], [22.81804, 48.11363], [22.87847, 48.04665], [22.84276, 47.98602], [22.89849, 47.95851], [22.94301, 47.96672], [22.92241, 48.02002], [23.0158, 47.99338], [23.08858, 48.00716], [23.1133, 48.08061], [23.15999, 48.12188], [23.27397, 48.08245], [23.33577, 48.0237], [23.4979, 47.96858], [23.52803, 48.01818], [23.5653, 48.00499], [23.63894, 48.00293], [23.66262, 47.98786], [23.75188, 47.99705], [23.80904, 47.98142], [23.8602, 47.9329], [23.89352, 47.94512], [23.94192, 47.94868], [23.96337, 47.96672], [23.98553, 47.96076], [24.00801, 47.968], [24.02999, 47.95087], [24.06466, 47.95317], [24.11281, 47.91487], [24.22566, 47.90231], [24.34926, 47.9244], [24.43578, 47.97131], [24.61994, 47.95062], [24.70632, 47.84428], [24.81893, 47.82031], [24.88896, 47.7234], [25.11144, 47.75203], [25.23778, 47.89403], [25.63878, 47.94924], [25.77723, 47.93919], [26.05901, 47.9897], [26.17711, 47.99246], [26.33504, 48.18418], [26.55202, 48.22445], [26.62823, 48.25804], [26.6839, 48.35828], [26.79239, 48.29071], [26.82809, 48.31629], [26.71274, 48.40388], [26.85556, 48.41095], [26.93384, 48.36558], [27.03821, 48.37653], [27.0231, 48.42485], [27.08078, 48.43214], [27.13434, 48.37288], [27.27855, 48.37534], [27.32159, 48.4434], [27.37604, 48.44398], [27.37741, 48.41026], [27.44333, 48.41209], [27.46942, 48.454], [27.5889, 48.49224], [27.59027, 48.46311], [27.6658, 48.44034], [27.74422, 48.45926], [27.79225, 48.44244], [27.81902, 48.41874], [27.87533, 48.4037], [27.88391, 48.36699], [27.95883, 48.32368], [28.04527, 48.32661], [28.09873, 48.3124], [28.07504, 48.23494], [28.17666, 48.25963], [28.19314, 48.20749], [28.2856, 48.23202], [28.32508, 48.23384], [28.35519, 48.24957], [28.36996, 48.20543], [28.34912, 48.1787], [28.30586, 48.1597], [28.30609, 48.14018], [28.34009, 48.13147], [28.38712, 48.17567], [28.43701, 48.15832], [28.42454, 48.12047], [28.48428, 48.0737], [28.53921, 48.17453], [28.69896, 48.13106], [28.85232, 48.12506], [28.8414, 48.03392], [28.9306, 47.96255], [29.1723, 47.99013], [29.19839, 47.89261], [29.27804, 47.88893], [29.20663, 47.80367], [29.27255, 47.79953], [29.22242, 47.73607], [29.22414, 47.60012], [29.11743, 47.55001], [29.18603, 47.43387], [29.3261, 47.44664], [29.39889, 47.30179], [29.47854, 47.30366], [29.48678, 47.36043], [29.5733, 47.36508], [29.59665, 47.25521], [29.54996, 47.24962], [29.57696, 47.13581], [29.49732, 47.12878], [29.53044, 47.07851], [29.61038, 47.09932], [29.62137, 47.05069], [29.57056, 46.94766], [29.72986, 46.92234], [29.75458, 46.8604], [29.87405, 46.88199], [29.98814, 46.82358], [29.94522, 46.80055], [29.9743, 46.75325], [29.94409, 46.56002], [29.88916, 46.54302], [30.02511, 46.45132], [30.16794, 46.40967], [30.09103, 46.38694], [29.94114, 46.40114], [29.88329, 46.35851], [29.74496, 46.45605], [29.66359, 46.4215], [29.6763, 46.36041], [29.5939, 46.35472], [29.49914, 46.45889], [29.35357, 46.49505], [29.24886, 46.37912], [29.23547, 46.55435], [29.02409, 46.49582], [29.01241, 46.46177], [28.9306, 46.45699], [29.004, 46.31495], [28.98478, 46.31803], [28.94953, 46.25852], [29.06656, 46.19716], [28.94643, 46.09176], [29.00613, 46.04962], [28.98004, 46.00385], [28.74383, 45.96664], [28.78503, 45.83475], [28.69852, 45.81753], [28.70401, 45.78019], [28.52823, 45.73803], [28.47879, 45.66994], [28.51587, 45.6613], [28.54196, 45.58062], [28.49252, 45.56716], [28.51449, 45.49982], [28.43072, 45.48538], [28.41836, 45.51715], [28.30201, 45.54744], [28.21139, 45.46895], [28.28504, 45.43907], [28.34554, 45.32102], [28.5735, 45.24759], [28.71358, 45.22631], [28.78911, 45.24179], [28.81383, 45.3384], [28.94292, 45.28045], [28.96077, 45.33164], [29.24779, 45.43388], [29.42632, 45.44545], [29.59798, 45.38857], [29.68175, 45.26885], [29.65428, 45.25629], [29.69272, 45.19227], [30.04414, 45.08461], [31.62627, 45.50633], [33.54017, 46.0123], [33.59087, 46.06013], [33.57318, 46.10317]]]] } },
20744     { type: "Feature", properties: { iso1A2: "UG", iso1A3: "UGA", iso1N3: "800", wikidata: "Q1036", nameEn: "Uganda", groups: ["014", "202", "002", "UN"], driveSide: "left", callingCodes: ["256"] }, geometry: { type: "MultiPolygon", coordinates: [[[[33.93107, -0.99298], [33.9264, -0.54188], [33.98449, -0.13079], [33.90936, 0.10581], [34.10067, 0.36372], [34.08727, 0.44713], [34.11408, 0.48884], [34.13493, 0.58118], [34.20196, 0.62289], [34.27345, 0.63182], [34.31516, 0.75693], [34.40041, 0.80266], [34.43349, 0.85254], [34.52369, 1.10692], [34.57427, 1.09868], [34.58029, 1.14712], [34.67562, 1.21265], [34.80223, 1.22754], [34.82606, 1.26626], [34.82606, 1.30944], [34.7918, 1.36752], [34.87819, 1.5596], [34.92734, 1.56109], [34.9899, 1.6668], [34.98692, 1.97348], [34.90947, 2.42447], [34.95267, 2.47209], [34.77244, 2.70272], [34.78137, 2.76223], [34.73967, 2.85447], [34.65774, 2.8753], [34.60114, 2.93034], [34.56242, 3.11478], [34.45815, 3.18319], [34.40006, 3.37949], [34.41794, 3.44342], [34.39112, 3.48802], [34.44922, 3.51627], [34.45815, 3.67385], [34.15429, 3.80464], [34.06046, 4.15235], [33.9873, 4.23316], [33.51264, 3.75068], [33.18356, 3.77812], [33.02852, 3.89296], [32.89746, 3.81339], [32.72021, 3.77327], [32.41337, 3.748], [32.20782, 3.6053], [32.19888, 3.50867], [32.08866, 3.53543], [32.08491, 3.56287], [32.05187, 3.589], [31.95907, 3.57408], [31.96205, 3.6499], [31.86821, 3.78664], [31.81459, 3.82083], [31.72075, 3.74354], [31.50776, 3.63652], [31.50478, 3.67814], [31.29476, 3.8015], [31.16666, 3.79853], [30.97601, 3.693], [30.85153, 3.48867], [30.94081, 3.50847], [30.93486, 3.40737], [30.84251, 3.26908], [30.77101, 3.04897], [30.8574, 2.9508], [30.8857, 2.83923], [30.75612, 2.5863], [30.74271, 2.43601], [30.83059, 2.42559], [30.91102, 2.33332], [30.96911, 2.41071], [31.06593, 2.35862], [31.07934, 2.30207], [31.12104, 2.27676], [31.1985, 2.29462], [31.20148, 2.2217], [31.28042, 2.17853], [31.30127, 2.11006], [30.48503, 1.21675], [30.24671, 1.14974], [30.22139, 0.99635], [30.1484, 0.89805], [29.98307, 0.84295], [29.95477, 0.64486], [29.97413, 0.52124], [29.87284, 0.39166], [29.81922, 0.16824], [29.77454, 0.16675], [29.7224, 0.07291], [29.72687, -0.08051], [29.65091, -0.46777], [29.67474, -0.47969], [29.67176, -0.55714], [29.62708, -0.71055], [29.63006, -0.8997], [29.58388, -0.89821], [29.59061, -1.39016], [29.82657, -1.31187], [29.912, -1.48269], [30.16369, -1.34303], [30.35212, -1.06896], [30.47194, -1.0555], [30.64166, -1.06601], [30.70631, -1.01175], [30.76635, -0.9852], [30.80408, -0.99911], [33.93107, -0.99298]]]] } },
20745     { type: "Feature", properties: { iso1A2: "UM", iso1A3: "UMI", iso1N3: "581", wikidata: "Q16645", nameEn: "United States Minor Outlying Islands", country: "US" }, geometry: null },
20746     { type: "Feature", properties: { iso1A2: "UN", wikidata: "Q1065", nameEn: "United Nations", level: "unitedNations", isoStatus: "excRes" }, geometry: null },
20747     { type: "Feature", properties: { iso1A2: "US", iso1A3: "USA", iso1N3: "840", wikidata: "Q30", nameEn: "United States of America" }, geometry: null },
20748     { type: "Feature", properties: { iso1A2: "UY", iso1A3: "URY", iso1N3: "858", wikidata: "Q77", nameEn: "Uruguay", groups: ["005", "419", "019", "UN"], callingCodes: ["598"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-57.65132, -30.19229], [-57.61478, -30.25165], [-57.64859, -30.35095], [-57.89115, -30.49572], [-57.8024, -30.77193], [-57.89476, -30.95994], [-57.86729, -31.06352], [-57.9908, -31.34924], [-57.98127, -31.3872], [-58.07569, -31.44916], [-58.0023, -31.53084], [-58.00076, -31.65016], [-58.20252, -31.86966], [-58.10036, -32.25338], [-58.22362, -32.52416], [-58.1224, -32.98842], [-58.40475, -33.11777], [-58.44442, -33.84033], [-58.34425, -34.15035], [-57.83001, -34.69099], [-54.78916, -36.21945], [-52.83257, -34.01481], [-53.37138, -33.74313], [-53.39593, -33.75169], [-53.44031, -33.69344], [-53.52794, -33.68908], [-53.53459, -33.16843], [-53.1111, -32.71147], [-53.37671, -32.57005], [-53.39572, -32.58596], [-53.76024, -32.0751], [-54.17384, -31.86168], [-55.50821, -30.91349], [-55.50841, -30.9027], [-55.51862, -30.89828], [-55.52712, -30.89997], [-55.53276, -30.90218], [-55.53431, -30.89714], [-55.54572, -30.89051], [-55.55218, -30.88193], [-55.55373, -30.8732], [-55.5634, -30.8686], [-55.58866, -30.84117], [-55.87388, -31.05053], [-56.4619, -30.38457], [-56.4795, -30.3899], [-56.49267, -30.39471], [-56.90236, -30.02578], [-57.22502, -30.26121], [-57.65132, -30.19229]]]] } },
20749     { type: "Feature", properties: { iso1A2: "UZ", iso1A3: "UZB", iso1N3: "860", wikidata: "Q265", nameEn: "Uzbekistan", groups: ["143", "142", "UN"], callingCodes: ["998"] }, geometry: { type: "MultiPolygon", coordinates: [[[[65.85194, 42.85481], [65.53277, 43.31856], [65.18666, 43.48835], [64.96464, 43.74748], [64.53885, 43.56941], [63.34656, 43.64003], [62.01711, 43.51008], [61.01475, 44.41383], [58.59711, 45.58671], [55.97842, 44.99622], [55.97832, 44.99622], [55.97822, 44.99617], [55.97811, 44.99617], [55.97801, 44.99612], [55.97801, 44.99607], [55.97791, 44.99607], [55.9778, 44.99607], [55.9777, 44.99601], [55.9777, 44.99596], [55.9776, 44.99591], [55.97749, 44.99591], [55.97739, 44.99591], [55.97739, 44.99586], [55.97729, 44.99586], [55.97718, 44.99581], [55.97708, 44.99576], [55.97698, 44.9957], [55.97698, 44.99565], [55.97687, 44.9956], [55.97677, 44.9956], [55.97677, 44.99555], [55.97677, 44.9955], [55.97667, 44.99545], [55.97656, 44.99539], [55.97646, 44.99534], [55.97646, 44.99529], [55.97636, 44.99524], [55.97636, 44.99519], [55.97625, 44.99514], [55.97615, 44.99508], [55.97615, 44.99503], [55.97615, 44.99498], [55.97615, 44.99493], [55.97615, 44.99483], [55.97615, 44.99477], [55.97605, 44.99477], [55.97605, 44.99467], [55.97605, 44.99462], [55.97605, 44.99457], [55.97605, 44.99452], [55.97594, 44.99446], [55.97584, 44.99441], [55.97584, 44.99436], [55.97584, 44.99431], [55.97584, 44.99426], [55.97584, 44.99421], [55.97584, 44.99415], [55.97584, 44.99405], [55.97584, 44.994], [55.97584, 44.9939], [55.97584, 44.99384], [55.97584, 44.99374], [55.97584, 44.99369], [55.97584, 44.99359], [55.97584, 44.99353], [55.97584, 44.99348], [55.97584, 44.99343], [55.97584, 44.99338], [55.97584, 44.99328], [55.97584, 44.99322], [56.00314, 41.32584], [57.03423, 41.25435], [57.13796, 41.36625], [57.03359, 41.41777], [56.96218, 41.80383], [57.03633, 41.92043], [57.30275, 42.14076], [57.6296, 42.16519], [57.84932, 42.18555], [57.92897, 42.24047], [57.90975, 42.4374], [57.99214, 42.50021], [58.3492, 42.43335], [58.40688, 42.29535], [58.51674, 42.30348], [58.29427, 42.56497], [58.14321, 42.62159], [58.27504, 42.69632], [58.57991, 42.64988], [58.6266, 42.79314], [58.93422, 42.5407], [59.17317, 42.52248], [59.2955, 42.37064], [59.4341, 42.29738], [59.94633, 42.27655], [60.00539, 42.212], [59.96419, 42.1428], [60.04659, 42.08982], [60.0356, 42.01028], [59.95046, 41.97966], [60.33223, 41.75058], [60.08504, 41.80997], [60.06032, 41.76287], [60.18117, 41.60082], [60.06581, 41.4363], [60.5078, 41.21694], [61.03261, 41.25691], [61.22212, 41.14946], [61.33199, 41.14946], [61.39732, 41.19873], [61.4446, 41.29407], [61.87856, 41.12257], [62.11751, 40.58242], [62.34273, 40.43206], [62.43337, 39.98528], [63.6913, 39.27666], [63.70778, 39.22349], [64.19086, 38.95561], [64.32576, 38.98691], [65.55873, 38.29052], [65.83913, 38.25733], [66.24013, 38.16238], [66.41042, 38.02403], [66.56697, 38.0435], [66.67684, 37.96776], [66.53676, 37.80084], [66.52852, 37.58568], [66.65761, 37.45497], [66.52303, 37.39827], [66.55743, 37.35409], [66.64699, 37.32958], [66.95598, 37.40162], [67.08232, 37.35469], [67.13039, 37.27168], [67.2224, 37.24545], [67.2581, 37.17216], [67.51868, 37.26102], [67.78329, 37.1834], [67.8474, 37.31594], [67.81566, 37.43107], [68.12635, 37.93], [68.27159, 37.91477], [68.40343, 38.19484], [68.13289, 38.40822], [68.06274, 38.39435], [68.11366, 38.47169], [68.05873, 38.56087], [68.0807, 38.64136], [68.05598, 38.71641], [68.12877, 38.73677], [68.06948, 38.82115], [68.19743, 38.85985], [68.09704, 39.02589], [67.68915, 39.00775], [67.67833, 39.14479], [67.33226, 39.23739], [67.36522, 39.31287], [67.45998, 39.315], [67.46822, 39.46146], [67.39681, 39.52505], [67.46547, 39.53564], [67.44899, 39.57799], [67.62889, 39.60234], [67.70992, 39.66156], [68.12053, 39.56317], [68.54166, 39.53929], [68.61972, 39.68905], [68.63071, 39.85265], [68.88889, 39.87163], [68.93695, 39.91167], [68.84906, 40.04952], [68.96579, 40.06949], [69.01935, 40.11466], [69.01523, 40.15771], [68.62796, 40.07789], [68.52771, 40.11676], [68.5332, 40.14826], [68.77902, 40.20492], [68.79276, 40.17555], [68.84357, 40.18604], [68.85832, 40.20885], [69.04544, 40.22904], [69.15659, 40.2162], [69.2074, 40.21488], [69.30448, 40.18774], [69.30104, 40.24502], [69.25229, 40.26362], [69.24817, 40.30357], [69.30808, 40.2821], [69.32833, 40.29794], [69.33794, 40.34819], [69.30774, 40.36102], [69.28525, 40.41894], [69.27066, 40.49274], [69.21063, 40.54469], [69.2643, 40.57506], [69.3455, 40.57988], [69.32834, 40.70233], [69.38327, 40.7918], [69.53021, 40.77621], [69.59441, 40.70181], [69.69434, 40.62615], [70.36655, 40.90296], [70.38028, 41.02014], [70.45251, 41.04438], [70.80009, 40.72825], [70.49871, 40.52503], [70.32626, 40.45174], [70.37511, 40.38605], [70.57149, 40.3442], [70.56394, 40.26421], [70.62342, 40.17396], [70.8607, 40.217], [70.9818, 40.22392], [70.95789, 40.28761], [71.05901, 40.28765], [71.13042, 40.34106], [71.36663, 40.31593], [71.4246, 40.28619], [71.51215, 40.26943], [71.51549, 40.22986], [71.61725, 40.20615], [71.61931, 40.26775], [71.68386, 40.26984], [71.70569, 40.20391], [71.69621, 40.18492], [71.71719, 40.17886], [71.73054, 40.14818], [71.82646, 40.21872], [71.85002, 40.25647], [72.05464, 40.27586], [71.96401, 40.31907], [72.18648, 40.49893], [72.24368, 40.46091], [72.40346, 40.4007], [72.44191, 40.48222], [72.41513, 40.50856], [72.38384, 40.51535], [72.41714, 40.55736], [72.34406, 40.60144], [72.40517, 40.61917], [72.47795, 40.5532], [72.66713, 40.5219], [72.66713, 40.59076], [72.69579, 40.59778], [72.73995, 40.58409], [72.74768, 40.58051], [72.74862, 40.57131], [72.75982, 40.57273], [72.74894, 40.59592], [72.74866, 40.60873], [72.80137, 40.67856], [72.84754, 40.67229], [72.85372, 40.7116], [72.8722, 40.71111], [72.93296, 40.73089], [72.99133, 40.76457], [73.0612, 40.76678], [73.13412, 40.79122], [73.13267, 40.83512], [73.01869, 40.84681], [72.94454, 40.8094], [72.84291, 40.85512], [72.68157, 40.84942], [72.59136, 40.86947], [72.55109, 40.96046], [72.48742, 40.97136], [72.45206, 41.03018], [72.38511, 41.02785], [72.36138, 41.04384], [72.34757, 41.06104], [72.34026, 41.04539], [72.324, 41.03381], [72.18339, 40.99571], [72.17594, 41.02377], [72.21061, 41.05607], [72.1792, 41.10621], [72.14864, 41.13363], [72.17594, 41.15522], [72.16433, 41.16483], [72.10745, 41.15483], [72.07249, 41.11739], [71.85964, 41.19081], [71.91457, 41.2982], [71.83914, 41.3546], [71.76625, 41.4466], [71.71132, 41.43012], [71.73054, 41.54713], [71.65914, 41.49599], [71.6787, 41.42111], [71.57227, 41.29175], [71.46688, 41.31883], [71.43814, 41.19644], [71.46148, 41.13958], [71.40198, 41.09436], [71.34877, 41.16807], [71.27187, 41.11015], [71.25813, 41.18796], [71.11806, 41.15359], [71.02193, 41.19494], [70.9615, 41.16393], [70.86263, 41.23833], [70.77885, 41.24813], [70.78572, 41.36419], [70.67586, 41.47953], [70.48909, 41.40335], [70.17682, 41.5455], [70.69777, 41.92554], [71.28719, 42.18033], [71.13263, 42.28356], [70.94483, 42.26238], [69.49545, 41.545], [69.45751, 41.56863], [69.39485, 41.51518], [69.45081, 41.46246], [69.37468, 41.46555], [69.35554, 41.47211], [69.29778, 41.43673], [69.25059, 41.46693], [69.23332, 41.45847], [69.22671, 41.46298], [69.20439, 41.45391], [69.18528, 41.45175], [69.17701, 41.43769], [69.15137, 41.43078], [69.05006, 41.36183], [69.01308, 41.22804], [68.7217, 41.05025], [68.73945, 40.96989], [68.65662, 40.93861], [68.62221, 41.03019], [68.49983, 40.99669], [68.58444, 40.91447], [68.63, 40.59358], [68.49983, 40.56437], [67.96736, 40.83798], [68.1271, 41.0324], [68.08273, 41.08148], [67.98511, 41.02794], [67.9644, 41.14611], [66.69129, 41.1311], [66.53302, 41.87388], [66.00546, 41.94455], [66.09482, 42.93426], [65.85194, 42.85481]], [[70.68112, 40.90612], [70.6721, 40.90555], [70.57501, 40.98941], [70.54223, 40.98787], [70.56077, 41.00642], [70.6158, 40.97661], [70.68112, 40.90612]]], [[[71.21139, 40.03369], [71.12218, 40.03052], [71.06305, 40.1771], [71.00236, 40.18154], [71.01035, 40.05481], [71.11037, 40.01984], [71.11668, 39.99291], [71.09063, 39.99], [71.10501, 39.95568], [71.04979, 39.89808], [71.10531, 39.91354], [71.16101, 39.88423], [71.23067, 39.93581], [71.1427, 39.95026], [71.21139, 40.03369]]], [[[71.86463, 39.98598], [71.78838, 40.01404], [71.71511, 39.96348], [71.7504, 39.93701], [71.84316, 39.95582], [71.86463, 39.98598]]]] } },
20750     { type: "Feature", properties: { iso1A2: "VA", iso1A3: "VAT", iso1N3: "336", wikidata: "Q237", nameEn: "Vatican City", aliases: ["Holy See"], groups: ["039", "150"], callingCodes: ["379", "39 06"] }, geometry: { type: "MultiPolygon", coordinates: [[[[12.45181, 41.90056], [12.45446, 41.90028], [12.45435, 41.90143], [12.45626, 41.90172], [12.45691, 41.90125], [12.4577, 41.90115], [12.45834, 41.90174], [12.45826, 41.90281], [12.45755, 41.9033], [12.45762, 41.9058], [12.45561, 41.90629], [12.45543, 41.90738], [12.45091, 41.90625], [12.44984, 41.90545], [12.44815, 41.90326], [12.44582, 41.90194], [12.44834, 41.90095], [12.45181, 41.90056]]]] } },
20751     { type: "Feature", properties: { iso1A2: "VC", iso1A3: "VCT", iso1N3: "670", wikidata: "Q757", nameEn: "St. Vincent and the Grenadines", aliases: ["WV"], groups: ["029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", callingCodes: ["1 784"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-62.64026, 12.69984], [-59.94058, 12.34011], [-61.69315, 14.26451], [-62.64026, 12.69984]]]] } },
20752     { type: "Feature", properties: { iso1A2: "VE", iso1A3: "VEN", iso1N3: "862", wikidata: "Q717", nameEn: "Venezuela", aliases: ["YV"], groups: ["005", "419", "019", "UN"], callingCodes: ["58"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-71.22331, 13.01387], [-70.92579, 11.96275], [-71.3275, 11.85], [-71.9675, 11.65536], [-72.24983, 11.14138], [-72.4767, 11.1117], [-72.88002, 10.44309], [-72.98085, 9.85253], [-73.36905, 9.16636], [-73.02119, 9.27584], [-72.94052, 9.10663], [-72.77415, 9.10165], [-72.65474, 8.61428], [-72.4042, 8.36513], [-72.36987, 8.19976], [-72.35163, 8.01163], [-72.39137, 8.03534], [-72.47213, 7.96106], [-72.48801, 7.94329], [-72.48183, 7.92909], [-72.47042, 7.92306], [-72.45806, 7.91141], [-72.46183, 7.90682], [-72.44454, 7.86031], [-72.46763, 7.79518], [-72.47827, 7.65604], [-72.45321, 7.57232], [-72.47415, 7.48928], [-72.43132, 7.40034], [-72.19437, 7.37034], [-72.04895, 7.03837], [-71.82441, 7.04314], [-71.44118, 7.02116], [-71.42212, 7.03854], [-71.37234, 7.01588], [-71.03941, 6.98163], [-70.7596, 7.09799], [-70.10716, 6.96516], [-69.41843, 6.1072], [-67.60654, 6.2891], [-67.4625, 6.20625], [-67.43513, 5.98835], [-67.58558, 5.84537], [-67.63914, 5.64963], [-67.59141, 5.5369], [-67.83341, 5.31104], [-67.85358, 4.53249], [-67.62671, 3.74303], [-67.50067, 3.75812], [-67.30945, 3.38393], [-67.85862, 2.86727], [-67.85862, 2.79173], [-67.65696, 2.81691], [-67.21967, 2.35778], [-66.85795, 1.22998], [-66.28507, 0.74585], [-65.6727, 1.01353], [-65.50158, 0.92086], [-65.57288, 0.62856], [-65.11657, 1.12046], [-64.38932, 1.5125], [-64.34654, 1.35569], [-64.08274, 1.64792], [-64.06135, 1.94722], [-63.39827, 2.16098], [-63.39114, 2.4317], [-64.0257, 2.48156], [-64.02908, 2.79797], [-64.48379, 3.7879], [-64.84028, 4.24665], [-64.72977, 4.28931], [-64.57648, 4.12576], [-64.14512, 4.12932], [-63.99183, 3.90172], [-63.86082, 3.94796], [-63.70218, 3.91417], [-63.67099, 4.01731], [-63.50611, 3.83592], [-63.42233, 3.89995], [-63.4464, 3.9693], [-63.21111, 3.96219], [-62.98296, 3.59935], [-62.7655, 3.73099], [-62.74411, 4.03331], [-62.57656, 4.04754], [-62.44822, 4.18621], [-62.13094, 4.08309], [-61.54629, 4.2822], [-61.48569, 4.43149], [-61.29675, 4.44216], [-61.31457, 4.54167], [-61.15703, 4.49839], [-60.98303, 4.54167], [-60.86539, 4.70512], [-60.5802, 4.94312], [-60.73204, 5.20931], [-61.4041, 5.95304], [-61.15058, 6.19558], [-61.20762, 6.58174], [-61.13632, 6.70922], [-60.54873, 6.8631], [-60.39419, 6.94847], [-60.28074, 7.1162], [-60.44116, 7.20817], [-60.54098, 7.14804], [-60.63367, 7.25061], [-60.59802, 7.33194], [-60.71923, 7.55817], [-60.64793, 7.56877], [-60.51959, 7.83373], [-60.38056, 7.8302], [-60.02407, 8.04557], [-59.97059, 8.20791], [-59.83156, 8.23261], [-59.80661, 8.28906], [-59.85562, 8.35213], [-59.98508, 8.53046], [-59.54058, 8.6862], [-60.89962, 9.81445], [-62.08693, 10.04435], [-61.62505, 11.18974], [-63.73917, 11.92623], [-63.19938, 16.44103], [-67.89186, 12.4116], [-68.01417, 11.77722], [-68.33524, 11.78151], [-68.99639, 11.79035], [-71.22331, 13.01387]]]] } },
20753     { type: "Feature", properties: { iso1A2: "VG", iso1A3: "VGB", iso1N3: "092", wikidata: "Q25305", nameEn: "British Virgin Islands", country: "GB", groups: ["BOTS", "029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1 284"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-64.47127, 17.55688], [-63.88746, 19.15706], [-65.02435, 18.73231], [-64.86027, 18.39056], [-64.64673, 18.36549], [-64.47127, 17.55688]]]] } },
20754     { type: "Feature", properties: { iso1A2: "VI", iso1A3: "VIR", iso1N3: "850", wikidata: "Q11703", nameEn: "United States Virgin Islands", aliases: ["US-VI"], country: "US", groups: ["Q1352230", "029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1 340"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-65.02435, 18.73231], [-65.27974, 17.56928], [-64.47127, 17.55688], [-64.64673, 18.36549], [-64.86027, 18.39056], [-65.02435, 18.73231]]]] } },
20755     { type: "Feature", properties: { iso1A2: "VN", iso1A3: "VNM", iso1N3: "704", wikidata: "Q881", nameEn: "Vietnam", groups: ["035", "142", "UN"], callingCodes: ["84"] }, geometry: { type: "MultiPolygon", coordinates: [[[[108.10003, 21.47338], [108.0569, 21.53604], [108.02926, 21.54997], [107.97932, 21.54503], [107.97383, 21.53961], [107.97074, 21.54072], [107.96774, 21.53601], [107.95232, 21.5388], [107.92652, 21.58906], [107.90006, 21.5905], [107.86114, 21.65128], [107.80355, 21.66141], [107.66967, 21.60787], [107.56537, 21.61945], [107.54047, 21.5934], [107.49065, 21.59774], [107.49532, 21.62958], [107.47197, 21.6672], [107.41593, 21.64839], [107.38636, 21.59774], [107.35989, 21.60063], [107.35834, 21.6672], [107.29296, 21.74674], [107.24625, 21.7077], [107.20734, 21.71493], [107.10771, 21.79879], [107.02615, 21.81981], [107.00964, 21.85948], [107.06101, 21.88982], [107.05634, 21.92303], [106.99252, 21.95191], [106.97228, 21.92592], [106.92714, 21.93459], [106.9178, 21.97357], [106.81038, 21.97934], [106.74345, 22.00965], [106.72551, 21.97923], [106.69276, 21.96013], [106.68274, 21.99811], [106.70142, 22.02409], [106.6983, 22.15102], [106.67495, 22.1885], [106.69986, 22.22309], [106.6516, 22.33977], [106.55976, 22.34841], [106.57221, 22.37], [106.55665, 22.46498], [106.58395, 22.474], [106.61269, 22.60301], [106.65316, 22.5757], [106.71698, 22.58432], [106.72321, 22.63606], [106.76293, 22.73491], [106.82404, 22.7881], [106.83685, 22.8098], [106.81271, 22.8226], [106.78422, 22.81532], [106.71128, 22.85982], [106.71387, 22.88296], [106.6734, 22.89587], [106.6516, 22.86862], [106.60179, 22.92884], [106.55976, 22.92311], [106.51306, 22.94891], [106.49749, 22.91164], [106.34961, 22.86718], [106.27022, 22.87722], [106.19705, 22.98475], [106.00179, 22.99049], [105.99568, 22.94178], [105.90119, 22.94168], [105.8726, 22.92756], [105.72382, 23.06641], [105.57594, 23.075], [105.56037, 23.16806], [105.49966, 23.20669], [105.42805, 23.30824], [105.40782, 23.28107], [105.32376, 23.39684], [105.22569, 23.27249], [105.17276, 23.28679], [105.11672, 23.25247], [105.07002, 23.26248], [104.98712, 23.19176], [104.96532, 23.20463], [104.9486, 23.17235], [104.91435, 23.18666], [104.87992, 23.17141], [104.87382, 23.12854], [104.79478, 23.12934], [104.8334, 23.01484], [104.86765, 22.95178], [104.84942, 22.93631], [104.77114, 22.90017], [104.72755, 22.81984], [104.65283, 22.83419], [104.60457, 22.81841], [104.58122, 22.85571], [104.47225, 22.75813], [104.35593, 22.69353], [104.25683, 22.76534], [104.27084, 22.8457], [104.11384, 22.80363], [104.03734, 22.72945], [104.01088, 22.51823], [103.99247, 22.51958], [103.97384, 22.50634], [103.96783, 22.51173], [103.96352, 22.50584], [103.95191, 22.5134], [103.94513, 22.52553], [103.93286, 22.52703], [103.87904, 22.56683], [103.64506, 22.79979], [103.56255, 22.69499], [103.57812, 22.65764], [103.52675, 22.59155], [103.43646, 22.70648], [103.43179, 22.75816], [103.32282, 22.8127], [103.28079, 22.68063], [103.18895, 22.64471], [103.15782, 22.59873], [103.17961, 22.55705], [103.07843, 22.50097], [103.0722, 22.44775], [102.9321, 22.48659], [102.8636, 22.60735], [102.60675, 22.73376], [102.57095, 22.7036], [102.51802, 22.77969], [102.46665, 22.77108], [102.42618, 22.69212], [102.38415, 22.67919], [102.41061, 22.64184], [102.25339, 22.4607], [102.26428, 22.41321], [102.16621, 22.43336], [102.14099, 22.40092], [102.18712, 22.30403], [102.51734, 22.02676], [102.49092, 21.99002], [102.62301, 21.91447], [102.67145, 21.65894], [102.74189, 21.66713], [102.82115, 21.73667], [102.81894, 21.83888], [102.85637, 21.84501], [102.86077, 21.71213], [102.97965, 21.74076], [102.98846, 21.58936], [102.86297, 21.4255], [102.94223, 21.46034], [102.88939, 21.3107], [102.80794, 21.25736], [102.89825, 21.24707], [102.97745, 21.05821], [103.03469, 21.05821], [103.12055, 20.89994], [103.21497, 20.89832], [103.38032, 20.79501], [103.45737, 20.82382], [103.68633, 20.66324], [103.73478, 20.6669], [103.82282, 20.8732], [103.98024, 20.91531], [104.11121, 20.96779], [104.27412, 20.91433], [104.63957, 20.6653], [104.38199, 20.47155], [104.40621, 20.3849], [104.47886, 20.37459], [104.66158, 20.47774], [104.72102, 20.40554], [104.62195, 20.36633], [104.61315, 20.24452], [104.86852, 20.14121], [104.91695, 20.15567], [104.9874, 20.09573], [104.8465, 19.91783], [104.8355, 19.80395], [104.68359, 19.72729], [104.64837, 19.62365], [104.53169, 19.61743], [104.41281, 19.70035], [104.23229, 19.70242], [104.06498, 19.66926], [104.05617, 19.61743], [104.10832, 19.51575], [104.06058, 19.43484], [103.87125, 19.31854], [104.5361, 18.97747], [104.64617, 18.85668], [105.12829, 18.70453], [105.19654, 18.64196], [105.1327, 18.58355], [105.10408, 18.43533], [105.15942, 18.38691], [105.38366, 18.15315], [105.46292, 18.22008], [105.64784, 17.96687], [105.60381, 17.89356], [105.76612, 17.67147], [105.85744, 17.63221], [106.09019, 17.36399], [106.18991, 17.28227], [106.24444, 17.24714], [106.29287, 17.3018], [106.31929, 17.20509], [106.43597, 17.01362], [106.50862, 16.9673], [106.55045, 17.0031], [106.54824, 16.92729], [106.51963, 16.92097], [106.52183, 16.87884], [106.55265, 16.86831], [106.55485, 16.68704], [106.59013, 16.62259], [106.58267, 16.6012], [106.61477, 16.60713], [106.66052, 16.56892], [106.65832, 16.47816], [106.74418, 16.41904], [106.84104, 16.55415], [106.88727, 16.52671], [106.88067, 16.43594], [106.96638, 16.34938], [106.97385, 16.30204], [107.02597, 16.31132], [107.09091, 16.3092], [107.15035, 16.26271], [107.14595, 16.17816], [107.25822, 16.13587], [107.33968, 16.05549], [107.44975, 16.08511], [107.46296, 16.01106], [107.39471, 15.88829], [107.34188, 15.89464], [107.21419, 15.83747], [107.21859, 15.74638], [107.27143, 15.71459], [107.27583, 15.62769], [107.34408, 15.62345], [107.3815, 15.49832], [107.50699, 15.48771], [107.53341, 15.40496], [107.62367, 15.42193], [107.60605, 15.37524], [107.62587, 15.2266], [107.58844, 15.20111], [107.61926, 15.13949], [107.61486, 15.0566], [107.46516, 15.00982], [107.48277, 14.93751], [107.59285, 14.87795], [107.51579, 14.79282], [107.54361, 14.69092], [107.55371, 14.628], [107.52102, 14.59034], [107.52569, 14.54665], [107.48521, 14.40346], [107.44941, 14.41552], [107.39493, 14.32655], [107.40427, 14.24509], [107.33577, 14.11832], [107.37158, 14.07906], [107.35757, 14.02319], [107.38247, 13.99147], [107.44318, 13.99751], [107.46498, 13.91593], [107.45252, 13.78897], [107.53503, 13.73908], [107.61909, 13.52577], [107.62843, 13.3668], [107.49144, 13.01215], [107.49611, 12.88926], [107.55993, 12.7982], [107.5755, 12.52177], [107.55059, 12.36824], [107.4463, 12.29373], [107.42917, 12.24657], [107.34511, 12.33327], [107.15831, 12.27547], [106.99953, 12.08983], [106.92325, 12.06548], [106.79405, 12.0807], [106.70687, 11.96956], [106.4111, 11.97413], [106.4687, 11.86751], [106.44068, 11.86294], [106.44535, 11.8279], [106.41577, 11.76999], [106.45158, 11.68616], [106.44691, 11.66787], [106.37219, 11.69836], [106.30525, 11.67549], [106.26478, 11.72122], [106.18539, 11.75171], [106.13158, 11.73283], [106.06708, 11.77761], [106.02038, 11.77457], [106.00792, 11.7197], [105.95188, 11.63738], [105.88962, 11.67854], [105.8507, 11.66635], [105.80867, 11.60536], [105.81645, 11.56876], [105.87328, 11.55953], [105.88962, 11.43605], [105.86782, 11.28343], [106.10444, 11.07879], [106.1527, 11.10476], [106.1757, 11.07301], [106.20095, 10.97795], [106.14301, 10.98176], [106.18539, 10.79451], [106.06708, 10.8098], [105.94535, 10.9168], [105.93403, 10.83853], [105.84603, 10.85873], [105.86376, 10.89839], [105.77751, 11.03671], [105.50045, 10.94586], [105.42884, 10.96878], [105.34011, 10.86179], [105.11449, 10.96332], [105.08326, 10.95656], [105.02722, 10.89236], [105.09571, 10.72722], [104.95094, 10.64003], [104.87933, 10.52833], [104.59018, 10.53073], [104.49869, 10.4057], [104.47963, 10.43046], [104.43778, 10.42386], [103.99198, 10.48391], [102.47649, 9.66162], [104.81582, 8.03101], [109.55486, 8.10026], [111.60491, 13.57105], [108.00365, 17.98159], [108.10003, 21.47338]]]] } },
20756     { type: "Feature", properties: { iso1A2: "VU", iso1A3: "VUT", iso1N3: "548", wikidata: "Q686", nameEn: "Vanuatu", groups: ["054", "009", "UN"], callingCodes: ["678"] }, geometry: { type: "MultiPolygon", coordinates: [[[[156.73836, -14.50464], [174.245, -23.1974], [172.71443, -12.01327], [156.73836, -14.50464]]]] } },
20757     { type: "Feature", properties: { iso1A2: "WF", iso1A3: "WLF", iso1N3: "876", wikidata: "Q35555", nameEn: "Wallis and Futuna", country: "FR", groups: ["EU", "Q1451600", "061", "009", "UN"], callingCodes: ["681"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-178.66551, -14.32452], [-176.76826, -14.95183], [-175.59809, -12.61507], [-178.66551, -14.32452]]]] } },
20758     { type: "Feature", properties: { iso1A2: "WS", iso1A3: "WSM", iso1N3: "882", wikidata: "Q683", nameEn: "Samoa", groups: ["061", "009", "UN"], driveSide: "left", callingCodes: ["685"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-173.74402, -14.26669], [-170.99605, -15.1275], [-171.39864, -10.21587], [-173.74402, -14.26669]]]] } },
20759     { type: "Feature", properties: { iso1A2: "XK", iso1A3: "XKX", wikidata: "Q1246", nameEn: "Kosovo", aliases: ["KV"], groups: ["039", "150"], isoStatus: "usrAssn", callingCodes: ["383"] }, geometry: { type: "MultiPolygon", coordinates: [[[[21.39045, 42.74888], [21.44047, 42.87276], [21.36941, 42.87397], [21.32974, 42.90424], [21.2719, 42.8994], [21.23534, 42.95523], [21.23877, 43.00848], [21.2041, 43.02277], [21.16734, 42.99694], [21.14465, 43.11089], [21.08952, 43.13471], [21.05378, 43.10707], [21.00749, 43.13984], [20.96287, 43.12416], [20.83727, 43.17842], [20.88685, 43.21697], [20.82145, 43.26769], [20.73811, 43.25068], [20.68688, 43.21335], [20.59929, 43.20492], [20.69515, 43.09641], [20.64557, 43.00826], [20.59929, 43.01067], [20.48692, 42.93208], [20.53484, 42.8885], [20.43734, 42.83157], [20.40594, 42.84853], [20.35692, 42.8335], [20.27869, 42.81945], [20.2539, 42.76245], [20.04898, 42.77701], [20.02088, 42.74789], [20.02915, 42.71147], [20.0969, 42.65559], [20.07761, 42.55582], [20.17127, 42.50469], [20.21797, 42.41237], [20.24399, 42.32168], [20.34479, 42.32656], [20.3819, 42.3029], [20.48857, 42.25444], [20.56955, 42.12097], [20.55633, 42.08173], [20.59434, 42.03879], [20.63069, 41.94913], [20.57946, 41.91593], [20.59524, 41.8818], [20.68523, 41.85318], [20.76786, 41.91839], [20.75464, 42.05229], [21.11491, 42.20794], [21.16614, 42.19815], [21.22728, 42.08909], [21.31983, 42.10993], [21.29913, 42.13954], [21.30496, 42.1418], [21.38428, 42.24465], [21.43882, 42.23609], [21.43882, 42.2789], [21.50823, 42.27156], [21.52145, 42.24465], [21.58992, 42.25915], [21.56772, 42.30946], [21.5264, 42.33634], [21.53467, 42.36809], [21.57021, 42.3647], [21.59029, 42.38042], [21.62887, 42.37664], [21.64209, 42.41081], [21.62556, 42.45106], [21.7035, 42.51899], [21.70522, 42.54176], [21.7327, 42.55041], [21.75672, 42.62695], [21.79413, 42.65923], [21.75025, 42.70125], [21.6626, 42.67813], [21.58755, 42.70418], [21.59154, 42.72643], [21.47498, 42.74695], [21.39045, 42.74888]]]] } },
20760     { type: "Feature", properties: { iso1A2: "YE", iso1A3: "YEM", iso1N3: "887", wikidata: "Q805", nameEn: "Yemen", groups: ["145", "142", "UN"], callingCodes: ["967"] }, geometry: { type: "MultiPolygon", coordinates: [[[[57.49095, 8.14549], [52.81185, 17.28568], [52.74267, 17.29519], [52.78009, 17.35124], [52.00311, 19.00083], [49.04884, 18.59899], [48.19996, 18.20584], [47.58351, 17.50366], [47.48245, 17.10808], [47.00571, 16.94765], [46.76494, 17.29151], [46.31018, 17.20464], [44.50126, 17.47475], [43.70631, 17.35762], [43.43005, 17.56148], [43.29185, 17.53224], [43.22533, 17.38343], [43.32653, 17.31179], [43.20156, 17.25901], [43.17787, 17.14717], [43.23967, 17.03428], [43.18233, 17.02673], [43.1813, 16.98438], [43.19328, 16.94703], [43.1398, 16.90696], [43.18338, 16.84852], [43.22012, 16.83932], [43.22956, 16.80613], [43.24801, 16.80613], [43.26303, 16.79479], [43.25857, 16.75304], [43.21325, 16.74416], [43.22066, 16.65179], [43.15274, 16.67248], [43.11601, 16.53166], [42.97215, 16.51093], [42.94351, 16.49467], [42.94625, 16.39721], [42.76801, 16.40371], [42.15205, 16.40211], [40.99158, 15.81743], [43.29075, 12.79154], [43.32909, 12.59711], [43.90659, 12.3823], [51.12877, 12.56479], [57.49095, 8.14549]]]] } },
20761     { type: "Feature", properties: { iso1A2: "YT", iso1A3: "MYT", iso1N3: "175", wikidata: "Q17063", nameEn: "Mayotte", country: "FR", groups: ["Q3320166", "EU", "014", "202", "002", "UN"], callingCodes: ["262"] }, geometry: { type: "MultiPolygon", coordinates: [[[[43.28731, -13.97126], [45.54824, -13.22353], [45.4971, -11.75965], [43.28731, -13.97126]]]] } },
20762     { type: "Feature", properties: { iso1A2: "ZA", iso1A3: "ZAF", iso1N3: "710", wikidata: "Q258", nameEn: "South Africa", groups: ["018", "202", "002", "UN"], driveSide: "left", callingCodes: ["27"] }, geometry: { type: "MultiPolygon", coordinates: [[[[31.30611, -22.422], [31.16344, -22.32599], [31.08932, -22.34884], [30.86696, -22.28907], [30.6294, -22.32599], [30.48686, -22.31368], [30.38614, -22.34533], [30.28351, -22.35587], [30.2265, -22.2961], [30.13147, -22.30841], [29.92242, -22.19408], [29.76848, -22.14128], [29.64609, -22.12917], [29.37703, -22.19581], [29.21955, -22.17771], [29.18974, -22.18599], [29.15268, -22.21399], [29.10881, -22.21202], [29.0151, -22.22907], [28.91889, -22.44299], [28.63287, -22.55887], [28.34874, -22.5694], [28.04562, -22.8394], [28.04752, -22.90243], [27.93729, -22.96194], [27.93539, -23.04941], [27.74154, -23.2137], [27.6066, -23.21894], [27.52393, -23.37952], [27.33768, -23.40917], [26.99749, -23.65486], [26.84165, -24.24885], [26.51667, -24.47219], [26.46346, -24.60358], [26.39409, -24.63468], [25.8515, -24.75727], [25.84295, -24.78661], [25.88571, -24.87802], [25.72702, -25.25503], [25.69661, -25.29284], [25.6643, -25.4491], [25.58543, -25.6343], [25.33076, -25.76616], [25.12266, -25.75931], [25.01718, -25.72507], [24.8946, -25.80723], [24.67319, -25.81749], [24.44703, -25.73021], [24.36531, -25.773], [24.18287, -25.62916], [23.9244, -25.64286], [23.47588, -25.29971], [23.03497, -25.29971], [22.86012, -25.50572], [22.70808, -25.99186], [22.56365, -26.19668], [22.41921, -26.23078], [22.21206, -26.3773], [22.06192, -26.61882], [21.90703, -26.66808], [21.83291, -26.65959], [21.77114, -26.69015], [21.7854, -26.79199], [21.69322, -26.86152], [21.37869, -26.82083], [21.13353, -26.86661], [20.87031, -26.80047], [20.68596, -26.9039], [20.63275, -26.78181], [20.61754, -26.4692], [20.86081, -26.14892], [20.64795, -25.47827], [20.29826, -24.94869], [20.03678, -24.81004], [20.02809, -24.78725], [19.99817, -24.76768], [19.99882, -28.42622], [18.99885, -28.89165], [17.4579, -28.68718], [17.15405, -28.08573], [16.90446, -28.057], [16.59922, -28.53246], [16.46592, -28.57126], [16.45332, -28.63117], [12.51595, -32.27486], [38.88176, -48.03306], [34.51034, -26.91792], [32.35222, -26.86027], [32.29584, -26.852], [32.22302, -26.84136], [32.19409, -26.84032], [32.13315, -26.84345], [32.09664, -26.80721], [32.00893, -26.8096], [31.97463, -27.11057], [31.97592, -27.31675], [31.49834, -27.31549], [31.15027, -27.20151], [30.96088, -27.0245], [30.97757, -26.92706], [30.88826, -26.79622], [30.81101, -26.84722], [30.78927, -26.48271], [30.95819, -26.26303], [31.13073, -25.91558], [31.31237, -25.7431], [31.4175, -25.71886], [31.86881, -25.99973], [31.974, -25.95387], [31.92649, -25.84216], [32.00631, -25.65044], [31.97875, -25.46356], [32.01676, -25.38117], [32.03196, -25.10785], [31.9835, -24.29983], [31.90368, -24.18892], [31.87707, -23.95293], [31.77445, -23.90082], [31.70223, -23.72695], [31.67942, -23.60858], [31.56539, -23.47268], [31.55779, -23.176], [31.30611, -22.422]], [[29.33204, -29.45598], [29.28545, -29.58456], [29.12553, -29.76266], [29.16548, -29.91706], [28.9338, -30.05072], [28.80222, -30.10579], [28.68627, -30.12885], [28.399, -30.1592], [28.2319, -30.28476], [28.12073, -30.68072], [27.74814, -30.60635], [27.69467, -30.55862], [27.67819, -30.53437], [27.6521, -30.51707], [27.62137, -30.50509], [27.56781, -30.44562], [27.56901, -30.42504], [27.45452, -30.32239], [27.38108, -30.33456], [27.36649, -30.27246], [27.37293, -30.19401], [27.40778, -30.14577], [27.32555, -30.14785], [27.29603, -30.05473], [27.22719, -30.00718], [27.09489, -29.72796], [27.01016, -29.65439], [27.33464, -29.48161], [27.4358, -29.33465], [27.47254, -29.31968], [27.45125, -29.29708], [27.48679, -29.29349], [27.54258, -29.25575], [27.5158, -29.2261], [27.55974, -29.18954], [27.75458, -28.89839], [27.8907, -28.91612], [27.88933, -28.88156], [27.9392, -28.84864], [27.98675, -28.8787], [28.02503, -28.85991], [28.1317, -28.7293], [28.2348, -28.69471], [28.30518, -28.69531], [28.40612, -28.6215], [28.65091, -28.57025], [28.68043, -28.58744], [29.40524, -29.21246], [29.44883, -29.3772], [29.33204, -29.45598]]]] } },
20763     { type: "Feature", properties: { iso1A2: "ZM", iso1A3: "ZMB", iso1N3: "894", wikidata: "Q953", nameEn: "Zambia", groups: ["014", "202", "002", "UN"], driveSide: "left", callingCodes: ["260"] }, geometry: { type: "MultiPolygon", coordinates: [[[[32.95389, -9.40138], [32.76233, -9.31963], [32.75611, -9.28583], [32.53661, -9.24281], [32.49147, -9.14754], [32.43543, -9.11988], [32.25486, -9.13371], [32.16146, -9.05993], [32.08206, -9.04609], [31.98866, -9.07069], [31.94196, -9.02303], [31.94663, -8.93846], [31.81587, -8.88618], [31.71158, -8.91386], [31.57147, -8.81388], [31.57147, -8.70619], [31.37533, -8.60769], [31.00796, -8.58615], [30.79243, -8.27382], [28.88917, -8.4831], [28.9711, -8.66935], [28.38526, -9.23393], [28.36562, -9.30091], [28.52636, -9.35379], [28.51627, -9.44726], [28.56208, -9.49122], [28.68532, -9.78], [28.62795, -9.92942], [28.65032, -10.65133], [28.37241, -11.57848], [28.48357, -11.87532], [29.18592, -12.37921], [29.4992, -12.43843], [29.48404, -12.23604], [29.8139, -12.14898], [29.81551, -13.44683], [29.65078, -13.41844], [29.60531, -13.21685], [29.01918, -13.41353], [28.33199, -12.41375], [27.59932, -12.22123], [27.21025, -11.76157], [27.22541, -11.60323], [27.04351, -11.61312], [26.88687, -12.01868], [26.01777, -11.91488], [25.33058, -11.65767], [25.34069, -11.19707], [24.42612, -11.44975], [24.34528, -11.06816], [24.00027, -10.89356], [24.02603, -11.15368], [23.98804, -12.13149], [24.06672, -12.29058], [23.90937, -12.844], [24.03339, -12.99091], [21.97988, -13.00148], [22.00323, -16.18028], [22.17217, -16.50269], [23.20038, -17.47563], [23.47474, -17.62877], [24.23619, -17.47489], [24.32811, -17.49082], [24.38712, -17.46818], [24.5621, -17.52963], [24.70864, -17.49501], [25.00198, -17.58221], [25.26433, -17.79571], [25.51646, -17.86232], [25.6827, -17.81987], [25.85738, -17.91403], [25.85892, -17.97726], [26.08925, -17.98168], [26.0908, -17.93021], [26.21601, -17.88608], [26.55918, -17.99638], [26.68403, -18.07411], [26.74314, -18.0199], [26.89926, -17.98756], [27.14196, -17.81398], [27.30736, -17.60487], [27.61377, -17.34378], [27.62795, -17.24365], [27.83141, -16.96274], [28.73725, -16.5528], [28.76199, -16.51575], [28.81454, -16.48611], [28.8501, -16.04537], [28.9243, -15.93987], [29.01298, -15.93805], [29.21955, -15.76589], [29.4437, -15.68702], [29.8317, -15.6126], [30.35574, -15.6513], [30.41902, -15.62269], [30.22098, -14.99447], [33.24249, -14.00019], [33.16749, -13.93992], [33.07568, -13.98447], [33.02977, -14.05022], [32.99042, -13.95689], [32.88985, -13.82956], [32.79015, -13.80755], [32.76962, -13.77224], [32.84528, -13.71576], [32.7828, -13.64805], [32.68654, -13.64268], [32.66468, -13.60019], [32.68436, -13.55769], [32.73683, -13.57682], [32.84176, -13.52794], [32.86113, -13.47292], [33.0078, -13.19492], [32.98289, -13.12671], [33.02181, -12.88707], [32.96733, -12.88251], [32.94397, -12.76868], [33.05917, -12.59554], [33.18837, -12.61377], [33.28177, -12.54692], [33.37517, -12.54085], [33.54485, -12.35996], [33.47636, -12.32498], [33.3705, -12.34931], [33.25998, -12.14242], [33.33937, -11.91252], [33.32692, -11.59248], [33.24252, -11.59302], [33.23663, -11.40637], [33.29267, -11.43536], [33.29267, -11.3789], [33.39697, -11.15296], [33.25998, -10.88862], [33.28022, -10.84428], [33.47636, -10.78465], [33.70675, -10.56896], [33.54797, -10.36077], [33.53863, -10.20148], [33.31297, -10.05133], [33.37902, -9.9104], [33.36581, -9.81063], [33.31517, -9.82364], [33.2095, -9.61099], [33.12144, -9.58929], [33.10163, -9.66525], [33.05485, -9.61316], [33.00256, -9.63053], [33.00476, -9.5133], [32.95389, -9.40138]]]] } },
20764     { type: "Feature", properties: { iso1A2: "ZW", iso1A3: "ZWE", iso1N3: "716", wikidata: "Q954", nameEn: "Zimbabwe", groups: ["014", "202", "002", "UN"], driveSide: "left", callingCodes: ["263"] }, geometry: { type: "MultiPolygon", coordinates: [[[[30.41902, -15.62269], [30.35574, -15.6513], [29.8317, -15.6126], [29.4437, -15.68702], [29.21955, -15.76589], [29.01298, -15.93805], [28.9243, -15.93987], [28.8501, -16.04537], [28.81454, -16.48611], [28.76199, -16.51575], [28.73725, -16.5528], [27.83141, -16.96274], [27.62795, -17.24365], [27.61377, -17.34378], [27.30736, -17.60487], [27.14196, -17.81398], [26.89926, -17.98756], [26.74314, -18.0199], [26.68403, -18.07411], [26.55918, -17.99638], [26.21601, -17.88608], [26.0908, -17.93021], [26.08925, -17.98168], [25.85892, -17.97726], [25.85738, -17.91403], [25.6827, -17.81987], [25.51646, -17.86232], [25.26433, -17.79571], [25.23909, -17.90832], [25.31799, -18.07091], [25.39972, -18.12691], [25.53465, -18.39041], [25.68859, -18.56165], [25.79217, -18.6355], [25.82353, -18.82808], [25.94326, -18.90362], [25.99837, -19.02943], [25.96226, -19.08152], [26.17227, -19.53709], [26.72246, -19.92707], [27.21278, -20.08244], [27.29831, -20.28935], [27.28865, -20.49873], [27.69361, -20.48531], [27.72972, -20.51735], [27.69171, -21.08409], [27.91407, -21.31621], [28.01669, -21.57624], [28.29416, -21.59037], [28.49942, -21.66634], [28.58114, -21.63455], [29.07763, -21.81877], [29.04023, -21.85864], [29.02191, -21.90647], [29.02191, -21.95665], [29.04108, -22.00563], [29.08495, -22.04867], [29.14501, -22.07275], [29.1974, -22.07472], [29.24648, -22.05967], [29.3533, -22.18363], [29.37703, -22.19581], [29.64609, -22.12917], [29.76848, -22.14128], [29.92242, -22.19408], [30.13147, -22.30841], [30.2265, -22.2961], [30.28351, -22.35587], [30.38614, -22.34533], [30.48686, -22.31368], [30.6294, -22.32599], [30.86696, -22.28907], [31.08932, -22.34884], [31.16344, -22.32599], [31.30611, -22.422], [31.38336, -22.36919], [32.41234, -21.31246], [32.48236, -21.32873], [32.37115, -21.133], [32.51644, -20.91929], [32.48122, -20.63319], [32.55167, -20.56312], [32.66174, -20.56106], [32.85987, -20.27841], [32.85987, -20.16686], [32.93032, -20.03868], [33.01178, -20.02007], [33.06461, -19.77787], [32.95013, -19.67219], [32.84666, -19.68462], [32.84446, -19.48343], [32.78282, -19.47513], [32.77966, -19.36098], [32.85107, -19.29238], [32.87088, -19.09279], [32.84006, -19.0262], [32.72118, -19.02204], [32.69917, -18.94293], [32.73439, -18.92628], [32.70137, -18.84712], [32.82465, -18.77419], [32.9017, -18.7992], [32.95013, -18.69079], [32.88629, -18.58023], [32.88629, -18.51344], [33.02278, -18.4696], [33.03159, -18.35054], [32.94133, -17.99705], [33.0492, -17.60298], [32.98536, -17.55891], [32.96554, -17.48964], [33.0426, -17.3468], [33.00517, -17.30477], [32.96554, -17.11971], [32.84113, -16.92259], [32.91051, -16.89446], [32.97655, -16.70689], [32.78943, -16.70267], [32.69917, -16.66893], [32.71017, -16.59932], [32.42838, -16.4727], [32.28529, -16.43892], [32.02772, -16.43892], [31.91324, -16.41569], [31.90223, -16.34388], [31.67988, -16.19595], [31.42451, -16.15154], [31.30563, -16.01193], [31.13171, -15.98019], [30.97761, -16.05848], [30.91597, -15.99924], [30.42568, -15.9962], [30.41902, -15.62269]]]] } }
20765   ] };
20766   var borders = borders_default;
20767   var _whichPolygon = {};
20768   var _featuresByCode = {};
20769   var idFilterRegex = /(?=(?!^(and|the|of|el|la|de)$))(\b(and|the|of|el|la|de)\b)|[-_ .,'()&[\]/]/gi;
20770   function canonicalID(id2) {
20771     const s2 = id2 || "";
20772     if (s2.charAt(0) === ".") {
20773       return s2.toUpperCase();
20774     } else {
20775       return s2.replace(idFilterRegex, "").toUpperCase();
20776     }
20777   }
20778   var levels = [
20779     "subterritory",
20780     "territory",
20781     "subcountryGroup",
20782     "country",
20783     "sharedLandform",
20784     "intermediateRegion",
20785     "subregion",
20786     "region",
20787     "subunion",
20788     "union",
20789     "unitedNations",
20790     "world"
20791   ];
20792   loadDerivedDataAndCaches(borders);
20793   function loadDerivedDataAndCaches(borders2) {
20794     const identifierProps = ["iso1A2", "iso1A3", "m49", "wikidata", "emojiFlag", "ccTLD", "nameEn"];
20795     let geometryFeatures = [];
20796     for (const feature22 of borders2.features) {
20797       const props = feature22.properties;
20798       props.id = props.iso1A2 || props.m49 || props.wikidata;
20799       loadM49(feature22);
20800       loadTLD(feature22);
20801       loadIsoStatus(feature22);
20802       loadLevel(feature22);
20803       loadGroups(feature22);
20804       loadFlag(feature22);
20805       cacheFeatureByIDs(feature22);
20806       if (feature22.geometry) {
20807         geometryFeatures.push(feature22);
20808       }
20809     }
20810     for (const feature22 of borders2.features) {
20811       feature22.properties.groups = feature22.properties.groups.map((groupID) => {
20812         return _featuresByCode[groupID].properties.id;
20813       });
20814       loadMembersForGroupsOf(feature22);
20815     }
20816     for (const feature22 of borders2.features) {
20817       loadRoadSpeedUnit(feature22);
20818       loadRoadHeightUnit(feature22);
20819       loadDriveSide(feature22);
20820       loadCallingCodes(feature22);
20821       loadGroupGroups(feature22);
20822     }
20823     for (const feature22 of borders2.features) {
20824       feature22.properties.groups.sort((groupID1, groupID2) => {
20825         return levels.indexOf(_featuresByCode[groupID1].properties.level) - levels.indexOf(_featuresByCode[groupID2].properties.level);
20826       });
20827       if (feature22.properties.members) {
20828         feature22.properties.members.sort((id1, id2) => {
20829           const diff = levels.indexOf(_featuresByCode[id1].properties.level) - levels.indexOf(_featuresByCode[id2].properties.level);
20830           if (diff === 0) {
20831             return borders2.features.indexOf(_featuresByCode[id1]) - borders2.features.indexOf(_featuresByCode[id2]);
20832           }
20833           return diff;
20834         });
20835       }
20836     }
20837     const geometryOnlyCollection = {
20838       type: "FeatureCollection",
20839       features: geometryFeatures
20840     };
20841     _whichPolygon = (0, import_which_polygon.default)(geometryOnlyCollection);
20842     function loadGroups(feature22) {
20843       const props = feature22.properties;
20844       if (!props.groups) {
20845         props.groups = [];
20846       }
20847       if (feature22.geometry && props.country) {
20848         props.groups.push(props.country);
20849       }
20850       if (props.m49 !== "001") {
20851         props.groups.push("001");
20852       }
20853     }
20854     function loadM49(feature22) {
20855       const props = feature22.properties;
20856       if (!props.m49 && props.iso1N3) {
20857         props.m49 = props.iso1N3;
20858       }
20859     }
20860     function loadTLD(feature22) {
20861       const props = feature22.properties;
20862       if (props.level === "unitedNations") return;
20863       if (props.ccTLD === null) return;
20864       if (!props.ccTLD && props.iso1A2) {
20865         props.ccTLD = "." + props.iso1A2.toLowerCase();
20866       }
20867     }
20868     function loadIsoStatus(feature22) {
20869       const props = feature22.properties;
20870       if (!props.isoStatus && props.iso1A2) {
20871         props.isoStatus = "official";
20872       }
20873     }
20874     function loadLevel(feature22) {
20875       const props = feature22.properties;
20876       if (props.level) return;
20877       if (!props.country) {
20878         props.level = "country";
20879       } else if (!props.iso1A2 || props.isoStatus === "official") {
20880         props.level = "territory";
20881       } else {
20882         props.level = "subterritory";
20883       }
20884     }
20885     function loadGroupGroups(feature22) {
20886       const props = feature22.properties;
20887       if (feature22.geometry || !props.members) return;
20888       const featureLevelIndex = levels.indexOf(props.level);
20889       let sharedGroups = [];
20890       props.members.forEach((memberID, index) => {
20891         const member = _featuresByCode[memberID];
20892         const memberGroups = member.properties.groups.filter((groupID) => {
20893           return groupID !== feature22.properties.id && featureLevelIndex < levels.indexOf(_featuresByCode[groupID].properties.level);
20894         });
20895         if (index === 0) {
20896           sharedGroups = memberGroups;
20897         } else {
20898           sharedGroups = sharedGroups.filter((groupID) => memberGroups.indexOf(groupID) !== -1);
20899         }
20900       });
20901       props.groups = props.groups.concat(
20902         sharedGroups.filter((groupID) => props.groups.indexOf(groupID) === -1)
20903       );
20904       for (const groupID of sharedGroups) {
20905         const groupFeature = _featuresByCode[groupID];
20906         if (groupFeature.properties.members.indexOf(props.id) === -1) {
20907           groupFeature.properties.members.push(props.id);
20908         }
20909       }
20910     }
20911     function loadRoadSpeedUnit(feature22) {
20912       const props = feature22.properties;
20913       if (feature22.geometry) {
20914         if (!props.roadSpeedUnit) props.roadSpeedUnit = "km/h";
20915       } else if (props.members) {
20916         const vals = Array.from(
20917           new Set(
20918             props.members.map((id2) => {
20919               const member = _featuresByCode[id2];
20920               if (member.geometry) return member.properties.roadSpeedUnit || "km/h";
20921             }).filter(Boolean)
20922           )
20923         );
20924         if (vals.length === 1) props.roadSpeedUnit = vals[0];
20925       }
20926     }
20927     function loadRoadHeightUnit(feature22) {
20928       const props = feature22.properties;
20929       if (feature22.geometry) {
20930         if (!props.roadHeightUnit) props.roadHeightUnit = "m";
20931       } else if (props.members) {
20932         const vals = Array.from(
20933           new Set(
20934             props.members.map((id2) => {
20935               const member = _featuresByCode[id2];
20936               if (member.geometry) return member.properties.roadHeightUnit || "m";
20937             }).filter(Boolean)
20938           )
20939         );
20940         if (vals.length === 1) props.roadHeightUnit = vals[0];
20941       }
20942     }
20943     function loadDriveSide(feature22) {
20944       const props = feature22.properties;
20945       if (feature22.geometry) {
20946         if (!props.driveSide) props.driveSide = "right";
20947       } else if (props.members) {
20948         const vals = Array.from(
20949           new Set(
20950             props.members.map((id2) => {
20951               const member = _featuresByCode[id2];
20952               if (member.geometry) return member.properties.driveSide || "right";
20953             }).filter(Boolean)
20954           )
20955         );
20956         if (vals.length === 1) props.driveSide = vals[0];
20957       }
20958     }
20959     function loadCallingCodes(feature22) {
20960       const props = feature22.properties;
20961       if (!feature22.geometry && props.members) {
20962         props.callingCodes = Array.from(
20963           new Set(
20964             props.members.reduce((array2, id2) => {
20965               const member = _featuresByCode[id2];
20966               if (member.geometry && member.properties.callingCodes) {
20967                 return array2.concat(member.properties.callingCodes);
20968               }
20969               return array2;
20970             }, [])
20971           )
20972         );
20973       }
20974     }
20975     function loadFlag(feature22) {
20976       if (!feature22.properties.iso1A2) return;
20977       const flag = feature22.properties.iso1A2.replace(/./g, function(char) {
20978         return String.fromCodePoint(char.charCodeAt(0) + 127397);
20979       });
20980       feature22.properties.emojiFlag = flag;
20981     }
20982     function loadMembersForGroupsOf(feature22) {
20983       for (const groupID of feature22.properties.groups) {
20984         const groupFeature = _featuresByCode[groupID];
20985         if (!groupFeature.properties.members) {
20986           groupFeature.properties.members = [];
20987         }
20988         groupFeature.properties.members.push(feature22.properties.id);
20989       }
20990     }
20991     function cacheFeatureByIDs(feature22) {
20992       let ids = [];
20993       for (const prop of identifierProps) {
20994         const id2 = feature22.properties[prop];
20995         if (id2) {
20996           ids.push(id2);
20997         }
20998       }
20999       for (const alias of feature22.properties.aliases || []) {
21000         ids.push(alias);
21001       }
21002       for (const id2 of ids) {
21003         const cid = canonicalID(id2);
21004         _featuresByCode[cid] = feature22;
21005       }
21006     }
21007   }
21008   function locArray(loc) {
21009     if (Array.isArray(loc)) {
21010       return loc;
21011     } else if (loc.coordinates) {
21012       return loc.coordinates;
21013     }
21014     return loc.geometry.coordinates;
21015   }
21016   function smallestFeature(loc) {
21017     const query = locArray(loc);
21018     const featureProperties = _whichPolygon(query);
21019     if (!featureProperties) return null;
21020     return _featuresByCode[featureProperties.id];
21021   }
21022   function countryFeature(loc) {
21023     const feature22 = smallestFeature(loc);
21024     if (!feature22) return null;
21025     const countryCode = feature22.properties.country || feature22.properties.iso1A2;
21026     return _featuresByCode[countryCode] || null;
21027   }
21028   var defaultOpts = {
21029     level: void 0,
21030     maxLevel: void 0,
21031     withProp: void 0
21032   };
21033   function featureForLoc(loc, opts) {
21034     const targetLevel = opts.level || "country";
21035     const maxLevel = opts.maxLevel || "world";
21036     const withProp = opts.withProp;
21037     const targetLevelIndex = levels.indexOf(targetLevel);
21038     if (targetLevelIndex === -1) return null;
21039     const maxLevelIndex = levels.indexOf(maxLevel);
21040     if (maxLevelIndex === -1) return null;
21041     if (maxLevelIndex < targetLevelIndex) return null;
21042     if (targetLevel === "country") {
21043       const fastFeature = countryFeature(loc);
21044       if (fastFeature) {
21045         if (!withProp || fastFeature.properties[withProp]) {
21046           return fastFeature;
21047         }
21048       }
21049     }
21050     const features = featuresContaining(loc);
21051     const match = features.find((feature22) => {
21052       let levelIndex = levels.indexOf(feature22.properties.level);
21053       if (feature22.properties.level === targetLevel || // if no feature exists at the target level, return the first feature at the next level up
21054       levelIndex > targetLevelIndex && levelIndex <= maxLevelIndex) {
21055         if (!withProp || feature22.properties[withProp]) {
21056           return feature22;
21057         }
21058       }
21059       return false;
21060     });
21061     return match || null;
21062   }
21063   function featureForID(id2) {
21064     let stringID;
21065     if (typeof id2 === "number") {
21066       stringID = id2.toString();
21067       if (stringID.length === 1) {
21068         stringID = "00" + stringID;
21069       } else if (stringID.length === 2) {
21070         stringID = "0" + stringID;
21071       }
21072     } else {
21073       stringID = canonicalID(id2);
21074     }
21075     return _featuresByCode[stringID] || null;
21076   }
21077   function smallestFeaturesForBbox(bbox2) {
21078     return _whichPolygon.bbox(bbox2).map((props) => _featuresByCode[props.id]);
21079   }
21080   function smallestOrMatchingFeature(query) {
21081     if (typeof query === "object") {
21082       return smallestFeature(query);
21083     }
21084     return featureForID(query);
21085   }
21086   function feature(query, opts = defaultOpts) {
21087     if (typeof query === "object") {
21088       return featureForLoc(query, opts);
21089     }
21090     return featureForID(query);
21091   }
21092   function iso1A2Code(query, opts = defaultOpts) {
21093     opts.withProp = "iso1A2";
21094     const match = feature(query, opts);
21095     if (!match) return null;
21096     return match.properties.iso1A2 || null;
21097   }
21098   function propertiesForQuery(query, property) {
21099     const features = featuresContaining(query, false);
21100     return features.map((feature22) => feature22.properties[property]).filter(Boolean);
21101   }
21102   function iso1A2Codes(query) {
21103     return propertiesForQuery(query, "iso1A2");
21104   }
21105   function featuresContaining(query, strict) {
21106     let matchingFeatures;
21107     if (Array.isArray(query) && query.length === 4) {
21108       matchingFeatures = smallestFeaturesForBbox(query);
21109     } else {
21110       const smallestOrMatching = smallestOrMatchingFeature(query);
21111       matchingFeatures = smallestOrMatching ? [smallestOrMatching] : [];
21112     }
21113     if (!matchingFeatures.length) return [];
21114     let returnFeatures;
21115     if (!strict || typeof query === "object") {
21116       returnFeatures = matchingFeatures.slice();
21117     } else {
21118       returnFeatures = [];
21119     }
21120     for (const feature22 of matchingFeatures) {
21121       const properties = feature22.properties;
21122       for (const groupID of properties.groups) {
21123         const groupFeature = _featuresByCode[groupID];
21124         if (returnFeatures.indexOf(groupFeature) === -1) {
21125           returnFeatures.push(groupFeature);
21126         }
21127       }
21128     }
21129     return returnFeatures;
21130   }
21131   function featuresIn(id2, strict) {
21132     const feature22 = featureForID(id2);
21133     if (!feature22) return [];
21134     let features = [];
21135     if (!strict) {
21136       features.push(feature22);
21137     }
21138     const properties = feature22.properties;
21139     for (const memberID of properties.members || []) {
21140       features.push(_featuresByCode[memberID]);
21141     }
21142     return features;
21143   }
21144   function aggregateFeature(id2) {
21145     var _a3;
21146     const features = featuresIn(id2, false);
21147     if (features.length === 0) return null;
21148     let aggregateCoordinates = [];
21149     for (const feature22 of features) {
21150       if (((_a3 = feature22.geometry) == null ? void 0 : _a3.type) === "MultiPolygon" && feature22.geometry.coordinates) {
21151         aggregateCoordinates = aggregateCoordinates.concat(feature22.geometry.coordinates);
21152       }
21153     }
21154     return {
21155       type: "Feature",
21156       properties: features[0].properties,
21157       geometry: {
21158         type: "MultiPolygon",
21159         coordinates: aggregateCoordinates
21160       }
21161     };
21162   }
21163   function roadSpeedUnit(query) {
21164     const feature22 = smallestOrMatchingFeature(query);
21165     return feature22 && feature22.properties.roadSpeedUnit || null;
21166   }
21167   function roadHeightUnit(query) {
21168     const feature22 = smallestOrMatchingFeature(query);
21169     return feature22 && feature22.properties.roadHeightUnit || null;
21170   }
21171
21172   // node_modules/polyclip-ts/dist/constant.js
21173   var constant_default5 = (x2) => {
21174     return () => {
21175       return x2;
21176     };
21177   };
21178
21179   // node_modules/polyclip-ts/dist/compare.js
21180   var compare_default = (eps) => {
21181     const almostEqual = eps ? (a2, b2) => b2.minus(a2).abs().isLessThanOrEqualTo(eps) : constant_default5(false);
21182     return (a2, b2) => {
21183       if (almostEqual(a2, b2))
21184         return 0;
21185       return a2.comparedTo(b2);
21186     };
21187   };
21188
21189   // node_modules/polyclip-ts/dist/orient.js
21190   function orient_default(eps) {
21191     const almostCollinear = eps ? (area2, ax, ay, cx, cy) => area2.exponentiatedBy(2).isLessThanOrEqualTo(cx.minus(ax).exponentiatedBy(2).plus(cy.minus(ay).exponentiatedBy(2)).times(eps)) : constant_default5(false);
21192     return (a2, b2, c2) => {
21193       const ax = a2.x, ay = a2.y, cx = c2.x, cy = c2.y;
21194       const area2 = ay.minus(cy).times(b2.x.minus(cx)).minus(ax.minus(cx).times(b2.y.minus(cy)));
21195       if (almostCollinear(area2, ax, ay, cx, cy))
21196         return 0;
21197       return area2.comparedTo(0);
21198     };
21199   }
21200
21201   // node_modules/bignumber.js/bignumber.mjs
21202   var isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i;
21203   var mathceil = Math.ceil;
21204   var mathfloor = Math.floor;
21205   var bignumberError = "[BigNumber Error] ";
21206   var tooManyDigits = bignumberError + "Number primitive has more than 15 significant digits: ";
21207   var BASE = 1e14;
21208   var LOG_BASE = 14;
21209   var MAX_SAFE_INTEGER = 9007199254740991;
21210   var POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13];
21211   var SQRT_BASE = 1e7;
21212   var MAX = 1e9;
21213   function clone(configObject) {
21214     var div, convertBase, parseNumeric2, P2 = BigNumber2.prototype = { constructor: BigNumber2, toString: null, valueOf: null }, ONE = new BigNumber2(1), DECIMAL_PLACES = 20, ROUNDING_MODE = 4, TO_EXP_NEG = -7, TO_EXP_POS = 21, MIN_EXP = -1e7, MAX_EXP = 1e7, CRYPTO = false, MODULO_MODE = 1, POW_PRECISION = 0, FORMAT = {
21215       prefix: "",
21216       groupSize: 3,
21217       secondaryGroupSize: 0,
21218       groupSeparator: ",",
21219       decimalSeparator: ".",
21220       fractionGroupSize: 0,
21221       fractionGroupSeparator: "\xA0",
21222       // non-breaking space
21223       suffix: ""
21224     }, ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz", alphabetHasNormalDecimalDigits = true;
21225     function BigNumber2(v2, b2) {
21226       var alphabet, c2, caseChanged, e3, i3, isNum, len, str, x2 = this;
21227       if (!(x2 instanceof BigNumber2)) return new BigNumber2(v2, b2);
21228       if (b2 == null) {
21229         if (v2 && v2._isBigNumber === true) {
21230           x2.s = v2.s;
21231           if (!v2.c || v2.e > MAX_EXP) {
21232             x2.c = x2.e = null;
21233           } else if (v2.e < MIN_EXP) {
21234             x2.c = [x2.e = 0];
21235           } else {
21236             x2.e = v2.e;
21237             x2.c = v2.c.slice();
21238           }
21239           return;
21240         }
21241         if ((isNum = typeof v2 == "number") && v2 * 0 == 0) {
21242           x2.s = 1 / v2 < 0 ? (v2 = -v2, -1) : 1;
21243           if (v2 === ~~v2) {
21244             for (e3 = 0, i3 = v2; i3 >= 10; i3 /= 10, e3++) ;
21245             if (e3 > MAX_EXP) {
21246               x2.c = x2.e = null;
21247             } else {
21248               x2.e = e3;
21249               x2.c = [v2];
21250             }
21251             return;
21252           }
21253           str = String(v2);
21254         } else {
21255           if (!isNumeric.test(str = String(v2))) return parseNumeric2(x2, str, isNum);
21256           x2.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;
21257         }
21258         if ((e3 = str.indexOf(".")) > -1) str = str.replace(".", "");
21259         if ((i3 = str.search(/e/i)) > 0) {
21260           if (e3 < 0) e3 = i3;
21261           e3 += +str.slice(i3 + 1);
21262           str = str.substring(0, i3);
21263         } else if (e3 < 0) {
21264           e3 = str.length;
21265         }
21266       } else {
21267         intCheck(b2, 2, ALPHABET.length, "Base");
21268         if (b2 == 10 && alphabetHasNormalDecimalDigits) {
21269           x2 = new BigNumber2(v2);
21270           return round(x2, DECIMAL_PLACES + x2.e + 1, ROUNDING_MODE);
21271         }
21272         str = String(v2);
21273         if (isNum = typeof v2 == "number") {
21274           if (v2 * 0 != 0) return parseNumeric2(x2, str, isNum, b2);
21275           x2.s = 1 / v2 < 0 ? (str = str.slice(1), -1) : 1;
21276           if (BigNumber2.DEBUG && str.replace(/^0\.0*|\./, "").length > 15) {
21277             throw Error(tooManyDigits + v2);
21278           }
21279         } else {
21280           x2.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;
21281         }
21282         alphabet = ALPHABET.slice(0, b2);
21283         e3 = i3 = 0;
21284         for (len = str.length; i3 < len; i3++) {
21285           if (alphabet.indexOf(c2 = str.charAt(i3)) < 0) {
21286             if (c2 == ".") {
21287               if (i3 > e3) {
21288                 e3 = len;
21289                 continue;
21290               }
21291             } else if (!caseChanged) {
21292               if (str == str.toUpperCase() && (str = str.toLowerCase()) || str == str.toLowerCase() && (str = str.toUpperCase())) {
21293                 caseChanged = true;
21294                 i3 = -1;
21295                 e3 = 0;
21296                 continue;
21297               }
21298             }
21299             return parseNumeric2(x2, String(v2), isNum, b2);
21300           }
21301         }
21302         isNum = false;
21303         str = convertBase(str, b2, 10, x2.s);
21304         if ((e3 = str.indexOf(".")) > -1) str = str.replace(".", "");
21305         else e3 = str.length;
21306       }
21307       for (i3 = 0; str.charCodeAt(i3) === 48; i3++) ;
21308       for (len = str.length; str.charCodeAt(--len) === 48; ) ;
21309       if (str = str.slice(i3, ++len)) {
21310         len -= i3;
21311         if (isNum && BigNumber2.DEBUG && len > 15 && (v2 > MAX_SAFE_INTEGER || v2 !== mathfloor(v2))) {
21312           throw Error(tooManyDigits + x2.s * v2);
21313         }
21314         if ((e3 = e3 - i3 - 1) > MAX_EXP) {
21315           x2.c = x2.e = null;
21316         } else if (e3 < MIN_EXP) {
21317           x2.c = [x2.e = 0];
21318         } else {
21319           x2.e = e3;
21320           x2.c = [];
21321           i3 = (e3 + 1) % LOG_BASE;
21322           if (e3 < 0) i3 += LOG_BASE;
21323           if (i3 < len) {
21324             if (i3) x2.c.push(+str.slice(0, i3));
21325             for (len -= LOG_BASE; i3 < len; ) {
21326               x2.c.push(+str.slice(i3, i3 += LOG_BASE));
21327             }
21328             i3 = LOG_BASE - (str = str.slice(i3)).length;
21329           } else {
21330             i3 -= len;
21331           }
21332           for (; i3--; str += "0") ;
21333           x2.c.push(+str);
21334         }
21335       } else {
21336         x2.c = [x2.e = 0];
21337       }
21338     }
21339     BigNumber2.clone = clone;
21340     BigNumber2.ROUND_UP = 0;
21341     BigNumber2.ROUND_DOWN = 1;
21342     BigNumber2.ROUND_CEIL = 2;
21343     BigNumber2.ROUND_FLOOR = 3;
21344     BigNumber2.ROUND_HALF_UP = 4;
21345     BigNumber2.ROUND_HALF_DOWN = 5;
21346     BigNumber2.ROUND_HALF_EVEN = 6;
21347     BigNumber2.ROUND_HALF_CEIL = 7;
21348     BigNumber2.ROUND_HALF_FLOOR = 8;
21349     BigNumber2.EUCLID = 9;
21350     BigNumber2.config = BigNumber2.set = function(obj) {
21351       var p2, v2;
21352       if (obj != null) {
21353         if (typeof obj == "object") {
21354           if (obj.hasOwnProperty(p2 = "DECIMAL_PLACES")) {
21355             v2 = obj[p2];
21356             intCheck(v2, 0, MAX, p2);
21357             DECIMAL_PLACES = v2;
21358           }
21359           if (obj.hasOwnProperty(p2 = "ROUNDING_MODE")) {
21360             v2 = obj[p2];
21361             intCheck(v2, 0, 8, p2);
21362             ROUNDING_MODE = v2;
21363           }
21364           if (obj.hasOwnProperty(p2 = "EXPONENTIAL_AT")) {
21365             v2 = obj[p2];
21366             if (v2 && v2.pop) {
21367               intCheck(v2[0], -MAX, 0, p2);
21368               intCheck(v2[1], 0, MAX, p2);
21369               TO_EXP_NEG = v2[0];
21370               TO_EXP_POS = v2[1];
21371             } else {
21372               intCheck(v2, -MAX, MAX, p2);
21373               TO_EXP_NEG = -(TO_EXP_POS = v2 < 0 ? -v2 : v2);
21374             }
21375           }
21376           if (obj.hasOwnProperty(p2 = "RANGE")) {
21377             v2 = obj[p2];
21378             if (v2 && v2.pop) {
21379               intCheck(v2[0], -MAX, -1, p2);
21380               intCheck(v2[1], 1, MAX, p2);
21381               MIN_EXP = v2[0];
21382               MAX_EXP = v2[1];
21383             } else {
21384               intCheck(v2, -MAX, MAX, p2);
21385               if (v2) {
21386                 MIN_EXP = -(MAX_EXP = v2 < 0 ? -v2 : v2);
21387               } else {
21388                 throw Error(bignumberError + p2 + " cannot be zero: " + v2);
21389               }
21390             }
21391           }
21392           if (obj.hasOwnProperty(p2 = "CRYPTO")) {
21393             v2 = obj[p2];
21394             if (v2 === !!v2) {
21395               if (v2) {
21396                 if (typeof crypto != "undefined" && crypto && (crypto.getRandomValues || crypto.randomBytes)) {
21397                   CRYPTO = v2;
21398                 } else {
21399                   CRYPTO = !v2;
21400                   throw Error(bignumberError + "crypto unavailable");
21401                 }
21402               } else {
21403                 CRYPTO = v2;
21404               }
21405             } else {
21406               throw Error(bignumberError + p2 + " not true or false: " + v2);
21407             }
21408           }
21409           if (obj.hasOwnProperty(p2 = "MODULO_MODE")) {
21410             v2 = obj[p2];
21411             intCheck(v2, 0, 9, p2);
21412             MODULO_MODE = v2;
21413           }
21414           if (obj.hasOwnProperty(p2 = "POW_PRECISION")) {
21415             v2 = obj[p2];
21416             intCheck(v2, 0, MAX, p2);
21417             POW_PRECISION = v2;
21418           }
21419           if (obj.hasOwnProperty(p2 = "FORMAT")) {
21420             v2 = obj[p2];
21421             if (typeof v2 == "object") FORMAT = v2;
21422             else throw Error(bignumberError + p2 + " not an object: " + v2);
21423           }
21424           if (obj.hasOwnProperty(p2 = "ALPHABET")) {
21425             v2 = obj[p2];
21426             if (typeof v2 == "string" && !/^.?$|[+\-.\s]|(.).*\1/.test(v2)) {
21427               alphabetHasNormalDecimalDigits = v2.slice(0, 10) == "0123456789";
21428               ALPHABET = v2;
21429             } else {
21430               throw Error(bignumberError + p2 + " invalid: " + v2);
21431             }
21432           }
21433         } else {
21434           throw Error(bignumberError + "Object expected: " + obj);
21435         }
21436       }
21437       return {
21438         DECIMAL_PLACES,
21439         ROUNDING_MODE,
21440         EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],
21441         RANGE: [MIN_EXP, MAX_EXP],
21442         CRYPTO,
21443         MODULO_MODE,
21444         POW_PRECISION,
21445         FORMAT,
21446         ALPHABET
21447       };
21448     };
21449     BigNumber2.isBigNumber = function(v2) {
21450       if (!v2 || v2._isBigNumber !== true) return false;
21451       if (!BigNumber2.DEBUG) return true;
21452       var i3, n3, c2 = v2.c, e3 = v2.e, s2 = v2.s;
21453       out: if ({}.toString.call(c2) == "[object Array]") {
21454         if ((s2 === 1 || s2 === -1) && e3 >= -MAX && e3 <= MAX && e3 === mathfloor(e3)) {
21455           if (c2[0] === 0) {
21456             if (e3 === 0 && c2.length === 1) return true;
21457             break out;
21458           }
21459           i3 = (e3 + 1) % LOG_BASE;
21460           if (i3 < 1) i3 += LOG_BASE;
21461           if (String(c2[0]).length == i3) {
21462             for (i3 = 0; i3 < c2.length; i3++) {
21463               n3 = c2[i3];
21464               if (n3 < 0 || n3 >= BASE || n3 !== mathfloor(n3)) break out;
21465             }
21466             if (n3 !== 0) return true;
21467           }
21468         }
21469       } else if (c2 === null && e3 === null && (s2 === null || s2 === 1 || s2 === -1)) {
21470         return true;
21471       }
21472       throw Error(bignumberError + "Invalid BigNumber: " + v2);
21473     };
21474     BigNumber2.maximum = BigNumber2.max = function() {
21475       return maxOrMin(arguments, -1);
21476     };
21477     BigNumber2.minimum = BigNumber2.min = function() {
21478       return maxOrMin(arguments, 1);
21479     };
21480     BigNumber2.random = function() {
21481       var pow2_53 = 9007199254740992;
21482       var random53bitInt = Math.random() * pow2_53 & 2097151 ? function() {
21483         return mathfloor(Math.random() * pow2_53);
21484       } : function() {
21485         return (Math.random() * 1073741824 | 0) * 8388608 + (Math.random() * 8388608 | 0);
21486       };
21487       return function(dp) {
21488         var a2, b2, e3, k2, v2, i3 = 0, c2 = [], rand = new BigNumber2(ONE);
21489         if (dp == null) dp = DECIMAL_PLACES;
21490         else intCheck(dp, 0, MAX);
21491         k2 = mathceil(dp / LOG_BASE);
21492         if (CRYPTO) {
21493           if (crypto.getRandomValues) {
21494             a2 = crypto.getRandomValues(new Uint32Array(k2 *= 2));
21495             for (; i3 < k2; ) {
21496               v2 = a2[i3] * 131072 + (a2[i3 + 1] >>> 11);
21497               if (v2 >= 9e15) {
21498                 b2 = crypto.getRandomValues(new Uint32Array(2));
21499                 a2[i3] = b2[0];
21500                 a2[i3 + 1] = b2[1];
21501               } else {
21502                 c2.push(v2 % 1e14);
21503                 i3 += 2;
21504               }
21505             }
21506             i3 = k2 / 2;
21507           } else if (crypto.randomBytes) {
21508             a2 = crypto.randomBytes(k2 *= 7);
21509             for (; i3 < k2; ) {
21510               v2 = (a2[i3] & 31) * 281474976710656 + a2[i3 + 1] * 1099511627776 + a2[i3 + 2] * 4294967296 + a2[i3 + 3] * 16777216 + (a2[i3 + 4] << 16) + (a2[i3 + 5] << 8) + a2[i3 + 6];
21511               if (v2 >= 9e15) {
21512                 crypto.randomBytes(7).copy(a2, i3);
21513               } else {
21514                 c2.push(v2 % 1e14);
21515                 i3 += 7;
21516               }
21517             }
21518             i3 = k2 / 7;
21519           } else {
21520             CRYPTO = false;
21521             throw Error(bignumberError + "crypto unavailable");
21522           }
21523         }
21524         if (!CRYPTO) {
21525           for (; i3 < k2; ) {
21526             v2 = random53bitInt();
21527             if (v2 < 9e15) c2[i3++] = v2 % 1e14;
21528           }
21529         }
21530         k2 = c2[--i3];
21531         dp %= LOG_BASE;
21532         if (k2 && dp) {
21533           v2 = POWS_TEN[LOG_BASE - dp];
21534           c2[i3] = mathfloor(k2 / v2) * v2;
21535         }
21536         for (; c2[i3] === 0; c2.pop(), i3--) ;
21537         if (i3 < 0) {
21538           c2 = [e3 = 0];
21539         } else {
21540           for (e3 = -1; c2[0] === 0; c2.splice(0, 1), e3 -= LOG_BASE) ;
21541           for (i3 = 1, v2 = c2[0]; v2 >= 10; v2 /= 10, i3++) ;
21542           if (i3 < LOG_BASE) e3 -= LOG_BASE - i3;
21543         }
21544         rand.e = e3;
21545         rand.c = c2;
21546         return rand;
21547       };
21548     }();
21549     BigNumber2.sum = function() {
21550       var i3 = 1, args = arguments, sum = new BigNumber2(args[0]);
21551       for (; i3 < args.length; ) sum = sum.plus(args[i3++]);
21552       return sum;
21553     };
21554     convertBase = /* @__PURE__ */ function() {
21555       var decimal = "0123456789";
21556       function toBaseOut(str, baseIn, baseOut, alphabet) {
21557         var j2, arr = [0], arrL, i3 = 0, len = str.length;
21558         for (; i3 < len; ) {
21559           for (arrL = arr.length; arrL--; arr[arrL] *= baseIn) ;
21560           arr[0] += alphabet.indexOf(str.charAt(i3++));
21561           for (j2 = 0; j2 < arr.length; j2++) {
21562             if (arr[j2] > baseOut - 1) {
21563               if (arr[j2 + 1] == null) arr[j2 + 1] = 0;
21564               arr[j2 + 1] += arr[j2] / baseOut | 0;
21565               arr[j2] %= baseOut;
21566             }
21567           }
21568         }
21569         return arr.reverse();
21570       }
21571       return function(str, baseIn, baseOut, sign2, callerIsToString) {
21572         var alphabet, d2, e3, k2, r2, x2, xc, y2, i3 = str.indexOf("."), dp = DECIMAL_PLACES, rm = ROUNDING_MODE;
21573         if (i3 >= 0) {
21574           k2 = POW_PRECISION;
21575           POW_PRECISION = 0;
21576           str = str.replace(".", "");
21577           y2 = new BigNumber2(baseIn);
21578           x2 = y2.pow(str.length - i3);
21579           POW_PRECISION = k2;
21580           y2.c = toBaseOut(
21581             toFixedPoint(coeffToString(x2.c), x2.e, "0"),
21582             10,
21583             baseOut,
21584             decimal
21585           );
21586           y2.e = y2.c.length;
21587         }
21588         xc = toBaseOut(str, baseIn, baseOut, callerIsToString ? (alphabet = ALPHABET, decimal) : (alphabet = decimal, ALPHABET));
21589         e3 = k2 = xc.length;
21590         for (; xc[--k2] == 0; xc.pop()) ;
21591         if (!xc[0]) return alphabet.charAt(0);
21592         if (i3 < 0) {
21593           --e3;
21594         } else {
21595           x2.c = xc;
21596           x2.e = e3;
21597           x2.s = sign2;
21598           x2 = div(x2, y2, dp, rm, baseOut);
21599           xc = x2.c;
21600           r2 = x2.r;
21601           e3 = x2.e;
21602         }
21603         d2 = e3 + dp + 1;
21604         i3 = xc[d2];
21605         k2 = baseOut / 2;
21606         r2 = r2 || d2 < 0 || xc[d2 + 1] != null;
21607         r2 = rm < 4 ? (i3 != null || r2) && (rm == 0 || rm == (x2.s < 0 ? 3 : 2)) : i3 > k2 || i3 == k2 && (rm == 4 || r2 || rm == 6 && xc[d2 - 1] & 1 || rm == (x2.s < 0 ? 8 : 7));
21608         if (d2 < 1 || !xc[0]) {
21609           str = r2 ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);
21610         } else {
21611           xc.length = d2;
21612           if (r2) {
21613             for (--baseOut; ++xc[--d2] > baseOut; ) {
21614               xc[d2] = 0;
21615               if (!d2) {
21616                 ++e3;
21617                 xc = [1].concat(xc);
21618               }
21619             }
21620           }
21621           for (k2 = xc.length; !xc[--k2]; ) ;
21622           for (i3 = 0, str = ""; i3 <= k2; str += alphabet.charAt(xc[i3++])) ;
21623           str = toFixedPoint(str, e3, alphabet.charAt(0));
21624         }
21625         return str;
21626       };
21627     }();
21628     div = /* @__PURE__ */ function() {
21629       function multiply(x2, k2, base) {
21630         var m2, temp, xlo, xhi, carry = 0, i3 = x2.length, klo = k2 % SQRT_BASE, khi = k2 / SQRT_BASE | 0;
21631         for (x2 = x2.slice(); i3--; ) {
21632           xlo = x2[i3] % SQRT_BASE;
21633           xhi = x2[i3] / SQRT_BASE | 0;
21634           m2 = khi * xlo + xhi * klo;
21635           temp = klo * xlo + m2 % SQRT_BASE * SQRT_BASE + carry;
21636           carry = (temp / base | 0) + (m2 / SQRT_BASE | 0) + khi * xhi;
21637           x2[i3] = temp % base;
21638         }
21639         if (carry) x2 = [carry].concat(x2);
21640         return x2;
21641       }
21642       function compare2(a2, b2, aL, bL) {
21643         var i3, cmp;
21644         if (aL != bL) {
21645           cmp = aL > bL ? 1 : -1;
21646         } else {
21647           for (i3 = cmp = 0; i3 < aL; i3++) {
21648             if (a2[i3] != b2[i3]) {
21649               cmp = a2[i3] > b2[i3] ? 1 : -1;
21650               break;
21651             }
21652           }
21653         }
21654         return cmp;
21655       }
21656       function subtract(a2, b2, aL, base) {
21657         var i3 = 0;
21658         for (; aL--; ) {
21659           a2[aL] -= i3;
21660           i3 = a2[aL] < b2[aL] ? 1 : 0;
21661           a2[aL] = i3 * base + a2[aL] - b2[aL];
21662         }
21663         for (; !a2[0] && a2.length > 1; a2.splice(0, 1)) ;
21664       }
21665       return function(x2, y2, dp, rm, base) {
21666         var cmp, e3, i3, more, n3, prod, prodL, q2, qc, rem, remL, rem0, xi, xL, yc0, yL, yz, s2 = x2.s == y2.s ? 1 : -1, xc = x2.c, yc = y2.c;
21667         if (!xc || !xc[0] || !yc || !yc[0]) {
21668           return new BigNumber2(
21669             // Return NaN if either NaN, or both Infinity or 0.
21670             !x2.s || !y2.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN : (
21671               // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
21672               xc && xc[0] == 0 || !yc ? s2 * 0 : s2 / 0
21673             )
21674           );
21675         }
21676         q2 = new BigNumber2(s2);
21677         qc = q2.c = [];
21678         e3 = x2.e - y2.e;
21679         s2 = dp + e3 + 1;
21680         if (!base) {
21681           base = BASE;
21682           e3 = bitFloor(x2.e / LOG_BASE) - bitFloor(y2.e / LOG_BASE);
21683           s2 = s2 / LOG_BASE | 0;
21684         }
21685         for (i3 = 0; yc[i3] == (xc[i3] || 0); i3++) ;
21686         if (yc[i3] > (xc[i3] || 0)) e3--;
21687         if (s2 < 0) {
21688           qc.push(1);
21689           more = true;
21690         } else {
21691           xL = xc.length;
21692           yL = yc.length;
21693           i3 = 0;
21694           s2 += 2;
21695           n3 = mathfloor(base / (yc[0] + 1));
21696           if (n3 > 1) {
21697             yc = multiply(yc, n3, base);
21698             xc = multiply(xc, n3, base);
21699             yL = yc.length;
21700             xL = xc.length;
21701           }
21702           xi = yL;
21703           rem = xc.slice(0, yL);
21704           remL = rem.length;
21705           for (; remL < yL; rem[remL++] = 0) ;
21706           yz = yc.slice();
21707           yz = [0].concat(yz);
21708           yc0 = yc[0];
21709           if (yc[1] >= base / 2) yc0++;
21710           do {
21711             n3 = 0;
21712             cmp = compare2(yc, rem, yL, remL);
21713             if (cmp < 0) {
21714               rem0 = rem[0];
21715               if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
21716               n3 = mathfloor(rem0 / yc0);
21717               if (n3 > 1) {
21718                 if (n3 >= base) n3 = base - 1;
21719                 prod = multiply(yc, n3, base);
21720                 prodL = prod.length;
21721                 remL = rem.length;
21722                 while (compare2(prod, rem, prodL, remL) == 1) {
21723                   n3--;
21724                   subtract(prod, yL < prodL ? yz : yc, prodL, base);
21725                   prodL = prod.length;
21726                   cmp = 1;
21727                 }
21728               } else {
21729                 if (n3 == 0) {
21730                   cmp = n3 = 1;
21731                 }
21732                 prod = yc.slice();
21733                 prodL = prod.length;
21734               }
21735               if (prodL < remL) prod = [0].concat(prod);
21736               subtract(rem, prod, remL, base);
21737               remL = rem.length;
21738               if (cmp == -1) {
21739                 while (compare2(yc, rem, yL, remL) < 1) {
21740                   n3++;
21741                   subtract(rem, yL < remL ? yz : yc, remL, base);
21742                   remL = rem.length;
21743                 }
21744               }
21745             } else if (cmp === 0) {
21746               n3++;
21747               rem = [0];
21748             }
21749             qc[i3++] = n3;
21750             if (rem[0]) {
21751               rem[remL++] = xc[xi] || 0;
21752             } else {
21753               rem = [xc[xi]];
21754               remL = 1;
21755             }
21756           } while ((xi++ < xL || rem[0] != null) && s2--);
21757           more = rem[0] != null;
21758           if (!qc[0]) qc.splice(0, 1);
21759         }
21760         if (base == BASE) {
21761           for (i3 = 1, s2 = qc[0]; s2 >= 10; s2 /= 10, i3++) ;
21762           round(q2, dp + (q2.e = i3 + e3 * LOG_BASE - 1) + 1, rm, more);
21763         } else {
21764           q2.e = e3;
21765           q2.r = +more;
21766         }
21767         return q2;
21768       };
21769     }();
21770     function format2(n3, i3, rm, id2) {
21771       var c0, e3, ne2, len, str;
21772       if (rm == null) rm = ROUNDING_MODE;
21773       else intCheck(rm, 0, 8);
21774       if (!n3.c) return n3.toString();
21775       c0 = n3.c[0];
21776       ne2 = n3.e;
21777       if (i3 == null) {
21778         str = coeffToString(n3.c);
21779         str = id2 == 1 || id2 == 2 && (ne2 <= TO_EXP_NEG || ne2 >= TO_EXP_POS) ? toExponential(str, ne2) : toFixedPoint(str, ne2, "0");
21780       } else {
21781         n3 = round(new BigNumber2(n3), i3, rm);
21782         e3 = n3.e;
21783         str = coeffToString(n3.c);
21784         len = str.length;
21785         if (id2 == 1 || id2 == 2 && (i3 <= e3 || e3 <= TO_EXP_NEG)) {
21786           for (; len < i3; str += "0", len++) ;
21787           str = toExponential(str, e3);
21788         } else {
21789           i3 -= ne2;
21790           str = toFixedPoint(str, e3, "0");
21791           if (e3 + 1 > len) {
21792             if (--i3 > 0) for (str += "."; i3--; str += "0") ;
21793           } else {
21794             i3 += e3 - len;
21795             if (i3 > 0) {
21796               if (e3 + 1 == len) str += ".";
21797               for (; i3--; str += "0") ;
21798             }
21799           }
21800         }
21801       }
21802       return n3.s < 0 && c0 ? "-" + str : str;
21803     }
21804     function maxOrMin(args, n3) {
21805       var k2, y2, i3 = 1, x2 = new BigNumber2(args[0]);
21806       for (; i3 < args.length; i3++) {
21807         y2 = new BigNumber2(args[i3]);
21808         if (!y2.s || (k2 = compare(x2, y2)) === n3 || k2 === 0 && x2.s === n3) {
21809           x2 = y2;
21810         }
21811       }
21812       return x2;
21813     }
21814     function normalise(n3, c2, e3) {
21815       var i3 = 1, j2 = c2.length;
21816       for (; !c2[--j2]; c2.pop()) ;
21817       for (j2 = c2[0]; j2 >= 10; j2 /= 10, i3++) ;
21818       if ((e3 = i3 + e3 * LOG_BASE - 1) > MAX_EXP) {
21819         n3.c = n3.e = null;
21820       } else if (e3 < MIN_EXP) {
21821         n3.c = [n3.e = 0];
21822       } else {
21823         n3.e = e3;
21824         n3.c = c2;
21825       }
21826       return n3;
21827     }
21828     parseNumeric2 = /* @__PURE__ */ function() {
21829       var basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i, dotAfter = /^([^.]+)\.$/, dotBefore = /^\.([^.]+)$/, isInfinityOrNaN = /^-?(Infinity|NaN)$/, whitespaceOrPlus = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
21830       return function(x2, str, isNum, b2) {
21831         var base, s2 = isNum ? str : str.replace(whitespaceOrPlus, "");
21832         if (isInfinityOrNaN.test(s2)) {
21833           x2.s = isNaN(s2) ? null : s2 < 0 ? -1 : 1;
21834         } else {
21835           if (!isNum) {
21836             s2 = s2.replace(basePrefix, function(m2, p1, p2) {
21837               base = (p2 = p2.toLowerCase()) == "x" ? 16 : p2 == "b" ? 2 : 8;
21838               return !b2 || b2 == base ? p1 : m2;
21839             });
21840             if (b2) {
21841               base = b2;
21842               s2 = s2.replace(dotAfter, "$1").replace(dotBefore, "0.$1");
21843             }
21844             if (str != s2) return new BigNumber2(s2, base);
21845           }
21846           if (BigNumber2.DEBUG) {
21847             throw Error(bignumberError + "Not a" + (b2 ? " base " + b2 : "") + " number: " + str);
21848           }
21849           x2.s = null;
21850         }
21851         x2.c = x2.e = null;
21852       };
21853     }();
21854     function round(x2, sd, rm, r2) {
21855       var d2, i3, j2, k2, n3, ni, rd, xc = x2.c, pows10 = POWS_TEN;
21856       if (xc) {
21857         out: {
21858           for (d2 = 1, k2 = xc[0]; k2 >= 10; k2 /= 10, d2++) ;
21859           i3 = sd - d2;
21860           if (i3 < 0) {
21861             i3 += LOG_BASE;
21862             j2 = sd;
21863             n3 = xc[ni = 0];
21864             rd = mathfloor(n3 / pows10[d2 - j2 - 1] % 10);
21865           } else {
21866             ni = mathceil((i3 + 1) / LOG_BASE);
21867             if (ni >= xc.length) {
21868               if (r2) {
21869                 for (; xc.length <= ni; xc.push(0)) ;
21870                 n3 = rd = 0;
21871                 d2 = 1;
21872                 i3 %= LOG_BASE;
21873                 j2 = i3 - LOG_BASE + 1;
21874               } else {
21875                 break out;
21876               }
21877             } else {
21878               n3 = k2 = xc[ni];
21879               for (d2 = 1; k2 >= 10; k2 /= 10, d2++) ;
21880               i3 %= LOG_BASE;
21881               j2 = i3 - LOG_BASE + d2;
21882               rd = j2 < 0 ? 0 : mathfloor(n3 / pows10[d2 - j2 - 1] % 10);
21883             }
21884           }
21885           r2 = r2 || sd < 0 || // Are there any non-zero digits after the rounding digit?
21886           // The expression  n % pows10[d - j - 1]  returns all digits of n to the right
21887           // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.
21888           xc[ni + 1] != null || (j2 < 0 ? n3 : n3 % pows10[d2 - j2 - 1]);
21889           r2 = rm < 4 ? (rd || r2) && (rm == 0 || rm == (x2.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || r2 || rm == 6 && // Check whether the digit to the left of the rounding digit is odd.
21890           (i3 > 0 ? j2 > 0 ? n3 / pows10[d2 - j2] : 0 : xc[ni - 1]) % 10 & 1 || rm == (x2.s < 0 ? 8 : 7));
21891           if (sd < 1 || !xc[0]) {
21892             xc.length = 0;
21893             if (r2) {
21894               sd -= x2.e + 1;
21895               xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];
21896               x2.e = -sd || 0;
21897             } else {
21898               xc[0] = x2.e = 0;
21899             }
21900             return x2;
21901           }
21902           if (i3 == 0) {
21903             xc.length = ni;
21904             k2 = 1;
21905             ni--;
21906           } else {
21907             xc.length = ni + 1;
21908             k2 = pows10[LOG_BASE - i3];
21909             xc[ni] = j2 > 0 ? mathfloor(n3 / pows10[d2 - j2] % pows10[j2]) * k2 : 0;
21910           }
21911           if (r2) {
21912             for (; ; ) {
21913               if (ni == 0) {
21914                 for (i3 = 1, j2 = xc[0]; j2 >= 10; j2 /= 10, i3++) ;
21915                 j2 = xc[0] += k2;
21916                 for (k2 = 1; j2 >= 10; j2 /= 10, k2++) ;
21917                 if (i3 != k2) {
21918                   x2.e++;
21919                   if (xc[0] == BASE) xc[0] = 1;
21920                 }
21921                 break;
21922               } else {
21923                 xc[ni] += k2;
21924                 if (xc[ni] != BASE) break;
21925                 xc[ni--] = 0;
21926                 k2 = 1;
21927               }
21928             }
21929           }
21930           for (i3 = xc.length; xc[--i3] === 0; xc.pop()) ;
21931         }
21932         if (x2.e > MAX_EXP) {
21933           x2.c = x2.e = null;
21934         } else if (x2.e < MIN_EXP) {
21935           x2.c = [x2.e = 0];
21936         }
21937       }
21938       return x2;
21939     }
21940     function valueOf(n3) {
21941       var str, e3 = n3.e;
21942       if (e3 === null) return n3.toString();
21943       str = coeffToString(n3.c);
21944       str = e3 <= TO_EXP_NEG || e3 >= TO_EXP_POS ? toExponential(str, e3) : toFixedPoint(str, e3, "0");
21945       return n3.s < 0 ? "-" + str : str;
21946     }
21947     P2.absoluteValue = P2.abs = function() {
21948       var x2 = new BigNumber2(this);
21949       if (x2.s < 0) x2.s = 1;
21950       return x2;
21951     };
21952     P2.comparedTo = function(y2, b2) {
21953       return compare(this, new BigNumber2(y2, b2));
21954     };
21955     P2.decimalPlaces = P2.dp = function(dp, rm) {
21956       var c2, n3, v2, x2 = this;
21957       if (dp != null) {
21958         intCheck(dp, 0, MAX);
21959         if (rm == null) rm = ROUNDING_MODE;
21960         else intCheck(rm, 0, 8);
21961         return round(new BigNumber2(x2), dp + x2.e + 1, rm);
21962       }
21963       if (!(c2 = x2.c)) return null;
21964       n3 = ((v2 = c2.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;
21965       if (v2 = c2[v2]) for (; v2 % 10 == 0; v2 /= 10, n3--) ;
21966       if (n3 < 0) n3 = 0;
21967       return n3;
21968     };
21969     P2.dividedBy = P2.div = function(y2, b2) {
21970       return div(this, new BigNumber2(y2, b2), DECIMAL_PLACES, ROUNDING_MODE);
21971     };
21972     P2.dividedToIntegerBy = P2.idiv = function(y2, b2) {
21973       return div(this, new BigNumber2(y2, b2), 0, 1);
21974     };
21975     P2.exponentiatedBy = P2.pow = function(n3, m2) {
21976       var half, isModExp, i3, k2, more, nIsBig, nIsNeg, nIsOdd, y2, x2 = this;
21977       n3 = new BigNumber2(n3);
21978       if (n3.c && !n3.isInteger()) {
21979         throw Error(bignumberError + "Exponent not an integer: " + valueOf(n3));
21980       }
21981       if (m2 != null) m2 = new BigNumber2(m2);
21982       nIsBig = n3.e > 14;
21983       if (!x2.c || !x2.c[0] || x2.c[0] == 1 && !x2.e && x2.c.length == 1 || !n3.c || !n3.c[0]) {
21984         y2 = new BigNumber2(Math.pow(+valueOf(x2), nIsBig ? n3.s * (2 - isOdd(n3)) : +valueOf(n3)));
21985         return m2 ? y2.mod(m2) : y2;
21986       }
21987       nIsNeg = n3.s < 0;
21988       if (m2) {
21989         if (m2.c ? !m2.c[0] : !m2.s) return new BigNumber2(NaN);
21990         isModExp = !nIsNeg && x2.isInteger() && m2.isInteger();
21991         if (isModExp) x2 = x2.mod(m2);
21992       } else if (n3.e > 9 && (x2.e > 0 || x2.e < -1 || (x2.e == 0 ? x2.c[0] > 1 || nIsBig && x2.c[1] >= 24e7 : x2.c[0] < 8e13 || nIsBig && x2.c[0] <= 9999975e7))) {
21993         k2 = x2.s < 0 && isOdd(n3) ? -0 : 0;
21994         if (x2.e > -1) k2 = 1 / k2;
21995         return new BigNumber2(nIsNeg ? 1 / k2 : k2);
21996       } else if (POW_PRECISION) {
21997         k2 = mathceil(POW_PRECISION / LOG_BASE + 2);
21998       }
21999       if (nIsBig) {
22000         half = new BigNumber2(0.5);
22001         if (nIsNeg) n3.s = 1;
22002         nIsOdd = isOdd(n3);
22003       } else {
22004         i3 = Math.abs(+valueOf(n3));
22005         nIsOdd = i3 % 2;
22006       }
22007       y2 = new BigNumber2(ONE);
22008       for (; ; ) {
22009         if (nIsOdd) {
22010           y2 = y2.times(x2);
22011           if (!y2.c) break;
22012           if (k2) {
22013             if (y2.c.length > k2) y2.c.length = k2;
22014           } else if (isModExp) {
22015             y2 = y2.mod(m2);
22016           }
22017         }
22018         if (i3) {
22019           i3 = mathfloor(i3 / 2);
22020           if (i3 === 0) break;
22021           nIsOdd = i3 % 2;
22022         } else {
22023           n3 = n3.times(half);
22024           round(n3, n3.e + 1, 1);
22025           if (n3.e > 14) {
22026             nIsOdd = isOdd(n3);
22027           } else {
22028             i3 = +valueOf(n3);
22029             if (i3 === 0) break;
22030             nIsOdd = i3 % 2;
22031           }
22032         }
22033         x2 = x2.times(x2);
22034         if (k2) {
22035           if (x2.c && x2.c.length > k2) x2.c.length = k2;
22036         } else if (isModExp) {
22037           x2 = x2.mod(m2);
22038         }
22039       }
22040       if (isModExp) return y2;
22041       if (nIsNeg) y2 = ONE.div(y2);
22042       return m2 ? y2.mod(m2) : k2 ? round(y2, POW_PRECISION, ROUNDING_MODE, more) : y2;
22043     };
22044     P2.integerValue = function(rm) {
22045       var n3 = new BigNumber2(this);
22046       if (rm == null) rm = ROUNDING_MODE;
22047       else intCheck(rm, 0, 8);
22048       return round(n3, n3.e + 1, rm);
22049     };
22050     P2.isEqualTo = P2.eq = function(y2, b2) {
22051       return compare(this, new BigNumber2(y2, b2)) === 0;
22052     };
22053     P2.isFinite = function() {
22054       return !!this.c;
22055     };
22056     P2.isGreaterThan = P2.gt = function(y2, b2) {
22057       return compare(this, new BigNumber2(y2, b2)) > 0;
22058     };
22059     P2.isGreaterThanOrEqualTo = P2.gte = function(y2, b2) {
22060       return (b2 = compare(this, new BigNumber2(y2, b2))) === 1 || b2 === 0;
22061     };
22062     P2.isInteger = function() {
22063       return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;
22064     };
22065     P2.isLessThan = P2.lt = function(y2, b2) {
22066       return compare(this, new BigNumber2(y2, b2)) < 0;
22067     };
22068     P2.isLessThanOrEqualTo = P2.lte = function(y2, b2) {
22069       return (b2 = compare(this, new BigNumber2(y2, b2))) === -1 || b2 === 0;
22070     };
22071     P2.isNaN = function() {
22072       return !this.s;
22073     };
22074     P2.isNegative = function() {
22075       return this.s < 0;
22076     };
22077     P2.isPositive = function() {
22078       return this.s > 0;
22079     };
22080     P2.isZero = function() {
22081       return !!this.c && this.c[0] == 0;
22082     };
22083     P2.minus = function(y2, b2) {
22084       var i3, j2, t2, xLTy, x2 = this, a2 = x2.s;
22085       y2 = new BigNumber2(y2, b2);
22086       b2 = y2.s;
22087       if (!a2 || !b2) return new BigNumber2(NaN);
22088       if (a2 != b2) {
22089         y2.s = -b2;
22090         return x2.plus(y2);
22091       }
22092       var xe2 = x2.e / LOG_BASE, ye2 = y2.e / LOG_BASE, xc = x2.c, yc = y2.c;
22093       if (!xe2 || !ye2) {
22094         if (!xc || !yc) return xc ? (y2.s = -b2, y2) : new BigNumber2(yc ? x2 : NaN);
22095         if (!xc[0] || !yc[0]) {
22096           return yc[0] ? (y2.s = -b2, y2) : new BigNumber2(xc[0] ? x2 : (
22097             // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
22098             ROUNDING_MODE == 3 ? -0 : 0
22099           ));
22100         }
22101       }
22102       xe2 = bitFloor(xe2);
22103       ye2 = bitFloor(ye2);
22104       xc = xc.slice();
22105       if (a2 = xe2 - ye2) {
22106         if (xLTy = a2 < 0) {
22107           a2 = -a2;
22108           t2 = xc;
22109         } else {
22110           ye2 = xe2;
22111           t2 = yc;
22112         }
22113         t2.reverse();
22114         for (b2 = a2; b2--; t2.push(0)) ;
22115         t2.reverse();
22116       } else {
22117         j2 = (xLTy = (a2 = xc.length) < (b2 = yc.length)) ? a2 : b2;
22118         for (a2 = b2 = 0; b2 < j2; b2++) {
22119           if (xc[b2] != yc[b2]) {
22120             xLTy = xc[b2] < yc[b2];
22121             break;
22122           }
22123         }
22124       }
22125       if (xLTy) {
22126         t2 = xc;
22127         xc = yc;
22128         yc = t2;
22129         y2.s = -y2.s;
22130       }
22131       b2 = (j2 = yc.length) - (i3 = xc.length);
22132       if (b2 > 0) for (; b2--; xc[i3++] = 0) ;
22133       b2 = BASE - 1;
22134       for (; j2 > a2; ) {
22135         if (xc[--j2] < yc[j2]) {
22136           for (i3 = j2; i3 && !xc[--i3]; xc[i3] = b2) ;
22137           --xc[i3];
22138           xc[j2] += BASE;
22139         }
22140         xc[j2] -= yc[j2];
22141       }
22142       for (; xc[0] == 0; xc.splice(0, 1), --ye2) ;
22143       if (!xc[0]) {
22144         y2.s = ROUNDING_MODE == 3 ? -1 : 1;
22145         y2.c = [y2.e = 0];
22146         return y2;
22147       }
22148       return normalise(y2, xc, ye2);
22149     };
22150     P2.modulo = P2.mod = function(y2, b2) {
22151       var q2, s2, x2 = this;
22152       y2 = new BigNumber2(y2, b2);
22153       if (!x2.c || !y2.s || y2.c && !y2.c[0]) {
22154         return new BigNumber2(NaN);
22155       } else if (!y2.c || x2.c && !x2.c[0]) {
22156         return new BigNumber2(x2);
22157       }
22158       if (MODULO_MODE == 9) {
22159         s2 = y2.s;
22160         y2.s = 1;
22161         q2 = div(x2, y2, 0, 3);
22162         y2.s = s2;
22163         q2.s *= s2;
22164       } else {
22165         q2 = div(x2, y2, 0, MODULO_MODE);
22166       }
22167       y2 = x2.minus(q2.times(y2));
22168       if (!y2.c[0] && MODULO_MODE == 1) y2.s = x2.s;
22169       return y2;
22170     };
22171     P2.multipliedBy = P2.times = function(y2, b2) {
22172       var c2, e3, i3, j2, k2, m2, xcL, xlo, xhi, ycL, ylo, yhi, zc, base, sqrtBase, x2 = this, xc = x2.c, yc = (y2 = new BigNumber2(y2, b2)).c;
22173       if (!xc || !yc || !xc[0] || !yc[0]) {
22174         if (!x2.s || !y2.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {
22175           y2.c = y2.e = y2.s = null;
22176         } else {
22177           y2.s *= x2.s;
22178           if (!xc || !yc) {
22179             y2.c = y2.e = null;
22180           } else {
22181             y2.c = [0];
22182             y2.e = 0;
22183           }
22184         }
22185         return y2;
22186       }
22187       e3 = bitFloor(x2.e / LOG_BASE) + bitFloor(y2.e / LOG_BASE);
22188       y2.s *= x2.s;
22189       xcL = xc.length;
22190       ycL = yc.length;
22191       if (xcL < ycL) {
22192         zc = xc;
22193         xc = yc;
22194         yc = zc;
22195         i3 = xcL;
22196         xcL = ycL;
22197         ycL = i3;
22198       }
22199       for (i3 = xcL + ycL, zc = []; i3--; zc.push(0)) ;
22200       base = BASE;
22201       sqrtBase = SQRT_BASE;
22202       for (i3 = ycL; --i3 >= 0; ) {
22203         c2 = 0;
22204         ylo = yc[i3] % sqrtBase;
22205         yhi = yc[i3] / sqrtBase | 0;
22206         for (k2 = xcL, j2 = i3 + k2; j2 > i3; ) {
22207           xlo = xc[--k2] % sqrtBase;
22208           xhi = xc[k2] / sqrtBase | 0;
22209           m2 = yhi * xlo + xhi * ylo;
22210           xlo = ylo * xlo + m2 % sqrtBase * sqrtBase + zc[j2] + c2;
22211           c2 = (xlo / base | 0) + (m2 / sqrtBase | 0) + yhi * xhi;
22212           zc[j2--] = xlo % base;
22213         }
22214         zc[j2] = c2;
22215       }
22216       if (c2) {
22217         ++e3;
22218       } else {
22219         zc.splice(0, 1);
22220       }
22221       return normalise(y2, zc, e3);
22222     };
22223     P2.negated = function() {
22224       var x2 = new BigNumber2(this);
22225       x2.s = -x2.s || null;
22226       return x2;
22227     };
22228     P2.plus = function(y2, b2) {
22229       var t2, x2 = this, a2 = x2.s;
22230       y2 = new BigNumber2(y2, b2);
22231       b2 = y2.s;
22232       if (!a2 || !b2) return new BigNumber2(NaN);
22233       if (a2 != b2) {
22234         y2.s = -b2;
22235         return x2.minus(y2);
22236       }
22237       var xe2 = x2.e / LOG_BASE, ye2 = y2.e / LOG_BASE, xc = x2.c, yc = y2.c;
22238       if (!xe2 || !ye2) {
22239         if (!xc || !yc) return new BigNumber2(a2 / 0);
22240         if (!xc[0] || !yc[0]) return yc[0] ? y2 : new BigNumber2(xc[0] ? x2 : a2 * 0);
22241       }
22242       xe2 = bitFloor(xe2);
22243       ye2 = bitFloor(ye2);
22244       xc = xc.slice();
22245       if (a2 = xe2 - ye2) {
22246         if (a2 > 0) {
22247           ye2 = xe2;
22248           t2 = yc;
22249         } else {
22250           a2 = -a2;
22251           t2 = xc;
22252         }
22253         t2.reverse();
22254         for (; a2--; t2.push(0)) ;
22255         t2.reverse();
22256       }
22257       a2 = xc.length;
22258       b2 = yc.length;
22259       if (a2 - b2 < 0) {
22260         t2 = yc;
22261         yc = xc;
22262         xc = t2;
22263         b2 = a2;
22264       }
22265       for (a2 = 0; b2; ) {
22266         a2 = (xc[--b2] = xc[b2] + yc[b2] + a2) / BASE | 0;
22267         xc[b2] = BASE === xc[b2] ? 0 : xc[b2] % BASE;
22268       }
22269       if (a2) {
22270         xc = [a2].concat(xc);
22271         ++ye2;
22272       }
22273       return normalise(y2, xc, ye2);
22274     };
22275     P2.precision = P2.sd = function(sd, rm) {
22276       var c2, n3, v2, x2 = this;
22277       if (sd != null && sd !== !!sd) {
22278         intCheck(sd, 1, MAX);
22279         if (rm == null) rm = ROUNDING_MODE;
22280         else intCheck(rm, 0, 8);
22281         return round(new BigNumber2(x2), sd, rm);
22282       }
22283       if (!(c2 = x2.c)) return null;
22284       v2 = c2.length - 1;
22285       n3 = v2 * LOG_BASE + 1;
22286       if (v2 = c2[v2]) {
22287         for (; v2 % 10 == 0; v2 /= 10, n3--) ;
22288         for (v2 = c2[0]; v2 >= 10; v2 /= 10, n3++) ;
22289       }
22290       if (sd && x2.e + 1 > n3) n3 = x2.e + 1;
22291       return n3;
22292     };
22293     P2.shiftedBy = function(k2) {
22294       intCheck(k2, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);
22295       return this.times("1e" + k2);
22296     };
22297     P2.squareRoot = P2.sqrt = function() {
22298       var m2, n3, r2, rep, t2, x2 = this, c2 = x2.c, s2 = x2.s, e3 = x2.e, dp = DECIMAL_PLACES + 4, half = new BigNumber2("0.5");
22299       if (s2 !== 1 || !c2 || !c2[0]) {
22300         return new BigNumber2(!s2 || s2 < 0 && (!c2 || c2[0]) ? NaN : c2 ? x2 : 1 / 0);
22301       }
22302       s2 = Math.sqrt(+valueOf(x2));
22303       if (s2 == 0 || s2 == 1 / 0) {
22304         n3 = coeffToString(c2);
22305         if ((n3.length + e3) % 2 == 0) n3 += "0";
22306         s2 = Math.sqrt(+n3);
22307         e3 = bitFloor((e3 + 1) / 2) - (e3 < 0 || e3 % 2);
22308         if (s2 == 1 / 0) {
22309           n3 = "5e" + e3;
22310         } else {
22311           n3 = s2.toExponential();
22312           n3 = n3.slice(0, n3.indexOf("e") + 1) + e3;
22313         }
22314         r2 = new BigNumber2(n3);
22315       } else {
22316         r2 = new BigNumber2(s2 + "");
22317       }
22318       if (r2.c[0]) {
22319         e3 = r2.e;
22320         s2 = e3 + dp;
22321         if (s2 < 3) s2 = 0;
22322         for (; ; ) {
22323           t2 = r2;
22324           r2 = half.times(t2.plus(div(x2, t2, dp, 1)));
22325           if (coeffToString(t2.c).slice(0, s2) === (n3 = coeffToString(r2.c)).slice(0, s2)) {
22326             if (r2.e < e3) --s2;
22327             n3 = n3.slice(s2 - 3, s2 + 1);
22328             if (n3 == "9999" || !rep && n3 == "4999") {
22329               if (!rep) {
22330                 round(t2, t2.e + DECIMAL_PLACES + 2, 0);
22331                 if (t2.times(t2).eq(x2)) {
22332                   r2 = t2;
22333                   break;
22334                 }
22335               }
22336               dp += 4;
22337               s2 += 4;
22338               rep = 1;
22339             } else {
22340               if (!+n3 || !+n3.slice(1) && n3.charAt(0) == "5") {
22341                 round(r2, r2.e + DECIMAL_PLACES + 2, 1);
22342                 m2 = !r2.times(r2).eq(x2);
22343               }
22344               break;
22345             }
22346           }
22347         }
22348       }
22349       return round(r2, r2.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m2);
22350     };
22351     P2.toExponential = function(dp, rm) {
22352       if (dp != null) {
22353         intCheck(dp, 0, MAX);
22354         dp++;
22355       }
22356       return format2(this, dp, rm, 1);
22357     };
22358     P2.toFixed = function(dp, rm) {
22359       if (dp != null) {
22360         intCheck(dp, 0, MAX);
22361         dp = dp + this.e + 1;
22362       }
22363       return format2(this, dp, rm);
22364     };
22365     P2.toFormat = function(dp, rm, format3) {
22366       var str, x2 = this;
22367       if (format3 == null) {
22368         if (dp != null && rm && typeof rm == "object") {
22369           format3 = rm;
22370           rm = null;
22371         } else if (dp && typeof dp == "object") {
22372           format3 = dp;
22373           dp = rm = null;
22374         } else {
22375           format3 = FORMAT;
22376         }
22377       } else if (typeof format3 != "object") {
22378         throw Error(bignumberError + "Argument not an object: " + format3);
22379       }
22380       str = x2.toFixed(dp, rm);
22381       if (x2.c) {
22382         var i3, arr = str.split("."), g1 = +format3.groupSize, g22 = +format3.secondaryGroupSize, groupSeparator = format3.groupSeparator || "", intPart = arr[0], fractionPart = arr[1], isNeg = x2.s < 0, intDigits = isNeg ? intPart.slice(1) : intPart, len = intDigits.length;
22383         if (g22) {
22384           i3 = g1;
22385           g1 = g22;
22386           g22 = i3;
22387           len -= i3;
22388         }
22389         if (g1 > 0 && len > 0) {
22390           i3 = len % g1 || g1;
22391           intPart = intDigits.substr(0, i3);
22392           for (; i3 < len; i3 += g1) intPart += groupSeparator + intDigits.substr(i3, g1);
22393           if (g22 > 0) intPart += groupSeparator + intDigits.slice(i3);
22394           if (isNeg) intPart = "-" + intPart;
22395         }
22396         str = fractionPart ? intPart + (format3.decimalSeparator || "") + ((g22 = +format3.fractionGroupSize) ? fractionPart.replace(
22397           new RegExp("\\d{" + g22 + "}\\B", "g"),
22398           "$&" + (format3.fractionGroupSeparator || "")
22399         ) : fractionPart) : intPart;
22400       }
22401       return (format3.prefix || "") + str + (format3.suffix || "");
22402     };
22403     P2.toFraction = function(md) {
22404       var d2, d0, d1, d22, e3, exp2, n3, n0, n1, q2, r2, s2, x2 = this, xc = x2.c;
22405       if (md != null) {
22406         n3 = new BigNumber2(md);
22407         if (!n3.isInteger() && (n3.c || n3.s !== 1) || n3.lt(ONE)) {
22408           throw Error(bignumberError + "Argument " + (n3.isInteger() ? "out of range: " : "not an integer: ") + valueOf(n3));
22409         }
22410       }
22411       if (!xc) return new BigNumber2(x2);
22412       d2 = new BigNumber2(ONE);
22413       n1 = d0 = new BigNumber2(ONE);
22414       d1 = n0 = new BigNumber2(ONE);
22415       s2 = coeffToString(xc);
22416       e3 = d2.e = s2.length - x2.e - 1;
22417       d2.c[0] = POWS_TEN[(exp2 = e3 % LOG_BASE) < 0 ? LOG_BASE + exp2 : exp2];
22418       md = !md || n3.comparedTo(d2) > 0 ? e3 > 0 ? d2 : n1 : n3;
22419       exp2 = MAX_EXP;
22420       MAX_EXP = 1 / 0;
22421       n3 = new BigNumber2(s2);
22422       n0.c[0] = 0;
22423       for (; ; ) {
22424         q2 = div(n3, d2, 0, 1);
22425         d22 = d0.plus(q2.times(d1));
22426         if (d22.comparedTo(md) == 1) break;
22427         d0 = d1;
22428         d1 = d22;
22429         n1 = n0.plus(q2.times(d22 = n1));
22430         n0 = d22;
22431         d2 = n3.minus(q2.times(d22 = d2));
22432         n3 = d22;
22433       }
22434       d22 = div(md.minus(d0), d1, 0, 1);
22435       n0 = n0.plus(d22.times(n1));
22436       d0 = d0.plus(d22.times(d1));
22437       n0.s = n1.s = x2.s;
22438       e3 = e3 * 2;
22439       r2 = div(n1, d1, e3, ROUNDING_MODE).minus(x2).abs().comparedTo(
22440         div(n0, d0, e3, ROUNDING_MODE).minus(x2).abs()
22441       ) < 1 ? [n1, d1] : [n0, d0];
22442       MAX_EXP = exp2;
22443       return r2;
22444     };
22445     P2.toNumber = function() {
22446       return +valueOf(this);
22447     };
22448     P2.toPrecision = function(sd, rm) {
22449       if (sd != null) intCheck(sd, 1, MAX);
22450       return format2(this, sd, rm, 2);
22451     };
22452     P2.toString = function(b2) {
22453       var str, n3 = this, s2 = n3.s, e3 = n3.e;
22454       if (e3 === null) {
22455         if (s2) {
22456           str = "Infinity";
22457           if (s2 < 0) str = "-" + str;
22458         } else {
22459           str = "NaN";
22460         }
22461       } else {
22462         if (b2 == null) {
22463           str = e3 <= TO_EXP_NEG || e3 >= TO_EXP_POS ? toExponential(coeffToString(n3.c), e3) : toFixedPoint(coeffToString(n3.c), e3, "0");
22464         } else if (b2 === 10 && alphabetHasNormalDecimalDigits) {
22465           n3 = round(new BigNumber2(n3), DECIMAL_PLACES + e3 + 1, ROUNDING_MODE);
22466           str = toFixedPoint(coeffToString(n3.c), n3.e, "0");
22467         } else {
22468           intCheck(b2, 2, ALPHABET.length, "Base");
22469           str = convertBase(toFixedPoint(coeffToString(n3.c), e3, "0"), 10, b2, s2, true);
22470         }
22471         if (s2 < 0 && n3.c[0]) str = "-" + str;
22472       }
22473       return str;
22474     };
22475     P2.valueOf = P2.toJSON = function() {
22476       return valueOf(this);
22477     };
22478     P2._isBigNumber = true;
22479     P2[Symbol.toStringTag] = "BigNumber";
22480     P2[Symbol.for("nodejs.util.inspect.custom")] = P2.valueOf;
22481     if (configObject != null) BigNumber2.set(configObject);
22482     return BigNumber2;
22483   }
22484   function bitFloor(n3) {
22485     var i3 = n3 | 0;
22486     return n3 > 0 || n3 === i3 ? i3 : i3 - 1;
22487   }
22488   function coeffToString(a2) {
22489     var s2, z2, i3 = 1, j2 = a2.length, r2 = a2[0] + "";
22490     for (; i3 < j2; ) {
22491       s2 = a2[i3++] + "";
22492       z2 = LOG_BASE - s2.length;
22493       for (; z2--; s2 = "0" + s2) ;
22494       r2 += s2;
22495     }
22496     for (j2 = r2.length; r2.charCodeAt(--j2) === 48; ) ;
22497     return r2.slice(0, j2 + 1 || 1);
22498   }
22499   function compare(x2, y2) {
22500     var a2, b2, xc = x2.c, yc = y2.c, i3 = x2.s, j2 = y2.s, k2 = x2.e, l2 = y2.e;
22501     if (!i3 || !j2) return null;
22502     a2 = xc && !xc[0];
22503     b2 = yc && !yc[0];
22504     if (a2 || b2) return a2 ? b2 ? 0 : -j2 : i3;
22505     if (i3 != j2) return i3;
22506     a2 = i3 < 0;
22507     b2 = k2 == l2;
22508     if (!xc || !yc) return b2 ? 0 : !xc ^ a2 ? 1 : -1;
22509     if (!b2) return k2 > l2 ^ a2 ? 1 : -1;
22510     j2 = (k2 = xc.length) < (l2 = yc.length) ? k2 : l2;
22511     for (i3 = 0; i3 < j2; i3++) if (xc[i3] != yc[i3]) return xc[i3] > yc[i3] ^ a2 ? 1 : -1;
22512     return k2 == l2 ? 0 : k2 > l2 ^ a2 ? 1 : -1;
22513   }
22514   function intCheck(n3, min3, max3, name) {
22515     if (n3 < min3 || n3 > max3 || n3 !== mathfloor(n3)) {
22516       throw Error(bignumberError + (name || "Argument") + (typeof n3 == "number" ? n3 < min3 || n3 > max3 ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(n3));
22517     }
22518   }
22519   function isOdd(n3) {
22520     var k2 = n3.c.length - 1;
22521     return bitFloor(n3.e / LOG_BASE) == k2 && n3.c[k2] % 2 != 0;
22522   }
22523   function toExponential(str, e3) {
22524     return (str.length > 1 ? str.charAt(0) + "." + str.slice(1) : str) + (e3 < 0 ? "e" : "e+") + e3;
22525   }
22526   function toFixedPoint(str, e3, z2) {
22527     var len, zs;
22528     if (e3 < 0) {
22529       for (zs = z2 + "."; ++e3; zs += z2) ;
22530       str = zs + str;
22531     } else {
22532       len = str.length;
22533       if (++e3 > len) {
22534         for (zs = z2, e3 -= len; --e3; zs += z2) ;
22535         str += zs;
22536       } else if (e3 < len) {
22537         str = str.slice(0, e3) + "." + str.slice(e3);
22538       }
22539     }
22540     return str;
22541   }
22542   var BigNumber = clone();
22543   var bignumber_default = BigNumber;
22544
22545   // node_modules/splaytree-ts/dist/index.js
22546   var SplayTreeNode = class {
22547     constructor(key) {
22548       __publicField(this, "key");
22549       __publicField(this, "left", null);
22550       __publicField(this, "right", null);
22551       this.key = key;
22552     }
22553   };
22554   var SplayTreeSetNode = class extends SplayTreeNode {
22555     constructor(key) {
22556       super(key);
22557     }
22558   };
22559   var SplayTreeMapNode = class _SplayTreeMapNode extends SplayTreeNode {
22560     constructor(key, value) {
22561       super(key);
22562       __publicField(this, "value");
22563       this.value = value;
22564     }
22565     replaceValue(value) {
22566       const node = new _SplayTreeMapNode(this.key, value);
22567       node.left = this.left;
22568       node.right = this.right;
22569       return node;
22570     }
22571   };
22572   var SplayTree = class {
22573     constructor() {
22574       __publicField(this, "size", 0);
22575       __publicField(this, "modificationCount", 0);
22576       __publicField(this, "splayCount", 0);
22577     }
22578     splay(key) {
22579       const root3 = this.root;
22580       if (root3 == null) {
22581         this.compare(key, key);
22582         return -1;
22583       }
22584       let right = null;
22585       let newTreeRight = null;
22586       let left = null;
22587       let newTreeLeft = null;
22588       let current = root3;
22589       const compare2 = this.compare;
22590       let comp;
22591       while (true) {
22592         comp = compare2(current.key, key);
22593         if (comp > 0) {
22594           let currentLeft = current.left;
22595           if (currentLeft == null)
22596             break;
22597           comp = compare2(currentLeft.key, key);
22598           if (comp > 0) {
22599             current.left = currentLeft.right;
22600             currentLeft.right = current;
22601             current = currentLeft;
22602             currentLeft = current.left;
22603             if (currentLeft == null)
22604               break;
22605           }
22606           if (right == null) {
22607             newTreeRight = current;
22608           } else {
22609             right.left = current;
22610           }
22611           right = current;
22612           current = currentLeft;
22613         } else if (comp < 0) {
22614           let currentRight = current.right;
22615           if (currentRight == null)
22616             break;
22617           comp = compare2(currentRight.key, key);
22618           if (comp < 0) {
22619             current.right = currentRight.left;
22620             currentRight.left = current;
22621             current = currentRight;
22622             currentRight = current.right;
22623             if (currentRight == null)
22624               break;
22625           }
22626           if (left == null) {
22627             newTreeLeft = current;
22628           } else {
22629             left.right = current;
22630           }
22631           left = current;
22632           current = currentRight;
22633         } else {
22634           break;
22635         }
22636       }
22637       if (left != null) {
22638         left.right = current.left;
22639         current.left = newTreeLeft;
22640       }
22641       if (right != null) {
22642         right.left = current.right;
22643         current.right = newTreeRight;
22644       }
22645       if (this.root !== current) {
22646         this.root = current;
22647         this.splayCount++;
22648       }
22649       return comp;
22650     }
22651     splayMin(node) {
22652       let current = node;
22653       let nextLeft = current.left;
22654       while (nextLeft != null) {
22655         const left = nextLeft;
22656         current.left = left.right;
22657         left.right = current;
22658         current = left;
22659         nextLeft = current.left;
22660       }
22661       return current;
22662     }
22663     splayMax(node) {
22664       let current = node;
22665       let nextRight = current.right;
22666       while (nextRight != null) {
22667         const right = nextRight;
22668         current.right = right.left;
22669         right.left = current;
22670         current = right;
22671         nextRight = current.right;
22672       }
22673       return current;
22674     }
22675     _delete(key) {
22676       if (this.root == null)
22677         return null;
22678       const comp = this.splay(key);
22679       if (comp != 0)
22680         return null;
22681       let root3 = this.root;
22682       const result = root3;
22683       const left = root3.left;
22684       this.size--;
22685       if (left == null) {
22686         this.root = root3.right;
22687       } else {
22688         const right = root3.right;
22689         root3 = this.splayMax(left);
22690         root3.right = right;
22691         this.root = root3;
22692       }
22693       this.modificationCount++;
22694       return result;
22695     }
22696     addNewRoot(node, comp) {
22697       this.size++;
22698       this.modificationCount++;
22699       const root3 = this.root;
22700       if (root3 == null) {
22701         this.root = node;
22702         return;
22703       }
22704       if (comp < 0) {
22705         node.left = root3;
22706         node.right = root3.right;
22707         root3.right = null;
22708       } else {
22709         node.right = root3;
22710         node.left = root3.left;
22711         root3.left = null;
22712       }
22713       this.root = node;
22714     }
22715     _first() {
22716       const root3 = this.root;
22717       if (root3 == null)
22718         return null;
22719       this.root = this.splayMin(root3);
22720       return this.root;
22721     }
22722     _last() {
22723       const root3 = this.root;
22724       if (root3 == null)
22725         return null;
22726       this.root = this.splayMax(root3);
22727       return this.root;
22728     }
22729     clear() {
22730       this.root = null;
22731       this.size = 0;
22732       this.modificationCount++;
22733     }
22734     has(key) {
22735       return this.validKey(key) && this.splay(key) == 0;
22736     }
22737     defaultCompare() {
22738       return (a2, b2) => a2 < b2 ? -1 : a2 > b2 ? 1 : 0;
22739     }
22740     wrap() {
22741       return {
22742         getRoot: () => {
22743           return this.root;
22744         },
22745         setRoot: (root3) => {
22746           this.root = root3;
22747         },
22748         getSize: () => {
22749           return this.size;
22750         },
22751         getModificationCount: () => {
22752           return this.modificationCount;
22753         },
22754         getSplayCount: () => {
22755           return this.splayCount;
22756         },
22757         setSplayCount: (count) => {
22758           this.splayCount = count;
22759         },
22760         splay: (key) => {
22761           return this.splay(key);
22762         },
22763         has: (key) => {
22764           return this.has(key);
22765         }
22766       };
22767     }
22768   };
22769   var _a, _b;
22770   var SplayTreeMap = class extends SplayTree {
22771     constructor(compare2, isValidKey) {
22772       super();
22773       __publicField(this, "root", null);
22774       __publicField(this, "compare");
22775       __publicField(this, "validKey");
22776       __publicField(this, _a, "[object Map]");
22777       this.compare = compare2 != null ? compare2 : this.defaultCompare();
22778       this.validKey = isValidKey != null ? isValidKey : (a2) => a2 != null && a2 != void 0;
22779     }
22780     delete(key) {
22781       if (!this.validKey(key))
22782         return false;
22783       return this._delete(key) != null;
22784     }
22785     forEach(f2) {
22786       const nodes = new SplayTreeMapEntryIterableIterator(this.wrap());
22787       let result;
22788       while (result = nodes.next(), !result.done) {
22789         f2(result.value[1], result.value[0], this);
22790       }
22791     }
22792     get(key) {
22793       if (!this.validKey(key))
22794         return void 0;
22795       if (this.root != null) {
22796         const comp = this.splay(key);
22797         if (comp == 0) {
22798           return this.root.value;
22799         }
22800       }
22801       return void 0;
22802     }
22803     hasValue(value) {
22804       const initialSplayCount = this.splayCount;
22805       const visit = (node) => {
22806         while (node != null) {
22807           if (node.value == value)
22808             return true;
22809           if (initialSplayCount != this.splayCount) {
22810             throw "Concurrent modification during iteration.";
22811           }
22812           if (node.right != null && visit(node.right)) {
22813             return true;
22814           }
22815           node = node.left;
22816         }
22817         return false;
22818       };
22819       return visit(this.root);
22820     }
22821     set(key, value) {
22822       const comp = this.splay(key);
22823       if (comp == 0) {
22824         this.root = this.root.replaceValue(value);
22825         this.splayCount += 1;
22826         return this;
22827       }
22828       this.addNewRoot(new SplayTreeMapNode(key, value), comp);
22829       return this;
22830     }
22831     setAll(other) {
22832       other.forEach((value, key) => {
22833         this.set(key, value);
22834       });
22835     }
22836     setIfAbsent(key, ifAbsent) {
22837       let comp = this.splay(key);
22838       if (comp == 0) {
22839         return this.root.value;
22840       }
22841       const modificationCount = this.modificationCount;
22842       const splayCount = this.splayCount;
22843       const value = ifAbsent();
22844       if (modificationCount != this.modificationCount) {
22845         throw "Concurrent modification during iteration.";
22846       }
22847       if (splayCount != this.splayCount) {
22848         comp = this.splay(key);
22849       }
22850       this.addNewRoot(new SplayTreeMapNode(key, value), comp);
22851       return value;
22852     }
22853     isEmpty() {
22854       return this.root == null;
22855     }
22856     isNotEmpty() {
22857       return !this.isEmpty();
22858     }
22859     firstKey() {
22860       if (this.root == null)
22861         return null;
22862       return this._first().key;
22863     }
22864     lastKey() {
22865       if (this.root == null)
22866         return null;
22867       return this._last().key;
22868     }
22869     lastKeyBefore(key) {
22870       if (key == null)
22871         throw "Invalid arguments(s)";
22872       if (this.root == null)
22873         return null;
22874       const comp = this.splay(key);
22875       if (comp < 0)
22876         return this.root.key;
22877       let node = this.root.left;
22878       if (node == null)
22879         return null;
22880       let nodeRight = node.right;
22881       while (nodeRight != null) {
22882         node = nodeRight;
22883         nodeRight = node.right;
22884       }
22885       return node.key;
22886     }
22887     firstKeyAfter(key) {
22888       if (key == null)
22889         throw "Invalid arguments(s)";
22890       if (this.root == null)
22891         return null;
22892       const comp = this.splay(key);
22893       if (comp > 0)
22894         return this.root.key;
22895       let node = this.root.right;
22896       if (node == null)
22897         return null;
22898       let nodeLeft = node.left;
22899       while (nodeLeft != null) {
22900         node = nodeLeft;
22901         nodeLeft = node.left;
22902       }
22903       return node.key;
22904     }
22905     update(key, update, ifAbsent) {
22906       let comp = this.splay(key);
22907       if (comp == 0) {
22908         const modificationCount = this.modificationCount;
22909         const splayCount = this.splayCount;
22910         const newValue = update(this.root.value);
22911         if (modificationCount != this.modificationCount) {
22912           throw "Concurrent modification during iteration.";
22913         }
22914         if (splayCount != this.splayCount) {
22915           this.splay(key);
22916         }
22917         this.root = this.root.replaceValue(newValue);
22918         this.splayCount += 1;
22919         return newValue;
22920       }
22921       if (ifAbsent != null) {
22922         const modificationCount = this.modificationCount;
22923         const splayCount = this.splayCount;
22924         const newValue = ifAbsent();
22925         if (modificationCount != this.modificationCount) {
22926           throw "Concurrent modification during iteration.";
22927         }
22928         if (splayCount != this.splayCount) {
22929           comp = this.splay(key);
22930         }
22931         this.addNewRoot(new SplayTreeMapNode(key, newValue), comp);
22932         return newValue;
22933       }
22934       throw "Invalid argument (key): Key not in map.";
22935     }
22936     updateAll(update) {
22937       const root3 = this.root;
22938       if (root3 == null)
22939         return;
22940       const iterator = new SplayTreeMapEntryIterableIterator(this.wrap());
22941       let node;
22942       while (node = iterator.next(), !node.done) {
22943         const newValue = update(...node.value);
22944         iterator.replaceValue(newValue);
22945       }
22946     }
22947     keys() {
22948       return new SplayTreeKeyIterableIterator(this.wrap());
22949     }
22950     values() {
22951       return new SplayTreeValueIterableIterator(this.wrap());
22952     }
22953     entries() {
22954       return this[Symbol.iterator]();
22955     }
22956     [(_b = Symbol.iterator, _a = Symbol.toStringTag, _b)]() {
22957       return new SplayTreeMapEntryIterableIterator(this.wrap());
22958     }
22959   };
22960   var _a2, _b2;
22961   var SplayTreeSet = class _SplayTreeSet extends SplayTree {
22962     constructor(compare2, isValidKey) {
22963       super();
22964       __publicField(this, "root", null);
22965       __publicField(this, "compare");
22966       __publicField(this, "validKey");
22967       __publicField(this, _a2, "[object Set]");
22968       this.compare = compare2 != null ? compare2 : this.defaultCompare();
22969       this.validKey = isValidKey != null ? isValidKey : (v2) => v2 != null && v2 != void 0;
22970     }
22971     delete(element) {
22972       if (!this.validKey(element))
22973         return false;
22974       return this._delete(element) != null;
22975     }
22976     deleteAll(elements) {
22977       for (const element of elements) {
22978         this.delete(element);
22979       }
22980     }
22981     forEach(f2) {
22982       const nodes = this[Symbol.iterator]();
22983       let result;
22984       while (result = nodes.next(), !result.done) {
22985         f2(result.value, result.value, this);
22986       }
22987     }
22988     add(element) {
22989       const compare2 = this.splay(element);
22990       if (compare2 != 0)
22991         this.addNewRoot(new SplayTreeSetNode(element), compare2);
22992       return this;
22993     }
22994     addAndReturn(element) {
22995       const compare2 = this.splay(element);
22996       if (compare2 != 0)
22997         this.addNewRoot(new SplayTreeSetNode(element), compare2);
22998       return this.root.key;
22999     }
23000     addAll(elements) {
23001       for (const element of elements) {
23002         this.add(element);
23003       }
23004     }
23005     isEmpty() {
23006       return this.root == null;
23007     }
23008     isNotEmpty() {
23009       return this.root != null;
23010     }
23011     single() {
23012       if (this.size == 0)
23013         throw "Bad state: No element";
23014       if (this.size > 1)
23015         throw "Bad state: Too many element";
23016       return this.root.key;
23017     }
23018     first() {
23019       if (this.size == 0)
23020         throw "Bad state: No element";
23021       return this._first().key;
23022     }
23023     last() {
23024       if (this.size == 0)
23025         throw "Bad state: No element";
23026       return this._last().key;
23027     }
23028     lastBefore(element) {
23029       if (element == null)
23030         throw "Invalid arguments(s)";
23031       if (this.root == null)
23032         return null;
23033       const comp = this.splay(element);
23034       if (comp < 0)
23035         return this.root.key;
23036       let node = this.root.left;
23037       if (node == null)
23038         return null;
23039       let nodeRight = node.right;
23040       while (nodeRight != null) {
23041         node = nodeRight;
23042         nodeRight = node.right;
23043       }
23044       return node.key;
23045     }
23046     firstAfter(element) {
23047       if (element == null)
23048         throw "Invalid arguments(s)";
23049       if (this.root == null)
23050         return null;
23051       const comp = this.splay(element);
23052       if (comp > 0)
23053         return this.root.key;
23054       let node = this.root.right;
23055       if (node == null)
23056         return null;
23057       let nodeLeft = node.left;
23058       while (nodeLeft != null) {
23059         node = nodeLeft;
23060         nodeLeft = node.left;
23061       }
23062       return node.key;
23063     }
23064     retainAll(elements) {
23065       const retainSet = new _SplayTreeSet(this.compare, this.validKey);
23066       const modificationCount = this.modificationCount;
23067       for (const object of elements) {
23068         if (modificationCount != this.modificationCount) {
23069           throw "Concurrent modification during iteration.";
23070         }
23071         if (this.validKey(object) && this.splay(object) == 0) {
23072           retainSet.add(this.root.key);
23073         }
23074       }
23075       if (retainSet.size != this.size) {
23076         this.root = retainSet.root;
23077         this.size = retainSet.size;
23078         this.modificationCount++;
23079       }
23080     }
23081     lookup(object) {
23082       if (!this.validKey(object))
23083         return null;
23084       const comp = this.splay(object);
23085       if (comp != 0)
23086         return null;
23087       return this.root.key;
23088     }
23089     intersection(other) {
23090       const result = new _SplayTreeSet(this.compare, this.validKey);
23091       for (const element of this) {
23092         if (other.has(element))
23093           result.add(element);
23094       }
23095       return result;
23096     }
23097     difference(other) {
23098       const result = new _SplayTreeSet(this.compare, this.validKey);
23099       for (const element of this) {
23100         if (!other.has(element))
23101           result.add(element);
23102       }
23103       return result;
23104     }
23105     union(other) {
23106       const u2 = this.clone();
23107       u2.addAll(other);
23108       return u2;
23109     }
23110     clone() {
23111       const set4 = new _SplayTreeSet(this.compare, this.validKey);
23112       set4.size = this.size;
23113       set4.root = this.copyNode(this.root);
23114       return set4;
23115     }
23116     copyNode(node) {
23117       if (node == null)
23118         return null;
23119       function copyChildren(node2, dest) {
23120         let left;
23121         let right;
23122         do {
23123           left = node2.left;
23124           right = node2.right;
23125           if (left != null) {
23126             const newLeft = new SplayTreeSetNode(left.key);
23127             dest.left = newLeft;
23128             copyChildren(left, newLeft);
23129           }
23130           if (right != null) {
23131             const newRight = new SplayTreeSetNode(right.key);
23132             dest.right = newRight;
23133             node2 = right;
23134             dest = newRight;
23135           }
23136         } while (right != null);
23137       }
23138       const result = new SplayTreeSetNode(node.key);
23139       copyChildren(node, result);
23140       return result;
23141     }
23142     toSet() {
23143       return this.clone();
23144     }
23145     entries() {
23146       return new SplayTreeSetEntryIterableIterator(this.wrap());
23147     }
23148     keys() {
23149       return this[Symbol.iterator]();
23150     }
23151     values() {
23152       return this[Symbol.iterator]();
23153     }
23154     [(_b2 = Symbol.iterator, _a2 = Symbol.toStringTag, _b2)]() {
23155       return new SplayTreeKeyIterableIterator(this.wrap());
23156     }
23157   };
23158   var SplayTreeIterableIterator = class {
23159     constructor(tree) {
23160       __publicField(this, "tree");
23161       __publicField(this, "path", new Array());
23162       __publicField(this, "modificationCount", null);
23163       __publicField(this, "splayCount");
23164       this.tree = tree;
23165       this.splayCount = tree.getSplayCount();
23166     }
23167     [Symbol.iterator]() {
23168       return this;
23169     }
23170     next() {
23171       if (this.moveNext())
23172         return { done: false, value: this.current() };
23173       return { done: true, value: null };
23174     }
23175     current() {
23176       if (!this.path.length)
23177         return null;
23178       const node = this.path[this.path.length - 1];
23179       return this.getValue(node);
23180     }
23181     rebuildPath(key) {
23182       this.path.splice(0, this.path.length);
23183       this.tree.splay(key);
23184       this.path.push(this.tree.getRoot());
23185       this.splayCount = this.tree.getSplayCount();
23186     }
23187     findLeftMostDescendent(node) {
23188       while (node != null) {
23189         this.path.push(node);
23190         node = node.left;
23191       }
23192     }
23193     moveNext() {
23194       if (this.modificationCount != this.tree.getModificationCount()) {
23195         if (this.modificationCount == null) {
23196           this.modificationCount = this.tree.getModificationCount();
23197           let node2 = this.tree.getRoot();
23198           while (node2 != null) {
23199             this.path.push(node2);
23200             node2 = node2.left;
23201           }
23202           return this.path.length > 0;
23203         }
23204         throw "Concurrent modification during iteration.";
23205       }
23206       if (!this.path.length)
23207         return false;
23208       if (this.splayCount != this.tree.getSplayCount()) {
23209         this.rebuildPath(this.path[this.path.length - 1].key);
23210       }
23211       let node = this.path[this.path.length - 1];
23212       let next = node.right;
23213       if (next != null) {
23214         while (next != null) {
23215           this.path.push(next);
23216           next = next.left;
23217         }
23218         return true;
23219       }
23220       this.path.pop();
23221       while (this.path.length && this.path[this.path.length - 1].right === node) {
23222         node = this.path.pop();
23223       }
23224       return this.path.length > 0;
23225     }
23226   };
23227   var SplayTreeKeyIterableIterator = class extends SplayTreeIterableIterator {
23228     getValue(node) {
23229       return node.key;
23230     }
23231   };
23232   var SplayTreeSetEntryIterableIterator = class extends SplayTreeIterableIterator {
23233     getValue(node) {
23234       return [node.key, node.key];
23235     }
23236   };
23237   var SplayTreeValueIterableIterator = class extends SplayTreeIterableIterator {
23238     constructor(map2) {
23239       super(map2);
23240     }
23241     getValue(node) {
23242       return node.value;
23243     }
23244   };
23245   var SplayTreeMapEntryIterableIterator = class extends SplayTreeIterableIterator {
23246     constructor(map2) {
23247       super(map2);
23248     }
23249     getValue(node) {
23250       return [node.key, node.value];
23251     }
23252     replaceValue(value) {
23253       if (this.modificationCount != this.tree.getModificationCount()) {
23254         throw "Concurrent modification during iteration.";
23255       }
23256       if (this.splayCount != this.tree.getSplayCount()) {
23257         this.rebuildPath(this.path[this.path.length - 1].key);
23258       }
23259       const last = this.path.pop();
23260       const newLast = last.replaceValue(value);
23261       if (!this.path.length) {
23262         this.tree.setRoot(newLast);
23263       } else {
23264         const parent = this.path[this.path.length - 1];
23265         if (last === parent.left) {
23266           parent.left = newLast;
23267         } else {
23268           parent.right = newLast;
23269         }
23270       }
23271       this.path.push(newLast);
23272       const count = this.tree.getSplayCount() + 1;
23273       this.tree.setSplayCount(count);
23274       this.splayCount = count;
23275     }
23276   };
23277
23278   // node_modules/polyclip-ts/dist/identity.js
23279   var identity_default3 = (x2) => {
23280     return x2;
23281   };
23282
23283   // node_modules/polyclip-ts/dist/snap.js
23284   var snap_default = (eps) => {
23285     if (eps) {
23286       const xTree = new SplayTreeSet(compare_default(eps));
23287       const yTree = new SplayTreeSet(compare_default(eps));
23288       const snapCoord = (coord2, tree) => {
23289         return tree.addAndReturn(coord2);
23290       };
23291       const snap = (v2) => {
23292         return {
23293           x: snapCoord(v2.x, xTree),
23294           y: snapCoord(v2.y, yTree)
23295         };
23296       };
23297       snap({ x: new bignumber_default(0), y: new bignumber_default(0) });
23298       return snap;
23299     }
23300     return identity_default3;
23301   };
23302
23303   // node_modules/polyclip-ts/dist/precision.js
23304   var set3 = (eps) => {
23305     return {
23306       set: (eps2) => {
23307         precision = set3(eps2);
23308       },
23309       reset: () => set3(eps),
23310       compare: compare_default(eps),
23311       snap: snap_default(eps),
23312       orient: orient_default(eps)
23313     };
23314   };
23315   var precision = set3();
23316
23317   // node_modules/polyclip-ts/dist/bbox.js
23318   var isInBbox = (bbox2, point) => {
23319     return bbox2.ll.x.isLessThanOrEqualTo(point.x) && point.x.isLessThanOrEqualTo(bbox2.ur.x) && bbox2.ll.y.isLessThanOrEqualTo(point.y) && point.y.isLessThanOrEqualTo(bbox2.ur.y);
23320   };
23321   var getBboxOverlap = (b1, b2) => {
23322     if (b2.ur.x.isLessThan(b1.ll.x) || b1.ur.x.isLessThan(b2.ll.x) || b2.ur.y.isLessThan(b1.ll.y) || b1.ur.y.isLessThan(b2.ll.y))
23323       return null;
23324     const lowerX = b1.ll.x.isLessThan(b2.ll.x) ? b2.ll.x : b1.ll.x;
23325     const upperX = b1.ur.x.isLessThan(b2.ur.x) ? b1.ur.x : b2.ur.x;
23326     const lowerY = b1.ll.y.isLessThan(b2.ll.y) ? b2.ll.y : b1.ll.y;
23327     const upperY = b1.ur.y.isLessThan(b2.ur.y) ? b1.ur.y : b2.ur.y;
23328     return { ll: { x: lowerX, y: lowerY }, ur: { x: upperX, y: upperY } };
23329   };
23330
23331   // node_modules/polyclip-ts/dist/vector.js
23332   var crossProduct = (a2, b2) => a2.x.times(b2.y).minus(a2.y.times(b2.x));
23333   var dotProduct = (a2, b2) => a2.x.times(b2.x).plus(a2.y.times(b2.y));
23334   var length = (v2) => dotProduct(v2, v2).sqrt();
23335   var sineOfAngle = (pShared, pBase, pAngle) => {
23336     const vBase = { x: pBase.x.minus(pShared.x), y: pBase.y.minus(pShared.y) };
23337     const vAngle = { x: pAngle.x.minus(pShared.x), y: pAngle.y.minus(pShared.y) };
23338     return crossProduct(vAngle, vBase).div(length(vAngle)).div(length(vBase));
23339   };
23340   var cosineOfAngle = (pShared, pBase, pAngle) => {
23341     const vBase = { x: pBase.x.minus(pShared.x), y: pBase.y.minus(pShared.y) };
23342     const vAngle = { x: pAngle.x.minus(pShared.x), y: pAngle.y.minus(pShared.y) };
23343     return dotProduct(vAngle, vBase).div(length(vAngle)).div(length(vBase));
23344   };
23345   var horizontalIntersection = (pt2, v2, y2) => {
23346     if (v2.y.isZero())
23347       return null;
23348     return { x: pt2.x.plus(v2.x.div(v2.y).times(y2.minus(pt2.y))), y: y2 };
23349   };
23350   var verticalIntersection = (pt2, v2, x2) => {
23351     if (v2.x.isZero())
23352       return null;
23353     return { x: x2, y: pt2.y.plus(v2.y.div(v2.x).times(x2.minus(pt2.x))) };
23354   };
23355   var intersection = (pt1, v1, pt2, v2) => {
23356     if (v1.x.isZero())
23357       return verticalIntersection(pt2, v2, pt1.x);
23358     if (v2.x.isZero())
23359       return verticalIntersection(pt1, v1, pt2.x);
23360     if (v1.y.isZero())
23361       return horizontalIntersection(pt2, v2, pt1.y);
23362     if (v2.y.isZero())
23363       return horizontalIntersection(pt1, v1, pt2.y);
23364     const kross = crossProduct(v1, v2);
23365     if (kross.isZero())
23366       return null;
23367     const ve2 = { x: pt2.x.minus(pt1.x), y: pt2.y.minus(pt1.y) };
23368     const d1 = crossProduct(ve2, v1).div(kross);
23369     const d2 = crossProduct(ve2, v2).div(kross);
23370     const x12 = pt1.x.plus(d2.times(v1.x)), x2 = pt2.x.plus(d1.times(v2.x));
23371     const y12 = pt1.y.plus(d2.times(v1.y)), y2 = pt2.y.plus(d1.times(v2.y));
23372     const x3 = x12.plus(x2).div(2);
23373     const y3 = y12.plus(y2).div(2);
23374     return { x: x3, y: y3 };
23375   };
23376
23377   // node_modules/polyclip-ts/dist/sweep-event.js
23378   var SweepEvent = class _SweepEvent {
23379     // Warning: 'point' input will be modified and re-used (for performance)
23380     constructor(point, isLeft) {
23381       __publicField(this, "point");
23382       __publicField(this, "isLeft");
23383       __publicField(this, "segment");
23384       __publicField(this, "otherSE");
23385       __publicField(this, "consumedBy");
23386       if (point.events === void 0)
23387         point.events = [this];
23388       else
23389         point.events.push(this);
23390       this.point = point;
23391       this.isLeft = isLeft;
23392     }
23393     // for ordering sweep events in the sweep event queue
23394     static compare(a2, b2) {
23395       const ptCmp = _SweepEvent.comparePoints(a2.point, b2.point);
23396       if (ptCmp !== 0)
23397         return ptCmp;
23398       if (a2.point !== b2.point)
23399         a2.link(b2);
23400       if (a2.isLeft !== b2.isLeft)
23401         return a2.isLeft ? 1 : -1;
23402       return Segment.compare(a2.segment, b2.segment);
23403     }
23404     // for ordering points in sweep line order
23405     static comparePoints(aPt, bPt) {
23406       if (aPt.x.isLessThan(bPt.x))
23407         return -1;
23408       if (aPt.x.isGreaterThan(bPt.x))
23409         return 1;
23410       if (aPt.y.isLessThan(bPt.y))
23411         return -1;
23412       if (aPt.y.isGreaterThan(bPt.y))
23413         return 1;
23414       return 0;
23415     }
23416     link(other) {
23417       if (other.point === this.point) {
23418         throw new Error("Tried to link already linked events");
23419       }
23420       const otherEvents = other.point.events;
23421       for (let i3 = 0, iMax = otherEvents.length; i3 < iMax; i3++) {
23422         const evt = otherEvents[i3];
23423         this.point.events.push(evt);
23424         evt.point = this.point;
23425       }
23426       this.checkForConsuming();
23427     }
23428     /* Do a pass over our linked events and check to see if any pair
23429      * of segments match, and should be consumed. */
23430     checkForConsuming() {
23431       const numEvents = this.point.events.length;
23432       for (let i3 = 0; i3 < numEvents; i3++) {
23433         const evt1 = this.point.events[i3];
23434         if (evt1.segment.consumedBy !== void 0)
23435           continue;
23436         for (let j2 = i3 + 1; j2 < numEvents; j2++) {
23437           const evt2 = this.point.events[j2];
23438           if (evt2.consumedBy !== void 0)
23439             continue;
23440           if (evt1.otherSE.point.events !== evt2.otherSE.point.events)
23441             continue;
23442           evt1.segment.consume(evt2.segment);
23443         }
23444       }
23445     }
23446     getAvailableLinkedEvents() {
23447       const events = [];
23448       for (let i3 = 0, iMax = this.point.events.length; i3 < iMax; i3++) {
23449         const evt = this.point.events[i3];
23450         if (evt !== this && !evt.segment.ringOut && evt.segment.isInResult()) {
23451           events.push(evt);
23452         }
23453       }
23454       return events;
23455     }
23456     /**
23457      * Returns a comparator function for sorting linked events that will
23458      * favor the event that will give us the smallest left-side angle.
23459      * All ring construction starts as low as possible heading to the right,
23460      * so by always turning left as sharp as possible we'll get polygons
23461      * without uncessary loops & holes.
23462      *
23463      * The comparator function has a compute cache such that it avoids
23464      * re-computing already-computed values.
23465      */
23466     getLeftmostComparator(baseEvent) {
23467       const cache = /* @__PURE__ */ new Map();
23468       const fillCache = (linkedEvent) => {
23469         const nextEvent = linkedEvent.otherSE;
23470         cache.set(linkedEvent, {
23471           sine: sineOfAngle(this.point, baseEvent.point, nextEvent.point),
23472           cosine: cosineOfAngle(this.point, baseEvent.point, nextEvent.point)
23473         });
23474       };
23475       return (a2, b2) => {
23476         if (!cache.has(a2))
23477           fillCache(a2);
23478         if (!cache.has(b2))
23479           fillCache(b2);
23480         const { sine: asine, cosine: acosine } = cache.get(a2);
23481         const { sine: bsine, cosine: bcosine } = cache.get(b2);
23482         if (asine.isGreaterThanOrEqualTo(0) && bsine.isGreaterThanOrEqualTo(0)) {
23483           if (acosine.isLessThan(bcosine))
23484             return 1;
23485           if (acosine.isGreaterThan(bcosine))
23486             return -1;
23487           return 0;
23488         }
23489         if (asine.isLessThan(0) && bsine.isLessThan(0)) {
23490           if (acosine.isLessThan(bcosine))
23491             return -1;
23492           if (acosine.isGreaterThan(bcosine))
23493             return 1;
23494           return 0;
23495         }
23496         if (bsine.isLessThan(asine))
23497           return -1;
23498         if (bsine.isGreaterThan(asine))
23499           return 1;
23500         return 0;
23501       };
23502     }
23503   };
23504
23505   // node_modules/polyclip-ts/dist/segment.js
23506   var segmentId = 0;
23507   var Segment = class _Segment {
23508     /* Warning: a reference to ringWindings input will be stored,
23509      *  and possibly will be later modified */
23510     constructor(leftSE, rightSE, rings, windings) {
23511       __publicField(this, "id");
23512       __publicField(this, "leftSE");
23513       __publicField(this, "rightSE");
23514       __publicField(this, "rings");
23515       __publicField(this, "windings");
23516       __publicField(this, "ringOut");
23517       __publicField(this, "consumedBy");
23518       __publicField(this, "prev");
23519       __publicField(this, "_prevInResult");
23520       __publicField(this, "_beforeState");
23521       __publicField(this, "_afterState");
23522       __publicField(this, "_isInResult");
23523       this.id = ++segmentId;
23524       this.leftSE = leftSE;
23525       leftSE.segment = this;
23526       leftSE.otherSE = rightSE;
23527       this.rightSE = rightSE;
23528       rightSE.segment = this;
23529       rightSE.otherSE = leftSE;
23530       this.rings = rings;
23531       this.windings = windings;
23532     }
23533     /* This compare() function is for ordering segments in the sweep
23534      * line tree, and does so according to the following criteria:
23535      *
23536      * Consider the vertical line that lies an infinestimal step to the
23537      * right of the right-more of the two left endpoints of the input
23538      * segments. Imagine slowly moving a point up from negative infinity
23539      * in the increasing y direction. Which of the two segments will that
23540      * point intersect first? That segment comes 'before' the other one.
23541      *
23542      * If neither segment would be intersected by such a line, (if one
23543      * or more of the segments are vertical) then the line to be considered
23544      * is directly on the right-more of the two left inputs.
23545      */
23546     static compare(a2, b2) {
23547       const alx = a2.leftSE.point.x;
23548       const blx = b2.leftSE.point.x;
23549       const arx = a2.rightSE.point.x;
23550       const brx = b2.rightSE.point.x;
23551       if (brx.isLessThan(alx))
23552         return 1;
23553       if (arx.isLessThan(blx))
23554         return -1;
23555       const aly = a2.leftSE.point.y;
23556       const bly = b2.leftSE.point.y;
23557       const ary = a2.rightSE.point.y;
23558       const bry = b2.rightSE.point.y;
23559       if (alx.isLessThan(blx)) {
23560         if (bly.isLessThan(aly) && bly.isLessThan(ary))
23561           return 1;
23562         if (bly.isGreaterThan(aly) && bly.isGreaterThan(ary))
23563           return -1;
23564         const aCmpBLeft = a2.comparePoint(b2.leftSE.point);
23565         if (aCmpBLeft < 0)
23566           return 1;
23567         if (aCmpBLeft > 0)
23568           return -1;
23569         const bCmpARight = b2.comparePoint(a2.rightSE.point);
23570         if (bCmpARight !== 0)
23571           return bCmpARight;
23572         return -1;
23573       }
23574       if (alx.isGreaterThan(blx)) {
23575         if (aly.isLessThan(bly) && aly.isLessThan(bry))
23576           return -1;
23577         if (aly.isGreaterThan(bly) && aly.isGreaterThan(bry))
23578           return 1;
23579         const bCmpALeft = b2.comparePoint(a2.leftSE.point);
23580         if (bCmpALeft !== 0)
23581           return bCmpALeft;
23582         const aCmpBRight = a2.comparePoint(b2.rightSE.point);
23583         if (aCmpBRight < 0)
23584           return 1;
23585         if (aCmpBRight > 0)
23586           return -1;
23587         return 1;
23588       }
23589       if (aly.isLessThan(bly))
23590         return -1;
23591       if (aly.isGreaterThan(bly))
23592         return 1;
23593       if (arx.isLessThan(brx)) {
23594         const bCmpARight = b2.comparePoint(a2.rightSE.point);
23595         if (bCmpARight !== 0)
23596           return bCmpARight;
23597       }
23598       if (arx.isGreaterThan(brx)) {
23599         const aCmpBRight = a2.comparePoint(b2.rightSE.point);
23600         if (aCmpBRight < 0)
23601           return 1;
23602         if (aCmpBRight > 0)
23603           return -1;
23604       }
23605       if (!arx.eq(brx)) {
23606         const ay = ary.minus(aly);
23607         const ax = arx.minus(alx);
23608         const by = bry.minus(bly);
23609         const bx = brx.minus(blx);
23610         if (ay.isGreaterThan(ax) && by.isLessThan(bx))
23611           return 1;
23612         if (ay.isLessThan(ax) && by.isGreaterThan(bx))
23613           return -1;
23614       }
23615       if (arx.isGreaterThan(brx))
23616         return 1;
23617       if (arx.isLessThan(brx))
23618         return -1;
23619       if (ary.isLessThan(bry))
23620         return -1;
23621       if (ary.isGreaterThan(bry))
23622         return 1;
23623       if (a2.id < b2.id)
23624         return -1;
23625       if (a2.id > b2.id)
23626         return 1;
23627       return 0;
23628     }
23629     static fromRing(pt1, pt2, ring) {
23630       let leftPt, rightPt, winding;
23631       const cmpPts = SweepEvent.comparePoints(pt1, pt2);
23632       if (cmpPts < 0) {
23633         leftPt = pt1;
23634         rightPt = pt2;
23635         winding = 1;
23636       } else if (cmpPts > 0) {
23637         leftPt = pt2;
23638         rightPt = pt1;
23639         winding = -1;
23640       } else
23641         throw new Error("Tried to create degenerate segment at [".concat(pt1.x, ", ").concat(pt1.y, "]"));
23642       const leftSE = new SweepEvent(leftPt, true);
23643       const rightSE = new SweepEvent(rightPt, false);
23644       return new _Segment(leftSE, rightSE, [ring], [winding]);
23645     }
23646     /* When a segment is split, the rightSE is replaced with a new sweep event */
23647     replaceRightSE(newRightSE) {
23648       this.rightSE = newRightSE;
23649       this.rightSE.segment = this;
23650       this.rightSE.otherSE = this.leftSE;
23651       this.leftSE.otherSE = this.rightSE;
23652     }
23653     bbox() {
23654       const y12 = this.leftSE.point.y;
23655       const y2 = this.rightSE.point.y;
23656       return {
23657         ll: { x: this.leftSE.point.x, y: y12.isLessThan(y2) ? y12 : y2 },
23658         ur: { x: this.rightSE.point.x, y: y12.isGreaterThan(y2) ? y12 : y2 }
23659       };
23660     }
23661     /* A vector from the left point to the right */
23662     vector() {
23663       return {
23664         x: this.rightSE.point.x.minus(this.leftSE.point.x),
23665         y: this.rightSE.point.y.minus(this.leftSE.point.y)
23666       };
23667     }
23668     isAnEndpoint(pt2) {
23669       return pt2.x.eq(this.leftSE.point.x) && pt2.y.eq(this.leftSE.point.y) || pt2.x.eq(this.rightSE.point.x) && pt2.y.eq(this.rightSE.point.y);
23670     }
23671     /* Compare this segment with a point.
23672      *
23673      * A point P is considered to be colinear to a segment if there
23674      * exists a distance D such that if we travel along the segment
23675      * from one * endpoint towards the other a distance D, we find
23676      * ourselves at point P.
23677      *
23678      * Return value indicates:
23679      *
23680      *   1: point lies above the segment (to the left of vertical)
23681      *   0: point is colinear to segment
23682      *  -1: point lies below the segment (to the right of vertical)
23683      */
23684     comparePoint(point) {
23685       return precision.orient(this.leftSE.point, point, this.rightSE.point);
23686     }
23687     /**
23688      * Given another segment, returns the first non-trivial intersection
23689      * between the two segments (in terms of sweep line ordering), if it exists.
23690      *
23691      * A 'non-trivial' intersection is one that will cause one or both of the
23692      * segments to be split(). As such, 'trivial' vs. 'non-trivial' intersection:
23693      *
23694      *   * endpoint of segA with endpoint of segB --> trivial
23695      *   * endpoint of segA with point along segB --> non-trivial
23696      *   * endpoint of segB with point along segA --> non-trivial
23697      *   * point along segA with point along segB --> non-trivial
23698      *
23699      * If no non-trivial intersection exists, return null
23700      * Else, return null.
23701      */
23702     getIntersection(other) {
23703       const tBbox = this.bbox();
23704       const oBbox = other.bbox();
23705       const bboxOverlap = getBboxOverlap(tBbox, oBbox);
23706       if (bboxOverlap === null)
23707         return null;
23708       const tlp = this.leftSE.point;
23709       const trp = this.rightSE.point;
23710       const olp = other.leftSE.point;
23711       const orp = other.rightSE.point;
23712       const touchesOtherLSE = isInBbox(tBbox, olp) && this.comparePoint(olp) === 0;
23713       const touchesThisLSE = isInBbox(oBbox, tlp) && other.comparePoint(tlp) === 0;
23714       const touchesOtherRSE = isInBbox(tBbox, orp) && this.comparePoint(orp) === 0;
23715       const touchesThisRSE = isInBbox(oBbox, trp) && other.comparePoint(trp) === 0;
23716       if (touchesThisLSE && touchesOtherLSE) {
23717         if (touchesThisRSE && !touchesOtherRSE)
23718           return trp;
23719         if (!touchesThisRSE && touchesOtherRSE)
23720           return orp;
23721         return null;
23722       }
23723       if (touchesThisLSE) {
23724         if (touchesOtherRSE) {
23725           if (tlp.x.eq(orp.x) && tlp.y.eq(orp.y))
23726             return null;
23727         }
23728         return tlp;
23729       }
23730       if (touchesOtherLSE) {
23731         if (touchesThisRSE) {
23732           if (trp.x.eq(olp.x) && trp.y.eq(olp.y))
23733             return null;
23734         }
23735         return olp;
23736       }
23737       if (touchesThisRSE && touchesOtherRSE)
23738         return null;
23739       if (touchesThisRSE)
23740         return trp;
23741       if (touchesOtherRSE)
23742         return orp;
23743       const pt2 = intersection(tlp, this.vector(), olp, other.vector());
23744       if (pt2 === null)
23745         return null;
23746       if (!isInBbox(bboxOverlap, pt2))
23747         return null;
23748       return precision.snap(pt2);
23749     }
23750     /**
23751      * Split the given segment into multiple segments on the given points.
23752      *  * Each existing segment will retain its leftSE and a new rightSE will be
23753      *    generated for it.
23754      *  * A new segment will be generated which will adopt the original segment's
23755      *    rightSE, and a new leftSE will be generated for it.
23756      *  * If there are more than two points given to split on, new segments
23757      *    in the middle will be generated with new leftSE and rightSE's.
23758      *  * An array of the newly generated SweepEvents will be returned.
23759      *
23760      * Warning: input array of points is modified
23761      */
23762     split(point) {
23763       const newEvents = [];
23764       const alreadyLinked = point.events !== void 0;
23765       const newLeftSE = new SweepEvent(point, true);
23766       const newRightSE = new SweepEvent(point, false);
23767       const oldRightSE = this.rightSE;
23768       this.replaceRightSE(newRightSE);
23769       newEvents.push(newRightSE);
23770       newEvents.push(newLeftSE);
23771       const newSeg = new _Segment(newLeftSE, oldRightSE, this.rings.slice(), this.windings.slice());
23772       if (SweepEvent.comparePoints(newSeg.leftSE.point, newSeg.rightSE.point) > 0) {
23773         newSeg.swapEvents();
23774       }
23775       if (SweepEvent.comparePoints(this.leftSE.point, this.rightSE.point) > 0) {
23776         this.swapEvents();
23777       }
23778       if (alreadyLinked) {
23779         newLeftSE.checkForConsuming();
23780         newRightSE.checkForConsuming();
23781       }
23782       return newEvents;
23783     }
23784     /* Swap which event is left and right */
23785     swapEvents() {
23786       const tmpEvt = this.rightSE;
23787       this.rightSE = this.leftSE;
23788       this.leftSE = tmpEvt;
23789       this.leftSE.isLeft = true;
23790       this.rightSE.isLeft = false;
23791       for (let i3 = 0, iMax = this.windings.length; i3 < iMax; i3++) {
23792         this.windings[i3] *= -1;
23793       }
23794     }
23795     /* Consume another segment. We take their rings under our wing
23796      * and mark them as consumed. Use for perfectly overlapping segments */
23797     consume(other) {
23798       let consumer = this;
23799       let consumee = other;
23800       while (consumer.consumedBy)
23801         consumer = consumer.consumedBy;
23802       while (consumee.consumedBy)
23803         consumee = consumee.consumedBy;
23804       const cmp = _Segment.compare(consumer, consumee);
23805       if (cmp === 0)
23806         return;
23807       if (cmp > 0) {
23808         const tmp = consumer;
23809         consumer = consumee;
23810         consumee = tmp;
23811       }
23812       if (consumer.prev === consumee) {
23813         const tmp = consumer;
23814         consumer = consumee;
23815         consumee = tmp;
23816       }
23817       for (let i3 = 0, iMax = consumee.rings.length; i3 < iMax; i3++) {
23818         const ring = consumee.rings[i3];
23819         const winding = consumee.windings[i3];
23820         const index = consumer.rings.indexOf(ring);
23821         if (index === -1) {
23822           consumer.rings.push(ring);
23823           consumer.windings.push(winding);
23824         } else
23825           consumer.windings[index] += winding;
23826       }
23827       consumee.rings = null;
23828       consumee.windings = null;
23829       consumee.consumedBy = consumer;
23830       consumee.leftSE.consumedBy = consumer.leftSE;
23831       consumee.rightSE.consumedBy = consumer.rightSE;
23832     }
23833     /* The first segment previous segment chain that is in the result */
23834     prevInResult() {
23835       if (this._prevInResult !== void 0)
23836         return this._prevInResult;
23837       if (!this.prev)
23838         this._prevInResult = null;
23839       else if (this.prev.isInResult())
23840         this._prevInResult = this.prev;
23841       else
23842         this._prevInResult = this.prev.prevInResult();
23843       return this._prevInResult;
23844     }
23845     beforeState() {
23846       if (this._beforeState !== void 0)
23847         return this._beforeState;
23848       if (!this.prev)
23849         this._beforeState = {
23850           rings: [],
23851           windings: [],
23852           multiPolys: []
23853         };
23854       else {
23855         const seg = this.prev.consumedBy || this.prev;
23856         this._beforeState = seg.afterState();
23857       }
23858       return this._beforeState;
23859     }
23860     afterState() {
23861       if (this._afterState !== void 0)
23862         return this._afterState;
23863       const beforeState = this.beforeState();
23864       this._afterState = {
23865         rings: beforeState.rings.slice(0),
23866         windings: beforeState.windings.slice(0),
23867         multiPolys: []
23868       };
23869       const ringsAfter = this._afterState.rings;
23870       const windingsAfter = this._afterState.windings;
23871       const mpsAfter = this._afterState.multiPolys;
23872       for (let i3 = 0, iMax = this.rings.length; i3 < iMax; i3++) {
23873         const ring = this.rings[i3];
23874         const winding = this.windings[i3];
23875         const index = ringsAfter.indexOf(ring);
23876         if (index === -1) {
23877           ringsAfter.push(ring);
23878           windingsAfter.push(winding);
23879         } else
23880           windingsAfter[index] += winding;
23881       }
23882       const polysAfter = [];
23883       const polysExclude = [];
23884       for (let i3 = 0, iMax = ringsAfter.length; i3 < iMax; i3++) {
23885         if (windingsAfter[i3] === 0)
23886           continue;
23887         const ring = ringsAfter[i3];
23888         const poly = ring.poly;
23889         if (polysExclude.indexOf(poly) !== -1)
23890           continue;
23891         if (ring.isExterior)
23892           polysAfter.push(poly);
23893         else {
23894           if (polysExclude.indexOf(poly) === -1)
23895             polysExclude.push(poly);
23896           const index = polysAfter.indexOf(ring.poly);
23897           if (index !== -1)
23898             polysAfter.splice(index, 1);
23899         }
23900       }
23901       for (let i3 = 0, iMax = polysAfter.length; i3 < iMax; i3++) {
23902         const mp = polysAfter[i3].multiPoly;
23903         if (mpsAfter.indexOf(mp) === -1)
23904           mpsAfter.push(mp);
23905       }
23906       return this._afterState;
23907     }
23908     /* Is this segment part of the final result? */
23909     isInResult() {
23910       if (this.consumedBy)
23911         return false;
23912       if (this._isInResult !== void 0)
23913         return this._isInResult;
23914       const mpsBefore = this.beforeState().multiPolys;
23915       const mpsAfter = this.afterState().multiPolys;
23916       switch (operation_default.type) {
23917         case "union": {
23918           const noBefores = mpsBefore.length === 0;
23919           const noAfters = mpsAfter.length === 0;
23920           this._isInResult = noBefores !== noAfters;
23921           break;
23922         }
23923         case "intersection": {
23924           let least;
23925           let most;
23926           if (mpsBefore.length < mpsAfter.length) {
23927             least = mpsBefore.length;
23928             most = mpsAfter.length;
23929           } else {
23930             least = mpsAfter.length;
23931             most = mpsBefore.length;
23932           }
23933           this._isInResult = most === operation_default.numMultiPolys && least < most;
23934           break;
23935         }
23936         case "xor": {
23937           const diff = Math.abs(mpsBefore.length - mpsAfter.length);
23938           this._isInResult = diff % 2 === 1;
23939           break;
23940         }
23941         case "difference": {
23942           const isJustSubject = (mps) => mps.length === 1 && mps[0].isSubject;
23943           this._isInResult = isJustSubject(mpsBefore) !== isJustSubject(mpsAfter);
23944           break;
23945         }
23946       }
23947       return this._isInResult;
23948     }
23949   };
23950
23951   // node_modules/polyclip-ts/dist/geom-in.js
23952   var RingIn = class {
23953     constructor(geomRing, poly, isExterior) {
23954       __publicField(this, "poly");
23955       __publicField(this, "isExterior");
23956       __publicField(this, "segments");
23957       __publicField(this, "bbox");
23958       if (!Array.isArray(geomRing) || geomRing.length === 0) {
23959         throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
23960       }
23961       this.poly = poly;
23962       this.isExterior = isExterior;
23963       this.segments = [];
23964       if (typeof geomRing[0][0] !== "number" || typeof geomRing[0][1] !== "number") {
23965         throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
23966       }
23967       const firstPoint = precision.snap({ x: new bignumber_default(geomRing[0][0]), y: new bignumber_default(geomRing[0][1]) });
23968       this.bbox = {
23969         ll: { x: firstPoint.x, y: firstPoint.y },
23970         ur: { x: firstPoint.x, y: firstPoint.y }
23971       };
23972       let prevPoint = firstPoint;
23973       for (let i3 = 1, iMax = geomRing.length; i3 < iMax; i3++) {
23974         if (typeof geomRing[i3][0] !== "number" || typeof geomRing[i3][1] !== "number") {
23975           throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
23976         }
23977         const point = precision.snap({ x: new bignumber_default(geomRing[i3][0]), y: new bignumber_default(geomRing[i3][1]) });
23978         if (point.x.eq(prevPoint.x) && point.y.eq(prevPoint.y))
23979           continue;
23980         this.segments.push(Segment.fromRing(prevPoint, point, this));
23981         if (point.x.isLessThan(this.bbox.ll.x))
23982           this.bbox.ll.x = point.x;
23983         if (point.y.isLessThan(this.bbox.ll.y))
23984           this.bbox.ll.y = point.y;
23985         if (point.x.isGreaterThan(this.bbox.ur.x))
23986           this.bbox.ur.x = point.x;
23987         if (point.y.isGreaterThan(this.bbox.ur.y))
23988           this.bbox.ur.y = point.y;
23989         prevPoint = point;
23990       }
23991       if (!firstPoint.x.eq(prevPoint.x) || !firstPoint.y.eq(prevPoint.y)) {
23992         this.segments.push(Segment.fromRing(prevPoint, firstPoint, this));
23993       }
23994     }
23995     getSweepEvents() {
23996       const sweepEvents = [];
23997       for (let i3 = 0, iMax = this.segments.length; i3 < iMax; i3++) {
23998         const segment = this.segments[i3];
23999         sweepEvents.push(segment.leftSE);
24000         sweepEvents.push(segment.rightSE);
24001       }
24002       return sweepEvents;
24003     }
24004   };
24005   var PolyIn = class {
24006     constructor(geomPoly, multiPoly) {
24007       __publicField(this, "multiPoly");
24008       __publicField(this, "exteriorRing");
24009       __publicField(this, "interiorRings");
24010       __publicField(this, "bbox");
24011       if (!Array.isArray(geomPoly)) {
24012         throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
24013       }
24014       this.exteriorRing = new RingIn(geomPoly[0], this, true);
24015       this.bbox = {
24016         ll: { x: this.exteriorRing.bbox.ll.x, y: this.exteriorRing.bbox.ll.y },
24017         ur: { x: this.exteriorRing.bbox.ur.x, y: this.exteriorRing.bbox.ur.y }
24018       };
24019       this.interiorRings = [];
24020       for (let i3 = 1, iMax = geomPoly.length; i3 < iMax; i3++) {
24021         const ring = new RingIn(geomPoly[i3], this, false);
24022         if (ring.bbox.ll.x.isLessThan(this.bbox.ll.x))
24023           this.bbox.ll.x = ring.bbox.ll.x;
24024         if (ring.bbox.ll.y.isLessThan(this.bbox.ll.y))
24025           this.bbox.ll.y = ring.bbox.ll.y;
24026         if (ring.bbox.ur.x.isGreaterThan(this.bbox.ur.x))
24027           this.bbox.ur.x = ring.bbox.ur.x;
24028         if (ring.bbox.ur.y.isGreaterThan(this.bbox.ur.y))
24029           this.bbox.ur.y = ring.bbox.ur.y;
24030         this.interiorRings.push(ring);
24031       }
24032       this.multiPoly = multiPoly;
24033     }
24034     getSweepEvents() {
24035       const sweepEvents = this.exteriorRing.getSweepEvents();
24036       for (let i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
24037         const ringSweepEvents = this.interiorRings[i3].getSweepEvents();
24038         for (let j2 = 0, jMax = ringSweepEvents.length; j2 < jMax; j2++) {
24039           sweepEvents.push(ringSweepEvents[j2]);
24040         }
24041       }
24042       return sweepEvents;
24043     }
24044   };
24045   var MultiPolyIn = class {
24046     constructor(geom, isSubject) {
24047       __publicField(this, "isSubject");
24048       __publicField(this, "polys");
24049       __publicField(this, "bbox");
24050       if (!Array.isArray(geom)) {
24051         throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
24052       }
24053       try {
24054         if (typeof geom[0][0][0] === "number")
24055           geom = [geom];
24056       } catch (ex) {
24057       }
24058       this.polys = [];
24059       this.bbox = {
24060         ll: { x: new bignumber_default(Number.POSITIVE_INFINITY), y: new bignumber_default(Number.POSITIVE_INFINITY) },
24061         ur: { x: new bignumber_default(Number.NEGATIVE_INFINITY), y: new bignumber_default(Number.NEGATIVE_INFINITY) }
24062       };
24063       for (let i3 = 0, iMax = geom.length; i3 < iMax; i3++) {
24064         const poly = new PolyIn(geom[i3], this);
24065         if (poly.bbox.ll.x.isLessThan(this.bbox.ll.x))
24066           this.bbox.ll.x = poly.bbox.ll.x;
24067         if (poly.bbox.ll.y.isLessThan(this.bbox.ll.y))
24068           this.bbox.ll.y = poly.bbox.ll.y;
24069         if (poly.bbox.ur.x.isGreaterThan(this.bbox.ur.x))
24070           this.bbox.ur.x = poly.bbox.ur.x;
24071         if (poly.bbox.ur.y.isGreaterThan(this.bbox.ur.y))
24072           this.bbox.ur.y = poly.bbox.ur.y;
24073         this.polys.push(poly);
24074       }
24075       this.isSubject = isSubject;
24076     }
24077     getSweepEvents() {
24078       const sweepEvents = [];
24079       for (let i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
24080         const polySweepEvents = this.polys[i3].getSweepEvents();
24081         for (let j2 = 0, jMax = polySweepEvents.length; j2 < jMax; j2++) {
24082           sweepEvents.push(polySweepEvents[j2]);
24083         }
24084       }
24085       return sweepEvents;
24086     }
24087   };
24088
24089   // node_modules/polyclip-ts/dist/geom-out.js
24090   var RingOut = class _RingOut {
24091     constructor(events) {
24092       __publicField(this, "events");
24093       __publicField(this, "poly");
24094       __publicField(this, "_isExteriorRing");
24095       __publicField(this, "_enclosingRing");
24096       this.events = events;
24097       for (let i3 = 0, iMax = events.length; i3 < iMax; i3++) {
24098         events[i3].segment.ringOut = this;
24099       }
24100       this.poly = null;
24101     }
24102     /* Given the segments from the sweep line pass, compute & return a series
24103      * of closed rings from all the segments marked to be part of the result */
24104     static factory(allSegments) {
24105       const ringsOut = [];
24106       for (let i3 = 0, iMax = allSegments.length; i3 < iMax; i3++) {
24107         const segment = allSegments[i3];
24108         if (!segment.isInResult() || segment.ringOut)
24109           continue;
24110         let prevEvent = null;
24111         let event = segment.leftSE;
24112         let nextEvent = segment.rightSE;
24113         const events = [event];
24114         const startingPoint = event.point;
24115         const intersectionLEs = [];
24116         while (true) {
24117           prevEvent = event;
24118           event = nextEvent;
24119           events.push(event);
24120           if (event.point === startingPoint)
24121             break;
24122           while (true) {
24123             const availableLEs = event.getAvailableLinkedEvents();
24124             if (availableLEs.length === 0) {
24125               const firstPt = events[0].point;
24126               const lastPt = events[events.length - 1].point;
24127               throw new Error("Unable to complete output ring starting at [".concat(firstPt.x, ",") + " ".concat(firstPt.y, "]. Last matching segment found ends at") + " [".concat(lastPt.x, ", ").concat(lastPt.y, "]."));
24128             }
24129             if (availableLEs.length === 1) {
24130               nextEvent = availableLEs[0].otherSE;
24131               break;
24132             }
24133             let indexLE = null;
24134             for (let j2 = 0, jMax = intersectionLEs.length; j2 < jMax; j2++) {
24135               if (intersectionLEs[j2].point === event.point) {
24136                 indexLE = j2;
24137                 break;
24138               }
24139             }
24140             if (indexLE !== null) {
24141               const intersectionLE = intersectionLEs.splice(indexLE)[0];
24142               const ringEvents = events.splice(intersectionLE.index);
24143               ringEvents.unshift(ringEvents[0].otherSE);
24144               ringsOut.push(new _RingOut(ringEvents.reverse()));
24145               continue;
24146             }
24147             intersectionLEs.push({
24148               index: events.length,
24149               point: event.point
24150             });
24151             const comparator = event.getLeftmostComparator(prevEvent);
24152             nextEvent = availableLEs.sort(comparator)[0].otherSE;
24153             break;
24154           }
24155         }
24156         ringsOut.push(new _RingOut(events));
24157       }
24158       return ringsOut;
24159     }
24160     getGeom() {
24161       let prevPt = this.events[0].point;
24162       const points = [prevPt];
24163       for (let i3 = 1, iMax = this.events.length - 1; i3 < iMax; i3++) {
24164         const pt3 = this.events[i3].point;
24165         const nextPt2 = this.events[i3 + 1].point;
24166         if (precision.orient(pt3, prevPt, nextPt2) === 0)
24167           continue;
24168         points.push(pt3);
24169         prevPt = pt3;
24170       }
24171       if (points.length === 1)
24172         return null;
24173       const pt2 = points[0];
24174       const nextPt = points[1];
24175       if (precision.orient(pt2, prevPt, nextPt) === 0)
24176         points.shift();
24177       points.push(points[0]);
24178       const step = this.isExteriorRing() ? 1 : -1;
24179       const iStart = this.isExteriorRing() ? 0 : points.length - 1;
24180       const iEnd = this.isExteriorRing() ? points.length : -1;
24181       const orderedPoints = [];
24182       for (let i3 = iStart; i3 != iEnd; i3 += step)
24183         orderedPoints.push([points[i3].x.toNumber(), points[i3].y.toNumber()]);
24184       return orderedPoints;
24185     }
24186     isExteriorRing() {
24187       if (this._isExteriorRing === void 0) {
24188         const enclosing = this.enclosingRing();
24189         this._isExteriorRing = enclosing ? !enclosing.isExteriorRing() : true;
24190       }
24191       return this._isExteriorRing;
24192     }
24193     enclosingRing() {
24194       if (this._enclosingRing === void 0) {
24195         this._enclosingRing = this._calcEnclosingRing();
24196       }
24197       return this._enclosingRing;
24198     }
24199     /* Returns the ring that encloses this one, if any */
24200     _calcEnclosingRing() {
24201       var _a3, _b3;
24202       let leftMostEvt = this.events[0];
24203       for (let i3 = 1, iMax = this.events.length; i3 < iMax; i3++) {
24204         const evt = this.events[i3];
24205         if (SweepEvent.compare(leftMostEvt, evt) > 0)
24206           leftMostEvt = evt;
24207       }
24208       let prevSeg = leftMostEvt.segment.prevInResult();
24209       let prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
24210       while (true) {
24211         if (!prevSeg)
24212           return null;
24213         if (!prevPrevSeg)
24214           return prevSeg.ringOut;
24215         if (prevPrevSeg.ringOut !== prevSeg.ringOut) {
24216           if (((_a3 = prevPrevSeg.ringOut) == null ? void 0 : _a3.enclosingRing()) !== prevSeg.ringOut) {
24217             return prevSeg.ringOut;
24218           } else
24219             return (_b3 = prevSeg.ringOut) == null ? void 0 : _b3.enclosingRing();
24220         }
24221         prevSeg = prevPrevSeg.prevInResult();
24222         prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
24223       }
24224     }
24225   };
24226   var PolyOut = class {
24227     constructor(exteriorRing) {
24228       __publicField(this, "exteriorRing");
24229       __publicField(this, "interiorRings");
24230       this.exteriorRing = exteriorRing;
24231       exteriorRing.poly = this;
24232       this.interiorRings = [];
24233     }
24234     addInterior(ring) {
24235       this.interiorRings.push(ring);
24236       ring.poly = this;
24237     }
24238     getGeom() {
24239       const geom0 = this.exteriorRing.getGeom();
24240       if (geom0 === null)
24241         return null;
24242       const geom = [geom0];
24243       for (let i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
24244         const ringGeom = this.interiorRings[i3].getGeom();
24245         if (ringGeom === null)
24246           continue;
24247         geom.push(ringGeom);
24248       }
24249       return geom;
24250     }
24251   };
24252   var MultiPolyOut = class {
24253     constructor(rings) {
24254       __publicField(this, "rings");
24255       __publicField(this, "polys");
24256       this.rings = rings;
24257       this.polys = this._composePolys(rings);
24258     }
24259     getGeom() {
24260       const geom = [];
24261       for (let i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
24262         const polyGeom = this.polys[i3].getGeom();
24263         if (polyGeom === null)
24264           continue;
24265         geom.push(polyGeom);
24266       }
24267       return geom;
24268     }
24269     _composePolys(rings) {
24270       var _a3;
24271       const polys = [];
24272       for (let i3 = 0, iMax = rings.length; i3 < iMax; i3++) {
24273         const ring = rings[i3];
24274         if (ring.poly)
24275           continue;
24276         if (ring.isExteriorRing())
24277           polys.push(new PolyOut(ring));
24278         else {
24279           const enclosingRing = ring.enclosingRing();
24280           if (!(enclosingRing == null ? void 0 : enclosingRing.poly))
24281             polys.push(new PolyOut(enclosingRing));
24282           (_a3 = enclosingRing == null ? void 0 : enclosingRing.poly) == null ? void 0 : _a3.addInterior(ring);
24283         }
24284       }
24285       return polys;
24286     }
24287   };
24288
24289   // node_modules/polyclip-ts/dist/sweep-line.js
24290   var SweepLine = class {
24291     constructor(queue, comparator = Segment.compare) {
24292       __publicField(this, "queue");
24293       __publicField(this, "tree");
24294       __publicField(this, "segments");
24295       this.queue = queue;
24296       this.tree = new SplayTreeSet(comparator);
24297       this.segments = [];
24298     }
24299     process(event) {
24300       const segment = event.segment;
24301       const newEvents = [];
24302       if (event.consumedBy) {
24303         if (event.isLeft)
24304           this.queue.delete(event.otherSE);
24305         else
24306           this.tree.delete(segment);
24307         return newEvents;
24308       }
24309       if (event.isLeft)
24310         this.tree.add(segment);
24311       let prevSeg = segment;
24312       let nextSeg = segment;
24313       do {
24314         prevSeg = this.tree.lastBefore(prevSeg);
24315       } while (prevSeg != null && prevSeg.consumedBy != void 0);
24316       do {
24317         nextSeg = this.tree.firstAfter(nextSeg);
24318       } while (nextSeg != null && nextSeg.consumedBy != void 0);
24319       if (event.isLeft) {
24320         let prevMySplitter = null;
24321         if (prevSeg) {
24322           const prevInter = prevSeg.getIntersection(segment);
24323           if (prevInter !== null) {
24324             if (!segment.isAnEndpoint(prevInter))
24325               prevMySplitter = prevInter;
24326             if (!prevSeg.isAnEndpoint(prevInter)) {
24327               const newEventsFromSplit = this._splitSafely(prevSeg, prevInter);
24328               for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
24329                 newEvents.push(newEventsFromSplit[i3]);
24330               }
24331             }
24332           }
24333         }
24334         let nextMySplitter = null;
24335         if (nextSeg) {
24336           const nextInter = nextSeg.getIntersection(segment);
24337           if (nextInter !== null) {
24338             if (!segment.isAnEndpoint(nextInter))
24339               nextMySplitter = nextInter;
24340             if (!nextSeg.isAnEndpoint(nextInter)) {
24341               const newEventsFromSplit = this._splitSafely(nextSeg, nextInter);
24342               for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
24343                 newEvents.push(newEventsFromSplit[i3]);
24344               }
24345             }
24346           }
24347         }
24348         if (prevMySplitter !== null || nextMySplitter !== null) {
24349           let mySplitter = null;
24350           if (prevMySplitter === null)
24351             mySplitter = nextMySplitter;
24352           else if (nextMySplitter === null)
24353             mySplitter = prevMySplitter;
24354           else {
24355             const cmpSplitters = SweepEvent.comparePoints(prevMySplitter, nextMySplitter);
24356             mySplitter = cmpSplitters <= 0 ? prevMySplitter : nextMySplitter;
24357           }
24358           this.queue.delete(segment.rightSE);
24359           newEvents.push(segment.rightSE);
24360           const newEventsFromSplit = segment.split(mySplitter);
24361           for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
24362             newEvents.push(newEventsFromSplit[i3]);
24363           }
24364         }
24365         if (newEvents.length > 0) {
24366           this.tree.delete(segment);
24367           newEvents.push(event);
24368         } else {
24369           this.segments.push(segment);
24370           segment.prev = prevSeg;
24371         }
24372       } else {
24373         if (prevSeg && nextSeg) {
24374           const inter = prevSeg.getIntersection(nextSeg);
24375           if (inter !== null) {
24376             if (!prevSeg.isAnEndpoint(inter)) {
24377               const newEventsFromSplit = this._splitSafely(prevSeg, inter);
24378               for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
24379                 newEvents.push(newEventsFromSplit[i3]);
24380               }
24381             }
24382             if (!nextSeg.isAnEndpoint(inter)) {
24383               const newEventsFromSplit = this._splitSafely(nextSeg, inter);
24384               for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
24385                 newEvents.push(newEventsFromSplit[i3]);
24386               }
24387             }
24388           }
24389         }
24390         this.tree.delete(segment);
24391       }
24392       return newEvents;
24393     }
24394     /* Safely split a segment that is currently in the datastructures
24395      * IE - a segment other than the one that is currently being processed. */
24396     _splitSafely(seg, pt2) {
24397       this.tree.delete(seg);
24398       const rightSE = seg.rightSE;
24399       this.queue.delete(rightSE);
24400       const newEvents = seg.split(pt2);
24401       newEvents.push(rightSE);
24402       if (seg.consumedBy === void 0)
24403         this.tree.add(seg);
24404       return newEvents;
24405     }
24406   };
24407
24408   // node_modules/polyclip-ts/dist/operation.js
24409   var Operation = class {
24410     constructor() {
24411       __publicField(this, "type");
24412       __publicField(this, "numMultiPolys");
24413     }
24414     run(type2, geom, moreGeoms) {
24415       operation.type = type2;
24416       const multipolys = [new MultiPolyIn(geom, true)];
24417       for (let i3 = 0, iMax = moreGeoms.length; i3 < iMax; i3++) {
24418         multipolys.push(new MultiPolyIn(moreGeoms[i3], false));
24419       }
24420       operation.numMultiPolys = multipolys.length;
24421       if (operation.type === "difference") {
24422         const subject = multipolys[0];
24423         let i3 = 1;
24424         while (i3 < multipolys.length) {
24425           if (getBboxOverlap(multipolys[i3].bbox, subject.bbox) !== null)
24426             i3++;
24427           else
24428             multipolys.splice(i3, 1);
24429         }
24430       }
24431       if (operation.type === "intersection") {
24432         for (let i3 = 0, iMax = multipolys.length; i3 < iMax; i3++) {
24433           const mpA = multipolys[i3];
24434           for (let j2 = i3 + 1, jMax = multipolys.length; j2 < jMax; j2++) {
24435             if (getBboxOverlap(mpA.bbox, multipolys[j2].bbox) === null)
24436               return [];
24437           }
24438         }
24439       }
24440       const queue = new SplayTreeSet(SweepEvent.compare);
24441       for (let i3 = 0, iMax = multipolys.length; i3 < iMax; i3++) {
24442         const sweepEvents = multipolys[i3].getSweepEvents();
24443         for (let j2 = 0, jMax = sweepEvents.length; j2 < jMax; j2++) {
24444           queue.add(sweepEvents[j2]);
24445         }
24446       }
24447       const sweepLine = new SweepLine(queue);
24448       let evt = null;
24449       if (queue.size != 0) {
24450         evt = queue.first();
24451         queue.delete(evt);
24452       }
24453       while (evt) {
24454         const newEvents = sweepLine.process(evt);
24455         for (let i3 = 0, iMax = newEvents.length; i3 < iMax; i3++) {
24456           const evt2 = newEvents[i3];
24457           if (evt2.consumedBy === void 0)
24458             queue.add(evt2);
24459         }
24460         if (queue.size != 0) {
24461           evt = queue.first();
24462           queue.delete(evt);
24463         } else {
24464           evt = null;
24465         }
24466       }
24467       precision.reset();
24468       const ringsOut = RingOut.factory(sweepLine.segments);
24469       const result = new MultiPolyOut(ringsOut);
24470       return result.getGeom();
24471     }
24472   };
24473   var operation = new Operation();
24474   var operation_default = operation;
24475
24476   // node_modules/polyclip-ts/dist/index.js
24477   var union = (geom, ...moreGeoms) => operation_default.run("union", geom, moreGeoms);
24478   var difference = (geom, ...moreGeoms) => operation_default.run("difference", geom, moreGeoms);
24479   var setPrecision = precision.set;
24480
24481   // node_modules/@rapideditor/location-conflation/index.mjs
24482   var import_geojson_area = __toESM(require_geojson_area(), 1);
24483   var import_circle_to_polygon = __toESM(require_circle_to_polygon(), 1);
24484   var import_geojson_precision = __toESM(require_geojson_precision(), 1);
24485   var import_json_stringify_pretty_compact = __toESM(require_json_stringify_pretty_compact(), 1);
24486   var LocationConflation = class {
24487     // constructor
24488     //
24489     // `fc`  Optional FeatureCollection of known features
24490     //
24491     // Optionally pass a GeoJSON FeatureCollection of known features which we can refer to later.
24492     // Each feature must have a filename-like `id`, for example: `something.geojson`
24493     //
24494     // {
24495     //   "type": "FeatureCollection"
24496     //   "features": [
24497     //     {
24498     //       "type": "Feature",
24499     //       "id": "philly_metro.geojson",
24500     //       "properties": { … },
24501     //       "geometry": { … }
24502     //     }
24503     //   ]
24504     // }
24505     constructor(fc) {
24506       this._cache = {};
24507       this.strict = true;
24508       if (fc && fc.type === "FeatureCollection" && Array.isArray(fc.features)) {
24509         fc.features.forEach((feature3) => {
24510           feature3.properties = feature3.properties || {};
24511           let props = feature3.properties;
24512           let id2 = feature3.id || props.id;
24513           if (!id2 || !/^\S+\.geojson$/i.test(id2)) return;
24514           id2 = id2.toLowerCase();
24515           feature3.id = id2;
24516           props.id = id2;
24517           if (!props.area) {
24518             const area = import_geojson_area.default.geometry(feature3.geometry) / 1e6;
24519             props.area = Number(area.toFixed(2));
24520           }
24521           this._cache[id2] = feature3;
24522         });
24523       }
24524       let world = _cloneDeep(feature("Q2"));
24525       world.geometry = {
24526         type: "Polygon",
24527         coordinates: [[[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]]]
24528       };
24529       world.id = "Q2";
24530       world.properties.id = "Q2";
24531       world.properties.area = import_geojson_area.default.geometry(world.geometry) / 1e6;
24532       this._cache.Q2 = world;
24533     }
24534     // validateLocation
24535     // `location`  The location to validate
24536     //
24537     // Pass a `location` value to validate
24538     //
24539     // Returns a result like:
24540     //   {
24541     //     type:     'point', 'geojson', or 'countrycoder'
24542     //     location:  the queried location
24543     //     id:        the stable identifier for the feature
24544     //   }
24545     // or `null` if the location is invalid
24546     //
24547     validateLocation(location) {
24548       if (Array.isArray(location) && (location.length === 2 || location.length === 3)) {
24549         const lon = location[0];
24550         const lat = location[1];
24551         const radius = location[2];
24552         if (Number.isFinite(lon) && lon >= -180 && lon <= 180 && Number.isFinite(lat) && lat >= -90 && lat <= 90 && (location.length === 2 || Number.isFinite(radius) && radius > 0)) {
24553           const id2 = "[" + location.toString() + "]";
24554           return { type: "point", location, id: id2 };
24555         }
24556       } else if (typeof location === "string" && /^\S+\.geojson$/i.test(location)) {
24557         const id2 = location.toLowerCase();
24558         if (this._cache[id2]) {
24559           return { type: "geojson", location, id: id2 };
24560         }
24561       } else if (typeof location === "string" || typeof location === "number") {
24562         const feature3 = feature(location);
24563         if (feature3) {
24564           const id2 = feature3.properties.wikidata;
24565           return { type: "countrycoder", location, id: id2 };
24566         }
24567       }
24568       if (this.strict) {
24569         throw new Error('validateLocation:  Invalid location: "'.concat(location, '".'));
24570       } else {
24571         return null;
24572       }
24573     }
24574     // resolveLocation
24575     // `location`  The location to resolve
24576     //
24577     // Pass a `location` value to resolve
24578     //
24579     // Returns a result like:
24580     //   {
24581     //     type:      'point', 'geojson', or 'countrycoder'
24582     //     location:  the queried location
24583     //     id:        a stable identifier for the feature
24584     //     feature:   the resolved GeoJSON feature
24585     //   }
24586     //  or `null` if the location is invalid
24587     //
24588     resolveLocation(location) {
24589       const valid = this.validateLocation(location);
24590       if (!valid) return null;
24591       const id2 = valid.id;
24592       if (this._cache[id2]) {
24593         return Object.assign(valid, { feature: this._cache[id2] });
24594       }
24595       if (valid.type === "point") {
24596         const lon = location[0];
24597         const lat = location[1];
24598         const radius = location[2] || 25;
24599         const EDGES = 10;
24600         const PRECISION = 3;
24601         const area = Math.PI * radius * radius;
24602         const feature3 = this._cache[id2] = (0, import_geojson_precision.default)({
24603           type: "Feature",
24604           id: id2,
24605           properties: { id: id2, area: Number(area.toFixed(2)) },
24606           geometry: (0, import_circle_to_polygon.default)([lon, lat], radius * 1e3, EDGES)
24607           // km to m
24608         }, PRECISION);
24609         return Object.assign(valid, { feature: feature3 });
24610       } else if (valid.type === "geojson") {
24611       } else if (valid.type === "countrycoder") {
24612         let feature3 = _cloneDeep(feature(id2));
24613         let props = feature3.properties;
24614         if (Array.isArray(props.members)) {
24615           let aggregate = aggregateFeature(id2);
24616           aggregate.geometry.coordinates = _clip([aggregate], "UNION").geometry.coordinates;
24617           feature3.geometry = aggregate.geometry;
24618         }
24619         if (!props.area) {
24620           const area = import_geojson_area.default.geometry(feature3.geometry) / 1e6;
24621           props.area = Number(area.toFixed(2));
24622         }
24623         feature3.id = id2;
24624         props.id = id2;
24625         this._cache[id2] = feature3;
24626         return Object.assign(valid, { feature: feature3 });
24627       }
24628       if (this.strict) {
24629         throw new Error("resolveLocation:  Couldn't resolve location \"".concat(location, '".'));
24630       } else {
24631         return null;
24632       }
24633     }
24634     // validateLocationSet
24635     // `locationSet`  the locationSet to validate
24636     //
24637     // Pass a locationSet Object to validate like:
24638     //   {
24639     //     include: [ Array of locations ],
24640     //     exclude: [ Array of locations ]
24641     //   }
24642     //
24643     // Returns a result like:
24644     //   {
24645     //     type:         'locationset'
24646     //     locationSet:  the queried locationSet
24647     //     id:           the stable identifier for the feature
24648     //   }
24649     // or `null` if the locationSet is invalid
24650     //
24651     validateLocationSet(locationSet) {
24652       locationSet = locationSet || {};
24653       const validator = this.validateLocation.bind(this);
24654       let include = (locationSet.include || []).map(validator).filter(Boolean);
24655       let exclude = (locationSet.exclude || []).map(validator).filter(Boolean);
24656       if (!include.length) {
24657         if (this.strict) {
24658           throw new Error("validateLocationSet:  LocationSet includes nothing.");
24659         } else {
24660           locationSet.include = ["Q2"];
24661           include = [{ type: "countrycoder", location: "Q2", id: "Q2" }];
24662         }
24663       }
24664       include.sort(_sortLocations);
24665       let id2 = "+[" + include.map((d2) => d2.id).join(",") + "]";
24666       if (exclude.length) {
24667         exclude.sort(_sortLocations);
24668         id2 += "-[" + exclude.map((d2) => d2.id).join(",") + "]";
24669       }
24670       return { type: "locationset", locationSet, id: id2 };
24671     }
24672     // resolveLocationSet
24673     // `locationSet`  the locationSet to resolve
24674     //
24675     // Pass a locationSet Object to validate like:
24676     //   {
24677     //     include: [ Array of locations ],
24678     //     exclude: [ Array of locations ]
24679     //   }
24680     //
24681     // Returns a result like:
24682     //   {
24683     //     type:         'locationset'
24684     //     locationSet:  the queried locationSet
24685     //     id:           the stable identifier for the feature
24686     //     feature:      the resolved GeoJSON feature
24687     //   }
24688     // or `null` if the locationSet is invalid
24689     //
24690     resolveLocationSet(locationSet) {
24691       locationSet = locationSet || {};
24692       const valid = this.validateLocationSet(locationSet);
24693       if (!valid) return null;
24694       const id2 = valid.id;
24695       if (this._cache[id2]) {
24696         return Object.assign(valid, { feature: this._cache[id2] });
24697       }
24698       const resolver = this.resolveLocation.bind(this);
24699       const includes = (locationSet.include || []).map(resolver).filter(Boolean);
24700       const excludes = (locationSet.exclude || []).map(resolver).filter(Boolean);
24701       if (includes.length === 1 && excludes.length === 0) {
24702         return Object.assign(valid, { feature: includes[0].feature });
24703       }
24704       const includeGeoJSON = _clip(includes.map((d2) => d2.feature), "UNION");
24705       const excludeGeoJSON = _clip(excludes.map((d2) => d2.feature), "UNION");
24706       let resultGeoJSON = excludeGeoJSON ? _clip([includeGeoJSON, excludeGeoJSON], "DIFFERENCE") : includeGeoJSON;
24707       const area = import_geojson_area.default.geometry(resultGeoJSON.geometry) / 1e6;
24708       resultGeoJSON.id = id2;
24709       resultGeoJSON.properties = { id: id2, area: Number(area.toFixed(2)) };
24710       this._cache[id2] = resultGeoJSON;
24711       return Object.assign(valid, { feature: resultGeoJSON });
24712     }
24713     // stringify
24714     // convenience method to prettyStringify the given object
24715     stringify(obj, options2) {
24716       return (0, import_json_stringify_pretty_compact.default)(obj, options2);
24717     }
24718   };
24719   function _clip(features, which) {
24720     if (!Array.isArray(features) || !features.length) return null;
24721     const fn = { UNION: union, DIFFERENCE: difference }[which];
24722     const args = features.map((feature3) => feature3.geometry.coordinates);
24723     const coords = fn.apply(null, args);
24724     return {
24725       type: "Feature",
24726       properties: {},
24727       geometry: {
24728         type: whichType(coords),
24729         coordinates: coords
24730       }
24731     };
24732     function whichType(coords2) {
24733       const a2 = Array.isArray(coords2);
24734       const b2 = a2 && Array.isArray(coords2[0]);
24735       const c2 = b2 && Array.isArray(coords2[0][0]);
24736       const d2 = c2 && Array.isArray(coords2[0][0][0]);
24737       return d2 ? "MultiPolygon" : "Polygon";
24738     }
24739   }
24740   function _cloneDeep(obj) {
24741     return JSON.parse(JSON.stringify(obj));
24742   }
24743   function _sortLocations(a2, b2) {
24744     const rank = { countrycoder: 1, geojson: 2, point: 3 };
24745     const aRank = rank[a2.type];
24746     const bRank = rank[b2.type];
24747     return aRank > bRank ? 1 : aRank < bRank ? -1 : a2.id.localeCompare(b2.id);
24748   }
24749
24750   // modules/core/LocationManager.js
24751   var import_which_polygon2 = __toESM(require_which_polygon());
24752   var import_geojson_area2 = __toESM(require_geojson_area());
24753   var _loco = new LocationConflation();
24754   var LocationManager = class {
24755     /**
24756      * @constructor
24757      */
24758     constructor() {
24759       this._wp = null;
24760       this._resolved = /* @__PURE__ */ new Map();
24761       this._knownLocationSets = /* @__PURE__ */ new Map();
24762       this._locationIncludedIn = /* @__PURE__ */ new Map();
24763       this._locationExcludedIn = /* @__PURE__ */ new Map();
24764       const world = { locationSet: { include: ["Q2"] } };
24765       this._resolveLocationSet(world);
24766       this._rebuildIndex();
24767     }
24768     /**
24769      * _validateLocationSet
24770      * Pass an Object with a `locationSet` property.
24771      * Validates the `locationSet` and sets a `locationSetID` property on the object.
24772      * To avoid so much computation we only resolve the include and exclude regions, but not the locationSet itself.
24773      *
24774      * Use `_resolveLocationSet()` instead if you need to resolve geojson of locationSet, for example to render it.
24775      * Note: You need to call `_rebuildIndex()` after you're all finished validating the locationSets.
24776      *
24777      * @param  `obj`  Object to check, it should have `locationSet` property
24778      */
24779     _validateLocationSet(obj) {
24780       if (obj.locationSetID) return;
24781       try {
24782         let locationSet = obj.locationSet;
24783         if (!locationSet) {
24784           throw new Error("object missing locationSet property");
24785         }
24786         if (!locationSet.include) {
24787           locationSet.include = ["Q2"];
24788         }
24789         const locationSetID = _loco.validateLocationSet(locationSet).id;
24790         obj.locationSetID = locationSetID;
24791         if (this._knownLocationSets.has(locationSetID)) return;
24792         let area = 0;
24793         (locationSet.include || []).forEach((location) => {
24794           const locationID = _loco.validateLocation(location).id;
24795           let geojson = this._resolved.get(locationID);
24796           if (!geojson) {
24797             geojson = _loco.resolveLocation(location).feature;
24798             this._resolved.set(locationID, geojson);
24799           }
24800           area += geojson.properties.area;
24801           let s2 = this._locationIncludedIn.get(locationID);
24802           if (!s2) {
24803             s2 = /* @__PURE__ */ new Set();
24804             this._locationIncludedIn.set(locationID, s2);
24805           }
24806           s2.add(locationSetID);
24807         });
24808         (locationSet.exclude || []).forEach((location) => {
24809           const locationID = _loco.validateLocation(location).id;
24810           let geojson = this._resolved.get(locationID);
24811           if (!geojson) {
24812             geojson = _loco.resolveLocation(location).feature;
24813             this._resolved.set(locationID, geojson);
24814           }
24815           area -= geojson.properties.area;
24816           let s2 = this._locationExcludedIn.get(locationID);
24817           if (!s2) {
24818             s2 = /* @__PURE__ */ new Set();
24819             this._locationExcludedIn.set(locationID, s2);
24820           }
24821           s2.add(locationSetID);
24822         });
24823         this._knownLocationSets.set(locationSetID, area);
24824       } catch {
24825         obj.locationSet = { include: ["Q2"] };
24826         obj.locationSetID = "+[Q2]";
24827       }
24828     }
24829     /**
24830      * _resolveLocationSet
24831      * Does everything that `_validateLocationSet()` does, but then "resolves" the locationSet into GeoJSON.
24832      * This step is a bit more computationally expensive, so really only needed if you intend to render the shape.
24833      *
24834      * Note: You need to call `_rebuildIndex()` after you're all finished validating the locationSets.
24835      *
24836      * @param  `obj`  Object to check, it should have `locationSet` property
24837      */
24838     _resolveLocationSet(obj) {
24839       this._validateLocationSet(obj);
24840       if (this._resolved.has(obj.locationSetID)) return;
24841       try {
24842         const result = _loco.resolveLocationSet(obj.locationSet);
24843         const locationSetID = result.id;
24844         obj.locationSetID = locationSetID;
24845         if (!result.feature.geometry.coordinates.length || !result.feature.properties.area) {
24846           throw new Error("locationSet ".concat(locationSetID, " resolves to an empty feature."));
24847         }
24848         let geojson = JSON.parse(JSON.stringify(result.feature));
24849         geojson.id = locationSetID;
24850         geojson.properties.id = locationSetID;
24851         this._resolved.set(locationSetID, geojson);
24852       } catch {
24853         obj.locationSet = { include: ["Q2"] };
24854         obj.locationSetID = "+[Q2]";
24855       }
24856     }
24857     /**
24858      * _rebuildIndex
24859      * Rebuilds the whichPolygon index with whatever features have been resolved into GeoJSON.
24860      */
24861     _rebuildIndex() {
24862       this._wp = (0, import_which_polygon2.default)({ features: [...this._resolved.values()] });
24863     }
24864     /**
24865      * mergeCustomGeoJSON
24866      * Accepts a FeatureCollection-like object containing custom locations
24867      * Each feature must have a filename-like `id`, for example: `something.geojson`
24868      * {
24869      *   "type": "FeatureCollection"
24870      *   "features": [
24871      *     {
24872      *       "type": "Feature",
24873      *       "id": "philly_metro.geojson",
24874      *       "properties": { … },
24875      *       "geometry": { … }
24876      *     }
24877      *   ]
24878      * }
24879      *
24880      * @param  `fc`  FeatureCollection-like Object containing custom locations
24881      */
24882     mergeCustomGeoJSON(fc) {
24883       if (!fc || fc.type !== "FeatureCollection" || !Array.isArray(fc.features)) return;
24884       fc.features.forEach((feature3) => {
24885         feature3.properties = feature3.properties || {};
24886         let props = feature3.properties;
24887         let id2 = feature3.id || props.id;
24888         if (!id2 || !/^\S+\.geojson$/i.test(id2)) return;
24889         id2 = id2.toLowerCase();
24890         feature3.id = id2;
24891         props.id = id2;
24892         if (!props.area) {
24893           const area = import_geojson_area2.default.geometry(feature3.geometry) / 1e6;
24894           props.area = Number(area.toFixed(2));
24895         }
24896         _loco._cache[id2] = feature3;
24897       });
24898     }
24899     /**
24900      * mergeLocationSets
24901      * Accepts an Array of Objects containing `locationSet` properties:
24902      * [
24903      *  { id: 'preset1', locationSet: {…} },
24904      *  { id: 'preset2', locationSet: {…} },
24905      *  …
24906      * ]
24907      * After validating, the Objects will be decorated with a `locationSetID` property:
24908      * [
24909      *  { id: 'preset1', locationSet: {…}, locationSetID: '+[Q2]' },
24910      *  { id: 'preset2', locationSet: {…}, locationSetID: '+[Q30]' },
24911      *  …
24912      * ]
24913      *
24914      * @param  `objects`  Objects to check - they should have `locationSet` property
24915      * @return  Promise resolved true (this function used to be slow/async, now it's faster and sync)
24916      */
24917     mergeLocationSets(objects) {
24918       if (!Array.isArray(objects)) return Promise.reject("nothing to do");
24919       objects.forEach((obj) => this._validateLocationSet(obj));
24920       this._rebuildIndex();
24921       return Promise.resolve(objects);
24922     }
24923     /**
24924      * locationSetID
24925      * Returns a locationSetID for a given locationSet (fallback to `+[Q2]`, world)
24926      * (The locationSet doesn't necessarily need to be resolved to compute its `id`)
24927      *
24928      * @param  `locationSet`  A locationSet Object, e.g. `{ include: ['us'] }`
24929      * @return  String locationSetID, e.g. `+[Q30]`
24930      */
24931     locationSetID(locationSet) {
24932       let locationSetID;
24933       try {
24934         locationSetID = _loco.validateLocationSet(locationSet).id;
24935       } catch {
24936         locationSetID = "+[Q2]";
24937       }
24938       return locationSetID;
24939     }
24940     /**
24941      * feature
24942      * Returns the resolved GeoJSON feature for a given locationSetID (fallback to 'world')
24943      * A GeoJSON feature:
24944      * {
24945      *   type: 'Feature',
24946      *   id: '+[Q30]',
24947      *   properties: { id: '+[Q30]', area: 21817019.17, … },
24948      *   geometry: { … }
24949      * }
24950      *
24951      * @param  `locationSetID`  String identifier, e.g. `+[Q30]`
24952      * @return  GeoJSON object (fallback to world)
24953      */
24954     feature(locationSetID = "+[Q2]") {
24955       const feature3 = this._resolved.get(locationSetID);
24956       return feature3 || this._resolved.get("+[Q2]");
24957     }
24958     /**
24959      * locationSetsAt
24960      * Find all the locationSets valid at the given location.
24961      * Results include the area (in km²) to facilitate sorting.
24962      *
24963      * Object of locationSetIDs to areas (in km²)
24964      * {
24965      *   "+[Q2]": 511207893.3958111,
24966      *   "+[Q30]": 21817019.17,
24967      *   "+[new_jersey.geojson]": 22390.77,
24968      *   …
24969      * }
24970      *
24971      * @param  `loc`  `[lon,lat]` location to query, e.g. `[-74.4813, 40.7967]`
24972      * @return  Object of locationSetIDs valid at given location
24973      */
24974     locationSetsAt(loc) {
24975       let result = {};
24976       const hits = this._wp(loc, true) || [];
24977       const thiz = this;
24978       hits.forEach((prop) => {
24979         if (prop.id[0] !== "+") return;
24980         const locationSetID = prop.id;
24981         const area = thiz._knownLocationSets.get(locationSetID);
24982         if (area) {
24983           result[locationSetID] = area;
24984         }
24985       });
24986       hits.forEach((prop) => {
24987         if (prop.id[0] === "+") return;
24988         const locationID = prop.id;
24989         const included = thiz._locationIncludedIn.get(locationID);
24990         (included || []).forEach((locationSetID) => {
24991           const area = thiz._knownLocationSets.get(locationSetID);
24992           if (area) {
24993             result[locationSetID] = area;
24994           }
24995         });
24996       });
24997       hits.forEach((prop) => {
24998         if (prop.id[0] === "+") return;
24999         const locationID = prop.id;
25000         const excluded = thiz._locationExcludedIn.get(locationID);
25001         (excluded || []).forEach((locationSetID) => {
25002           delete result[locationSetID];
25003         });
25004       });
25005       return result;
25006     }
25007     // Direct access to the location-conflation resolver
25008     loco() {
25009       return _loco;
25010     }
25011   };
25012   var _sharedLocationManager = new LocationManager();
25013
25014   // node_modules/lodash-es/_freeGlobal.js
25015   var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
25016   var freeGlobal_default = freeGlobal;
25017
25018   // node_modules/lodash-es/_root.js
25019   var freeSelf = typeof self == "object" && self && self.Object === Object && self;
25020   var root2 = freeGlobal_default || freeSelf || Function("return this")();
25021   var root_default = root2;
25022
25023   // node_modules/lodash-es/_Symbol.js
25024   var Symbol2 = root_default.Symbol;
25025   var Symbol_default = Symbol2;
25026
25027   // node_modules/lodash-es/_getRawTag.js
25028   var objectProto = Object.prototype;
25029   var hasOwnProperty = objectProto.hasOwnProperty;
25030   var nativeObjectToString = objectProto.toString;
25031   var symToStringTag = Symbol_default ? Symbol_default.toStringTag : void 0;
25032   function getRawTag(value) {
25033     var isOwn = hasOwnProperty.call(value, symToStringTag), tag2 = value[symToStringTag];
25034     try {
25035       value[symToStringTag] = void 0;
25036       var unmasked = true;
25037     } catch (e3) {
25038     }
25039     var result = nativeObjectToString.call(value);
25040     if (unmasked) {
25041       if (isOwn) {
25042         value[symToStringTag] = tag2;
25043       } else {
25044         delete value[symToStringTag];
25045       }
25046     }
25047     return result;
25048   }
25049   var getRawTag_default = getRawTag;
25050
25051   // node_modules/lodash-es/_objectToString.js
25052   var objectProto2 = Object.prototype;
25053   var nativeObjectToString2 = objectProto2.toString;
25054   function objectToString(value) {
25055     return nativeObjectToString2.call(value);
25056   }
25057   var objectToString_default = objectToString;
25058
25059   // node_modules/lodash-es/_baseGetTag.js
25060   var nullTag = "[object Null]";
25061   var undefinedTag = "[object Undefined]";
25062   var symToStringTag2 = Symbol_default ? Symbol_default.toStringTag : void 0;
25063   function baseGetTag(value) {
25064     if (value == null) {
25065       return value === void 0 ? undefinedTag : nullTag;
25066     }
25067     return symToStringTag2 && symToStringTag2 in Object(value) ? getRawTag_default(value) : objectToString_default(value);
25068   }
25069   var baseGetTag_default = baseGetTag;
25070
25071   // node_modules/lodash-es/isObjectLike.js
25072   function isObjectLike(value) {
25073     return value != null && typeof value == "object";
25074   }
25075   var isObjectLike_default = isObjectLike;
25076
25077   // node_modules/lodash-es/isSymbol.js
25078   var symbolTag = "[object Symbol]";
25079   function isSymbol(value) {
25080     return typeof value == "symbol" || isObjectLike_default(value) && baseGetTag_default(value) == symbolTag;
25081   }
25082   var isSymbol_default = isSymbol;
25083
25084   // node_modules/lodash-es/_arrayMap.js
25085   function arrayMap(array2, iteratee) {
25086     var index = -1, length2 = array2 == null ? 0 : array2.length, result = Array(length2);
25087     while (++index < length2) {
25088       result[index] = iteratee(array2[index], index, array2);
25089     }
25090     return result;
25091   }
25092   var arrayMap_default = arrayMap;
25093
25094   // node_modules/lodash-es/isArray.js
25095   var isArray = Array.isArray;
25096   var isArray_default = isArray;
25097
25098   // node_modules/lodash-es/_baseToString.js
25099   var INFINITY = 1 / 0;
25100   var symbolProto = Symbol_default ? Symbol_default.prototype : void 0;
25101   var symbolToString = symbolProto ? symbolProto.toString : void 0;
25102   function baseToString(value) {
25103     if (typeof value == "string") {
25104       return value;
25105     }
25106     if (isArray_default(value)) {
25107       return arrayMap_default(value, baseToString) + "";
25108     }
25109     if (isSymbol_default(value)) {
25110       return symbolToString ? symbolToString.call(value) : "";
25111     }
25112     var result = value + "";
25113     return result == "0" && 1 / value == -INFINITY ? "-0" : result;
25114   }
25115   var baseToString_default = baseToString;
25116
25117   // node_modules/lodash-es/_trimmedEndIndex.js
25118   var reWhitespace = /\s/;
25119   function trimmedEndIndex(string) {
25120     var index = string.length;
25121     while (index-- && reWhitespace.test(string.charAt(index))) {
25122     }
25123     return index;
25124   }
25125   var trimmedEndIndex_default = trimmedEndIndex;
25126
25127   // node_modules/lodash-es/_baseTrim.js
25128   var reTrimStart = /^\s+/;
25129   function baseTrim(string) {
25130     return string ? string.slice(0, trimmedEndIndex_default(string) + 1).replace(reTrimStart, "") : string;
25131   }
25132   var baseTrim_default = baseTrim;
25133
25134   // node_modules/lodash-es/isObject.js
25135   function isObject(value) {
25136     var type2 = typeof value;
25137     return value != null && (type2 == "object" || type2 == "function");
25138   }
25139   var isObject_default = isObject;
25140
25141   // node_modules/lodash-es/toNumber.js
25142   var NAN = 0 / 0;
25143   var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
25144   var reIsBinary = /^0b[01]+$/i;
25145   var reIsOctal = /^0o[0-7]+$/i;
25146   var freeParseInt = parseInt;
25147   function toNumber(value) {
25148     if (typeof value == "number") {
25149       return value;
25150     }
25151     if (isSymbol_default(value)) {
25152       return NAN;
25153     }
25154     if (isObject_default(value)) {
25155       var other = typeof value.valueOf == "function" ? value.valueOf() : value;
25156       value = isObject_default(other) ? other + "" : other;
25157     }
25158     if (typeof value != "string") {
25159       return value === 0 ? value : +value;
25160     }
25161     value = baseTrim_default(value);
25162     var isBinary = reIsBinary.test(value);
25163     return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
25164   }
25165   var toNumber_default = toNumber;
25166
25167   // node_modules/lodash-es/isFunction.js
25168   var asyncTag = "[object AsyncFunction]";
25169   var funcTag = "[object Function]";
25170   var genTag = "[object GeneratorFunction]";
25171   var proxyTag = "[object Proxy]";
25172   function isFunction(value) {
25173     if (!isObject_default(value)) {
25174       return false;
25175     }
25176     var tag2 = baseGetTag_default(value);
25177     return tag2 == funcTag || tag2 == genTag || tag2 == asyncTag || tag2 == proxyTag;
25178   }
25179   var isFunction_default = isFunction;
25180
25181   // node_modules/lodash-es/_coreJsData.js
25182   var coreJsData = root_default["__core-js_shared__"];
25183   var coreJsData_default = coreJsData;
25184
25185   // node_modules/lodash-es/_isMasked.js
25186   var maskSrcKey = function() {
25187     var uid = /[^.]+$/.exec(coreJsData_default && coreJsData_default.keys && coreJsData_default.keys.IE_PROTO || "");
25188     return uid ? "Symbol(src)_1." + uid : "";
25189   }();
25190   function isMasked(func) {
25191     return !!maskSrcKey && maskSrcKey in func;
25192   }
25193   var isMasked_default = isMasked;
25194
25195   // node_modules/lodash-es/_toSource.js
25196   var funcProto = Function.prototype;
25197   var funcToString = funcProto.toString;
25198   function toSource(func) {
25199     if (func != null) {
25200       try {
25201         return funcToString.call(func);
25202       } catch (e3) {
25203       }
25204       try {
25205         return func + "";
25206       } catch (e3) {
25207       }
25208     }
25209     return "";
25210   }
25211   var toSource_default = toSource;
25212
25213   // node_modules/lodash-es/_baseIsNative.js
25214   var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
25215   var reIsHostCtor = /^\[object .+?Constructor\]$/;
25216   var funcProto2 = Function.prototype;
25217   var objectProto3 = Object.prototype;
25218   var funcToString2 = funcProto2.toString;
25219   var hasOwnProperty2 = objectProto3.hasOwnProperty;
25220   var reIsNative = RegExp(
25221     "^" + funcToString2.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
25222   );
25223   function baseIsNative(value) {
25224     if (!isObject_default(value) || isMasked_default(value)) {
25225       return false;
25226     }
25227     var pattern = isFunction_default(value) ? reIsNative : reIsHostCtor;
25228     return pattern.test(toSource_default(value));
25229   }
25230   var baseIsNative_default = baseIsNative;
25231
25232   // node_modules/lodash-es/_getValue.js
25233   function getValue(object, key) {
25234     return object == null ? void 0 : object[key];
25235   }
25236   var getValue_default = getValue;
25237
25238   // node_modules/lodash-es/_getNative.js
25239   function getNative(object, key) {
25240     var value = getValue_default(object, key);
25241     return baseIsNative_default(value) ? value : void 0;
25242   }
25243   var getNative_default = getNative;
25244
25245   // node_modules/lodash-es/_WeakMap.js
25246   var WeakMap = getNative_default(root_default, "WeakMap");
25247   var WeakMap_default = WeakMap;
25248
25249   // node_modules/lodash-es/_isIndex.js
25250   var MAX_SAFE_INTEGER2 = 9007199254740991;
25251   var reIsUint = /^(?:0|[1-9]\d*)$/;
25252   function isIndex(value, length2) {
25253     var type2 = typeof value;
25254     length2 = length2 == null ? MAX_SAFE_INTEGER2 : length2;
25255     return !!length2 && (type2 == "number" || type2 != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length2);
25256   }
25257   var isIndex_default = isIndex;
25258
25259   // node_modules/lodash-es/eq.js
25260   function eq(value, other) {
25261     return value === other || value !== value && other !== other;
25262   }
25263   var eq_default = eq;
25264
25265   // node_modules/lodash-es/isLength.js
25266   var MAX_SAFE_INTEGER3 = 9007199254740991;
25267   function isLength(value) {
25268     return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER3;
25269   }
25270   var isLength_default = isLength;
25271
25272   // node_modules/lodash-es/isArrayLike.js
25273   function isArrayLike(value) {
25274     return value != null && isLength_default(value.length) && !isFunction_default(value);
25275   }
25276   var isArrayLike_default = isArrayLike;
25277
25278   // node_modules/lodash-es/_isPrototype.js
25279   var objectProto4 = Object.prototype;
25280   function isPrototype(value) {
25281     var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto4;
25282     return value === proto;
25283   }
25284   var isPrototype_default = isPrototype;
25285
25286   // node_modules/lodash-es/_baseTimes.js
25287   function baseTimes(n3, iteratee) {
25288     var index = -1, result = Array(n3);
25289     while (++index < n3) {
25290       result[index] = iteratee(index);
25291     }
25292     return result;
25293   }
25294   var baseTimes_default = baseTimes;
25295
25296   // node_modules/lodash-es/_baseIsArguments.js
25297   var argsTag = "[object Arguments]";
25298   function baseIsArguments(value) {
25299     return isObjectLike_default(value) && baseGetTag_default(value) == argsTag;
25300   }
25301   var baseIsArguments_default = baseIsArguments;
25302
25303   // node_modules/lodash-es/isArguments.js
25304   var objectProto5 = Object.prototype;
25305   var hasOwnProperty3 = objectProto5.hasOwnProperty;
25306   var propertyIsEnumerable = objectProto5.propertyIsEnumerable;
25307   var isArguments = baseIsArguments_default(/* @__PURE__ */ function() {
25308     return arguments;
25309   }()) ? baseIsArguments_default : function(value) {
25310     return isObjectLike_default(value) && hasOwnProperty3.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
25311   };
25312   var isArguments_default = isArguments;
25313
25314   // node_modules/lodash-es/stubFalse.js
25315   function stubFalse() {
25316     return false;
25317   }
25318   var stubFalse_default = stubFalse;
25319
25320   // node_modules/lodash-es/isBuffer.js
25321   var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
25322   var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
25323   var moduleExports = freeModule && freeModule.exports === freeExports;
25324   var Buffer2 = moduleExports ? root_default.Buffer : void 0;
25325   var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
25326   var isBuffer = nativeIsBuffer || stubFalse_default;
25327   var isBuffer_default = isBuffer;
25328
25329   // node_modules/lodash-es/_baseIsTypedArray.js
25330   var argsTag2 = "[object Arguments]";
25331   var arrayTag = "[object Array]";
25332   var boolTag = "[object Boolean]";
25333   var dateTag = "[object Date]";
25334   var errorTag = "[object Error]";
25335   var funcTag2 = "[object Function]";
25336   var mapTag = "[object Map]";
25337   var numberTag = "[object Number]";
25338   var objectTag = "[object Object]";
25339   var regexpTag = "[object RegExp]";
25340   var setTag = "[object Set]";
25341   var stringTag = "[object String]";
25342   var weakMapTag = "[object WeakMap]";
25343   var arrayBufferTag = "[object ArrayBuffer]";
25344   var dataViewTag = "[object DataView]";
25345   var float32Tag = "[object Float32Array]";
25346   var float64Tag = "[object Float64Array]";
25347   var int8Tag = "[object Int8Array]";
25348   var int16Tag = "[object Int16Array]";
25349   var int32Tag = "[object Int32Array]";
25350   var uint8Tag = "[object Uint8Array]";
25351   var uint8ClampedTag = "[object Uint8ClampedArray]";
25352   var uint16Tag = "[object Uint16Array]";
25353   var uint32Tag = "[object Uint32Array]";
25354   var typedArrayTags = {};
25355   typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
25356   typedArrayTags[argsTag2] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag2] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
25357   function baseIsTypedArray(value) {
25358     return isObjectLike_default(value) && isLength_default(value.length) && !!typedArrayTags[baseGetTag_default(value)];
25359   }
25360   var baseIsTypedArray_default = baseIsTypedArray;
25361
25362   // node_modules/lodash-es/_baseUnary.js
25363   function baseUnary(func) {
25364     return function(value) {
25365       return func(value);
25366     };
25367   }
25368   var baseUnary_default = baseUnary;
25369
25370   // node_modules/lodash-es/_nodeUtil.js
25371   var freeExports2 = typeof exports == "object" && exports && !exports.nodeType && exports;
25372   var freeModule2 = freeExports2 && typeof module == "object" && module && !module.nodeType && module;
25373   var moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
25374   var freeProcess = moduleExports2 && freeGlobal_default.process;
25375   var nodeUtil = function() {
25376     try {
25377       var types = freeModule2 && freeModule2.require && freeModule2.require("util").types;
25378       if (types) {
25379         return types;
25380       }
25381       return freeProcess && freeProcess.binding && freeProcess.binding("util");
25382     } catch (e3) {
25383     }
25384   }();
25385   var nodeUtil_default = nodeUtil;
25386
25387   // node_modules/lodash-es/isTypedArray.js
25388   var nodeIsTypedArray = nodeUtil_default && nodeUtil_default.isTypedArray;
25389   var isTypedArray = nodeIsTypedArray ? baseUnary_default(nodeIsTypedArray) : baseIsTypedArray_default;
25390   var isTypedArray_default = isTypedArray;
25391
25392   // node_modules/lodash-es/_arrayLikeKeys.js
25393   var objectProto6 = Object.prototype;
25394   var hasOwnProperty4 = objectProto6.hasOwnProperty;
25395   function arrayLikeKeys(value, inherited) {
25396     var isArr = isArray_default(value), isArg = !isArr && isArguments_default(value), isBuff = !isArr && !isArg && isBuffer_default(value), isType = !isArr && !isArg && !isBuff && isTypedArray_default(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes_default(value.length, String) : [], length2 = result.length;
25397     for (var key in value) {
25398       if ((inherited || hasOwnProperty4.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
25399       (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
25400       isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
25401       isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
25402       isIndex_default(key, length2)))) {
25403         result.push(key);
25404       }
25405     }
25406     return result;
25407   }
25408   var arrayLikeKeys_default = arrayLikeKeys;
25409
25410   // node_modules/lodash-es/_overArg.js
25411   function overArg(func, transform2) {
25412     return function(arg) {
25413       return func(transform2(arg));
25414     };
25415   }
25416   var overArg_default = overArg;
25417
25418   // node_modules/lodash-es/_nativeKeys.js
25419   var nativeKeys = overArg_default(Object.keys, Object);
25420   var nativeKeys_default = nativeKeys;
25421
25422   // node_modules/lodash-es/_baseKeys.js
25423   var objectProto7 = Object.prototype;
25424   var hasOwnProperty5 = objectProto7.hasOwnProperty;
25425   function baseKeys(object) {
25426     if (!isPrototype_default(object)) {
25427       return nativeKeys_default(object);
25428     }
25429     var result = [];
25430     for (var key in Object(object)) {
25431       if (hasOwnProperty5.call(object, key) && key != "constructor") {
25432         result.push(key);
25433       }
25434     }
25435     return result;
25436   }
25437   var baseKeys_default = baseKeys;
25438
25439   // node_modules/lodash-es/keys.js
25440   function keys(object) {
25441     return isArrayLike_default(object) ? arrayLikeKeys_default(object) : baseKeys_default(object);
25442   }
25443   var keys_default = keys;
25444
25445   // node_modules/lodash-es/_nativeCreate.js
25446   var nativeCreate = getNative_default(Object, "create");
25447   var nativeCreate_default = nativeCreate;
25448
25449   // node_modules/lodash-es/_hashClear.js
25450   function hashClear() {
25451     this.__data__ = nativeCreate_default ? nativeCreate_default(null) : {};
25452     this.size = 0;
25453   }
25454   var hashClear_default = hashClear;
25455
25456   // node_modules/lodash-es/_hashDelete.js
25457   function hashDelete(key) {
25458     var result = this.has(key) && delete this.__data__[key];
25459     this.size -= result ? 1 : 0;
25460     return result;
25461   }
25462   var hashDelete_default = hashDelete;
25463
25464   // node_modules/lodash-es/_hashGet.js
25465   var HASH_UNDEFINED = "__lodash_hash_undefined__";
25466   var objectProto8 = Object.prototype;
25467   var hasOwnProperty6 = objectProto8.hasOwnProperty;
25468   function hashGet(key) {
25469     var data = this.__data__;
25470     if (nativeCreate_default) {
25471       var result = data[key];
25472       return result === HASH_UNDEFINED ? void 0 : result;
25473     }
25474     return hasOwnProperty6.call(data, key) ? data[key] : void 0;
25475   }
25476   var hashGet_default = hashGet;
25477
25478   // node_modules/lodash-es/_hashHas.js
25479   var objectProto9 = Object.prototype;
25480   var hasOwnProperty7 = objectProto9.hasOwnProperty;
25481   function hashHas(key) {
25482     var data = this.__data__;
25483     return nativeCreate_default ? data[key] !== void 0 : hasOwnProperty7.call(data, key);
25484   }
25485   var hashHas_default = hashHas;
25486
25487   // node_modules/lodash-es/_hashSet.js
25488   var HASH_UNDEFINED2 = "__lodash_hash_undefined__";
25489   function hashSet(key, value) {
25490     var data = this.__data__;
25491     this.size += this.has(key) ? 0 : 1;
25492     data[key] = nativeCreate_default && value === void 0 ? HASH_UNDEFINED2 : value;
25493     return this;
25494   }
25495   var hashSet_default = hashSet;
25496
25497   // node_modules/lodash-es/_Hash.js
25498   function Hash(entries) {
25499     var index = -1, length2 = entries == null ? 0 : entries.length;
25500     this.clear();
25501     while (++index < length2) {
25502       var entry = entries[index];
25503       this.set(entry[0], entry[1]);
25504     }
25505   }
25506   Hash.prototype.clear = hashClear_default;
25507   Hash.prototype["delete"] = hashDelete_default;
25508   Hash.prototype.get = hashGet_default;
25509   Hash.prototype.has = hashHas_default;
25510   Hash.prototype.set = hashSet_default;
25511   var Hash_default = Hash;
25512
25513   // node_modules/lodash-es/_listCacheClear.js
25514   function listCacheClear() {
25515     this.__data__ = [];
25516     this.size = 0;
25517   }
25518   var listCacheClear_default = listCacheClear;
25519
25520   // node_modules/lodash-es/_assocIndexOf.js
25521   function assocIndexOf(array2, key) {
25522     var length2 = array2.length;
25523     while (length2--) {
25524       if (eq_default(array2[length2][0], key)) {
25525         return length2;
25526       }
25527     }
25528     return -1;
25529   }
25530   var assocIndexOf_default = assocIndexOf;
25531
25532   // node_modules/lodash-es/_listCacheDelete.js
25533   var arrayProto = Array.prototype;
25534   var splice = arrayProto.splice;
25535   function listCacheDelete(key) {
25536     var data = this.__data__, index = assocIndexOf_default(data, key);
25537     if (index < 0) {
25538       return false;
25539     }
25540     var lastIndex = data.length - 1;
25541     if (index == lastIndex) {
25542       data.pop();
25543     } else {
25544       splice.call(data, index, 1);
25545     }
25546     --this.size;
25547     return true;
25548   }
25549   var listCacheDelete_default = listCacheDelete;
25550
25551   // node_modules/lodash-es/_listCacheGet.js
25552   function listCacheGet(key) {
25553     var data = this.__data__, index = assocIndexOf_default(data, key);
25554     return index < 0 ? void 0 : data[index][1];
25555   }
25556   var listCacheGet_default = listCacheGet;
25557
25558   // node_modules/lodash-es/_listCacheHas.js
25559   function listCacheHas(key) {
25560     return assocIndexOf_default(this.__data__, key) > -1;
25561   }
25562   var listCacheHas_default = listCacheHas;
25563
25564   // node_modules/lodash-es/_listCacheSet.js
25565   function listCacheSet(key, value) {
25566     var data = this.__data__, index = assocIndexOf_default(data, key);
25567     if (index < 0) {
25568       ++this.size;
25569       data.push([key, value]);
25570     } else {
25571       data[index][1] = value;
25572     }
25573     return this;
25574   }
25575   var listCacheSet_default = listCacheSet;
25576
25577   // node_modules/lodash-es/_ListCache.js
25578   function ListCache(entries) {
25579     var index = -1, length2 = entries == null ? 0 : entries.length;
25580     this.clear();
25581     while (++index < length2) {
25582       var entry = entries[index];
25583       this.set(entry[0], entry[1]);
25584     }
25585   }
25586   ListCache.prototype.clear = listCacheClear_default;
25587   ListCache.prototype["delete"] = listCacheDelete_default;
25588   ListCache.prototype.get = listCacheGet_default;
25589   ListCache.prototype.has = listCacheHas_default;
25590   ListCache.prototype.set = listCacheSet_default;
25591   var ListCache_default = ListCache;
25592
25593   // node_modules/lodash-es/_Map.js
25594   var Map2 = getNative_default(root_default, "Map");
25595   var Map_default = Map2;
25596
25597   // node_modules/lodash-es/_mapCacheClear.js
25598   function mapCacheClear() {
25599     this.size = 0;
25600     this.__data__ = {
25601       "hash": new Hash_default(),
25602       "map": new (Map_default || ListCache_default)(),
25603       "string": new Hash_default()
25604     };
25605   }
25606   var mapCacheClear_default = mapCacheClear;
25607
25608   // node_modules/lodash-es/_isKeyable.js
25609   function isKeyable(value) {
25610     var type2 = typeof value;
25611     return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null;
25612   }
25613   var isKeyable_default = isKeyable;
25614
25615   // node_modules/lodash-es/_getMapData.js
25616   function getMapData(map2, key) {
25617     var data = map2.__data__;
25618     return isKeyable_default(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
25619   }
25620   var getMapData_default = getMapData;
25621
25622   // node_modules/lodash-es/_mapCacheDelete.js
25623   function mapCacheDelete(key) {
25624     var result = getMapData_default(this, key)["delete"](key);
25625     this.size -= result ? 1 : 0;
25626     return result;
25627   }
25628   var mapCacheDelete_default = mapCacheDelete;
25629
25630   // node_modules/lodash-es/_mapCacheGet.js
25631   function mapCacheGet(key) {
25632     return getMapData_default(this, key).get(key);
25633   }
25634   var mapCacheGet_default = mapCacheGet;
25635
25636   // node_modules/lodash-es/_mapCacheHas.js
25637   function mapCacheHas(key) {
25638     return getMapData_default(this, key).has(key);
25639   }
25640   var mapCacheHas_default = mapCacheHas;
25641
25642   // node_modules/lodash-es/_mapCacheSet.js
25643   function mapCacheSet(key, value) {
25644     var data = getMapData_default(this, key), size = data.size;
25645     data.set(key, value);
25646     this.size += data.size == size ? 0 : 1;
25647     return this;
25648   }
25649   var mapCacheSet_default = mapCacheSet;
25650
25651   // node_modules/lodash-es/_MapCache.js
25652   function MapCache(entries) {
25653     var index = -1, length2 = entries == null ? 0 : entries.length;
25654     this.clear();
25655     while (++index < length2) {
25656       var entry = entries[index];
25657       this.set(entry[0], entry[1]);
25658     }
25659   }
25660   MapCache.prototype.clear = mapCacheClear_default;
25661   MapCache.prototype["delete"] = mapCacheDelete_default;
25662   MapCache.prototype.get = mapCacheGet_default;
25663   MapCache.prototype.has = mapCacheHas_default;
25664   MapCache.prototype.set = mapCacheSet_default;
25665   var MapCache_default = MapCache;
25666
25667   // node_modules/lodash-es/toString.js
25668   function toString(value) {
25669     return value == null ? "" : baseToString_default(value);
25670   }
25671   var toString_default = toString;
25672
25673   // node_modules/lodash-es/_arrayPush.js
25674   function arrayPush(array2, values) {
25675     var index = -1, length2 = values.length, offset = array2.length;
25676     while (++index < length2) {
25677       array2[offset + index] = values[index];
25678     }
25679     return array2;
25680   }
25681   var arrayPush_default = arrayPush;
25682
25683   // node_modules/lodash-es/_basePropertyOf.js
25684   function basePropertyOf(object) {
25685     return function(key) {
25686       return object == null ? void 0 : object[key];
25687     };
25688   }
25689   var basePropertyOf_default = basePropertyOf;
25690
25691   // node_modules/lodash-es/_stackClear.js
25692   function stackClear() {
25693     this.__data__ = new ListCache_default();
25694     this.size = 0;
25695   }
25696   var stackClear_default = stackClear;
25697
25698   // node_modules/lodash-es/_stackDelete.js
25699   function stackDelete(key) {
25700     var data = this.__data__, result = data["delete"](key);
25701     this.size = data.size;
25702     return result;
25703   }
25704   var stackDelete_default = stackDelete;
25705
25706   // node_modules/lodash-es/_stackGet.js
25707   function stackGet(key) {
25708     return this.__data__.get(key);
25709   }
25710   var stackGet_default = stackGet;
25711
25712   // node_modules/lodash-es/_stackHas.js
25713   function stackHas(key) {
25714     return this.__data__.has(key);
25715   }
25716   var stackHas_default = stackHas;
25717
25718   // node_modules/lodash-es/_stackSet.js
25719   var LARGE_ARRAY_SIZE = 200;
25720   function stackSet(key, value) {
25721     var data = this.__data__;
25722     if (data instanceof ListCache_default) {
25723       var pairs2 = data.__data__;
25724       if (!Map_default || pairs2.length < LARGE_ARRAY_SIZE - 1) {
25725         pairs2.push([key, value]);
25726         this.size = ++data.size;
25727         return this;
25728       }
25729       data = this.__data__ = new MapCache_default(pairs2);
25730     }
25731     data.set(key, value);
25732     this.size = data.size;
25733     return this;
25734   }
25735   var stackSet_default = stackSet;
25736
25737   // node_modules/lodash-es/_Stack.js
25738   function Stack(entries) {
25739     var data = this.__data__ = new ListCache_default(entries);
25740     this.size = data.size;
25741   }
25742   Stack.prototype.clear = stackClear_default;
25743   Stack.prototype["delete"] = stackDelete_default;
25744   Stack.prototype.get = stackGet_default;
25745   Stack.prototype.has = stackHas_default;
25746   Stack.prototype.set = stackSet_default;
25747   var Stack_default = Stack;
25748
25749   // node_modules/lodash-es/_arrayFilter.js
25750   function arrayFilter(array2, predicate) {
25751     var index = -1, length2 = array2 == null ? 0 : array2.length, resIndex = 0, result = [];
25752     while (++index < length2) {
25753       var value = array2[index];
25754       if (predicate(value, index, array2)) {
25755         result[resIndex++] = value;
25756       }
25757     }
25758     return result;
25759   }
25760   var arrayFilter_default = arrayFilter;
25761
25762   // node_modules/lodash-es/stubArray.js
25763   function stubArray() {
25764     return [];
25765   }
25766   var stubArray_default = stubArray;
25767
25768   // node_modules/lodash-es/_getSymbols.js
25769   var objectProto10 = Object.prototype;
25770   var propertyIsEnumerable2 = objectProto10.propertyIsEnumerable;
25771   var nativeGetSymbols = Object.getOwnPropertySymbols;
25772   var getSymbols = !nativeGetSymbols ? stubArray_default : function(object) {
25773     if (object == null) {
25774       return [];
25775     }
25776     object = Object(object);
25777     return arrayFilter_default(nativeGetSymbols(object), function(symbol) {
25778       return propertyIsEnumerable2.call(object, symbol);
25779     });
25780   };
25781   var getSymbols_default = getSymbols;
25782
25783   // node_modules/lodash-es/_baseGetAllKeys.js
25784   function baseGetAllKeys(object, keysFunc, symbolsFunc) {
25785     var result = keysFunc(object);
25786     return isArray_default(object) ? result : arrayPush_default(result, symbolsFunc(object));
25787   }
25788   var baseGetAllKeys_default = baseGetAllKeys;
25789
25790   // node_modules/lodash-es/_getAllKeys.js
25791   function getAllKeys(object) {
25792     return baseGetAllKeys_default(object, keys_default, getSymbols_default);
25793   }
25794   var getAllKeys_default = getAllKeys;
25795
25796   // node_modules/lodash-es/_DataView.js
25797   var DataView2 = getNative_default(root_default, "DataView");
25798   var DataView_default = DataView2;
25799
25800   // node_modules/lodash-es/_Promise.js
25801   var Promise2 = getNative_default(root_default, "Promise");
25802   var Promise_default = Promise2;
25803
25804   // node_modules/lodash-es/_Set.js
25805   var Set2 = getNative_default(root_default, "Set");
25806   var Set_default = Set2;
25807
25808   // node_modules/lodash-es/_getTag.js
25809   var mapTag2 = "[object Map]";
25810   var objectTag2 = "[object Object]";
25811   var promiseTag = "[object Promise]";
25812   var setTag2 = "[object Set]";
25813   var weakMapTag2 = "[object WeakMap]";
25814   var dataViewTag2 = "[object DataView]";
25815   var dataViewCtorString = toSource_default(DataView_default);
25816   var mapCtorString = toSource_default(Map_default);
25817   var promiseCtorString = toSource_default(Promise_default);
25818   var setCtorString = toSource_default(Set_default);
25819   var weakMapCtorString = toSource_default(WeakMap_default);
25820   var getTag = baseGetTag_default;
25821   if (DataView_default && getTag(new DataView_default(new ArrayBuffer(1))) != dataViewTag2 || Map_default && getTag(new Map_default()) != mapTag2 || Promise_default && getTag(Promise_default.resolve()) != promiseTag || Set_default && getTag(new Set_default()) != setTag2 || WeakMap_default && getTag(new WeakMap_default()) != weakMapTag2) {
25822     getTag = function(value) {
25823       var result = baseGetTag_default(value), Ctor = result == objectTag2 ? value.constructor : void 0, ctorString = Ctor ? toSource_default(Ctor) : "";
25824       if (ctorString) {
25825         switch (ctorString) {
25826           case dataViewCtorString:
25827             return dataViewTag2;
25828           case mapCtorString:
25829             return mapTag2;
25830           case promiseCtorString:
25831             return promiseTag;
25832           case setCtorString:
25833             return setTag2;
25834           case weakMapCtorString:
25835             return weakMapTag2;
25836         }
25837       }
25838       return result;
25839     };
25840   }
25841   var getTag_default = getTag;
25842
25843   // node_modules/lodash-es/_Uint8Array.js
25844   var Uint8Array2 = root_default.Uint8Array;
25845   var Uint8Array_default = Uint8Array2;
25846
25847   // node_modules/lodash-es/_setCacheAdd.js
25848   var HASH_UNDEFINED3 = "__lodash_hash_undefined__";
25849   function setCacheAdd(value) {
25850     this.__data__.set(value, HASH_UNDEFINED3);
25851     return this;
25852   }
25853   var setCacheAdd_default = setCacheAdd;
25854
25855   // node_modules/lodash-es/_setCacheHas.js
25856   function setCacheHas(value) {
25857     return this.__data__.has(value);
25858   }
25859   var setCacheHas_default = setCacheHas;
25860
25861   // node_modules/lodash-es/_SetCache.js
25862   function SetCache(values) {
25863     var index = -1, length2 = values == null ? 0 : values.length;
25864     this.__data__ = new MapCache_default();
25865     while (++index < length2) {
25866       this.add(values[index]);
25867     }
25868   }
25869   SetCache.prototype.add = SetCache.prototype.push = setCacheAdd_default;
25870   SetCache.prototype.has = setCacheHas_default;
25871   var SetCache_default = SetCache;
25872
25873   // node_modules/lodash-es/_arraySome.js
25874   function arraySome(array2, predicate) {
25875     var index = -1, length2 = array2 == null ? 0 : array2.length;
25876     while (++index < length2) {
25877       if (predicate(array2[index], index, array2)) {
25878         return true;
25879       }
25880     }
25881     return false;
25882   }
25883   var arraySome_default = arraySome;
25884
25885   // node_modules/lodash-es/_cacheHas.js
25886   function cacheHas(cache, key) {
25887     return cache.has(key);
25888   }
25889   var cacheHas_default = cacheHas;
25890
25891   // node_modules/lodash-es/_equalArrays.js
25892   var COMPARE_PARTIAL_FLAG = 1;
25893   var COMPARE_UNORDERED_FLAG = 2;
25894   function equalArrays(array2, other, bitmask, customizer, equalFunc, stack) {
25895     var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array2.length, othLength = other.length;
25896     if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
25897       return false;
25898     }
25899     var arrStacked = stack.get(array2);
25900     var othStacked = stack.get(other);
25901     if (arrStacked && othStacked) {
25902       return arrStacked == other && othStacked == array2;
25903     }
25904     var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache_default() : void 0;
25905     stack.set(array2, other);
25906     stack.set(other, array2);
25907     while (++index < arrLength) {
25908       var arrValue = array2[index], othValue = other[index];
25909       if (customizer) {
25910         var compared = isPartial ? customizer(othValue, arrValue, index, other, array2, stack) : customizer(arrValue, othValue, index, array2, other, stack);
25911       }
25912       if (compared !== void 0) {
25913         if (compared) {
25914           continue;
25915         }
25916         result = false;
25917         break;
25918       }
25919       if (seen) {
25920         if (!arraySome_default(other, function(othValue2, othIndex) {
25921           if (!cacheHas_default(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
25922             return seen.push(othIndex);
25923           }
25924         })) {
25925           result = false;
25926           break;
25927         }
25928       } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
25929         result = false;
25930         break;
25931       }
25932     }
25933     stack["delete"](array2);
25934     stack["delete"](other);
25935     return result;
25936   }
25937   var equalArrays_default = equalArrays;
25938
25939   // node_modules/lodash-es/_mapToArray.js
25940   function mapToArray(map2) {
25941     var index = -1, result = Array(map2.size);
25942     map2.forEach(function(value, key) {
25943       result[++index] = [key, value];
25944     });
25945     return result;
25946   }
25947   var mapToArray_default = mapToArray;
25948
25949   // node_modules/lodash-es/_setToArray.js
25950   function setToArray(set4) {
25951     var index = -1, result = Array(set4.size);
25952     set4.forEach(function(value) {
25953       result[++index] = value;
25954     });
25955     return result;
25956   }
25957   var setToArray_default = setToArray;
25958
25959   // node_modules/lodash-es/_equalByTag.js
25960   var COMPARE_PARTIAL_FLAG2 = 1;
25961   var COMPARE_UNORDERED_FLAG2 = 2;
25962   var boolTag2 = "[object Boolean]";
25963   var dateTag2 = "[object Date]";
25964   var errorTag2 = "[object Error]";
25965   var mapTag3 = "[object Map]";
25966   var numberTag2 = "[object Number]";
25967   var regexpTag2 = "[object RegExp]";
25968   var setTag3 = "[object Set]";
25969   var stringTag2 = "[object String]";
25970   var symbolTag2 = "[object Symbol]";
25971   var arrayBufferTag2 = "[object ArrayBuffer]";
25972   var dataViewTag3 = "[object DataView]";
25973   var symbolProto2 = Symbol_default ? Symbol_default.prototype : void 0;
25974   var symbolValueOf = symbolProto2 ? symbolProto2.valueOf : void 0;
25975   function equalByTag(object, other, tag2, bitmask, customizer, equalFunc, stack) {
25976     switch (tag2) {
25977       case dataViewTag3:
25978         if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
25979           return false;
25980         }
25981         object = object.buffer;
25982         other = other.buffer;
25983       case arrayBufferTag2:
25984         if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array_default(object), new Uint8Array_default(other))) {
25985           return false;
25986         }
25987         return true;
25988       case boolTag2:
25989       case dateTag2:
25990       case numberTag2:
25991         return eq_default(+object, +other);
25992       case errorTag2:
25993         return object.name == other.name && object.message == other.message;
25994       case regexpTag2:
25995       case stringTag2:
25996         return object == other + "";
25997       case mapTag3:
25998         var convert = mapToArray_default;
25999       case setTag3:
26000         var isPartial = bitmask & COMPARE_PARTIAL_FLAG2;
26001         convert || (convert = setToArray_default);
26002         if (object.size != other.size && !isPartial) {
26003           return false;
26004         }
26005         var stacked = stack.get(object);
26006         if (stacked) {
26007           return stacked == other;
26008         }
26009         bitmask |= COMPARE_UNORDERED_FLAG2;
26010         stack.set(object, other);
26011         var result = equalArrays_default(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
26012         stack["delete"](object);
26013         return result;
26014       case symbolTag2:
26015         if (symbolValueOf) {
26016           return symbolValueOf.call(object) == symbolValueOf.call(other);
26017         }
26018     }
26019     return false;
26020   }
26021   var equalByTag_default = equalByTag;
26022
26023   // node_modules/lodash-es/_equalObjects.js
26024   var COMPARE_PARTIAL_FLAG3 = 1;
26025   var objectProto11 = Object.prototype;
26026   var hasOwnProperty8 = objectProto11.hasOwnProperty;
26027   function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
26028     var isPartial = bitmask & COMPARE_PARTIAL_FLAG3, objProps = getAllKeys_default(object), objLength = objProps.length, othProps = getAllKeys_default(other), othLength = othProps.length;
26029     if (objLength != othLength && !isPartial) {
26030       return false;
26031     }
26032     var index = objLength;
26033     while (index--) {
26034       var key = objProps[index];
26035       if (!(isPartial ? key in other : hasOwnProperty8.call(other, key))) {
26036         return false;
26037       }
26038     }
26039     var objStacked = stack.get(object);
26040     var othStacked = stack.get(other);
26041     if (objStacked && othStacked) {
26042       return objStacked == other && othStacked == object;
26043     }
26044     var result = true;
26045     stack.set(object, other);
26046     stack.set(other, object);
26047     var skipCtor = isPartial;
26048     while (++index < objLength) {
26049       key = objProps[index];
26050       var objValue = object[key], othValue = other[key];
26051       if (customizer) {
26052         var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
26053       }
26054       if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
26055         result = false;
26056         break;
26057       }
26058       skipCtor || (skipCtor = key == "constructor");
26059     }
26060     if (result && !skipCtor) {
26061       var objCtor = object.constructor, othCtor = other.constructor;
26062       if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
26063         result = false;
26064       }
26065     }
26066     stack["delete"](object);
26067     stack["delete"](other);
26068     return result;
26069   }
26070   var equalObjects_default = equalObjects;
26071
26072   // node_modules/lodash-es/_baseIsEqualDeep.js
26073   var COMPARE_PARTIAL_FLAG4 = 1;
26074   var argsTag3 = "[object Arguments]";
26075   var arrayTag2 = "[object Array]";
26076   var objectTag3 = "[object Object]";
26077   var objectProto12 = Object.prototype;
26078   var hasOwnProperty9 = objectProto12.hasOwnProperty;
26079   function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
26080     var objIsArr = isArray_default(object), othIsArr = isArray_default(other), objTag = objIsArr ? arrayTag2 : getTag_default(object), othTag = othIsArr ? arrayTag2 : getTag_default(other);
26081     objTag = objTag == argsTag3 ? objectTag3 : objTag;
26082     othTag = othTag == argsTag3 ? objectTag3 : othTag;
26083     var objIsObj = objTag == objectTag3, othIsObj = othTag == objectTag3, isSameTag = objTag == othTag;
26084     if (isSameTag && isBuffer_default(object)) {
26085       if (!isBuffer_default(other)) {
26086         return false;
26087       }
26088       objIsArr = true;
26089       objIsObj = false;
26090     }
26091     if (isSameTag && !objIsObj) {
26092       stack || (stack = new Stack_default());
26093       return objIsArr || isTypedArray_default(object) ? equalArrays_default(object, other, bitmask, customizer, equalFunc, stack) : equalByTag_default(object, other, objTag, bitmask, customizer, equalFunc, stack);
26094     }
26095     if (!(bitmask & COMPARE_PARTIAL_FLAG4)) {
26096       var objIsWrapped = objIsObj && hasOwnProperty9.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty9.call(other, "__wrapped__");
26097       if (objIsWrapped || othIsWrapped) {
26098         var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
26099         stack || (stack = new Stack_default());
26100         return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
26101       }
26102     }
26103     if (!isSameTag) {
26104       return false;
26105     }
26106     stack || (stack = new Stack_default());
26107     return equalObjects_default(object, other, bitmask, customizer, equalFunc, stack);
26108   }
26109   var baseIsEqualDeep_default = baseIsEqualDeep;
26110
26111   // node_modules/lodash-es/_baseIsEqual.js
26112   function baseIsEqual(value, other, bitmask, customizer, stack) {
26113     if (value === other) {
26114       return true;
26115     }
26116     if (value == null || other == null || !isObjectLike_default(value) && !isObjectLike_default(other)) {
26117       return value !== value && other !== other;
26118     }
26119     return baseIsEqualDeep_default(value, other, bitmask, customizer, baseIsEqual, stack);
26120   }
26121   var baseIsEqual_default = baseIsEqual;
26122
26123   // node_modules/lodash-es/now.js
26124   var now2 = function() {
26125     return root_default.Date.now();
26126   };
26127   var now_default = now2;
26128
26129   // node_modules/lodash-es/debounce.js
26130   var FUNC_ERROR_TEXT = "Expected a function";
26131   var nativeMax = Math.max;
26132   var nativeMin = Math.min;
26133   function debounce(func, wait, options2) {
26134     var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
26135     if (typeof func != "function") {
26136       throw new TypeError(FUNC_ERROR_TEXT);
26137     }
26138     wait = toNumber_default(wait) || 0;
26139     if (isObject_default(options2)) {
26140       leading = !!options2.leading;
26141       maxing = "maxWait" in options2;
26142       maxWait = maxing ? nativeMax(toNumber_default(options2.maxWait) || 0, wait) : maxWait;
26143       trailing = "trailing" in options2 ? !!options2.trailing : trailing;
26144     }
26145     function invokeFunc(time) {
26146       var args = lastArgs, thisArg = lastThis;
26147       lastArgs = lastThis = void 0;
26148       lastInvokeTime = time;
26149       result = func.apply(thisArg, args);
26150       return result;
26151     }
26152     function leadingEdge(time) {
26153       lastInvokeTime = time;
26154       timerId = setTimeout(timerExpired, wait);
26155       return leading ? invokeFunc(time) : result;
26156     }
26157     function remainingWait(time) {
26158       var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
26159       return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
26160     }
26161     function shouldInvoke(time) {
26162       var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
26163       return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
26164     }
26165     function timerExpired() {
26166       var time = now_default();
26167       if (shouldInvoke(time)) {
26168         return trailingEdge(time);
26169       }
26170       timerId = setTimeout(timerExpired, remainingWait(time));
26171     }
26172     function trailingEdge(time) {
26173       timerId = void 0;
26174       if (trailing && lastArgs) {
26175         return invokeFunc(time);
26176       }
26177       lastArgs = lastThis = void 0;
26178       return result;
26179     }
26180     function cancel() {
26181       if (timerId !== void 0) {
26182         clearTimeout(timerId);
26183       }
26184       lastInvokeTime = 0;
26185       lastArgs = lastCallTime = lastThis = timerId = void 0;
26186     }
26187     function flush() {
26188       return timerId === void 0 ? result : trailingEdge(now_default());
26189     }
26190     function debounced() {
26191       var time = now_default(), isInvoking = shouldInvoke(time);
26192       lastArgs = arguments;
26193       lastThis = this;
26194       lastCallTime = time;
26195       if (isInvoking) {
26196         if (timerId === void 0) {
26197           return leadingEdge(lastCallTime);
26198         }
26199         if (maxing) {
26200           clearTimeout(timerId);
26201           timerId = setTimeout(timerExpired, wait);
26202           return invokeFunc(lastCallTime);
26203         }
26204       }
26205       if (timerId === void 0) {
26206         timerId = setTimeout(timerExpired, wait);
26207       }
26208       return result;
26209     }
26210     debounced.cancel = cancel;
26211     debounced.flush = flush;
26212     return debounced;
26213   }
26214   var debounce_default = debounce;
26215
26216   // node_modules/lodash-es/_escapeHtmlChar.js
26217   var htmlEscapes = {
26218     "&": "&amp;",
26219     "<": "&lt;",
26220     ">": "&gt;",
26221     '"': "&quot;",
26222     "'": "&#39;"
26223   };
26224   var escapeHtmlChar = basePropertyOf_default(htmlEscapes);
26225   var escapeHtmlChar_default = escapeHtmlChar;
26226
26227   // node_modules/lodash-es/escape.js
26228   var reUnescapedHtml = /[&<>"']/g;
26229   var reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
26230   function escape2(string) {
26231     string = toString_default(string);
26232     return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar_default) : string;
26233   }
26234   var escape_default = escape2;
26235
26236   // node_modules/lodash-es/isEqual.js
26237   function isEqual(value, other) {
26238     return baseIsEqual_default(value, other);
26239   }
26240   var isEqual_default = isEqual;
26241
26242   // node_modules/lodash-es/isNumber.js
26243   var numberTag3 = "[object Number]";
26244   function isNumber(value) {
26245     return typeof value == "number" || isObjectLike_default(value) && baseGetTag_default(value) == numberTag3;
26246   }
26247   var isNumber_default = isNumber;
26248
26249   // node_modules/lodash-es/throttle.js
26250   var FUNC_ERROR_TEXT2 = "Expected a function";
26251   function throttle(func, wait, options2) {
26252     var leading = true, trailing = true;
26253     if (typeof func != "function") {
26254       throw new TypeError(FUNC_ERROR_TEXT2);
26255     }
26256     if (isObject_default(options2)) {
26257       leading = "leading" in options2 ? !!options2.leading : leading;
26258       trailing = "trailing" in options2 ? !!options2.trailing : trailing;
26259     }
26260     return debounce_default(func, wait, {
26261       "leading": leading,
26262       "maxWait": wait,
26263       "trailing": trailing
26264     });
26265   }
26266   var throttle_default = throttle;
26267
26268   // node_modules/lodash-es/_unescapeHtmlChar.js
26269   var htmlUnescapes = {
26270     "&amp;": "&",
26271     "&lt;": "<",
26272     "&gt;": ">",
26273     "&quot;": '"',
26274     "&#39;": "'"
26275   };
26276   var unescapeHtmlChar = basePropertyOf_default(htmlUnescapes);
26277   var unescapeHtmlChar_default = unescapeHtmlChar;
26278
26279   // node_modules/lodash-es/unescape.js
26280   var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g;
26281   var reHasEscapedHtml = RegExp(reEscapedHtml.source);
26282   function unescape(string) {
26283     string = toString_default(string);
26284     return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar_default) : string;
26285   }
26286   var unescape_default = unescape;
26287
26288   // modules/util/detect.js
26289   var _detected;
26290   function utilDetect(refresh2) {
26291     if (_detected && !refresh2) return _detected;
26292     _detected = {};
26293     const ua = navigator.userAgent;
26294     let m2 = null;
26295     m2 = ua.match(/(edge)\/?\s*(\.?\d+(\.\d+)*)/i);
26296     if (m2 !== null) {
26297       _detected.browser = m2[1];
26298       _detected.version = m2[2];
26299     }
26300     if (!_detected.browser) {
26301       m2 = ua.match(/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/i);
26302       if (m2 !== null) {
26303         _detected.browser = "msie";
26304         _detected.version = m2[1];
26305       }
26306     }
26307     if (!_detected.browser) {
26308       m2 = ua.match(/(opr)\/?\s*(\.?\d+(\.\d+)*)/i);
26309       if (m2 !== null) {
26310         _detected.browser = "Opera";
26311         _detected.version = m2[2];
26312       }
26313     }
26314     if (!_detected.browser) {
26315       m2 = ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
26316       if (m2 !== null) {
26317         _detected.browser = m2[1];
26318         _detected.version = m2[2];
26319         m2 = ua.match(/version\/([\.\d]+)/i);
26320         if (m2 !== null) _detected.version = m2[1];
26321       }
26322     }
26323     if (!_detected.browser) {
26324       _detected.browser = navigator.appName;
26325       _detected.version = navigator.appVersion;
26326     }
26327     _detected.version = _detected.version.split(/\W/).slice(0, 2).join(".");
26328     _detected.opera = _detected.browser.toLowerCase() === "opera" && Number(_detected.version) < 15;
26329     if (_detected.browser.toLowerCase() === "msie") {
26330       _detected.ie = true;
26331       _detected.browser = "Internet Explorer";
26332       _detected.support = false;
26333     } else {
26334       _detected.ie = false;
26335       _detected.support = true;
26336     }
26337     _detected.filedrop = window.FileReader && "ondrop" in window;
26338     if (/Win/.test(ua)) {
26339       _detected.os = "win";
26340       _detected.platform = "Windows";
26341     } else if (/Mac/.test(ua)) {
26342       _detected.os = "mac";
26343       _detected.platform = "Macintosh";
26344     } else if (/X11/.test(ua) || /Linux/.test(ua)) {
26345       _detected.os = "linux";
26346       _detected.platform = "Linux";
26347     } else {
26348       _detected.os = "win";
26349       _detected.platform = "Unknown";
26350     }
26351     _detected.isMobileWebKit = (/\b(iPad|iPhone|iPod)\b/.test(ua) || // HACK: iPadOS 13+ requests desktop sites by default by using a Mac user agent,
26352     // so assume any "mac" with multitouch is actually iOS
26353     navigator.platform === "MacIntel" && "maxTouchPoints" in navigator && navigator.maxTouchPoints > 1) && /WebKit/.test(ua) && !/Edge/.test(ua) && !window.MSStream;
26354     _detected.browserLocales = Array.from(new Set(
26355       // remove duplicates
26356       [navigator.language].concat(navigator.languages || []).concat([
26357         // old property for backwards compatibility
26358         navigator.userLanguage
26359       ]).filter(Boolean)
26360     ));
26361     const loc = window.top.location;
26362     let origin = loc.origin;
26363     if (!origin) {
26364       origin = loc.protocol + "//" + loc.hostname + (loc.port ? ":" + loc.port : "");
26365     }
26366     _detected.host = origin + loc.pathname;
26367     return _detected;
26368   }
26369
26370   // modules/util/aes.js
26371   var import_aes_js = __toESM(require_aes_js());
26372   var DEFAULT_128 = [250, 157, 60, 79, 142, 134, 229, 129, 138, 126, 210, 129, 29, 71, 160, 208];
26373   function utilAesEncrypt(text, key) {
26374     key = key || DEFAULT_128;
26375     const textBytes = import_aes_js.default.utils.utf8.toBytes(text);
26376     const aesCtr = new import_aes_js.default.ModeOfOperation.ctr(key);
26377     const encryptedBytes = aesCtr.encrypt(textBytes);
26378     const encryptedHex = import_aes_js.default.utils.hex.fromBytes(encryptedBytes);
26379     return encryptedHex;
26380   }
26381   function utilAesDecrypt(encryptedHex, key) {
26382     key = key || DEFAULT_128;
26383     const encryptedBytes = import_aes_js.default.utils.hex.toBytes(encryptedHex);
26384     const aesCtr = new import_aes_js.default.ModeOfOperation.ctr(key);
26385     const decryptedBytes = aesCtr.decrypt(encryptedBytes);
26386     const text = import_aes_js.default.utils.utf8.fromBytes(decryptedBytes);
26387     return text;
26388   }
26389
26390   // modules/util/clean_tags.js
26391   function utilCleanTags(tags) {
26392     var out = {};
26393     for (var k2 in tags) {
26394       if (!k2) continue;
26395       var v2 = tags[k2];
26396       if (v2 !== void 0) {
26397         out[k2] = cleanValue(k2, v2);
26398       }
26399     }
26400     return out;
26401     function cleanValue(k3, v3) {
26402       function keepSpaces(k4) {
26403         return /_hours|_times|:conditional$/.test(k4);
26404       }
26405       function skip(k4) {
26406         return /^(description|note|fixme|inscription)$/.test(k4);
26407       }
26408       if (skip(k3)) return v3;
26409       var cleaned = v3.split(";").map(function(s2) {
26410         return s2.trim();
26411       }).join(keepSpaces(k3) ? "; " : ";");
26412       if (k3.indexOf("website") !== -1 || k3.indexOf("email") !== -1 || cleaned.indexOf("http") === 0) {
26413         cleaned = cleaned.replace(/[\u200B-\u200F\uFEFF]/g, "");
26414       }
26415       return cleaned;
26416     }
26417   }
26418
26419   // modules/util/get_set_value.js
26420   function utilGetSetValue(selection2, value, shouldUpdate) {
26421     function setValue(value2, shouldUpdate2) {
26422       function valueNull() {
26423         delete this.value;
26424       }
26425       function valueConstant() {
26426         if (shouldUpdate2(this.value, value2)) {
26427           this.value = value2;
26428         }
26429       }
26430       function valueFunction() {
26431         var x2 = value2.apply(this, arguments);
26432         if (x2 === null || x2 === void 0) {
26433           delete this.value;
26434         } else if (shouldUpdate2(this.value, x2)) {
26435           this.value = x2;
26436         }
26437       }
26438       return value2 === null || value2 === void 0 ? valueNull : typeof value2 === "function" ? valueFunction : valueConstant;
26439     }
26440     if (arguments.length === 1) {
26441       return selection2.property("value");
26442     }
26443     if (shouldUpdate === void 0) {
26444       shouldUpdate = (a2, b2) => a2 !== b2;
26445     }
26446     return selection2.each(setValue(value, shouldUpdate));
26447   }
26448
26449   // modules/util/keybinding.js
26450   function utilKeybinding(namespace) {
26451     var _keybindings = {};
26452     function testBindings(d3_event, isCapturing) {
26453       var didMatch = false;
26454       var bindings = Object.keys(_keybindings).map(function(id2) {
26455         return _keybindings[id2];
26456       });
26457       var i3, binding;
26458       for (i3 = 0; i3 < bindings.length; i3++) {
26459         binding = bindings[i3];
26460         if (!binding.event.modifiers.shiftKey) continue;
26461         if (!!binding.capture !== isCapturing) continue;
26462         if (matches(d3_event, binding, true)) {
26463           binding.callback(d3_event);
26464           didMatch = true;
26465           break;
26466         }
26467       }
26468       if (didMatch) return;
26469       for (i3 = 0; i3 < bindings.length; i3++) {
26470         binding = bindings[i3];
26471         if (binding.event.modifiers.shiftKey) continue;
26472         if (!!binding.capture !== isCapturing) continue;
26473         if (matches(d3_event, binding, false)) {
26474           binding.callback(d3_event);
26475           break;
26476         }
26477       }
26478       function matches(d3_event2, binding2, testShift) {
26479         var event = d3_event2;
26480         var isMatch = false;
26481         var tryKeyCode = true;
26482         if (event.key !== void 0) {
26483           tryKeyCode = event.key.charCodeAt(0) > 127;
26484           isMatch = true;
26485           if (binding2.event.key === void 0) {
26486             isMatch = false;
26487           } else if (Array.isArray(binding2.event.key)) {
26488             if (binding2.event.key.map(function(s2) {
26489               return s2.toLowerCase();
26490             }).indexOf(event.key.toLowerCase()) === -1) {
26491               isMatch = false;
26492             }
26493           } else {
26494             if (event.key.toLowerCase() !== binding2.event.key.toLowerCase()) {
26495               isMatch = false;
26496             }
26497           }
26498         }
26499         if (!isMatch && (tryKeyCode || binding2.event.modifiers.altKey)) {
26500           isMatch = event.keyCode === binding2.event.keyCode;
26501         }
26502         if (!isMatch) return false;
26503         if (!(event.ctrlKey && event.altKey)) {
26504           if (event.ctrlKey !== binding2.event.modifiers.ctrlKey) return false;
26505           if (event.altKey !== binding2.event.modifiers.altKey) return false;
26506         }
26507         if (event.metaKey !== binding2.event.modifiers.metaKey) return false;
26508         if (testShift && event.shiftKey !== binding2.event.modifiers.shiftKey) return false;
26509         return true;
26510       }
26511     }
26512     function capture(d3_event) {
26513       testBindings(d3_event, true);
26514     }
26515     function bubble(d3_event) {
26516       var tagName = select_default2(d3_event.target).node().tagName;
26517       if (tagName === "INPUT" || tagName === "SELECT" || tagName === "TEXTAREA") {
26518         return;
26519       }
26520       testBindings(d3_event, false);
26521     }
26522     function keybinding(selection2) {
26523       selection2 = selection2 || select_default2(document);
26524       selection2.on("keydown.capture." + namespace, capture, true);
26525       selection2.on("keydown.bubble." + namespace, bubble, false);
26526       return keybinding;
26527     }
26528     keybinding.unbind = function(selection2) {
26529       _keybindings = [];
26530       selection2 = selection2 || select_default2(document);
26531       selection2.on("keydown.capture." + namespace, null);
26532       selection2.on("keydown.bubble." + namespace, null);
26533       return keybinding;
26534     };
26535     keybinding.clear = function() {
26536       _keybindings = {};
26537       return keybinding;
26538     };
26539     keybinding.off = function(codes, capture2) {
26540       var arr = utilArrayUniq([].concat(codes));
26541       for (var i3 = 0; i3 < arr.length; i3++) {
26542         var id2 = arr[i3] + (capture2 ? "-capture" : "-bubble");
26543         delete _keybindings[id2];
26544       }
26545       return keybinding;
26546     };
26547     keybinding.on = function(codes, callback, capture2) {
26548       if (typeof callback !== "function") {
26549         return keybinding.off(codes, capture2);
26550       }
26551       var arr = utilArrayUniq([].concat(codes));
26552       for (var i3 = 0; i3 < arr.length; i3++) {
26553         var id2 = arr[i3] + (capture2 ? "-capture" : "-bubble");
26554         var binding = {
26555           id: id2,
26556           capture: capture2,
26557           callback,
26558           event: {
26559             key: void 0,
26560             // preferred
26561             keyCode: 0,
26562             // fallback
26563             modifiers: {
26564               shiftKey: false,
26565               ctrlKey: false,
26566               altKey: false,
26567               metaKey: false
26568             }
26569           }
26570         };
26571         if (_keybindings[id2]) {
26572           console.warn('warning: duplicate keybinding for "' + id2 + '"');
26573         }
26574         _keybindings[id2] = binding;
26575         var matches = arr[i3].toLowerCase().match(/(?:(?:[^+⇧⌃⌥⌘])+|[⇧⌃⌥⌘]|\+\+|^\+$)/g);
26576         for (var j2 = 0; j2 < matches.length; j2++) {
26577           if (matches[j2] === "++") matches[j2] = "+";
26578           if (matches[j2] in utilKeybinding.modifierCodes) {
26579             var prop = utilKeybinding.modifierProperties[utilKeybinding.modifierCodes[matches[j2]]];
26580             binding.event.modifiers[prop] = true;
26581           } else {
26582             binding.event.key = utilKeybinding.keys[matches[j2]] || matches[j2];
26583             if (matches[j2] in utilKeybinding.keyCodes) {
26584               binding.event.keyCode = utilKeybinding.keyCodes[matches[j2]];
26585             }
26586           }
26587         }
26588       }
26589       return keybinding;
26590     };
26591     return keybinding;
26592   }
26593   utilKeybinding.modifierCodes = {
26594     // Shift key, ⇧
26595     "\u21E7": 16,
26596     shift: 16,
26597     // CTRL key, on Mac: ⌃
26598     "\u2303": 17,
26599     ctrl: 17,
26600     // ALT key, on Mac: ⌥ (Alt)
26601     "\u2325": 18,
26602     alt: 18,
26603     option: 18,
26604     // META, on Mac: ⌘ (CMD), on Windows (Win), on Linux (Super)
26605     "\u2318": 91,
26606     meta: 91,
26607     cmd: 91,
26608     "super": 91,
26609     win: 91
26610   };
26611   utilKeybinding.modifierProperties = {
26612     16: "shiftKey",
26613     17: "ctrlKey",
26614     18: "altKey",
26615     91: "metaKey"
26616   };
26617   utilKeybinding.plusKeys = ["plus", "ffplus", "=", "ffequals", "\u2260", "\xB1"];
26618   utilKeybinding.minusKeys = ["_", "-", "ffminus", "dash", "\u2013", "\u2014"];
26619   utilKeybinding.keys = {
26620     // Backspace key, on Mac: ⌫ (Backspace)
26621     "\u232B": "Backspace",
26622     backspace: "Backspace",
26623     // Tab Key, on Mac: ⇥ (Tab), on Windows ⇥⇥
26624     "\u21E5": "Tab",
26625     "\u21C6": "Tab",
26626     tab: "Tab",
26627     // Return key, ↩
26628     "\u21A9": "Enter",
26629     "\u21B5": "Enter",
26630     "\u23CE": "Enter",
26631     "return": "Enter",
26632     enter: "Enter",
26633     "\u2305": "Enter",
26634     // Pause/Break key
26635     "pause": "Pause",
26636     "pause-break": "Pause",
26637     // Caps Lock key, ⇪
26638     "\u21EA": "CapsLock",
26639     caps: "CapsLock",
26640     "caps-lock": "CapsLock",
26641     // Escape key, on Mac: ⎋, on Windows: Esc
26642     "\u238B": ["Escape", "Esc"],
26643     escape: ["Escape", "Esc"],
26644     esc: ["Escape", "Esc"],
26645     // Space key
26646     space: [" ", "Spacebar"],
26647     // Page-Up key, or pgup, on Mac: ↖
26648     "\u2196": "PageUp",
26649     pgup: "PageUp",
26650     "page-up": "PageUp",
26651     // Page-Down key, or pgdown, on Mac: ↘
26652     "\u2198": "PageDown",
26653     pgdown: "PageDown",
26654     "page-down": "PageDown",
26655     // END key, on Mac: ⇟
26656     "\u21DF": "End",
26657     end: "End",
26658     // HOME key, on Mac: ⇞
26659     "\u21DE": "Home",
26660     home: "Home",
26661     // Insert key, or ins
26662     ins: "Insert",
26663     insert: "Insert",
26664     // Delete key, on Mac: ⌦ (Delete)
26665     "\u2326": ["Delete", "Del"],
26666     del: ["Delete", "Del"],
26667     "delete": ["Delete", "Del"],
26668     // Left Arrow Key, or ←
26669     "\u2190": ["ArrowLeft", "Left"],
26670     left: ["ArrowLeft", "Left"],
26671     "arrow-left": ["ArrowLeft", "Left"],
26672     // Up Arrow Key, or ↑
26673     "\u2191": ["ArrowUp", "Up"],
26674     up: ["ArrowUp", "Up"],
26675     "arrow-up": ["ArrowUp", "Up"],
26676     // Right Arrow Key, or →
26677     "\u2192": ["ArrowRight", "Right"],
26678     right: ["ArrowRight", "Right"],
26679     "arrow-right": ["ArrowRight", "Right"],
26680     // Up Arrow Key, or ↓
26681     "\u2193": ["ArrowDown", "Down"],
26682     down: ["ArrowDown", "Down"],
26683     "arrow-down": ["ArrowDown", "Down"],
26684     // odities, stuff for backward compatibility (browsers and code):
26685     // Num-Multiply, or *
26686     "*": ["*", "Multiply"],
26687     star: ["*", "Multiply"],
26688     asterisk: ["*", "Multiply"],
26689     multiply: ["*", "Multiply"],
26690     // Num-Plus or +
26691     "+": ["+", "Add"],
26692     "plus": ["+", "Add"],
26693     // Num-Subtract, or -
26694     "-": ["-", "Subtract"],
26695     subtract: ["-", "Subtract"],
26696     "dash": ["-", "Subtract"],
26697     // Semicolon
26698     semicolon: ";",
26699     // = or equals
26700     equals: "=",
26701     // Comma, or ,
26702     comma: ",",
26703     // Period, or ., or full-stop
26704     period: ".",
26705     "full-stop": ".",
26706     // Slash, or /, or forward-slash
26707     slash: "/",
26708     "forward-slash": "/",
26709     // Tick, or `, or back-quote
26710     tick: "`",
26711     "back-quote": "`",
26712     // Open bracket, or [
26713     "open-bracket": "[",
26714     // Back slash, or \
26715     "back-slash": "\\",
26716     // Close bracket, or ]
26717     "close-bracket": "]",
26718     // Apostrophe, or Quote, or '
26719     quote: "'",
26720     apostrophe: "'",
26721     // NUMPAD 0-9
26722     "num-0": "0",
26723     "num-1": "1",
26724     "num-2": "2",
26725     "num-3": "3",
26726     "num-4": "4",
26727     "num-5": "5",
26728     "num-6": "6",
26729     "num-7": "7",
26730     "num-8": "8",
26731     "num-9": "9",
26732     // F1-F25
26733     f1: "F1",
26734     f2: "F2",
26735     f3: "F3",
26736     f4: "F4",
26737     f5: "F5",
26738     f6: "F6",
26739     f7: "F7",
26740     f8: "F8",
26741     f9: "F9",
26742     f10: "F10",
26743     f11: "F11",
26744     f12: "F12",
26745     f13: "F13",
26746     f14: "F14",
26747     f15: "F15",
26748     f16: "F16",
26749     f17: "F17",
26750     f18: "F18",
26751     f19: "F19",
26752     f20: "F20",
26753     f21: "F21",
26754     f22: "F22",
26755     f23: "F23",
26756     f24: "F24",
26757     f25: "F25"
26758   };
26759   utilKeybinding.keyCodes = {
26760     // Backspace key, on Mac: ⌫ (Backspace)
26761     "\u232B": 8,
26762     backspace: 8,
26763     // Tab Key, on Mac: ⇥ (Tab), on Windows ⇥⇥
26764     "\u21E5": 9,
26765     "\u21C6": 9,
26766     tab: 9,
26767     // Return key, ↩
26768     "\u21A9": 13,
26769     "\u21B5": 13,
26770     "\u23CE": 13,
26771     "return": 13,
26772     enter: 13,
26773     "\u2305": 13,
26774     // Pause/Break key
26775     "pause": 19,
26776     "pause-break": 19,
26777     // Caps Lock key, ⇪
26778     "\u21EA": 20,
26779     caps: 20,
26780     "caps-lock": 20,
26781     // Escape key, on Mac: ⎋, on Windows: Esc
26782     "\u238B": 27,
26783     escape: 27,
26784     esc: 27,
26785     // Space key
26786     space: 32,
26787     // Page-Up key, or pgup, on Mac: ↖
26788     "\u2196": 33,
26789     pgup: 33,
26790     "page-up": 33,
26791     // Page-Down key, or pgdown, on Mac: ↘
26792     "\u2198": 34,
26793     pgdown: 34,
26794     "page-down": 34,
26795     // END key, on Mac: ⇟
26796     "\u21DF": 35,
26797     end: 35,
26798     // HOME key, on Mac: ⇞
26799     "\u21DE": 36,
26800     home: 36,
26801     // Insert key, or ins
26802     ins: 45,
26803     insert: 45,
26804     // Delete key, on Mac: ⌦ (Delete)
26805     "\u2326": 46,
26806     del: 46,
26807     "delete": 46,
26808     // Left Arrow Key, or ←
26809     "\u2190": 37,
26810     left: 37,
26811     "arrow-left": 37,
26812     // Up Arrow Key, or ↑
26813     "\u2191": 38,
26814     up: 38,
26815     "arrow-up": 38,
26816     // Right Arrow Key, or →
26817     "\u2192": 39,
26818     right: 39,
26819     "arrow-right": 39,
26820     // Up Arrow Key, or ↓
26821     "\u2193": 40,
26822     down: 40,
26823     "arrow-down": 40,
26824     // odities, printing characters that come out wrong:
26825     // Firefox Equals
26826     "ffequals": 61,
26827     // Num-Multiply, or *
26828     "*": 106,
26829     star: 106,
26830     asterisk: 106,
26831     multiply: 106,
26832     // Num-Plus or +
26833     "+": 107,
26834     "plus": 107,
26835     // Num-Subtract, or -
26836     "-": 109,
26837     subtract: 109,
26838     // Vertical Bar / Pipe
26839     "|": 124,
26840     // Firefox Plus
26841     "ffplus": 171,
26842     // Firefox Minus
26843     "ffminus": 173,
26844     // Semicolon
26845     ";": 186,
26846     semicolon: 186,
26847     // = or equals
26848     "=": 187,
26849     "equals": 187,
26850     // Comma, or ,
26851     ",": 188,
26852     comma: 188,
26853     // Dash / Underscore key
26854     "dash": 189,
26855     // Period, or ., or full-stop
26856     ".": 190,
26857     period: 190,
26858     "full-stop": 190,
26859     // Slash, or /, or forward-slash
26860     "/": 191,
26861     slash: 191,
26862     "forward-slash": 191,
26863     // Tick, or `, or back-quote
26864     "`": 192,
26865     tick: 192,
26866     "back-quote": 192,
26867     // Open bracket, or [
26868     "[": 219,
26869     "open-bracket": 219,
26870     // Back slash, or \
26871     "\\": 220,
26872     "back-slash": 220,
26873     // Close bracket, or ]
26874     "]": 221,
26875     "close-bracket": 221,
26876     // Apostrophe, or Quote, or '
26877     "'": 222,
26878     quote: 222,
26879     apostrophe: 222
26880   };
26881   var i = 95;
26882   var n = 0;
26883   while (++i < 106) {
26884     utilKeybinding.keyCodes["num-" + n] = i;
26885     ++n;
26886   }
26887   i = 47;
26888   n = 0;
26889   while (++i < 58) {
26890     utilKeybinding.keyCodes[n] = i;
26891     ++n;
26892   }
26893   i = 111;
26894   n = 1;
26895   while (++i < 136) {
26896     utilKeybinding.keyCodes["f" + n] = i;
26897     ++n;
26898   }
26899   i = 64;
26900   while (++i < 91) {
26901     utilKeybinding.keyCodes[String.fromCharCode(i).toLowerCase()] = i;
26902   }
26903
26904   // modules/util/object.js
26905   function utilObjectOmit(obj, omitKeys) {
26906     return Object.keys(obj).reduce(function(result, key) {
26907       if (omitKeys.indexOf(key) === -1) {
26908         result[key] = obj[key];
26909       }
26910       return result;
26911     }, {});
26912   }
26913
26914   // modules/util/rebind.js
26915   function utilRebind(target, source) {
26916     var i3 = 1, n3 = arguments.length, method;
26917     while (++i3 < n3) {
26918       target[method = arguments[i3]] = d3_rebind(target, source, source[method]);
26919     }
26920     return target;
26921   }
26922   function d3_rebind(target, source, method) {
26923     return function() {
26924       var value = method.apply(source, arguments);
26925       return value === source ? target : value;
26926     };
26927   }
26928
26929   // modules/util/session_mutex.js
26930   function utilSessionMutex(name) {
26931     var mutex = {};
26932     var intervalID;
26933     function renew() {
26934       var expires = /* @__PURE__ */ new Date();
26935       expires.setSeconds(expires.getSeconds() + 5);
26936       document.cookie = name + "=1; expires=" + expires.toUTCString() + "; sameSite=strict";
26937     }
26938     mutex.lock = function() {
26939       if (intervalID) return true;
26940       var cookie = document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + name + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1");
26941       if (cookie) return false;
26942       renew();
26943       intervalID = window.setInterval(renew, 4e3);
26944       return true;
26945     };
26946     mutex.unlock = function() {
26947       if (!intervalID) return;
26948       document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; sameSite=strict";
26949       clearInterval(intervalID);
26950       intervalID = null;
26951     };
26952     mutex.locked = function() {
26953       return !!intervalID;
26954     };
26955     return mutex;
26956   }
26957
26958   // modules/util/tiler.js
26959   function utilTiler() {
26960     var _size = [256, 256];
26961     var _scale = 256;
26962     var _tileSize = 256;
26963     var _zoomExtent = [0, 20];
26964     var _translate = [_size[0] / 2, _size[1] / 2];
26965     var _margin = 0;
26966     var _skipNullIsland = false;
26967     function clamp3(num, min3, max3) {
26968       return Math.max(min3, Math.min(num, max3));
26969     }
26970     function nearNullIsland(tile) {
26971       var x2 = tile[0];
26972       var y2 = tile[1];
26973       var z2 = tile[2];
26974       if (z2 >= 7) {
26975         var center = Math.pow(2, z2 - 1);
26976         var width = Math.pow(2, z2 - 6);
26977         var min3 = center - width / 2;
26978         var max3 = center + width / 2 - 1;
26979         return x2 >= min3 && x2 <= max3 && y2 >= min3 && y2 <= max3;
26980       }
26981       return false;
26982     }
26983     function tiler8() {
26984       var z2 = geoScaleToZoom(_scale / (2 * Math.PI), _tileSize);
26985       var z0 = clamp3(Math.round(z2), _zoomExtent[0], _zoomExtent[1]);
26986       var tileMin = 0;
26987       var tileMax = Math.pow(2, z0) - 1;
26988       var log2ts = Math.log(_tileSize) * Math.LOG2E;
26989       var k2 = Math.pow(2, z2 - z0 + log2ts);
26990       var origin = [
26991         (_translate[0] - _scale / 2) / k2,
26992         (_translate[1] - _scale / 2) / k2
26993       ];
26994       var cols = range(
26995         clamp3(Math.floor(-origin[0]) - _margin, tileMin, tileMax + 1),
26996         clamp3(Math.ceil(_size[0] / k2 - origin[0]) + _margin, tileMin, tileMax + 1)
26997       );
26998       var rows = range(
26999         clamp3(Math.floor(-origin[1]) - _margin, tileMin, tileMax + 1),
27000         clamp3(Math.ceil(_size[1] / k2 - origin[1]) + _margin, tileMin, tileMax + 1)
27001       );
27002       var tiles = [];
27003       for (var i3 = 0; i3 < rows.length; i3++) {
27004         var y2 = rows[i3];
27005         for (var j2 = 0; j2 < cols.length; j2++) {
27006           var x2 = cols[j2];
27007           if (i3 >= _margin && i3 <= rows.length - _margin && j2 >= _margin && j2 <= cols.length - _margin) {
27008             tiles.unshift([x2, y2, z0]);
27009           } else {
27010             tiles.push([x2, y2, z0]);
27011           }
27012         }
27013       }
27014       tiles.translate = origin;
27015       tiles.scale = k2;
27016       return tiles;
27017     }
27018     tiler8.getTiles = function(projection2) {
27019       var origin = [
27020         projection2.scale() * Math.PI - projection2.translate()[0],
27021         projection2.scale() * Math.PI - projection2.translate()[1]
27022       ];
27023       this.size(projection2.clipExtent()[1]).scale(projection2.scale() * 2 * Math.PI).translate(projection2.translate());
27024       var tiles = tiler8();
27025       var ts = tiles.scale;
27026       return tiles.map(function(tile) {
27027         if (_skipNullIsland && nearNullIsland(tile)) {
27028           return false;
27029         }
27030         var x2 = tile[0] * ts - origin[0];
27031         var y2 = tile[1] * ts - origin[1];
27032         return {
27033           id: tile.toString(),
27034           xyz: tile,
27035           extent: geoExtent(
27036             projection2.invert([x2, y2 + ts]),
27037             projection2.invert([x2 + ts, y2])
27038           )
27039         };
27040       }).filter(Boolean);
27041     };
27042     tiler8.getGeoJSON = function(projection2) {
27043       var features = tiler8.getTiles(projection2).map(function(tile) {
27044         return {
27045           type: "Feature",
27046           properties: {
27047             id: tile.id,
27048             name: tile.id
27049           },
27050           geometry: {
27051             type: "Polygon",
27052             coordinates: [tile.extent.polygon()]
27053           }
27054         };
27055       });
27056       return {
27057         type: "FeatureCollection",
27058         features
27059       };
27060     };
27061     tiler8.tileSize = function(val) {
27062       if (!arguments.length) return _tileSize;
27063       _tileSize = val;
27064       return tiler8;
27065     };
27066     tiler8.zoomExtent = function(val) {
27067       if (!arguments.length) return _zoomExtent;
27068       _zoomExtent = val;
27069       return tiler8;
27070     };
27071     tiler8.size = function(val) {
27072       if (!arguments.length) return _size;
27073       _size = val;
27074       return tiler8;
27075     };
27076     tiler8.scale = function(val) {
27077       if (!arguments.length) return _scale;
27078       _scale = val;
27079       return tiler8;
27080     };
27081     tiler8.translate = function(val) {
27082       if (!arguments.length) return _translate;
27083       _translate = val;
27084       return tiler8;
27085     };
27086     tiler8.margin = function(val) {
27087       if (!arguments.length) return _margin;
27088       _margin = +val;
27089       return tiler8;
27090     };
27091     tiler8.skipNullIsland = function(val) {
27092       if (!arguments.length) return _skipNullIsland;
27093       _skipNullIsland = val;
27094       return tiler8;
27095     };
27096     return tiler8;
27097   }
27098
27099   // modules/util/trigger_event.js
27100   function utilTriggerEvent(target, type2, eventProperties) {
27101     target.each(function() {
27102       var evt = document.createEvent("HTMLEvents");
27103       evt.initEvent(type2, true, true);
27104       for (var prop in eventProperties) {
27105         evt[prop] = eventProperties[prop];
27106       }
27107       this.dispatchEvent(evt);
27108     });
27109   }
27110
27111   // modules/util/units.js
27112   var OSM_PRECISION = 7;
27113   function displayLength(m2, isImperial) {
27114     var d2 = m2 * (isImperial ? 3.28084 : 1);
27115     var unit2;
27116     if (isImperial) {
27117       if (d2 >= 5280) {
27118         d2 /= 5280;
27119         unit2 = "miles";
27120       } else {
27121         unit2 = "feet";
27122       }
27123     } else {
27124       if (d2 >= 1e3) {
27125         d2 /= 1e3;
27126         unit2 = "kilometers";
27127       } else {
27128         unit2 = "meters";
27129       }
27130     }
27131     return _t("units." + unit2, {
27132       quantity: d2.toLocaleString(_mainLocalizer.localeCode(), {
27133         maximumSignificantDigits: 4
27134       })
27135     });
27136   }
27137   function displayArea(m2, isImperial) {
27138     var locale2 = _mainLocalizer.localeCode();
27139     var d2 = m2 * (isImperial ? 10.7639111056 : 1);
27140     var d1, d22, area;
27141     var unit1 = "";
27142     var unit2 = "";
27143     if (isImperial) {
27144       if (d2 >= 6969600) {
27145         d1 = d2 / 27878400;
27146         unit1 = "square_miles";
27147       } else {
27148         d1 = d2;
27149         unit1 = "square_feet";
27150       }
27151       if (d2 > 4356 && d2 < 4356e4) {
27152         d22 = d2 / 43560;
27153         unit2 = "acres";
27154       }
27155     } else {
27156       if (d2 >= 25e4) {
27157         d1 = d2 / 1e6;
27158         unit1 = "square_kilometers";
27159       } else {
27160         d1 = d2;
27161         unit1 = "square_meters";
27162       }
27163       if (d2 > 1e3 && d2 < 1e7) {
27164         d22 = d2 / 1e4;
27165         unit2 = "hectares";
27166       }
27167     }
27168     area = _t("units." + unit1, {
27169       quantity: d1.toLocaleString(locale2, {
27170         maximumSignificantDigits: 4
27171       })
27172     });
27173     if (d22) {
27174       return _t("units.area_pair", {
27175         area1: area,
27176         area2: _t("units." + unit2, {
27177           quantity: d22.toLocaleString(locale2, {
27178             maximumSignificantDigits: 2
27179           })
27180         })
27181       });
27182     } else {
27183       return area;
27184     }
27185   }
27186   function wrap(x2, min3, max3) {
27187     var d2 = max3 - min3;
27188     return ((x2 - min3) % d2 + d2) % d2 + min3;
27189   }
27190   function clamp(x2, min3, max3) {
27191     return Math.max(min3, Math.min(x2, max3));
27192   }
27193   function roundToDecimal(target, decimalPlace) {
27194     target = Number(target);
27195     decimalPlace = Number(decimalPlace);
27196     const factor = Math.pow(10, decimalPlace);
27197     return Math.round(target * factor) / factor;
27198   }
27199   function displayCoordinate(deg, pos, neg) {
27200     var displayCoordinate2;
27201     var locale2 = _mainLocalizer.localeCode();
27202     var degreesFloor = Math.floor(Math.abs(deg));
27203     var min3 = (Math.abs(deg) - degreesFloor) * 60;
27204     var minFloor = Math.floor(min3);
27205     var sec = (min3 - minFloor) * 60;
27206     var fix = roundToDecimal(sec, 8);
27207     var secRounded = roundToDecimal(fix, 0);
27208     if (secRounded === 60) {
27209       secRounded = 0;
27210       minFloor += 1;
27211       if (minFloor === 60) {
27212         minFloor = 0;
27213         degreesFloor += 1;
27214       }
27215     }
27216     displayCoordinate2 = _t("units.arcdegrees", {
27217       quantity: degreesFloor.toLocaleString(locale2)
27218     }) + (minFloor !== 0 || secRounded !== 0 ? _t("units.arcminutes", {
27219       quantity: minFloor.toLocaleString(locale2)
27220     }) : "") + (secRounded !== 0 ? _t("units.arcseconds", {
27221       quantity: secRounded.toLocaleString(locale2)
27222     }) : "");
27223     if (deg === 0) {
27224       return displayCoordinate2;
27225     } else {
27226       return _t("units.coordinate", {
27227         coordinate: displayCoordinate2,
27228         direction: _t("units." + (deg > 0 ? pos : neg))
27229       });
27230     }
27231   }
27232   function dmsCoordinatePair(coord2) {
27233     return _t("units.coordinate_pair", {
27234       latitude: displayCoordinate(clamp(coord2[1], -90, 90), "north", "south"),
27235       longitude: displayCoordinate(wrap(coord2[0], -180, 180), "east", "west")
27236     });
27237   }
27238   function decimalCoordinatePair(coord2) {
27239     return _t("units.coordinate_pair", {
27240       latitude: clamp(coord2[1], -90, 90).toFixed(OSM_PRECISION),
27241       longitude: wrap(coord2[0], -180, 180).toFixed(OSM_PRECISION)
27242     });
27243   }
27244   function dmsMatcher(q2) {
27245     const matchers = [
27246       // D M SS , D M SS  ex: 35 11 10.1 , 136 49 53.8
27247       {
27248         condition: /^\s*(-?)\s*(\d+)\s+(\d+)\s+(\d+\.?\d*)\s*\,\s*(-?)\s*(\d+)\s+(\d+)\s+(\d+\.?\d*)\s*$/,
27249         parser: function(q3) {
27250           const match = this.condition.exec(q3);
27251           const lat = +match[2] + +match[3] / 60 + +match[4] / 3600;
27252           const lng = +match[6] + +match[7] / 60 + +match[8] / 3600;
27253           const isNegLat = match[1] === "-" ? -lat : lat;
27254           const isNegLng = match[5] === "-" ? -lng : lng;
27255           const d2 = [isNegLat, isNegLng];
27256           return d2;
27257         }
27258       },
27259       // D MM , D MM ex: 35 11.1683 , 136 49.8966
27260       {
27261         condition: /^\s*(-?)\s*(\d+)\s+(\d+\.?\d*)\s*\,\s*(-?)\s*(\d+)\s+(\d+\.?\d*)\s*$/,
27262         parser: function(q3) {
27263           const match = this.condition.exec(q3);
27264           const lat = +match[2] + +match[3] / 60;
27265           const lng = +match[5] + +match[6] / 60;
27266           const isNegLat = match[1] === "-" ? -lat : lat;
27267           const isNegLng = match[4] === "-" ? -lng : lng;
27268           const d2 = [isNegLat, isNegLng];
27269           return d2;
27270         }
27271       }
27272     ];
27273     for (const matcher of matchers) {
27274       if (matcher.condition.test(q2)) {
27275         return matcher.parser(q2);
27276       }
27277     }
27278     return null;
27279   }
27280
27281   // modules/core/localizer.js
27282   var _mainLocalizer = coreLocalizer();
27283   var _t = _mainLocalizer.t;
27284   function coreLocalizer() {
27285     let localizer = {};
27286     let _dataLanguages = {};
27287     let _dataLocales = {};
27288     let _localeStrings = {};
27289     let _localeCode = "en-US";
27290     let _localeCodes = ["en-US", "en"];
27291     let _languageCode = "en";
27292     let _textDirection = "ltr";
27293     let _usesMetric = false;
27294     let _languageNames = {};
27295     let _scriptNames = {};
27296     localizer.localeCode = () => _localeCode;
27297     localizer.localeCodes = () => _localeCodes;
27298     localizer.languageCode = () => _languageCode;
27299     localizer.textDirection = () => _textDirection;
27300     localizer.usesMetric = () => _usesMetric;
27301     localizer.languageNames = () => _languageNames;
27302     localizer.scriptNames = () => _scriptNames;
27303     let _preferredLocaleCodes = [];
27304     localizer.preferredLocaleCodes = function(codes) {
27305       if (!arguments.length) return _preferredLocaleCodes;
27306       if (typeof codes === "string") {
27307         _preferredLocaleCodes = codes.split(/,|;| /gi).filter(Boolean);
27308       } else {
27309         _preferredLocaleCodes = codes;
27310       }
27311       return localizer;
27312     };
27313     var _loadPromise;
27314     localizer.ensureLoaded = () => {
27315       if (_loadPromise) return _loadPromise;
27316       let filesToFetch = [
27317         "languages",
27318         // load the list of languages
27319         "locales"
27320         // load the list of supported locales
27321       ];
27322       const localeDirs = {
27323         general: "locales",
27324         tagging: presetsCdnUrl + "dist/translations"
27325       };
27326       let fileMap = _mainFileFetcher.fileMap();
27327       for (let scopeId in localeDirs) {
27328         const key = "locales_index_".concat(scopeId);
27329         if (!fileMap[key]) {
27330           fileMap[key] = localeDirs[scopeId] + "/index.min.json";
27331         }
27332         filesToFetch.push(key);
27333       }
27334       return _loadPromise = Promise.all(filesToFetch.map((key) => _mainFileFetcher.get(key))).then((results) => {
27335         _dataLanguages = results[0];
27336         _dataLocales = results[1];
27337         let indexes = results.slice(2);
27338         let requestedLocales = (_preferredLocaleCodes || []).concat(utilDetect().browserLocales).concat(["en"]);
27339         _localeCodes = localesToUseFrom(requestedLocales);
27340         _localeCode = _localeCodes[0];
27341         let loadStringsPromises = [];
27342         indexes.forEach((index, i3) => {
27343           const fullCoverageIndex = _localeCodes.findIndex(function(locale2) {
27344             return index[locale2] && index[locale2].pct === 1;
27345           });
27346           _localeCodes.slice(0, fullCoverageIndex + 1).forEach(function(code) {
27347             let scopeId = Object.keys(localeDirs)[i3];
27348             let directory = Object.values(localeDirs)[i3];
27349             if (index[code]) loadStringsPromises.push(localizer.loadLocale(code, scopeId, directory));
27350           });
27351         });
27352         return Promise.all(loadStringsPromises);
27353       }).then(() => {
27354         updateForCurrentLocale();
27355       }).catch((err) => console.error(err));
27356     };
27357     function localesToUseFrom(requestedLocales) {
27358       let supportedLocales = _dataLocales;
27359       let toUse = [];
27360       for (let i3 in requestedLocales) {
27361         let locale2 = requestedLocales[i3];
27362         if (supportedLocales[locale2]) toUse.push(locale2);
27363         if (locale2.includes("-")) {
27364           let langPart = locale2.split("-")[0];
27365           if (supportedLocales[langPart]) toUse.push(langPart);
27366         }
27367       }
27368       return utilArrayUniq(toUse);
27369     }
27370     function updateForCurrentLocale() {
27371       if (!_localeCode) return;
27372       _languageCode = _localeCode.split("-")[0];
27373       const currentData = _dataLocales[_localeCode] || _dataLocales[_languageCode];
27374       const hash = utilStringQs(window.location.hash);
27375       if (hash.rtl === "true") {
27376         _textDirection = "rtl";
27377       } else if (hash.rtl === "false") {
27378         _textDirection = "ltr";
27379       } else {
27380         _textDirection = currentData && currentData.rtl ? "rtl" : "ltr";
27381       }
27382       let locale2 = _localeCode;
27383       if (locale2.toLowerCase() === "en-us") locale2 = "en";
27384       _languageNames = _localeStrings.general[locale2].languageNames || _localeStrings.general[_languageCode].languageNames;
27385       _scriptNames = _localeStrings.general[locale2].scriptNames || _localeStrings.general[_languageCode].scriptNames;
27386       _usesMetric = _localeCode.slice(-3).toLowerCase() !== "-us";
27387     }
27388     localizer.loadLocale = (locale2, scopeId, directory) => {
27389       if (locale2.toLowerCase() === "en-us") locale2 = "en";
27390       if (_localeStrings[scopeId] && _localeStrings[scopeId][locale2]) {
27391         return Promise.resolve(locale2);
27392       }
27393       let fileMap = _mainFileFetcher.fileMap();
27394       const key = "locale_".concat(scopeId, "_").concat(locale2);
27395       if (!fileMap[key]) {
27396         fileMap[key] = "".concat(directory, "/").concat(locale2, ".min.json");
27397       }
27398       return _mainFileFetcher.get(key).then((d2) => {
27399         if (!_localeStrings[scopeId]) _localeStrings[scopeId] = {};
27400         _localeStrings[scopeId][locale2] = d2[locale2];
27401         return locale2;
27402       });
27403     };
27404     localizer.pluralRule = function(number3) {
27405       return pluralRule(number3, _localeCode);
27406     };
27407     function pluralRule(number3, localeCode) {
27408       const rules = "Intl" in window && Intl.PluralRules && new Intl.PluralRules(localeCode);
27409       if (rules) {
27410         return rules.select(number3);
27411       }
27412       if (number3 === 1) return "one";
27413       return "other";
27414     }
27415     localizer.tInfo = function(origStringId, replacements, locale2) {
27416       let stringId = origStringId.trim();
27417       let scopeId = "general";
27418       if (stringId[0] === "_") {
27419         let split = stringId.split(".");
27420         scopeId = split[0].slice(1);
27421         stringId = split.slice(1).join(".");
27422       }
27423       locale2 = locale2 || _localeCode;
27424       let path = stringId.split(".").map((s2) => s2.replace(/<TX_DOT>/g, ".")).reverse();
27425       let stringsKey = locale2;
27426       if (stringsKey.toLowerCase() === "en-us") stringsKey = "en";
27427       let result = _localeStrings && _localeStrings[scopeId] && _localeStrings[scopeId][stringsKey];
27428       while (result !== void 0 && path.length) {
27429         result = result[path.pop()];
27430       }
27431       if (result !== void 0) {
27432         if (replacements) {
27433           if (typeof result === "object" && Object.keys(result).length) {
27434             const number3 = Object.values(replacements).find(function(value) {
27435               return typeof value === "number";
27436             });
27437             if (number3 !== void 0) {
27438               const rule = pluralRule(number3, locale2);
27439               if (result[rule]) {
27440                 result = result[rule];
27441               } else {
27442                 result = Object.values(result)[0];
27443               }
27444             }
27445           }
27446           if (typeof result === "string") {
27447             for (let key in replacements) {
27448               let value = replacements[key];
27449               if (typeof value === "number") {
27450                 if (value.toLocaleString) {
27451                   value = value.toLocaleString(locale2, {
27452                     style: "decimal",
27453                     useGrouping: true,
27454                     minimumFractionDigits: 0
27455                   });
27456                 } else {
27457                   value = value.toString();
27458                 }
27459               }
27460               const token = "{".concat(key, "}");
27461               const regex = new RegExp(token, "g");
27462               result = result.replace(regex, value);
27463             }
27464           }
27465         }
27466         if (typeof result === "string") {
27467           return {
27468             text: result,
27469             locale: locale2
27470           };
27471         }
27472       }
27473       let index = _localeCodes.indexOf(locale2);
27474       if (index >= 0 && index < _localeCodes.length - 1) {
27475         let fallback = _localeCodes[index + 1];
27476         return localizer.tInfo(origStringId, replacements, fallback);
27477       }
27478       if (replacements && "default" in replacements) {
27479         return {
27480           text: replacements.default,
27481           locale: null
27482         };
27483       }
27484       const missing = "Missing ".concat(locale2, " translation: ").concat(origStringId);
27485       if (typeof console !== "undefined") console.error(missing);
27486       return {
27487         text: missing,
27488         locale: "en"
27489       };
27490     };
27491     localizer.hasTextForStringId = function(stringId) {
27492       return !!localizer.tInfo(stringId, { default: "nothing found" }).locale;
27493     };
27494     localizer.t = function(stringId, replacements, locale2) {
27495       return localizer.tInfo(stringId, replacements, locale2).text;
27496     };
27497     localizer.t.html = function(stringId, replacements, locale2) {
27498       replacements = Object.assign({}, replacements);
27499       for (var k2 in replacements) {
27500         if (typeof replacements[k2] === "string") {
27501           replacements[k2] = escape_default(replacements[k2]);
27502         }
27503         if (typeof replacements[k2] === "object" && typeof replacements[k2].html === "string") {
27504           replacements[k2] = replacements[k2].html;
27505         }
27506       }
27507       const info = localizer.tInfo(stringId, replacements, locale2);
27508       if (info.text) {
27509         return '<span class="localized-text" lang="'.concat(info.locale || "und", '">').concat(info.text, "</span>");
27510       } else {
27511         return "";
27512       }
27513     };
27514     localizer.t.append = function(stringId, replacements, locale2) {
27515       const ret = function(selection2) {
27516         const info = localizer.tInfo(stringId, replacements, locale2);
27517         return selection2.append("span").attr("class", "localized-text").attr("lang", info.locale || "und").text((replacements && replacements.prefix || "") + info.text + (replacements && replacements.suffix || ""));
27518       };
27519       ret.stringId = stringId;
27520       return ret;
27521     };
27522     localizer.t.addOrUpdate = function(stringId, replacements, locale2) {
27523       const ret = function(selection2) {
27524         const info = localizer.tInfo(stringId, replacements, locale2);
27525         const span = selection2.selectAll("span.localized-text").data([info]);
27526         const enter = span.enter().append("span").classed("localized-text", true);
27527         span.merge(enter).attr("lang", info.locale || "und").text((replacements && replacements.prefix || "") + info.text + (replacements && replacements.suffix || ""));
27528       };
27529       ret.stringId = stringId;
27530       return ret;
27531     };
27532     localizer.languageName = (code, options2) => {
27533       if (_languageNames && _languageNames[code]) {
27534         return _languageNames[code];
27535       }
27536       if (options2 && options2.localOnly) return null;
27537       const langInfo = _dataLanguages[code];
27538       if (langInfo) {
27539         if (langInfo.nativeName) {
27540           return localizer.t("translate.language_and_code", { language: langInfo.nativeName, code });
27541         } else if (langInfo.base && langInfo.script) {
27542           const base = langInfo.base;
27543           if (_languageNames && _languageNames[base]) {
27544             const scriptCode = langInfo.script;
27545             const script = _scriptNames && _scriptNames[scriptCode] || scriptCode;
27546             return localizer.t("translate.language_and_code", { language: _languageNames[base], code: script });
27547           } else if (_dataLanguages[base] && _dataLanguages[base].nativeName) {
27548             return localizer.t("translate.language_and_code", { language: _dataLanguages[base].nativeName, code });
27549           }
27550         }
27551       }
27552       return code;
27553     };
27554     localizer.floatFormatter = (locale2) => {
27555       if (!("Intl" in window && "NumberFormat" in Intl && "formatToParts" in Intl.NumberFormat.prototype)) {
27556         return (number3, fractionDigits) => {
27557           return fractionDigits === void 0 ? number3.toString() : number3.toFixed(fractionDigits);
27558         };
27559       } else {
27560         return (number3, fractionDigits) => number3.toLocaleString(locale2, {
27561           minimumFractionDigits: fractionDigits,
27562           maximumFractionDigits: fractionDigits === void 0 ? 20 : fractionDigits
27563         });
27564       }
27565     };
27566     localizer.floatParser = (locale2) => {
27567       const polyfill = (string) => +string.trim();
27568       if (!("Intl" in window && "NumberFormat" in Intl)) return polyfill;
27569       const format2 = new Intl.NumberFormat(locale2, { maximumFractionDigits: 20 });
27570       if (!("formatToParts" in format2)) return polyfill;
27571       const parts = format2.formatToParts(-12345.6);
27572       const numerals = Array.from({ length: 10 }).map((_2, i3) => format2.format(i3));
27573       const index = new Map(numerals.map((d2, i3) => [d2, i3]));
27574       const literalPart = parts.find((d2) => d2.type === "literal");
27575       const literal = literalPart && new RegExp("[".concat(literalPart.value, "]"), "g");
27576       const groupPart = parts.find((d2) => d2.type === "group");
27577       const group = groupPart && new RegExp("[".concat(groupPart.value, "]"), "g");
27578       const decimalPart = parts.find((d2) => d2.type === "decimal");
27579       const decimal = decimalPart && new RegExp("[".concat(decimalPart.value, "]"));
27580       const numeral = new RegExp("[".concat(numerals.join(""), "]"), "g");
27581       const getIndex = (d2) => index.get(d2);
27582       return (string) => {
27583         string = string.trim();
27584         if (literal) string = string.replace(literal, "");
27585         if (group) string = string.replace(group, "");
27586         if (decimal) string = string.replace(decimal, ".");
27587         string = string.replace(numeral, getIndex);
27588         return string ? +string : NaN;
27589       };
27590     };
27591     localizer.decimalPlaceCounter = (locale2) => {
27592       var literal, group, decimal;
27593       if ("Intl" in window && "NumberFormat" in Intl) {
27594         const format2 = new Intl.NumberFormat(locale2, { maximumFractionDigits: 20 });
27595         if ("formatToParts" in format2) {
27596           const parts = format2.formatToParts(-12345.6);
27597           const literalPart = parts.find((d2) => d2.type === "literal");
27598           literal = literalPart && new RegExp("[".concat(literalPart.value, "]"), "g");
27599           const groupPart = parts.find((d2) => d2.type === "group");
27600           group = groupPart && new RegExp("[".concat(groupPart.value, "]"), "g");
27601           const decimalPart = parts.find((d2) => d2.type === "decimal");
27602           decimal = decimalPart && new RegExp("[".concat(decimalPart.value, "]"));
27603         }
27604       }
27605       return (string) => {
27606         string = string.trim();
27607         if (literal) string = string.replace(literal, "");
27608         if (group) string = string.replace(group, "");
27609         const parts = string.split(decimal || ".");
27610         return parts && parts[1] && parts[1].length || 0;
27611       };
27612     };
27613     return localizer;
27614   }
27615
27616   // modules/presets/collection.js
27617   function presetCollection(collection) {
27618     const MAXRESULTS = 50;
27619     let _this = {};
27620     let _memo = {};
27621     _this.collection = collection;
27622     _this.item = (id2) => {
27623       if (_memo[id2]) return _memo[id2];
27624       const found = _this.collection.find((d2) => d2.id === id2);
27625       if (found) _memo[id2] = found;
27626       return found;
27627     };
27628     _this.index = (id2) => _this.collection.findIndex((d2) => d2.id === id2);
27629     _this.matchGeometry = (geometry) => {
27630       return presetCollection(
27631         _this.collection.filter((d2) => d2.matchGeometry(geometry))
27632       );
27633     };
27634     _this.matchAllGeometry = (geometries) => {
27635       return presetCollection(
27636         _this.collection.filter((d2) => d2 && d2.matchAllGeometry(geometries))
27637       );
27638     };
27639     _this.matchAnyGeometry = (geometries) => {
27640       return presetCollection(
27641         _this.collection.filter((d2) => geometries.some((geom) => d2.matchGeometry(geom)))
27642       );
27643     };
27644     _this.fallback = (geometry) => {
27645       let id2 = geometry;
27646       if (id2 === "vertex") id2 = "point";
27647       return _this.item(id2);
27648     };
27649     _this.search = (value, geometry, loc) => {
27650       if (!value) return _this;
27651       value = value.toLowerCase().trim();
27652       function leading(a2) {
27653         const index = a2.indexOf(value);
27654         return index === 0 || a2[index - 1] === " ";
27655       }
27656       function leadingStrict(a2) {
27657         const index = a2.indexOf(value);
27658         return index === 0;
27659       }
27660       function sortPresets(nameProp, aliasesProp) {
27661         return function sortNames(a2, b2) {
27662           let aCompare = a2[nameProp]();
27663           let bCompare = b2[nameProp]();
27664           if (aliasesProp) {
27665             const findMatchingAlias = (strings) => {
27666               if (strings.some((s2) => s2 === value)) {
27667                 return strings.find((s2) => s2 === value);
27668               } else {
27669                 return strings.filter((s2) => s2.includes(value)).sort((a3, b3) => a3.length - b3.length)[0];
27670               }
27671             };
27672             aCompare = findMatchingAlias([aCompare].concat(a2[aliasesProp]()));
27673             bCompare = findMatchingAlias([bCompare].concat(b2[aliasesProp]()));
27674           }
27675           if (value === aCompare) return -1;
27676           if (value === bCompare) return 1;
27677           let i3 = b2.originalScore - a2.originalScore;
27678           if (i3 !== 0) return i3;
27679           i3 = aCompare.indexOf(value) - bCompare.indexOf(value);
27680           if (i3 !== 0) return i3;
27681           return aCompare.length - bCompare.length;
27682         };
27683       }
27684       let pool = _this.collection;
27685       if (Array.isArray(loc)) {
27686         const validHere = _sharedLocationManager.locationSetsAt(loc);
27687         pool = pool.filter((a2) => !a2.locationSetID || validHere[a2.locationSetID]);
27688       }
27689       const searchable = pool.filter((a2) => a2.searchable !== false && a2.suggestion !== true);
27690       const suggestions = pool.filter((a2) => a2.suggestion === true);
27691       const leadingNames = searchable.filter((a2) => leading(a2.searchName()) || a2.searchAliases().some(leading)).sort(sortPresets("searchName", "searchAliases"));
27692       const leadingSuggestions = suggestions.filter((a2) => leadingStrict(a2.searchName())).sort(sortPresets("searchName"));
27693       const leadingNamesStripped = searchable.filter((a2) => leading(a2.searchNameStripped()) || a2.searchAliasesStripped().some(leading)).sort(sortPresets("searchNameStripped", "searchAliasesStripped"));
27694       const leadingSuggestionsStripped = suggestions.filter((a2) => leadingStrict(a2.searchNameStripped())).sort(sortPresets("searchNameStripped"));
27695       const leadingTerms = searchable.filter((a2) => (a2.terms() || []).some(leading));
27696       const leadingSuggestionTerms = suggestions.filter((a2) => (a2.terms() || []).some(leading));
27697       const leadingTagValues = searchable.filter((a2) => Object.values(a2.tags || {}).filter((val) => val !== "*").some(leading));
27698       const similarName = searchable.map((a2) => ({ preset: a2, dist: utilEditDistance(value, a2.searchName()) })).filter((a2) => a2.dist + Math.min(value.length - a2.preset.searchName().length, 0) < 3).sort((a2, b2) => a2.dist - b2.dist).map((a2) => a2.preset);
27699       const similarSuggestions = suggestions.map((a2) => ({ preset: a2, dist: utilEditDistance(value, a2.searchName()) })).filter((a2) => a2.dist + Math.min(value.length - a2.preset.searchName().length, 0) < 1).sort((a2, b2) => a2.dist - b2.dist).map((a2) => a2.preset);
27700       const similarTerms = searchable.filter((a2) => {
27701         return (a2.terms() || []).some((b2) => {
27702           return utilEditDistance(value, b2) + Math.min(value.length - b2.length, 0) < 3;
27703         });
27704       });
27705       let leadingTagKeyValues = [];
27706       if (value.includes("=")) {
27707         leadingTagKeyValues = searchable.filter((a2) => a2.tags && Object.keys(a2.tags).some((key) => key + "=" + a2.tags[key] === value)).concat(searchable.filter((a2) => a2.tags && Object.keys(a2.tags).some((key) => leading(key + "=" + a2.tags[key]))));
27708       }
27709       let results = leadingNames.concat(
27710         leadingSuggestions,
27711         leadingNamesStripped,
27712         leadingSuggestionsStripped,
27713         leadingTerms,
27714         leadingSuggestionTerms,
27715         leadingTagValues,
27716         similarName,
27717         similarSuggestions,
27718         similarTerms,
27719         leadingTagKeyValues
27720       ).slice(0, MAXRESULTS - 1);
27721       if (geometry) {
27722         if (typeof geometry === "string") {
27723           results.push(_this.fallback(geometry));
27724         } else {
27725           geometry.forEach((geom) => results.push(_this.fallback(geom)));
27726         }
27727       }
27728       return presetCollection(utilArrayUniq(results));
27729     };
27730     return _this;
27731   }
27732
27733   // modules/presets/category.js
27734   function presetCategory(categoryID, category, allPresets) {
27735     let _this = Object.assign({}, category);
27736     let _searchName;
27737     let _searchNameStripped;
27738     _this.id = categoryID;
27739     _this.members = presetCollection(
27740       (category.members || []).map((presetID) => allPresets[presetID]).filter(Boolean)
27741     );
27742     _this.geometry = _this.members.collection.reduce((acc, preset) => {
27743       for (let i3 in preset.geometry) {
27744         const geometry = preset.geometry[i3];
27745         if (acc.indexOf(geometry) === -1) {
27746           acc.push(geometry);
27747         }
27748       }
27749       return acc;
27750     }, []);
27751     _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0;
27752     _this.matchAllGeometry = (geometries) => _this.members.collection.some((preset) => preset.matchAllGeometry(geometries));
27753     _this.matchScore = () => -1;
27754     _this.name = () => _t("_tagging.presets.categories.".concat(categoryID, ".name"), { "default": categoryID });
27755     _this.nameLabel = () => _t.append("_tagging.presets.categories.".concat(categoryID, ".name"), { "default": categoryID });
27756     _this.terms = () => [];
27757     _this.searchName = () => {
27758       if (!_searchName) {
27759         _searchName = (_this.suggestion ? _this.originalName : _this.name()).toLowerCase();
27760       }
27761       return _searchName;
27762     };
27763     _this.searchNameStripped = () => {
27764       if (!_searchNameStripped) {
27765         _searchNameStripped = _this.searchName();
27766         if (_searchNameStripped.normalize) _searchNameStripped = _searchNameStripped.normalize("NFD");
27767         _searchNameStripped = _searchNameStripped.replace(/[\u0300-\u036f]/g, "");
27768       }
27769       return _searchNameStripped;
27770     };
27771     _this.searchAliases = () => [];
27772     _this.searchAliasesStripped = () => [];
27773     return _this;
27774   }
27775
27776   // modules/presets/field.js
27777   function presetField(fieldID, field, allFields) {
27778     allFields = allFields || {};
27779     let _this = Object.assign({}, field);
27780     _this.id = fieldID;
27781     _this.safeid = utilSafeClassName(fieldID);
27782     _this.matchGeometry = (geom) => !_this.geometry || _this.geometry.indexOf(geom) !== -1;
27783     _this.matchAllGeometry = (geometries) => {
27784       return !_this.geometry || geometries.every((geom) => _this.geometry.indexOf(geom) !== -1);
27785     };
27786     _this.t = (scope, options2) => _t("_tagging.presets.fields.".concat(fieldID, ".").concat(scope), options2);
27787     _this.t.html = (scope, options2) => _t.html("_tagging.presets.fields.".concat(fieldID, ".").concat(scope), options2);
27788     _this.t.append = (scope, options2) => _t.append("_tagging.presets.fields.".concat(fieldID, ".").concat(scope), options2);
27789     _this.hasTextForStringId = (scope) => _mainLocalizer.hasTextForStringId("_tagging.presets.fields.".concat(fieldID, ".").concat(scope));
27790     _this.resolveReference = (which) => {
27791       const referenceRegex = /^\{(.*)\}$/;
27792       const match = (field[which] || "").match(referenceRegex);
27793       if (match) {
27794         const field2 = allFields[match[1]];
27795         if (field2) {
27796           return field2;
27797         }
27798         console.error("Unable to resolve referenced field: ".concat(match[1]));
27799       }
27800       return _this;
27801     };
27802     _this.title = () => _this.overrideLabel || _this.resolveReference("label").t("label", { "default": fieldID });
27803     _this.label = () => _this.overrideLabel ? (selection2) => selection2.text(_this.overrideLabel) : _this.resolveReference("label").t.append("label", { "default": fieldID });
27804     _this.placeholder = () => _this.resolveReference("placeholder").t("placeholder", { "default": "" });
27805     _this.originalTerms = (_this.terms || []).join();
27806     _this.terms = () => _this.resolveReference("label").t("terms", { "default": _this.originalTerms }).toLowerCase().trim().split(/\s*,+\s*/);
27807     _this.increment = _this.type === "number" ? _this.increment || 1 : void 0;
27808     return _this;
27809   }
27810
27811   // modules/presets/preset.js
27812   var import_lodash = __toESM(require_lodash());
27813   function presetPreset(presetID, preset, addable, allFields, allPresets) {
27814     allFields = allFields || {};
27815     allPresets = allPresets || {};
27816     let _this = Object.assign({}, preset);
27817     let _addable = addable || false;
27818     let _searchName;
27819     let _searchNameStripped;
27820     let _searchAliases;
27821     let _searchAliasesStripped;
27822     const referenceRegex = /^\{(.*)\}$/;
27823     _this.id = presetID;
27824     _this.safeid = utilSafeClassName(presetID);
27825     _this.originalTerms = (_this.terms || []).join();
27826     _this.originalName = _this.name || "";
27827     _this.originalAliases = (_this.aliases || []).join("\n");
27828     _this.originalScore = _this.matchScore || 1;
27829     _this.originalReference = _this.reference || {};
27830     _this.originalFields = _this.fields || [];
27831     _this.originalMoreFields = _this.moreFields || [];
27832     _this.fields = (loc) => resolveFields("fields", loc);
27833     _this.moreFields = (loc) => resolveFields("moreFields", loc);
27834     _this.tags = _this.tags || {};
27835     _this.addTags = _this.addTags || _this.tags;
27836     _this.removeTags = _this.removeTags || _this.addTags;
27837     _this.geometry = _this.geometry || [];
27838     _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0;
27839     _this.matchAllGeometry = (geoms) => geoms.every(_this.matchGeometry);
27840     _this.matchScore = (entityTags) => {
27841       const tags = _this.tags;
27842       let seen = {};
27843       let score = 0;
27844       for (let k2 in tags) {
27845         seen[k2] = true;
27846         if (entityTags[k2] === tags[k2]) {
27847           score += _this.originalScore;
27848         } else if (tags[k2] === "*" && k2 in entityTags) {
27849           score += _this.originalScore / 2;
27850         } else {
27851           return -1;
27852         }
27853       }
27854       const addTags = _this.addTags;
27855       for (let k2 in addTags) {
27856         if (!seen[k2] && entityTags[k2] === addTags[k2]) {
27857           score += _this.originalScore;
27858         }
27859       }
27860       if (_this.searchable === false) {
27861         score *= 0.999;
27862       }
27863       return score;
27864     };
27865     _this.t = (scope, options2) => {
27866       const textID = "_tagging.presets.presets.".concat(presetID, ".").concat(scope);
27867       return _t(textID, options2);
27868     };
27869     _this.t.append = (scope, options2) => {
27870       const textID = "_tagging.presets.presets.".concat(presetID, ".").concat(scope);
27871       return _t.append(textID, options2);
27872     };
27873     function resolveReference(which) {
27874       const match = (_this[which] || "").match(referenceRegex);
27875       if (match) {
27876         const preset2 = allPresets[match[1]];
27877         if (preset2) {
27878           return preset2;
27879         }
27880         console.error("Unable to resolve referenced preset: ".concat(match[1]));
27881       }
27882       return _this;
27883     }
27884     _this.name = () => {
27885       return resolveReference("originalName").t("name", { "default": _this.originalName || presetID });
27886     };
27887     _this.nameLabel = () => {
27888       return resolveReference("originalName").t.append("name", { "default": _this.originalName || presetID });
27889     };
27890     _this.subtitle = () => {
27891       if (_this.suggestion) {
27892         let path = presetID.split("/");
27893         path.pop();
27894         return _t("_tagging.presets.presets." + path.join("/") + ".name");
27895       }
27896       return null;
27897     };
27898     _this.subtitleLabel = () => {
27899       if (_this.suggestion) {
27900         let path = presetID.split("/");
27901         path.pop();
27902         return _t.append("_tagging.presets.presets." + path.join("/") + ".name");
27903       }
27904       return null;
27905     };
27906     _this.aliases = () => {
27907       return resolveReference("originalName").t("aliases", { "default": _this.originalAliases }).trim().split(/\s*[\r\n]+\s*/);
27908     };
27909     _this.terms = () => {
27910       return resolveReference("originalName").t("terms", { "default": _this.originalTerms }).toLowerCase().trim().split(/\s*,+\s*/);
27911     };
27912     _this.searchName = () => {
27913       if (!_searchName) {
27914         _searchName = (_this.suggestion ? _this.originalName : _this.name()).toLowerCase();
27915       }
27916       return _searchName;
27917     };
27918     _this.searchNameStripped = () => {
27919       if (!_searchNameStripped) {
27920         _searchNameStripped = stripDiacritics(_this.searchName());
27921       }
27922       return _searchNameStripped;
27923     };
27924     _this.searchAliases = () => {
27925       if (!_searchAliases) {
27926         _searchAliases = _this.aliases().map((alias) => alias.toLowerCase());
27927       }
27928       return _searchAliases;
27929     };
27930     _this.searchAliasesStripped = () => {
27931       if (!_searchAliasesStripped) {
27932         _searchAliasesStripped = _this.searchAliases();
27933         _searchAliasesStripped = _searchAliasesStripped.map(stripDiacritics);
27934       }
27935       return _searchAliasesStripped;
27936     };
27937     _this.isFallback = () => {
27938       const tagCount = Object.keys(_this.tags).length;
27939       return tagCount === 0 || tagCount === 1 && _this.tags.hasOwnProperty("area");
27940     };
27941     _this.addable = function(val) {
27942       if (!arguments.length) return _addable;
27943       _addable = val;
27944       return _this;
27945     };
27946     _this.reference = () => {
27947       const qid = _this.tags.wikidata || _this.tags["flag:wikidata"] || _this.tags["brand:wikidata"] || _this.tags["network:wikidata"] || _this.tags["operator:wikidata"];
27948       if (qid) {
27949         return { qid };
27950       }
27951       let key = _this.originalReference.key || Object.keys(utilObjectOmit(_this.tags, "name"))[0];
27952       let value = _this.originalReference.value || _this.tags[key];
27953       if (value === "*") {
27954         return { key };
27955       } else {
27956         return { key, value };
27957       }
27958     };
27959     _this.unsetTags = (tags, geometry, ignoringKeys, skipFieldDefaults, loc) => {
27960       let removeTags = ignoringKeys ? utilObjectOmit(_this.removeTags, ignoringKeys) : _this.removeTags;
27961       tags = utilObjectOmit(tags, Object.keys(removeTags));
27962       if (geometry && !skipFieldDefaults) {
27963         _this.fields(loc).forEach((field) => {
27964           if (field.matchGeometry(geometry) && field.key && field.default === tags[field.key] && (!ignoringKeys || ignoringKeys.indexOf(field.key) === -1)) {
27965             delete tags[field.key];
27966           }
27967         });
27968       }
27969       delete tags.area;
27970       return tags;
27971     };
27972     _this.setTags = (tags, geometry, skipFieldDefaults, loc) => {
27973       const addTags = _this.addTags;
27974       tags = Object.assign({}, tags);
27975       for (let k2 in addTags) {
27976         if (addTags[k2] === "*") {
27977           if (_this.tags[k2] || !tags[k2]) {
27978             tags[k2] = "yes";
27979           }
27980         } else {
27981           tags[k2] = addTags[k2];
27982         }
27983       }
27984       if (!addTags.hasOwnProperty("area")) {
27985         delete tags.area;
27986         if (geometry === "area") {
27987           let needsAreaTag = true;
27988           for (let k2 in addTags) {
27989             if (_this.geometry.indexOf("line") === -1 && k2 in osmAreaKeys || k2 in osmAreaKeysExceptions && addTags[k2] in osmAreaKeysExceptions[k2]) {
27990               needsAreaTag = false;
27991               break;
27992             }
27993           }
27994           if (needsAreaTag) {
27995             tags.area = "yes";
27996           }
27997         }
27998       }
27999       if (geometry && !skipFieldDefaults) {
28000         _this.fields(loc).forEach((field) => {
28001           if (field.matchGeometry(geometry) && field.key && !tags[field.key] && field.default) {
28002             tags[field.key] = field.default;
28003           }
28004         });
28005       }
28006       return tags;
28007     };
28008     function resolveFields(which, loc) {
28009       const fieldIDs = which === "fields" ? _this.originalFields : _this.originalMoreFields;
28010       let resolved = [];
28011       fieldIDs.forEach((fieldID) => {
28012         const match = fieldID.match(referenceRegex);
28013         if (match !== null) {
28014           resolved = resolved.concat(inheritFields(allPresets[match[1]], which));
28015         } else if (allFields[fieldID]) {
28016           resolved.push(allFields[fieldID]);
28017         } else {
28018           console.log('Cannot resolve "'.concat(fieldID, '" found in ').concat(_this.id, ".").concat(which));
28019         }
28020       });
28021       if (!resolved.length) {
28022         const endIndex = _this.id.lastIndexOf("/");
28023         const parentID = endIndex && _this.id.substring(0, endIndex);
28024         if (parentID) {
28025           let parent = allPresets[parentID];
28026           if (loc) {
28027             const validHere = _sharedLocationManager.locationSetsAt(loc);
28028             if ((parent == null ? void 0 : parent.locationSetID) && !validHere[parent.locationSetID]) {
28029               const candidateIDs = Object.keys(allPresets).filter((k2) => k2.startsWith(parentID));
28030               parent = allPresets[candidateIDs.find((candidateID) => {
28031                 const candidate = allPresets[candidateID];
28032                 return validHere[candidate.locationSetID] && (0, import_lodash.isEqual)(candidate.tags, parent.tags);
28033               })];
28034             }
28035           }
28036           resolved = inheritFields(parent, which);
28037         }
28038       }
28039       return utilArrayUniq(resolved);
28040       function inheritFields(parent, which2) {
28041         if (!parent) return [];
28042         if (which2 === "fields") {
28043           return parent.fields().filter(shouldInherit);
28044         } else if (which2 === "moreFields") {
28045           return parent.moreFields();
28046         } else {
28047           return [];
28048         }
28049       }
28050       function shouldInherit(f2) {
28051         if (f2.key && _this.tags[f2.key] !== void 0 && // inherit anyway if multiple values are allowed or just a checkbox
28052         f2.type !== "multiCombo" && f2.type !== "semiCombo" && f2.type !== "manyCombo" && f2.type !== "check") return false;
28053         return true;
28054       }
28055     }
28056     function stripDiacritics(s2) {
28057       if (s2.normalize) s2 = s2.normalize("NFD");
28058       s2 = s2.replace(/[\u0300-\u036f]/g, "");
28059       return s2;
28060     }
28061     return _this;
28062   }
28063
28064   // modules/presets/index.js
28065   var _mainPresetIndex = presetIndex();
28066   function presetIndex() {
28067     const dispatch14 = dispatch_default("favoritePreset", "recentsChange");
28068     const MAXRECENTS = 30;
28069     const POINT = presetPreset("point", { name: "Point", tags: {}, geometry: ["point", "vertex"], matchScore: 0.1 });
28070     const LINE = presetPreset("line", { name: "Line", tags: {}, geometry: ["line"], matchScore: 0.1 });
28071     const AREA = presetPreset("area", { name: "Area", tags: { area: "yes" }, geometry: ["area"], matchScore: 0.1 });
28072     const RELATION = presetPreset("relation", { name: "Relation", tags: {}, geometry: ["relation"], matchScore: 0.1 });
28073     let _this = presetCollection([POINT, LINE, AREA, RELATION]);
28074     let _presets = { point: POINT, line: LINE, area: AREA, relation: RELATION };
28075     let _defaults2 = {
28076       point: presetCollection([POINT]),
28077       vertex: presetCollection([POINT]),
28078       line: presetCollection([LINE]),
28079       area: presetCollection([AREA]),
28080       relation: presetCollection([RELATION])
28081     };
28082     let _fields = {};
28083     let _categories = {};
28084     let _universal = [];
28085     let _addablePresetIDs = null;
28086     let _recents;
28087     let _favorites;
28088     let _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} };
28089     let _loadPromise;
28090     _this.ensureLoaded = () => {
28091       if (_loadPromise) return _loadPromise;
28092       return _loadPromise = Promise.all([
28093         _mainFileFetcher.get("preset_categories"),
28094         _mainFileFetcher.get("preset_defaults"),
28095         _mainFileFetcher.get("preset_presets"),
28096         _mainFileFetcher.get("preset_fields")
28097       ]).then((vals) => {
28098         _this.merge({
28099           categories: vals[0],
28100           defaults: vals[1],
28101           presets: vals[2],
28102           fields: vals[3]
28103         });
28104         osmSetAreaKeys(_this.areaKeys());
28105         osmSetLineTags(_this.lineTags());
28106         osmSetPointTags(_this.pointTags());
28107         osmSetVertexTags(_this.vertexTags());
28108       });
28109     };
28110     _this.merge = (d2) => {
28111       let newLocationSets = [];
28112       if (d2.fields) {
28113         Object.keys(d2.fields).forEach((fieldID) => {
28114           let f2 = d2.fields[fieldID];
28115           if (f2) {
28116             f2 = presetField(fieldID, f2, _fields);
28117             if (f2.locationSet) newLocationSets.push(f2);
28118             _fields[fieldID] = f2;
28119           } else {
28120             delete _fields[fieldID];
28121           }
28122         });
28123       }
28124       if (d2.presets) {
28125         Object.keys(d2.presets).forEach((presetID) => {
28126           let p2 = d2.presets[presetID];
28127           if (p2) {
28128             const isAddable = !_addablePresetIDs || _addablePresetIDs.has(presetID);
28129             p2 = presetPreset(presetID, p2, isAddable, _fields, _presets);
28130             if (p2.locationSet) newLocationSets.push(p2);
28131             _presets[presetID] = p2;
28132           } else {
28133             const existing = _presets[presetID];
28134             if (existing && !existing.isFallback()) {
28135               delete _presets[presetID];
28136             }
28137           }
28138         });
28139       }
28140       if (d2.categories) {
28141         Object.keys(d2.categories).forEach((categoryID) => {
28142           let c2 = d2.categories[categoryID];
28143           if (c2) {
28144             c2 = presetCategory(categoryID, c2, _presets);
28145             if (c2.locationSet) newLocationSets.push(c2);
28146             _categories[categoryID] = c2;
28147           } else {
28148             delete _categories[categoryID];
28149           }
28150         });
28151       }
28152       _this.collection = Object.values(_presets).concat(Object.values(_categories));
28153       if (d2.defaults) {
28154         Object.keys(d2.defaults).forEach((geometry) => {
28155           const def2 = d2.defaults[geometry];
28156           if (Array.isArray(def2)) {
28157             _defaults2[geometry] = presetCollection(
28158               def2.map((id2) => _presets[id2] || _categories[id2]).filter(Boolean)
28159             );
28160           } else {
28161             delete _defaults2[geometry];
28162           }
28163         });
28164       }
28165       _universal = Object.values(_fields).filter((field) => field.universal);
28166       _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} };
28167       _this.collection.forEach((preset) => {
28168         (preset.geometry || []).forEach((geometry) => {
28169           let g3 = _geometryIndex[geometry];
28170           for (let key in preset.tags) {
28171             g3[key] = g3[key] || {};
28172             let value = preset.tags[key];
28173             (g3[key][value] = g3[key][value] || []).push(preset);
28174           }
28175         });
28176       });
28177       if (d2.featureCollection && Array.isArray(d2.featureCollection.features)) {
28178         _sharedLocationManager.mergeCustomGeoJSON(d2.featureCollection);
28179       }
28180       if (newLocationSets.length) {
28181         _sharedLocationManager.mergeLocationSets(newLocationSets);
28182       }
28183       return _this;
28184     };
28185     _this.match = (entity, resolver) => {
28186       return resolver.transient(entity, "presetMatch", () => {
28187         let geometry = entity.geometry(resolver);
28188         if (geometry === "vertex" && entity.isOnAddressLine(resolver)) {
28189           geometry = "point";
28190         }
28191         const entityExtent = entity.extent(resolver);
28192         return _this.matchTags(entity.tags, geometry, entityExtent.center());
28193       });
28194     };
28195     _this.matchTags = (tags, geometry, loc) => {
28196       const keyIndex = _geometryIndex[geometry];
28197       let bestScore = -1;
28198       let bestMatch;
28199       let matchCandidates = [];
28200       for (let k2 in tags) {
28201         let indexMatches = [];
28202         let valueIndex = keyIndex[k2];
28203         if (!valueIndex) continue;
28204         let keyValueMatches = valueIndex[tags[k2]];
28205         if (keyValueMatches) indexMatches.push(...keyValueMatches);
28206         let keyStarMatches = valueIndex["*"];
28207         if (keyStarMatches) indexMatches.push(...keyStarMatches);
28208         if (indexMatches.length === 0) continue;
28209         for (let i3 = 0; i3 < indexMatches.length; i3++) {
28210           const candidate = indexMatches[i3];
28211           const score = candidate.matchScore(tags);
28212           if (score === -1) {
28213             continue;
28214           }
28215           matchCandidates.push({ score, candidate });
28216           if (score > bestScore) {
28217             bestScore = score;
28218             bestMatch = candidate;
28219           }
28220         }
28221       }
28222       if (bestMatch && bestMatch.locationSetID && bestMatch.locationSetID !== "+[Q2]" && Array.isArray(loc)) {
28223         const validHere = _sharedLocationManager.locationSetsAt(loc);
28224         if (!validHere[bestMatch.locationSetID]) {
28225           matchCandidates.sort((a2, b2) => a2.score < b2.score ? 1 : -1);
28226           for (let i3 = 0; i3 < matchCandidates.length; i3++) {
28227             const candidateScore = matchCandidates[i3];
28228             if (!candidateScore.candidate.locationSetID || validHere[candidateScore.candidate.locationSetID]) {
28229               bestMatch = candidateScore.candidate;
28230               bestScore = candidateScore.score;
28231               break;
28232             }
28233           }
28234         }
28235       }
28236       if (!bestMatch || bestMatch.isFallback()) {
28237         for (let k2 in tags) {
28238           if (/^addr:/.test(k2) && keyIndex["addr:*"] && keyIndex["addr:*"]["*"]) {
28239             bestMatch = keyIndex["addr:*"]["*"][0];
28240             break;
28241           }
28242         }
28243       }
28244       return bestMatch || _this.fallback(geometry);
28245     };
28246     _this.allowsVertex = (entity, resolver) => {
28247       if (entity.type !== "node") return false;
28248       if (Object.keys(entity.tags).length === 0) return true;
28249       return resolver.transient(entity, "vertexMatch", () => {
28250         if (entity.isOnAddressLine(resolver)) return true;
28251         const geometries = osmNodeGeometriesForTags(entity.tags);
28252         if (geometries.vertex) return true;
28253         if (geometries.point) return false;
28254         return true;
28255       });
28256     };
28257     _this.areaKeys = () => {
28258       const ignore = {
28259         barrier: true,
28260         highway: true,
28261         footway: true,
28262         railway: true,
28263         junction: true,
28264         type: true
28265       };
28266       let areaKeys = {};
28267       const presets = _this.collection.filter((p2) => !p2.suggestion && !p2.replacement);
28268       presets.forEach((p2) => {
28269         const keys2 = p2.tags && Object.keys(p2.tags);
28270         const key = keys2 && keys2.length && keys2[0];
28271         if (!key) return;
28272         if (ignore[key]) return;
28273         if (p2.geometry.indexOf("area") !== -1) {
28274           areaKeys[key] = areaKeys[key] || {};
28275         }
28276       });
28277       presets.forEach((p2) => {
28278         let key;
28279         for (key in p2.addTags) {
28280           const value = p2.addTags[key];
28281           if (key in areaKeys && // probably an area...
28282           p2.geometry.indexOf("line") !== -1 && // but sometimes a line
28283           value !== "*") {
28284             areaKeys[key][value] = true;
28285           }
28286         }
28287       });
28288       return areaKeys;
28289     };
28290     _this.lineTags = () => {
28291       return _this.collection.filter((lineTags, d2) => {
28292         if (d2.suggestion || d2.replacement || d2.searchable === false) return lineTags;
28293         const keys2 = d2.tags && Object.keys(d2.tags);
28294         const key = keys2 && keys2.length && keys2[0];
28295         if (!key) return lineTags;
28296         if (d2.geometry.indexOf("line") !== -1) {
28297           lineTags[key] = lineTags[key] || [];
28298           lineTags[key].push(d2.tags);
28299         }
28300         return lineTags;
28301       }, {});
28302     };
28303     _this.pointTags = () => {
28304       return _this.collection.reduce((pointTags, d2) => {
28305         if (d2.suggestion || d2.replacement || d2.searchable === false) return pointTags;
28306         const keys2 = d2.tags && Object.keys(d2.tags);
28307         const key = keys2 && keys2.length && keys2[0];
28308         if (!key) return pointTags;
28309         if (d2.geometry.indexOf("point") !== -1) {
28310           pointTags[key] = pointTags[key] || {};
28311           pointTags[key][d2.tags[key]] = true;
28312         }
28313         return pointTags;
28314       }, {});
28315     };
28316     _this.vertexTags = () => {
28317       return _this.collection.reduce((vertexTags, d2) => {
28318         if (d2.suggestion || d2.replacement || d2.searchable === false) return vertexTags;
28319         const keys2 = d2.tags && Object.keys(d2.tags);
28320         const key = keys2 && keys2.length && keys2[0];
28321         if (!key) return vertexTags;
28322         if (d2.geometry.indexOf("vertex") !== -1) {
28323           vertexTags[key] = vertexTags[key] || {};
28324           vertexTags[key][d2.tags[key]] = true;
28325         }
28326         return vertexTags;
28327       }, {});
28328     };
28329     _this.field = (id2) => _fields[id2];
28330     _this.universal = () => _universal;
28331     _this.defaults = (geometry, n3, startWithRecents, loc, extraPresets) => {
28332       let recents = [];
28333       if (startWithRecents) {
28334         recents = _this.recent().matchGeometry(geometry).collection.slice(0, 4);
28335       }
28336       let defaults;
28337       if (_addablePresetIDs) {
28338         defaults = Array.from(_addablePresetIDs).map(function(id2) {
28339           var preset = _this.item(id2);
28340           if (preset && preset.matchGeometry(geometry)) return preset;
28341           return null;
28342         }).filter(Boolean);
28343       } else {
28344         defaults = _defaults2[geometry].collection.concat(_this.fallback(geometry));
28345       }
28346       let result = presetCollection(
28347         utilArrayUniq(recents.concat(defaults).concat(extraPresets || [])).slice(0, n3 - 1)
28348       );
28349       if (Array.isArray(loc)) {
28350         const validHere = _sharedLocationManager.locationSetsAt(loc);
28351         result.collection = result.collection.filter((a2) => !a2.locationSetID || validHere[a2.locationSetID]);
28352       }
28353       return result;
28354     };
28355     _this.addablePresetIDs = function(val) {
28356       if (!arguments.length) return _addablePresetIDs;
28357       if (Array.isArray(val)) val = new Set(val);
28358       _addablePresetIDs = val;
28359       if (_addablePresetIDs) {
28360         _this.collection.forEach((p2) => {
28361           if (p2.addable) p2.addable(_addablePresetIDs.has(p2.id));
28362         });
28363       } else {
28364         _this.collection.forEach((p2) => {
28365           if (p2.addable) p2.addable(true);
28366         });
28367       }
28368       return _this;
28369     };
28370     _this.recent = () => {
28371       return presetCollection(
28372         utilArrayUniq(_this.getRecents().map((d2) => d2.preset).filter((d2) => d2.searchable !== false))
28373       );
28374     };
28375     function RibbonItem(preset, source) {
28376       let item = {};
28377       item.preset = preset;
28378       item.source = source;
28379       item.isFavorite = () => item.source === "favorite";
28380       item.isRecent = () => item.source === "recent";
28381       item.matches = (preset2) => item.preset.id === preset2.id;
28382       item.minified = () => ({ pID: item.preset.id });
28383       return item;
28384     }
28385     function ribbonItemForMinified(d2, source) {
28386       if (d2 && d2.pID) {
28387         const preset = _this.item(d2.pID);
28388         if (!preset) return null;
28389         return RibbonItem(preset, source);
28390       }
28391       return null;
28392     }
28393     _this.getGenericRibbonItems = () => {
28394       return ["point", "line", "area"].map((id2) => RibbonItem(_this.item(id2), "generic"));
28395     };
28396     _this.getAddable = () => {
28397       if (!_addablePresetIDs) return [];
28398       return _addablePresetIDs.map((id2) => {
28399         const preset = _this.item(id2);
28400         if (preset) return RibbonItem(preset, "addable");
28401         return null;
28402       }).filter(Boolean);
28403     };
28404     function setRecents(items) {
28405       _recents = items;
28406       const minifiedItems = items.map((d2) => d2.minified());
28407       corePreferences("preset_recents", JSON.stringify(minifiedItems));
28408       dispatch14.call("recentsChange");
28409     }
28410     _this.getRecents = () => {
28411       if (!_recents) {
28412         _recents = (JSON.parse(corePreferences("preset_recents")) || []).reduce((acc, d2) => {
28413           let item = ribbonItemForMinified(d2, "recent");
28414           if (item && item.preset.addable()) acc.push(item);
28415           return acc;
28416         }, []);
28417       }
28418       return _recents;
28419     };
28420     _this.addRecent = (preset, besidePreset, after) => {
28421       const recents = _this.getRecents();
28422       const beforeItem = _this.recentMatching(besidePreset);
28423       let toIndex = recents.indexOf(beforeItem);
28424       if (after) toIndex += 1;
28425       const newItem = RibbonItem(preset, "recent");
28426       recents.splice(toIndex, 0, newItem);
28427       setRecents(recents);
28428     };
28429     _this.removeRecent = (preset) => {
28430       const item = _this.recentMatching(preset);
28431       if (item) {
28432         let items = _this.getRecents();
28433         items.splice(items.indexOf(item), 1);
28434         setRecents(items);
28435       }
28436     };
28437     _this.recentMatching = (preset) => {
28438       const items = _this.getRecents();
28439       for (let i3 in items) {
28440         if (items[i3].matches(preset)) {
28441           return items[i3];
28442         }
28443       }
28444       return null;
28445     };
28446     _this.moveItem = (items, fromIndex, toIndex) => {
28447       if (fromIndex === toIndex || fromIndex < 0 || toIndex < 0 || fromIndex >= items.length || toIndex >= items.length) return null;
28448       items.splice(toIndex, 0, items.splice(fromIndex, 1)[0]);
28449       return items;
28450     };
28451     _this.moveRecent = (item, beforeItem) => {
28452       const recents = _this.getRecents();
28453       const fromIndex = recents.indexOf(item);
28454       const toIndex = recents.indexOf(beforeItem);
28455       const items = _this.moveItem(recents, fromIndex, toIndex);
28456       if (items) setRecents(items);
28457     };
28458     _this.setMostRecent = (preset) => {
28459       if (preset.searchable === false) return;
28460       let items = _this.getRecents();
28461       let item = _this.recentMatching(preset);
28462       if (item) {
28463         items.splice(items.indexOf(item), 1);
28464       } else {
28465         item = RibbonItem(preset, "recent");
28466       }
28467       while (items.length >= MAXRECENTS) {
28468         items.pop();
28469       }
28470       items.unshift(item);
28471       setRecents(items);
28472     };
28473     function setFavorites(items) {
28474       _favorites = items;
28475       const minifiedItems = items.map((d2) => d2.minified());
28476       corePreferences("preset_favorites", JSON.stringify(minifiedItems));
28477       dispatch14.call("favoritePreset");
28478     }
28479     _this.addFavorite = (preset, besidePreset, after) => {
28480       const favorites = _this.getFavorites();
28481       const beforeItem = _this.favoriteMatching(besidePreset);
28482       let toIndex = favorites.indexOf(beforeItem);
28483       if (after) toIndex += 1;
28484       const newItem = RibbonItem(preset, "favorite");
28485       favorites.splice(toIndex, 0, newItem);
28486       setFavorites(favorites);
28487     };
28488     _this.toggleFavorite = (preset) => {
28489       const favs = _this.getFavorites();
28490       const favorite = _this.favoriteMatching(preset);
28491       if (favorite) {
28492         favs.splice(favs.indexOf(favorite), 1);
28493       } else {
28494         if (favs.length === 10) {
28495           favs.pop();
28496         }
28497         favs.push(RibbonItem(preset, "favorite"));
28498       }
28499       setFavorites(favs);
28500     };
28501     _this.removeFavorite = (preset) => {
28502       const item = _this.favoriteMatching(preset);
28503       if (item) {
28504         const items = _this.getFavorites();
28505         items.splice(items.indexOf(item), 1);
28506         setFavorites(items);
28507       }
28508     };
28509     _this.getFavorites = () => {
28510       if (!_favorites) {
28511         let rawFavorites = JSON.parse(corePreferences("preset_favorites"));
28512         if (!rawFavorites) {
28513           rawFavorites = [];
28514           corePreferences("preset_favorites", JSON.stringify(rawFavorites));
28515         }
28516         _favorites = rawFavorites.reduce((output, d2) => {
28517           const item = ribbonItemForMinified(d2, "favorite");
28518           if (item && item.preset.addable()) output.push(item);
28519           return output;
28520         }, []);
28521       }
28522       return _favorites;
28523     };
28524     _this.favoriteMatching = (preset) => {
28525       const favs = _this.getFavorites();
28526       for (let index in favs) {
28527         if (favs[index].matches(preset)) {
28528           return favs[index];
28529         }
28530       }
28531       return null;
28532     };
28533     return utilRebind(_this, dispatch14, "on");
28534   }
28535
28536   // modules/util/util.js
28537   function utilTagText(entity) {
28538     var obj = entity && entity.tags || {};
28539     return Object.keys(obj).map(function(k2) {
28540       return k2 + "=" + obj[k2];
28541     }).join(", ");
28542   }
28543   function utilTotalExtent(array2, graph) {
28544     var extent = geoExtent();
28545     var val, entity;
28546     for (var i3 = 0; i3 < array2.length; i3++) {
28547       val = array2[i3];
28548       entity = typeof val === "string" ? graph.hasEntity(val) : val;
28549       if (entity) {
28550         extent._extend(entity.extent(graph));
28551       }
28552     }
28553     return extent;
28554   }
28555   function utilTagDiff(oldTags, newTags) {
28556     var tagDiff = [];
28557     var keys2 = utilArrayUnion(Object.keys(oldTags), Object.keys(newTags)).sort();
28558     keys2.forEach(function(k2) {
28559       var oldVal = oldTags[k2];
28560       var newVal = newTags[k2];
28561       if ((oldVal || oldVal === "") && (newVal === void 0 || newVal !== oldVal)) {
28562         tagDiff.push({
28563           type: "-",
28564           key: k2,
28565           oldVal,
28566           newVal,
28567           display: "- " + k2 + "=" + oldVal
28568         });
28569       }
28570       if ((newVal || newVal === "") && (oldVal === void 0 || newVal !== oldVal)) {
28571         tagDiff.push({
28572           type: "+",
28573           key: k2,
28574           oldVal,
28575           newVal,
28576           display: "+ " + k2 + "=" + newVal
28577         });
28578       }
28579     });
28580     return tagDiff;
28581   }
28582   function utilEntitySelector(ids) {
28583     return ids.length ? "." + ids.join(",.") : "nothing";
28584   }
28585   function utilEntityOrMemberSelector(ids, graph) {
28586     var seen = new Set(ids);
28587     ids.forEach(collectShallowDescendants);
28588     return utilEntitySelector(Array.from(seen));
28589     function collectShallowDescendants(id2) {
28590       var entity = graph.hasEntity(id2);
28591       if (!entity || entity.type !== "relation") return;
28592       entity.members.map(function(member) {
28593         return member.id;
28594       }).forEach(function(id3) {
28595         seen.add(id3);
28596       });
28597     }
28598   }
28599   function utilEntityOrDeepMemberSelector(ids, graph) {
28600     return utilEntitySelector(utilEntityAndDeepMemberIDs(ids, graph));
28601   }
28602   function utilEntityAndDeepMemberIDs(ids, graph) {
28603     var seen = /* @__PURE__ */ new Set();
28604     ids.forEach(collectDeepDescendants);
28605     return Array.from(seen);
28606     function collectDeepDescendants(id2) {
28607       if (seen.has(id2)) return;
28608       seen.add(id2);
28609       var entity = graph.hasEntity(id2);
28610       if (!entity || entity.type !== "relation") return;
28611       entity.members.map(function(member) {
28612         return member.id;
28613       }).forEach(collectDeepDescendants);
28614     }
28615   }
28616   function utilDeepMemberSelector(ids, graph, skipMultipolgonMembers) {
28617     var idsSet = new Set(ids);
28618     var seen = /* @__PURE__ */ new Set();
28619     var returners = /* @__PURE__ */ new Set();
28620     ids.forEach(collectDeepDescendants);
28621     return utilEntitySelector(Array.from(returners));
28622     function collectDeepDescendants(id2) {
28623       if (seen.has(id2)) return;
28624       seen.add(id2);
28625       if (!idsSet.has(id2)) {
28626         returners.add(id2);
28627       }
28628       var entity = graph.hasEntity(id2);
28629       if (!entity || entity.type !== "relation") return;
28630       if (skipMultipolgonMembers && entity.isMultipolygon()) return;
28631       entity.members.map(function(member) {
28632         return member.id;
28633       }).forEach(collectDeepDescendants);
28634     }
28635   }
28636   function utilHighlightEntities(ids, highlighted, context) {
28637     context.surface().selectAll(utilEntityOrDeepMemberSelector(ids, context.graph())).classed("highlighted", highlighted);
28638   }
28639   function utilGetAllNodes(ids, graph) {
28640     var seen = /* @__PURE__ */ new Set();
28641     var nodes = /* @__PURE__ */ new Set();
28642     ids.forEach(collectNodes);
28643     return Array.from(nodes);
28644     function collectNodes(id2) {
28645       if (seen.has(id2)) return;
28646       seen.add(id2);
28647       var entity = graph.hasEntity(id2);
28648       if (!entity) return;
28649       if (entity.type === "node") {
28650         nodes.add(entity);
28651       } else if (entity.type === "way") {
28652         entity.nodes.forEach(collectNodes);
28653       } else {
28654         entity.members.map(function(member) {
28655           return member.id;
28656         }).forEach(collectNodes);
28657       }
28658     }
28659   }
28660   function utilDisplayName(entity) {
28661     var localizedNameKey = "name:" + _mainLocalizer.languageCode().toLowerCase();
28662     var name = entity.tags[localizedNameKey] || entity.tags.name || "";
28663     if (name) return name;
28664     var tags = {
28665       direction: entity.tags.direction,
28666       from: entity.tags.from,
28667       network: entity.tags.cycle_network || entity.tags.network,
28668       ref: entity.tags.ref,
28669       to: entity.tags.to,
28670       via: entity.tags.via
28671     };
28672     var keyComponents = [];
28673     if (tags.network) {
28674       keyComponents.push("network");
28675     }
28676     if (tags.ref) {
28677       keyComponents.push("ref");
28678     }
28679     if (entity.tags.route) {
28680       if (tags.direction) {
28681         keyComponents.push("direction");
28682       } else if (tags.from && tags.to) {
28683         keyComponents.push("from");
28684         keyComponents.push("to");
28685         if (tags.via) {
28686           keyComponents.push("via");
28687         }
28688       }
28689     }
28690     if (keyComponents.length) {
28691       name = _t("inspector.display_name." + keyComponents.join("_"), tags);
28692     }
28693     return name;
28694   }
28695   function utilDisplayNameForPath(entity) {
28696     var name = utilDisplayName(entity);
28697     var isFirefox = utilDetect().browser.toLowerCase().indexOf("firefox") > -1;
28698     var isNewChromium = Number(utilDetect().version.split(".")[0]) >= 96;
28699     if (!isFirefox && !isNewChromium && name && rtlRegex.test(name)) {
28700       name = fixRTLTextForSvg(name);
28701     }
28702     return name;
28703   }
28704   function utilDisplayType(id2) {
28705     return {
28706       n: _t("inspector.node"),
28707       w: _t("inspector.way"),
28708       r: _t("inspector.relation")
28709     }[id2.charAt(0)];
28710   }
28711   function utilDisplayLabel(entity, graphOrGeometry, verbose) {
28712     var result;
28713     var displayName = utilDisplayName(entity);
28714     var preset = typeof graphOrGeometry === "string" ? _mainPresetIndex.matchTags(entity.tags, graphOrGeometry) : _mainPresetIndex.match(entity, graphOrGeometry);
28715     var presetName = preset && (preset.suggestion ? preset.subtitle() : preset.name());
28716     if (verbose) {
28717       result = [presetName, displayName].filter(Boolean).join(" ");
28718     } else {
28719       result = displayName || presetName;
28720     }
28721     return result || utilDisplayType(entity.id);
28722   }
28723   function utilEntityRoot(entityType) {
28724     return {
28725       node: "n",
28726       way: "w",
28727       relation: "r"
28728     }[entityType];
28729   }
28730   function utilCombinedTags(entityIDs, graph) {
28731     var tags = {};
28732     var tagCounts = {};
28733     var allKeys = /* @__PURE__ */ new Set();
28734     var entities = entityIDs.map(function(entityID) {
28735       return graph.hasEntity(entityID);
28736     }).filter(Boolean);
28737     entities.forEach(function(entity) {
28738       var keys2 = Object.keys(entity.tags).filter(Boolean);
28739       keys2.forEach(function(key2) {
28740         allKeys.add(key2);
28741       });
28742     });
28743     entities.forEach(function(entity) {
28744       allKeys.forEach(function(key2) {
28745         var value = entity.tags[key2];
28746         if (!tags.hasOwnProperty(key2)) {
28747           tags[key2] = value;
28748         } else {
28749           if (!Array.isArray(tags[key2])) {
28750             if (tags[key2] !== value) {
28751               tags[key2] = [tags[key2], value];
28752             }
28753           } else {
28754             if (tags[key2].indexOf(value) === -1) {
28755               tags[key2].push(value);
28756             }
28757           }
28758         }
28759         var tagHash = key2 + "=" + value;
28760         if (!tagCounts[tagHash]) tagCounts[tagHash] = 0;
28761         tagCounts[tagHash] += 1;
28762       });
28763     });
28764     for (var key in tags) {
28765       if (!Array.isArray(tags[key])) continue;
28766       tags[key] = tags[key].sort(function(val12, val2) {
28767         var key2 = key2;
28768         var count2 = tagCounts[key2 + "=" + val2];
28769         var count1 = tagCounts[key2 + "=" + val12];
28770         if (count2 !== count1) {
28771           return count2 - count1;
28772         }
28773         if (val2 && val12) {
28774           return val12.localeCompare(val2);
28775         }
28776         return val12 ? 1 : -1;
28777       });
28778     }
28779     return tags;
28780   }
28781   function utilStringQs(str) {
28782     var i3 = 0;
28783     while (i3 < str.length && (str[i3] === "?" || str[i3] === "#")) i3++;
28784     str = str.slice(i3);
28785     return str.split("&").reduce(function(obj, pair3) {
28786       var parts = pair3.split("=");
28787       if (parts.length === 2) {
28788         obj[parts[0]] = null === parts[1] ? "" : decodeURIComponent(parts[1]);
28789       }
28790       return obj;
28791     }, {});
28792   }
28793   function utilQsString(obj, noencode) {
28794     function softEncode(s2) {
28795       return encodeURIComponent(s2).replace(/(%2F|%3A|%2C|%7B|%7D)/g, decodeURIComponent);
28796     }
28797     return Object.keys(obj).sort().map(function(key) {
28798       return encodeURIComponent(key) + "=" + (noencode ? softEncode(obj[key]) : encodeURIComponent(obj[key]));
28799     }).join("&");
28800   }
28801   function utilPrefixDOMProperty(property) {
28802     var prefixes2 = ["webkit", "ms", "moz", "o"];
28803     var i3 = -1;
28804     var n3 = prefixes2.length;
28805     var s2 = document.body;
28806     if (property in s2) return property;
28807     property = property.slice(0, 1).toUpperCase() + property.slice(1);
28808     while (++i3 < n3) {
28809       if (prefixes2[i3] + property in s2) {
28810         return prefixes2[i3] + property;
28811       }
28812     }
28813     return false;
28814   }
28815   function utilPrefixCSSProperty(property) {
28816     var prefixes2 = ["webkit", "ms", "Moz", "O"];
28817     var i3 = -1;
28818     var n3 = prefixes2.length;
28819     var s2 = document.body.style;
28820     if (property.toLowerCase() in s2) {
28821       return property.toLowerCase();
28822     }
28823     while (++i3 < n3) {
28824       if (prefixes2[i3] + property in s2) {
28825         return "-" + prefixes2[i3].toLowerCase() + property.replace(/([A-Z])/g, "-$1").toLowerCase();
28826       }
28827     }
28828     return false;
28829   }
28830   var transformProperty;
28831   function utilSetTransform(el, x2, y2, scale) {
28832     var prop = transformProperty = transformProperty || utilPrefixCSSProperty("Transform");
28833     var translate = utilDetect().opera ? "translate(" + x2 + "px," + y2 + "px)" : "translate3d(" + x2 + "px," + y2 + "px,0)";
28834     return el.style(prop, translate + (scale ? " scale(" + scale + ")" : ""));
28835   }
28836   function utilEditDistance(a2, b2) {
28837     a2 = (0, import_diacritics.remove)(a2.toLowerCase());
28838     b2 = (0, import_diacritics.remove)(b2.toLowerCase());
28839     if (a2.length === 0) return b2.length;
28840     if (b2.length === 0) return a2.length;
28841     var matrix = [];
28842     var i3, j2;
28843     for (i3 = 0; i3 <= b2.length; i3++) {
28844       matrix[i3] = [i3];
28845     }
28846     for (j2 = 0; j2 <= a2.length; j2++) {
28847       matrix[0][j2] = j2;
28848     }
28849     for (i3 = 1; i3 <= b2.length; i3++) {
28850       for (j2 = 1; j2 <= a2.length; j2++) {
28851         if (b2.charAt(i3 - 1) === a2.charAt(j2 - 1)) {
28852           matrix[i3][j2] = matrix[i3 - 1][j2 - 1];
28853         } else {
28854           matrix[i3][j2] = Math.min(
28855             matrix[i3 - 1][j2 - 1] + 1,
28856             // substitution
28857             Math.min(
28858               matrix[i3][j2 - 1] + 1,
28859               // insertion
28860               matrix[i3 - 1][j2] + 1
28861             )
28862           );
28863         }
28864       }
28865     }
28866     return matrix[b2.length][a2.length];
28867   }
28868   function utilFastMouse(container) {
28869     var rect = container.getBoundingClientRect();
28870     var rectLeft = rect.left;
28871     var rectTop = rect.top;
28872     var clientLeft = +container.clientLeft;
28873     var clientTop = +container.clientTop;
28874     return function(e3) {
28875       return [
28876         e3.clientX - rectLeft - clientLeft,
28877         e3.clientY - rectTop - clientTop
28878       ];
28879     };
28880   }
28881   function utilAsyncMap(inputs, func, callback) {
28882     var remaining = inputs.length;
28883     var results = [];
28884     var errors = [];
28885     inputs.forEach(function(d2, i3) {
28886       func(d2, function done(err, data) {
28887         errors[i3] = err;
28888         results[i3] = data;
28889         remaining--;
28890         if (!remaining) callback(errors, results);
28891       });
28892     });
28893   }
28894   function utilWrap(index, length2) {
28895     if (index < 0) {
28896       index += Math.ceil(-index / length2) * length2;
28897     }
28898     return index % length2;
28899   }
28900   function utilFunctor(value) {
28901     if (typeof value === "function") return value;
28902     return function() {
28903       return value;
28904     };
28905   }
28906   function utilNoAuto(selection2) {
28907     var isText = selection2.size() && selection2.node().tagName.toLowerCase() === "textarea";
28908     return selection2.attr("autocomplete", "new-password").attr("autocorrect", "off").attr("autocapitalize", "off").attr("spellcheck", isText ? "true" : "false");
28909   }
28910   function utilHashcode(str) {
28911     var hash = 0;
28912     if (str.length === 0) {
28913       return hash;
28914     }
28915     for (var i3 = 0; i3 < str.length; i3++) {
28916       var char = str.charCodeAt(i3);
28917       hash = (hash << 5) - hash + char;
28918       hash = hash & hash;
28919     }
28920     return hash;
28921   }
28922   function utilSafeClassName(str) {
28923     return str.toLowerCase().replace(/[^a-z0-9]+/g, "_");
28924   }
28925   function utilUniqueDomId(val) {
28926     return "ideditor-" + utilSafeClassName(val.toString()) + "-" + (/* @__PURE__ */ new Date()).getTime().toString();
28927   }
28928   function utilUnicodeCharsCount(str) {
28929     return Array.from(str).length;
28930   }
28931   function utilUnicodeCharsTruncated(str, limit) {
28932     return Array.from(str).slice(0, limit).join("");
28933   }
28934   function toNumericID(id2) {
28935     var match = id2.match(/^[cnwr](-?\d+)$/);
28936     if (match) {
28937       return parseInt(match[1], 10);
28938     }
28939     return NaN;
28940   }
28941   function compareNumericIDs(left, right) {
28942     if (isNaN(left) && isNaN(right)) return -1;
28943     if (isNaN(left)) return 1;
28944     if (isNaN(right)) return -1;
28945     if (Math.sign(left) !== Math.sign(right)) return -Math.sign(left);
28946     if (Math.sign(left) < 0) return Math.sign(right - left);
28947     return Math.sign(left - right);
28948   }
28949   function utilCompareIDs(left, right) {
28950     return compareNumericIDs(toNumericID(left), toNumericID(right));
28951   }
28952   function utilOldestID(ids) {
28953     if (ids.length === 0) {
28954       return void 0;
28955     }
28956     var oldestIDIndex = 0;
28957     var oldestID = toNumericID(ids[0]);
28958     for (var i3 = 1; i3 < ids.length; i3++) {
28959       var num = toNumericID(ids[i3]);
28960       if (compareNumericIDs(oldestID, num) === 1) {
28961         oldestIDIndex = i3;
28962         oldestID = num;
28963       }
28964     }
28965     return ids[oldestIDIndex];
28966   }
28967   function utilCleanOsmString(val, maxChars) {
28968     if (val === void 0 || val === null) {
28969       val = "";
28970     } else {
28971       val = val.toString();
28972     }
28973     val = val.trim();
28974     if (val.normalize) val = val.normalize("NFC");
28975     return utilUnicodeCharsTruncated(val, maxChars);
28976   }
28977
28978   // modules/osm/entity.js
28979   function osmEntity(attrs) {
28980     if (this instanceof osmEntity) return;
28981     if (attrs && attrs.type) {
28982       return osmEntity[attrs.type].apply(this, arguments);
28983     } else if (attrs && attrs.id) {
28984       return osmEntity[osmEntity.id.type(attrs.id)].apply(this, arguments);
28985     }
28986     return new osmEntity().initialize(arguments);
28987   }
28988   osmEntity.id = function(type2) {
28989     return osmEntity.id.fromOSM(type2, osmEntity.id.next[type2]--);
28990   };
28991   osmEntity.id.next = {
28992     changeset: -1,
28993     node: -1,
28994     way: -1,
28995     relation: -1
28996   };
28997   osmEntity.id.fromOSM = function(type2, id2) {
28998     return type2[0] + id2;
28999   };
29000   osmEntity.id.toOSM = function(id2) {
29001     var match = id2.match(/^[cnwr](-?\d+)$/);
29002     if (match) {
29003       return match[1];
29004     }
29005     return "";
29006   };
29007   osmEntity.id.type = function(id2) {
29008     return { "c": "changeset", "n": "node", "w": "way", "r": "relation" }[id2[0]];
29009   };
29010   osmEntity.key = function(entity) {
29011     return entity.id + "v" + (entity.v || 0);
29012   };
29013   var _deprecatedTagValuesByKey;
29014   osmEntity.deprecatedTagValuesByKey = function(dataDeprecated) {
29015     if (!_deprecatedTagValuesByKey) {
29016       _deprecatedTagValuesByKey = {};
29017       dataDeprecated.forEach(function(d2) {
29018         var oldKeys = Object.keys(d2.old);
29019         if (oldKeys.length === 1) {
29020           var oldKey = oldKeys[0];
29021           var oldValue = d2.old[oldKey];
29022           if (oldValue !== "*") {
29023             if (!_deprecatedTagValuesByKey[oldKey]) {
29024               _deprecatedTagValuesByKey[oldKey] = [oldValue];
29025             } else {
29026               _deprecatedTagValuesByKey[oldKey].push(oldValue);
29027             }
29028           }
29029         }
29030       });
29031     }
29032     return _deprecatedTagValuesByKey;
29033   };
29034   osmEntity.prototype = {
29035     tags: {},
29036     initialize: function(sources) {
29037       for (var i3 = 0; i3 < sources.length; ++i3) {
29038         var source = sources[i3];
29039         for (var prop in source) {
29040           if (Object.prototype.hasOwnProperty.call(source, prop)) {
29041             if (source[prop] === void 0) {
29042               delete this[prop];
29043             } else {
29044               this[prop] = source[prop];
29045             }
29046           }
29047         }
29048       }
29049       if (!this.id && this.type) {
29050         this.id = osmEntity.id(this.type);
29051       }
29052       if (!this.hasOwnProperty("visible")) {
29053         this.visible = true;
29054       }
29055       if (debug) {
29056         Object.freeze(this);
29057         Object.freeze(this.tags);
29058         if (this.loc) Object.freeze(this.loc);
29059         if (this.nodes) Object.freeze(this.nodes);
29060         if (this.members) Object.freeze(this.members);
29061       }
29062       return this;
29063     },
29064     copy: function(resolver, copies) {
29065       if (copies[this.id]) return copies[this.id];
29066       var copy2 = osmEntity(this, { id: void 0, user: void 0, version: void 0 });
29067       copies[this.id] = copy2;
29068       return copy2;
29069     },
29070     osmId: function() {
29071       return osmEntity.id.toOSM(this.id);
29072     },
29073     isNew: function() {
29074       var osmId = osmEntity.id.toOSM(this.id);
29075       return osmId.length === 0 || osmId[0] === "-";
29076     },
29077     update: function(attrs) {
29078       return osmEntity(this, attrs, { v: 1 + (this.v || 0) });
29079     },
29080     mergeTags: function(tags) {
29081       var merged = Object.assign({}, this.tags);
29082       var changed = false;
29083       for (var k2 in tags) {
29084         var t1 = merged[k2];
29085         var t2 = tags[k2];
29086         if (!t1) {
29087           changed = true;
29088           merged[k2] = t2;
29089         } else if (t1 !== t2) {
29090           changed = true;
29091           merged[k2] = utilUnicodeCharsTruncated(
29092             utilArrayUnion(t1.split(/;\s*/), t2.split(/;\s*/)).join(";"),
29093             255
29094             // avoid exceeding character limit; see also context.maxCharsForTagValue()
29095           );
29096         }
29097       }
29098       return changed ? this.update({ tags: merged }) : this;
29099     },
29100     intersects: function(extent, resolver) {
29101       return this.extent(resolver).intersects(extent);
29102     },
29103     hasNonGeometryTags: function() {
29104       return Object.keys(this.tags).some(function(k2) {
29105         return k2 !== "area";
29106       });
29107     },
29108     hasParentRelations: function(resolver) {
29109       return resolver.parentRelations(this).length > 0;
29110     },
29111     hasInterestingTags: function() {
29112       return Object.keys(this.tags).some(osmIsInterestingTag);
29113     },
29114     isHighwayIntersection: function() {
29115       return false;
29116     },
29117     isDegenerate: function() {
29118       return true;
29119     },
29120     deprecatedTags: function(dataDeprecated) {
29121       var tags = this.tags;
29122       if (Object.keys(tags).length === 0) return [];
29123       var deprecated = [];
29124       dataDeprecated.forEach(function(d2) {
29125         var oldKeys = Object.keys(d2.old);
29126         if (d2.replace) {
29127           var hasExistingValues = Object.keys(d2.replace).some(function(replaceKey) {
29128             if (!tags[replaceKey] || d2.old[replaceKey]) return false;
29129             var replaceValue = d2.replace[replaceKey];
29130             if (replaceValue === "*") return false;
29131             if (replaceValue === tags[replaceKey]) return false;
29132             return true;
29133           });
29134           if (hasExistingValues) return;
29135         }
29136         var matchesDeprecatedTags = oldKeys.every(function(oldKey) {
29137           if (!tags[oldKey]) return false;
29138           if (d2.old[oldKey] === "*") return true;
29139           if (d2.old[oldKey] === tags[oldKey]) return true;
29140           var vals = tags[oldKey].split(";").filter(Boolean);
29141           if (vals.length === 0) {
29142             return false;
29143           } else if (vals.length > 1) {
29144             return vals.indexOf(d2.old[oldKey]) !== -1;
29145           } else {
29146             if (tags[oldKey] === d2.old[oldKey]) {
29147               if (d2.replace && d2.old[oldKey] === d2.replace[oldKey]) {
29148                 var replaceKeys = Object.keys(d2.replace);
29149                 return !replaceKeys.every(function(replaceKey) {
29150                   return tags[replaceKey] === d2.replace[replaceKey];
29151                 });
29152               } else {
29153                 return true;
29154               }
29155             }
29156           }
29157           return false;
29158         });
29159         if (matchesDeprecatedTags) {
29160           deprecated.push(d2);
29161         }
29162       });
29163       return deprecated;
29164     }
29165   };
29166
29167   // modules/osm/lanes.js
29168   function osmLanes(entity) {
29169     if (entity.type !== "way") return null;
29170     if (!entity.tags.highway) return null;
29171     var tags = entity.tags;
29172     var isOneWay = entity.isOneWay();
29173     var laneCount = getLaneCount(tags, isOneWay);
29174     var maxspeed = parseMaxspeed(tags);
29175     var laneDirections = parseLaneDirections(tags, isOneWay, laneCount);
29176     var forward = laneDirections.forward;
29177     var backward = laneDirections.backward;
29178     var bothways = laneDirections.bothways;
29179     var turnLanes = {};
29180     turnLanes.unspecified = parseTurnLanes(tags["turn:lanes"]);
29181     turnLanes.forward = parseTurnLanes(tags["turn:lanes:forward"]);
29182     turnLanes.backward = parseTurnLanes(tags["turn:lanes:backward"]);
29183     var maxspeedLanes = {};
29184     maxspeedLanes.unspecified = parseMaxspeedLanes(tags["maxspeed:lanes"], maxspeed);
29185     maxspeedLanes.forward = parseMaxspeedLanes(tags["maxspeed:lanes:forward"], maxspeed);
29186     maxspeedLanes.backward = parseMaxspeedLanes(tags["maxspeed:lanes:backward"], maxspeed);
29187     var psvLanes = {};
29188     psvLanes.unspecified = parseMiscLanes(tags["psv:lanes"]);
29189     psvLanes.forward = parseMiscLanes(tags["psv:lanes:forward"]);
29190     psvLanes.backward = parseMiscLanes(tags["psv:lanes:backward"]);
29191     var busLanes = {};
29192     busLanes.unspecified = parseMiscLanes(tags["bus:lanes"]);
29193     busLanes.forward = parseMiscLanes(tags["bus:lanes:forward"]);
29194     busLanes.backward = parseMiscLanes(tags["bus:lanes:backward"]);
29195     var taxiLanes = {};
29196     taxiLanes.unspecified = parseMiscLanes(tags["taxi:lanes"]);
29197     taxiLanes.forward = parseMiscLanes(tags["taxi:lanes:forward"]);
29198     taxiLanes.backward = parseMiscLanes(tags["taxi:lanes:backward"]);
29199     var hovLanes = {};
29200     hovLanes.unspecified = parseMiscLanes(tags["hov:lanes"]);
29201     hovLanes.forward = parseMiscLanes(tags["hov:lanes:forward"]);
29202     hovLanes.backward = parseMiscLanes(tags["hov:lanes:backward"]);
29203     var hgvLanes = {};
29204     hgvLanes.unspecified = parseMiscLanes(tags["hgv:lanes"]);
29205     hgvLanes.forward = parseMiscLanes(tags["hgv:lanes:forward"]);
29206     hgvLanes.backward = parseMiscLanes(tags["hgv:lanes:backward"]);
29207     var bicyclewayLanes = {};
29208     bicyclewayLanes.unspecified = parseBicycleWay(tags["bicycleway:lanes"]);
29209     bicyclewayLanes.forward = parseBicycleWay(tags["bicycleway:lanes:forward"]);
29210     bicyclewayLanes.backward = parseBicycleWay(tags["bicycleway:lanes:backward"]);
29211     var lanesObj = {
29212       forward: [],
29213       backward: [],
29214       unspecified: []
29215     };
29216     mapToLanesObj(lanesObj, turnLanes, "turnLane");
29217     mapToLanesObj(lanesObj, maxspeedLanes, "maxspeed");
29218     mapToLanesObj(lanesObj, psvLanes, "psv");
29219     mapToLanesObj(lanesObj, busLanes, "bus");
29220     mapToLanesObj(lanesObj, taxiLanes, "taxi");
29221     mapToLanesObj(lanesObj, hovLanes, "hov");
29222     mapToLanesObj(lanesObj, hgvLanes, "hgv");
29223     mapToLanesObj(lanesObj, bicyclewayLanes, "bicycleway");
29224     return {
29225       metadata: {
29226         count: laneCount,
29227         oneway: isOneWay,
29228         forward,
29229         backward,
29230         bothways,
29231         turnLanes,
29232         maxspeed,
29233         maxspeedLanes,
29234         psvLanes,
29235         busLanes,
29236         taxiLanes,
29237         hovLanes,
29238         hgvLanes,
29239         bicyclewayLanes
29240       },
29241       lanes: lanesObj
29242     };
29243   }
29244   function getLaneCount(tags, isOneWay) {
29245     var count;
29246     if (tags.lanes) {
29247       count = parseInt(tags.lanes, 10);
29248       if (count > 0) {
29249         return count;
29250       }
29251     }
29252     switch (tags.highway) {
29253       case "trunk":
29254       case "motorway":
29255         count = isOneWay ? 2 : 4;
29256         break;
29257       default:
29258         count = isOneWay ? 1 : 2;
29259         break;
29260     }
29261     return count;
29262   }
29263   function parseMaxspeed(tags) {
29264     var maxspeed = tags.maxspeed;
29265     if (!maxspeed) return;
29266     var maxspeedRegex = /^([0-9][\.0-9]+?)(?:[ ]?(?:km\/h|kmh|kph|mph|knots))?$/;
29267     if (!maxspeedRegex.test(maxspeed)) return;
29268     return parseInt(maxspeed, 10);
29269   }
29270   function parseLaneDirections(tags, isOneWay, laneCount) {
29271     var forward = parseInt(tags["lanes:forward"], 10);
29272     var backward = parseInt(tags["lanes:backward"], 10);
29273     var bothways = parseInt(tags["lanes:both_ways"], 10) > 0 ? 1 : 0;
29274     if (parseInt(tags.oneway, 10) === -1) {
29275       forward = 0;
29276       bothways = 0;
29277       backward = laneCount;
29278     } else if (isOneWay) {
29279       forward = laneCount;
29280       bothways = 0;
29281       backward = 0;
29282     } else if (isNaN(forward) && isNaN(backward)) {
29283       backward = Math.floor((laneCount - bothways) / 2);
29284       forward = laneCount - bothways - backward;
29285     } else if (isNaN(forward)) {
29286       if (backward > laneCount - bothways) {
29287         backward = laneCount - bothways;
29288       }
29289       forward = laneCount - bothways - backward;
29290     } else if (isNaN(backward)) {
29291       if (forward > laneCount - bothways) {
29292         forward = laneCount - bothways;
29293       }
29294       backward = laneCount - bothways - forward;
29295     }
29296     return {
29297       forward,
29298       backward,
29299       bothways
29300     };
29301   }
29302   function parseTurnLanes(tag2) {
29303     if (!tag2) return;
29304     var validValues = [
29305       "left",
29306       "slight_left",
29307       "sharp_left",
29308       "through",
29309       "right",
29310       "slight_right",
29311       "sharp_right",
29312       "reverse",
29313       "merge_to_left",
29314       "merge_to_right",
29315       "none"
29316     ];
29317     return tag2.split("|").map(function(s2) {
29318       if (s2 === "") s2 = "none";
29319       return s2.split(";").map(function(d2) {
29320         return validValues.indexOf(d2) === -1 ? "unknown" : d2;
29321       });
29322     });
29323   }
29324   function parseMaxspeedLanes(tag2, maxspeed) {
29325     if (!tag2) return;
29326     return tag2.split("|").map(function(s2) {
29327       if (s2 === "none") return s2;
29328       var m2 = parseInt(s2, 10);
29329       if (s2 === "" || m2 === maxspeed) return null;
29330       return isNaN(m2) ? "unknown" : m2;
29331     });
29332   }
29333   function parseMiscLanes(tag2) {
29334     if (!tag2) return;
29335     var validValues = [
29336       "yes",
29337       "no",
29338       "designated"
29339     ];
29340     return tag2.split("|").map(function(s2) {
29341       if (s2 === "") s2 = "no";
29342       return validValues.indexOf(s2) === -1 ? "unknown" : s2;
29343     });
29344   }
29345   function parseBicycleWay(tag2) {
29346     if (!tag2) return;
29347     var validValues = [
29348       "yes",
29349       "no",
29350       "designated",
29351       "lane"
29352     ];
29353     return tag2.split("|").map(function(s2) {
29354       if (s2 === "") s2 = "no";
29355       return validValues.indexOf(s2) === -1 ? "unknown" : s2;
29356     });
29357   }
29358   function mapToLanesObj(lanesObj, data, key) {
29359     if (data.forward) {
29360       data.forward.forEach(function(l2, i3) {
29361         if (!lanesObj.forward[i3]) lanesObj.forward[i3] = {};
29362         lanesObj.forward[i3][key] = l2;
29363       });
29364     }
29365     if (data.backward) {
29366       data.backward.forEach(function(l2, i3) {
29367         if (!lanesObj.backward[i3]) lanesObj.backward[i3] = {};
29368         lanesObj.backward[i3][key] = l2;
29369       });
29370     }
29371     if (data.unspecified) {
29372       data.unspecified.forEach(function(l2, i3) {
29373         if (!lanesObj.unspecified[i3]) lanesObj.unspecified[i3] = {};
29374         lanesObj.unspecified[i3][key] = l2;
29375       });
29376     }
29377   }
29378
29379   // modules/osm/way.js
29380   function osmWay() {
29381     if (!(this instanceof osmWay)) {
29382       return new osmWay().initialize(arguments);
29383     } else if (arguments.length) {
29384       this.initialize(arguments);
29385     }
29386   }
29387   osmEntity.way = osmWay;
29388   osmWay.prototype = Object.create(osmEntity.prototype);
29389   Object.assign(osmWay.prototype, {
29390     type: "way",
29391     nodes: [],
29392     copy: function(resolver, copies) {
29393       if (copies[this.id]) return copies[this.id];
29394       var copy2 = osmEntity.prototype.copy.call(this, resolver, copies);
29395       var nodes = this.nodes.map(function(id2) {
29396         return resolver.entity(id2).copy(resolver, copies).id;
29397       });
29398       copy2 = copy2.update({ nodes });
29399       copies[this.id] = copy2;
29400       return copy2;
29401     },
29402     extent: function(resolver) {
29403       return resolver.transient(this, "extent", function() {
29404         var extent = geoExtent();
29405         for (var i3 = 0; i3 < this.nodes.length; i3++) {
29406           var node = resolver.hasEntity(this.nodes[i3]);
29407           if (node) {
29408             extent._extend(node.extent());
29409           }
29410         }
29411         return extent;
29412       });
29413     },
29414     first: function() {
29415       return this.nodes[0];
29416     },
29417     last: function() {
29418       return this.nodes[this.nodes.length - 1];
29419     },
29420     contains: function(node) {
29421       return this.nodes.indexOf(node) >= 0;
29422     },
29423     affix: function(node) {
29424       if (this.nodes[0] === node) return "prefix";
29425       if (this.nodes[this.nodes.length - 1] === node) return "suffix";
29426     },
29427     layer: function() {
29428       if (isFinite(this.tags.layer)) {
29429         return Math.max(-10, Math.min(+this.tags.layer, 10));
29430       }
29431       if (this.tags.covered === "yes") return -1;
29432       if (this.tags.location === "overground") return 1;
29433       if (this.tags.location === "underground") return -1;
29434       if (this.tags.location === "underwater") return -10;
29435       if (this.tags.power === "line") return 10;
29436       if (this.tags.power === "minor_line") return 10;
29437       if (this.tags.aerialway) return 10;
29438       if (this.tags.bridge) return 1;
29439       if (this.tags.cutting) return -1;
29440       if (this.tags.tunnel) return -1;
29441       if (this.tags.waterway) return -1;
29442       if (this.tags.man_made === "pipeline") return -10;
29443       if (this.tags.boundary) return -10;
29444       return 0;
29445     },
29446     // the approximate width of the line based on its tags except its `width` tag
29447     impliedLineWidthMeters: function() {
29448       var averageWidths = {
29449         highway: {
29450           // width is for single lane
29451           motorway: 5,
29452           motorway_link: 5,
29453           trunk: 4.5,
29454           trunk_link: 4.5,
29455           primary: 4,
29456           secondary: 4,
29457           tertiary: 4,
29458           primary_link: 4,
29459           secondary_link: 4,
29460           tertiary_link: 4,
29461           unclassified: 4,
29462           road: 4,
29463           living_street: 4,
29464           bus_guideway: 4,
29465           busway: 4,
29466           pedestrian: 4,
29467           residential: 3.5,
29468           service: 3.5,
29469           track: 3,
29470           cycleway: 2.5,
29471           bridleway: 2,
29472           corridor: 2,
29473           steps: 2,
29474           path: 1.5,
29475           footway: 1.5,
29476           ladder: 0.5
29477         },
29478         railway: {
29479           // width includes ties and rail bed, not just track gauge
29480           rail: 2.5,
29481           light_rail: 2.5,
29482           tram: 2.5,
29483           subway: 2.5,
29484           monorail: 2.5,
29485           funicular: 2.5,
29486           disused: 2.5,
29487           preserved: 2.5,
29488           miniature: 1.5,
29489           narrow_gauge: 1.5
29490         },
29491         waterway: {
29492           river: 50,
29493           canal: 25,
29494           stream: 5,
29495           tidal_channel: 5,
29496           fish_pass: 2.5,
29497           drain: 2.5,
29498           ditch: 1.5
29499         }
29500       };
29501       for (var key in averageWidths) {
29502         if (this.tags[key] && averageWidths[key][this.tags[key]]) {
29503           var width = averageWidths[key][this.tags[key]];
29504           if (key === "highway") {
29505             var laneCount = this.tags.lanes && parseInt(this.tags.lanes, 10);
29506             if (!laneCount) laneCount = this.isOneWay() ? 1 : 2;
29507             return width * laneCount;
29508           }
29509           return width;
29510         }
29511       }
29512       return null;
29513     },
29514     isOneWay: function() {
29515       var values = {
29516         "yes": true,
29517         "1": true,
29518         "-1": true,
29519         "reversible": true,
29520         "alternating": true,
29521         "no": false,
29522         "0": false
29523       };
29524       if (values[this.tags.oneway] !== void 0) {
29525         return values[this.tags.oneway];
29526       }
29527       for (var key in this.tags) {
29528         if (key in osmOneWayTags && this.tags[key] in osmOneWayTags[key]) {
29529           return true;
29530         }
29531       }
29532       return false;
29533     },
29534     // Some identifier for tag that implies that this way is "sided",
29535     // i.e. the right side is the 'inside' (e.g. the right side of a
29536     // natural=cliff is lower).
29537     sidednessIdentifier: function() {
29538       for (const realKey in this.tags) {
29539         const value = this.tags[realKey];
29540         const key = osmRemoveLifecyclePrefix(realKey);
29541         if (key in osmRightSideIsInsideTags && value in osmRightSideIsInsideTags[key]) {
29542           if (osmRightSideIsInsideTags[key][value] === true) {
29543             return key;
29544           } else {
29545             return osmRightSideIsInsideTags[key][value];
29546           }
29547         }
29548       }
29549       return null;
29550     },
29551     isSided: function() {
29552       if (this.tags.two_sided === "yes") {
29553         return false;
29554       }
29555       return this.sidednessIdentifier() !== null;
29556     },
29557     lanes: function() {
29558       return osmLanes(this);
29559     },
29560     isClosed: function() {
29561       return this.nodes.length > 1 && this.first() === this.last();
29562     },
29563     isConvex: function(resolver) {
29564       if (!this.isClosed() || this.isDegenerate()) return null;
29565       var nodes = utilArrayUniq(resolver.childNodes(this));
29566       var coords = nodes.map(function(n3) {
29567         return n3.loc;
29568       });
29569       var curr = 0;
29570       var prev = 0;
29571       for (var i3 = 0; i3 < coords.length; i3++) {
29572         var o2 = coords[(i3 + 1) % coords.length];
29573         var a2 = coords[i3];
29574         var b2 = coords[(i3 + 2) % coords.length];
29575         var res = geoVecCross(a2, b2, o2);
29576         curr = res > 0 ? 1 : res < 0 ? -1 : 0;
29577         if (curr === 0) {
29578           continue;
29579         } else if (prev && curr !== prev) {
29580           return false;
29581         }
29582         prev = curr;
29583       }
29584       return true;
29585     },
29586     // returns an object with the tag that implies this is an area, if any
29587     tagSuggestingArea: function() {
29588       return osmTagSuggestingArea(this.tags);
29589     },
29590     isArea: function() {
29591       if (this.tags.area === "yes") return true;
29592       if (!this.isClosed() || this.tags.area === "no") return false;
29593       return this.tagSuggestingArea() !== null;
29594     },
29595     isDegenerate: function() {
29596       return new Set(this.nodes).size < (this.isArea() ? 3 : 2);
29597     },
29598     areAdjacent: function(n1, n22) {
29599       for (var i3 = 0; i3 < this.nodes.length; i3++) {
29600         if (this.nodes[i3] === n1) {
29601           if (this.nodes[i3 - 1] === n22) return true;
29602           if (this.nodes[i3 + 1] === n22) return true;
29603         }
29604       }
29605       return false;
29606     },
29607     geometry: function(graph) {
29608       return graph.transient(this, "geometry", function() {
29609         return this.isArea() ? "area" : "line";
29610       });
29611     },
29612     // returns an array of objects representing the segments between the nodes in this way
29613     segments: function(graph) {
29614       function segmentExtent(graph2) {
29615         var n1 = graph2.hasEntity(this.nodes[0]);
29616         var n22 = graph2.hasEntity(this.nodes[1]);
29617         return n1 && n22 && geoExtent([
29618           [
29619             Math.min(n1.loc[0], n22.loc[0]),
29620             Math.min(n1.loc[1], n22.loc[1])
29621           ],
29622           [
29623             Math.max(n1.loc[0], n22.loc[0]),
29624             Math.max(n1.loc[1], n22.loc[1])
29625           ]
29626         ]);
29627       }
29628       return graph.transient(this, "segments", function() {
29629         var segments = [];
29630         for (var i3 = 0; i3 < this.nodes.length - 1; i3++) {
29631           segments.push({
29632             id: this.id + "-" + i3,
29633             wayId: this.id,
29634             index: i3,
29635             nodes: [this.nodes[i3], this.nodes[i3 + 1]],
29636             extent: segmentExtent
29637           });
29638         }
29639         return segments;
29640       });
29641     },
29642     // If this way is not closed, append the beginning node to the end of the nodelist to close it.
29643     close: function() {
29644       if (this.isClosed() || !this.nodes.length) return this;
29645       var nodes = this.nodes.slice();
29646       nodes = nodes.filter(noRepeatNodes);
29647       nodes.push(nodes[0]);
29648       return this.update({ nodes });
29649     },
29650     // If this way is closed, remove any connector nodes from the end of the nodelist to unclose it.
29651     unclose: function() {
29652       if (!this.isClosed()) return this;
29653       var nodes = this.nodes.slice();
29654       var connector = this.first();
29655       var i3 = nodes.length - 1;
29656       while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
29657         nodes.splice(i3, 1);
29658         i3 = nodes.length - 1;
29659       }
29660       nodes = nodes.filter(noRepeatNodes);
29661       return this.update({ nodes });
29662     },
29663     // Adds a node (id) in front of the node which is currently at position index.
29664     // If index is undefined, the node will be added to the end of the way for linear ways,
29665     //   or just before the final connecting node for circular ways.
29666     // Consecutive duplicates are eliminated including existing ones.
29667     // Circularity is always preserved when adding a node.
29668     addNode: function(id2, index) {
29669       var nodes = this.nodes.slice();
29670       var isClosed = this.isClosed();
29671       var max3 = isClosed ? nodes.length - 1 : nodes.length;
29672       if (index === void 0) {
29673         index = max3;
29674       }
29675       if (index < 0 || index > max3) {
29676         throw new RangeError("index " + index + " out of range 0.." + max3);
29677       }
29678       if (isClosed) {
29679         var connector = this.first();
29680         var i3 = 1;
29681         while (i3 < nodes.length && nodes.length > 2 && nodes[i3] === connector) {
29682           nodes.splice(i3, 1);
29683           if (index > i3) index--;
29684         }
29685         i3 = nodes.length - 1;
29686         while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
29687           nodes.splice(i3, 1);
29688           if (index > i3) index--;
29689           i3 = nodes.length - 1;
29690         }
29691       }
29692       nodes.splice(index, 0, id2);
29693       nodes = nodes.filter(noRepeatNodes);
29694       if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
29695         nodes.push(nodes[0]);
29696       }
29697       return this.update({ nodes });
29698     },
29699     // Replaces the node which is currently at position index with the given node (id).
29700     // Consecutive duplicates are eliminated including existing ones.
29701     // Circularity is preserved when updating a node.
29702     updateNode: function(id2, index) {
29703       var nodes = this.nodes.slice();
29704       var isClosed = this.isClosed();
29705       var max3 = nodes.length - 1;
29706       if (index === void 0 || index < 0 || index > max3) {
29707         throw new RangeError("index " + index + " out of range 0.." + max3);
29708       }
29709       if (isClosed) {
29710         var connector = this.first();
29711         var i3 = 1;
29712         while (i3 < nodes.length && nodes.length > 2 && nodes[i3] === connector) {
29713           nodes.splice(i3, 1);
29714           if (index > i3) index--;
29715         }
29716         i3 = nodes.length - 1;
29717         while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
29718           nodes.splice(i3, 1);
29719           if (index === i3) index = 0;
29720           i3 = nodes.length - 1;
29721         }
29722       }
29723       nodes.splice(index, 1, id2);
29724       nodes = nodes.filter(noRepeatNodes);
29725       if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
29726         nodes.push(nodes[0]);
29727       }
29728       return this.update({ nodes });
29729     },
29730     // Replaces each occurrence of node id needle with replacement.
29731     // Consecutive duplicates are eliminated including existing ones.
29732     // Circularity is preserved.
29733     replaceNode: function(needleID, replacementID) {
29734       var nodes = this.nodes.slice();
29735       var isClosed = this.isClosed();
29736       for (var i3 = 0; i3 < nodes.length; i3++) {
29737         if (nodes[i3] === needleID) {
29738           nodes[i3] = replacementID;
29739         }
29740       }
29741       nodes = nodes.filter(noRepeatNodes);
29742       if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
29743         nodes.push(nodes[0]);
29744       }
29745       return this.update({ nodes });
29746     },
29747     // Removes each occurrence of node id.
29748     // Consecutive duplicates are eliminated including existing ones.
29749     // Circularity is preserved.
29750     removeNode: function(id2) {
29751       var nodes = this.nodes.slice();
29752       var isClosed = this.isClosed();
29753       nodes = nodes.filter(function(node) {
29754         return node !== id2;
29755       }).filter(noRepeatNodes);
29756       if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
29757         nodes.push(nodes[0]);
29758       }
29759       return this.update({ nodes });
29760     },
29761     asJXON: function(changeset_id) {
29762       var r2 = {
29763         way: {
29764           "@id": this.osmId(),
29765           "@version": this.version || 0,
29766           nd: this.nodes.map(function(id2) {
29767             return { keyAttributes: { ref: osmEntity.id.toOSM(id2) } };
29768           }, this),
29769           tag: Object.keys(this.tags).map(function(k2) {
29770             return { keyAttributes: { k: k2, v: this.tags[k2] } };
29771           }, this)
29772         }
29773       };
29774       if (changeset_id) {
29775         r2.way["@changeset"] = changeset_id;
29776       }
29777       return r2;
29778     },
29779     asGeoJSON: function(resolver) {
29780       return resolver.transient(this, "GeoJSON", function() {
29781         var coordinates = resolver.childNodes(this).map(function(n3) {
29782           return n3.loc;
29783         });
29784         if (this.isArea() && this.isClosed()) {
29785           return {
29786             type: "Polygon",
29787             coordinates: [coordinates]
29788           };
29789         } else {
29790           return {
29791             type: "LineString",
29792             coordinates
29793           };
29794         }
29795       });
29796     },
29797     area: function(resolver) {
29798       return resolver.transient(this, "area", function() {
29799         var nodes = resolver.childNodes(this);
29800         var json = {
29801           type: "Polygon",
29802           coordinates: [nodes.map(function(n3) {
29803             return n3.loc;
29804           })]
29805         };
29806         if (!this.isClosed() && nodes.length) {
29807           json.coordinates[0].push(nodes[0].loc);
29808         }
29809         var area = area_default(json);
29810         if (area > 2 * Math.PI) {
29811           json.coordinates[0] = json.coordinates[0].reverse();
29812           area = area_default(json);
29813         }
29814         return isNaN(area) ? 0 : area;
29815       });
29816     }
29817   });
29818   function noRepeatNodes(node, i3, arr) {
29819     return i3 === 0 || node !== arr[i3 - 1];
29820   }
29821
29822   // modules/osm/multipolygon.js
29823   function osmJoinWays(toJoin, graph) {
29824     function resolve(member) {
29825       return graph.childNodes(graph.entity(member.id));
29826     }
29827     function reverse(item2) {
29828       var action = actionReverse(item2.id, { reverseOneway: true });
29829       sequences.actions.push(action);
29830       return item2 instanceof osmWay ? action(graph).entity(item2.id) : item2;
29831     }
29832     toJoin = toJoin.filter(function(member) {
29833       return member.type === "way" && graph.hasEntity(member.id);
29834     });
29835     var i3;
29836     var joinAsMembers = true;
29837     for (i3 = 0; i3 < toJoin.length; i3++) {
29838       if (toJoin[i3] instanceof osmWay) {
29839         joinAsMembers = false;
29840         break;
29841       }
29842     }
29843     var sequences = [];
29844     sequences.actions = [];
29845     while (toJoin.length) {
29846       var item = toJoin.shift();
29847       var currWays = [item];
29848       var currNodes = resolve(item).slice();
29849       while (toJoin.length) {
29850         var start2 = currNodes[0];
29851         var end = currNodes[currNodes.length - 1];
29852         var fn = null;
29853         var nodes = null;
29854         for (i3 = 0; i3 < toJoin.length; i3++) {
29855           item = toJoin[i3];
29856           nodes = resolve(item);
29857           if (joinAsMembers && currWays.length === 1 && nodes[0] !== end && nodes[nodes.length - 1] !== end && (nodes[nodes.length - 1] === start2 || nodes[0] === start2)) {
29858             currWays[0] = reverse(currWays[0]);
29859             currNodes.reverse();
29860             start2 = currNodes[0];
29861             end = currNodes[currNodes.length - 1];
29862           }
29863           if (nodes[0] === end) {
29864             fn = currNodes.push;
29865             nodes = nodes.slice(1);
29866             break;
29867           } else if (nodes[nodes.length - 1] === end) {
29868             fn = currNodes.push;
29869             nodes = nodes.slice(0, -1).reverse();
29870             item = reverse(item);
29871             break;
29872           } else if (nodes[nodes.length - 1] === start2) {
29873             fn = currNodes.unshift;
29874             nodes = nodes.slice(0, -1);
29875             break;
29876           } else if (nodes[0] === start2) {
29877             fn = currNodes.unshift;
29878             nodes = nodes.slice(1).reverse();
29879             item = reverse(item);
29880             break;
29881           } else {
29882             fn = nodes = null;
29883           }
29884         }
29885         if (!nodes) {
29886           break;
29887         }
29888         fn.apply(currWays, [item]);
29889         fn.apply(currNodes, nodes);
29890         toJoin.splice(i3, 1);
29891       }
29892       currWays.nodes = currNodes;
29893       sequences.push(currWays);
29894     }
29895     return sequences;
29896   }
29897
29898   // modules/actions/add_member.js
29899   function actionAddMember(relationId, member, memberIndex) {
29900     return function action(graph) {
29901       var relation = graph.entity(relationId);
29902       var isPTv2 = /stop|platform/.test(member.role);
29903       if (member.type === "way" && !isPTv2) {
29904         graph = addWayMember(relation, graph);
29905       } else {
29906         if (isPTv2 && isNaN(memberIndex)) {
29907           memberIndex = 0;
29908         }
29909         graph = graph.replace(relation.addMember(member, memberIndex));
29910       }
29911       return graph;
29912     };
29913     function addWayMember(relation, graph) {
29914       var groups, item, i3, j2, k2;
29915       var PTv2members = [];
29916       var members = [];
29917       for (i3 = 0; i3 < relation.members.length; i3++) {
29918         var m2 = relation.members[i3];
29919         if (/stop|platform/.test(m2.role)) {
29920           PTv2members.push(m2);
29921         } else {
29922           members.push(m2);
29923         }
29924       }
29925       relation = relation.update({ members });
29926       groups = utilArrayGroupBy(relation.members, "type");
29927       groups.way = groups.way || [];
29928       groups.way.push(member);
29929       members = withIndex(groups.way);
29930       var joined = osmJoinWays(members, graph);
29931       for (i3 = 0; i3 < joined.length; i3++) {
29932         var segment = joined[i3];
29933         var nodes = segment.nodes.slice();
29934         var startIndex = segment[0].index;
29935         for (j2 = 0; j2 < members.length; j2++) {
29936           if (members[j2].index === startIndex) {
29937             break;
29938           }
29939         }
29940         for (k2 = 0; k2 < segment.length; k2++) {
29941           item = segment[k2];
29942           var way = graph.entity(item.id);
29943           if (k2 > 0) {
29944             if (j2 + k2 >= members.length || item.index !== members[j2 + k2].index) {
29945               moveMember(members, item.index, j2 + k2);
29946             }
29947           }
29948           nodes.splice(0, way.nodes.length - 1);
29949         }
29950       }
29951       var wayMembers = [];
29952       for (i3 = 0; i3 < members.length; i3++) {
29953         item = members[i3];
29954         if (item.index === -1) continue;
29955         wayMembers.push(utilObjectOmit(item, ["index"]));
29956       }
29957       var newMembers = PTv2members.concat(groups.node || [], wayMembers, groups.relation || []);
29958       return graph.replace(relation.update({ members: newMembers }));
29959       function moveMember(arr, findIndex, toIndex) {
29960         var i4;
29961         for (i4 = 0; i4 < arr.length; i4++) {
29962           if (arr[i4].index === findIndex) {
29963             break;
29964           }
29965         }
29966         var item2 = Object.assign({}, arr[i4]);
29967         arr[i4].index = -1;
29968         delete item2.index;
29969         arr.splice(toIndex, 0, item2);
29970       }
29971       function withIndex(arr) {
29972         var result = new Array(arr.length);
29973         for (var i4 = 0; i4 < arr.length; i4++) {
29974           result[i4] = Object.assign({}, arr[i4]);
29975           result[i4].index = i4;
29976         }
29977         return result;
29978       }
29979     }
29980   }
29981
29982   // modules/actions/add_midpoint.js
29983   function actionAddMidpoint(midpoint, node) {
29984     return function(graph) {
29985       graph = graph.replace(node.move(midpoint.loc));
29986       var parents = utilArrayIntersection(
29987         graph.parentWays(graph.entity(midpoint.edge[0])),
29988         graph.parentWays(graph.entity(midpoint.edge[1]))
29989       );
29990       parents.forEach(function(way) {
29991         for (var i3 = 0; i3 < way.nodes.length - 1; i3++) {
29992           if (geoEdgeEqual([way.nodes[i3], way.nodes[i3 + 1]], midpoint.edge)) {
29993             graph = graph.replace(graph.entity(way.id).addNode(node.id, i3 + 1));
29994             return;
29995           }
29996         }
29997       });
29998       return graph;
29999     };
30000   }
30001
30002   // modules/actions/add_vertex.js
30003   function actionAddVertex(wayId, nodeId, index) {
30004     return function(graph) {
30005       return graph.replace(graph.entity(wayId).addNode(nodeId, index));
30006     };
30007   }
30008
30009   // modules/actions/change_member.js
30010   function actionChangeMember(relationId, member, memberIndex) {
30011     return function(graph) {
30012       return graph.replace(graph.entity(relationId).updateMember(member, memberIndex));
30013     };
30014   }
30015
30016   // modules/actions/change_preset.js
30017   function actionChangePreset(entityID, oldPreset, newPreset, skipFieldDefaults) {
30018     return function action(graph) {
30019       var entity = graph.entity(entityID);
30020       var geometry = entity.geometry(graph);
30021       var tags = entity.tags;
30022       const loc = entity.extent(graph).center();
30023       var preserveKeys;
30024       if (newPreset) {
30025         preserveKeys = [];
30026         if (newPreset.addTags) {
30027           preserveKeys = preserveKeys.concat(Object.keys(newPreset.addTags));
30028         }
30029         if (oldPreset && !oldPreset.id.startsWith(newPreset.id)) {
30030           newPreset.fields(loc).concat(newPreset.moreFields(loc)).filter((f2) => f2.matchGeometry(geometry)).map((f2) => f2.key).filter(Boolean).forEach((key) => preserveKeys.push(key));
30031         }
30032       }
30033       if (oldPreset) tags = oldPreset.unsetTags(tags, geometry, preserveKeys, false, loc);
30034       if (newPreset) tags = newPreset.setTags(tags, geometry, skipFieldDefaults, loc);
30035       return graph.replace(entity.update({ tags }));
30036     };
30037   }
30038
30039   // modules/actions/change_tags.js
30040   function actionChangeTags(entityId, tags) {
30041     return function(graph) {
30042       var entity = graph.entity(entityId);
30043       return graph.replace(entity.update({ tags }));
30044     };
30045   }
30046
30047   // modules/osm/node.js
30048   var cardinal = {
30049     north: 0,
30050     n: 0,
30051     northnortheast: 22,
30052     nne: 22,
30053     northeast: 45,
30054     ne: 45,
30055     eastnortheast: 67,
30056     ene: 67,
30057     east: 90,
30058     e: 90,
30059     eastsoutheast: 112,
30060     ese: 112,
30061     southeast: 135,
30062     se: 135,
30063     southsoutheast: 157,
30064     sse: 157,
30065     south: 180,
30066     s: 180,
30067     southsouthwest: 202,
30068     ssw: 202,
30069     southwest: 225,
30070     sw: 225,
30071     westsouthwest: 247,
30072     wsw: 247,
30073     west: 270,
30074     w: 270,
30075     westnorthwest: 292,
30076     wnw: 292,
30077     northwest: 315,
30078     nw: 315,
30079     northnorthwest: 337,
30080     nnw: 337
30081   };
30082   function osmNode() {
30083     if (!(this instanceof osmNode)) {
30084       return new osmNode().initialize(arguments);
30085     } else if (arguments.length) {
30086       this.initialize(arguments);
30087     }
30088   }
30089   osmEntity.node = osmNode;
30090   osmNode.prototype = Object.create(osmEntity.prototype);
30091   Object.assign(osmNode.prototype, {
30092     type: "node",
30093     loc: [9999, 9999],
30094     extent: function() {
30095       return new geoExtent(this.loc);
30096     },
30097     geometry: function(graph) {
30098       return graph.transient(this, "geometry", function() {
30099         return graph.isPoi(this) ? "point" : "vertex";
30100       });
30101     },
30102     move: function(loc) {
30103       return this.update({ loc });
30104     },
30105     isDegenerate: function() {
30106       return !(Array.isArray(this.loc) && this.loc.length === 2 && this.loc[0] >= -180 && this.loc[0] <= 180 && this.loc[1] >= -90 && this.loc[1] <= 90);
30107     },
30108     // Inspect tags and geometry to determine which direction(s) this node/vertex points
30109     directions: function(resolver, projection2) {
30110       var val;
30111       var i3;
30112       if (this.isHighwayIntersection(resolver) && (this.tags.stop || "").toLowerCase() === "all") {
30113         val = "all";
30114       } else {
30115         val = (this.tags.direction || "").toLowerCase();
30116         var re3 = /:direction$/i;
30117         var keys2 = Object.keys(this.tags);
30118         for (i3 = 0; i3 < keys2.length; i3++) {
30119           if (re3.test(keys2[i3])) {
30120             val = this.tags[keys2[i3]].toLowerCase();
30121             break;
30122           }
30123         }
30124       }
30125       if (val === "") return [];
30126       var values = val.split(";");
30127       var results = [];
30128       values.forEach(function(v2) {
30129         if (cardinal[v2] !== void 0) {
30130           v2 = cardinal[v2];
30131         }
30132         if (v2 !== "" && !isNaN(+v2)) {
30133           results.push(+v2);
30134           return;
30135         }
30136         var lookBackward = this.tags["traffic_sign:backward"] || v2 === "backward" || v2 === "both" || v2 === "all";
30137         var lookForward = this.tags["traffic_sign:forward"] || v2 === "forward" || v2 === "both" || v2 === "all";
30138         if (!lookForward && !lookBackward) return;
30139         var nodeIds = {};
30140         resolver.parentWays(this).forEach(function(parent) {
30141           var nodes = parent.nodes;
30142           for (i3 = 0; i3 < nodes.length; i3++) {
30143             if (nodes[i3] === this.id) {
30144               if (lookForward && i3 > 0) {
30145                 nodeIds[nodes[i3 - 1]] = true;
30146               }
30147               if (lookBackward && i3 < nodes.length - 1) {
30148                 nodeIds[nodes[i3 + 1]] = true;
30149               }
30150             }
30151           }
30152         }, this);
30153         Object.keys(nodeIds).forEach(function(nodeId) {
30154           results.push(
30155             geoAngle(this, resolver.entity(nodeId), projection2) * (180 / Math.PI) + 90
30156           );
30157         }, this);
30158       }, this);
30159       return utilArrayUniq(results);
30160     },
30161     isCrossing: function() {
30162       return this.tags.highway === "crossing" || this.tags.railway && this.tags.railway.indexOf("crossing") !== -1;
30163     },
30164     isEndpoint: function(resolver) {
30165       return resolver.transient(this, "isEndpoint", function() {
30166         var id2 = this.id;
30167         return resolver.parentWays(this).filter(function(parent) {
30168           return !parent.isClosed() && !!parent.affix(id2);
30169         }).length > 0;
30170       });
30171     },
30172     isConnected: function(resolver) {
30173       return resolver.transient(this, "isConnected", function() {
30174         var parents = resolver.parentWays(this);
30175         if (parents.length > 1) {
30176           for (var i3 in parents) {
30177             if (parents[i3].geometry(resolver) === "line" && parents[i3].hasInterestingTags()) return true;
30178           }
30179         } else if (parents.length === 1) {
30180           var way = parents[0];
30181           var nodes = way.nodes.slice();
30182           if (way.isClosed()) {
30183             nodes.pop();
30184           }
30185           return nodes.indexOf(this.id) !== nodes.lastIndexOf(this.id);
30186         }
30187         return false;
30188       });
30189     },
30190     parentIntersectionWays: function(resolver) {
30191       return resolver.transient(this, "parentIntersectionWays", function() {
30192         return resolver.parentWays(this).filter(function(parent) {
30193           return (parent.tags.highway || parent.tags.waterway || parent.tags.railway || parent.tags.aeroway) && parent.geometry(resolver) === "line";
30194         });
30195       });
30196     },
30197     isIntersection: function(resolver) {
30198       return this.parentIntersectionWays(resolver).length > 1;
30199     },
30200     isHighwayIntersection: function(resolver) {
30201       return resolver.transient(this, "isHighwayIntersection", function() {
30202         return resolver.parentWays(this).filter(function(parent) {
30203           return parent.tags.highway && parent.geometry(resolver) === "line";
30204         }).length > 1;
30205       });
30206     },
30207     isOnAddressLine: function(resolver) {
30208       return resolver.transient(this, "isOnAddressLine", function() {
30209         return resolver.parentWays(this).filter(function(parent) {
30210           return parent.tags.hasOwnProperty("addr:interpolation") && parent.geometry(resolver) === "line";
30211         }).length > 0;
30212       });
30213     },
30214     asJXON: function(changeset_id) {
30215       var r2 = {
30216         node: {
30217           "@id": this.osmId(),
30218           "@lon": this.loc[0],
30219           "@lat": this.loc[1],
30220           "@version": this.version || 0,
30221           tag: Object.keys(this.tags).map(function(k2) {
30222             return { keyAttributes: { k: k2, v: this.tags[k2] } };
30223           }, this)
30224         }
30225       };
30226       if (changeset_id) r2.node["@changeset"] = changeset_id;
30227       return r2;
30228     },
30229     asGeoJSON: function() {
30230       return {
30231         type: "Point",
30232         coordinates: this.loc
30233       };
30234     }
30235   });
30236
30237   // modules/actions/circularize.js
30238   function actionCircularize(wayId, projection2, maxAngle) {
30239     maxAngle = (maxAngle || 20) * Math.PI / 180;
30240     var action = function(graph, t2) {
30241       if (t2 === null || !isFinite(t2)) t2 = 1;
30242       t2 = Math.min(Math.max(+t2, 0), 1);
30243       var way = graph.entity(wayId);
30244       var origNodes = {};
30245       graph.childNodes(way).forEach(function(node2) {
30246         if (!origNodes[node2.id]) origNodes[node2.id] = node2;
30247       });
30248       if (!way.isConvex(graph)) {
30249         graph = action.makeConvex(graph);
30250       }
30251       var nodes = utilArrayUniq(graph.childNodes(way));
30252       var keyNodes = nodes.filter(function(n3) {
30253         return graph.parentWays(n3).length !== 1;
30254       });
30255       var points = nodes.map(function(n3) {
30256         return projection2(n3.loc);
30257       });
30258       var keyPoints = keyNodes.map(function(n3) {
30259         return projection2(n3.loc);
30260       });
30261       var centroid = points.length === 2 ? geoVecInterp(points[0], points[1], 0.5) : centroid_default2(points);
30262       var radius = median(points, function(p2) {
30263         return geoVecLength(centroid, p2);
30264       });
30265       var sign2 = area_default3(points) > 0 ? 1 : -1;
30266       var ids, i3, j2, k2;
30267       if (!keyNodes.length) {
30268         keyNodes = [nodes[0]];
30269         keyPoints = [points[0]];
30270       }
30271       if (keyNodes.length === 1) {
30272         var index = nodes.indexOf(keyNodes[0]);
30273         var oppositeIndex = Math.floor((index + nodes.length / 2) % nodes.length);
30274         keyNodes.push(nodes[oppositeIndex]);
30275         keyPoints.push(points[oppositeIndex]);
30276       }
30277       for (i3 = 0; i3 < keyPoints.length; i3++) {
30278         var nextKeyNodeIndex = (i3 + 1) % keyNodes.length;
30279         var startNode = keyNodes[i3];
30280         var endNode = keyNodes[nextKeyNodeIndex];
30281         var startNodeIndex = nodes.indexOf(startNode);
30282         var endNodeIndex = nodes.indexOf(endNode);
30283         var numberNewPoints = -1;
30284         var indexRange = endNodeIndex - startNodeIndex;
30285         var nearNodes = {};
30286         var inBetweenNodes = [];
30287         var startAngle, endAngle, totalAngle, eachAngle;
30288         var angle2, loc, node, origNode;
30289         if (indexRange < 0) {
30290           indexRange += nodes.length;
30291         }
30292         var distance = geoVecLength(centroid, keyPoints[i3]) || 1e-4;
30293         keyPoints[i3] = [
30294           centroid[0] + (keyPoints[i3][0] - centroid[0]) / distance * radius,
30295           centroid[1] + (keyPoints[i3][1] - centroid[1]) / distance * radius
30296         ];
30297         loc = projection2.invert(keyPoints[i3]);
30298         node = keyNodes[i3];
30299         origNode = origNodes[node.id];
30300         node = node.move(geoVecInterp(origNode.loc, loc, t2));
30301         graph = graph.replace(node);
30302         startAngle = Math.atan2(keyPoints[i3][1] - centroid[1], keyPoints[i3][0] - centroid[0]);
30303         endAngle = Math.atan2(keyPoints[nextKeyNodeIndex][1] - centroid[1], keyPoints[nextKeyNodeIndex][0] - centroid[0]);
30304         totalAngle = endAngle - startAngle;
30305         if (totalAngle * sign2 > 0) {
30306           totalAngle = -sign2 * (2 * Math.PI - Math.abs(totalAngle));
30307         }
30308         do {
30309           numberNewPoints++;
30310           eachAngle = totalAngle / (indexRange + numberNewPoints);
30311         } while (Math.abs(eachAngle) > maxAngle);
30312         for (j2 = 1; j2 < indexRange; j2++) {
30313           angle2 = startAngle + j2 * eachAngle;
30314           loc = projection2.invert([
30315             centroid[0] + Math.cos(angle2) * radius,
30316             centroid[1] + Math.sin(angle2) * radius
30317           ]);
30318           node = nodes[(j2 + startNodeIndex) % nodes.length];
30319           origNode = origNodes[node.id];
30320           nearNodes[node.id] = angle2;
30321           node = node.move(geoVecInterp(origNode.loc, loc, t2));
30322           graph = graph.replace(node);
30323         }
30324         for (j2 = 0; j2 < numberNewPoints; j2++) {
30325           angle2 = startAngle + (indexRange + j2) * eachAngle;
30326           loc = projection2.invert([
30327             centroid[0] + Math.cos(angle2) * radius,
30328             centroid[1] + Math.sin(angle2) * radius
30329           ]);
30330           var min3 = Infinity;
30331           for (var nodeId in nearNodes) {
30332             var nearAngle = nearNodes[nodeId];
30333             var dist = Math.abs(nearAngle - angle2);
30334             if (dist < min3) {
30335               min3 = dist;
30336               origNode = origNodes[nodeId];
30337             }
30338           }
30339           node = osmNode({ loc: geoVecInterp(origNode.loc, loc, t2) });
30340           graph = graph.replace(node);
30341           nodes.splice(endNodeIndex + j2, 0, node);
30342           inBetweenNodes.push(node.id);
30343         }
30344         if (indexRange === 1 && inBetweenNodes.length) {
30345           var startIndex1 = way.nodes.lastIndexOf(startNode.id);
30346           var endIndex1 = way.nodes.lastIndexOf(endNode.id);
30347           var wayDirection1 = endIndex1 - startIndex1;
30348           if (wayDirection1 < -1) {
30349             wayDirection1 = 1;
30350           }
30351           var parentWays = graph.parentWays(keyNodes[i3]);
30352           for (j2 = 0; j2 < parentWays.length; j2++) {
30353             var sharedWay = parentWays[j2];
30354             if (sharedWay === way) continue;
30355             if (sharedWay.areAdjacent(startNode.id, endNode.id)) {
30356               var startIndex2 = sharedWay.nodes.lastIndexOf(startNode.id);
30357               var endIndex2 = sharedWay.nodes.lastIndexOf(endNode.id);
30358               var wayDirection2 = endIndex2 - startIndex2;
30359               var insertAt = endIndex2;
30360               if (wayDirection2 < -1) {
30361                 wayDirection2 = 1;
30362               }
30363               if (wayDirection1 !== wayDirection2) {
30364                 inBetweenNodes.reverse();
30365                 insertAt = startIndex2;
30366               }
30367               for (k2 = 0; k2 < inBetweenNodes.length; k2++) {
30368                 sharedWay = sharedWay.addNode(inBetweenNodes[k2], insertAt + k2);
30369               }
30370               graph = graph.replace(sharedWay);
30371             }
30372           }
30373         }
30374       }
30375       ids = nodes.map(function(n3) {
30376         return n3.id;
30377       });
30378       ids.push(ids[0]);
30379       way = way.update({ nodes: ids });
30380       graph = graph.replace(way);
30381       return graph;
30382     };
30383     action.makeConvex = function(graph) {
30384       var way = graph.entity(wayId);
30385       var nodes = utilArrayUniq(graph.childNodes(way));
30386       var points = nodes.map(function(n3) {
30387         return projection2(n3.loc);
30388       });
30389       var sign2 = area_default3(points) > 0 ? 1 : -1;
30390       var hull = hull_default(points);
30391       var i3, j2;
30392       if (sign2 === -1) {
30393         nodes.reverse();
30394         points.reverse();
30395       }
30396       for (i3 = 0; i3 < hull.length - 1; i3++) {
30397         var startIndex = points.indexOf(hull[i3]);
30398         var endIndex = points.indexOf(hull[i3 + 1]);
30399         var indexRange = endIndex - startIndex;
30400         if (indexRange < 0) {
30401           indexRange += nodes.length;
30402         }
30403         for (j2 = 1; j2 < indexRange; j2++) {
30404           var point = geoVecInterp(hull[i3], hull[i3 + 1], j2 / indexRange);
30405           var node = nodes[(j2 + startIndex) % nodes.length].move(projection2.invert(point));
30406           graph = graph.replace(node);
30407         }
30408       }
30409       return graph;
30410     };
30411     action.disabled = function(graph) {
30412       if (!graph.entity(wayId).isClosed()) {
30413         return "not_closed";
30414       }
30415       var way = graph.entity(wayId);
30416       var nodes = utilArrayUniq(graph.childNodes(way));
30417       var points = nodes.map(function(n3) {
30418         return projection2(n3.loc);
30419       });
30420       var hull = hull_default(points);
30421       var epsilonAngle = Math.PI / 180;
30422       if (hull.length !== points.length || hull.length < 3) {
30423         return false;
30424       }
30425       var centroid = centroid_default2(points);
30426       var radius = geoVecLengthSquare(centroid, points[0]);
30427       var i3, actualPoint;
30428       for (i3 = 0; i3 < hull.length; i3++) {
30429         actualPoint = hull[i3];
30430         var actualDist = geoVecLengthSquare(actualPoint, centroid);
30431         var diff = Math.abs(actualDist - radius);
30432         if (diff > 0.05 * radius) {
30433           return false;
30434         }
30435       }
30436       for (i3 = 0; i3 < hull.length; i3++) {
30437         actualPoint = hull[i3];
30438         var nextPoint = hull[(i3 + 1) % hull.length];
30439         var startAngle = Math.atan2(actualPoint[1] - centroid[1], actualPoint[0] - centroid[0]);
30440         var endAngle = Math.atan2(nextPoint[1] - centroid[1], nextPoint[0] - centroid[0]);
30441         var angle2 = endAngle - startAngle;
30442         if (angle2 < 0) {
30443           angle2 = -angle2;
30444         }
30445         if (angle2 > Math.PI) {
30446           angle2 = 2 * Math.PI - angle2;
30447         }
30448         if (angle2 > maxAngle + epsilonAngle) {
30449           return false;
30450         }
30451       }
30452       return "already_circular";
30453     };
30454     action.transitionable = true;
30455     return action;
30456   }
30457
30458   // modules/actions/delete_way.js
30459   function actionDeleteWay(wayID) {
30460     function canDeleteNode(node, graph) {
30461       if (graph.parentWays(node).length || graph.parentRelations(node).length) return false;
30462       var geometries = osmNodeGeometriesForTags(node.tags);
30463       if (geometries.point) return false;
30464       if (geometries.vertex) return true;
30465       return !node.hasInterestingTags();
30466     }
30467     var action = function(graph) {
30468       var way = graph.entity(wayID);
30469       graph.parentRelations(way).forEach(function(parent) {
30470         parent = parent.removeMembersWithID(wayID);
30471         graph = graph.replace(parent);
30472         if (parent.isDegenerate()) {
30473           graph = actionDeleteRelation(parent.id)(graph);
30474         }
30475       });
30476       new Set(way.nodes).forEach(function(nodeID) {
30477         graph = graph.replace(way.removeNode(nodeID));
30478         var node = graph.entity(nodeID);
30479         if (canDeleteNode(node, graph)) {
30480           graph = graph.remove(node);
30481         }
30482       });
30483       return graph.remove(way);
30484     };
30485     return action;
30486   }
30487
30488   // modules/actions/delete_multiple.js
30489   function actionDeleteMultiple(ids) {
30490     var actions = {
30491       way: actionDeleteWay,
30492       node: actionDeleteNode,
30493       relation: actionDeleteRelation
30494     };
30495     var action = function(graph) {
30496       ids.forEach(function(id2) {
30497         if (graph.hasEntity(id2)) {
30498           graph = actions[graph.entity(id2).type](id2)(graph);
30499         }
30500       });
30501       return graph;
30502     };
30503     return action;
30504   }
30505
30506   // modules/actions/delete_relation.js
30507   function actionDeleteRelation(relationID, allowUntaggedMembers) {
30508     function canDeleteEntity(entity, graph) {
30509       return !graph.parentWays(entity).length && !graph.parentRelations(entity).length && (!entity.hasInterestingTags() && !allowUntaggedMembers);
30510     }
30511     var action = function(graph) {
30512       var relation = graph.entity(relationID);
30513       graph.parentRelations(relation).forEach(function(parent) {
30514         parent = parent.removeMembersWithID(relationID);
30515         graph = graph.replace(parent);
30516         if (parent.isDegenerate()) {
30517           graph = actionDeleteRelation(parent.id)(graph);
30518         }
30519       });
30520       var memberIDs = utilArrayUniq(relation.members.map(function(m2) {
30521         return m2.id;
30522       }));
30523       memberIDs.forEach(function(memberID) {
30524         graph = graph.replace(relation.removeMembersWithID(memberID));
30525         var entity = graph.entity(memberID);
30526         if (canDeleteEntity(entity, graph)) {
30527           graph = actionDeleteMultiple([memberID])(graph);
30528         }
30529       });
30530       return graph.remove(relation);
30531     };
30532     return action;
30533   }
30534
30535   // modules/actions/delete_node.js
30536   function actionDeleteNode(nodeId) {
30537     var action = function(graph) {
30538       var node = graph.entity(nodeId);
30539       graph.parentWays(node).forEach(function(parent) {
30540         parent = parent.removeNode(nodeId);
30541         graph = graph.replace(parent);
30542         if (parent.isDegenerate()) {
30543           graph = actionDeleteWay(parent.id)(graph);
30544         }
30545       });
30546       graph.parentRelations(node).forEach(function(parent) {
30547         parent = parent.removeMembersWithID(nodeId);
30548         graph = graph.replace(parent);
30549         if (parent.isDegenerate()) {
30550           graph = actionDeleteRelation(parent.id)(graph);
30551         }
30552       });
30553       return graph.remove(node);
30554     };
30555     return action;
30556   }
30557
30558   // modules/actions/connect.js
30559   function actionConnect(nodeIDs) {
30560     var action = function(graph) {
30561       var survivor;
30562       var node;
30563       var parents;
30564       var i3, j2;
30565       nodeIDs.reverse();
30566       var interestingIDs = [];
30567       for (i3 = 0; i3 < nodeIDs.length; i3++) {
30568         node = graph.entity(nodeIDs[i3]);
30569         if (node.hasInterestingTags()) {
30570           if (!node.isNew()) {
30571             interestingIDs.push(node.id);
30572           }
30573         }
30574       }
30575       survivor = graph.entity(utilOldestID(interestingIDs.length > 0 ? interestingIDs : nodeIDs));
30576       for (i3 = 0; i3 < nodeIDs.length; i3++) {
30577         node = graph.entity(nodeIDs[i3]);
30578         if (node.id === survivor.id) continue;
30579         parents = graph.parentWays(node);
30580         for (j2 = 0; j2 < parents.length; j2++) {
30581           graph = graph.replace(parents[j2].replaceNode(node.id, survivor.id));
30582         }
30583         parents = graph.parentRelations(node);
30584         for (j2 = 0; j2 < parents.length; j2++) {
30585           graph = graph.replace(parents[j2].replaceMember(node, survivor));
30586         }
30587         survivor = survivor.mergeTags(node.tags);
30588         graph = actionDeleteNode(node.id)(graph);
30589       }
30590       graph = graph.replace(survivor);
30591       parents = graph.parentWays(survivor);
30592       for (i3 = 0; i3 < parents.length; i3++) {
30593         if (parents[i3].isDegenerate()) {
30594           graph = actionDeleteWay(parents[i3].id)(graph);
30595         }
30596       }
30597       return graph;
30598     };
30599     action.disabled = function(graph) {
30600       var seen = {};
30601       var restrictionIDs = [];
30602       var survivor;
30603       var node, way;
30604       var relations, relation, role;
30605       var i3, j2, k2;
30606       survivor = graph.entity(utilOldestID(nodeIDs));
30607       for (i3 = 0; i3 < nodeIDs.length; i3++) {
30608         node = graph.entity(nodeIDs[i3]);
30609         relations = graph.parentRelations(node);
30610         for (j2 = 0; j2 < relations.length; j2++) {
30611           relation = relations[j2];
30612           role = relation.memberById(node.id).role || "";
30613           if (relation.hasFromViaTo()) {
30614             restrictionIDs.push(relation.id);
30615           }
30616           if (seen[relation.id] !== void 0 && seen[relation.id] !== role) {
30617             return "relation";
30618           } else {
30619             seen[relation.id] = role;
30620           }
30621         }
30622       }
30623       for (i3 = 0; i3 < nodeIDs.length; i3++) {
30624         node = graph.entity(nodeIDs[i3]);
30625         var parents = graph.parentWays(node);
30626         for (j2 = 0; j2 < parents.length; j2++) {
30627           var parent = parents[j2];
30628           relations = graph.parentRelations(parent);
30629           for (k2 = 0; k2 < relations.length; k2++) {
30630             relation = relations[k2];
30631             if (relation.hasFromViaTo()) {
30632               restrictionIDs.push(relation.id);
30633             }
30634           }
30635         }
30636       }
30637       restrictionIDs = utilArrayUniq(restrictionIDs);
30638       for (i3 = 0; i3 < restrictionIDs.length; i3++) {
30639         relation = graph.entity(restrictionIDs[i3]);
30640         if (!relation.isComplete(graph)) continue;
30641         var memberWays = relation.members.filter(function(m2) {
30642           return m2.type === "way";
30643         }).map(function(m2) {
30644           return graph.entity(m2.id);
30645         });
30646         memberWays = utilArrayUniq(memberWays);
30647         var f2 = relation.memberByRole("from");
30648         var t2 = relation.memberByRole("to");
30649         var isUturn = f2.id === t2.id;
30650         var nodes = { from: [], via: [], to: [], keyfrom: [], keyto: [] };
30651         for (j2 = 0; j2 < relation.members.length; j2++) {
30652           collectNodes(relation.members[j2], nodes);
30653         }
30654         nodes.keyfrom = utilArrayUniq(nodes.keyfrom.filter(hasDuplicates));
30655         nodes.keyto = utilArrayUniq(nodes.keyto.filter(hasDuplicates));
30656         var filter2 = keyNodeFilter(nodes.keyfrom, nodes.keyto);
30657         nodes.from = nodes.from.filter(filter2);
30658         nodes.via = nodes.via.filter(filter2);
30659         nodes.to = nodes.to.filter(filter2);
30660         var connectFrom = false;
30661         var connectVia = false;
30662         var connectTo = false;
30663         var connectKeyFrom = false;
30664         var connectKeyTo = false;
30665         for (j2 = 0; j2 < nodeIDs.length; j2++) {
30666           var n3 = nodeIDs[j2];
30667           if (nodes.from.indexOf(n3) !== -1) {
30668             connectFrom = true;
30669           }
30670           if (nodes.via.indexOf(n3) !== -1) {
30671             connectVia = true;
30672           }
30673           if (nodes.to.indexOf(n3) !== -1) {
30674             connectTo = true;
30675           }
30676           if (nodes.keyfrom.indexOf(n3) !== -1) {
30677             connectKeyFrom = true;
30678           }
30679           if (nodes.keyto.indexOf(n3) !== -1) {
30680             connectKeyTo = true;
30681           }
30682         }
30683         if (connectFrom && connectTo && !isUturn) {
30684           return "restriction";
30685         }
30686         if (connectFrom && connectVia) {
30687           return "restriction";
30688         }
30689         if (connectTo && connectVia) {
30690           return "restriction";
30691         }
30692         if (connectKeyFrom || connectKeyTo) {
30693           if (nodeIDs.length !== 2) {
30694             return "restriction";
30695           }
30696           var n0 = null;
30697           var n1 = null;
30698           for (j2 = 0; j2 < memberWays.length; j2++) {
30699             way = memberWays[j2];
30700             if (way.contains(nodeIDs[0])) {
30701               n0 = nodeIDs[0];
30702             }
30703             if (way.contains(nodeIDs[1])) {
30704               n1 = nodeIDs[1];
30705             }
30706           }
30707           if (n0 && n1) {
30708             var ok = false;
30709             for (j2 = 0; j2 < memberWays.length; j2++) {
30710               way = memberWays[j2];
30711               if (way.areAdjacent(n0, n1)) {
30712                 ok = true;
30713                 break;
30714               }
30715             }
30716             if (!ok) {
30717               return "restriction";
30718             }
30719           }
30720         }
30721         for (j2 = 0; j2 < memberWays.length; j2++) {
30722           way = memberWays[j2].update({});
30723           for (k2 = 0; k2 < nodeIDs.length; k2++) {
30724             if (nodeIDs[k2] === survivor.id) continue;
30725             if (way.areAdjacent(nodeIDs[k2], survivor.id)) {
30726               way = way.removeNode(nodeIDs[k2]);
30727             } else {
30728               way = way.replaceNode(nodeIDs[k2], survivor.id);
30729             }
30730           }
30731           if (way.isDegenerate()) {
30732             return "restriction";
30733           }
30734         }
30735       }
30736       return false;
30737       function hasDuplicates(n4, i4, arr) {
30738         return arr.indexOf(n4) !== arr.lastIndexOf(n4);
30739       }
30740       function keyNodeFilter(froms, tos) {
30741         return function(n4) {
30742           return froms.indexOf(n4) === -1 && tos.indexOf(n4) === -1;
30743         };
30744       }
30745       function collectNodes(member, collection) {
30746         var entity = graph.hasEntity(member.id);
30747         if (!entity) return;
30748         var role2 = member.role || "";
30749         if (!collection[role2]) {
30750           collection[role2] = [];
30751         }
30752         if (member.type === "node") {
30753           collection[role2].push(member.id);
30754           if (role2 === "via") {
30755             collection.keyfrom.push(member.id);
30756             collection.keyto.push(member.id);
30757           }
30758         } else if (member.type === "way") {
30759           collection[role2].push.apply(collection[role2], entity.nodes);
30760           if (role2 === "from" || role2 === "via") {
30761             collection.keyfrom.push(entity.first());
30762             collection.keyfrom.push(entity.last());
30763           }
30764           if (role2 === "to" || role2 === "via") {
30765             collection.keyto.push(entity.first());
30766             collection.keyto.push(entity.last());
30767           }
30768         }
30769       }
30770     };
30771     return action;
30772   }
30773
30774   // modules/actions/copy_entities.js
30775   function actionCopyEntities(ids, fromGraph) {
30776     var _copies = {};
30777     var action = function(graph) {
30778       ids.forEach(function(id3) {
30779         fromGraph.entity(id3).copy(fromGraph, _copies);
30780       });
30781       for (var id2 in _copies) {
30782         graph = graph.replace(_copies[id2]);
30783       }
30784       return graph;
30785     };
30786     action.copies = function() {
30787       return _copies;
30788     };
30789     return action;
30790   }
30791
30792   // modules/actions/delete_member.js
30793   function actionDeleteMember(relationId, memberIndex) {
30794     return function(graph) {
30795       var relation = graph.entity(relationId).removeMember(memberIndex);
30796       graph = graph.replace(relation);
30797       if (relation.isDegenerate()) {
30798         graph = actionDeleteRelation(relation.id)(graph);
30799       }
30800       return graph;
30801     };
30802   }
30803
30804   // modules/actions/discard_tags.js
30805   function actionDiscardTags(difference2, discardTags) {
30806     discardTags = discardTags || {};
30807     return (graph) => {
30808       difference2.modified().forEach(checkTags);
30809       difference2.created().forEach(checkTags);
30810       return graph;
30811       function checkTags(entity) {
30812         const keys2 = Object.keys(entity.tags);
30813         let didDiscard = false;
30814         let tags = {};
30815         for (let i3 = 0; i3 < keys2.length; i3++) {
30816           const k2 = keys2[i3];
30817           if (discardTags[k2] || !entity.tags[k2]) {
30818             didDiscard = true;
30819           } else {
30820             tags[k2] = entity.tags[k2];
30821           }
30822         }
30823         if (didDiscard) {
30824           graph = graph.replace(entity.update({ tags }));
30825         }
30826       }
30827     };
30828   }
30829
30830   // modules/actions/disconnect.js
30831   function actionDisconnect(nodeId, newNodeId) {
30832     var wayIds;
30833     var disconnectableRelationTypes = {
30834       "associatedStreet": true,
30835       "enforcement": true,
30836       "site": true
30837     };
30838     var action = function(graph) {
30839       var node = graph.entity(nodeId);
30840       var connections = action.connections(graph);
30841       connections.forEach(function(connection) {
30842         var way = graph.entity(connection.wayID);
30843         var newNode = osmNode({ id: newNodeId, loc: node.loc, tags: node.tags });
30844         graph = graph.replace(newNode);
30845         if (connection.index === 0 && way.isArea()) {
30846           graph = graph.replace(way.replaceNode(way.nodes[0], newNode.id));
30847         } else if (way.isClosed() && connection.index === way.nodes.length - 1) {
30848           graph = graph.replace(way.unclose().addNode(newNode.id));
30849         } else {
30850           graph = graph.replace(way.updateNode(newNode.id, connection.index));
30851         }
30852       });
30853       return graph;
30854     };
30855     action.connections = function(graph) {
30856       var candidates = [];
30857       var keeping = false;
30858       var parentWays = graph.parentWays(graph.entity(nodeId));
30859       var way, waynode;
30860       for (var i3 = 0; i3 < parentWays.length; i3++) {
30861         way = parentWays[i3];
30862         if (wayIds && wayIds.indexOf(way.id) === -1) {
30863           keeping = true;
30864           continue;
30865         }
30866         if (way.isArea() && way.nodes[0] === nodeId) {
30867           candidates.push({ wayID: way.id, index: 0 });
30868         } else {
30869           for (var j2 = 0; j2 < way.nodes.length; j2++) {
30870             waynode = way.nodes[j2];
30871             if (waynode === nodeId) {
30872               if (way.isClosed() && parentWays.length > 1 && wayIds && wayIds.indexOf(way.id) !== -1 && j2 === way.nodes.length - 1) {
30873                 continue;
30874               }
30875               candidates.push({ wayID: way.id, index: j2 });
30876             }
30877           }
30878         }
30879       }
30880       return keeping ? candidates : candidates.slice(1);
30881     };
30882     action.disabled = function(graph) {
30883       var connections = action.connections(graph);
30884       if (connections.length === 0) return "not_connected";
30885       var parentWays = graph.parentWays(graph.entity(nodeId));
30886       var seenRelationIds = {};
30887       var sharedRelation;
30888       parentWays.forEach(function(way) {
30889         var relations = graph.parentRelations(way);
30890         relations.filter((relation) => !disconnectableRelationTypes[relation.tags.type]).forEach(function(relation) {
30891           if (relation.id in seenRelationIds) {
30892             if (wayIds) {
30893               if (wayIds.indexOf(way.id) !== -1 || wayIds.indexOf(seenRelationIds[relation.id]) !== -1) {
30894                 sharedRelation = relation;
30895               }
30896             } else {
30897               sharedRelation = relation;
30898             }
30899           } else {
30900             seenRelationIds[relation.id] = way.id;
30901           }
30902         });
30903       });
30904       if (sharedRelation) return "relation";
30905     };
30906     action.limitWays = function(val) {
30907       if (!arguments.length) return wayIds;
30908       wayIds = val;
30909       return action;
30910     };
30911     return action;
30912   }
30913
30914   // modules/actions/extract.js
30915   function actionExtract(entityID, projection2) {
30916     var extractedNodeID;
30917     var action = function(graph) {
30918       var entity = graph.entity(entityID);
30919       if (entity.type === "node") {
30920         return extractFromNode(entity, graph);
30921       }
30922       return extractFromWayOrRelation(entity, graph);
30923     };
30924     function extractFromNode(node, graph) {
30925       extractedNodeID = node.id;
30926       var replacement = osmNode({ loc: node.loc });
30927       graph = graph.replace(replacement);
30928       graph = graph.parentWays(node).reduce(function(accGraph, parentWay) {
30929         return accGraph.replace(parentWay.replaceNode(entityID, replacement.id));
30930       }, graph);
30931       return graph.parentRelations(node).reduce(function(accGraph, parentRel) {
30932         return accGraph.replace(parentRel.replaceMember(node, replacement));
30933       }, graph);
30934     }
30935     function extractFromWayOrRelation(entity, graph) {
30936       var fromGeometry = entity.geometry(graph);
30937       var keysToCopyAndRetain = ["source", "wheelchair"];
30938       var keysToRetain = ["area"];
30939       var buildingKeysToRetain = ["architect", "building", "height", "layer", "nycdoitt:bin"];
30940       var extractedLoc = path_default(projection2).centroid(entity.asGeoJSON(graph));
30941       extractedLoc = extractedLoc && projection2.invert(extractedLoc);
30942       if (!extractedLoc || !isFinite(extractedLoc[0]) || !isFinite(extractedLoc[1])) {
30943         extractedLoc = entity.extent(graph).center();
30944       }
30945       var indoorAreaValues = {
30946         area: true,
30947         corridor: true,
30948         elevator: true,
30949         level: true,
30950         room: true
30951       };
30952       var isBuilding = entity.tags.building && entity.tags.building !== "no" || entity.tags["building:part"] && entity.tags["building:part"] !== "no";
30953       var isIndoorArea = fromGeometry === "area" && entity.tags.indoor && indoorAreaValues[entity.tags.indoor];
30954       var entityTags = Object.assign({}, entity.tags);
30955       var pointTags = {};
30956       for (var key in entityTags) {
30957         if (entity.type === "relation" && key === "type") {
30958           continue;
30959         }
30960         if (keysToRetain.indexOf(key) !== -1) {
30961           continue;
30962         }
30963         if (isBuilding) {
30964           if (buildingKeysToRetain.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/)) continue;
30965         }
30966         if (isIndoorArea && key === "indoor") {
30967           continue;
30968         }
30969         pointTags[key] = entityTags[key];
30970         if (keysToCopyAndRetain.indexOf(key) !== -1 || key.match(/^addr:.{1,}/)) {
30971           continue;
30972         } else if (isIndoorArea && key === "level") {
30973           continue;
30974         }
30975         delete entityTags[key];
30976       }
30977       if (!isBuilding && !isIndoorArea && fromGeometry === "area") {
30978         entityTags.area = "yes";
30979       }
30980       var replacement = osmNode({ loc: extractedLoc, tags: pointTags });
30981       graph = graph.replace(replacement);
30982       extractedNodeID = replacement.id;
30983       return graph.replace(entity.update({ tags: entityTags }));
30984     }
30985     action.getExtractedNodeID = function() {
30986       return extractedNodeID;
30987     };
30988     return action;
30989   }
30990
30991   // modules/actions/join.js
30992   function actionJoin(ids) {
30993     function groupEntitiesByGeometry(graph) {
30994       var entities = ids.map(function(id2) {
30995         return graph.entity(id2);
30996       });
30997       return Object.assign(
30998         { line: [] },
30999         utilArrayGroupBy(entities, function(entity) {
31000           return entity.geometry(graph);
31001         })
31002       );
31003     }
31004     var action = function(graph) {
31005       var ways = ids.map(graph.entity, graph);
31006       var survivorID = utilOldestID(ways.map((way) => way.id));
31007       ways.sort(function(a2, b2) {
31008         var aSided = a2.isSided();
31009         var bSided = b2.isSided();
31010         return aSided && !bSided ? -1 : bSided && !aSided ? 1 : 0;
31011       });
31012       var sequences = osmJoinWays(ways, graph);
31013       var joined = sequences[0];
31014       graph = sequences.actions.reduce(function(g3, action2) {
31015         return action2(g3);
31016       }, graph);
31017       var survivor = graph.entity(survivorID);
31018       survivor = survivor.update({ nodes: joined.nodes.map(function(n3) {
31019         return n3.id;
31020       }) });
31021       graph = graph.replace(survivor);
31022       joined.forEach(function(way) {
31023         if (way.id === survivorID) return;
31024         graph.parentRelations(way).forEach(function(parent) {
31025           graph = graph.replace(parent.replaceMember(way, survivor));
31026         });
31027         survivor = survivor.mergeTags(way.tags);
31028         graph = graph.replace(survivor);
31029         graph = actionDeleteWay(way.id)(graph);
31030       });
31031       function checkForSimpleMultipolygon() {
31032         if (!survivor.isClosed()) return;
31033         var multipolygons = graph.parentMultipolygons(survivor).filter(function(multipolygon2) {
31034           return multipolygon2.members.length === 1;
31035         });
31036         if (multipolygons.length !== 1) return;
31037         var multipolygon = multipolygons[0];
31038         for (var key in survivor.tags) {
31039           if (multipolygon.tags[key] && // don't collapse if tags cannot be cleanly merged
31040           multipolygon.tags[key] !== survivor.tags[key]) return;
31041         }
31042         survivor = survivor.mergeTags(multipolygon.tags);
31043         graph = graph.replace(survivor);
31044         graph = actionDeleteRelation(
31045           multipolygon.id,
31046           true
31047           /* allow untagged members */
31048         )(graph);
31049         var tags = Object.assign({}, survivor.tags);
31050         if (survivor.geometry(graph) !== "area") {
31051           tags.area = "yes";
31052         }
31053         delete tags.type;
31054         survivor = survivor.update({ tags });
31055         graph = graph.replace(survivor);
31056       }
31057       checkForSimpleMultipolygon();
31058       return graph;
31059     };
31060     action.resultingWayNodesLength = function(graph) {
31061       return ids.reduce(function(count, id2) {
31062         return count + graph.entity(id2).nodes.length;
31063       }, 0) - ids.length - 1;
31064     };
31065     action.disabled = function(graph) {
31066       var geometries = groupEntitiesByGeometry(graph);
31067       if (ids.length < 2 || ids.length !== geometries.line.length) {
31068         return "not_eligible";
31069       }
31070       var joined = osmJoinWays(ids.map(graph.entity, graph), graph);
31071       if (joined.length > 1) {
31072         return "not_adjacent";
31073       }
31074       var i3;
31075       var sortedParentRelations = function(id2) {
31076         return graph.parentRelations(graph.entity(id2)).filter((rel) => !rel.isRestriction() && !rel.isConnectivity()).sort((a2, b2) => a2.id - b2.id);
31077       };
31078       var relsA = sortedParentRelations(ids[0]);
31079       for (i3 = 1; i3 < ids.length; i3++) {
31080         var relsB = sortedParentRelations(ids[i3]);
31081         if (!utilArrayIdentical(relsA, relsB)) {
31082           return "conflicting_relations";
31083         }
31084       }
31085       for (i3 = 0; i3 < ids.length - 1; i3++) {
31086         for (var j2 = i3 + 1; j2 < ids.length; j2++) {
31087           var path1 = graph.childNodes(graph.entity(ids[i3])).map(function(e3) {
31088             return e3.loc;
31089           });
31090           var path2 = graph.childNodes(graph.entity(ids[j2])).map(function(e3) {
31091             return e3.loc;
31092           });
31093           var intersections = geoPathIntersections(path1, path2);
31094           var common = utilArrayIntersection(
31095             joined[0].nodes.map(function(n3) {
31096               return n3.loc.toString();
31097             }),
31098             intersections.map(function(n3) {
31099               return n3.toString();
31100             })
31101           );
31102           if (common.length !== intersections.length) {
31103             return "paths_intersect";
31104           }
31105         }
31106       }
31107       var nodeIds = joined[0].nodes.map(function(n3) {
31108         return n3.id;
31109       }).slice(1, -1);
31110       var relation;
31111       var tags = {};
31112       var conflicting = false;
31113       joined[0].forEach(function(way) {
31114         var parents = graph.parentRelations(way);
31115         parents.forEach(function(parent) {
31116           if ((parent.isRestriction() || parent.isConnectivity()) && parent.members.some(function(m2) {
31117             return nodeIds.indexOf(m2.id) >= 0;
31118           })) {
31119             relation = parent;
31120           }
31121         });
31122         for (var k2 in way.tags) {
31123           if (!(k2 in tags)) {
31124             tags[k2] = way.tags[k2];
31125           } else if (tags[k2] && osmIsInterestingTag(k2) && tags[k2] !== way.tags[k2]) {
31126             conflicting = true;
31127           }
31128         }
31129       });
31130       if (relation) {
31131         return relation.isRestriction() ? "restriction" : "connectivity";
31132       }
31133       if (conflicting) {
31134         return "conflicting_tags";
31135       }
31136     };
31137     return action;
31138   }
31139
31140   // modules/actions/merge.js
31141   function actionMerge(ids) {
31142     function groupEntitiesByGeometry(graph) {
31143       var entities = ids.map(function(id2) {
31144         return graph.entity(id2);
31145       });
31146       return Object.assign(
31147         { point: [], area: [], line: [], relation: [] },
31148         utilArrayGroupBy(entities, function(entity) {
31149           return entity.geometry(graph);
31150         })
31151       );
31152     }
31153     var action = function(graph) {
31154       var geometries = groupEntitiesByGeometry(graph);
31155       var target = geometries.area[0] || geometries.line[0];
31156       var points = geometries.point;
31157       points.forEach(function(point) {
31158         target = target.mergeTags(point.tags);
31159         graph = graph.replace(target);
31160         graph.parentRelations(point).forEach(function(parent) {
31161           graph = graph.replace(parent.replaceMember(point, target));
31162         });
31163         var nodes = utilArrayUniq(graph.childNodes(target));
31164         var removeNode = point;
31165         if (!point.isNew()) {
31166           var inserted = false;
31167           var canBeReplaced = function(node2) {
31168             return !(graph.parentWays(node2).length > 1 || graph.parentRelations(node2).length);
31169           };
31170           var replaceNode = function(node2) {
31171             graph = graph.replace(point.update({ tags: node2.tags, loc: node2.loc }));
31172             target = target.replaceNode(node2.id, point.id);
31173             graph = graph.replace(target);
31174             removeNode = node2;
31175             inserted = true;
31176           };
31177           var i3;
31178           var node;
31179           for (i3 = 0; i3 < nodes.length; i3++) {
31180             node = nodes[i3];
31181             if (canBeReplaced(node) && node.isNew()) {
31182               replaceNode(node);
31183               break;
31184             }
31185           }
31186           if (!inserted && point.hasInterestingTags()) {
31187             for (i3 = 0; i3 < nodes.length; i3++) {
31188               node = nodes[i3];
31189               if (canBeReplaced(node) && !node.hasInterestingTags()) {
31190                 replaceNode(node);
31191                 break;
31192               }
31193             }
31194             if (!inserted) {
31195               for (i3 = 0; i3 < nodes.length; i3++) {
31196                 node = nodes[i3];
31197                 if (canBeReplaced(node) && utilCompareIDs(point.id, node.id) < 0) {
31198                   replaceNode(node);
31199                   break;
31200                 }
31201               }
31202             }
31203           }
31204         }
31205         graph = graph.remove(removeNode);
31206       });
31207       if (target.tags.area === "yes") {
31208         var tags = Object.assign({}, target.tags);
31209         delete tags.area;
31210         if (osmTagSuggestingArea(tags)) {
31211           target = target.update({ tags });
31212           graph = graph.replace(target);
31213         }
31214       }
31215       return graph;
31216     };
31217     action.disabled = function(graph) {
31218       var geometries = groupEntitiesByGeometry(graph);
31219       if (geometries.point.length === 0 || geometries.area.length + geometries.line.length !== 1 || geometries.relation.length !== 0) {
31220         return "not_eligible";
31221       }
31222     };
31223     return action;
31224   }
31225
31226   // modules/actions/merge_nodes.js
31227   function actionMergeNodes(nodeIDs, loc) {
31228     function chooseLoc(graph) {
31229       if (!nodeIDs.length) return null;
31230       var sum = [0, 0];
31231       var interestingCount = 0;
31232       var interestingLoc;
31233       for (var i3 = 0; i3 < nodeIDs.length; i3++) {
31234         var node = graph.entity(nodeIDs[i3]);
31235         if (node.hasInterestingTags()) {
31236           interestingLoc = ++interestingCount === 1 ? node.loc : null;
31237         }
31238         sum = geoVecAdd(sum, node.loc);
31239       }
31240       return interestingLoc || geoVecScale(sum, 1 / nodeIDs.length);
31241     }
31242     var action = function(graph) {
31243       if (nodeIDs.length < 2) return graph;
31244       var toLoc = loc;
31245       if (!toLoc) {
31246         toLoc = chooseLoc(graph);
31247       }
31248       for (var i3 = 0; i3 < nodeIDs.length; i3++) {
31249         var node = graph.entity(nodeIDs[i3]);
31250         if (node.loc !== toLoc) {
31251           graph = graph.replace(node.move(toLoc));
31252         }
31253       }
31254       return actionConnect(nodeIDs)(graph);
31255     };
31256     action.disabled = function(graph) {
31257       if (nodeIDs.length < 2) return "not_eligible";
31258       for (var i3 = 0; i3 < nodeIDs.length; i3++) {
31259         var entity = graph.entity(nodeIDs[i3]);
31260         if (entity.type !== "node") return "not_eligible";
31261       }
31262       return actionConnect(nodeIDs).disabled(graph);
31263     };
31264     return action;
31265   }
31266
31267   // modules/osm/changeset.js
31268   function osmChangeset() {
31269     if (!(this instanceof osmChangeset)) {
31270       return new osmChangeset().initialize(arguments);
31271     } else if (arguments.length) {
31272       this.initialize(arguments);
31273     }
31274   }
31275   osmEntity.changeset = osmChangeset;
31276   osmChangeset.prototype = Object.create(osmEntity.prototype);
31277   Object.assign(osmChangeset.prototype, {
31278     type: "changeset",
31279     extent: function() {
31280       return new geoExtent();
31281     },
31282     geometry: function() {
31283       return "changeset";
31284     },
31285     asJXON: function() {
31286       return {
31287         osm: {
31288           changeset: {
31289             tag: Object.keys(this.tags).map(function(k2) {
31290               return { "@k": k2, "@v": this.tags[k2] };
31291             }, this),
31292             "@version": 0.6,
31293             "@generator": "iD"
31294           }
31295         }
31296       };
31297     },
31298     // Generate [osmChange](http://wiki.openstreetmap.org/wiki/OsmChange)
31299     // XML. Returns a string.
31300     osmChangeJXON: function(changes) {
31301       var changeset_id = this.id;
31302       function nest(x2, order) {
31303         var groups = {};
31304         for (var i3 = 0; i3 < x2.length; i3++) {
31305           var tagName = Object.keys(x2[i3])[0];
31306           if (!groups[tagName]) groups[tagName] = [];
31307           groups[tagName].push(x2[i3][tagName]);
31308         }
31309         var ordered = {};
31310         order.forEach(function(o2) {
31311           if (groups[o2]) ordered[o2] = groups[o2];
31312         });
31313         return ordered;
31314       }
31315       function sort(changes2) {
31316         function resolve(item) {
31317           return relations.find(function(relation2) {
31318             return item.keyAttributes.type === "relation" && item.keyAttributes.ref === relation2["@id"];
31319           });
31320         }
31321         function isNew(item) {
31322           return !sorted[item["@id"]] && !processing.find(function(proc) {
31323             return proc["@id"] === item["@id"];
31324           });
31325         }
31326         var processing = [];
31327         var sorted = {};
31328         var relations = changes2.relation;
31329         if (!relations) return changes2;
31330         for (var i3 = 0; i3 < relations.length; i3++) {
31331           var relation = relations[i3];
31332           if (!sorted[relation["@id"]]) {
31333             processing.push(relation);
31334           }
31335           while (processing.length > 0) {
31336             var next = processing[0], deps = next.member.map(resolve).filter(Boolean).filter(isNew);
31337             if (deps.length === 0) {
31338               sorted[next["@id"]] = next;
31339               processing.shift();
31340             } else {
31341               processing = deps.concat(processing);
31342             }
31343           }
31344         }
31345         changes2.relation = Object.values(sorted);
31346         return changes2;
31347       }
31348       function rep(entity) {
31349         return entity.asJXON(changeset_id);
31350       }
31351       return {
31352         osmChange: {
31353           "@version": 0.6,
31354           "@generator": "iD",
31355           "create": sort(nest(changes.created.map(rep), ["node", "way", "relation"])),
31356           "modify": nest(changes.modified.map(rep), ["node", "way", "relation"]),
31357           "delete": Object.assign(nest(changes.deleted.map(rep), ["relation", "way", "node"]), { "@if-unused": true })
31358         }
31359       };
31360     },
31361     asGeoJSON: function() {
31362       return {};
31363     }
31364   });
31365
31366   // modules/osm/note.js
31367   function osmNote() {
31368     if (!(this instanceof osmNote)) {
31369       return new osmNote().initialize(arguments);
31370     } else if (arguments.length) {
31371       this.initialize(arguments);
31372     }
31373   }
31374   osmNote.id = function() {
31375     return osmNote.id.next--;
31376   };
31377   osmNote.id.next = -1;
31378   Object.assign(osmNote.prototype, {
31379     type: "note",
31380     initialize: function(sources) {
31381       for (var i3 = 0; i3 < sources.length; ++i3) {
31382         var source = sources[i3];
31383         for (var prop in source) {
31384           if (Object.prototype.hasOwnProperty.call(source, prop)) {
31385             if (source[prop] === void 0) {
31386               delete this[prop];
31387             } else {
31388               this[prop] = source[prop];
31389             }
31390           }
31391         }
31392       }
31393       if (!this.id) {
31394         this.id = osmNote.id().toString();
31395       }
31396       return this;
31397     },
31398     extent: function() {
31399       return new geoExtent(this.loc);
31400     },
31401     update: function(attrs) {
31402       return osmNote(this, attrs);
31403     },
31404     isNew: function() {
31405       return this.id < 0;
31406     },
31407     move: function(loc) {
31408       return this.update({ loc });
31409     }
31410   });
31411
31412   // modules/osm/relation.js
31413   function osmRelation() {
31414     if (!(this instanceof osmRelation)) {
31415       return new osmRelation().initialize(arguments);
31416     } else if (arguments.length) {
31417       this.initialize(arguments);
31418     }
31419   }
31420   osmEntity.relation = osmRelation;
31421   osmRelation.prototype = Object.create(osmEntity.prototype);
31422   osmRelation.creationOrder = function(a2, b2) {
31423     var aId = parseInt(osmEntity.id.toOSM(a2.id), 10);
31424     var bId = parseInt(osmEntity.id.toOSM(b2.id), 10);
31425     if (aId < 0 || bId < 0) return aId - bId;
31426     return bId - aId;
31427   };
31428   Object.assign(osmRelation.prototype, {
31429     type: "relation",
31430     members: [],
31431     copy: function(resolver, copies) {
31432       if (copies[this.id]) return copies[this.id];
31433       var copy2 = osmEntity.prototype.copy.call(this, resolver, copies);
31434       var members = this.members.map(function(member) {
31435         return Object.assign({}, member, { id: resolver.entity(member.id).copy(resolver, copies).id });
31436       });
31437       copy2 = copy2.update({ members });
31438       copies[this.id] = copy2;
31439       return copy2;
31440     },
31441     extent: function(resolver, memo) {
31442       return resolver.transient(this, "extent", function() {
31443         if (memo && memo[this.id]) return geoExtent();
31444         memo = memo || {};
31445         memo[this.id] = true;
31446         var extent = geoExtent();
31447         for (var i3 = 0; i3 < this.members.length; i3++) {
31448           var member = resolver.hasEntity(this.members[i3].id);
31449           if (member) {
31450             extent._extend(member.extent(resolver, memo));
31451           }
31452         }
31453         return extent;
31454       });
31455     },
31456     geometry: function(graph) {
31457       return graph.transient(this, "geometry", function() {
31458         return this.isMultipolygon() ? "area" : "relation";
31459       });
31460     },
31461     isDegenerate: function() {
31462       return this.members.length === 0;
31463     },
31464     // Return an array of members, each extended with an 'index' property whose value
31465     // is the member index.
31466     indexedMembers: function() {
31467       var result = new Array(this.members.length);
31468       for (var i3 = 0; i3 < this.members.length; i3++) {
31469         result[i3] = Object.assign({}, this.members[i3], { index: i3 });
31470       }
31471       return result;
31472     },
31473     // Return the first member with the given role. A copy of the member object
31474     // is returned, extended with an 'index' property whose value is the member index.
31475     memberByRole: function(role) {
31476       for (var i3 = 0; i3 < this.members.length; i3++) {
31477         if (this.members[i3].role === role) {
31478           return Object.assign({}, this.members[i3], { index: i3 });
31479         }
31480       }
31481     },
31482     // Same as memberByRole, but returns all members with the given role
31483     membersByRole: function(role) {
31484       var result = [];
31485       for (var i3 = 0; i3 < this.members.length; i3++) {
31486         if (this.members[i3].role === role) {
31487           result.push(Object.assign({}, this.members[i3], { index: i3 }));
31488         }
31489       }
31490       return result;
31491     },
31492     // Return the first member with the given id. A copy of the member object
31493     // is returned, extended with an 'index' property whose value is the member index.
31494     memberById: function(id2) {
31495       for (var i3 = 0; i3 < this.members.length; i3++) {
31496         if (this.members[i3].id === id2) {
31497           return Object.assign({}, this.members[i3], { index: i3 });
31498         }
31499       }
31500     },
31501     // Return the first member with the given id and role. A copy of the member object
31502     // is returned, extended with an 'index' property whose value is the member index.
31503     memberByIdAndRole: function(id2, role) {
31504       for (var i3 = 0; i3 < this.members.length; i3++) {
31505         if (this.members[i3].id === id2 && this.members[i3].role === role) {
31506           return Object.assign({}, this.members[i3], { index: i3 });
31507         }
31508       }
31509     },
31510     addMember: function(member, index) {
31511       var members = this.members.slice();
31512       members.splice(index === void 0 ? members.length : index, 0, member);
31513       return this.update({ members });
31514     },
31515     updateMember: function(member, index) {
31516       var members = this.members.slice();
31517       members.splice(index, 1, Object.assign({}, members[index], member));
31518       return this.update({ members });
31519     },
31520     removeMember: function(index) {
31521       var members = this.members.slice();
31522       members.splice(index, 1);
31523       return this.update({ members });
31524     },
31525     removeMembersWithID: function(id2) {
31526       var members = this.members.filter(function(m2) {
31527         return m2.id !== id2;
31528       });
31529       return this.update({ members });
31530     },
31531     moveMember: function(fromIndex, toIndex) {
31532       var members = this.members.slice();
31533       members.splice(toIndex, 0, members.splice(fromIndex, 1)[0]);
31534       return this.update({ members });
31535     },
31536     // Wherever a member appears with id `needle.id`, replace it with a member
31537     // with id `replacement.id`, type `replacement.type`, and the original role,
31538     // By default, adding a duplicate member (by id and role) is prevented.
31539     // Return an updated relation.
31540     replaceMember: function(needle, replacement, keepDuplicates) {
31541       if (!this.memberById(needle.id)) return this;
31542       var members = [];
31543       for (var i3 = 0; i3 < this.members.length; i3++) {
31544         var member = this.members[i3];
31545         if (member.id !== needle.id) {
31546           members.push(member);
31547         } else if (keepDuplicates || !this.memberByIdAndRole(replacement.id, member.role)) {
31548           members.push({ id: replacement.id, type: replacement.type, role: member.role });
31549         }
31550       }
31551       return this.update({ members });
31552     },
31553     asJXON: function(changeset_id) {
31554       var r2 = {
31555         relation: {
31556           "@id": this.osmId(),
31557           "@version": this.version || 0,
31558           member: this.members.map(function(member) {
31559             return {
31560               keyAttributes: {
31561                 type: member.type,
31562                 role: member.role,
31563                 ref: osmEntity.id.toOSM(member.id)
31564               }
31565             };
31566           }, this),
31567           tag: Object.keys(this.tags).map(function(k2) {
31568             return { keyAttributes: { k: k2, v: this.tags[k2] } };
31569           }, this)
31570         }
31571       };
31572       if (changeset_id) {
31573         r2.relation["@changeset"] = changeset_id;
31574       }
31575       return r2;
31576     },
31577     asGeoJSON: function(resolver) {
31578       return resolver.transient(this, "GeoJSON", function() {
31579         if (this.isMultipolygon()) {
31580           return {
31581             type: "MultiPolygon",
31582             coordinates: this.multipolygon(resolver)
31583           };
31584         } else {
31585           return {
31586             type: "FeatureCollection",
31587             properties: this.tags,
31588             features: this.members.map(function(member) {
31589               return Object.assign({ role: member.role }, resolver.entity(member.id).asGeoJSON(resolver));
31590             })
31591           };
31592         }
31593       });
31594     },
31595     area: function(resolver) {
31596       return resolver.transient(this, "area", function() {
31597         return area_default(this.asGeoJSON(resolver));
31598       });
31599     },
31600     isMultipolygon: function() {
31601       return this.tags.type === "multipolygon";
31602     },
31603     isComplete: function(resolver) {
31604       for (var i3 = 0; i3 < this.members.length; i3++) {
31605         if (!resolver.hasEntity(this.members[i3].id)) {
31606           return false;
31607         }
31608       }
31609       return true;
31610     },
31611     hasFromViaTo: function() {
31612       return this.members.some(function(m2) {
31613         return m2.role === "from";
31614       }) && this.members.some(function(m2) {
31615         return m2.role === "via";
31616       }) && this.members.some(function(m2) {
31617         return m2.role === "to";
31618       });
31619     },
31620     isRestriction: function() {
31621       return !!(this.tags.type && this.tags.type.match(/^restriction:?/));
31622     },
31623     isValidRestriction: function() {
31624       if (!this.isRestriction()) return false;
31625       var froms = this.members.filter(function(m2) {
31626         return m2.role === "from";
31627       });
31628       var vias = this.members.filter(function(m2) {
31629         return m2.role === "via";
31630       });
31631       var tos = this.members.filter(function(m2) {
31632         return m2.role === "to";
31633       });
31634       if (froms.length !== 1 && this.tags.restriction !== "no_entry") return false;
31635       if (froms.some(function(m2) {
31636         return m2.type !== "way";
31637       })) return false;
31638       if (tos.length !== 1 && this.tags.restriction !== "no_exit") return false;
31639       if (tos.some(function(m2) {
31640         return m2.type !== "way";
31641       })) return false;
31642       if (vias.length === 0) return false;
31643       if (vias.length > 1 && vias.some(function(m2) {
31644         return m2.type !== "way";
31645       })) return false;
31646       return true;
31647     },
31648     isConnectivity: function() {
31649       return !!(this.tags.type && this.tags.type.match(/^connectivity:?/));
31650     },
31651     // Returns an array [A0, ... An], each Ai being an array of node arrays [Nds0, ... Ndsm],
31652     // where Nds0 is an outer ring and subsequent Ndsi's (if any i > 0) being inner rings.
31653     //
31654     // This corresponds to the structure needed for rendering a multipolygon path using a
31655     // `evenodd` fill rule, as well as the structure of a GeoJSON MultiPolygon geometry.
31656     //
31657     // In the case of invalid geometries, this function will still return a result which
31658     // includes the nodes of all way members, but some Nds may be unclosed and some inner
31659     // rings not matched with the intended outer ring.
31660     //
31661     multipolygon: function(resolver) {
31662       var outers = this.members.filter(function(m2) {
31663         return "outer" === (m2.role || "outer");
31664       });
31665       var inners = this.members.filter(function(m2) {
31666         return "inner" === m2.role;
31667       });
31668       outers = osmJoinWays(outers, resolver);
31669       inners = osmJoinWays(inners, resolver);
31670       var sequenceToLineString = function(sequence) {
31671         if (sequence.nodes.length > 2 && sequence.nodes[0] !== sequence.nodes[sequence.nodes.length - 1]) {
31672           sequence.nodes.push(sequence.nodes[0]);
31673         }
31674         return sequence.nodes.map(function(node) {
31675           return node.loc;
31676         });
31677       };
31678       outers = outers.map(sequenceToLineString);
31679       inners = inners.map(sequenceToLineString);
31680       var result = outers.map(function(o3) {
31681         return [area_default({ type: "Polygon", coordinates: [o3] }) > 2 * Math.PI ? o3.reverse() : o3];
31682       });
31683       function findOuter(inner2) {
31684         var o3, outer;
31685         for (o3 = 0; o3 < outers.length; o3++) {
31686           outer = outers[o3];
31687           if (geoPolygonContainsPolygon(outer, inner2)) {
31688             return o3;
31689           }
31690         }
31691         for (o3 = 0; o3 < outers.length; o3++) {
31692           outer = outers[o3];
31693           if (geoPolygonIntersectsPolygon(outer, inner2, false)) {
31694             return o3;
31695           }
31696         }
31697       }
31698       for (var i3 = 0; i3 < inners.length; i3++) {
31699         var inner = inners[i3];
31700         if (area_default({ type: "Polygon", coordinates: [inner] }) < 2 * Math.PI) {
31701           inner = inner.reverse();
31702         }
31703         var o2 = findOuter(inners[i3]);
31704         if (o2 !== void 0) {
31705           result[o2].push(inners[i3]);
31706         } else {
31707           result.push([inners[i3]]);
31708         }
31709       }
31710       return result;
31711     }
31712   });
31713
31714   // modules/osm/qa_item.js
31715   var QAItem = class _QAItem {
31716     constructor(loc, service, itemType, id2, props) {
31717       this.loc = loc;
31718       this.service = service.title;
31719       this.itemType = itemType;
31720       this.id = id2 ? id2 : "".concat(_QAItem.id());
31721       this.update(props);
31722       if (service && typeof service.getIcon === "function") {
31723         this.icon = service.getIcon(itemType);
31724       }
31725     }
31726     update(props) {
31727       const { loc, service, itemType, id: id2 } = this;
31728       Object.keys(props).forEach((prop) => this[prop] = props[prop]);
31729       this.loc = loc;
31730       this.service = service;
31731       this.itemType = itemType;
31732       this.id = id2;
31733       return this;
31734     }
31735     // Generic handling for newly created QAItems
31736     static id() {
31737       return this.nextId--;
31738     }
31739   };
31740   QAItem.nextId = -1;
31741
31742   // modules/actions/split.js
31743   function actionSplit(nodeIds, newWayIds) {
31744     if (typeof nodeIds === "string") nodeIds = [nodeIds];
31745     var _wayIDs;
31746     var _keepHistoryOn = "longest";
31747     const circularJunctions = ["roundabout", "circular"];
31748     var _createdWayIDs = [];
31749     function dist(graph, nA, nB) {
31750       var locA = graph.entity(nA).loc;
31751       var locB = graph.entity(nB).loc;
31752       var epsilon3 = 1e-6;
31753       return locA && locB ? geoSphericalDistance(locA, locB) : epsilon3;
31754     }
31755     function splitArea(nodes, idxA, graph) {
31756       var lengths = new Array(nodes.length);
31757       var length2;
31758       var i3;
31759       var best = 0;
31760       var idxB;
31761       function wrap2(index) {
31762         return utilWrap(index, nodes.length);
31763       }
31764       length2 = 0;
31765       for (i3 = wrap2(idxA + 1); i3 !== idxA; i3 = wrap2(i3 + 1)) {
31766         length2 += dist(graph, nodes[i3], nodes[wrap2(i3 - 1)]);
31767         lengths[i3] = length2;
31768       }
31769       length2 = 0;
31770       for (i3 = wrap2(idxA - 1); i3 !== idxA; i3 = wrap2(i3 - 1)) {
31771         length2 += dist(graph, nodes[i3], nodes[wrap2(i3 + 1)]);
31772         if (length2 < lengths[i3]) {
31773           lengths[i3] = length2;
31774         }
31775       }
31776       for (i3 = 0; i3 < nodes.length; i3++) {
31777         var cost = lengths[i3] / dist(graph, nodes[idxA], nodes[i3]);
31778         if (cost > best) {
31779           idxB = i3;
31780           best = cost;
31781         }
31782       }
31783       return idxB;
31784     }
31785     function totalLengthBetweenNodes(graph, nodes) {
31786       var totalLength = 0;
31787       for (var i3 = 0; i3 < nodes.length - 1; i3++) {
31788         totalLength += dist(graph, nodes[i3], nodes[i3 + 1]);
31789       }
31790       return totalLength;
31791     }
31792     function split(graph, nodeId, wayA, newWayId) {
31793       var wayB = osmWay({ id: newWayId, tags: wayA.tags });
31794       var nodesA;
31795       var nodesB;
31796       var isArea = wayA.isArea();
31797       if (wayA.isClosed()) {
31798         var nodes = wayA.nodes.slice(0, -1);
31799         var idxA = nodes.indexOf(nodeId);
31800         var idxB = splitArea(nodes, idxA, graph);
31801         if (idxB < idxA) {
31802           nodesA = nodes.slice(idxA).concat(nodes.slice(0, idxB + 1));
31803           nodesB = nodes.slice(idxB, idxA + 1);
31804         } else {
31805           nodesA = nodes.slice(idxA, idxB + 1);
31806           nodesB = nodes.slice(idxB).concat(nodes.slice(0, idxA + 1));
31807         }
31808       } else {
31809         var idx = wayA.nodes.indexOf(nodeId, 1);
31810         nodesA = wayA.nodes.slice(0, idx + 1);
31811         nodesB = wayA.nodes.slice(idx);
31812       }
31813       var lengthA = totalLengthBetweenNodes(graph, nodesA);
31814       var lengthB = totalLengthBetweenNodes(graph, nodesB);
31815       if (_keepHistoryOn === "longest" && lengthB > lengthA) {
31816         wayA = wayA.update({ nodes: nodesB });
31817         wayB = wayB.update({ nodes: nodesA });
31818         var temp = lengthA;
31819         lengthA = lengthB;
31820         lengthB = temp;
31821       } else {
31822         wayA = wayA.update({ nodes: nodesA });
31823         wayB = wayB.update({ nodes: nodesB });
31824       }
31825       if (wayA.tags.step_count) {
31826         var stepCount = Number(wayA.tags.step_count);
31827         if (stepCount && // ensure a number
31828         isFinite(stepCount) && // ensure positive
31829         stepCount > 0 && // ensure integer
31830         Math.round(stepCount) === stepCount) {
31831           var tagsA = Object.assign({}, wayA.tags);
31832           var tagsB = Object.assign({}, wayB.tags);
31833           var ratioA = lengthA / (lengthA + lengthB);
31834           var countA = Math.round(stepCount * ratioA);
31835           tagsA.step_count = countA.toString();
31836           tagsB.step_count = (stepCount - countA).toString();
31837           wayA = wayA.update({ tags: tagsA });
31838           wayB = wayB.update({ tags: tagsB });
31839         }
31840       }
31841       graph = graph.replace(wayA);
31842       graph = graph.replace(wayB);
31843       graph.parentRelations(wayA).forEach(function(relation) {
31844         if (relation.hasFromViaTo()) {
31845           var f2 = relation.memberByRole("from");
31846           var v2 = relation.membersByRole("via");
31847           var t2 = relation.memberByRole("to");
31848           var i3;
31849           if (f2.id === wayA.id || t2.id === wayA.id) {
31850             var keepB = false;
31851             if (v2.length === 1 && v2[0].type === "node") {
31852               keepB = wayB.contains(v2[0].id);
31853             } else {
31854               for (i3 = 0; i3 < v2.length; i3++) {
31855                 if (v2[i3].type === "way") {
31856                   var wayVia = graph.hasEntity(v2[i3].id);
31857                   if (wayVia && utilArrayIntersection(wayB.nodes, wayVia.nodes).length) {
31858                     keepB = true;
31859                     break;
31860                   }
31861                 }
31862               }
31863             }
31864             if (keepB) {
31865               relation = relation.replaceMember(wayA, wayB);
31866               graph = graph.replace(relation);
31867             }
31868           } else {
31869             for (i3 = 0; i3 < v2.length; i3++) {
31870               if (v2[i3].type === "way" && v2[i3].id === wayA.id) {
31871                 graph = splitWayMember(graph, relation.id, wayA, wayB);
31872               }
31873             }
31874           }
31875         } else {
31876           graph = splitWayMember(graph, relation.id, wayA, wayB);
31877         }
31878       });
31879       if (isArea) {
31880         var multipolygon = osmRelation({
31881           tags: Object.assign({}, wayA.tags, { type: "multipolygon" }),
31882           members: [
31883             { id: wayA.id, role: "outer", type: "way" },
31884             { id: wayB.id, role: "outer", type: "way" }
31885           ]
31886         });
31887         graph = graph.replace(multipolygon);
31888         graph = graph.replace(wayA.update({ tags: {} }));
31889         graph = graph.replace(wayB.update({ tags: {} }));
31890       }
31891       _createdWayIDs.push(wayB.id);
31892       return graph;
31893     }
31894     function splitWayMember(graph, relationId, wayA, wayB) {
31895       function connects(way1, way2) {
31896         if (way1.nodes.length < 2 || way2.nodes.length < 2) return false;
31897         if (circularJunctions.includes(way1.tags.junction) && way1.isClosed()) {
31898           return way1.nodes.some((nodeId) => nodeId === way2.nodes[0] || nodeId === way2.nodes[way2.nodes.length - 1]);
31899         } else if (circularJunctions.includes(way2.tags.junction) && way2.isClosed()) {
31900           return way2.nodes.some((nodeId) => nodeId === way1.nodes[0] || nodeId === way1.nodes[way1.nodes.length - 1]);
31901         }
31902         if (way1.nodes[0] === way2.nodes[0]) return true;
31903         if (way1.nodes[0] === way2.nodes[way2.nodes.length - 1]) return true;
31904         if (way1.nodes[way1.nodes.length - 1] === way2.nodes[way2.nodes.length - 1]) return true;
31905         if (way1.nodes[way1.nodes.length - 1] === way2.nodes[0]) return true;
31906         return false;
31907       }
31908       let relation = graph.entity(relationId);
31909       const insertMembers = [];
31910       const members = relation.members;
31911       for (let i3 = 0; i3 < members.length; i3++) {
31912         const member = members[i3];
31913         if (member.id === wayA.id) {
31914           let wayAconnectsPrev = false;
31915           let wayAconnectsNext = false;
31916           let wayBconnectsPrev = false;
31917           let wayBconnectsNext = false;
31918           if (i3 > 0 && graph.hasEntity(members[i3 - 1].id)) {
31919             const prevEntity = graph.entity(members[i3 - 1].id);
31920             if (prevEntity.type === "way") {
31921               wayAconnectsPrev = connects(prevEntity, wayA);
31922               wayBconnectsPrev = connects(prevEntity, wayB);
31923             }
31924           }
31925           if (i3 < members.length - 1 && graph.hasEntity(members[i3 + 1].id)) {
31926             const nextEntity = graph.entity(members[i3 + 1].id);
31927             if (nextEntity.type === "way") {
31928               wayAconnectsNext = connects(nextEntity, wayA);
31929               wayBconnectsNext = connects(nextEntity, wayB);
31930             }
31931           }
31932           if (wayAconnectsPrev && !wayAconnectsNext || !wayBconnectsPrev && wayBconnectsNext && !(!wayAconnectsPrev && wayAconnectsNext)) {
31933             insertMembers.push({ at: i3 + 1, role: member.role });
31934             continue;
31935           }
31936           if (!wayAconnectsPrev && wayAconnectsNext || wayBconnectsPrev && !wayBconnectsNext && !(wayAconnectsPrev && !wayAconnectsNext)) {
31937             insertMembers.push({ at: i3, role: member.role });
31938             continue;
31939           }
31940           if (wayAconnectsPrev && wayBconnectsPrev && wayAconnectsNext && wayBconnectsNext) {
31941             if (i3 > 2 && graph.hasEntity(members[i3 - 2].id)) {
31942               const prev2Entity = graph.entity(members[i3 - 2].id);
31943               if (connects(prev2Entity, wayA) && !connects(prev2Entity, wayB)) {
31944                 insertMembers.push({ at: i3, role: member.role });
31945                 continue;
31946               }
31947               if (connects(prev2Entity, wayB) && !connects(prev2Entity, wayA)) {
31948                 insertMembers.push({ at: i3 + 1, role: member.role });
31949                 continue;
31950               }
31951             }
31952             if (i3 < members.length - 2 && graph.hasEntity(members[i3 + 2].id)) {
31953               const next2Entity = graph.entity(members[i3 + 2].id);
31954               if (connects(next2Entity, wayA) && !connects(next2Entity, wayB)) {
31955                 insertMembers.push({ at: i3 + 1, role: member.role });
31956                 continue;
31957               }
31958               if (connects(next2Entity, wayB) && !connects(next2Entity, wayA)) {
31959                 insertMembers.push({ at: i3, role: member.role });
31960                 continue;
31961               }
31962             }
31963           }
31964           if (wayA.nodes[wayA.nodes.length - 1] === wayB.nodes[0]) {
31965             insertMembers.push({ at: i3 + 1, role: member.role });
31966           } else {
31967             insertMembers.push({ at: i3, role: member.role });
31968           }
31969         }
31970       }
31971       insertMembers.reverse().forEach((item) => {
31972         graph = graph.replace(relation.addMember({
31973           id: wayB.id,
31974           type: "way",
31975           role: item.role
31976         }, item.at));
31977         relation = graph.entity(relation.id);
31978       });
31979       return graph;
31980     }
31981     var action = function(graph) {
31982       _createdWayIDs = [];
31983       var newWayIndex = 0;
31984       for (var i3 = 0; i3 < nodeIds.length; i3++) {
31985         var nodeId = nodeIds[i3];
31986         var candidates = action.waysForNode(nodeId, graph);
31987         for (var j2 = 0; j2 < candidates.length; j2++) {
31988           graph = split(graph, nodeId, candidates[j2], newWayIds && newWayIds[newWayIndex]);
31989           newWayIndex += 1;
31990         }
31991       }
31992       return graph;
31993     };
31994     action.getCreatedWayIDs = function() {
31995       return _createdWayIDs;
31996     };
31997     action.waysForNode = function(nodeId, graph) {
31998       var node = graph.entity(nodeId);
31999       var splittableParents = graph.parentWays(node).filter(isSplittable);
32000       if (!_wayIDs) {
32001         var hasLine = splittableParents.some(function(parent) {
32002           return parent.geometry(graph) === "line";
32003         });
32004         if (hasLine) {
32005           return splittableParents.filter(function(parent) {
32006             return parent.geometry(graph) === "line";
32007           });
32008         }
32009       }
32010       return splittableParents;
32011       function isSplittable(parent) {
32012         if (_wayIDs && _wayIDs.indexOf(parent.id) === -1) return false;
32013         if (parent.isClosed()) return true;
32014         for (var i3 = 1; i3 < parent.nodes.length - 1; i3++) {
32015           if (parent.nodes[i3] === nodeId) return true;
32016         }
32017         return false;
32018       }
32019     };
32020     action.ways = function(graph) {
32021       return utilArrayUniq([].concat.apply([], nodeIds.map(function(nodeId) {
32022         return action.waysForNode(nodeId, graph);
32023       })));
32024     };
32025     action.disabled = function(graph) {
32026       for (const nodeId of nodeIds) {
32027         const candidates = action.waysForNode(nodeId, graph);
32028         if (candidates.length === 0 || _wayIDs && _wayIDs.length !== candidates.length) {
32029           return "not_eligible";
32030         }
32031         for (const way of candidates) {
32032           const parentRelations = graph.parentRelations(way);
32033           for (const parentRelation of parentRelations) {
32034             if (parentRelation.hasFromViaTo()) {
32035               const vias = parentRelation.membersByRole("via");
32036               if (!vias.every((via) => graph.hasEntity(via.id))) {
32037                 return "parent_incomplete";
32038               }
32039             } else {
32040               for (let i3 = 0; i3 < parentRelation.members.length; i3++) {
32041                 if (parentRelation.members[i3].id === way.id) {
32042                   const memberBeforePresent = i3 > 0 && graph.hasEntity(parentRelation.members[i3 - 1].id);
32043                   const memberAfterPresent = i3 < parentRelation.members.length - 1 && graph.hasEntity(parentRelation.members[i3 + 1].id);
32044                   if (!memberBeforePresent && !memberAfterPresent && parentRelation.members.length > 1) {
32045                     return "parent_incomplete";
32046                   }
32047                 }
32048               }
32049             }
32050             const relTypesExceptions = ["junction", "enforcement"];
32051             if (circularJunctions.includes(way.tags.junction) && way.isClosed() && !relTypesExceptions.includes(parentRelation.tags.type)) {
32052               return "simple_roundabout";
32053             }
32054           }
32055         }
32056       }
32057     };
32058     action.limitWays = function(val) {
32059       if (!arguments.length) return _wayIDs;
32060       _wayIDs = val;
32061       return action;
32062     };
32063     action.keepHistoryOn = function(val) {
32064       if (!arguments.length) return _keepHistoryOn;
32065       _keepHistoryOn = val;
32066       return action;
32067     };
32068     return action;
32069   }
32070
32071   // modules/core/graph.js
32072   function coreGraph(other, mutable) {
32073     if (!(this instanceof coreGraph)) return new coreGraph(other, mutable);
32074     if (other instanceof coreGraph) {
32075       var base = other.base();
32076       this.entities = Object.assign(Object.create(base.entities), other.entities);
32077       this._parentWays = Object.assign(Object.create(base.parentWays), other._parentWays);
32078       this._parentRels = Object.assign(Object.create(base.parentRels), other._parentRels);
32079     } else {
32080       this.entities = /* @__PURE__ */ Object.create({});
32081       this._parentWays = /* @__PURE__ */ Object.create({});
32082       this._parentRels = /* @__PURE__ */ Object.create({});
32083       this.rebase(other || [], [this]);
32084     }
32085     this.transients = {};
32086     this._childNodes = {};
32087     this.frozen = !mutable;
32088   }
32089   coreGraph.prototype = {
32090     hasEntity: function(id2) {
32091       return this.entities[id2];
32092     },
32093     entity: function(id2) {
32094       var entity = this.entities[id2];
32095       if (!entity) {
32096         entity = this.entities.__proto__[id2];
32097       }
32098       if (!entity) {
32099         throw new Error("entity " + id2 + " not found");
32100       }
32101       return entity;
32102     },
32103     geometry: function(id2) {
32104       return this.entity(id2).geometry(this);
32105     },
32106     transient: function(entity, key, fn) {
32107       var id2 = entity.id;
32108       var transients = this.transients[id2] || (this.transients[id2] = {});
32109       if (transients[key] !== void 0) {
32110         return transients[key];
32111       }
32112       transients[key] = fn.call(entity);
32113       return transients[key];
32114     },
32115     parentWays: function(entity) {
32116       var parents = this._parentWays[entity.id];
32117       var result = [];
32118       if (parents) {
32119         parents.forEach(function(id2) {
32120           result.push(this.entity(id2));
32121         }, this);
32122       }
32123       return result;
32124     },
32125     isPoi: function(entity) {
32126       var parents = this._parentWays[entity.id];
32127       return !parents || parents.size === 0;
32128     },
32129     isShared: function(entity) {
32130       var parents = this._parentWays[entity.id];
32131       return parents && parents.size > 1;
32132     },
32133     parentRelations: function(entity) {
32134       var parents = this._parentRels[entity.id];
32135       var result = [];
32136       if (parents) {
32137         parents.forEach(function(id2) {
32138           result.push(this.entity(id2));
32139         }, this);
32140       }
32141       return result;
32142     },
32143     parentMultipolygons: function(entity) {
32144       return this.parentRelations(entity).filter(function(relation) {
32145         return relation.isMultipolygon();
32146       });
32147     },
32148     childNodes: function(entity) {
32149       if (this._childNodes[entity.id]) return this._childNodes[entity.id];
32150       if (!entity.nodes) return [];
32151       var nodes = [];
32152       for (var i3 = 0; i3 < entity.nodes.length; i3++) {
32153         nodes[i3] = this.entity(entity.nodes[i3]);
32154       }
32155       if (debug) Object.freeze(nodes);
32156       this._childNodes[entity.id] = nodes;
32157       return this._childNodes[entity.id];
32158     },
32159     base: function() {
32160       return {
32161         "entities": Object.getPrototypeOf(this.entities),
32162         "parentWays": Object.getPrototypeOf(this._parentWays),
32163         "parentRels": Object.getPrototypeOf(this._parentRels)
32164       };
32165     },
32166     // Unlike other graph methods, rebase mutates in place. This is because it
32167     // is used only during the history operation that merges newly downloaded
32168     // data into each state. To external consumers, it should appear as if the
32169     // graph always contained the newly downloaded data.
32170     rebase: function(entities, stack, force) {
32171       var base = this.base();
32172       var i3, j2, k2, id2;
32173       for (i3 = 0; i3 < entities.length; i3++) {
32174         var entity = entities[i3];
32175         if (!entity.visible || !force && base.entities[entity.id]) continue;
32176         base.entities[entity.id] = entity;
32177         this._updateCalculated(void 0, entity, base.parentWays, base.parentRels);
32178         if (entity.type === "way") {
32179           for (j2 = 0; j2 < entity.nodes.length; j2++) {
32180             id2 = entity.nodes[j2];
32181             for (k2 = 1; k2 < stack.length; k2++) {
32182               var ents = stack[k2].entities;
32183               if (ents.hasOwnProperty(id2) && ents[id2] === void 0) {
32184                 delete ents[id2];
32185               }
32186             }
32187           }
32188         }
32189       }
32190       for (i3 = 0; i3 < stack.length; i3++) {
32191         stack[i3]._updateRebased();
32192       }
32193     },
32194     _updateRebased: function() {
32195       var base = this.base();
32196       Object.keys(this._parentWays).forEach(function(child) {
32197         if (base.parentWays[child]) {
32198           base.parentWays[child].forEach(function(id2) {
32199             if (!this.entities.hasOwnProperty(id2)) {
32200               this._parentWays[child].add(id2);
32201             }
32202           }, this);
32203         }
32204       }, this);
32205       Object.keys(this._parentRels).forEach(function(child) {
32206         if (base.parentRels[child]) {
32207           base.parentRels[child].forEach(function(id2) {
32208             if (!this.entities.hasOwnProperty(id2)) {
32209               this._parentRels[child].add(id2);
32210             }
32211           }, this);
32212         }
32213       }, this);
32214       this.transients = {};
32215     },
32216     // Updates calculated properties (parentWays, parentRels) for the specified change
32217     _updateCalculated: function(oldentity, entity, parentWays, parentRels) {
32218       parentWays = parentWays || this._parentWays;
32219       parentRels = parentRels || this._parentRels;
32220       var type2 = entity && entity.type || oldentity && oldentity.type;
32221       var removed, added, i3;
32222       if (type2 === "way") {
32223         if (oldentity && entity) {
32224           removed = utilArrayDifference(oldentity.nodes, entity.nodes);
32225           added = utilArrayDifference(entity.nodes, oldentity.nodes);
32226         } else if (oldentity) {
32227           removed = oldentity.nodes;
32228           added = [];
32229         } else if (entity) {
32230           removed = [];
32231           added = entity.nodes;
32232         }
32233         for (i3 = 0; i3 < removed.length; i3++) {
32234           parentWays[removed[i3]] = new Set(parentWays[removed[i3]]);
32235           parentWays[removed[i3]].delete(oldentity.id);
32236         }
32237         for (i3 = 0; i3 < added.length; i3++) {
32238           parentWays[added[i3]] = new Set(parentWays[added[i3]]);
32239           parentWays[added[i3]].add(entity.id);
32240         }
32241       } else if (type2 === "relation") {
32242         var oldentityMemberIDs = oldentity ? oldentity.members.map(function(m2) {
32243           return m2.id;
32244         }) : [];
32245         var entityMemberIDs = entity ? entity.members.map(function(m2) {
32246           return m2.id;
32247         }) : [];
32248         if (oldentity && entity) {
32249           removed = utilArrayDifference(oldentityMemberIDs, entityMemberIDs);
32250           added = utilArrayDifference(entityMemberIDs, oldentityMemberIDs);
32251         } else if (oldentity) {
32252           removed = oldentityMemberIDs;
32253           added = [];
32254         } else if (entity) {
32255           removed = [];
32256           added = entityMemberIDs;
32257         }
32258         for (i3 = 0; i3 < removed.length; i3++) {
32259           parentRels[removed[i3]] = new Set(parentRels[removed[i3]]);
32260           parentRels[removed[i3]].delete(oldentity.id);
32261         }
32262         for (i3 = 0; i3 < added.length; i3++) {
32263           parentRels[added[i3]] = new Set(parentRels[added[i3]]);
32264           parentRels[added[i3]].add(entity.id);
32265         }
32266       }
32267     },
32268     replace: function(entity) {
32269       if (this.entities[entity.id] === entity) return this;
32270       return this.update(function() {
32271         this._updateCalculated(this.entities[entity.id], entity);
32272         this.entities[entity.id] = entity;
32273       });
32274     },
32275     remove: function(entity) {
32276       return this.update(function() {
32277         this._updateCalculated(entity, void 0);
32278         this.entities[entity.id] = void 0;
32279       });
32280     },
32281     revert: function(id2) {
32282       var baseEntity = this.base().entities[id2];
32283       var headEntity = this.entities[id2];
32284       if (headEntity === baseEntity) return this;
32285       return this.update(function() {
32286         this._updateCalculated(headEntity, baseEntity);
32287         delete this.entities[id2];
32288       });
32289     },
32290     update: function() {
32291       var graph = this.frozen ? coreGraph(this, true) : this;
32292       for (var i3 = 0; i3 < arguments.length; i3++) {
32293         arguments[i3].call(graph, graph);
32294       }
32295       if (this.frozen) graph.frozen = true;
32296       return graph;
32297     },
32298     // Obliterates any existing entities
32299     load: function(entities) {
32300       var base = this.base();
32301       this.entities = Object.create(base.entities);
32302       for (var i3 in entities) {
32303         this.entities[i3] = entities[i3];
32304         this._updateCalculated(base.entities[i3], this.entities[i3]);
32305       }
32306       return this;
32307     }
32308   };
32309
32310   // modules/osm/intersection.js
32311   function osmTurn(turn) {
32312     if (!(this instanceof osmTurn)) {
32313       return new osmTurn(turn);
32314     }
32315     Object.assign(this, turn);
32316   }
32317   function osmIntersection(graph, startVertexId, maxDistance) {
32318     maxDistance = maxDistance || 30;
32319     var vgraph = coreGraph();
32320     var i3, j2, k2;
32321     function memberOfRestriction(entity) {
32322       return graph.parentRelations(entity).some(function(r2) {
32323         return r2.isRestriction();
32324       });
32325     }
32326     function isRoad(way2) {
32327       if (way2.isArea() || way2.isDegenerate()) return false;
32328       var roads = {
32329         "motorway": true,
32330         "motorway_link": true,
32331         "trunk": true,
32332         "trunk_link": true,
32333         "primary": true,
32334         "primary_link": true,
32335         "secondary": true,
32336         "secondary_link": true,
32337         "tertiary": true,
32338         "tertiary_link": true,
32339         "residential": true,
32340         "unclassified": true,
32341         "living_street": true,
32342         "service": true,
32343         "busway": true,
32344         "road": true,
32345         "track": true
32346       };
32347       return roads[way2.tags.highway];
32348     }
32349     var startNode = graph.entity(startVertexId);
32350     var checkVertices = [startNode];
32351     var checkWays;
32352     var vertices = [];
32353     var vertexIds = [];
32354     var vertex;
32355     var ways = [];
32356     var wayIds = [];
32357     var way;
32358     var nodes = [];
32359     var node;
32360     var parents = [];
32361     var parent;
32362     var actions = [];
32363     while (checkVertices.length) {
32364       vertex = checkVertices.pop();
32365       checkWays = graph.parentWays(vertex);
32366       var hasWays = false;
32367       for (i3 = 0; i3 < checkWays.length; i3++) {
32368         way = checkWays[i3];
32369         if (!isRoad(way) && !memberOfRestriction(way)) continue;
32370         ways.push(way);
32371         hasWays = true;
32372         nodes = utilArrayUniq(graph.childNodes(way));
32373         for (j2 = 0; j2 < nodes.length; j2++) {
32374           node = nodes[j2];
32375           if (node === vertex) continue;
32376           if (vertices.indexOf(node) !== -1) continue;
32377           if (geoSphericalDistance(node.loc, startNode.loc) > maxDistance) continue;
32378           var hasParents = false;
32379           parents = graph.parentWays(node);
32380           for (k2 = 0; k2 < parents.length; k2++) {
32381             parent = parents[k2];
32382             if (parent === way) continue;
32383             if (ways.indexOf(parent) !== -1) continue;
32384             if (!isRoad(parent)) continue;
32385             hasParents = true;
32386             break;
32387           }
32388           if (hasParents) {
32389             checkVertices.push(node);
32390           }
32391         }
32392       }
32393       if (hasWays) {
32394         vertices.push(vertex);
32395       }
32396     }
32397     vertices = utilArrayUniq(vertices);
32398     ways = utilArrayUniq(ways);
32399     ways.forEach(function(way2) {
32400       graph.childNodes(way2).forEach(function(node2) {
32401         vgraph = vgraph.replace(node2);
32402       });
32403       vgraph = vgraph.replace(way2);
32404       graph.parentRelations(way2).forEach(function(relation) {
32405         if (relation.isRestriction()) {
32406           if (relation.isValidRestriction(graph)) {
32407             vgraph = vgraph.replace(relation);
32408           } else if (relation.isComplete(graph)) {
32409             actions.push(actionDeleteRelation(relation.id));
32410           }
32411         }
32412       });
32413     });
32414     ways.forEach(function(w2) {
32415       var way2 = vgraph.entity(w2.id);
32416       if (way2.tags.oneway === "-1") {
32417         var action = actionReverse(way2.id, { reverseOneway: true });
32418         actions.push(action);
32419         vgraph = action(vgraph);
32420       }
32421     });
32422     var origCount = osmEntity.id.next.way;
32423     vertices.forEach(function(v2) {
32424       var splitAll = actionSplit([v2.id]).keepHistoryOn("first");
32425       if (!splitAll.disabled(vgraph)) {
32426         splitAll.ways(vgraph).forEach(function(way2) {
32427           var splitOne = actionSplit([v2.id]).limitWays([way2.id]).keepHistoryOn("first");
32428           actions.push(splitOne);
32429           vgraph = splitOne(vgraph);
32430         });
32431       }
32432     });
32433     osmEntity.id.next.way = origCount;
32434     vertexIds = vertices.map(function(v2) {
32435       return v2.id;
32436     });
32437     vertices = [];
32438     ways = [];
32439     vertexIds.forEach(function(id2) {
32440       var vertex2 = vgraph.entity(id2);
32441       var parents2 = vgraph.parentWays(vertex2);
32442       vertices.push(vertex2);
32443       ways = ways.concat(parents2);
32444     });
32445     vertices = utilArrayUniq(vertices);
32446     ways = utilArrayUniq(ways);
32447     vertexIds = vertices.map(function(v2) {
32448       return v2.id;
32449     });
32450     wayIds = ways.map(function(w2) {
32451       return w2.id;
32452     });
32453     function withMetadata(way2, vertexIds2) {
32454       var __oneWay = way2.isOneWay();
32455       var __first = vertexIds2.indexOf(way2.first()) !== -1;
32456       var __last = vertexIds2.indexOf(way2.last()) !== -1;
32457       var __via = __first && __last;
32458       var __from = __first && !__oneWay || __last;
32459       var __to = __first || __last && !__oneWay;
32460       return way2.update({
32461         __first,
32462         __last,
32463         __from,
32464         __via,
32465         __to,
32466         __oneWay
32467       });
32468     }
32469     ways = [];
32470     wayIds.forEach(function(id2) {
32471       var way2 = withMetadata(vgraph.entity(id2), vertexIds);
32472       vgraph = vgraph.replace(way2);
32473       ways.push(way2);
32474     });
32475     var keepGoing;
32476     var removeWayIds = [];
32477     var removeVertexIds = [];
32478     do {
32479       keepGoing = false;
32480       checkVertices = vertexIds.slice();
32481       for (i3 = 0; i3 < checkVertices.length; i3++) {
32482         var vertexId = checkVertices[i3];
32483         vertex = vgraph.hasEntity(vertexId);
32484         if (!vertex) {
32485           if (vertexIds.indexOf(vertexId) !== -1) {
32486             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
32487           }
32488           removeVertexIds.push(vertexId);
32489           continue;
32490         }
32491         parents = vgraph.parentWays(vertex);
32492         if (parents.length < 3) {
32493           if (vertexIds.indexOf(vertexId) !== -1) {
32494             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
32495           }
32496         }
32497         if (parents.length === 2) {
32498           var a2 = parents[0];
32499           var b2 = parents[1];
32500           var aIsLeaf = a2 && !a2.__via;
32501           var bIsLeaf = b2 && !b2.__via;
32502           var leaf, survivor;
32503           if (aIsLeaf && !bIsLeaf) {
32504             leaf = a2;
32505             survivor = b2;
32506           } else if (!aIsLeaf && bIsLeaf) {
32507             leaf = b2;
32508             survivor = a2;
32509           }
32510           if (leaf && survivor) {
32511             survivor = withMetadata(survivor, vertexIds);
32512             vgraph = vgraph.replace(survivor).remove(leaf);
32513             removeWayIds.push(leaf.id);
32514             keepGoing = true;
32515           }
32516         }
32517         parents = vgraph.parentWays(vertex);
32518         if (parents.length < 2) {
32519           if (vertexIds.indexOf(vertexId) !== -1) {
32520             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
32521           }
32522           removeVertexIds.push(vertexId);
32523           keepGoing = true;
32524         }
32525         if (parents.length < 1) {
32526           vgraph = vgraph.remove(vertex);
32527         }
32528       }
32529     } while (keepGoing);
32530     vertices = vertices.filter(function(vertex2) {
32531       return removeVertexIds.indexOf(vertex2.id) === -1;
32532     }).map(function(vertex2) {
32533       return vgraph.entity(vertex2.id);
32534     });
32535     ways = ways.filter(function(way2) {
32536       return removeWayIds.indexOf(way2.id) === -1;
32537     }).map(function(way2) {
32538       return vgraph.entity(way2.id);
32539     });
32540     var intersection2 = {
32541       graph: vgraph,
32542       actions,
32543       vertices,
32544       ways
32545     };
32546     intersection2.turns = function(fromWayId, maxViaWay) {
32547       if (!fromWayId) return [];
32548       if (!maxViaWay) maxViaWay = 0;
32549       var vgraph2 = intersection2.graph;
32550       var keyVertexIds = intersection2.vertices.map(function(v2) {
32551         return v2.id;
32552       });
32553       var start2 = vgraph2.entity(fromWayId);
32554       if (!start2 || !(start2.__from || start2.__via)) return [];
32555       var maxPathLength = maxViaWay * 2 + 3;
32556       var turns = [];
32557       step(start2);
32558       return turns;
32559       function step(entity, currPath, currRestrictions, matchedRestriction) {
32560         currPath = (currPath || []).slice();
32561         if (currPath.length >= maxPathLength) return;
32562         currPath.push(entity.id);
32563         currRestrictions = (currRestrictions || []).slice();
32564         if (entity.type === "node") {
32565           stepNode(entity, currPath, currRestrictions);
32566         } else {
32567           stepWay(entity, currPath, currRestrictions, matchedRestriction);
32568         }
32569       }
32570       function stepNode(entity, currPath, currRestrictions) {
32571         var i4, j3;
32572         var parents2 = vgraph2.parentWays(entity);
32573         var nextWays = [];
32574         for (i4 = 0; i4 < parents2.length; i4++) {
32575           var way2 = parents2[i4];
32576           if (way2.__oneWay && way2.nodes[0] !== entity.id) continue;
32577           if (currPath.indexOf(way2.id) !== -1 && currPath.length >= 3) continue;
32578           var restrict = null;
32579           for (j3 = 0; j3 < currRestrictions.length; j3++) {
32580             var restriction = currRestrictions[j3];
32581             var f2 = restriction.memberByRole("from");
32582             var v2 = restriction.membersByRole("via");
32583             var t2 = restriction.memberByRole("to");
32584             var isNo = /^no_/.test(restriction.tags.restriction);
32585             var isOnly = /^only_/.test(restriction.tags.restriction);
32586             if (!(isNo || isOnly)) {
32587               continue;
32588             }
32589             var matchesFrom = f2.id === fromWayId;
32590             var matchesViaTo = false;
32591             var isAlongOnlyPath = false;
32592             if (t2.id === way2.id) {
32593               if (v2.length === 1 && v2[0].type === "node") {
32594                 matchesViaTo = v2[0].id === entity.id && (matchesFrom && currPath.length === 2 || !matchesFrom && currPath.length > 2);
32595               } else {
32596                 var pathVias = [];
32597                 for (k2 = 2; k2 < currPath.length; k2 += 2) {
32598                   pathVias.push(currPath[k2]);
32599                 }
32600                 var restrictionVias = [];
32601                 for (k2 = 0; k2 < v2.length; k2++) {
32602                   if (v2[k2].type === "way") {
32603                     restrictionVias.push(v2[k2].id);
32604                   }
32605                 }
32606                 var diff = utilArrayDifference(pathVias, restrictionVias);
32607                 matchesViaTo = !diff.length;
32608               }
32609             } else if (isOnly) {
32610               for (k2 = 0; k2 < v2.length; k2++) {
32611                 if (v2[k2].type === "way" && v2[k2].id === way2.id) {
32612                   isAlongOnlyPath = true;
32613                   break;
32614                 }
32615               }
32616             }
32617             if (matchesViaTo) {
32618               if (isOnly) {
32619                 restrict = { id: restriction.id, direct: matchesFrom, from: f2.id, only: true, end: true };
32620               } else {
32621                 restrict = { id: restriction.id, direct: matchesFrom, from: f2.id, no: true, end: true };
32622               }
32623             } else {
32624               if (isAlongOnlyPath) {
32625                 restrict = { id: restriction.id, direct: false, from: f2.id, only: true, end: false };
32626               } else if (isOnly) {
32627                 restrict = { id: restriction.id, direct: false, from: f2.id, no: true, end: true };
32628               }
32629             }
32630             if (restrict && restrict.direct) break;
32631           }
32632           nextWays.push({ way: way2, restrict });
32633         }
32634         nextWays.forEach(function(nextWay) {
32635           step(nextWay.way, currPath, currRestrictions, nextWay.restrict);
32636         });
32637       }
32638       function stepWay(entity, currPath, currRestrictions, matchedRestriction) {
32639         var i4;
32640         if (currPath.length >= 3) {
32641           var turnPath = currPath.slice();
32642           if (matchedRestriction && matchedRestriction.direct === false) {
32643             for (i4 = 0; i4 < turnPath.length; i4++) {
32644               if (turnPath[i4] === matchedRestriction.from) {
32645                 turnPath = turnPath.slice(i4);
32646                 break;
32647               }
32648             }
32649           }
32650           var turn = pathToTurn(turnPath);
32651           if (turn) {
32652             if (matchedRestriction) {
32653               turn.restrictionID = matchedRestriction.id;
32654               turn.no = matchedRestriction.no;
32655               turn.only = matchedRestriction.only;
32656               turn.direct = matchedRestriction.direct;
32657             }
32658             turns.push(osmTurn(turn));
32659           }
32660           if (currPath[0] === currPath[2]) return;
32661         }
32662         if (matchedRestriction && matchedRestriction.end) return;
32663         var n1 = vgraph2.entity(entity.first());
32664         var n22 = vgraph2.entity(entity.last());
32665         var dist = geoSphericalDistance(n1.loc, n22.loc);
32666         var nextNodes = [];
32667         if (currPath.length > 1) {
32668           if (dist > maxDistance) return;
32669           if (!entity.__via) return;
32670         }
32671         if (!entity.__oneWay && // bidirectional..
32672         keyVertexIds.indexOf(n1.id) !== -1 && // key vertex..
32673         currPath.indexOf(n1.id) === -1) {
32674           nextNodes.push(n1);
32675         }
32676         if (keyVertexIds.indexOf(n22.id) !== -1 && // key vertex..
32677         currPath.indexOf(n22.id) === -1) {
32678           nextNodes.push(n22);
32679         }
32680         nextNodes.forEach(function(nextNode) {
32681           var fromRestrictions = vgraph2.parentRelations(entity).filter(function(r2) {
32682             if (!r2.isRestriction()) return false;
32683             var f2 = r2.memberByRole("from");
32684             if (!f2 || f2.id !== entity.id) return false;
32685             var isOnly = /^only_/.test(r2.tags.restriction);
32686             if (!isOnly) return true;
32687             var isOnlyVia = false;
32688             var v2 = r2.membersByRole("via");
32689             if (v2.length === 1 && v2[0].type === "node") {
32690               isOnlyVia = v2[0].id === nextNode.id;
32691             } else {
32692               for (var i5 = 0; i5 < v2.length; i5++) {
32693                 if (v2[i5].type !== "way") continue;
32694                 var viaWay = vgraph2.entity(v2[i5].id);
32695                 if (viaWay.first() === nextNode.id || viaWay.last() === nextNode.id) {
32696                   isOnlyVia = true;
32697                   break;
32698                 }
32699               }
32700             }
32701             return isOnlyVia;
32702           });
32703           step(nextNode, currPath, currRestrictions.concat(fromRestrictions), false);
32704         });
32705       }
32706       function pathToTurn(path) {
32707         if (path.length < 3) return;
32708         var fromWayId2, fromNodeId, fromVertexId;
32709         var toWayId, toNodeId, toVertexId;
32710         var viaWayIds, viaNodeId, isUturn;
32711         fromWayId2 = path[0];
32712         toWayId = path[path.length - 1];
32713         if (path.length === 3 && fromWayId2 === toWayId) {
32714           var way2 = vgraph2.entity(fromWayId2);
32715           if (way2.__oneWay) return null;
32716           isUturn = true;
32717           viaNodeId = fromVertexId = toVertexId = path[1];
32718           fromNodeId = toNodeId = adjacentNode(fromWayId2, viaNodeId);
32719         } else {
32720           isUturn = false;
32721           fromVertexId = path[1];
32722           fromNodeId = adjacentNode(fromWayId2, fromVertexId);
32723           toVertexId = path[path.length - 2];
32724           toNodeId = adjacentNode(toWayId, toVertexId);
32725           if (path.length === 3) {
32726             viaNodeId = path[1];
32727           } else {
32728             viaWayIds = path.filter(function(entityId) {
32729               return entityId[0] === "w";
32730             });
32731             viaWayIds = viaWayIds.slice(1, viaWayIds.length - 1);
32732           }
32733         }
32734         return {
32735           key: path.join("_"),
32736           path,
32737           from: { node: fromNodeId, way: fromWayId2, vertex: fromVertexId },
32738           via: { node: viaNodeId, ways: viaWayIds },
32739           to: { node: toNodeId, way: toWayId, vertex: toVertexId },
32740           u: isUturn
32741         };
32742         function adjacentNode(wayId, affixId) {
32743           var nodes2 = vgraph2.entity(wayId).nodes;
32744           return affixId === nodes2[0] ? nodes2[1] : nodes2[nodes2.length - 2];
32745         }
32746       }
32747     };
32748     return intersection2;
32749   }
32750   function osmInferRestriction(graph, turn, projection2) {
32751     var fromWay = graph.entity(turn.from.way);
32752     var fromNode = graph.entity(turn.from.node);
32753     var fromVertex = graph.entity(turn.from.vertex);
32754     var toWay = graph.entity(turn.to.way);
32755     var toNode = graph.entity(turn.to.node);
32756     var toVertex = graph.entity(turn.to.vertex);
32757     var fromOneWay = fromWay.tags.oneway === "yes";
32758     var toOneWay = toWay.tags.oneway === "yes";
32759     var angle2 = (geoAngle(fromVertex, fromNode, projection2) - geoAngle(toVertex, toNode, projection2)) * 180 / Math.PI;
32760     while (angle2 < 0) {
32761       angle2 += 360;
32762     }
32763     if (fromNode === toNode) {
32764       return "no_u_turn";
32765     }
32766     if ((angle2 < 23 || angle2 > 336) && fromOneWay && toOneWay) {
32767       return "no_u_turn";
32768     }
32769     if ((angle2 < 40 || angle2 > 319) && fromOneWay && toOneWay && turn.from.vertex !== turn.to.vertex) {
32770       return "no_u_turn";
32771     }
32772     if (angle2 < 158) {
32773       return "no_right_turn";
32774     }
32775     if (angle2 > 202) {
32776       return "no_left_turn";
32777     }
32778     return "no_straight_on";
32779   }
32780
32781   // modules/actions/merge_polygon.js
32782   function actionMergePolygon(ids, newRelationId) {
32783     function groupEntities(graph) {
32784       var entities = ids.map(function(id2) {
32785         return graph.entity(id2);
32786       });
32787       var geometryGroups = utilArrayGroupBy(entities, function(entity) {
32788         if (entity.type === "way" && entity.isClosed()) {
32789           return "closedWay";
32790         } else if (entity.type === "relation" && entity.isMultipolygon()) {
32791           return "multipolygon";
32792         } else {
32793           return "other";
32794         }
32795       });
32796       return Object.assign(
32797         { closedWay: [], multipolygon: [], other: [] },
32798         geometryGroups
32799       );
32800     }
32801     var action = function(graph) {
32802       var entities = groupEntities(graph);
32803       var polygons = entities.multipolygon.reduce(function(polygons2, m2) {
32804         return polygons2.concat(osmJoinWays(m2.members, graph));
32805       }, []).concat(entities.closedWay.map(function(d2) {
32806         var member = [{ id: d2.id }];
32807         member.nodes = graph.childNodes(d2);
32808         return member;
32809       }));
32810       var contained = polygons.map(function(w2, i3) {
32811         return polygons.map(function(d2, n3) {
32812           if (i3 === n3) return null;
32813           return geoPolygonContainsPolygon(
32814             d2.nodes.map(function(n4) {
32815               return n4.loc;
32816             }),
32817             w2.nodes.map(function(n4) {
32818               return n4.loc;
32819             })
32820           );
32821         });
32822       });
32823       var members = [];
32824       var outer = true;
32825       while (polygons.length) {
32826         extractUncontained(polygons);
32827         polygons = polygons.filter(isContained);
32828         contained = contained.filter(isContained).map(filterContained);
32829       }
32830       function isContained(d2, i3) {
32831         return contained[i3].some(function(val) {
32832           return val;
32833         });
32834       }
32835       function filterContained(d2) {
32836         return d2.filter(isContained);
32837       }
32838       function extractUncontained(polygons2) {
32839         polygons2.forEach(function(d2, i3) {
32840           if (!isContained(d2, i3)) {
32841             d2.forEach(function(member) {
32842               members.push({
32843                 type: "way",
32844                 id: member.id,
32845                 role: outer ? "outer" : "inner"
32846               });
32847             });
32848           }
32849         });
32850         outer = !outer;
32851       }
32852       var relation;
32853       if (entities.multipolygon.length > 0) {
32854         var oldestID = utilOldestID(entities.multipolygon.map((entity) => entity.id));
32855         relation = entities.multipolygon.find((entity) => entity.id === oldestID);
32856       } else {
32857         relation = osmRelation({ id: newRelationId, tags: { type: "multipolygon" } });
32858       }
32859       entities.multipolygon.forEach(function(m2) {
32860         if (m2.id !== relation.id) {
32861           relation = relation.mergeTags(m2.tags);
32862           graph = graph.remove(m2);
32863         }
32864       });
32865       entities.closedWay.forEach(function(way) {
32866         function isThisOuter(m2) {
32867           return m2.id === way.id && m2.role !== "inner";
32868         }
32869         if (members.some(isThisOuter)) {
32870           relation = relation.mergeTags(way.tags);
32871           graph = graph.replace(way.update({ tags: {} }));
32872         }
32873       });
32874       return graph.replace(relation.update({
32875         members,
32876         tags: utilObjectOmit(relation.tags, ["area"])
32877       }));
32878     };
32879     action.disabled = function(graph) {
32880       var entities = groupEntities(graph);
32881       if (entities.other.length > 0 || entities.closedWay.length + entities.multipolygon.length < 2) {
32882         return "not_eligible";
32883       }
32884       if (!entities.multipolygon.every(function(r2) {
32885         return r2.isComplete(graph);
32886       })) {
32887         return "incomplete_relation";
32888       }
32889       if (!entities.multipolygon.length) {
32890         var sharedMultipolygons = [];
32891         entities.closedWay.forEach(function(way, i3) {
32892           if (i3 === 0) {
32893             sharedMultipolygons = graph.parentMultipolygons(way);
32894           } else {
32895             sharedMultipolygons = utilArrayIntersection(sharedMultipolygons, graph.parentMultipolygons(way));
32896           }
32897         });
32898         sharedMultipolygons = sharedMultipolygons.filter(function(relation) {
32899           return relation.members.length === entities.closedWay.length;
32900         });
32901         if (sharedMultipolygons.length) {
32902           return "not_eligible";
32903         }
32904       } else if (entities.closedWay.some(function(way) {
32905         return utilArrayIntersection(graph.parentMultipolygons(way), entities.multipolygon).length;
32906       })) {
32907         return "not_eligible";
32908       }
32909     };
32910     return action;
32911   }
32912
32913   // modules/actions/merge_remote_changes.js
32914   var import_fast_deep_equal = __toESM(require_fast_deep_equal());
32915
32916   // node_modules/node-diff3/index.mjs
32917   function LCS(buffer1, buffer2) {
32918     let equivalenceClasses = {};
32919     for (let j2 = 0; j2 < buffer2.length; j2++) {
32920       const item = buffer2[j2];
32921       if (equivalenceClasses[item]) {
32922         equivalenceClasses[item].push(j2);
32923       } else {
32924         equivalenceClasses[item] = [j2];
32925       }
32926     }
32927     const NULLRESULT = { buffer1index: -1, buffer2index: -1, chain: null };
32928     let candidates = [NULLRESULT];
32929     for (let i3 = 0; i3 < buffer1.length; i3++) {
32930       const item = buffer1[i3];
32931       const buffer2indices = equivalenceClasses[item] || [];
32932       let r2 = 0;
32933       let c2 = candidates[0];
32934       for (let jx = 0; jx < buffer2indices.length; jx++) {
32935         const j2 = buffer2indices[jx];
32936         let s2;
32937         for (s2 = r2; s2 < candidates.length; s2++) {
32938           if (candidates[s2].buffer2index < j2 && (s2 === candidates.length - 1 || candidates[s2 + 1].buffer2index > j2)) {
32939             break;
32940           }
32941         }
32942         if (s2 < candidates.length) {
32943           const newCandidate = { buffer1index: i3, buffer2index: j2, chain: candidates[s2] };
32944           if (r2 === candidates.length) {
32945             candidates.push(c2);
32946           } else {
32947             candidates[r2] = c2;
32948           }
32949           r2 = s2 + 1;
32950           c2 = newCandidate;
32951           if (r2 === candidates.length) {
32952             break;
32953           }
32954         }
32955       }
32956       candidates[r2] = c2;
32957     }
32958     return candidates[candidates.length - 1];
32959   }
32960   function diffIndices(buffer1, buffer2) {
32961     const lcs = LCS(buffer1, buffer2);
32962     let result = [];
32963     let tail1 = buffer1.length;
32964     let tail2 = buffer2.length;
32965     for (let candidate = lcs; candidate !== null; candidate = candidate.chain) {
32966       const mismatchLength1 = tail1 - candidate.buffer1index - 1;
32967       const mismatchLength2 = tail2 - candidate.buffer2index - 1;
32968       tail1 = candidate.buffer1index;
32969       tail2 = candidate.buffer2index;
32970       if (mismatchLength1 || mismatchLength2) {
32971         result.push({
32972           buffer1: [tail1 + 1, mismatchLength1],
32973           buffer1Content: buffer1.slice(tail1 + 1, tail1 + 1 + mismatchLength1),
32974           buffer2: [tail2 + 1, mismatchLength2],
32975           buffer2Content: buffer2.slice(tail2 + 1, tail2 + 1 + mismatchLength2)
32976         });
32977       }
32978     }
32979     result.reverse();
32980     return result;
32981   }
32982   function diff3MergeRegions(a2, o2, b2) {
32983     let hunks = [];
32984     function addHunk(h2, ab) {
32985       hunks.push({
32986         ab,
32987         oStart: h2.buffer1[0],
32988         oLength: h2.buffer1[1],
32989         // length of o to remove
32990         abStart: h2.buffer2[0],
32991         abLength: h2.buffer2[1]
32992         // length of a/b to insert
32993         // abContent: (ab === 'a' ? a : b).slice(h.buffer2[0], h.buffer2[0] + h.buffer2[1])
32994       });
32995     }
32996     diffIndices(o2, a2).forEach((item) => addHunk(item, "a"));
32997     diffIndices(o2, b2).forEach((item) => addHunk(item, "b"));
32998     hunks.sort((x2, y2) => x2.oStart - y2.oStart);
32999     let results = [];
33000     let currOffset = 0;
33001     function advanceTo(endOffset) {
33002       if (endOffset > currOffset) {
33003         results.push({
33004           stable: true,
33005           buffer: "o",
33006           bufferStart: currOffset,
33007           bufferLength: endOffset - currOffset,
33008           bufferContent: o2.slice(currOffset, endOffset)
33009         });
33010         currOffset = endOffset;
33011       }
33012     }
33013     while (hunks.length) {
33014       let hunk = hunks.shift();
33015       let regionStart = hunk.oStart;
33016       let regionEnd = hunk.oStart + hunk.oLength;
33017       let regionHunks = [hunk];
33018       advanceTo(regionStart);
33019       while (hunks.length) {
33020         const nextHunk = hunks[0];
33021         const nextHunkStart = nextHunk.oStart;
33022         if (nextHunkStart > regionEnd) break;
33023         regionEnd = Math.max(regionEnd, nextHunkStart + nextHunk.oLength);
33024         regionHunks.push(hunks.shift());
33025       }
33026       if (regionHunks.length === 1) {
33027         if (hunk.abLength > 0) {
33028           const buffer = hunk.ab === "a" ? a2 : b2;
33029           results.push({
33030             stable: true,
33031             buffer: hunk.ab,
33032             bufferStart: hunk.abStart,
33033             bufferLength: hunk.abLength,
33034             bufferContent: buffer.slice(hunk.abStart, hunk.abStart + hunk.abLength)
33035           });
33036         }
33037       } else {
33038         let bounds = {
33039           a: [a2.length, -1, o2.length, -1],
33040           b: [b2.length, -1, o2.length, -1]
33041         };
33042         while (regionHunks.length) {
33043           hunk = regionHunks.shift();
33044           const oStart = hunk.oStart;
33045           const oEnd = oStart + hunk.oLength;
33046           const abStart = hunk.abStart;
33047           const abEnd = abStart + hunk.abLength;
33048           let b3 = bounds[hunk.ab];
33049           b3[0] = Math.min(abStart, b3[0]);
33050           b3[1] = Math.max(abEnd, b3[1]);
33051           b3[2] = Math.min(oStart, b3[2]);
33052           b3[3] = Math.max(oEnd, b3[3]);
33053         }
33054         const aStart = bounds.a[0] + (regionStart - bounds.a[2]);
33055         const aEnd = bounds.a[1] + (regionEnd - bounds.a[3]);
33056         const bStart = bounds.b[0] + (regionStart - bounds.b[2]);
33057         const bEnd = bounds.b[1] + (regionEnd - bounds.b[3]);
33058         let result = {
33059           stable: false,
33060           aStart,
33061           aLength: aEnd - aStart,
33062           aContent: a2.slice(aStart, aEnd),
33063           oStart: regionStart,
33064           oLength: regionEnd - regionStart,
33065           oContent: o2.slice(regionStart, regionEnd),
33066           bStart,
33067           bLength: bEnd - bStart,
33068           bContent: b2.slice(bStart, bEnd)
33069         };
33070         results.push(result);
33071       }
33072       currOffset = regionEnd;
33073     }
33074     advanceTo(o2.length);
33075     return results;
33076   }
33077   function diff3Merge(a2, o2, b2, options2) {
33078     let defaults = {
33079       excludeFalseConflicts: true,
33080       stringSeparator: /\s+/
33081     };
33082     options2 = Object.assign(defaults, options2);
33083     if (typeof a2 === "string") a2 = a2.split(options2.stringSeparator);
33084     if (typeof o2 === "string") o2 = o2.split(options2.stringSeparator);
33085     if (typeof b2 === "string") b2 = b2.split(options2.stringSeparator);
33086     let results = [];
33087     const regions = diff3MergeRegions(a2, o2, b2);
33088     let okBuffer = [];
33089     function flushOk() {
33090       if (okBuffer.length) {
33091         results.push({ ok: okBuffer });
33092       }
33093       okBuffer = [];
33094     }
33095     function isFalseConflict(a3, b3) {
33096       if (a3.length !== b3.length) return false;
33097       for (let i3 = 0; i3 < a3.length; i3++) {
33098         if (a3[i3] !== b3[i3]) return false;
33099       }
33100       return true;
33101     }
33102     regions.forEach((region) => {
33103       if (region.stable) {
33104         okBuffer.push(...region.bufferContent);
33105       } else {
33106         if (options2.excludeFalseConflicts && isFalseConflict(region.aContent, region.bContent)) {
33107           okBuffer.push(...region.aContent);
33108         } else {
33109           flushOk();
33110           results.push({
33111             conflict: {
33112               a: region.aContent,
33113               aIndex: region.aStart,
33114               o: region.oContent,
33115               oIndex: region.oStart,
33116               b: region.bContent,
33117               bIndex: region.bStart
33118             }
33119           });
33120         }
33121       }
33122     });
33123     flushOk();
33124     return results;
33125   }
33126
33127   // modules/actions/merge_remote_changes.js
33128   var import_lodash2 = __toESM(require_lodash());
33129   function actionMergeRemoteChanges(id2, localGraph, remoteGraph, discardTags, formatUser) {
33130     discardTags = discardTags || {};
33131     var _option = "safe";
33132     var _conflicts = [];
33133     function user(d2) {
33134       return typeof formatUser === "function" ? formatUser(d2) : (0, import_lodash2.escape)(d2);
33135     }
33136     function mergeLocation(remote, target) {
33137       function pointEqual(a2, b2) {
33138         var epsilon3 = 1e-6;
33139         return Math.abs(a2[0] - b2[0]) < epsilon3 && Math.abs(a2[1] - b2[1]) < epsilon3;
33140       }
33141       if (_option === "force_local" || pointEqual(target.loc, remote.loc)) {
33142         return target;
33143       }
33144       if (_option === "force_remote") {
33145         return target.update({ loc: remote.loc });
33146       }
33147       _conflicts.push(_t.html("merge_remote_changes.conflict.location", { user: { html: user(remote.user) } }));
33148       return target;
33149     }
33150     function mergeNodes(base, remote, target) {
33151       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.nodes, remote.nodes)) {
33152         return target;
33153       }
33154       if (_option === "force_remote") {
33155         return target.update({ nodes: remote.nodes });
33156       }
33157       var ccount = _conflicts.length;
33158       var o2 = base.nodes || [];
33159       var a2 = target.nodes || [];
33160       var b2 = remote.nodes || [];
33161       var nodes = [];
33162       var hunks = diff3Merge(a2, o2, b2, { excludeFalseConflicts: true });
33163       for (var i3 = 0; i3 < hunks.length; i3++) {
33164         var hunk = hunks[i3];
33165         if (hunk.ok) {
33166           nodes.push.apply(nodes, hunk.ok);
33167         } else {
33168           var c2 = hunk.conflict;
33169           if ((0, import_fast_deep_equal.default)(c2.o, c2.a)) {
33170             nodes.push.apply(nodes, c2.b);
33171           } else if ((0, import_fast_deep_equal.default)(c2.o, c2.b)) {
33172             nodes.push.apply(nodes, c2.a);
33173           } else {
33174             _conflicts.push(_t.html("merge_remote_changes.conflict.nodelist", { user: { html: user(remote.user) } }));
33175             break;
33176           }
33177         }
33178       }
33179       return _conflicts.length === ccount ? target.update({ nodes }) : target;
33180     }
33181     function mergeChildren(targetWay, children2, updates, graph) {
33182       function isUsed(node2, targetWay2) {
33183         var hasInterestingParent = graph.parentWays(node2).some(function(way) {
33184           return way.id !== targetWay2.id;
33185         });
33186         return node2.hasInterestingTags() || hasInterestingParent || graph.parentRelations(node2).length > 0;
33187       }
33188       var ccount = _conflicts.length;
33189       for (var i3 = 0; i3 < children2.length; i3++) {
33190         var id3 = children2[i3];
33191         var node = graph.hasEntity(id3);
33192         if (targetWay.nodes.indexOf(id3) === -1) {
33193           if (node && !isUsed(node, targetWay)) {
33194             updates.removeIds.push(id3);
33195           }
33196           continue;
33197         }
33198         var local = localGraph.hasEntity(id3);
33199         var remote = remoteGraph.hasEntity(id3);
33200         var target;
33201         if (_option === "force_remote" && remote && remote.visible) {
33202           updates.replacements.push(remote);
33203         } else if (_option === "force_local" && local) {
33204           target = osmEntity(local);
33205           if (remote) {
33206             target = target.update({ version: remote.version });
33207           }
33208           updates.replacements.push(target);
33209         } else if (_option === "safe" && local && remote && local.version !== remote.version) {
33210           target = osmEntity(local, { version: remote.version });
33211           if (remote.visible) {
33212             target = mergeLocation(remote, target);
33213           } else {
33214             _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
33215           }
33216           if (_conflicts.length !== ccount) break;
33217           updates.replacements.push(target);
33218         }
33219       }
33220       return targetWay;
33221     }
33222     function updateChildren(updates, graph) {
33223       for (var i3 = 0; i3 < updates.replacements.length; i3++) {
33224         graph = graph.replace(updates.replacements[i3]);
33225       }
33226       if (updates.removeIds.length) {
33227         graph = actionDeleteMultiple(updates.removeIds)(graph);
33228       }
33229       return graph;
33230     }
33231     function mergeMembers(remote, target) {
33232       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.members, remote.members)) {
33233         return target;
33234       }
33235       if (_option === "force_remote") {
33236         return target.update({ members: remote.members });
33237       }
33238       _conflicts.push(_t.html("merge_remote_changes.conflict.memberlist", { user: { html: user(remote.user) } }));
33239       return target;
33240     }
33241     function mergeTags(base, remote, target) {
33242       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.tags, remote.tags)) {
33243         return target;
33244       }
33245       if (_option === "force_remote") {
33246         return target.update({ tags: remote.tags });
33247       }
33248       var ccount = _conflicts.length;
33249       var o2 = base.tags || {};
33250       var a2 = target.tags || {};
33251       var b2 = remote.tags || {};
33252       var keys2 = utilArrayUnion(utilArrayUnion(Object.keys(o2), Object.keys(a2)), Object.keys(b2)).filter(function(k3) {
33253         return !discardTags[k3];
33254       });
33255       var tags = Object.assign({}, a2);
33256       var changed = false;
33257       for (var i3 = 0; i3 < keys2.length; i3++) {
33258         var k2 = keys2[i3];
33259         if (o2[k2] !== b2[k2] && a2[k2] !== b2[k2]) {
33260           if (o2[k2] !== a2[k2]) {
33261             _conflicts.push(_t.html(
33262               "merge_remote_changes.conflict.tags",
33263               { tag: k2, local: a2[k2], remote: b2[k2], user: { html: user(remote.user) } }
33264             ));
33265           } else {
33266             if (b2.hasOwnProperty(k2)) {
33267               tags[k2] = b2[k2];
33268             } else {
33269               delete tags[k2];
33270             }
33271             changed = true;
33272           }
33273         }
33274       }
33275       return changed && _conflicts.length === ccount ? target.update({ tags }) : target;
33276     }
33277     var action = function(graph) {
33278       var updates = { replacements: [], removeIds: [] };
33279       var base = graph.base().entities[id2];
33280       var local = localGraph.entity(id2);
33281       var remote = remoteGraph.entity(id2);
33282       var target = osmEntity(local, { version: remote.version });
33283       if (!remote.visible) {
33284         if (_option === "force_remote") {
33285           return actionDeleteMultiple([id2])(graph);
33286         } else if (_option === "force_local") {
33287           if (target.type === "way") {
33288             target = mergeChildren(target, utilArrayUniq(local.nodes), updates, graph);
33289             graph = updateChildren(updates, graph);
33290           }
33291           return graph.replace(target);
33292         } else {
33293           _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
33294           return graph;
33295         }
33296       }
33297       if (target.type === "node") {
33298         target = mergeLocation(remote, target);
33299       } else if (target.type === "way") {
33300         graph.rebase(remoteGraph.childNodes(remote), [graph], false);
33301         target = mergeNodes(base, remote, target);
33302         target = mergeChildren(target, utilArrayUnion(local.nodes, remote.nodes), updates, graph);
33303       } else if (target.type === "relation") {
33304         target = mergeMembers(remote, target);
33305       }
33306       target = mergeTags(base, remote, target);
33307       if (!_conflicts.length) {
33308         graph = updateChildren(updates, graph).replace(target);
33309       }
33310       return graph;
33311     };
33312     action.withOption = function(opt) {
33313       _option = opt;
33314       return action;
33315     };
33316     action.conflicts = function() {
33317       return _conflicts;
33318     };
33319     return action;
33320   }
33321
33322   // modules/actions/move.js
33323   function actionMove(moveIDs, tryDelta, projection2, cache) {
33324     var _delta = tryDelta;
33325     function setupCache(graph) {
33326       function canMove(nodeID) {
33327         if (moveIDs.indexOf(nodeID) !== -1) return true;
33328         var parents = graph.parentWays(graph.entity(nodeID));
33329         if (parents.length < 3) return true;
33330         var parentsMoving = parents.every(function(way) {
33331           return cache.moving[way.id];
33332         });
33333         if (!parentsMoving) delete cache.moving[nodeID];
33334         return parentsMoving;
33335       }
33336       function cacheEntities(ids) {
33337         for (var i3 = 0; i3 < ids.length; i3++) {
33338           var id2 = ids[i3];
33339           if (cache.moving[id2]) continue;
33340           cache.moving[id2] = true;
33341           var entity = graph.hasEntity(id2);
33342           if (!entity) continue;
33343           if (entity.type === "node") {
33344             cache.nodes.push(id2);
33345             cache.startLoc[id2] = entity.loc;
33346           } else if (entity.type === "way") {
33347             cache.ways.push(id2);
33348             cacheEntities(entity.nodes);
33349           } else {
33350             cacheEntities(entity.members.map(function(member) {
33351               return member.id;
33352             }));
33353           }
33354         }
33355       }
33356       function cacheIntersections(ids) {
33357         function isEndpoint(way2, id3) {
33358           return !way2.isClosed() && !!way2.affix(id3);
33359         }
33360         for (var i3 = 0; i3 < ids.length; i3++) {
33361           var id2 = ids[i3];
33362           var childNodes = graph.childNodes(graph.entity(id2));
33363           for (var j2 = 0; j2 < childNodes.length; j2++) {
33364             var node = childNodes[j2];
33365             var parents = graph.parentWays(node);
33366             if (parents.length !== 2) continue;
33367             var moved = graph.entity(id2);
33368             var unmoved = null;
33369             for (var k2 = 0; k2 < parents.length; k2++) {
33370               var way = parents[k2];
33371               if (!cache.moving[way.id]) {
33372                 unmoved = way;
33373                 break;
33374               }
33375             }
33376             if (!unmoved) continue;
33377             if (utilArrayIntersection(moved.nodes, unmoved.nodes).length > 2) continue;
33378             if (moved.isArea() || unmoved.isArea()) continue;
33379             cache.intersections.push({
33380               nodeId: node.id,
33381               movedId: moved.id,
33382               unmovedId: unmoved.id,
33383               movedIsEP: isEndpoint(moved, node.id),
33384               unmovedIsEP: isEndpoint(unmoved, node.id)
33385             });
33386           }
33387         }
33388       }
33389       if (!cache) {
33390         cache = {};
33391       }
33392       if (!cache.ok) {
33393         cache.moving = {};
33394         cache.intersections = [];
33395         cache.replacedVertex = {};
33396         cache.startLoc = {};
33397         cache.nodes = [];
33398         cache.ways = [];
33399         cacheEntities(moveIDs);
33400         cacheIntersections(cache.ways);
33401         cache.nodes = cache.nodes.filter(canMove);
33402         cache.ok = true;
33403       }
33404     }
33405     function replaceMovedVertex(nodeId, wayId, graph, delta) {
33406       var way = graph.entity(wayId);
33407       var moved = graph.entity(nodeId);
33408       var movedIndex = way.nodes.indexOf(nodeId);
33409       var len, prevIndex, nextIndex;
33410       if (way.isClosed()) {
33411         len = way.nodes.length - 1;
33412         prevIndex = (movedIndex + len - 1) % len;
33413         nextIndex = (movedIndex + len + 1) % len;
33414       } else {
33415         len = way.nodes.length;
33416         prevIndex = movedIndex - 1;
33417         nextIndex = movedIndex + 1;
33418       }
33419       var prev = graph.hasEntity(way.nodes[prevIndex]);
33420       var next = graph.hasEntity(way.nodes[nextIndex]);
33421       if (!prev || !next) return graph;
33422       var key = wayId + "_" + nodeId;
33423       var orig = cache.replacedVertex[key];
33424       if (!orig) {
33425         orig = osmNode();
33426         cache.replacedVertex[key] = orig;
33427         cache.startLoc[orig.id] = cache.startLoc[nodeId];
33428       }
33429       var start2, end;
33430       if (delta) {
33431         start2 = projection2(cache.startLoc[nodeId]);
33432         end = projection2.invert(geoVecAdd(start2, delta));
33433       } else {
33434         end = cache.startLoc[nodeId];
33435       }
33436       orig = orig.move(end);
33437       var angle2 = Math.abs(geoAngle(orig, prev, projection2) - geoAngle(orig, next, projection2)) * 180 / Math.PI;
33438       if (angle2 > 175 && angle2 < 185) return graph;
33439       var p1 = [prev.loc, orig.loc, moved.loc, next.loc].map(projection2);
33440       var p2 = [prev.loc, moved.loc, orig.loc, next.loc].map(projection2);
33441       var d1 = geoPathLength(p1);
33442       var d2 = geoPathLength(p2);
33443       var insertAt = d1 <= d2 ? movedIndex : nextIndex;
33444       if (way.isClosed() && insertAt === 0) insertAt = len;
33445       way = way.addNode(orig.id, insertAt);
33446       return graph.replace(orig).replace(way);
33447     }
33448     function removeDuplicateVertices(wayId, graph) {
33449       var way = graph.entity(wayId);
33450       var epsilon3 = 1e-6;
33451       var prev, curr;
33452       function isInteresting(node, graph2) {
33453         return graph2.parentWays(node).length > 1 || graph2.parentRelations(node).length || node.hasInterestingTags();
33454       }
33455       for (var i3 = 0; i3 < way.nodes.length; i3++) {
33456         curr = graph.entity(way.nodes[i3]);
33457         if (prev && curr && geoVecEqual(prev.loc, curr.loc, epsilon3)) {
33458           if (!isInteresting(prev, graph)) {
33459             way = way.removeNode(prev.id);
33460             graph = graph.replace(way).remove(prev);
33461           } else if (!isInteresting(curr, graph)) {
33462             way = way.removeNode(curr.id);
33463             graph = graph.replace(way).remove(curr);
33464           }
33465         }
33466         prev = curr;
33467       }
33468       return graph;
33469     }
33470     function unZorroIntersection(intersection2, graph) {
33471       var vertex = graph.entity(intersection2.nodeId);
33472       var way1 = graph.entity(intersection2.movedId);
33473       var way2 = graph.entity(intersection2.unmovedId);
33474       var isEP1 = intersection2.movedIsEP;
33475       var isEP2 = intersection2.unmovedIsEP;
33476       if (isEP1 && isEP2) return graph;
33477       var nodes1 = graph.childNodes(way1).filter(function(n3) {
33478         return n3 !== vertex;
33479       });
33480       var nodes2 = graph.childNodes(way2).filter(function(n3) {
33481         return n3 !== vertex;
33482       });
33483       if (way1.isClosed() && way1.first() === vertex.id) nodes1.push(nodes1[0]);
33484       if (way2.isClosed() && way2.first() === vertex.id) nodes2.push(nodes2[0]);
33485       var edge1 = !isEP1 && geoChooseEdge(nodes1, projection2(vertex.loc), projection2);
33486       var edge2 = !isEP2 && geoChooseEdge(nodes2, projection2(vertex.loc), projection2);
33487       var loc;
33488       if (!isEP1 && !isEP2) {
33489         var epsilon3 = 1e-6, maxIter = 10;
33490         for (var i3 = 0; i3 < maxIter; i3++) {
33491           loc = geoVecInterp(edge1.loc, edge2.loc, 0.5);
33492           edge1 = geoChooseEdge(nodes1, projection2(loc), projection2);
33493           edge2 = geoChooseEdge(nodes2, projection2(loc), projection2);
33494           if (Math.abs(edge1.distance - edge2.distance) < epsilon3) break;
33495         }
33496       } else if (!isEP1) {
33497         loc = edge1.loc;
33498       } else {
33499         loc = edge2.loc;
33500       }
33501       graph = graph.replace(vertex.move(loc));
33502       if (!isEP1 && edge1.index !== way1.nodes.indexOf(vertex.id)) {
33503         way1 = way1.removeNode(vertex.id).addNode(vertex.id, edge1.index);
33504         graph = graph.replace(way1);
33505       }
33506       if (!isEP2 && edge2.index !== way2.nodes.indexOf(vertex.id)) {
33507         way2 = way2.removeNode(vertex.id).addNode(vertex.id, edge2.index);
33508         graph = graph.replace(way2);
33509       }
33510       return graph;
33511     }
33512     function cleanupIntersections(graph) {
33513       for (var i3 = 0; i3 < cache.intersections.length; i3++) {
33514         var obj = cache.intersections[i3];
33515         graph = replaceMovedVertex(obj.nodeId, obj.movedId, graph, _delta);
33516         graph = replaceMovedVertex(obj.nodeId, obj.unmovedId, graph, null);
33517         graph = unZorroIntersection(obj, graph);
33518         graph = removeDuplicateVertices(obj.movedId, graph);
33519         graph = removeDuplicateVertices(obj.unmovedId, graph);
33520       }
33521       return graph;
33522     }
33523     function limitDelta(graph) {
33524       function moveNode(loc) {
33525         return geoVecAdd(projection2(loc), _delta);
33526       }
33527       for (var i3 = 0; i3 < cache.intersections.length; i3++) {
33528         var obj = cache.intersections[i3];
33529         if (obj.movedIsEP && obj.unmovedIsEP) continue;
33530         if (!obj.movedIsEP) continue;
33531         var node = graph.entity(obj.nodeId);
33532         var start2 = projection2(node.loc);
33533         var end = geoVecAdd(start2, _delta);
33534         var movedNodes = graph.childNodes(graph.entity(obj.movedId));
33535         var movedPath = movedNodes.map(function(n3) {
33536           return moveNode(n3.loc);
33537         });
33538         var unmovedNodes = graph.childNodes(graph.entity(obj.unmovedId));
33539         var unmovedPath = unmovedNodes.map(function(n3) {
33540           return projection2(n3.loc);
33541         });
33542         var hits = geoPathIntersections(movedPath, unmovedPath);
33543         for (var j2 = 0; i3 < hits.length; i3++) {
33544           if (geoVecEqual(hits[j2], end)) continue;
33545           var edge = geoChooseEdge(unmovedNodes, end, projection2);
33546           _delta = geoVecSubtract(projection2(edge.loc), start2);
33547         }
33548       }
33549     }
33550     var action = function(graph) {
33551       if (_delta[0] === 0 && _delta[1] === 0) return graph;
33552       setupCache(graph);
33553       if (cache.intersections.length) {
33554         limitDelta(graph);
33555       }
33556       for (var i3 = 0; i3 < cache.nodes.length; i3++) {
33557         var node = graph.entity(cache.nodes[i3]);
33558         var start2 = projection2(node.loc);
33559         var end = geoVecAdd(start2, _delta);
33560         graph = graph.replace(node.move(projection2.invert(end)));
33561       }
33562       if (cache.intersections.length) {
33563         graph = cleanupIntersections(graph);
33564       }
33565       return graph;
33566     };
33567     action.delta = function() {
33568       return _delta;
33569     };
33570     return action;
33571   }
33572
33573   // modules/actions/move_member.js
33574   function actionMoveMember(relationId, fromIndex, toIndex) {
33575     return function(graph) {
33576       return graph.replace(graph.entity(relationId).moveMember(fromIndex, toIndex));
33577     };
33578   }
33579
33580   // modules/actions/move_node.js
33581   function actionMoveNode(nodeID, toLoc) {
33582     var action = function(graph, t2) {
33583       if (t2 === null || !isFinite(t2)) t2 = 1;
33584       t2 = Math.min(Math.max(+t2, 0), 1);
33585       var node = graph.entity(nodeID);
33586       return graph.replace(
33587         node.move(geoVecInterp(node.loc, toLoc, t2))
33588       );
33589     };
33590     action.transitionable = true;
33591     return action;
33592   }
33593
33594   // modules/actions/noop.js
33595   function actionNoop() {
33596     return function(graph) {
33597       return graph;
33598     };
33599   }
33600
33601   // modules/actions/orthogonalize.js
33602   function actionOrthogonalize(wayID, projection2, vertexID, degThresh, ep) {
33603     var epsilon3 = ep || 1e-4;
33604     var threshold = degThresh || 13;
33605     var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
33606     var upperThreshold = Math.cos(threshold * Math.PI / 180);
33607     var action = function(graph, t2) {
33608       if (t2 === null || !isFinite(t2)) t2 = 1;
33609       t2 = Math.min(Math.max(+t2, 0), 1);
33610       var way = graph.entity(wayID);
33611       way = way.removeNode("");
33612       if (way.tags.nonsquare) {
33613         var tags = Object.assign({}, way.tags);
33614         delete tags.nonsquare;
33615         way = way.update({ tags });
33616       }
33617       graph = graph.replace(way);
33618       var isClosed = way.isClosed();
33619       var nodes = graph.childNodes(way).slice();
33620       if (isClosed) nodes.pop();
33621       if (vertexID !== void 0) {
33622         nodes = nodeSubset(nodes, vertexID, isClosed);
33623         if (nodes.length !== 3) return graph;
33624       }
33625       var nodeCount = {};
33626       var points = [];
33627       var corner = { i: 0, dotp: 1 };
33628       var node, point, loc, score, motions, i3, j2;
33629       for (i3 = 0; i3 < nodes.length; i3++) {
33630         node = nodes[i3];
33631         nodeCount[node.id] = (nodeCount[node.id] || 0) + 1;
33632         points.push({ id: node.id, coord: projection2(node.loc) });
33633       }
33634       if (points.length === 3) {
33635         for (i3 = 0; i3 < 1e3; i3++) {
33636           motions = points.map(calcMotion);
33637           points[corner.i].coord = geoVecAdd(points[corner.i].coord, motions[corner.i]);
33638           score = corner.dotp;
33639           if (score < epsilon3) {
33640             break;
33641           }
33642         }
33643         node = graph.entity(nodes[corner.i].id);
33644         loc = projection2.invert(points[corner.i].coord);
33645         graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
33646       } else {
33647         var straights = [];
33648         var simplified = [];
33649         for (i3 = 0; i3 < points.length; i3++) {
33650           point = points[i3];
33651           var dotp = 0;
33652           if (isClosed || i3 > 0 && i3 < points.length - 1) {
33653             var a2 = points[(i3 - 1 + points.length) % points.length];
33654             var b2 = points[(i3 + 1) % points.length];
33655             dotp = Math.abs(geoOrthoNormalizedDotProduct(a2.coord, b2.coord, point.coord));
33656           }
33657           if (dotp > upperThreshold) {
33658             straights.push(point);
33659           } else {
33660             simplified.push(point);
33661           }
33662         }
33663         var bestPoints = clonePoints(simplified);
33664         var originalPoints = clonePoints(simplified);
33665         score = Infinity;
33666         for (i3 = 0; i3 < 1e3; i3++) {
33667           motions = simplified.map(calcMotion);
33668           for (j2 = 0; j2 < motions.length; j2++) {
33669             simplified[j2].coord = geoVecAdd(simplified[j2].coord, motions[j2]);
33670           }
33671           var newScore = geoOrthoCalcScore(simplified, isClosed, epsilon3, threshold);
33672           if (newScore < score) {
33673             bestPoints = clonePoints(simplified);
33674             score = newScore;
33675           }
33676           if (score < epsilon3) {
33677             break;
33678           }
33679         }
33680         var bestCoords = bestPoints.map(function(p2) {
33681           return p2.coord;
33682         });
33683         if (isClosed) bestCoords.push(bestCoords[0]);
33684         for (i3 = 0; i3 < bestPoints.length; i3++) {
33685           point = bestPoints[i3];
33686           if (!geoVecEqual(originalPoints[i3].coord, point.coord)) {
33687             node = graph.entity(point.id);
33688             loc = projection2.invert(point.coord);
33689             graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
33690           }
33691         }
33692         for (i3 = 0; i3 < straights.length; i3++) {
33693           point = straights[i3];
33694           if (nodeCount[point.id] > 1) continue;
33695           node = graph.entity(point.id);
33696           if (t2 === 1 && graph.parentWays(node).length === 1 && graph.parentRelations(node).length === 0 && !node.hasInterestingTags()) {
33697             graph = actionDeleteNode(node.id)(graph);
33698           } else {
33699             var choice = geoVecProject(point.coord, bestCoords);
33700             if (choice) {
33701               loc = projection2.invert(choice.target);
33702               graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
33703             }
33704           }
33705         }
33706       }
33707       return graph;
33708       function clonePoints(array2) {
33709         return array2.map(function(p2) {
33710           return { id: p2.id, coord: [p2.coord[0], p2.coord[1]] };
33711         });
33712       }
33713       function calcMotion(point2, i4, array2) {
33714         if (!isClosed && (i4 === 0 || i4 === array2.length - 1)) return [0, 0];
33715         if (nodeCount[array2[i4].id] > 1) return [0, 0];
33716         var a3 = array2[(i4 - 1 + array2.length) % array2.length].coord;
33717         var origin = point2.coord;
33718         var b3 = array2[(i4 + 1) % array2.length].coord;
33719         var p2 = geoVecSubtract(a3, origin);
33720         var q2 = geoVecSubtract(b3, origin);
33721         var scale = 2 * Math.min(geoVecLength(p2), geoVecLength(q2));
33722         p2 = geoVecNormalize(p2);
33723         q2 = geoVecNormalize(q2);
33724         var dotp2 = p2[0] * q2[0] + p2[1] * q2[1];
33725         var val = Math.abs(dotp2);
33726         if (val < lowerThreshold) {
33727           corner.i = i4;
33728           corner.dotp = val;
33729           var vec = geoVecNormalize(geoVecAdd(p2, q2));
33730           return geoVecScale(vec, 0.1 * dotp2 * scale);
33731         }
33732         return [0, 0];
33733       }
33734     };
33735     function nodeSubset(nodes, vertexID2, isClosed) {
33736       var first = isClosed ? 0 : 1;
33737       var last = isClosed ? nodes.length : nodes.length - 1;
33738       for (var i3 = first; i3 < last; i3++) {
33739         if (nodes[i3].id === vertexID2) {
33740           return [
33741             nodes[(i3 - 1 + nodes.length) % nodes.length],
33742             nodes[i3],
33743             nodes[(i3 + 1) % nodes.length]
33744           ];
33745         }
33746       }
33747       return [];
33748     }
33749     action.disabled = function(graph) {
33750       var way = graph.entity(wayID);
33751       way = way.removeNode("");
33752       graph = graph.replace(way);
33753       var isClosed = way.isClosed();
33754       var nodes = graph.childNodes(way).slice();
33755       if (isClosed) nodes.pop();
33756       var allowStraightAngles = false;
33757       if (vertexID !== void 0) {
33758         allowStraightAngles = true;
33759         nodes = nodeSubset(nodes, vertexID, isClosed);
33760         if (nodes.length !== 3) return "end_vertex";
33761       }
33762       var coords = nodes.map(function(n3) {
33763         return projection2(n3.loc);
33764       });
33765       var score = geoOrthoCanOrthogonalize(coords, isClosed, epsilon3, threshold, allowStraightAngles);
33766       if (score === null) {
33767         return "not_squarish";
33768       } else if (score === 0) {
33769         return "square_enough";
33770       } else {
33771         return false;
33772       }
33773     };
33774     action.transitionable = true;
33775     return action;
33776   }
33777
33778   // modules/actions/restrict_turn.js
33779   function actionRestrictTurn(turn, restrictionType, restrictionID) {
33780     return function(graph) {
33781       var fromWay = graph.entity(turn.from.way);
33782       var toWay = graph.entity(turn.to.way);
33783       var viaNode = turn.via.node && graph.entity(turn.via.node);
33784       var viaWays = turn.via.ways && turn.via.ways.map(function(id2) {
33785         return graph.entity(id2);
33786       });
33787       var members = [];
33788       members.push({ id: fromWay.id, type: "way", role: "from" });
33789       if (viaNode) {
33790         members.push({ id: viaNode.id, type: "node", role: "via" });
33791       } else if (viaWays) {
33792         viaWays.forEach(function(viaWay) {
33793           members.push({ id: viaWay.id, type: "way", role: "via" });
33794         });
33795       }
33796       members.push({ id: toWay.id, type: "way", role: "to" });
33797       return graph.replace(osmRelation({
33798         id: restrictionID,
33799         tags: {
33800           type: "restriction",
33801           restriction: restrictionType
33802         },
33803         members
33804       }));
33805     };
33806   }
33807
33808   // modules/actions/revert.js
33809   function actionRevert(id2) {
33810     var action = function(graph) {
33811       var entity = graph.hasEntity(id2), base = graph.base().entities[id2];
33812       if (entity && !base) {
33813         if (entity.type === "node") {
33814           graph.parentWays(entity).forEach(function(parent) {
33815             parent = parent.removeNode(id2);
33816             graph = graph.replace(parent);
33817             if (parent.isDegenerate()) {
33818               graph = actionDeleteWay(parent.id)(graph);
33819             }
33820           });
33821         }
33822         graph.parentRelations(entity).forEach(function(parent) {
33823           parent = parent.removeMembersWithID(id2);
33824           graph = graph.replace(parent);
33825           if (parent.isDegenerate()) {
33826             graph = actionDeleteRelation(parent.id)(graph);
33827           }
33828         });
33829       }
33830       return graph.revert(id2);
33831     };
33832     return action;
33833   }
33834
33835   // modules/actions/rotate.js
33836   function actionRotate(rotateIds, pivot, angle2, projection2) {
33837     var action = function(graph) {
33838       return graph.update(function(graph2) {
33839         utilGetAllNodes(rotateIds, graph2).forEach(function(node) {
33840           var point = geoRotate([projection2(node.loc)], angle2, pivot)[0];
33841           graph2 = graph2.replace(node.move(projection2.invert(point)));
33842         });
33843       });
33844     };
33845     return action;
33846   }
33847
33848   // modules/actions/scale.js
33849   function actionScale(ids, pivotLoc, scaleFactor, projection2) {
33850     return function(graph) {
33851       return graph.update(function(graph2) {
33852         let point, radial;
33853         utilGetAllNodes(ids, graph2).forEach(function(node) {
33854           point = projection2(node.loc);
33855           radial = [
33856             point[0] - pivotLoc[0],
33857             point[1] - pivotLoc[1]
33858           ];
33859           point = [
33860             pivotLoc[0] + scaleFactor * radial[0],
33861             pivotLoc[1] + scaleFactor * radial[1]
33862           ];
33863           graph2 = graph2.replace(node.move(projection2.invert(point)));
33864         });
33865       });
33866     };
33867   }
33868
33869   // modules/actions/straighten_nodes.js
33870   function actionStraightenNodes(nodeIDs, projection2) {
33871     function positionAlongWay(a2, o2, b2) {
33872       return geoVecDot(a2, b2, o2) / geoVecDot(b2, b2, o2);
33873     }
33874     function getEndpoints(points) {
33875       var ssr = geoGetSmallestSurroundingRectangle(points);
33876       var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
33877       var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
33878       var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
33879       var q2 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
33880       var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q2);
33881       if (isLong) {
33882         return [p1, q1];
33883       }
33884       return [p2, q2];
33885     }
33886     var action = function(graph, t2) {
33887       if (t2 === null || !isFinite(t2)) t2 = 1;
33888       t2 = Math.min(Math.max(+t2, 0), 1);
33889       var nodes = nodeIDs.map(function(id2) {
33890         return graph.entity(id2);
33891       });
33892       var points = nodes.map(function(n3) {
33893         return projection2(n3.loc);
33894       });
33895       var endpoints = getEndpoints(points);
33896       var startPoint = endpoints[0];
33897       var endPoint = endpoints[1];
33898       for (var i3 = 0; i3 < points.length; i3++) {
33899         var node = nodes[i3];
33900         var point = points[i3];
33901         var u2 = positionAlongWay(point, startPoint, endPoint);
33902         var point2 = geoVecInterp(startPoint, endPoint, u2);
33903         var loc2 = projection2.invert(point2);
33904         graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t2)));
33905       }
33906       return graph;
33907     };
33908     action.disabled = function(graph) {
33909       var nodes = nodeIDs.map(function(id2) {
33910         return graph.entity(id2);
33911       });
33912       var points = nodes.map(function(n3) {
33913         return projection2(n3.loc);
33914       });
33915       var endpoints = getEndpoints(points);
33916       var startPoint = endpoints[0];
33917       var endPoint = endpoints[1];
33918       var maxDistance = 0;
33919       for (var i3 = 0; i3 < points.length; i3++) {
33920         var point = points[i3];
33921         var u2 = positionAlongWay(point, startPoint, endPoint);
33922         var p2 = geoVecInterp(startPoint, endPoint, u2);
33923         var dist = geoVecLength(p2, point);
33924         if (!isNaN(dist) && dist > maxDistance) {
33925           maxDistance = dist;
33926         }
33927       }
33928       if (maxDistance < 1e-4) {
33929         return "straight_enough";
33930       }
33931     };
33932     action.transitionable = true;
33933     return action;
33934   }
33935
33936   // modules/actions/straighten_way.js
33937   function actionStraightenWay(selectedIDs, projection2) {
33938     function positionAlongWay(a2, o2, b2) {
33939       return geoVecDot(a2, b2, o2) / geoVecDot(b2, b2, o2);
33940     }
33941     function allNodes(graph) {
33942       var nodes = [];
33943       var startNodes = [];
33944       var endNodes = [];
33945       var remainingWays = [];
33946       var selectedWays = selectedIDs.filter(function(w2) {
33947         return graph.entity(w2).type === "way";
33948       });
33949       var selectedNodes = selectedIDs.filter(function(n3) {
33950         return graph.entity(n3).type === "node";
33951       });
33952       for (var i3 = 0; i3 < selectedWays.length; i3++) {
33953         var way = graph.entity(selectedWays[i3]);
33954         nodes = way.nodes.slice(0);
33955         remainingWays.push(nodes);
33956         startNodes.push(nodes[0]);
33957         endNodes.push(nodes[nodes.length - 1]);
33958       }
33959       startNodes = startNodes.filter(function(n3) {
33960         return startNodes.indexOf(n3) === startNodes.lastIndexOf(n3);
33961       });
33962       endNodes = endNodes.filter(function(n3) {
33963         return endNodes.indexOf(n3) === endNodes.lastIndexOf(n3);
33964       });
33965       var currNode = utilArrayDifference(startNodes, endNodes).concat(utilArrayDifference(endNodes, startNodes))[0];
33966       var nextWay = [];
33967       nodes = [];
33968       var getNextWay = function(currNode2, remainingWays2) {
33969         return remainingWays2.filter(function(way2) {
33970           return way2[0] === currNode2 || way2[way2.length - 1] === currNode2;
33971         })[0];
33972       };
33973       while (remainingWays.length) {
33974         nextWay = getNextWay(currNode, remainingWays);
33975         remainingWays = utilArrayDifference(remainingWays, [nextWay]);
33976         if (nextWay[0] !== currNode) {
33977           nextWay.reverse();
33978         }
33979         nodes = nodes.concat(nextWay);
33980         currNode = nodes[nodes.length - 1];
33981       }
33982       if (selectedNodes.length === 2) {
33983         var startNodeIdx = nodes.indexOf(selectedNodes[0]);
33984         var endNodeIdx = nodes.indexOf(selectedNodes[1]);
33985         var sortedStartEnd = [startNodeIdx, endNodeIdx];
33986         sortedStartEnd.sort(function(a2, b2) {
33987           return a2 - b2;
33988         });
33989         nodes = nodes.slice(sortedStartEnd[0], sortedStartEnd[1] + 1);
33990       }
33991       return nodes.map(function(n3) {
33992         return graph.entity(n3);
33993       });
33994     }
33995     function shouldKeepNode(node, graph) {
33996       return graph.parentWays(node).length > 1 || graph.parentRelations(node).length || node.hasInterestingTags();
33997     }
33998     var action = function(graph, t2) {
33999       if (t2 === null || !isFinite(t2)) t2 = 1;
34000       t2 = Math.min(Math.max(+t2, 0), 1);
34001       var nodes = allNodes(graph);
34002       var points = nodes.map(function(n3) {
34003         return projection2(n3.loc);
34004       });
34005       var startPoint = points[0];
34006       var endPoint = points[points.length - 1];
34007       var toDelete = [];
34008       var i3;
34009       for (i3 = 1; i3 < points.length - 1; i3++) {
34010         var node = nodes[i3];
34011         var point = points[i3];
34012         if (t2 < 1 || shouldKeepNode(node, graph)) {
34013           var u2 = positionAlongWay(point, startPoint, endPoint);
34014           var p2 = geoVecInterp(startPoint, endPoint, u2);
34015           var loc2 = projection2.invert(p2);
34016           graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t2)));
34017         } else {
34018           if (toDelete.indexOf(node) === -1) {
34019             toDelete.push(node);
34020           }
34021         }
34022       }
34023       for (i3 = 0; i3 < toDelete.length; i3++) {
34024         graph = actionDeleteNode(toDelete[i3].id)(graph);
34025       }
34026       return graph;
34027     };
34028     action.disabled = function(graph) {
34029       var nodes = allNodes(graph);
34030       var points = nodes.map(function(n3) {
34031         return projection2(n3.loc);
34032       });
34033       var startPoint = points[0];
34034       var endPoint = points[points.length - 1];
34035       var threshold = 0.2 * geoVecLength(startPoint, endPoint);
34036       var i3;
34037       if (threshold === 0) {
34038         return "too_bendy";
34039       }
34040       var maxDistance = 0;
34041       for (i3 = 1; i3 < points.length - 1; i3++) {
34042         var point = points[i3];
34043         var u2 = positionAlongWay(point, startPoint, endPoint);
34044         var p2 = geoVecInterp(startPoint, endPoint, u2);
34045         var dist = geoVecLength(p2, point);
34046         if (isNaN(dist) || dist > threshold) {
34047           return "too_bendy";
34048         } else if (dist > maxDistance) {
34049           maxDistance = dist;
34050         }
34051       }
34052       var keepingAllNodes = nodes.every(function(node, i4) {
34053         return i4 === 0 || i4 === nodes.length - 1 || shouldKeepNode(node, graph);
34054       });
34055       if (maxDistance < 1e-4 && // Allow straightening even if already straight in order to remove extraneous nodes
34056       keepingAllNodes) {
34057         return "straight_enough";
34058       }
34059     };
34060     action.transitionable = true;
34061     return action;
34062   }
34063
34064   // modules/actions/unrestrict_turn.js
34065   function actionUnrestrictTurn(turn) {
34066     return function(graph) {
34067       return actionDeleteRelation(turn.restrictionID)(graph);
34068     };
34069   }
34070
34071   // modules/actions/reflect.js
34072   function actionReflect(reflectIds, projection2) {
34073     var _useLongAxis = true;
34074     var action = function(graph, t2) {
34075       if (t2 === null || !isFinite(t2)) t2 = 1;
34076       t2 = Math.min(Math.max(+t2, 0), 1);
34077       var nodes = utilGetAllNodes(reflectIds, graph);
34078       var points = nodes.map(function(n3) {
34079         return projection2(n3.loc);
34080       });
34081       var ssr = geoGetSmallestSurroundingRectangle(points);
34082       var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
34083       var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
34084       var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
34085       var q2 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
34086       var p3, q3;
34087       var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q2);
34088       if (_useLongAxis && isLong || !_useLongAxis && !isLong) {
34089         p3 = p1;
34090         q3 = q1;
34091       } else {
34092         p3 = p2;
34093         q3 = q2;
34094       }
34095       var dx = q3[0] - p3[0];
34096       var dy = q3[1] - p3[1];
34097       var a2 = (dx * dx - dy * dy) / (dx * dx + dy * dy);
34098       var b2 = 2 * dx * dy / (dx * dx + dy * dy);
34099       for (var i3 = 0; i3 < nodes.length; i3++) {
34100         var node = nodes[i3];
34101         var c2 = projection2(node.loc);
34102         var c22 = [
34103           a2 * (c2[0] - p3[0]) + b2 * (c2[1] - p3[1]) + p3[0],
34104           b2 * (c2[0] - p3[0]) - a2 * (c2[1] - p3[1]) + p3[1]
34105         ];
34106         var loc2 = projection2.invert(c22);
34107         node = node.move(geoVecInterp(node.loc, loc2, t2));
34108         graph = graph.replace(node);
34109       }
34110       return graph;
34111     };
34112     action.useLongAxis = function(val) {
34113       if (!arguments.length) return _useLongAxis;
34114       _useLongAxis = val;
34115       return action;
34116     };
34117     action.transitionable = true;
34118     return action;
34119   }
34120
34121   // modules/actions/upgrade_tags.js
34122   function actionUpgradeTags(entityId, oldTags, replaceTags) {
34123     return function(graph) {
34124       var entity = graph.entity(entityId);
34125       var tags = Object.assign({}, entity.tags);
34126       var transferValue;
34127       var semiIndex;
34128       for (var oldTagKey in oldTags) {
34129         if (!(oldTagKey in tags)) continue;
34130         if (oldTags[oldTagKey] === "*") {
34131           transferValue = tags[oldTagKey];
34132           delete tags[oldTagKey];
34133         } else if (oldTags[oldTagKey] === tags[oldTagKey]) {
34134           delete tags[oldTagKey];
34135         } else {
34136           var vals = tags[oldTagKey].split(";").filter(Boolean);
34137           var oldIndex = vals.indexOf(oldTags[oldTagKey]);
34138           if (vals.length === 1 || oldIndex === -1) {
34139             delete tags[oldTagKey];
34140           } else {
34141             if (replaceTags && replaceTags[oldTagKey]) {
34142               semiIndex = oldIndex;
34143             }
34144             vals.splice(oldIndex, 1);
34145             tags[oldTagKey] = vals.join(";");
34146           }
34147         }
34148       }
34149       if (replaceTags) {
34150         for (var replaceKey in replaceTags) {
34151           var replaceValue = replaceTags[replaceKey];
34152           if (replaceValue === "*") {
34153             if (tags[replaceKey] && tags[replaceKey] !== "no") {
34154               continue;
34155             } else {
34156               tags[replaceKey] = "yes";
34157             }
34158           } else if (replaceValue === "$1") {
34159             tags[replaceKey] = transferValue;
34160           } else {
34161             if (tags[replaceKey] && oldTags[replaceKey] && semiIndex !== void 0) {
34162               var existingVals = tags[replaceKey].split(";").filter(Boolean);
34163               if (existingVals.indexOf(replaceValue) === -1) {
34164                 existingVals.splice(semiIndex, 0, replaceValue);
34165                 tags[replaceKey] = existingVals.join(";");
34166               }
34167             } else {
34168               tags[replaceKey] = replaceValue;
34169             }
34170           }
34171         }
34172       }
34173       return graph.replace(entity.update({ tags }));
34174     };
34175   }
34176
34177   // modules/behavior/edit.js
34178   function behaviorEdit(context) {
34179     function behavior() {
34180       context.map().minzoom(context.minEditableZoom());
34181     }
34182     behavior.off = function() {
34183       context.map().minzoom(0);
34184     };
34185     return behavior;
34186   }
34187
34188   // modules/behavior/hover.js
34189   function behaviorHover(context) {
34190     var dispatch14 = dispatch_default("hover");
34191     var _selection = select_default2(null);
34192     var _newNodeId = null;
34193     var _initialNodeID = null;
34194     var _altDisables;
34195     var _ignoreVertex;
34196     var _targets = [];
34197     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
34198     function keydown(d3_event) {
34199       if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
34200         _selection.selectAll(".hover").classed("hover-suppressed", true).classed("hover", false);
34201         _selection.classed("hover-disabled", true);
34202         dispatch14.call("hover", this, null);
34203       }
34204     }
34205     function keyup(d3_event) {
34206       if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
34207         _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false).classed("hover", true);
34208         _selection.classed("hover-disabled", false);
34209         dispatch14.call("hover", this, _targets);
34210       }
34211     }
34212     function behavior(selection2) {
34213       _selection = selection2;
34214       _targets = [];
34215       if (_initialNodeID) {
34216         _newNodeId = _initialNodeID;
34217         _initialNodeID = null;
34218       } else {
34219         _newNodeId = null;
34220       }
34221       _selection.on(_pointerPrefix + "over.hover", pointerover).on(_pointerPrefix + "out.hover", pointerout).on(_pointerPrefix + "down.hover", pointerover);
34222       select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", pointerout, true).on("keydown.hover", keydown).on("keyup.hover", keyup);
34223       function eventTarget(d3_event) {
34224         var datum2 = d3_event.target && d3_event.target.__data__;
34225         if (typeof datum2 !== "object") return null;
34226         if (!(datum2 instanceof osmEntity) && datum2.properties && datum2.properties.entity instanceof osmEntity) {
34227           return datum2.properties.entity;
34228         }
34229         return datum2;
34230       }
34231       function pointerover(d3_event) {
34232         if (context.mode().id.indexOf("drag") === -1 && (!d3_event.pointerType || d3_event.pointerType === "mouse") && d3_event.buttons) return;
34233         var target = eventTarget(d3_event);
34234         if (target && _targets.indexOf(target) === -1) {
34235           _targets.push(target);
34236           updateHover(d3_event, _targets);
34237         }
34238       }
34239       function pointerout(d3_event) {
34240         var target = eventTarget(d3_event);
34241         var index = _targets.indexOf(target);
34242         if (index !== -1) {
34243           _targets.splice(index);
34244           updateHover(d3_event, _targets);
34245         }
34246       }
34247       function allowsVertex(d2) {
34248         return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
34249       }
34250       function modeAllowsHover(target) {
34251         var mode = context.mode();
34252         if (mode.id === "add-point") {
34253           return mode.preset.matchGeometry("vertex") || target.type !== "way" && target.geometry(context.graph()) !== "vertex";
34254         }
34255         return true;
34256       }
34257       function updateHover(d3_event, targets) {
34258         _selection.selectAll(".hover").classed("hover", false);
34259         _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false);
34260         var mode = context.mode();
34261         if (!_newNodeId && (mode.id === "draw-line" || mode.id === "draw-area")) {
34262           var node = targets.find(function(target) {
34263             return target instanceof osmEntity && target.type === "node";
34264           });
34265           _newNodeId = node && node.id;
34266         }
34267         targets = targets.filter(function(datum3) {
34268           if (datum3 instanceof osmEntity) {
34269             return datum3.id !== _newNodeId && (datum3.type !== "node" || !_ignoreVertex || allowsVertex(datum3)) && modeAllowsHover(datum3);
34270           }
34271           return true;
34272         });
34273         var selector = "";
34274         for (var i3 in targets) {
34275           var datum2 = targets[i3];
34276           if (datum2.__featurehash__) {
34277             selector += ", .data" + datum2.__featurehash__;
34278           } else if (datum2 instanceof QAItem) {
34279             selector += ", ." + datum2.service + ".itemId-" + datum2.id;
34280           } else if (datum2 instanceof osmNote) {
34281             selector += ", .note-" + datum2.id;
34282           } else if (datum2 instanceof osmEntity) {
34283             selector += ", ." + datum2.id;
34284             if (datum2.type === "relation") {
34285               for (var j2 in datum2.members) {
34286                 selector += ", ." + datum2.members[j2].id;
34287               }
34288             }
34289           }
34290         }
34291         var suppressed = _altDisables && d3_event && d3_event.altKey;
34292         if (selector.trim().length) {
34293           selector = selector.slice(1);
34294           _selection.selectAll(selector).classed(suppressed ? "hover-suppressed" : "hover", true);
34295         }
34296         dispatch14.call("hover", this, !suppressed && targets);
34297       }
34298     }
34299     behavior.off = function(selection2) {
34300       selection2.selectAll(".hover").classed("hover", false);
34301       selection2.selectAll(".hover-suppressed").classed("hover-suppressed", false);
34302       selection2.classed("hover-disabled", false);
34303       selection2.on(_pointerPrefix + "over.hover", null).on(_pointerPrefix + "out.hover", null).on(_pointerPrefix + "down.hover", null);
34304       select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", null, true).on("keydown.hover", null).on("keyup.hover", null);
34305     };
34306     behavior.altDisables = function(val) {
34307       if (!arguments.length) return _altDisables;
34308       _altDisables = val;
34309       return behavior;
34310     };
34311     behavior.ignoreVertex = function(val) {
34312       if (!arguments.length) return _ignoreVertex;
34313       _ignoreVertex = val;
34314       return behavior;
34315     };
34316     behavior.initialNodeID = function(nodeId) {
34317       _initialNodeID = nodeId;
34318       return behavior;
34319     };
34320     return utilRebind(behavior, dispatch14, "on");
34321   }
34322
34323   // modules/behavior/draw.js
34324   var _disableSpace = false;
34325   var _lastSpace = null;
34326   function behaviorDraw(context) {
34327     var dispatch14 = dispatch_default(
34328       "move",
34329       "down",
34330       "downcancel",
34331       "click",
34332       "clickWay",
34333       "clickNode",
34334       "undo",
34335       "cancel",
34336       "finish"
34337     );
34338     var keybinding = utilKeybinding("draw");
34339     var _hover = behaviorHover(context).altDisables(true).ignoreVertex(true).on("hover", context.ui().sidebar.hover);
34340     var _edit = behaviorEdit(context);
34341     var _closeTolerance = 4;
34342     var _tolerance = 12;
34343     var _mouseLeave = false;
34344     var _lastMouse = null;
34345     var _lastPointerUpEvent;
34346     var _downPointer;
34347     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
34348     function datum2(d3_event) {
34349       var mode = context.mode();
34350       var isNote = mode && mode.id.indexOf("note") !== -1;
34351       if (d3_event.altKey || isNote) return {};
34352       var element;
34353       if (d3_event.type === "keydown") {
34354         element = _lastMouse && _lastMouse.target;
34355       } else {
34356         element = d3_event.target;
34357       }
34358       var d2 = element.__data__;
34359       return d2 && d2.properties && d2.properties.target ? d2 : {};
34360     }
34361     function pointerdown(d3_event) {
34362       if (_downPointer) return;
34363       var pointerLocGetter = utilFastMouse(this);
34364       _downPointer = {
34365         id: d3_event.pointerId || "mouse",
34366         pointerLocGetter,
34367         downTime: +/* @__PURE__ */ new Date(),
34368         downLoc: pointerLocGetter(d3_event)
34369       };
34370       dispatch14.call("down", this, d3_event, datum2(d3_event));
34371     }
34372     function pointerup(d3_event) {
34373       if (!_downPointer || _downPointer.id !== (d3_event.pointerId || "mouse")) return;
34374       var downPointer = _downPointer;
34375       _downPointer = null;
34376       _lastPointerUpEvent = d3_event;
34377       if (downPointer.isCancelled) return;
34378       var t2 = +/* @__PURE__ */ new Date();
34379       var p2 = downPointer.pointerLocGetter(d3_event);
34380       var dist = geoVecLength(downPointer.downLoc, p2);
34381       if (dist < _closeTolerance || dist < _tolerance && t2 - downPointer.downTime < 500) {
34382         select_default2(window).on("click.draw-block", function() {
34383           d3_event.stopPropagation();
34384         }, true);
34385         context.map().dblclickZoomEnable(false);
34386         window.setTimeout(function() {
34387           context.map().dblclickZoomEnable(true);
34388           select_default2(window).on("click.draw-block", null);
34389         }, 500);
34390         click(d3_event, p2);
34391       }
34392     }
34393     function pointermove(d3_event) {
34394       if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse") && !_downPointer.isCancelled) {
34395         var p2 = _downPointer.pointerLocGetter(d3_event);
34396         var dist = geoVecLength(_downPointer.downLoc, p2);
34397         if (dist >= _closeTolerance) {
34398           _downPointer.isCancelled = true;
34399           dispatch14.call("downcancel", this);
34400         }
34401       }
34402       if (d3_event.pointerType && d3_event.pointerType !== "mouse" || d3_event.buttons || _downPointer) return;
34403       if (_lastPointerUpEvent && _lastPointerUpEvent.pointerType !== "mouse" && d3_event.timeStamp - _lastPointerUpEvent.timeStamp < 100) return;
34404       _lastMouse = d3_event;
34405       dispatch14.call("move", this, d3_event, datum2(d3_event));
34406     }
34407     function pointercancel(d3_event) {
34408       if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse")) {
34409         if (!_downPointer.isCancelled) {
34410           dispatch14.call("downcancel", this);
34411         }
34412         _downPointer = null;
34413       }
34414     }
34415     function mouseenter() {
34416       _mouseLeave = false;
34417     }
34418     function mouseleave() {
34419       _mouseLeave = true;
34420     }
34421     function allowsVertex(d2) {
34422       return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
34423     }
34424     function click(d3_event, loc) {
34425       var d2 = datum2(d3_event);
34426       var target = d2 && d2.properties && d2.properties.entity;
34427       var mode = context.mode();
34428       if (target && target.type === "node" && allowsVertex(target)) {
34429         dispatch14.call("clickNode", this, target, d2);
34430         return;
34431       } else if (target && target.type === "way" && (mode.id !== "add-point" || mode.preset.matchGeometry("vertex"))) {
34432         var choice = geoChooseEdge(
34433           context.graph().childNodes(target),
34434           loc,
34435           context.projection,
34436           context.activeID()
34437         );
34438         if (choice) {
34439           var edge = [target.nodes[choice.index - 1], target.nodes[choice.index]];
34440           dispatch14.call("clickWay", this, choice.loc, edge, d2);
34441           return;
34442         }
34443       } else if (mode.id !== "add-point" || mode.preset.matchGeometry("point")) {
34444         var locLatLng = context.projection.invert(loc);
34445         dispatch14.call("click", this, locLatLng, d2);
34446       }
34447     }
34448     function space(d3_event) {
34449       d3_event.preventDefault();
34450       d3_event.stopPropagation();
34451       var currSpace = context.map().mouse();
34452       if (_disableSpace && _lastSpace) {
34453         var dist = geoVecLength(_lastSpace, currSpace);
34454         if (dist > _tolerance) {
34455           _disableSpace = false;
34456         }
34457       }
34458       if (_disableSpace || _mouseLeave || !_lastMouse) return;
34459       _lastSpace = currSpace;
34460       _disableSpace = true;
34461       select_default2(window).on("keyup.space-block", function() {
34462         d3_event.preventDefault();
34463         d3_event.stopPropagation();
34464         _disableSpace = false;
34465         select_default2(window).on("keyup.space-block", null);
34466       });
34467       var loc = context.map().mouse() || // or the map center if the mouse has never entered the map
34468       context.projection(context.map().center());
34469       click(d3_event, loc);
34470     }
34471     function backspace(d3_event) {
34472       d3_event.preventDefault();
34473       dispatch14.call("undo");
34474     }
34475     function del(d3_event) {
34476       d3_event.preventDefault();
34477       dispatch14.call("cancel");
34478     }
34479     function ret(d3_event) {
34480       d3_event.preventDefault();
34481       dispatch14.call("finish");
34482     }
34483     function behavior(selection2) {
34484       context.install(_hover);
34485       context.install(_edit);
34486       _downPointer = null;
34487       keybinding.on("\u232B", backspace).on("\u2326", del).on("\u238B", ret).on("\u21A9", ret).on("space", space).on("\u2325space", space);
34488       selection2.on("mouseenter.draw", mouseenter).on("mouseleave.draw", mouseleave).on(_pointerPrefix + "down.draw", pointerdown).on(_pointerPrefix + "move.draw", pointermove);
34489       select_default2(window).on(_pointerPrefix + "up.draw", pointerup, true).on("pointercancel.draw", pointercancel, true);
34490       select_default2(document).call(keybinding);
34491       return behavior;
34492     }
34493     behavior.off = function(selection2) {
34494       context.ui().sidebar.hover.cancel();
34495       context.uninstall(_hover);
34496       context.uninstall(_edit);
34497       selection2.on("mouseenter.draw", null).on("mouseleave.draw", null).on(_pointerPrefix + "down.draw", null).on(_pointerPrefix + "move.draw", null);
34498       select_default2(window).on(_pointerPrefix + "up.draw", null).on("pointercancel.draw", null);
34499       select_default2(document).call(keybinding.unbind);
34500     };
34501     behavior.hover = function() {
34502       return _hover;
34503     };
34504     return utilRebind(behavior, dispatch14, "on");
34505   }
34506
34507   // modules/behavior/breathe.js
34508   var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
34509
34510   // node_modules/d3-scale/src/init.js
34511   function initRange(domain, range3) {
34512     switch (arguments.length) {
34513       case 0:
34514         break;
34515       case 1:
34516         this.range(domain);
34517         break;
34518       default:
34519         this.range(range3).domain(domain);
34520         break;
34521     }
34522     return this;
34523   }
34524
34525   // node_modules/d3-scale/src/constant.js
34526   function constants(x2) {
34527     return function() {
34528       return x2;
34529     };
34530   }
34531
34532   // node_modules/d3-scale/src/number.js
34533   function number2(x2) {
34534     return +x2;
34535   }
34536
34537   // node_modules/d3-scale/src/continuous.js
34538   var unit = [0, 1];
34539   function identity3(x2) {
34540     return x2;
34541   }
34542   function normalize(a2, b2) {
34543     return (b2 -= a2 = +a2) ? function(x2) {
34544       return (x2 - a2) / b2;
34545     } : constants(isNaN(b2) ? NaN : 0.5);
34546   }
34547   function clamper(a2, b2) {
34548     var t2;
34549     if (a2 > b2) t2 = a2, a2 = b2, b2 = t2;
34550     return function(x2) {
34551       return Math.max(a2, Math.min(b2, x2));
34552     };
34553   }
34554   function bimap(domain, range3, interpolate) {
34555     var d0 = domain[0], d1 = domain[1], r0 = range3[0], r1 = range3[1];
34556     if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
34557     else d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
34558     return function(x2) {
34559       return r0(d0(x2));
34560     };
34561   }
34562   function polymap(domain, range3, interpolate) {
34563     var j2 = Math.min(domain.length, range3.length) - 1, d2 = new Array(j2), r2 = new Array(j2), i3 = -1;
34564     if (domain[j2] < domain[0]) {
34565       domain = domain.slice().reverse();
34566       range3 = range3.slice().reverse();
34567     }
34568     while (++i3 < j2) {
34569       d2[i3] = normalize(domain[i3], domain[i3 + 1]);
34570       r2[i3] = interpolate(range3[i3], range3[i3 + 1]);
34571     }
34572     return function(x2) {
34573       var i4 = bisect_default(domain, x2, 1, j2) - 1;
34574       return r2[i4](d2[i4](x2));
34575     };
34576   }
34577   function copy(source, target) {
34578     return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown());
34579   }
34580   function transformer2() {
34581     var domain = unit, range3 = unit, interpolate = value_default, transform2, untransform, unknown, clamp3 = identity3, piecewise, output, input;
34582     function rescale() {
34583       var n3 = Math.min(domain.length, range3.length);
34584       if (clamp3 !== identity3) clamp3 = clamper(domain[0], domain[n3 - 1]);
34585       piecewise = n3 > 2 ? polymap : bimap;
34586       output = input = null;
34587       return scale;
34588     }
34589     function scale(x2) {
34590       return x2 == null || isNaN(x2 = +x2) ? unknown : (output || (output = piecewise(domain.map(transform2), range3, interpolate)))(transform2(clamp3(x2)));
34591     }
34592     scale.invert = function(y2) {
34593       return clamp3(untransform((input || (input = piecewise(range3, domain.map(transform2), number_default)))(y2)));
34594     };
34595     scale.domain = function(_2) {
34596       return arguments.length ? (domain = Array.from(_2, number2), rescale()) : domain.slice();
34597     };
34598     scale.range = function(_2) {
34599       return arguments.length ? (range3 = Array.from(_2), rescale()) : range3.slice();
34600     };
34601     scale.rangeRound = function(_2) {
34602       return range3 = Array.from(_2), interpolate = round_default, rescale();
34603     };
34604     scale.clamp = function(_2) {
34605       return arguments.length ? (clamp3 = _2 ? true : identity3, rescale()) : clamp3 !== identity3;
34606     };
34607     scale.interpolate = function(_2) {
34608       return arguments.length ? (interpolate = _2, rescale()) : interpolate;
34609     };
34610     scale.unknown = function(_2) {
34611       return arguments.length ? (unknown = _2, scale) : unknown;
34612     };
34613     return function(t2, u2) {
34614       transform2 = t2, untransform = u2;
34615       return rescale();
34616     };
34617   }
34618   function continuous() {
34619     return transformer2()(identity3, identity3);
34620   }
34621
34622   // node_modules/d3-format/src/formatDecimal.js
34623   function formatDecimal_default(x2) {
34624     return Math.abs(x2 = Math.round(x2)) >= 1e21 ? x2.toLocaleString("en").replace(/,/g, "") : x2.toString(10);
34625   }
34626   function formatDecimalParts(x2, p2) {
34627     if ((i3 = (x2 = p2 ? x2.toExponential(p2 - 1) : x2.toExponential()).indexOf("e")) < 0) return null;
34628     var i3, coefficient = x2.slice(0, i3);
34629     return [
34630       coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
34631       +x2.slice(i3 + 1)
34632     ];
34633   }
34634
34635   // node_modules/d3-format/src/exponent.js
34636   function exponent_default(x2) {
34637     return x2 = formatDecimalParts(Math.abs(x2)), x2 ? x2[1] : NaN;
34638   }
34639
34640   // node_modules/d3-format/src/formatGroup.js
34641   function formatGroup_default(grouping, thousands) {
34642     return function(value, width) {
34643       var i3 = value.length, t2 = [], j2 = 0, g3 = grouping[0], length2 = 0;
34644       while (i3 > 0 && g3 > 0) {
34645         if (length2 + g3 + 1 > width) g3 = Math.max(1, width - length2);
34646         t2.push(value.substring(i3 -= g3, i3 + g3));
34647         if ((length2 += g3 + 1) > width) break;
34648         g3 = grouping[j2 = (j2 + 1) % grouping.length];
34649       }
34650       return t2.reverse().join(thousands);
34651     };
34652   }
34653
34654   // node_modules/d3-format/src/formatNumerals.js
34655   function formatNumerals_default(numerals) {
34656     return function(value) {
34657       return value.replace(/[0-9]/g, function(i3) {
34658         return numerals[+i3];
34659       });
34660     };
34661   }
34662
34663   // node_modules/d3-format/src/formatSpecifier.js
34664   var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
34665   function formatSpecifier(specifier) {
34666     if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
34667     var match;
34668     return new FormatSpecifier({
34669       fill: match[1],
34670       align: match[2],
34671       sign: match[3],
34672       symbol: match[4],
34673       zero: match[5],
34674       width: match[6],
34675       comma: match[7],
34676       precision: match[8] && match[8].slice(1),
34677       trim: match[9],
34678       type: match[10]
34679     });
34680   }
34681   formatSpecifier.prototype = FormatSpecifier.prototype;
34682   function FormatSpecifier(specifier) {
34683     this.fill = specifier.fill === void 0 ? " " : specifier.fill + "";
34684     this.align = specifier.align === void 0 ? ">" : specifier.align + "";
34685     this.sign = specifier.sign === void 0 ? "-" : specifier.sign + "";
34686     this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + "";
34687     this.zero = !!specifier.zero;
34688     this.width = specifier.width === void 0 ? void 0 : +specifier.width;
34689     this.comma = !!specifier.comma;
34690     this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision;
34691     this.trim = !!specifier.trim;
34692     this.type = specifier.type === void 0 ? "" : specifier.type + "";
34693   }
34694   FormatSpecifier.prototype.toString = function() {
34695     return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
34696   };
34697
34698   // node_modules/d3-format/src/formatTrim.js
34699   function formatTrim_default(s2) {
34700     out: for (var n3 = s2.length, i3 = 1, i0 = -1, i1; i3 < n3; ++i3) {
34701       switch (s2[i3]) {
34702         case ".":
34703           i0 = i1 = i3;
34704           break;
34705         case "0":
34706           if (i0 === 0) i0 = i3;
34707           i1 = i3;
34708           break;
34709         default:
34710           if (!+s2[i3]) break out;
34711           if (i0 > 0) i0 = 0;
34712           break;
34713       }
34714     }
34715     return i0 > 0 ? s2.slice(0, i0) + s2.slice(i1 + 1) : s2;
34716   }
34717
34718   // node_modules/d3-format/src/formatPrefixAuto.js
34719   var prefixExponent;
34720   function formatPrefixAuto_default(x2, p2) {
34721     var d2 = formatDecimalParts(x2, p2);
34722     if (!d2) return x2 + "";
34723     var coefficient = d2[0], exponent = d2[1], i3 = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n3 = coefficient.length;
34724     return i3 === n3 ? coefficient : i3 > n3 ? coefficient + new Array(i3 - n3 + 1).join("0") : i3 > 0 ? coefficient.slice(0, i3) + "." + coefficient.slice(i3) : "0." + new Array(1 - i3).join("0") + formatDecimalParts(x2, Math.max(0, p2 + i3 - 1))[0];
34725   }
34726
34727   // node_modules/d3-format/src/formatRounded.js
34728   function formatRounded_default(x2, p2) {
34729     var d2 = formatDecimalParts(x2, p2);
34730     if (!d2) return x2 + "";
34731     var coefficient = d2[0], exponent = d2[1];
34732     return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) : coefficient + new Array(exponent - coefficient.length + 2).join("0");
34733   }
34734
34735   // node_modules/d3-format/src/formatTypes.js
34736   var formatTypes_default = {
34737     "%": (x2, p2) => (x2 * 100).toFixed(p2),
34738     "b": (x2) => Math.round(x2).toString(2),
34739     "c": (x2) => x2 + "",
34740     "d": formatDecimal_default,
34741     "e": (x2, p2) => x2.toExponential(p2),
34742     "f": (x2, p2) => x2.toFixed(p2),
34743     "g": (x2, p2) => x2.toPrecision(p2),
34744     "o": (x2) => Math.round(x2).toString(8),
34745     "p": (x2, p2) => formatRounded_default(x2 * 100, p2),
34746     "r": formatRounded_default,
34747     "s": formatPrefixAuto_default,
34748     "X": (x2) => Math.round(x2).toString(16).toUpperCase(),
34749     "x": (x2) => Math.round(x2).toString(16)
34750   };
34751
34752   // node_modules/d3-format/src/identity.js
34753   function identity_default4(x2) {
34754     return x2;
34755   }
34756
34757   // node_modules/d3-format/src/locale.js
34758   var map = Array.prototype.map;
34759   var prefixes = ["y", "z", "a", "f", "p", "n", "\xB5", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
34760   function locale_default(locale2) {
34761     var group = locale2.grouping === void 0 || locale2.thousands === void 0 ? identity_default4 : formatGroup_default(map.call(locale2.grouping, Number), locale2.thousands + ""), currencyPrefix = locale2.currency === void 0 ? "" : locale2.currency[0] + "", currencySuffix = locale2.currency === void 0 ? "" : locale2.currency[1] + "", decimal = locale2.decimal === void 0 ? "." : locale2.decimal + "", numerals = locale2.numerals === void 0 ? identity_default4 : formatNumerals_default(map.call(locale2.numerals, String)), percent = locale2.percent === void 0 ? "%" : locale2.percent + "", minus = locale2.minus === void 0 ? "\u2212" : locale2.minus + "", nan = locale2.nan === void 0 ? "NaN" : locale2.nan + "";
34762     function newFormat(specifier) {
34763       specifier = formatSpecifier(specifier);
34764       var fill = specifier.fill, align = specifier.align, sign2 = specifier.sign, symbol = specifier.symbol, zero3 = specifier.zero, width = specifier.width, comma = specifier.comma, precision3 = specifier.precision, trim = specifier.trim, type2 = specifier.type;
34765       if (type2 === "n") comma = true, type2 = "g";
34766       else if (!formatTypes_default[type2]) precision3 === void 0 && (precision3 = 12), trim = true, type2 = "g";
34767       if (zero3 || fill === "0" && align === "=") zero3 = true, fill = "0", align = "=";
34768       var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type2) ? "0" + type2.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type2) ? percent : "";
34769       var formatType = formatTypes_default[type2], maybeSuffix = /[defgprs%]/.test(type2);
34770       precision3 = precision3 === void 0 ? 6 : /[gprs]/.test(type2) ? Math.max(1, Math.min(21, precision3)) : Math.max(0, Math.min(20, precision3));
34771       function format2(value) {
34772         var valuePrefix = prefix, valueSuffix = suffix, i3, n3, c2;
34773         if (type2 === "c") {
34774           valueSuffix = formatType(value) + valueSuffix;
34775           value = "";
34776         } else {
34777           value = +value;
34778           var valueNegative = value < 0 || 1 / value < 0;
34779           value = isNaN(value) ? nan : formatType(Math.abs(value), precision3);
34780           if (trim) value = formatTrim_default(value);
34781           if (valueNegative && +value === 0 && sign2 !== "+") valueNegative = false;
34782           valuePrefix = (valueNegative ? sign2 === "(" ? sign2 : minus : sign2 === "-" || sign2 === "(" ? "" : sign2) + valuePrefix;
34783           valueSuffix = (type2 === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign2 === "(" ? ")" : "");
34784           if (maybeSuffix) {
34785             i3 = -1, n3 = value.length;
34786             while (++i3 < n3) {
34787               if (c2 = value.charCodeAt(i3), 48 > c2 || c2 > 57) {
34788                 valueSuffix = (c2 === 46 ? decimal + value.slice(i3 + 1) : value.slice(i3)) + valueSuffix;
34789                 value = value.slice(0, i3);
34790                 break;
34791               }
34792             }
34793           }
34794         }
34795         if (comma && !zero3) value = group(value, Infinity);
34796         var length2 = valuePrefix.length + value.length + valueSuffix.length, padding = length2 < width ? new Array(width - length2 + 1).join(fill) : "";
34797         if (comma && zero3) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
34798         switch (align) {
34799           case "<":
34800             value = valuePrefix + value + valueSuffix + padding;
34801             break;
34802           case "=":
34803             value = valuePrefix + padding + value + valueSuffix;
34804             break;
34805           case "^":
34806             value = padding.slice(0, length2 = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length2);
34807             break;
34808           default:
34809             value = padding + valuePrefix + value + valueSuffix;
34810             break;
34811         }
34812         return numerals(value);
34813       }
34814       format2.toString = function() {
34815         return specifier + "";
34816       };
34817       return format2;
34818     }
34819     function formatPrefix2(specifier, value) {
34820       var f2 = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), e3 = Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3, k2 = Math.pow(10, -e3), prefix = prefixes[8 + e3 / 3];
34821       return function(value2) {
34822         return f2(k2 * value2) + prefix;
34823       };
34824     }
34825     return {
34826       format: newFormat,
34827       formatPrefix: formatPrefix2
34828     };
34829   }
34830
34831   // node_modules/d3-format/src/defaultLocale.js
34832   var locale;
34833   var format;
34834   var formatPrefix;
34835   defaultLocale({
34836     thousands: ",",
34837     grouping: [3],
34838     currency: ["$", ""]
34839   });
34840   function defaultLocale(definition) {
34841     locale = locale_default(definition);
34842     format = locale.format;
34843     formatPrefix = locale.formatPrefix;
34844     return locale;
34845   }
34846
34847   // node_modules/d3-format/src/precisionFixed.js
34848   function precisionFixed_default(step) {
34849     return Math.max(0, -exponent_default(Math.abs(step)));
34850   }
34851
34852   // node_modules/d3-format/src/precisionPrefix.js
34853   function precisionPrefix_default(step, value) {
34854     return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3 - exponent_default(Math.abs(step)));
34855   }
34856
34857   // node_modules/d3-format/src/precisionRound.js
34858   function precisionRound_default(step, max3) {
34859     step = Math.abs(step), max3 = Math.abs(max3) - step;
34860     return Math.max(0, exponent_default(max3) - exponent_default(step)) + 1;
34861   }
34862
34863   // node_modules/d3-scale/src/tickFormat.js
34864   function tickFormat(start2, stop, count, specifier) {
34865     var step = tickStep(start2, stop, count), precision3;
34866     specifier = formatSpecifier(specifier == null ? ",f" : specifier);
34867     switch (specifier.type) {
34868       case "s": {
34869         var value = Math.max(Math.abs(start2), Math.abs(stop));
34870         if (specifier.precision == null && !isNaN(precision3 = precisionPrefix_default(step, value))) specifier.precision = precision3;
34871         return formatPrefix(specifier, value);
34872       }
34873       case "":
34874       case "e":
34875       case "g":
34876       case "p":
34877       case "r": {
34878         if (specifier.precision == null && !isNaN(precision3 = precisionRound_default(step, Math.max(Math.abs(start2), Math.abs(stop))))) specifier.precision = precision3 - (specifier.type === "e");
34879         break;
34880       }
34881       case "f":
34882       case "%": {
34883         if (specifier.precision == null && !isNaN(precision3 = precisionFixed_default(step))) specifier.precision = precision3 - (specifier.type === "%") * 2;
34884         break;
34885       }
34886     }
34887     return format(specifier);
34888   }
34889
34890   // node_modules/d3-scale/src/linear.js
34891   function linearish(scale) {
34892     var domain = scale.domain;
34893     scale.ticks = function(count) {
34894       var d2 = domain();
34895       return ticks(d2[0], d2[d2.length - 1], count == null ? 10 : count);
34896     };
34897     scale.tickFormat = function(count, specifier) {
34898       var d2 = domain();
34899       return tickFormat(d2[0], d2[d2.length - 1], count == null ? 10 : count, specifier);
34900     };
34901     scale.nice = function(count) {
34902       if (count == null) count = 10;
34903       var d2 = domain();
34904       var i0 = 0;
34905       var i1 = d2.length - 1;
34906       var start2 = d2[i0];
34907       var stop = d2[i1];
34908       var prestep;
34909       var step;
34910       var maxIter = 10;
34911       if (stop < start2) {
34912         step = start2, start2 = stop, stop = step;
34913         step = i0, i0 = i1, i1 = step;
34914       }
34915       while (maxIter-- > 0) {
34916         step = tickIncrement(start2, stop, count);
34917         if (step === prestep) {
34918           d2[i0] = start2;
34919           d2[i1] = stop;
34920           return domain(d2);
34921         } else if (step > 0) {
34922           start2 = Math.floor(start2 / step) * step;
34923           stop = Math.ceil(stop / step) * step;
34924         } else if (step < 0) {
34925           start2 = Math.ceil(start2 * step) / step;
34926           stop = Math.floor(stop * step) / step;
34927         } else {
34928           break;
34929         }
34930         prestep = step;
34931       }
34932       return scale;
34933     };
34934     return scale;
34935   }
34936   function linear3() {
34937     var scale = continuous();
34938     scale.copy = function() {
34939       return copy(scale, linear3());
34940     };
34941     initRange.apply(scale, arguments);
34942     return linearish(scale);
34943   }
34944
34945   // node_modules/d3-scale/src/quantize.js
34946   function quantize() {
34947     var x05 = 0, x12 = 1, n3 = 1, domain = [0.5], range3 = [0, 1], unknown;
34948     function scale(x2) {
34949       return x2 != null && x2 <= x2 ? range3[bisect_default(domain, x2, 0, n3)] : unknown;
34950     }
34951     function rescale() {
34952       var i3 = -1;
34953       domain = new Array(n3);
34954       while (++i3 < n3) domain[i3] = ((i3 + 1) * x12 - (i3 - n3) * x05) / (n3 + 1);
34955       return scale;
34956     }
34957     scale.domain = function(_2) {
34958       return arguments.length ? ([x05, x12] = _2, x05 = +x05, x12 = +x12, rescale()) : [x05, x12];
34959     };
34960     scale.range = function(_2) {
34961       return arguments.length ? (n3 = (range3 = Array.from(_2)).length - 1, rescale()) : range3.slice();
34962     };
34963     scale.invertExtent = function(y2) {
34964       var i3 = range3.indexOf(y2);
34965       return i3 < 0 ? [NaN, NaN] : i3 < 1 ? [x05, domain[0]] : i3 >= n3 ? [domain[n3 - 1], x12] : [domain[i3 - 1], domain[i3]];
34966     };
34967     scale.unknown = function(_2) {
34968       return arguments.length ? (unknown = _2, scale) : scale;
34969     };
34970     scale.thresholds = function() {
34971       return domain.slice();
34972     };
34973     scale.copy = function() {
34974       return quantize().domain([x05, x12]).range(range3).unknown(unknown);
34975     };
34976     return initRange.apply(linearish(scale), arguments);
34977   }
34978
34979   // modules/behavior/breathe.js
34980   function behaviorBreathe() {
34981     var duration = 800;
34982     var steps = 4;
34983     var selector = ".selected.shadow, .selected .shadow";
34984     var _selected = select_default2(null);
34985     var _classed = "";
34986     var _params = {};
34987     var _done = false;
34988     var _timer;
34989     function ratchetyInterpolator(a2, b2, steps2, units) {
34990       a2 = Number(a2);
34991       b2 = Number(b2);
34992       var sample = quantize().domain([0, 1]).range(quantize_default(number_default(a2, b2), steps2));
34993       return function(t2) {
34994         return String(sample(t2)) + (units || "");
34995       };
34996     }
34997     function reset(selection2) {
34998       selection2.style("stroke-opacity", null).style("stroke-width", null).style("fill-opacity", null).style("r", null);
34999     }
35000     function setAnimationParams(transition2, fromTo) {
35001       var toFrom = fromTo === "from" ? "to" : "from";
35002       transition2.styleTween("stroke-opacity", function(d2) {
35003         return ratchetyInterpolator(
35004           _params[d2.id][toFrom].opacity,
35005           _params[d2.id][fromTo].opacity,
35006           steps
35007         );
35008       }).styleTween("stroke-width", function(d2) {
35009         return ratchetyInterpolator(
35010           _params[d2.id][toFrom].width,
35011           _params[d2.id][fromTo].width,
35012           steps,
35013           "px"
35014         );
35015       }).styleTween("fill-opacity", function(d2) {
35016         return ratchetyInterpolator(
35017           _params[d2.id][toFrom].opacity,
35018           _params[d2.id][fromTo].opacity,
35019           steps
35020         );
35021       }).styleTween("r", function(d2) {
35022         return ratchetyInterpolator(
35023           _params[d2.id][toFrom].width,
35024           _params[d2.id][fromTo].width,
35025           steps,
35026           "px"
35027         );
35028       });
35029     }
35030     function calcAnimationParams(selection2) {
35031       selection2.call(reset).each(function(d2) {
35032         var s2 = select_default2(this);
35033         var tag2 = s2.node().tagName;
35034         var p2 = { "from": {}, "to": {} };
35035         var opacity;
35036         var width;
35037         if (tag2 === "circle") {
35038           opacity = Number(s2.style("fill-opacity") || 0.5);
35039           width = Number(s2.style("r") || 15.5);
35040         } else {
35041           opacity = Number(s2.style("stroke-opacity") || 0.7);
35042           width = Number(s2.style("stroke-width") || 10);
35043         }
35044         p2.tag = tag2;
35045         p2.from.opacity = opacity * 0.6;
35046         p2.to.opacity = opacity * 1.25;
35047         p2.from.width = width * 0.7;
35048         p2.to.width = width * (tag2 === "circle" ? 1.5 : 1);
35049         _params[d2.id] = p2;
35050       });
35051     }
35052     function run(surface, fromTo) {
35053       var toFrom = fromTo === "from" ? "to" : "from";
35054       var currSelected = surface.selectAll(selector);
35055       var currClassed = surface.attr("class");
35056       if (_done || currSelected.empty()) {
35057         _selected.call(reset);
35058         _selected = select_default2(null);
35059         return;
35060       }
35061       if (!(0, import_fast_deep_equal2.default)(currSelected.data(), _selected.data()) || currClassed !== _classed) {
35062         _selected.call(reset);
35063         _classed = currClassed;
35064         _selected = currSelected.call(calcAnimationParams);
35065       }
35066       var didCallNextRun = false;
35067       _selected.transition().duration(duration).call(setAnimationParams, fromTo).on("end", function() {
35068         if (!didCallNextRun) {
35069           surface.call(run, toFrom);
35070           didCallNextRun = true;
35071         }
35072         if (!select_default2(this).classed("selected")) {
35073           reset(select_default2(this));
35074         }
35075       });
35076     }
35077     function behavior(surface) {
35078       _done = false;
35079       _timer = timer(function() {
35080         if (surface.selectAll(selector).empty()) {
35081           return false;
35082         }
35083         surface.call(run, "from");
35084         _timer.stop();
35085         return true;
35086       }, 20);
35087     }
35088     behavior.restartIfNeeded = function(surface) {
35089       if (_selected.empty()) {
35090         surface.call(run, "from");
35091         if (_timer) {
35092           _timer.stop();
35093         }
35094       }
35095     };
35096     behavior.off = function() {
35097       _done = true;
35098       if (_timer) {
35099         _timer.stop();
35100       }
35101       _selected.interrupt().call(reset);
35102     };
35103     return behavior;
35104   }
35105
35106   // modules/behavior/operation.js
35107   function behaviorOperation(context) {
35108     var _operation;
35109     function keypress(d3_event) {
35110       if (!context.map().withinEditableZoom()) return;
35111       if (_operation.availableForKeypress && !_operation.availableForKeypress()) return;
35112       d3_event.preventDefault();
35113       var disabled = _operation.disabled();
35114       if (disabled) {
35115         context.ui().flash.duration(4e3).iconName("#iD-operation-" + _operation.id).iconClass("operation disabled").label(_operation.tooltip())();
35116       } else {
35117         context.ui().flash.duration(2e3).iconName("#iD-operation-" + _operation.id).iconClass("operation").label(_operation.annotation() || _operation.title)();
35118         if (_operation.point) _operation.point(null);
35119         _operation();
35120       }
35121     }
35122     function behavior() {
35123       if (_operation && _operation.available()) {
35124         context.keybinding().on(_operation.keys, keypress);
35125       }
35126       return behavior;
35127     }
35128     behavior.off = function() {
35129       context.keybinding().off(_operation.keys);
35130     };
35131     behavior.which = function(_2) {
35132       if (!arguments.length) return _operation;
35133       _operation = _2;
35134       return behavior;
35135     };
35136     return behavior;
35137   }
35138
35139   // modules/operations/circularize.js
35140   function operationCircularize(context, selectedIDs) {
35141     var _extent;
35142     var _actions = selectedIDs.map(getAction).filter(Boolean);
35143     var _amount = _actions.length === 1 ? "single" : "multiple";
35144     var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n3) {
35145       return n3.loc;
35146     });
35147     function getAction(entityID) {
35148       var entity = context.entity(entityID);
35149       if (entity.type !== "way" || new Set(entity.nodes).size <= 1) return null;
35150       if (!_extent) {
35151         _extent = entity.extent(context.graph());
35152       } else {
35153         _extent = _extent.extend(entity.extent(context.graph()));
35154       }
35155       return actionCircularize(entityID, context.projection);
35156     }
35157     var operation2 = function() {
35158       if (!_actions.length) return;
35159       var combinedAction = function(graph, t2) {
35160         _actions.forEach(function(action) {
35161           if (!action.disabled(graph)) {
35162             graph = action(graph, t2);
35163           }
35164         });
35165         return graph;
35166       };
35167       combinedAction.transitionable = true;
35168       context.perform(combinedAction, operation2.annotation());
35169       window.setTimeout(function() {
35170         context.validator().validate();
35171       }, 300);
35172     };
35173     operation2.available = function() {
35174       return _actions.length && selectedIDs.length === _actions.length;
35175     };
35176     operation2.disabled = function() {
35177       if (!_actions.length) return "";
35178       var actionDisableds = _actions.map(function(action) {
35179         return action.disabled(context.graph());
35180       }).filter(Boolean);
35181       if (actionDisableds.length === _actions.length) {
35182         if (new Set(actionDisableds).size > 1) {
35183           return "multiple_blockers";
35184         }
35185         return actionDisableds[0];
35186       } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
35187         return "too_large";
35188       } else if (someMissing()) {
35189         return "not_downloaded";
35190       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35191         return "connected_to_hidden";
35192       }
35193       return false;
35194       function someMissing() {
35195         if (context.inIntro()) return false;
35196         var osm = context.connection();
35197         if (osm) {
35198           var missing = _coords.filter(function(loc) {
35199             return !osm.isDataLoaded(loc);
35200           });
35201           if (missing.length) {
35202             missing.forEach(function(loc) {
35203               context.loadTileAtLoc(loc);
35204             });
35205             return true;
35206           }
35207         }
35208         return false;
35209       }
35210     };
35211     operation2.tooltip = function() {
35212       var disable = operation2.disabled();
35213       return disable ? _t.append("operations.circularize." + disable + "." + _amount) : _t.append("operations.circularize.description." + _amount);
35214     };
35215     operation2.annotation = function() {
35216       return _t("operations.circularize.annotation.feature", { n: _actions.length });
35217     };
35218     operation2.id = "circularize";
35219     operation2.keys = [_t("operations.circularize.key")];
35220     operation2.title = _t.append("operations.circularize.title");
35221     operation2.behavior = behaviorOperation(context).which(operation2);
35222     return operation2;
35223   }
35224
35225   // modules/ui/cmd.js
35226   var uiCmd = function(code) {
35227     var detected = utilDetect();
35228     if (detected.os === "mac") {
35229       return code;
35230     }
35231     if (detected.os === "win") {
35232       if (code === "\u2318\u21E7Z") return "Ctrl+Y";
35233     }
35234     var result = "", replacements = {
35235       "\u2318": "Ctrl",
35236       "\u21E7": "Shift",
35237       "\u2325": "Alt",
35238       "\u232B": "Backspace",
35239       "\u2326": "Delete"
35240     };
35241     for (var i3 = 0; i3 < code.length; i3++) {
35242       if (code[i3] in replacements) {
35243         result += replacements[code[i3]] + (i3 < code.length - 1 ? "+" : "");
35244       } else {
35245         result += code[i3];
35246       }
35247     }
35248     return result;
35249   };
35250   uiCmd.display = function(code) {
35251     if (code.length !== 1) return code;
35252     var detected = utilDetect();
35253     var mac = detected.os === "mac";
35254     var replacements = {
35255       "\u2318": mac ? "\u2318 " + _t("shortcuts.key.cmd") : _t("shortcuts.key.ctrl"),
35256       "\u21E7": mac ? "\u21E7 " + _t("shortcuts.key.shift") : _t("shortcuts.key.shift"),
35257       "\u2325": mac ? "\u2325 " + _t("shortcuts.key.option") : _t("shortcuts.key.alt"),
35258       "\u2303": mac ? "\u2303 " + _t("shortcuts.key.ctrl") : _t("shortcuts.key.ctrl"),
35259       "\u232B": mac ? "\u232B " + _t("shortcuts.key.delete") : _t("shortcuts.key.backspace"),
35260       "\u2326": mac ? "\u2326 " + _t("shortcuts.key.del") : _t("shortcuts.key.del"),
35261       "\u2196": mac ? "\u2196 " + _t("shortcuts.key.pgup") : _t("shortcuts.key.pgup"),
35262       "\u2198": mac ? "\u2198 " + _t("shortcuts.key.pgdn") : _t("shortcuts.key.pgdn"),
35263       "\u21DE": mac ? "\u21DE " + _t("shortcuts.key.home") : _t("shortcuts.key.home"),
35264       "\u21DF": mac ? "\u21DF " + _t("shortcuts.key.end") : _t("shortcuts.key.end"),
35265       "\u21B5": mac ? "\u23CE " + _t("shortcuts.key.return") : _t("shortcuts.key.enter"),
35266       "\u238B": mac ? "\u238B " + _t("shortcuts.key.esc") : _t("shortcuts.key.esc"),
35267       "\u2630": mac ? "\u2630 " + _t("shortcuts.key.menu") : _t("shortcuts.key.menu")
35268     };
35269     return replacements[code] || code;
35270   };
35271
35272   // modules/operations/delete.js
35273   function operationDelete(context, selectedIDs) {
35274     var multi = selectedIDs.length === 1 ? "single" : "multiple";
35275     var action = actionDeleteMultiple(selectedIDs);
35276     var nodes = utilGetAllNodes(selectedIDs, context.graph());
35277     var coords = nodes.map(function(n3) {
35278       return n3.loc;
35279     });
35280     var extent = utilTotalExtent(selectedIDs, context.graph());
35281     var operation2 = function() {
35282       var nextSelectedID;
35283       var nextSelectedLoc;
35284       if (selectedIDs.length === 1) {
35285         var id2 = selectedIDs[0];
35286         var entity = context.entity(id2);
35287         var geometry = entity.geometry(context.graph());
35288         var parents = context.graph().parentWays(entity);
35289         var parent = parents[0];
35290         if (geometry === "vertex") {
35291           var nodes2 = parent.nodes;
35292           var i3 = nodes2.indexOf(id2);
35293           if (i3 === 0) {
35294             i3++;
35295           } else if (i3 === nodes2.length - 1) {
35296             i3--;
35297           } else {
35298             var a2 = geoSphericalDistance(entity.loc, context.entity(nodes2[i3 - 1]).loc);
35299             var b2 = geoSphericalDistance(entity.loc, context.entity(nodes2[i3 + 1]).loc);
35300             i3 = a2 < b2 ? i3 - 1 : i3 + 1;
35301           }
35302           nextSelectedID = nodes2[i3];
35303           nextSelectedLoc = context.entity(nextSelectedID).loc;
35304         }
35305       }
35306       context.perform(action, operation2.annotation());
35307       context.validator().validate();
35308       if (nextSelectedID && nextSelectedLoc) {
35309         if (context.hasEntity(nextSelectedID)) {
35310           context.enter(modeSelect(context, [nextSelectedID]).follow(true));
35311         } else {
35312           context.map().centerEase(nextSelectedLoc);
35313           context.enter(modeBrowse(context));
35314         }
35315       } else {
35316         context.enter(modeBrowse(context));
35317       }
35318     };
35319     operation2.available = function() {
35320       return true;
35321     };
35322     operation2.disabled = function() {
35323       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
35324         return "too_large";
35325       } else if (someMissing()) {
35326         return "not_downloaded";
35327       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35328         return "connected_to_hidden";
35329       } else if (selectedIDs.some(protectedMember)) {
35330         return "part_of_relation";
35331       } else if (selectedIDs.some(incompleteRelation)) {
35332         return "incomplete_relation";
35333       } else if (selectedIDs.some(hasWikidataTag)) {
35334         return "has_wikidata_tag";
35335       }
35336       return false;
35337       function someMissing() {
35338         if (context.inIntro()) return false;
35339         var osm = context.connection();
35340         if (osm) {
35341           var missing = coords.filter(function(loc) {
35342             return !osm.isDataLoaded(loc);
35343           });
35344           if (missing.length) {
35345             missing.forEach(function(loc) {
35346               context.loadTileAtLoc(loc);
35347             });
35348             return true;
35349           }
35350         }
35351         return false;
35352       }
35353       function hasWikidataTag(id2) {
35354         var entity = context.entity(id2);
35355         return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
35356       }
35357       function incompleteRelation(id2) {
35358         var entity = context.entity(id2);
35359         return entity.type === "relation" && !entity.isComplete(context.graph());
35360       }
35361       function protectedMember(id2) {
35362         var entity = context.entity(id2);
35363         if (entity.type !== "way") return false;
35364         var parents = context.graph().parentRelations(entity);
35365         for (var i3 = 0; i3 < parents.length; i3++) {
35366           var parent = parents[i3];
35367           var type2 = parent.tags.type;
35368           var role = parent.memberById(id2).role || "outer";
35369           if (type2 === "route" || type2 === "boundary" || type2 === "multipolygon" && role === "outer") {
35370             return true;
35371           }
35372         }
35373         return false;
35374       }
35375     };
35376     operation2.tooltip = function() {
35377       var disable = operation2.disabled();
35378       return disable ? _t.append("operations.delete." + disable + "." + multi) : _t.append("operations.delete.description." + multi);
35379     };
35380     operation2.annotation = function() {
35381       return selectedIDs.length === 1 ? _t("operations.delete.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.delete.annotation.feature", { n: selectedIDs.length });
35382     };
35383     operation2.id = "delete";
35384     operation2.keys = [uiCmd("\u2318\u232B"), uiCmd("\u2318\u2326"), uiCmd("\u2326")];
35385     operation2.title = _t.append("operations.delete.title");
35386     operation2.behavior = behaviorOperation(context).which(operation2);
35387     return operation2;
35388   }
35389
35390   // modules/operations/orthogonalize.js
35391   function operationOrthogonalize(context, selectedIDs) {
35392     var _extent;
35393     var _type;
35394     var _actions = selectedIDs.map(chooseAction).filter(Boolean);
35395     var _amount = _actions.length === 1 ? "single" : "multiple";
35396     var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n3) {
35397       return n3.loc;
35398     });
35399     function chooseAction(entityID) {
35400       var entity = context.entity(entityID);
35401       var geometry = entity.geometry(context.graph());
35402       if (!_extent) {
35403         _extent = entity.extent(context.graph());
35404       } else {
35405         _extent = _extent.extend(entity.extent(context.graph()));
35406       }
35407       if (entity.type === "way" && new Set(entity.nodes).size > 2) {
35408         if (_type && _type !== "feature") return null;
35409         _type = "feature";
35410         return actionOrthogonalize(entityID, context.projection);
35411       } else if (geometry === "vertex") {
35412         if (_type && _type !== "corner") return null;
35413         _type = "corner";
35414         var graph = context.graph();
35415         var parents = graph.parentWays(entity);
35416         if (parents.length === 1) {
35417           var way = parents[0];
35418           if (way.nodes.indexOf(entityID) !== -1) {
35419             return actionOrthogonalize(way.id, context.projection, entityID);
35420           }
35421         }
35422       }
35423       return null;
35424     }
35425     var operation2 = function() {
35426       if (!_actions.length) return;
35427       var combinedAction = function(graph, t2) {
35428         _actions.forEach(function(action) {
35429           if (!action.disabled(graph)) {
35430             graph = action(graph, t2);
35431           }
35432         });
35433         return graph;
35434       };
35435       combinedAction.transitionable = true;
35436       context.perform(combinedAction, operation2.annotation());
35437       window.setTimeout(function() {
35438         context.validator().validate();
35439       }, 300);
35440     };
35441     operation2.available = function() {
35442       return _actions.length && selectedIDs.length === _actions.length;
35443     };
35444     operation2.disabled = function() {
35445       if (!_actions.length) return "";
35446       var actionDisableds = _actions.map(function(action) {
35447         return action.disabled(context.graph());
35448       }).filter(Boolean);
35449       if (actionDisableds.length === _actions.length) {
35450         if (new Set(actionDisableds).size > 1) {
35451           return "multiple_blockers";
35452         }
35453         return actionDisableds[0];
35454       } else if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
35455         return "too_large";
35456       } else if (someMissing()) {
35457         return "not_downloaded";
35458       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35459         return "connected_to_hidden";
35460       }
35461       return false;
35462       function someMissing() {
35463         if (context.inIntro()) return false;
35464         var osm = context.connection();
35465         if (osm) {
35466           var missing = _coords.filter(function(loc) {
35467             return !osm.isDataLoaded(loc);
35468           });
35469           if (missing.length) {
35470             missing.forEach(function(loc) {
35471               context.loadTileAtLoc(loc);
35472             });
35473             return true;
35474           }
35475         }
35476         return false;
35477       }
35478     };
35479     operation2.tooltip = function() {
35480       var disable = operation2.disabled();
35481       return disable ? _t.append("operations.orthogonalize." + disable + "." + _amount) : _t.append("operations.orthogonalize.description." + _type + "." + _amount);
35482     };
35483     operation2.annotation = function() {
35484       return _t("operations.orthogonalize.annotation." + _type, { n: _actions.length });
35485     };
35486     operation2.id = "orthogonalize";
35487     operation2.keys = [_t("operations.orthogonalize.key")];
35488     operation2.title = _t.append("operations.orthogonalize.title");
35489     operation2.behavior = behaviorOperation(context).which(operation2);
35490     return operation2;
35491   }
35492
35493   // modules/operations/reflect.js
35494   function operationReflectShort(context, selectedIDs) {
35495     return operationReflect(context, selectedIDs, "short");
35496   }
35497   function operationReflectLong(context, selectedIDs) {
35498     return operationReflect(context, selectedIDs, "long");
35499   }
35500   function operationReflect(context, selectedIDs, axis) {
35501     axis = axis || "long";
35502     var multi = selectedIDs.length === 1 ? "single" : "multiple";
35503     var nodes = utilGetAllNodes(selectedIDs, context.graph());
35504     var coords = nodes.map(function(n3) {
35505       return n3.loc;
35506     });
35507     var extent = utilTotalExtent(selectedIDs, context.graph());
35508     var operation2 = function() {
35509       var action = actionReflect(selectedIDs, context.projection).useLongAxis(Boolean(axis === "long"));
35510       context.perform(action, operation2.annotation());
35511       window.setTimeout(function() {
35512         context.validator().validate();
35513       }, 300);
35514     };
35515     operation2.available = function() {
35516       return nodes.length >= 3;
35517     };
35518     operation2.disabled = function() {
35519       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
35520         return "too_large";
35521       } else if (someMissing()) {
35522         return "not_downloaded";
35523       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35524         return "connected_to_hidden";
35525       } else if (selectedIDs.some(incompleteRelation)) {
35526         return "incomplete_relation";
35527       }
35528       return false;
35529       function someMissing() {
35530         if (context.inIntro()) return false;
35531         var osm = context.connection();
35532         if (osm) {
35533           var missing = coords.filter(function(loc) {
35534             return !osm.isDataLoaded(loc);
35535           });
35536           if (missing.length) {
35537             missing.forEach(function(loc) {
35538               context.loadTileAtLoc(loc);
35539             });
35540             return true;
35541           }
35542         }
35543         return false;
35544       }
35545       function incompleteRelation(id2) {
35546         var entity = context.entity(id2);
35547         return entity.type === "relation" && !entity.isComplete(context.graph());
35548       }
35549     };
35550     operation2.tooltip = function() {
35551       var disable = operation2.disabled();
35552       return disable ? _t.append("operations.reflect." + disable + "." + multi) : _t.append("operations.reflect.description." + axis + "." + multi);
35553     };
35554     operation2.annotation = function() {
35555       return _t("operations.reflect.annotation." + axis + ".feature", { n: selectedIDs.length });
35556     };
35557     operation2.id = "reflect-" + axis;
35558     operation2.keys = [_t("operations.reflect.key." + axis)];
35559     operation2.title = _t.append("operations.reflect.title." + axis);
35560     operation2.behavior = behaviorOperation(context).which(operation2);
35561     return operation2;
35562   }
35563
35564   // modules/operations/move.js
35565   function operationMove(context, selectedIDs) {
35566     var multi = selectedIDs.length === 1 ? "single" : "multiple";
35567     var nodes = utilGetAllNodes(selectedIDs, context.graph());
35568     var coords = nodes.map(function(n3) {
35569       return n3.loc;
35570     });
35571     var extent = utilTotalExtent(selectedIDs, context.graph());
35572     var operation2 = function() {
35573       context.enter(modeMove(context, selectedIDs));
35574     };
35575     operation2.available = function() {
35576       return selectedIDs.length > 0;
35577     };
35578     operation2.disabled = function() {
35579       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
35580         return "too_large";
35581       } else if (someMissing()) {
35582         return "not_downloaded";
35583       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35584         return "connected_to_hidden";
35585       } else if (selectedIDs.some(incompleteRelation)) {
35586         return "incomplete_relation";
35587       }
35588       return false;
35589       function someMissing() {
35590         if (context.inIntro()) return false;
35591         var osm = context.connection();
35592         if (osm) {
35593           var missing = coords.filter(function(loc) {
35594             return !osm.isDataLoaded(loc);
35595           });
35596           if (missing.length) {
35597             missing.forEach(function(loc) {
35598               context.loadTileAtLoc(loc);
35599             });
35600             return true;
35601           }
35602         }
35603         return false;
35604       }
35605       function incompleteRelation(id2) {
35606         var entity = context.entity(id2);
35607         return entity.type === "relation" && !entity.isComplete(context.graph());
35608       }
35609     };
35610     operation2.tooltip = function() {
35611       var disable = operation2.disabled();
35612       return disable ? _t.append("operations.move." + disable + "." + multi) : _t.append("operations.move.description." + multi);
35613     };
35614     operation2.annotation = function() {
35615       return selectedIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.move.annotation.feature", { n: selectedIDs.length });
35616     };
35617     operation2.id = "move";
35618     operation2.keys = [_t("operations.move.key")];
35619     operation2.title = _t.append("operations.move.title");
35620     operation2.behavior = behaviorOperation(context).which(operation2);
35621     operation2.mouseOnly = true;
35622     return operation2;
35623   }
35624
35625   // modules/modes/rotate.js
35626   function modeRotate(context, entityIDs) {
35627     var _tolerancePx = 4;
35628     var mode = {
35629       id: "rotate",
35630       button: "browse"
35631     };
35632     var keybinding = utilKeybinding("rotate");
35633     var behaviors = [
35634       behaviorEdit(context),
35635       operationCircularize(context, entityIDs).behavior,
35636       operationDelete(context, entityIDs).behavior,
35637       operationMove(context, entityIDs).behavior,
35638       operationOrthogonalize(context, entityIDs).behavior,
35639       operationReflectLong(context, entityIDs).behavior,
35640       operationReflectShort(context, entityIDs).behavior
35641     ];
35642     var annotation = entityIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.rotate.annotation.feature", { n: entityIDs.length });
35643     var _prevGraph;
35644     var _prevAngle;
35645     var _prevTransform;
35646     var _pivot;
35647     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
35648     function doRotate(d3_event) {
35649       var fn;
35650       if (context.graph() !== _prevGraph) {
35651         fn = context.perform;
35652       } else {
35653         fn = context.replace;
35654       }
35655       var projection2 = context.projection;
35656       var currTransform = projection2.transform();
35657       if (!_prevTransform || currTransform.k !== _prevTransform.k || currTransform.x !== _prevTransform.x || currTransform.y !== _prevTransform.y) {
35658         var nodes = utilGetAllNodes(entityIDs, context.graph());
35659         var points = nodes.map(function(n3) {
35660           return projection2(n3.loc);
35661         });
35662         _pivot = getPivot(points);
35663         _prevAngle = void 0;
35664       }
35665       var currMouse = context.map().mouse(d3_event);
35666       var currAngle = Math.atan2(currMouse[1] - _pivot[1], currMouse[0] - _pivot[0]);
35667       if (typeof _prevAngle === "undefined") _prevAngle = currAngle;
35668       var delta = currAngle - _prevAngle;
35669       fn(actionRotate(entityIDs, _pivot, delta, projection2));
35670       _prevTransform = currTransform;
35671       _prevAngle = currAngle;
35672       _prevGraph = context.graph();
35673     }
35674     function getPivot(points) {
35675       var _pivot2;
35676       if (points.length === 1) {
35677         _pivot2 = points[0];
35678       } else if (points.length === 2) {
35679         _pivot2 = geoVecInterp(points[0], points[1], 0.5);
35680       } else {
35681         var polygonHull = hull_default(points);
35682         if (polygonHull.length === 2) {
35683           _pivot2 = geoVecInterp(points[0], points[1], 0.5);
35684         } else {
35685           _pivot2 = centroid_default2(hull_default(points));
35686         }
35687       }
35688       return _pivot2;
35689     }
35690     function finish(d3_event) {
35691       d3_event.stopPropagation();
35692       context.replace(actionNoop(), annotation);
35693       context.enter(modeSelect(context, entityIDs));
35694     }
35695     function cancel() {
35696       if (_prevGraph) context.pop();
35697       context.enter(modeSelect(context, entityIDs));
35698     }
35699     function undone() {
35700       context.enter(modeBrowse(context));
35701     }
35702     mode.enter = function() {
35703       _prevGraph = null;
35704       context.features().forceVisible(entityIDs);
35705       behaviors.forEach(context.install);
35706       var downEvent;
35707       context.surface().on(_pointerPrefix + "down.modeRotate", function(d3_event) {
35708         downEvent = d3_event;
35709       });
35710       select_default2(window).on(_pointerPrefix + "move.modeRotate", doRotate, true).on(_pointerPrefix + "up.modeRotate", function(d3_event) {
35711         if (!downEvent) return;
35712         var mapNode = context.container().select(".main-map").node();
35713         var pointGetter = utilFastMouse(mapNode);
35714         var p1 = pointGetter(downEvent);
35715         var p2 = pointGetter(d3_event);
35716         var dist = geoVecLength(p1, p2);
35717         if (dist <= _tolerancePx) finish(d3_event);
35718         downEvent = null;
35719       }, true);
35720       context.history().on("undone.modeRotate", undone);
35721       keybinding.on("\u238B", cancel).on("\u21A9", finish);
35722       select_default2(document).call(keybinding);
35723     };
35724     mode.exit = function() {
35725       behaviors.forEach(context.uninstall);
35726       context.surface().on(_pointerPrefix + "down.modeRotate", null);
35727       select_default2(window).on(_pointerPrefix + "move.modeRotate", null, true).on(_pointerPrefix + "up.modeRotate", null, true);
35728       context.history().on("undone.modeRotate", null);
35729       select_default2(document).call(keybinding.unbind);
35730       context.features().forceVisible([]);
35731     };
35732     mode.selectedIDs = function() {
35733       if (!arguments.length) return entityIDs;
35734       return mode;
35735     };
35736     return mode;
35737   }
35738
35739   // modules/operations/rotate.js
35740   function operationRotate(context, selectedIDs) {
35741     var multi = selectedIDs.length === 1 ? "single" : "multiple";
35742     var nodes = utilGetAllNodes(selectedIDs, context.graph());
35743     var coords = nodes.map(function(n3) {
35744       return n3.loc;
35745     });
35746     var extent = utilTotalExtent(selectedIDs, context.graph());
35747     var operation2 = function() {
35748       context.enter(modeRotate(context, selectedIDs));
35749     };
35750     operation2.available = function() {
35751       return nodes.length >= 2;
35752     };
35753     operation2.disabled = function() {
35754       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
35755         return "too_large";
35756       } else if (someMissing()) {
35757         return "not_downloaded";
35758       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35759         return "connected_to_hidden";
35760       } else if (selectedIDs.some(incompleteRelation)) {
35761         return "incomplete_relation";
35762       }
35763       return false;
35764       function someMissing() {
35765         if (context.inIntro()) return false;
35766         var osm = context.connection();
35767         if (osm) {
35768           var missing = coords.filter(function(loc) {
35769             return !osm.isDataLoaded(loc);
35770           });
35771           if (missing.length) {
35772             missing.forEach(function(loc) {
35773               context.loadTileAtLoc(loc);
35774             });
35775             return true;
35776           }
35777         }
35778         return false;
35779       }
35780       function incompleteRelation(id2) {
35781         var entity = context.entity(id2);
35782         return entity.type === "relation" && !entity.isComplete(context.graph());
35783       }
35784     };
35785     operation2.tooltip = function() {
35786       var disable = operation2.disabled();
35787       return disable ? _t.append("operations.rotate." + disable + "." + multi) : _t.append("operations.rotate.description." + multi);
35788     };
35789     operation2.annotation = function() {
35790       return selectedIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.rotate.annotation.feature", { n: selectedIDs.length });
35791     };
35792     operation2.id = "rotate";
35793     operation2.keys = [_t("operations.rotate.key")];
35794     operation2.title = _t.append("operations.rotate.title");
35795     operation2.behavior = behaviorOperation(context).which(operation2);
35796     operation2.mouseOnly = true;
35797     return operation2;
35798   }
35799
35800   // modules/modes/move.js
35801   function modeMove(context, entityIDs, baseGraph) {
35802     var _tolerancePx = 4;
35803     var mode = {
35804       id: "move",
35805       button: "browse"
35806     };
35807     var keybinding = utilKeybinding("move");
35808     var behaviors = [
35809       behaviorEdit(context),
35810       operationCircularize(context, entityIDs).behavior,
35811       operationDelete(context, entityIDs).behavior,
35812       operationOrthogonalize(context, entityIDs).behavior,
35813       operationReflectLong(context, entityIDs).behavior,
35814       operationReflectShort(context, entityIDs).behavior,
35815       operationRotate(context, entityIDs).behavior
35816     ];
35817     var annotation = entityIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.move.annotation.feature", { n: entityIDs.length });
35818     var _prevGraph;
35819     var _cache5;
35820     var _origin;
35821     var _nudgeInterval;
35822     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
35823     function doMove(nudge) {
35824       nudge = nudge || [0, 0];
35825       var fn;
35826       if (_prevGraph !== context.graph()) {
35827         _cache5 = {};
35828         _origin = context.map().mouseCoordinates();
35829         fn = context.perform;
35830       } else {
35831         fn = context.overwrite;
35832       }
35833       var currMouse = context.map().mouse();
35834       var origMouse = context.projection(_origin);
35835       var delta = geoVecSubtract(geoVecSubtract(currMouse, origMouse), nudge);
35836       fn(actionMove(entityIDs, delta, context.projection, _cache5));
35837       _prevGraph = context.graph();
35838     }
35839     function startNudge(nudge) {
35840       if (_nudgeInterval) window.clearInterval(_nudgeInterval);
35841       _nudgeInterval = window.setInterval(function() {
35842         context.map().pan(nudge);
35843         doMove(nudge);
35844       }, 50);
35845     }
35846     function stopNudge() {
35847       if (_nudgeInterval) {
35848         window.clearInterval(_nudgeInterval);
35849         _nudgeInterval = null;
35850       }
35851     }
35852     function move() {
35853       doMove();
35854       var nudge = geoViewportEdge(context.map().mouse(), context.map().dimensions());
35855       if (nudge) {
35856         startNudge(nudge);
35857       } else {
35858         stopNudge();
35859       }
35860     }
35861     function finish(d3_event) {
35862       d3_event.stopPropagation();
35863       context.replace(actionNoop(), annotation);
35864       context.enter(modeSelect(context, entityIDs));
35865       stopNudge();
35866     }
35867     function cancel() {
35868       if (baseGraph) {
35869         while (context.graph() !== baseGraph) context.pop();
35870         context.enter(modeBrowse(context));
35871       } else {
35872         if (_prevGraph) context.pop();
35873         context.enter(modeSelect(context, entityIDs));
35874       }
35875       stopNudge();
35876     }
35877     function undone() {
35878       context.enter(modeBrowse(context));
35879     }
35880     mode.enter = function() {
35881       _origin = context.map().mouseCoordinates();
35882       _prevGraph = null;
35883       _cache5 = {};
35884       context.features().forceVisible(entityIDs);
35885       behaviors.forEach(context.install);
35886       var downEvent;
35887       context.surface().on(_pointerPrefix + "down.modeMove", function(d3_event) {
35888         downEvent = d3_event;
35889       });
35890       select_default2(window).on(_pointerPrefix + "move.modeMove", move, true).on(_pointerPrefix + "up.modeMove", function(d3_event) {
35891         if (!downEvent) return;
35892         var mapNode = context.container().select(".main-map").node();
35893         var pointGetter = utilFastMouse(mapNode);
35894         var p1 = pointGetter(downEvent);
35895         var p2 = pointGetter(d3_event);
35896         var dist = geoVecLength(p1, p2);
35897         if (dist <= _tolerancePx) finish(d3_event);
35898         downEvent = null;
35899       }, true);
35900       context.history().on("undone.modeMove", undone);
35901       keybinding.on("\u238B", cancel).on("\u21A9", finish);
35902       select_default2(document).call(keybinding);
35903     };
35904     mode.exit = function() {
35905       stopNudge();
35906       behaviors.forEach(function(behavior) {
35907         context.uninstall(behavior);
35908       });
35909       context.surface().on(_pointerPrefix + "down.modeMove", null);
35910       select_default2(window).on(_pointerPrefix + "move.modeMove", null, true).on(_pointerPrefix + "up.modeMove", null, true);
35911       context.history().on("undone.modeMove", null);
35912       select_default2(document).call(keybinding.unbind);
35913       context.features().forceVisible([]);
35914     };
35915     mode.selectedIDs = function() {
35916       if (!arguments.length) return entityIDs;
35917       return mode;
35918     };
35919     return mode;
35920   }
35921
35922   // modules/behavior/paste.js
35923   function behaviorPaste(context) {
35924     function doPaste(d3_event) {
35925       if (!context.map().withinEditableZoom()) return;
35926       d3_event.preventDefault();
35927       var baseGraph = context.graph();
35928       var mouse = context.map().mouse();
35929       var projection2 = context.projection;
35930       var viewport = geoExtent(projection2.clipExtent()).polygon();
35931       if (!geoPointInPolygon(mouse, viewport)) return;
35932       var oldIDs = context.copyIDs();
35933       if (!oldIDs.length) return;
35934       var extent = geoExtent();
35935       var oldGraph = context.copyGraph();
35936       var newIDs = [];
35937       var action = actionCopyEntities(oldIDs, oldGraph);
35938       context.perform(action);
35939       var copies = action.copies();
35940       var originals = /* @__PURE__ */ new Set();
35941       Object.values(copies).forEach(function(entity) {
35942         originals.add(entity.id);
35943       });
35944       for (var id2 in copies) {
35945         var oldEntity = oldGraph.entity(id2);
35946         var newEntity = copies[id2];
35947         extent._extend(oldEntity.extent(oldGraph));
35948         var parents = context.graph().parentWays(newEntity);
35949         var parentCopied = parents.some(function(parent) {
35950           return originals.has(parent.id);
35951         });
35952         if (!parentCopied) {
35953           newIDs.push(newEntity.id);
35954         }
35955       }
35956       var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
35957       var delta = geoVecSubtract(mouse, copyPoint);
35958       context.perform(actionMove(newIDs, delta, projection2));
35959       context.enter(modeMove(context, newIDs, baseGraph));
35960     }
35961     function behavior() {
35962       context.keybinding().on(uiCmd("\u2318V"), doPaste);
35963       return behavior;
35964     }
35965     behavior.off = function() {
35966       context.keybinding().off(uiCmd("\u2318V"));
35967     };
35968     return behavior;
35969   }
35970
35971   // modules/behavior/drag.js
35972   function behaviorDrag() {
35973     var dispatch14 = dispatch_default("start", "move", "end");
35974     var _tolerancePx = 1;
35975     var _penTolerancePx = 4;
35976     var _origin = null;
35977     var _selector = "";
35978     var _targetNode;
35979     var _targetEntity;
35980     var _surface;
35981     var _pointerId;
35982     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
35983     var d3_event_userSelectProperty = utilPrefixCSSProperty("UserSelect");
35984     var d3_event_userSelectSuppress = function() {
35985       var selection2 = selection_default();
35986       var select = selection2.style(d3_event_userSelectProperty);
35987       selection2.style(d3_event_userSelectProperty, "none");
35988       return function() {
35989         selection2.style(d3_event_userSelectProperty, select);
35990       };
35991     };
35992     function pointerdown(d3_event) {
35993       if (_pointerId) return;
35994       _pointerId = d3_event.pointerId || "mouse";
35995       _targetNode = this;
35996       var pointerLocGetter = utilFastMouse(_surface || _targetNode.parentNode);
35997       var offset;
35998       var startOrigin = pointerLocGetter(d3_event);
35999       var started = false;
36000       var selectEnable = d3_event_userSelectSuppress();
36001       select_default2(window).on(_pointerPrefix + "move.drag", pointermove).on(_pointerPrefix + "up.drag pointercancel.drag", pointerup, true);
36002       if (_origin) {
36003         offset = _origin.call(_targetNode, _targetEntity);
36004         offset = [offset[0] - startOrigin[0], offset[1] - startOrigin[1]];
36005       } else {
36006         offset = [0, 0];
36007       }
36008       d3_event.stopPropagation();
36009       function pointermove(d3_event2) {
36010         if (_pointerId !== (d3_event2.pointerId || "mouse")) return;
36011         var p2 = pointerLocGetter(d3_event2);
36012         if (!started) {
36013           var dist = geoVecLength(startOrigin, p2);
36014           var tolerance = d3_event2.pointerType === "pen" ? _penTolerancePx : _tolerancePx;
36015           if (dist < tolerance) return;
36016           started = true;
36017           dispatch14.call("start", this, d3_event2, _targetEntity);
36018         } else {
36019           startOrigin = p2;
36020           d3_event2.stopPropagation();
36021           d3_event2.preventDefault();
36022           var dx = p2[0] - startOrigin[0];
36023           var dy = p2[1] - startOrigin[1];
36024           dispatch14.call("move", this, d3_event2, _targetEntity, [p2[0] + offset[0], p2[1] + offset[1]], [dx, dy]);
36025         }
36026       }
36027       function pointerup(d3_event2) {
36028         if (_pointerId !== (d3_event2.pointerId || "mouse")) return;
36029         _pointerId = null;
36030         if (started) {
36031           dispatch14.call("end", this, d3_event2, _targetEntity);
36032           d3_event2.preventDefault();
36033         }
36034         select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
36035         selectEnable();
36036       }
36037     }
36038     function behavior(selection2) {
36039       var matchesSelector = utilPrefixDOMProperty("matchesSelector");
36040       var delegate = pointerdown;
36041       if (_selector) {
36042         delegate = function(d3_event) {
36043           var root3 = this;
36044           var target = d3_event.target;
36045           for (; target && target !== root3; target = target.parentNode) {
36046             var datum2 = target.__data__;
36047             _targetEntity = datum2 instanceof osmNote ? datum2 : datum2 && datum2.properties && datum2.properties.entity;
36048             if (_targetEntity && target[matchesSelector](_selector)) {
36049               return pointerdown.call(target, d3_event);
36050             }
36051           }
36052         };
36053       }
36054       selection2.on(_pointerPrefix + "down.drag" + _selector, delegate);
36055     }
36056     behavior.off = function(selection2) {
36057       selection2.on(_pointerPrefix + "down.drag" + _selector, null);
36058     };
36059     behavior.selector = function(_2) {
36060       if (!arguments.length) return _selector;
36061       _selector = _2;
36062       return behavior;
36063     };
36064     behavior.origin = function(_2) {
36065       if (!arguments.length) return _origin;
36066       _origin = _2;
36067       return behavior;
36068     };
36069     behavior.cancel = function() {
36070       select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
36071       return behavior;
36072     };
36073     behavior.targetNode = function(_2) {
36074       if (!arguments.length) return _targetNode;
36075       _targetNode = _2;
36076       return behavior;
36077     };
36078     behavior.targetEntity = function(_2) {
36079       if (!arguments.length) return _targetEntity;
36080       _targetEntity = _2;
36081       return behavior;
36082     };
36083     behavior.surface = function(_2) {
36084       if (!arguments.length) return _surface;
36085       _surface = _2;
36086       return behavior;
36087     };
36088     return utilRebind(behavior, dispatch14, "on");
36089   }
36090
36091   // modules/modes/drag_node.js
36092   function modeDragNode(context) {
36093     var mode = {
36094       id: "drag-node",
36095       button: "browse"
36096     };
36097     var hover = behaviorHover(context).altDisables(true).on("hover", context.ui().sidebar.hover);
36098     var edit2 = behaviorEdit(context);
36099     var _nudgeInterval;
36100     var _restoreSelectedIDs = [];
36101     var _wasMidpoint = false;
36102     var _isCancelled = false;
36103     var _activeEntity;
36104     var _startLoc;
36105     var _lastLoc;
36106     function startNudge(d3_event, entity, nudge) {
36107       if (_nudgeInterval) window.clearInterval(_nudgeInterval);
36108       _nudgeInterval = window.setInterval(function() {
36109         context.map().pan(nudge);
36110         doMove(d3_event, entity, nudge);
36111       }, 50);
36112     }
36113     function stopNudge() {
36114       if (_nudgeInterval) {
36115         window.clearInterval(_nudgeInterval);
36116         _nudgeInterval = null;
36117       }
36118     }
36119     function moveAnnotation(entity) {
36120       return _t("operations.move.annotation." + entity.geometry(context.graph()));
36121     }
36122     function connectAnnotation(nodeEntity, targetEntity) {
36123       var nodeGeometry = nodeEntity.geometry(context.graph());
36124       var targetGeometry = targetEntity.geometry(context.graph());
36125       if (nodeGeometry === "vertex" && targetGeometry === "vertex") {
36126         var nodeParentWayIDs = context.graph().parentWays(nodeEntity);
36127         var targetParentWayIDs = context.graph().parentWays(targetEntity);
36128         var sharedParentWays = utilArrayIntersection(nodeParentWayIDs, targetParentWayIDs);
36129         if (sharedParentWays.length !== 0) {
36130           if (sharedParentWays[0].areAdjacent(nodeEntity.id, targetEntity.id)) {
36131             return _t("operations.connect.annotation.from_vertex.to_adjacent_vertex");
36132           }
36133           return _t("operations.connect.annotation.from_vertex.to_sibling_vertex");
36134         }
36135       }
36136       return _t("operations.connect.annotation.from_" + nodeGeometry + ".to_" + targetGeometry);
36137     }
36138     function shouldSnapToNode(target) {
36139       if (!_activeEntity) return false;
36140       return _activeEntity.geometry(context.graph()) !== "vertex" || (target.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(target, context.graph()));
36141     }
36142     function origin(entity) {
36143       return context.projection(entity.loc);
36144     }
36145     function keydown(d3_event) {
36146       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
36147         if (context.surface().classed("nope")) {
36148           context.surface().classed("nope-suppressed", true);
36149         }
36150         context.surface().classed("nope", false).classed("nope-disabled", true);
36151       }
36152     }
36153     function keyup(d3_event) {
36154       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
36155         if (context.surface().classed("nope-suppressed")) {
36156           context.surface().classed("nope", true);
36157         }
36158         context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
36159       }
36160     }
36161     function start2(d3_event, entity) {
36162       _wasMidpoint = entity.type === "midpoint";
36163       var hasHidden = context.features().hasHiddenConnections(entity, context.graph());
36164       _isCancelled = !context.editable() || d3_event.shiftKey || hasHidden;
36165       if (_isCancelled) {
36166         if (hasHidden) {
36167           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("modes.drag_node.connected_to_hidden"))();
36168         }
36169         return drag.cancel();
36170       }
36171       if (_wasMidpoint) {
36172         var midpoint = entity;
36173         entity = osmNode();
36174         context.perform(actionAddMidpoint(midpoint, entity));
36175         entity = context.entity(entity.id);
36176         var vertex = context.surface().selectAll("." + entity.id);
36177         drag.targetNode(vertex.node()).targetEntity(entity);
36178       } else {
36179         context.perform(actionNoop());
36180       }
36181       _activeEntity = entity;
36182       _startLoc = entity.loc;
36183       hover.ignoreVertex(entity.geometry(context.graph()) === "vertex");
36184       context.surface().selectAll("." + _activeEntity.id).classed("active", true);
36185       context.enter(mode);
36186     }
36187     function datum2(d3_event) {
36188       if (!d3_event || d3_event.altKey) {
36189         return {};
36190       } else {
36191         var d2 = d3_event.target.__data__;
36192         return d2 && d2.properties && d2.properties.target ? d2 : {};
36193       }
36194     }
36195     function doMove(d3_event, entity, nudge) {
36196       nudge = nudge || [0, 0];
36197       var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
36198       var currMouse = geoVecSubtract(currPoint, nudge);
36199       var loc = context.projection.invert(currMouse);
36200       var target, edge;
36201       if (!_nudgeInterval) {
36202         var d2 = datum2(d3_event);
36203         target = d2 && d2.properties && d2.properties.entity;
36204         var targetLoc = target && target.loc;
36205         var targetNodes = d2 && d2.properties && d2.properties.nodes;
36206         if (targetLoc) {
36207           if (shouldSnapToNode(target)) {
36208             loc = targetLoc;
36209           }
36210         } else if (targetNodes) {
36211           edge = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, end.id);
36212           if (edge) {
36213             loc = edge.loc;
36214           }
36215         }
36216       }
36217       context.replace(
36218         actionMoveNode(entity.id, loc)
36219       );
36220       var isInvalid = false;
36221       if (target) {
36222         isInvalid = hasRelationConflict(entity, target, edge, context.graph());
36223       }
36224       if (!isInvalid) {
36225         isInvalid = hasInvalidGeometry(entity, context.graph());
36226       }
36227       var nope = context.surface().classed("nope");
36228       if (isInvalid === "relation" || isInvalid === "restriction") {
36229         if (!nope) {
36230           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(
36231             "operations.connect." + isInvalid,
36232             { relation: _mainPresetIndex.item("type/restriction").name() }
36233           ))();
36234         }
36235       } else if (isInvalid) {
36236         var errorID = isInvalid === "line" ? "lines" : "areas";
36237         context.ui().flash.duration(3e3).iconName("#iD-icon-no").label(_t.append("self_intersection.error." + errorID))();
36238       } else {
36239         if (nope) {
36240           context.ui().flash.duration(1).label("")();
36241         }
36242       }
36243       var nopeDisabled = context.surface().classed("nope-disabled");
36244       if (nopeDisabled) {
36245         context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
36246       } else {
36247         context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
36248       }
36249       _lastLoc = loc;
36250     }
36251     function hasRelationConflict(entity, target, edge, graph) {
36252       var testGraph = graph.update();
36253       if (edge) {
36254         var midpoint = osmNode();
36255         var action = actionAddMidpoint({
36256           loc: edge.loc,
36257           edge: [target.nodes[edge.index - 1], target.nodes[edge.index]]
36258         }, midpoint);
36259         testGraph = action(testGraph);
36260         target = midpoint;
36261       }
36262       var ids = [entity.id, target.id];
36263       return actionConnect(ids).disabled(testGraph);
36264     }
36265     function hasInvalidGeometry(entity, graph) {
36266       var parents = graph.parentWays(entity);
36267       var i3, j2, k2;
36268       for (i3 = 0; i3 < parents.length; i3++) {
36269         var parent = parents[i3];
36270         var nodes = [];
36271         var activeIndex = null;
36272         var relations = graph.parentRelations(parent);
36273         for (j2 = 0; j2 < relations.length; j2++) {
36274           if (!relations[j2].isMultipolygon()) continue;
36275           var rings = osmJoinWays(relations[j2].members, graph);
36276           for (k2 = 0; k2 < rings.length; k2++) {
36277             nodes = rings[k2].nodes;
36278             if (nodes.find(function(n3) {
36279               return n3.id === entity.id;
36280             })) {
36281               activeIndex = k2;
36282               if (geoHasSelfIntersections(nodes, entity.id)) {
36283                 return "multipolygonMember";
36284               }
36285             }
36286             rings[k2].coords = nodes.map(function(n3) {
36287               return n3.loc;
36288             });
36289           }
36290           for (k2 = 0; k2 < rings.length; k2++) {
36291             if (k2 === activeIndex) continue;
36292             if (geoHasLineIntersections(rings[activeIndex].nodes, rings[k2].nodes, entity.id)) {
36293               return "multipolygonRing";
36294             }
36295           }
36296         }
36297         if (activeIndex === null) {
36298           nodes = parent.nodes.map(function(nodeID) {
36299             return graph.entity(nodeID);
36300           });
36301           if (nodes.length && geoHasSelfIntersections(nodes, entity.id)) {
36302             return parent.geometry(graph);
36303           }
36304         }
36305       }
36306       return false;
36307     }
36308     function move(d3_event, entity, point) {
36309       if (_isCancelled) return;
36310       d3_event.stopPropagation();
36311       context.surface().classed("nope-disabled", d3_event.altKey);
36312       _lastLoc = context.projection.invert(point);
36313       doMove(d3_event, entity);
36314       var nudge = geoViewportEdge(point, context.map().dimensions());
36315       if (nudge) {
36316         startNudge(d3_event, entity, nudge);
36317       } else {
36318         stopNudge();
36319       }
36320     }
36321     function end(d3_event, entity) {
36322       if (_isCancelled) return;
36323       var wasPoint = entity.geometry(context.graph()) === "point";
36324       var d2 = datum2(d3_event);
36325       var nope = d2 && d2.properties && d2.properties.nope || context.surface().classed("nope");
36326       var target = d2 && d2.properties && d2.properties.entity;
36327       if (nope) {
36328         context.perform(
36329           _actionBounceBack(entity.id, _startLoc)
36330         );
36331       } else if (target && target.type === "way") {
36332         var choice = geoChooseEdge(context.graph().childNodes(target), context.map().mouse(), context.projection, entity.id);
36333         context.replace(
36334           actionAddMidpoint({
36335             loc: choice.loc,
36336             edge: [target.nodes[choice.index - 1], target.nodes[choice.index]]
36337           }, entity),
36338           connectAnnotation(entity, target)
36339         );
36340       } else if (target && target.type === "node" && shouldSnapToNode(target)) {
36341         context.replace(
36342           actionConnect([target.id, entity.id]),
36343           connectAnnotation(entity, target)
36344         );
36345       } else if (_wasMidpoint) {
36346         context.replace(
36347           actionNoop(),
36348           _t("operations.add.annotation.vertex")
36349         );
36350       } else {
36351         context.replace(
36352           actionNoop(),
36353           moveAnnotation(entity)
36354         );
36355       }
36356       if (wasPoint) {
36357         context.enter(modeSelect(context, [entity.id]));
36358       } else {
36359         var reselection = _restoreSelectedIDs.filter(function(id2) {
36360           return context.graph().hasEntity(id2);
36361         });
36362         if (reselection.length) {
36363           context.enter(modeSelect(context, reselection));
36364         } else {
36365           context.enter(modeBrowse(context));
36366         }
36367       }
36368     }
36369     function _actionBounceBack(nodeID, toLoc) {
36370       var moveNode = actionMoveNode(nodeID, toLoc);
36371       var action = function(graph, t2) {
36372         if (t2 === 1) context.pop();
36373         return moveNode(graph, t2);
36374       };
36375       action.transitionable = true;
36376       return action;
36377     }
36378     function cancel() {
36379       drag.cancel();
36380       context.enter(modeBrowse(context));
36381     }
36382     var drag = behaviorDrag().selector(".layer-touch.points .target").surface(context.container().select(".main-map").node()).origin(origin).on("start", start2).on("move", move).on("end", end);
36383     mode.enter = function() {
36384       context.install(hover);
36385       context.install(edit2);
36386       select_default2(window).on("keydown.dragNode", keydown).on("keyup.dragNode", keyup);
36387       context.history().on("undone.drag-node", cancel);
36388     };
36389     mode.exit = function() {
36390       context.ui().sidebar.hover.cancel();
36391       context.uninstall(hover);
36392       context.uninstall(edit2);
36393       select_default2(window).on("keydown.dragNode", null).on("keyup.dragNode", null);
36394       context.history().on("undone.drag-node", null);
36395       _activeEntity = null;
36396       context.surface().classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false).selectAll(".active").classed("active", false);
36397       stopNudge();
36398     };
36399     mode.selectedIDs = function() {
36400       if (!arguments.length) return _activeEntity ? [_activeEntity.id] : [];
36401       return mode;
36402     };
36403     mode.activeID = function() {
36404       if (!arguments.length) return _activeEntity && _activeEntity.id;
36405       return mode;
36406     };
36407     mode.restoreSelectedIDs = function(_2) {
36408       if (!arguments.length) return _restoreSelectedIDs;
36409       _restoreSelectedIDs = _2;
36410       return mode;
36411     };
36412     mode.behavior = drag;
36413     return mode;
36414   }
36415
36416   // node_modules/quickselect/index.js
36417   function quickselect2(arr, k2, left, right, compare2) {
36418     quickselectStep(arr, k2, left || 0, right || arr.length - 1, compare2 || defaultCompare);
36419   }
36420   function quickselectStep(arr, k2, left, right, compare2) {
36421     while (right > left) {
36422       if (right - left > 600) {
36423         var n3 = right - left + 1;
36424         var m2 = k2 - left + 1;
36425         var z2 = Math.log(n3);
36426         var s2 = 0.5 * Math.exp(2 * z2 / 3);
36427         var sd = 0.5 * Math.sqrt(z2 * s2 * (n3 - s2) / n3) * (m2 - n3 / 2 < 0 ? -1 : 1);
36428         var newLeft = Math.max(left, Math.floor(k2 - m2 * s2 / n3 + sd));
36429         var newRight = Math.min(right, Math.floor(k2 + (n3 - m2) * s2 / n3 + sd));
36430         quickselectStep(arr, k2, newLeft, newRight, compare2);
36431       }
36432       var t2 = arr[k2];
36433       var i3 = left;
36434       var j2 = right;
36435       swap2(arr, left, k2);
36436       if (compare2(arr[right], t2) > 0) swap2(arr, left, right);
36437       while (i3 < j2) {
36438         swap2(arr, i3, j2);
36439         i3++;
36440         j2--;
36441         while (compare2(arr[i3], t2) < 0) i3++;
36442         while (compare2(arr[j2], t2) > 0) j2--;
36443       }
36444       if (compare2(arr[left], t2) === 0) swap2(arr, left, j2);
36445       else {
36446         j2++;
36447         swap2(arr, j2, right);
36448       }
36449       if (j2 <= k2) left = j2 + 1;
36450       if (k2 <= j2) right = j2 - 1;
36451     }
36452   }
36453   function swap2(arr, i3, j2) {
36454     var tmp = arr[i3];
36455     arr[i3] = arr[j2];
36456     arr[j2] = tmp;
36457   }
36458   function defaultCompare(a2, b2) {
36459     return a2 < b2 ? -1 : a2 > b2 ? 1 : 0;
36460   }
36461
36462   // node_modules/rbush/index.js
36463   var RBush = class {
36464     constructor(maxEntries = 9) {
36465       this._maxEntries = Math.max(4, maxEntries);
36466       this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
36467       this.clear();
36468     }
36469     all() {
36470       return this._all(this.data, []);
36471     }
36472     search(bbox2) {
36473       let node = this.data;
36474       const result = [];
36475       if (!intersects(bbox2, node)) return result;
36476       const toBBox = this.toBBox;
36477       const nodesToSearch = [];
36478       while (node) {
36479         for (let i3 = 0; i3 < node.children.length; i3++) {
36480           const child = node.children[i3];
36481           const childBBox = node.leaf ? toBBox(child) : child;
36482           if (intersects(bbox2, childBBox)) {
36483             if (node.leaf) result.push(child);
36484             else if (contains(bbox2, childBBox)) this._all(child, result);
36485             else nodesToSearch.push(child);
36486           }
36487         }
36488         node = nodesToSearch.pop();
36489       }
36490       return result;
36491     }
36492     collides(bbox2) {
36493       let node = this.data;
36494       if (!intersects(bbox2, node)) return false;
36495       const nodesToSearch = [];
36496       while (node) {
36497         for (let i3 = 0; i3 < node.children.length; i3++) {
36498           const child = node.children[i3];
36499           const childBBox = node.leaf ? this.toBBox(child) : child;
36500           if (intersects(bbox2, childBBox)) {
36501             if (node.leaf || contains(bbox2, childBBox)) return true;
36502             nodesToSearch.push(child);
36503           }
36504         }
36505         node = nodesToSearch.pop();
36506       }
36507       return false;
36508     }
36509     load(data) {
36510       if (!(data && data.length)) return this;
36511       if (data.length < this._minEntries) {
36512         for (let i3 = 0; i3 < data.length; i3++) {
36513           this.insert(data[i3]);
36514         }
36515         return this;
36516       }
36517       let node = this._build(data.slice(), 0, data.length - 1, 0);
36518       if (!this.data.children.length) {
36519         this.data = node;
36520       } else if (this.data.height === node.height) {
36521         this._splitRoot(this.data, node);
36522       } else {
36523         if (this.data.height < node.height) {
36524           const tmpNode = this.data;
36525           this.data = node;
36526           node = tmpNode;
36527         }
36528         this._insert(node, this.data.height - node.height - 1, true);
36529       }
36530       return this;
36531     }
36532     insert(item) {
36533       if (item) this._insert(item, this.data.height - 1);
36534       return this;
36535     }
36536     clear() {
36537       this.data = createNode([]);
36538       return this;
36539     }
36540     remove(item, equalsFn) {
36541       if (!item) return this;
36542       let node = this.data;
36543       const bbox2 = this.toBBox(item);
36544       const path = [];
36545       const indexes = [];
36546       let i3, parent, goingUp;
36547       while (node || path.length) {
36548         if (!node) {
36549           node = path.pop();
36550           parent = path[path.length - 1];
36551           i3 = indexes.pop();
36552           goingUp = true;
36553         }
36554         if (node.leaf) {
36555           const index = findItem(item, node.children, equalsFn);
36556           if (index !== -1) {
36557             node.children.splice(index, 1);
36558             path.push(node);
36559             this._condense(path);
36560             return this;
36561           }
36562         }
36563         if (!goingUp && !node.leaf && contains(node, bbox2)) {
36564           path.push(node);
36565           indexes.push(i3);
36566           i3 = 0;
36567           parent = node;
36568           node = node.children[0];
36569         } else if (parent) {
36570           i3++;
36571           node = parent.children[i3];
36572           goingUp = false;
36573         } else node = null;
36574       }
36575       return this;
36576     }
36577     toBBox(item) {
36578       return item;
36579     }
36580     compareMinX(a2, b2) {
36581       return a2.minX - b2.minX;
36582     }
36583     compareMinY(a2, b2) {
36584       return a2.minY - b2.minY;
36585     }
36586     toJSON() {
36587       return this.data;
36588     }
36589     fromJSON(data) {
36590       this.data = data;
36591       return this;
36592     }
36593     _all(node, result) {
36594       const nodesToSearch = [];
36595       while (node) {
36596         if (node.leaf) result.push(...node.children);
36597         else nodesToSearch.push(...node.children);
36598         node = nodesToSearch.pop();
36599       }
36600       return result;
36601     }
36602     _build(items, left, right, height) {
36603       const N2 = right - left + 1;
36604       let M2 = this._maxEntries;
36605       let node;
36606       if (N2 <= M2) {
36607         node = createNode(items.slice(left, right + 1));
36608         calcBBox(node, this.toBBox);
36609         return node;
36610       }
36611       if (!height) {
36612         height = Math.ceil(Math.log(N2) / Math.log(M2));
36613         M2 = Math.ceil(N2 / Math.pow(M2, height - 1));
36614       }
36615       node = createNode([]);
36616       node.leaf = false;
36617       node.height = height;
36618       const N22 = Math.ceil(N2 / M2);
36619       const N1 = N22 * Math.ceil(Math.sqrt(M2));
36620       multiSelect(items, left, right, N1, this.compareMinX);
36621       for (let i3 = left; i3 <= right; i3 += N1) {
36622         const right2 = Math.min(i3 + N1 - 1, right);
36623         multiSelect(items, i3, right2, N22, this.compareMinY);
36624         for (let j2 = i3; j2 <= right2; j2 += N22) {
36625           const right3 = Math.min(j2 + N22 - 1, right2);
36626           node.children.push(this._build(items, j2, right3, height - 1));
36627         }
36628       }
36629       calcBBox(node, this.toBBox);
36630       return node;
36631     }
36632     _chooseSubtree(bbox2, node, level, path) {
36633       while (true) {
36634         path.push(node);
36635         if (node.leaf || path.length - 1 === level) break;
36636         let minArea = Infinity;
36637         let minEnlargement = Infinity;
36638         let targetNode;
36639         for (let i3 = 0; i3 < node.children.length; i3++) {
36640           const child = node.children[i3];
36641           const area = bboxArea(child);
36642           const enlargement = enlargedArea(bbox2, child) - area;
36643           if (enlargement < minEnlargement) {
36644             minEnlargement = enlargement;
36645             minArea = area < minArea ? area : minArea;
36646             targetNode = child;
36647           } else if (enlargement === minEnlargement) {
36648             if (area < minArea) {
36649               minArea = area;
36650               targetNode = child;
36651             }
36652           }
36653         }
36654         node = targetNode || node.children[0];
36655       }
36656       return node;
36657     }
36658     _insert(item, level, isNode) {
36659       const bbox2 = isNode ? item : this.toBBox(item);
36660       const insertPath = [];
36661       const node = this._chooseSubtree(bbox2, this.data, level, insertPath);
36662       node.children.push(item);
36663       extend2(node, bbox2);
36664       while (level >= 0) {
36665         if (insertPath[level].children.length > this._maxEntries) {
36666           this._split(insertPath, level);
36667           level--;
36668         } else break;
36669       }
36670       this._adjustParentBBoxes(bbox2, insertPath, level);
36671     }
36672     // split overflowed node into two
36673     _split(insertPath, level) {
36674       const node = insertPath[level];
36675       const M2 = node.children.length;
36676       const m2 = this._minEntries;
36677       this._chooseSplitAxis(node, m2, M2);
36678       const splitIndex = this._chooseSplitIndex(node, m2, M2);
36679       const newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
36680       newNode.height = node.height;
36681       newNode.leaf = node.leaf;
36682       calcBBox(node, this.toBBox);
36683       calcBBox(newNode, this.toBBox);
36684       if (level) insertPath[level - 1].children.push(newNode);
36685       else this._splitRoot(node, newNode);
36686     }
36687     _splitRoot(node, newNode) {
36688       this.data = createNode([node, newNode]);
36689       this.data.height = node.height + 1;
36690       this.data.leaf = false;
36691       calcBBox(this.data, this.toBBox);
36692     }
36693     _chooseSplitIndex(node, m2, M2) {
36694       let index;
36695       let minOverlap = Infinity;
36696       let minArea = Infinity;
36697       for (let i3 = m2; i3 <= M2 - m2; i3++) {
36698         const bbox1 = distBBox(node, 0, i3, this.toBBox);
36699         const bbox2 = distBBox(node, i3, M2, this.toBBox);
36700         const overlap = intersectionArea(bbox1, bbox2);
36701         const area = bboxArea(bbox1) + bboxArea(bbox2);
36702         if (overlap < minOverlap) {
36703           minOverlap = overlap;
36704           index = i3;
36705           minArea = area < minArea ? area : minArea;
36706         } else if (overlap === minOverlap) {
36707           if (area < minArea) {
36708             minArea = area;
36709             index = i3;
36710           }
36711         }
36712       }
36713       return index || M2 - m2;
36714     }
36715     // sorts node children by the best axis for split
36716     _chooseSplitAxis(node, m2, M2) {
36717       const compareMinX = node.leaf ? this.compareMinX : compareNodeMinX;
36718       const compareMinY = node.leaf ? this.compareMinY : compareNodeMinY;
36719       const xMargin = this._allDistMargin(node, m2, M2, compareMinX);
36720       const yMargin = this._allDistMargin(node, m2, M2, compareMinY);
36721       if (xMargin < yMargin) node.children.sort(compareMinX);
36722     }
36723     // total margin of all possible split distributions where each node is at least m full
36724     _allDistMargin(node, m2, M2, compare2) {
36725       node.children.sort(compare2);
36726       const toBBox = this.toBBox;
36727       const leftBBox = distBBox(node, 0, m2, toBBox);
36728       const rightBBox = distBBox(node, M2 - m2, M2, toBBox);
36729       let margin = bboxMargin(leftBBox) + bboxMargin(rightBBox);
36730       for (let i3 = m2; i3 < M2 - m2; i3++) {
36731         const child = node.children[i3];
36732         extend2(leftBBox, node.leaf ? toBBox(child) : child);
36733         margin += bboxMargin(leftBBox);
36734       }
36735       for (let i3 = M2 - m2 - 1; i3 >= m2; i3--) {
36736         const child = node.children[i3];
36737         extend2(rightBBox, node.leaf ? toBBox(child) : child);
36738         margin += bboxMargin(rightBBox);
36739       }
36740       return margin;
36741     }
36742     _adjustParentBBoxes(bbox2, path, level) {
36743       for (let i3 = level; i3 >= 0; i3--) {
36744         extend2(path[i3], bbox2);
36745       }
36746     }
36747     _condense(path) {
36748       for (let i3 = path.length - 1, siblings; i3 >= 0; i3--) {
36749         if (path[i3].children.length === 0) {
36750           if (i3 > 0) {
36751             siblings = path[i3 - 1].children;
36752             siblings.splice(siblings.indexOf(path[i3]), 1);
36753           } else this.clear();
36754         } else calcBBox(path[i3], this.toBBox);
36755       }
36756     }
36757   };
36758   function findItem(item, items, equalsFn) {
36759     if (!equalsFn) return items.indexOf(item);
36760     for (let i3 = 0; i3 < items.length; i3++) {
36761       if (equalsFn(item, items[i3])) return i3;
36762     }
36763     return -1;
36764   }
36765   function calcBBox(node, toBBox) {
36766     distBBox(node, 0, node.children.length, toBBox, node);
36767   }
36768   function distBBox(node, k2, p2, toBBox, destNode) {
36769     if (!destNode) destNode = createNode(null);
36770     destNode.minX = Infinity;
36771     destNode.minY = Infinity;
36772     destNode.maxX = -Infinity;
36773     destNode.maxY = -Infinity;
36774     for (let i3 = k2; i3 < p2; i3++) {
36775       const child = node.children[i3];
36776       extend2(destNode, node.leaf ? toBBox(child) : child);
36777     }
36778     return destNode;
36779   }
36780   function extend2(a2, b2) {
36781     a2.minX = Math.min(a2.minX, b2.minX);
36782     a2.minY = Math.min(a2.minY, b2.minY);
36783     a2.maxX = Math.max(a2.maxX, b2.maxX);
36784     a2.maxY = Math.max(a2.maxY, b2.maxY);
36785     return a2;
36786   }
36787   function compareNodeMinX(a2, b2) {
36788     return a2.minX - b2.minX;
36789   }
36790   function compareNodeMinY(a2, b2) {
36791     return a2.minY - b2.minY;
36792   }
36793   function bboxArea(a2) {
36794     return (a2.maxX - a2.minX) * (a2.maxY - a2.minY);
36795   }
36796   function bboxMargin(a2) {
36797     return a2.maxX - a2.minX + (a2.maxY - a2.minY);
36798   }
36799   function enlargedArea(a2, b2) {
36800     return (Math.max(b2.maxX, a2.maxX) - Math.min(b2.minX, a2.minX)) * (Math.max(b2.maxY, a2.maxY) - Math.min(b2.minY, a2.minY));
36801   }
36802   function intersectionArea(a2, b2) {
36803     const minX = Math.max(a2.minX, b2.minX);
36804     const minY = Math.max(a2.minY, b2.minY);
36805     const maxX = Math.min(a2.maxX, b2.maxX);
36806     const maxY = Math.min(a2.maxY, b2.maxY);
36807     return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
36808   }
36809   function contains(a2, b2) {
36810     return a2.minX <= b2.minX && a2.minY <= b2.minY && b2.maxX <= a2.maxX && b2.maxY <= a2.maxY;
36811   }
36812   function intersects(a2, b2) {
36813     return b2.minX <= a2.maxX && b2.minY <= a2.maxY && b2.maxX >= a2.minX && b2.maxY >= a2.minY;
36814   }
36815   function createNode(children2) {
36816     return {
36817       children: children2,
36818       height: 1,
36819       leaf: true,
36820       minX: Infinity,
36821       minY: Infinity,
36822       maxX: -Infinity,
36823       maxY: -Infinity
36824     };
36825   }
36826   function multiSelect(arr, left, right, n3, compare2) {
36827     const stack = [left, right];
36828     while (stack.length) {
36829       right = stack.pop();
36830       left = stack.pop();
36831       if (right - left <= n3) continue;
36832       const mid = left + Math.ceil((right - left) / n3 / 2) * n3;
36833       quickselect2(arr, mid, left, right, compare2);
36834       stack.push(left, mid, mid, right);
36835     }
36836   }
36837
36838   // node_modules/d3-fetch/src/text.js
36839   function responseText(response) {
36840     if (!response.ok) throw new Error(response.status + " " + response.statusText);
36841     return response.text();
36842   }
36843   function text_default3(input, init2) {
36844     return fetch(input, init2).then(responseText);
36845   }
36846
36847   // node_modules/d3-fetch/src/json.js
36848   function responseJson(response) {
36849     if (!response.ok) throw new Error(response.status + " " + response.statusText);
36850     if (response.status === 204 || response.status === 205) return;
36851     return response.json();
36852   }
36853   function json_default(input, init2) {
36854     return fetch(input, init2).then(responseJson);
36855   }
36856
36857   // node_modules/d3-fetch/src/xml.js
36858   function parser(type2) {
36859     return (input, init2) => text_default3(input, init2).then((text) => new DOMParser().parseFromString(text, type2));
36860   }
36861   var xml_default = parser("application/xml");
36862   var html = parser("text/html");
36863   var svg = parser("image/svg+xml");
36864
36865   // modules/services/keepRight.js
36866   var tiler = utilTiler();
36867   var dispatch2 = dispatch_default("loaded");
36868   var _tileZoom = 14;
36869   var _krUrlRoot = "https://www.keepright.at";
36870   var _krData = { errorTypes: {}, localizeStrings: {} };
36871   var _cache;
36872   var _krRuleset = [
36873     // no 20 - multiple node on same spot - these are mostly boundaries overlapping roads
36874     30,
36875     40,
36876     50,
36877     60,
36878     70,
36879     90,
36880     100,
36881     110,
36882     120,
36883     130,
36884     150,
36885     160,
36886     170,
36887     180,
36888     190,
36889     191,
36890     192,
36891     193,
36892     194,
36893     195,
36894     196,
36895     197,
36896     198,
36897     200,
36898     201,
36899     202,
36900     203,
36901     204,
36902     205,
36903     206,
36904     207,
36905     208,
36906     210,
36907     220,
36908     230,
36909     231,
36910     232,
36911     270,
36912     280,
36913     281,
36914     282,
36915     283,
36916     284,
36917     285,
36918     290,
36919     291,
36920     292,
36921     293,
36922     294,
36923     295,
36924     296,
36925     297,
36926     298,
36927     300,
36928     310,
36929     311,
36930     312,
36931     313,
36932     320,
36933     350,
36934     360,
36935     370,
36936     380,
36937     390,
36938     400,
36939     401,
36940     402,
36941     410,
36942     411,
36943     412,
36944     413
36945   ];
36946   function abortRequest(controller) {
36947     if (controller) {
36948       controller.abort();
36949     }
36950   }
36951   function abortUnwantedRequests(cache, tiles) {
36952     Object.keys(cache.inflightTile).forEach((k2) => {
36953       const wanted = tiles.find((tile) => k2 === tile.id);
36954       if (!wanted) {
36955         abortRequest(cache.inflightTile[k2]);
36956         delete cache.inflightTile[k2];
36957       }
36958     });
36959   }
36960   function encodeIssueRtree(d2) {
36961     return { minX: d2.loc[0], minY: d2.loc[1], maxX: d2.loc[0], maxY: d2.loc[1], data: d2 };
36962   }
36963   function updateRtree(item, replace) {
36964     _cache.rtree.remove(item, (a2, b2) => a2.data.id === b2.data.id);
36965     if (replace) {
36966       _cache.rtree.insert(item);
36967     }
36968   }
36969   function tokenReplacements(d2) {
36970     if (!(d2 instanceof QAItem)) return;
36971     const replacements = {};
36972     const issueTemplate = _krData.errorTypes[d2.whichType];
36973     if (!issueTemplate) {
36974       console.log("No Template: ", d2.whichType);
36975       console.log("  ", d2.description);
36976       return;
36977     }
36978     if (!issueTemplate.regex) return;
36979     const errorRegex = new RegExp(issueTemplate.regex, "i");
36980     const errorMatch = errorRegex.exec(d2.description);
36981     if (!errorMatch) {
36982       console.log("Unmatched: ", d2.whichType);
36983       console.log("  ", d2.description);
36984       console.log("  ", errorRegex);
36985       return;
36986     }
36987     for (let i3 = 1; i3 < errorMatch.length; i3++) {
36988       let capture = errorMatch[i3];
36989       let idType;
36990       idType = "IDs" in issueTemplate ? issueTemplate.IDs[i3 - 1] : "";
36991       if (idType && capture) {
36992         capture = parseError(capture, idType);
36993       } else {
36994         const compare2 = capture.toLowerCase();
36995         if (_krData.localizeStrings[compare2]) {
36996           capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare2]);
36997         } else {
36998           capture = unescape_default(capture);
36999         }
37000       }
37001       replacements["var" + i3] = capture;
37002     }
37003     return replacements;
37004   }
37005   function parseError(capture, idType) {
37006     const compare2 = capture.toLowerCase();
37007     if (_krData.localizeStrings[compare2]) {
37008       capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare2]);
37009     }
37010     switch (idType) {
37011       // link a string like "this node"
37012       case "this":
37013         capture = linkErrorObject(capture);
37014         break;
37015       case "url":
37016         capture = linkURL(capture);
37017         break;
37018       // link an entity ID
37019       case "n":
37020       case "w":
37021       case "r":
37022         capture = linkEntity(idType + capture);
37023         break;
37024       // some errors have more complex ID lists/variance
37025       case "20":
37026         capture = parse20(capture);
37027         break;
37028       case "211":
37029         capture = parse211(capture);
37030         break;
37031       case "231":
37032         capture = parse231(capture);
37033         break;
37034       case "294":
37035         capture = parse294(capture);
37036         break;
37037       case "370":
37038         capture = parse370(capture);
37039         break;
37040     }
37041     return capture;
37042     function linkErrorObject(d2) {
37043       return { html: '<a class="error_object_link">'.concat(d2, "</a>") };
37044     }
37045     function linkEntity(d2) {
37046       return { html: '<a class="error_entity_link">'.concat(d2, "</a>") };
37047     }
37048     function linkURL(d2) {
37049       return { html: '<a class="kr_external_link" target="_blank" href="'.concat(d2, '">').concat(d2, "</a>") };
37050     }
37051     function parse211(capture2) {
37052       let newList = [];
37053       const items = capture2.split(", ");
37054       items.forEach((item) => {
37055         let id2 = linkEntity("n" + item.slice(1));
37056         newList.push(id2);
37057       });
37058       return newList.join(", ");
37059     }
37060     function parse231(capture2) {
37061       let newList = [];
37062       const items = capture2.split("),");
37063       items.forEach((item) => {
37064         const match = item.match(/\#(\d+)\((.+)\)?/);
37065         if (match !== null && match.length > 2) {
37066           newList.push(
37067             linkEntity("w" + match[1]) + " " + _t("QA.keepRight.errorTypes.231.layer", { layer: match[2] })
37068           );
37069         }
37070       });
37071       return newList.join(", ");
37072     }
37073     function parse294(capture2) {
37074       let newList = [];
37075       const items = capture2.split(",");
37076       items.forEach((item) => {
37077         item = item.split(" ");
37078         const role = '"'.concat(item[0], '"');
37079         const idType2 = item[1].slice(0, 1);
37080         let id2 = item[2].slice(1);
37081         id2 = linkEntity(idType2 + id2);
37082         newList.push("".concat(role, " ").concat(item[1], " ").concat(id2));
37083       });
37084       return newList.join(", ");
37085     }
37086     function parse370(capture2) {
37087       if (!capture2) return "";
37088       const match = capture2.match(/\(including the name (\'.+\')\)/);
37089       if (match && match.length) {
37090         return _t("QA.keepRight.errorTypes.370.including_the_name", { name: match[1] });
37091       }
37092       return "";
37093     }
37094     function parse20(capture2) {
37095       let newList = [];
37096       const items = capture2.split(",");
37097       items.forEach((item) => {
37098         const id2 = linkEntity("n" + item.slice(1));
37099         newList.push(id2);
37100       });
37101       return newList.join(", ");
37102     }
37103   }
37104   var keepRight_default = {
37105     title: "keepRight",
37106     init() {
37107       _mainFileFetcher.get("keepRight").then((d2) => _krData = d2);
37108       if (!_cache) {
37109         this.reset();
37110       }
37111       this.event = utilRebind(this, dispatch2, "on");
37112     },
37113     reset() {
37114       if (_cache) {
37115         Object.values(_cache.inflightTile).forEach(abortRequest);
37116       }
37117       _cache = {
37118         data: {},
37119         loadedTile: {},
37120         inflightTile: {},
37121         inflightPost: {},
37122         closed: {},
37123         rtree: new RBush()
37124       };
37125     },
37126     // KeepRight API:  http://osm.mueschelsoft.de/keepright/interfacing.php
37127     loadIssues(projection2) {
37128       const options2 = {
37129         format: "geojson",
37130         ch: _krRuleset
37131       };
37132       const tiles = tiler.zoomExtent([_tileZoom, _tileZoom]).getTiles(projection2);
37133       abortUnwantedRequests(_cache, tiles);
37134       tiles.forEach((tile) => {
37135         if (_cache.loadedTile[tile.id] || _cache.inflightTile[tile.id]) return;
37136         const [left, top, right, bottom] = tile.extent.rectangle();
37137         const params = Object.assign({}, options2, { left, bottom, right, top });
37138         const url = "".concat(_krUrlRoot, "/export.php?") + utilQsString(params);
37139         const controller = new AbortController();
37140         _cache.inflightTile[tile.id] = controller;
37141         json_default(url, { signal: controller.signal }).then((data) => {
37142           delete _cache.inflightTile[tile.id];
37143           _cache.loadedTile[tile.id] = true;
37144           if (!data || !data.features || !data.features.length) {
37145             throw new Error("No Data");
37146           }
37147           data.features.forEach((feature3) => {
37148             const {
37149               properties: {
37150                 error_type: itemType,
37151                 error_id: id2,
37152                 comment = null,
37153                 object_id: objectId,
37154                 object_type: objectType,
37155                 schema,
37156                 title
37157               }
37158             } = feature3;
37159             let {
37160               geometry: { coordinates: loc },
37161               properties: { description = "" }
37162             } = feature3;
37163             const issueTemplate = _krData.errorTypes[itemType];
37164             const parentIssueType = (Math.floor(itemType / 10) * 10).toString();
37165             const whichType = issueTemplate ? itemType : parentIssueType;
37166             const whichTemplate = _krData.errorTypes[whichType];
37167             switch (whichType) {
37168               case "170":
37169                 description = "This feature has a FIXME tag: ".concat(description);
37170                 break;
37171               case "292":
37172               case "293":
37173                 description = description.replace("A turn-", "This turn-");
37174                 break;
37175               case "294":
37176               case "295":
37177               case "296":
37178               case "297":
37179               case "298":
37180                 description = "This turn-restriction~".concat(description);
37181                 break;
37182               case "300":
37183                 description = "This highway is missing a maxspeed tag";
37184                 break;
37185               case "411":
37186               case "412":
37187               case "413":
37188                 description = "This feature~".concat(description);
37189                 break;
37190             }
37191             let coincident = false;
37192             do {
37193               let delta = coincident ? [1e-5, 0] : [0, 1e-5];
37194               loc = geoVecAdd(loc, delta);
37195               let bbox2 = geoExtent(loc).bbox();
37196               coincident = _cache.rtree.search(bbox2).length;
37197             } while (coincident);
37198             let d2 = new QAItem(loc, this, itemType, id2, {
37199               comment,
37200               description,
37201               whichType,
37202               parentIssueType,
37203               severity: whichTemplate.severity || "error",
37204               objectId,
37205               objectType,
37206               schema,
37207               title
37208             });
37209             d2.replacements = tokenReplacements(d2);
37210             _cache.data[id2] = d2;
37211             _cache.rtree.insert(encodeIssueRtree(d2));
37212           });
37213           dispatch2.call("loaded");
37214         }).catch(() => {
37215           delete _cache.inflightTile[tile.id];
37216           _cache.loadedTile[tile.id] = true;
37217         });
37218       });
37219     },
37220     postUpdate(d2, callback) {
37221       if (_cache.inflightPost[d2.id]) {
37222         return callback({ message: "Error update already inflight", status: -2 }, d2);
37223       }
37224       const params = { schema: d2.schema, id: d2.id };
37225       if (d2.newStatus) {
37226         params.st = d2.newStatus;
37227       }
37228       if (d2.newComment !== void 0) {
37229         params.co = d2.newComment;
37230       }
37231       const url = "".concat(_krUrlRoot, "/comment.php?") + utilQsString(params);
37232       const controller = new AbortController();
37233       _cache.inflightPost[d2.id] = controller;
37234       json_default(url, { signal: controller.signal }).finally(() => {
37235         delete _cache.inflightPost[d2.id];
37236         if (d2.newStatus === "ignore") {
37237           this.removeItem(d2);
37238         } else if (d2.newStatus === "ignore_t") {
37239           this.removeItem(d2);
37240           _cache.closed["".concat(d2.schema, ":").concat(d2.id)] = true;
37241         } else {
37242           d2 = this.replaceItem(d2.update({
37243             comment: d2.newComment,
37244             newComment: void 0,
37245             newState: void 0
37246           }));
37247         }
37248         if (callback) callback(null, d2);
37249       });
37250     },
37251     // Get all cached QAItems covering the viewport
37252     getItems(projection2) {
37253       const viewport = projection2.clipExtent();
37254       const min3 = [viewport[0][0], viewport[1][1]];
37255       const max3 = [viewport[1][0], viewport[0][1]];
37256       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
37257       return _cache.rtree.search(bbox2).map((d2) => d2.data);
37258     },
37259     // Get a QAItem from cache
37260     // NOTE: Don't change method name until UI v3 is merged
37261     getError(id2) {
37262       return _cache.data[id2];
37263     },
37264     // Replace a single QAItem in the cache
37265     replaceItem(item) {
37266       if (!(item instanceof QAItem) || !item.id) return;
37267       _cache.data[item.id] = item;
37268       updateRtree(encodeIssueRtree(item), true);
37269       return item;
37270     },
37271     // Remove a single QAItem from the cache
37272     removeItem(item) {
37273       if (!(item instanceof QAItem) || !item.id) return;
37274       delete _cache.data[item.id];
37275       updateRtree(encodeIssueRtree(item), false);
37276     },
37277     issueURL(item) {
37278       return "".concat(_krUrlRoot, "/report_map.php?schema=").concat(item.schema, "&error=").concat(item.id);
37279     },
37280     // Get an array of issues closed during this session.
37281     // Used to populate `closed:keepright` changeset tag
37282     getClosedIDs() {
37283       return Object.keys(_cache.closed).sort();
37284     }
37285   };
37286
37287   // node_modules/marked/lib/marked.esm.js
37288   function _getDefaults() {
37289     return {
37290       async: false,
37291       breaks: false,
37292       extensions: null,
37293       gfm: true,
37294       hooks: null,
37295       pedantic: false,
37296       renderer: null,
37297       silent: false,
37298       tokenizer: null,
37299       walkTokens: null
37300     };
37301   }
37302   var _defaults = _getDefaults();
37303   function changeDefaults(newDefaults) {
37304     _defaults = newDefaults;
37305   }
37306   var escapeTest = /[&<>"']/;
37307   var escapeReplace = new RegExp(escapeTest.source, "g");
37308   var escapeTestNoEncode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/;
37309   var escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, "g");
37310   var escapeReplacements = {
37311     "&": "&amp;",
37312     "<": "&lt;",
37313     ">": "&gt;",
37314     '"': "&quot;",
37315     "'": "&#39;"
37316   };
37317   var getEscapeReplacement = (ch) => escapeReplacements[ch];
37318   function escape$1(html3, encode) {
37319     if (encode) {
37320       if (escapeTest.test(html3)) {
37321         return html3.replace(escapeReplace, getEscapeReplacement);
37322       }
37323     } else {
37324       if (escapeTestNoEncode.test(html3)) {
37325         return html3.replace(escapeReplaceNoEncode, getEscapeReplacement);
37326       }
37327     }
37328     return html3;
37329   }
37330   var caret = /(^|[^\[])\^/g;
37331   function edit(regex, opt) {
37332     let source = typeof regex === "string" ? regex : regex.source;
37333     opt = opt || "";
37334     const obj = {
37335       replace: (name, val) => {
37336         let valSource = typeof val === "string" ? val : val.source;
37337         valSource = valSource.replace(caret, "$1");
37338         source = source.replace(name, valSource);
37339         return obj;
37340       },
37341       getRegex: () => {
37342         return new RegExp(source, opt);
37343       }
37344     };
37345     return obj;
37346   }
37347   function cleanUrl(href) {
37348     try {
37349       href = encodeURI(href).replace(/%25/g, "%");
37350     } catch {
37351       return null;
37352     }
37353     return href;
37354   }
37355   var noopTest = { exec: () => null };
37356   function splitCells(tableRow, count) {
37357     const row = tableRow.replace(/\|/g, (match, offset, str) => {
37358       let escaped = false;
37359       let curr = offset;
37360       while (--curr >= 0 && str[curr] === "\\")
37361         escaped = !escaped;
37362       if (escaped) {
37363         return "|";
37364       } else {
37365         return " |";
37366       }
37367     }), cells = row.split(/ \|/);
37368     let i3 = 0;
37369     if (!cells[0].trim()) {
37370       cells.shift();
37371     }
37372     if (cells.length > 0 && !cells[cells.length - 1].trim()) {
37373       cells.pop();
37374     }
37375     if (count) {
37376       if (cells.length > count) {
37377         cells.splice(count);
37378       } else {
37379         while (cells.length < count)
37380           cells.push("");
37381       }
37382     }
37383     for (; i3 < cells.length; i3++) {
37384       cells[i3] = cells[i3].trim().replace(/\\\|/g, "|");
37385     }
37386     return cells;
37387   }
37388   function rtrim(str, c2, invert) {
37389     const l2 = str.length;
37390     if (l2 === 0) {
37391       return "";
37392     }
37393     let suffLen = 0;
37394     while (suffLen < l2) {
37395       const currChar = str.charAt(l2 - suffLen - 1);
37396       if (currChar === c2 && !invert) {
37397         suffLen++;
37398       } else if (currChar !== c2 && invert) {
37399         suffLen++;
37400       } else {
37401         break;
37402       }
37403     }
37404     return str.slice(0, l2 - suffLen);
37405   }
37406   function findClosingBracket(str, b2) {
37407     if (str.indexOf(b2[1]) === -1) {
37408       return -1;
37409     }
37410     let level = 0;
37411     for (let i3 = 0; i3 < str.length; i3++) {
37412       if (str[i3] === "\\") {
37413         i3++;
37414       } else if (str[i3] === b2[0]) {
37415         level++;
37416       } else if (str[i3] === b2[1]) {
37417         level--;
37418         if (level < 0) {
37419           return i3;
37420         }
37421       }
37422     }
37423     return -1;
37424   }
37425   function outputLink(cap, link3, raw, lexer2) {
37426     const href = link3.href;
37427     const title = link3.title ? escape$1(link3.title) : null;
37428     const text = cap[1].replace(/\\([\[\]])/g, "$1");
37429     if (cap[0].charAt(0) !== "!") {
37430       lexer2.state.inLink = true;
37431       const token = {
37432         type: "link",
37433         raw,
37434         href,
37435         title,
37436         text,
37437         tokens: lexer2.inlineTokens(text)
37438       };
37439       lexer2.state.inLink = false;
37440       return token;
37441     }
37442     return {
37443       type: "image",
37444       raw,
37445       href,
37446       title,
37447       text: escape$1(text)
37448     };
37449   }
37450   function indentCodeCompensation(raw, text) {
37451     const matchIndentToCode = raw.match(/^(\s+)(?:```)/);
37452     if (matchIndentToCode === null) {
37453       return text;
37454     }
37455     const indentToCode = matchIndentToCode[1];
37456     return text.split("\n").map((node) => {
37457       const matchIndentInNode = node.match(/^\s+/);
37458       if (matchIndentInNode === null) {
37459         return node;
37460       }
37461       const [indentInNode] = matchIndentInNode;
37462       if (indentInNode.length >= indentToCode.length) {
37463         return node.slice(indentToCode.length);
37464       }
37465       return node;
37466     }).join("\n");
37467   }
37468   var _Tokenizer = class {
37469     // set by the lexer
37470     constructor(options2) {
37471       __publicField(this, "options");
37472       __publicField(this, "rules");
37473       // set by the lexer
37474       __publicField(this, "lexer");
37475       this.options = options2 || _defaults;
37476     }
37477     space(src) {
37478       const cap = this.rules.block.newline.exec(src);
37479       if (cap && cap[0].length > 0) {
37480         return {
37481           type: "space",
37482           raw: cap[0]
37483         };
37484       }
37485     }
37486     code(src) {
37487       const cap = this.rules.block.code.exec(src);
37488       if (cap) {
37489         const text = cap[0].replace(/^ {1,4}/gm, "");
37490         return {
37491           type: "code",
37492           raw: cap[0],
37493           codeBlockStyle: "indented",
37494           text: !this.options.pedantic ? rtrim(text, "\n") : text
37495         };
37496       }
37497     }
37498     fences(src) {
37499       const cap = this.rules.block.fences.exec(src);
37500       if (cap) {
37501         const raw = cap[0];
37502         const text = indentCodeCompensation(raw, cap[3] || "");
37503         return {
37504           type: "code",
37505           raw,
37506           lang: cap[2] ? cap[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : cap[2],
37507           text
37508         };
37509       }
37510     }
37511     heading(src) {
37512       const cap = this.rules.block.heading.exec(src);
37513       if (cap) {
37514         let text = cap[2].trim();
37515         if (/#$/.test(text)) {
37516           const trimmed = rtrim(text, "#");
37517           if (this.options.pedantic) {
37518             text = trimmed.trim();
37519           } else if (!trimmed || / $/.test(trimmed)) {
37520             text = trimmed.trim();
37521           }
37522         }
37523         return {
37524           type: "heading",
37525           raw: cap[0],
37526           depth: cap[1].length,
37527           text,
37528           tokens: this.lexer.inline(text)
37529         };
37530       }
37531     }
37532     hr(src) {
37533       const cap = this.rules.block.hr.exec(src);
37534       if (cap) {
37535         return {
37536           type: "hr",
37537           raw: rtrim(cap[0], "\n")
37538         };
37539       }
37540     }
37541     blockquote(src) {
37542       const cap = this.rules.block.blockquote.exec(src);
37543       if (cap) {
37544         let lines = rtrim(cap[0], "\n").split("\n");
37545         let raw = "";
37546         let text = "";
37547         const tokens = [];
37548         while (lines.length > 0) {
37549           let inBlockquote = false;
37550           const currentLines = [];
37551           let i3;
37552           for (i3 = 0; i3 < lines.length; i3++) {
37553             if (/^ {0,3}>/.test(lines[i3])) {
37554               currentLines.push(lines[i3]);
37555               inBlockquote = true;
37556             } else if (!inBlockquote) {
37557               currentLines.push(lines[i3]);
37558             } else {
37559               break;
37560             }
37561           }
37562           lines = lines.slice(i3);
37563           const currentRaw = currentLines.join("\n");
37564           const currentText = currentRaw.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g, "\n    $1").replace(/^ {0,3}>[ \t]?/gm, "");
37565           raw = raw ? "".concat(raw, "\n").concat(currentRaw) : currentRaw;
37566           text = text ? "".concat(text, "\n").concat(currentText) : currentText;
37567           const top = this.lexer.state.top;
37568           this.lexer.state.top = true;
37569           this.lexer.blockTokens(currentText, tokens, true);
37570           this.lexer.state.top = top;
37571           if (lines.length === 0) {
37572             break;
37573           }
37574           const lastToken = tokens[tokens.length - 1];
37575           if ((lastToken == null ? void 0 : lastToken.type) === "code") {
37576             break;
37577           } else if ((lastToken == null ? void 0 : lastToken.type) === "blockquote") {
37578             const oldToken = lastToken;
37579             const newText = oldToken.raw + "\n" + lines.join("\n");
37580             const newToken = this.blockquote(newText);
37581             tokens[tokens.length - 1] = newToken;
37582             raw = raw.substring(0, raw.length - oldToken.raw.length) + newToken.raw;
37583             text = text.substring(0, text.length - oldToken.text.length) + newToken.text;
37584             break;
37585           } else if ((lastToken == null ? void 0 : lastToken.type) === "list") {
37586             const oldToken = lastToken;
37587             const newText = oldToken.raw + "\n" + lines.join("\n");
37588             const newToken = this.list(newText);
37589             tokens[tokens.length - 1] = newToken;
37590             raw = raw.substring(0, raw.length - lastToken.raw.length) + newToken.raw;
37591             text = text.substring(0, text.length - oldToken.raw.length) + newToken.raw;
37592             lines = newText.substring(tokens[tokens.length - 1].raw.length).split("\n");
37593             continue;
37594           }
37595         }
37596         return {
37597           type: "blockquote",
37598           raw,
37599           tokens,
37600           text
37601         };
37602       }
37603     }
37604     list(src) {
37605       let cap = this.rules.block.list.exec(src);
37606       if (cap) {
37607         let bull = cap[1].trim();
37608         const isordered = bull.length > 1;
37609         const list2 = {
37610           type: "list",
37611           raw: "",
37612           ordered: isordered,
37613           start: isordered ? +bull.slice(0, -1) : "",
37614           loose: false,
37615           items: []
37616         };
37617         bull = isordered ? "\\d{1,9}\\".concat(bull.slice(-1)) : "\\".concat(bull);
37618         if (this.options.pedantic) {
37619           bull = isordered ? bull : "[*+-]";
37620         }
37621         const itemRegex = new RegExp("^( {0,3}".concat(bull, ")((?:[     ][^\\n]*)?(?:\\n|$))"));
37622         let endsWithBlankLine = false;
37623         while (src) {
37624           let endEarly = false;
37625           let raw = "";
37626           let itemContents = "";
37627           if (!(cap = itemRegex.exec(src))) {
37628             break;
37629           }
37630           if (this.rules.block.hr.test(src)) {
37631             break;
37632           }
37633           raw = cap[0];
37634           src = src.substring(raw.length);
37635           let line = cap[2].split("\n", 1)[0].replace(/^\t+/, (t2) => " ".repeat(3 * t2.length));
37636           let nextLine = src.split("\n", 1)[0];
37637           let blankLine = !line.trim();
37638           let indent = 0;
37639           if (this.options.pedantic) {
37640             indent = 2;
37641             itemContents = line.trimStart();
37642           } else if (blankLine) {
37643             indent = cap[1].length + 1;
37644           } else {
37645             indent = cap[2].search(/[^ ]/);
37646             indent = indent > 4 ? 1 : indent;
37647             itemContents = line.slice(indent);
37648             indent += cap[1].length;
37649           }
37650           if (blankLine && /^ *$/.test(nextLine)) {
37651             raw += nextLine + "\n";
37652             src = src.substring(nextLine.length + 1);
37653             endEarly = true;
37654           }
37655           if (!endEarly) {
37656             const nextBulletRegex = new RegExp("^ {0,".concat(Math.min(3, indent - 1), "}(?:[*+-]|\\d{1,9}[.)])((?:[    ][^\\n]*)?(?:\\n|$))"));
37657             const hrRegex = new RegExp("^ {0,".concat(Math.min(3, indent - 1), "}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)"));
37658             const fencesBeginRegex = new RegExp("^ {0,".concat(Math.min(3, indent - 1), "}(?:```|~~~)"));
37659             const headingBeginRegex = new RegExp("^ {0,".concat(Math.min(3, indent - 1), "}#"));
37660             while (src) {
37661               const rawLine = src.split("\n", 1)[0];
37662               nextLine = rawLine;
37663               if (this.options.pedantic) {
37664                 nextLine = nextLine.replace(/^ {1,4}(?=( {4})*[^ ])/g, "  ");
37665               }
37666               if (fencesBeginRegex.test(nextLine)) {
37667                 break;
37668               }
37669               if (headingBeginRegex.test(nextLine)) {
37670                 break;
37671               }
37672               if (nextBulletRegex.test(nextLine)) {
37673                 break;
37674               }
37675               if (hrRegex.test(src)) {
37676                 break;
37677               }
37678               if (nextLine.search(/[^ ]/) >= indent || !nextLine.trim()) {
37679                 itemContents += "\n" + nextLine.slice(indent);
37680               } else {
37681                 if (blankLine) {
37682                   break;
37683                 }
37684                 if (line.search(/[^ ]/) >= 4) {
37685                   break;
37686                 }
37687                 if (fencesBeginRegex.test(line)) {
37688                   break;
37689                 }
37690                 if (headingBeginRegex.test(line)) {
37691                   break;
37692                 }
37693                 if (hrRegex.test(line)) {
37694                   break;
37695                 }
37696                 itemContents += "\n" + nextLine;
37697               }
37698               if (!blankLine && !nextLine.trim()) {
37699                 blankLine = true;
37700               }
37701               raw += rawLine + "\n";
37702               src = src.substring(rawLine.length + 1);
37703               line = nextLine.slice(indent);
37704             }
37705           }
37706           if (!list2.loose) {
37707             if (endsWithBlankLine) {
37708               list2.loose = true;
37709             } else if (/\n *\n *$/.test(raw)) {
37710               endsWithBlankLine = true;
37711             }
37712           }
37713           let istask = null;
37714           let ischecked;
37715           if (this.options.gfm) {
37716             istask = /^\[[ xX]\] /.exec(itemContents);
37717             if (istask) {
37718               ischecked = istask[0] !== "[ ] ";
37719               itemContents = itemContents.replace(/^\[[ xX]\] +/, "");
37720             }
37721           }
37722           list2.items.push({
37723             type: "list_item",
37724             raw,
37725             task: !!istask,
37726             checked: ischecked,
37727             loose: false,
37728             text: itemContents,
37729             tokens: []
37730           });
37731           list2.raw += raw;
37732         }
37733         list2.items[list2.items.length - 1].raw = list2.items[list2.items.length - 1].raw.trimEnd();
37734         list2.items[list2.items.length - 1].text = list2.items[list2.items.length - 1].text.trimEnd();
37735         list2.raw = list2.raw.trimEnd();
37736         for (let i3 = 0; i3 < list2.items.length; i3++) {
37737           this.lexer.state.top = false;
37738           list2.items[i3].tokens = this.lexer.blockTokens(list2.items[i3].text, []);
37739           if (!list2.loose) {
37740             const spacers = list2.items[i3].tokens.filter((t2) => t2.type === "space");
37741             const hasMultipleLineBreaks = spacers.length > 0 && spacers.some((t2) => /\n.*\n/.test(t2.raw));
37742             list2.loose = hasMultipleLineBreaks;
37743           }
37744         }
37745         if (list2.loose) {
37746           for (let i3 = 0; i3 < list2.items.length; i3++) {
37747             list2.items[i3].loose = true;
37748           }
37749         }
37750         return list2;
37751       }
37752     }
37753     html(src) {
37754       const cap = this.rules.block.html.exec(src);
37755       if (cap) {
37756         const token = {
37757           type: "html",
37758           block: true,
37759           raw: cap[0],
37760           pre: cap[1] === "pre" || cap[1] === "script" || cap[1] === "style",
37761           text: cap[0]
37762         };
37763         return token;
37764       }
37765     }
37766     def(src) {
37767       const cap = this.rules.block.def.exec(src);
37768       if (cap) {
37769         const tag2 = cap[1].toLowerCase().replace(/\s+/g, " ");
37770         const href = cap[2] ? cap[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "";
37771         const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : cap[3];
37772         return {
37773           type: "def",
37774           tag: tag2,
37775           raw: cap[0],
37776           href,
37777           title
37778         };
37779       }
37780     }
37781     table(src) {
37782       const cap = this.rules.block.table.exec(src);
37783       if (!cap) {
37784         return;
37785       }
37786       if (!/[:|]/.test(cap[2])) {
37787         return;
37788       }
37789       const headers = splitCells(cap[1]);
37790       const aligns = cap[2].replace(/^\||\| *$/g, "").split("|");
37791       const rows = cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, "").split("\n") : [];
37792       const item = {
37793         type: "table",
37794         raw: cap[0],
37795         header: [],
37796         align: [],
37797         rows: []
37798       };
37799       if (headers.length !== aligns.length) {
37800         return;
37801       }
37802       for (const align of aligns) {
37803         if (/^ *-+: *$/.test(align)) {
37804           item.align.push("right");
37805         } else if (/^ *:-+: *$/.test(align)) {
37806           item.align.push("center");
37807         } else if (/^ *:-+ *$/.test(align)) {
37808           item.align.push("left");
37809         } else {
37810           item.align.push(null);
37811         }
37812       }
37813       for (let i3 = 0; i3 < headers.length; i3++) {
37814         item.header.push({
37815           text: headers[i3],
37816           tokens: this.lexer.inline(headers[i3]),
37817           header: true,
37818           align: item.align[i3]
37819         });
37820       }
37821       for (const row of rows) {
37822         item.rows.push(splitCells(row, item.header.length).map((cell, i3) => {
37823           return {
37824             text: cell,
37825             tokens: this.lexer.inline(cell),
37826             header: false,
37827             align: item.align[i3]
37828           };
37829         }));
37830       }
37831       return item;
37832     }
37833     lheading(src) {
37834       const cap = this.rules.block.lheading.exec(src);
37835       if (cap) {
37836         return {
37837           type: "heading",
37838           raw: cap[0],
37839           depth: cap[2].charAt(0) === "=" ? 1 : 2,
37840           text: cap[1],
37841           tokens: this.lexer.inline(cap[1])
37842         };
37843       }
37844     }
37845     paragraph(src) {
37846       const cap = this.rules.block.paragraph.exec(src);
37847       if (cap) {
37848         const text = cap[1].charAt(cap[1].length - 1) === "\n" ? cap[1].slice(0, -1) : cap[1];
37849         return {
37850           type: "paragraph",
37851           raw: cap[0],
37852           text,
37853           tokens: this.lexer.inline(text)
37854         };
37855       }
37856     }
37857     text(src) {
37858       const cap = this.rules.block.text.exec(src);
37859       if (cap) {
37860         return {
37861           type: "text",
37862           raw: cap[0],
37863           text: cap[0],
37864           tokens: this.lexer.inline(cap[0])
37865         };
37866       }
37867     }
37868     escape(src) {
37869       const cap = this.rules.inline.escape.exec(src);
37870       if (cap) {
37871         return {
37872           type: "escape",
37873           raw: cap[0],
37874           text: escape$1(cap[1])
37875         };
37876       }
37877     }
37878     tag(src) {
37879       const cap = this.rules.inline.tag.exec(src);
37880       if (cap) {
37881         if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {
37882           this.lexer.state.inLink = true;
37883         } else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) {
37884           this.lexer.state.inLink = false;
37885         }
37886         if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
37887           this.lexer.state.inRawBlock = true;
37888         } else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
37889           this.lexer.state.inRawBlock = false;
37890         }
37891         return {
37892           type: "html",
37893           raw: cap[0],
37894           inLink: this.lexer.state.inLink,
37895           inRawBlock: this.lexer.state.inRawBlock,
37896           block: false,
37897           text: cap[0]
37898         };
37899       }
37900     }
37901     link(src) {
37902       const cap = this.rules.inline.link.exec(src);
37903       if (cap) {
37904         const trimmedUrl = cap[2].trim();
37905         if (!this.options.pedantic && /^</.test(trimmedUrl)) {
37906           if (!/>$/.test(trimmedUrl)) {
37907             return;
37908           }
37909           const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), "\\");
37910           if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
37911             return;
37912           }
37913         } else {
37914           const lastParenIndex = findClosingBracket(cap[2], "()");
37915           if (lastParenIndex > -1) {
37916             const start2 = cap[0].indexOf("!") === 0 ? 5 : 4;
37917             const linkLen = start2 + cap[1].length + lastParenIndex;
37918             cap[2] = cap[2].substring(0, lastParenIndex);
37919             cap[0] = cap[0].substring(0, linkLen).trim();
37920             cap[3] = "";
37921           }
37922         }
37923         let href = cap[2];
37924         let title = "";
37925         if (this.options.pedantic) {
37926           const link3 = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
37927           if (link3) {
37928             href = link3[1];
37929             title = link3[3];
37930           }
37931         } else {
37932           title = cap[3] ? cap[3].slice(1, -1) : "";
37933         }
37934         href = href.trim();
37935         if (/^</.test(href)) {
37936           if (this.options.pedantic && !/>$/.test(trimmedUrl)) {
37937             href = href.slice(1);
37938           } else {
37939             href = href.slice(1, -1);
37940           }
37941         }
37942         return outputLink(cap, {
37943           href: href ? href.replace(this.rules.inline.anyPunctuation, "$1") : href,
37944           title: title ? title.replace(this.rules.inline.anyPunctuation, "$1") : title
37945         }, cap[0], this.lexer);
37946       }
37947     }
37948     reflink(src, links) {
37949       let cap;
37950       if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
37951         const linkString = (cap[2] || cap[1]).replace(/\s+/g, " ");
37952         const link3 = links[linkString.toLowerCase()];
37953         if (!link3) {
37954           const text = cap[0].charAt(0);
37955           return {
37956             type: "text",
37957             raw: text,
37958             text
37959           };
37960         }
37961         return outputLink(cap, link3, cap[0], this.lexer);
37962       }
37963     }
37964     emStrong(src, maskedSrc, prevChar = "") {
37965       let match = this.rules.inline.emStrongLDelim.exec(src);
37966       if (!match)
37967         return;
37968       if (match[3] && prevChar.match(/[\p{L}\p{N}]/u))
37969         return;
37970       const nextChar = match[1] || match[2] || "";
37971       if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) {
37972         const lLength = [...match[0]].length - 1;
37973         let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;
37974         const endReg = match[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
37975         endReg.lastIndex = 0;
37976         maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
37977         while ((match = endReg.exec(maskedSrc)) != null) {
37978           rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
37979           if (!rDelim)
37980             continue;
37981           rLength = [...rDelim].length;
37982           if (match[3] || match[4]) {
37983             delimTotal += rLength;
37984             continue;
37985           } else if (match[5] || match[6]) {
37986             if (lLength % 3 && !((lLength + rLength) % 3)) {
37987               midDelimTotal += rLength;
37988               continue;
37989             }
37990           }
37991           delimTotal -= rLength;
37992           if (delimTotal > 0)
37993             continue;
37994           rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
37995           const lastCharLength = [...match[0]][0].length;
37996           const raw = src.slice(0, lLength + match.index + lastCharLength + rLength);
37997           if (Math.min(lLength, rLength) % 2) {
37998             const text2 = raw.slice(1, -1);
37999             return {
38000               type: "em",
38001               raw,
38002               text: text2,
38003               tokens: this.lexer.inlineTokens(text2)
38004             };
38005           }
38006           const text = raw.slice(2, -2);
38007           return {
38008             type: "strong",
38009             raw,
38010             text,
38011             tokens: this.lexer.inlineTokens(text)
38012           };
38013         }
38014       }
38015     }
38016     codespan(src) {
38017       const cap = this.rules.inline.code.exec(src);
38018       if (cap) {
38019         let text = cap[2].replace(/\n/g, " ");
38020         const hasNonSpaceChars = /[^ ]/.test(text);
38021         const hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text);
38022         if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
38023           text = text.substring(1, text.length - 1);
38024         }
38025         text = escape$1(text, true);
38026         return {
38027           type: "codespan",
38028           raw: cap[0],
38029           text
38030         };
38031       }
38032     }
38033     br(src) {
38034       const cap = this.rules.inline.br.exec(src);
38035       if (cap) {
38036         return {
38037           type: "br",
38038           raw: cap[0]
38039         };
38040       }
38041     }
38042     del(src) {
38043       const cap = this.rules.inline.del.exec(src);
38044       if (cap) {
38045         return {
38046           type: "del",
38047           raw: cap[0],
38048           text: cap[2],
38049           tokens: this.lexer.inlineTokens(cap[2])
38050         };
38051       }
38052     }
38053     autolink(src) {
38054       const cap = this.rules.inline.autolink.exec(src);
38055       if (cap) {
38056         let text, href;
38057         if (cap[2] === "@") {
38058           text = escape$1(cap[1]);
38059           href = "mailto:" + text;
38060         } else {
38061           text = escape$1(cap[1]);
38062           href = text;
38063         }
38064         return {
38065           type: "link",
38066           raw: cap[0],
38067           text,
38068           href,
38069           tokens: [
38070             {
38071               type: "text",
38072               raw: text,
38073               text
38074             }
38075           ]
38076         };
38077       }
38078     }
38079     url(src) {
38080       var _a3, _b3;
38081       let cap;
38082       if (cap = this.rules.inline.url.exec(src)) {
38083         let text, href;
38084         if (cap[2] === "@") {
38085           text = escape$1(cap[0]);
38086           href = "mailto:" + text;
38087         } else {
38088           let prevCapZero;
38089           do {
38090             prevCapZero = cap[0];
38091             cap[0] = (_b3 = (_a3 = this.rules.inline._backpedal.exec(cap[0])) == null ? void 0 : _a3[0]) != null ? _b3 : "";
38092           } while (prevCapZero !== cap[0]);
38093           text = escape$1(cap[0]);
38094           if (cap[1] === "www.") {
38095             href = "http://" + cap[0];
38096           } else {
38097             href = cap[0];
38098           }
38099         }
38100         return {
38101           type: "link",
38102           raw: cap[0],
38103           text,
38104           href,
38105           tokens: [
38106             {
38107               type: "text",
38108               raw: text,
38109               text
38110             }
38111           ]
38112         };
38113       }
38114     }
38115     inlineText(src) {
38116       const cap = this.rules.inline.text.exec(src);
38117       if (cap) {
38118         let text;
38119         if (this.lexer.state.inRawBlock) {
38120           text = cap[0];
38121         } else {
38122           text = escape$1(cap[0]);
38123         }
38124         return {
38125           type: "text",
38126           raw: cap[0],
38127           text
38128         };
38129       }
38130     }
38131   };
38132   var newline = /^(?: *(?:\n|$))+/;
38133   var blockCode = /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/;
38134   var fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
38135   var hr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
38136   var heading = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
38137   var bullet = /(?:[*+-]|\d{1,9}[.)])/;
38138   var lheading = edit(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, bullet).replace(/blockCode/g, / {4}/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).getRegex();
38139   var _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
38140   var blockText = /^[^\n]+/;
38141   var _blockLabel = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
38142   var def = edit(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label", _blockLabel).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
38143   var list = edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, bullet).getRegex();
38144   var _tag = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
38145   var _comment = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
38146   var html2 = edit("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))", "i").replace("comment", _comment).replace("tag", _tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
38147   var paragraph = edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex();
38148   var blockquote = edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", paragraph).getRegex();
38149   var blockNormal = {
38150     blockquote,
38151     code: blockCode,
38152     def,
38153     fences,
38154     heading,
38155     hr,
38156     html: html2,
38157     lheading,
38158     list,
38159     newline,
38160     paragraph,
38161     table: noopTest,
38162     text: blockText
38163   };
38164   var gfmTable = edit("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex();
38165   var blockGfm = {
38166     ...blockNormal,
38167     table: gfmTable,
38168     paragraph: edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", gfmTable).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex()
38169   };
38170   var blockPedantic = {
38171     ...blockNormal,
38172     html: edit("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", _comment).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
38173     def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
38174     heading: /^(#{1,6})(.*)(?:\n+|$)/,
38175     fences: noopTest,
38176     // fences not supported
38177     lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
38178     paragraph: edit(_paragraph).replace("hr", hr).replace("heading", " *#{1,6} *[^\n]").replace("lheading", lheading).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
38179   };
38180   var escape4 = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
38181   var inlineCode = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
38182   var br = /^( {2,}|\\)\n(?!\s*$)/;
38183   var inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
38184   var _punctuation = "\\p{P}\\p{S}";
38185   var punctuation = edit(/^((?![*_])[\spunctuation])/, "u").replace(/punctuation/g, _punctuation).getRegex();
38186   var blockSkip = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g;
38187   var emStrongLDelim = edit(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, "u").replace(/punct/g, _punctuation).getRegex();
38188   var emStrongRDelimAst = edit("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])", "gu").replace(/punct/g, _punctuation).getRegex();
38189   var emStrongRDelimUnd = edit("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])", "gu").replace(/punct/g, _punctuation).getRegex();
38190   var anyPunctuation = edit(/\\([punct])/, "gu").replace(/punct/g, _punctuation).getRegex();
38191   var autolink = edit(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex();
38192   var _inlineComment = edit(_comment).replace("(?:-->|$)", "-->").getRegex();
38193   var tag = edit("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", _inlineComment).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
38194   var _inlineLabel = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
38195   var link2 = edit(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label", _inlineLabel).replace("href", /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
38196   var reflink = edit(/^!?\[(label)\]\[(ref)\]/).replace("label", _inlineLabel).replace("ref", _blockLabel).getRegex();
38197   var nolink = edit(/^!?\[(ref)\](?:\[\])?/).replace("ref", _blockLabel).getRegex();
38198   var reflinkSearch = edit("reflink|nolink(?!\\()", "g").replace("reflink", reflink).replace("nolink", nolink).getRegex();
38199   var inlineNormal = {
38200     _backpedal: noopTest,
38201     // only used for GFM url
38202     anyPunctuation,
38203     autolink,
38204     blockSkip,
38205     br,
38206     code: inlineCode,
38207     del: noopTest,
38208     emStrongLDelim,
38209     emStrongRDelimAst,
38210     emStrongRDelimUnd,
38211     escape: escape4,
38212     link: link2,
38213     nolink,
38214     punctuation,
38215     reflink,
38216     reflinkSearch,
38217     tag,
38218     text: inlineText,
38219     url: noopTest
38220   };
38221   var inlinePedantic = {
38222     ...inlineNormal,
38223     link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", _inlineLabel).getRegex(),
38224     reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", _inlineLabel).getRegex()
38225   };
38226   var inlineGfm = {
38227     ...inlineNormal,
38228     escape: edit(escape4).replace("])", "~|])").getRegex(),
38229     url: edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
38230     _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
38231     del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
38232     text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
38233   };
38234   var inlineBreaks = {
38235     ...inlineGfm,
38236     br: edit(br).replace("{2,}", "*").getRegex(),
38237     text: edit(inlineGfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
38238   };
38239   var block = {
38240     normal: blockNormal,
38241     gfm: blockGfm,
38242     pedantic: blockPedantic
38243   };
38244   var inline = {
38245     normal: inlineNormal,
38246     gfm: inlineGfm,
38247     breaks: inlineBreaks,
38248     pedantic: inlinePedantic
38249   };
38250   var _Lexer = class __Lexer {
38251     constructor(options2) {
38252       __publicField(this, "tokens");
38253       __publicField(this, "options");
38254       __publicField(this, "state");
38255       __publicField(this, "tokenizer");
38256       __publicField(this, "inlineQueue");
38257       this.tokens = [];
38258       this.tokens.links = /* @__PURE__ */ Object.create(null);
38259       this.options = options2 || _defaults;
38260       this.options.tokenizer = this.options.tokenizer || new _Tokenizer();
38261       this.tokenizer = this.options.tokenizer;
38262       this.tokenizer.options = this.options;
38263       this.tokenizer.lexer = this;
38264       this.inlineQueue = [];
38265       this.state = {
38266         inLink: false,
38267         inRawBlock: false,
38268         top: true
38269       };
38270       const rules = {
38271         block: block.normal,
38272         inline: inline.normal
38273       };
38274       if (this.options.pedantic) {
38275         rules.block = block.pedantic;
38276         rules.inline = inline.pedantic;
38277       } else if (this.options.gfm) {
38278         rules.block = block.gfm;
38279         if (this.options.breaks) {
38280           rules.inline = inline.breaks;
38281         } else {
38282           rules.inline = inline.gfm;
38283         }
38284       }
38285       this.tokenizer.rules = rules;
38286     }
38287     /**
38288      * Expose Rules
38289      */
38290     static get rules() {
38291       return {
38292         block,
38293         inline
38294       };
38295     }
38296     /**
38297      * Static Lex Method
38298      */
38299     static lex(src, options2) {
38300       const lexer2 = new __Lexer(options2);
38301       return lexer2.lex(src);
38302     }
38303     /**
38304      * Static Lex Inline Method
38305      */
38306     static lexInline(src, options2) {
38307       const lexer2 = new __Lexer(options2);
38308       return lexer2.inlineTokens(src);
38309     }
38310     /**
38311      * Preprocessing
38312      */
38313     lex(src) {
38314       src = src.replace(/\r\n|\r/g, "\n");
38315       this.blockTokens(src, this.tokens);
38316       for (let i3 = 0; i3 < this.inlineQueue.length; i3++) {
38317         const next = this.inlineQueue[i3];
38318         this.inlineTokens(next.src, next.tokens);
38319       }
38320       this.inlineQueue = [];
38321       return this.tokens;
38322     }
38323     blockTokens(src, tokens = [], lastParagraphClipped = false) {
38324       if (this.options.pedantic) {
38325         src = src.replace(/\t/g, "    ").replace(/^ +$/gm, "");
38326       } else {
38327         src = src.replace(/^( *)(\t+)/gm, (_2, leading, tabs) => {
38328           return leading + "    ".repeat(tabs.length);
38329         });
38330       }
38331       let token;
38332       let lastToken;
38333       let cutSrc;
38334       while (src) {
38335         if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((extTokenizer) => {
38336           if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
38337             src = src.substring(token.raw.length);
38338             tokens.push(token);
38339             return true;
38340           }
38341           return false;
38342         })) {
38343           continue;
38344         }
38345         if (token = this.tokenizer.space(src)) {
38346           src = src.substring(token.raw.length);
38347           if (token.raw.length === 1 && tokens.length > 0) {
38348             tokens[tokens.length - 1].raw += "\n";
38349           } else {
38350             tokens.push(token);
38351           }
38352           continue;
38353         }
38354         if (token = this.tokenizer.code(src)) {
38355           src = src.substring(token.raw.length);
38356           lastToken = tokens[tokens.length - 1];
38357           if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
38358             lastToken.raw += "\n" + token.raw;
38359             lastToken.text += "\n" + token.text;
38360             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
38361           } else {
38362             tokens.push(token);
38363           }
38364           continue;
38365         }
38366         if (token = this.tokenizer.fences(src)) {
38367           src = src.substring(token.raw.length);
38368           tokens.push(token);
38369           continue;
38370         }
38371         if (token = this.tokenizer.heading(src)) {
38372           src = src.substring(token.raw.length);
38373           tokens.push(token);
38374           continue;
38375         }
38376         if (token = this.tokenizer.hr(src)) {
38377           src = src.substring(token.raw.length);
38378           tokens.push(token);
38379           continue;
38380         }
38381         if (token = this.tokenizer.blockquote(src)) {
38382           src = src.substring(token.raw.length);
38383           tokens.push(token);
38384           continue;
38385         }
38386         if (token = this.tokenizer.list(src)) {
38387           src = src.substring(token.raw.length);
38388           tokens.push(token);
38389           continue;
38390         }
38391         if (token = this.tokenizer.html(src)) {
38392           src = src.substring(token.raw.length);
38393           tokens.push(token);
38394           continue;
38395         }
38396         if (token = this.tokenizer.def(src)) {
38397           src = src.substring(token.raw.length);
38398           lastToken = tokens[tokens.length - 1];
38399           if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
38400             lastToken.raw += "\n" + token.raw;
38401             lastToken.text += "\n" + token.raw;
38402             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
38403           } else if (!this.tokens.links[token.tag]) {
38404             this.tokens.links[token.tag] = {
38405               href: token.href,
38406               title: token.title
38407             };
38408           }
38409           continue;
38410         }
38411         if (token = this.tokenizer.table(src)) {
38412           src = src.substring(token.raw.length);
38413           tokens.push(token);
38414           continue;
38415         }
38416         if (token = this.tokenizer.lheading(src)) {
38417           src = src.substring(token.raw.length);
38418           tokens.push(token);
38419           continue;
38420         }
38421         cutSrc = src;
38422         if (this.options.extensions && this.options.extensions.startBlock) {
38423           let startIndex = Infinity;
38424           const tempSrc = src.slice(1);
38425           let tempStart;
38426           this.options.extensions.startBlock.forEach((getStartIndex) => {
38427             tempStart = getStartIndex.call({ lexer: this }, tempSrc);
38428             if (typeof tempStart === "number" && tempStart >= 0) {
38429               startIndex = Math.min(startIndex, tempStart);
38430             }
38431           });
38432           if (startIndex < Infinity && startIndex >= 0) {
38433             cutSrc = src.substring(0, startIndex + 1);
38434           }
38435         }
38436         if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
38437           lastToken = tokens[tokens.length - 1];
38438           if (lastParagraphClipped && (lastToken == null ? void 0 : lastToken.type) === "paragraph") {
38439             lastToken.raw += "\n" + token.raw;
38440             lastToken.text += "\n" + token.text;
38441             this.inlineQueue.pop();
38442             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
38443           } else {
38444             tokens.push(token);
38445           }
38446           lastParagraphClipped = cutSrc.length !== src.length;
38447           src = src.substring(token.raw.length);
38448           continue;
38449         }
38450         if (token = this.tokenizer.text(src)) {
38451           src = src.substring(token.raw.length);
38452           lastToken = tokens[tokens.length - 1];
38453           if (lastToken && lastToken.type === "text") {
38454             lastToken.raw += "\n" + token.raw;
38455             lastToken.text += "\n" + token.text;
38456             this.inlineQueue.pop();
38457             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
38458           } else {
38459             tokens.push(token);
38460           }
38461           continue;
38462         }
38463         if (src) {
38464           const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
38465           if (this.options.silent) {
38466             console.error(errMsg);
38467             break;
38468           } else {
38469             throw new Error(errMsg);
38470           }
38471         }
38472       }
38473       this.state.top = true;
38474       return tokens;
38475     }
38476     inline(src, tokens = []) {
38477       this.inlineQueue.push({ src, tokens });
38478       return tokens;
38479     }
38480     /**
38481      * Lexing/Compiling
38482      */
38483     inlineTokens(src, tokens = []) {
38484       let token, lastToken, cutSrc;
38485       let maskedSrc = src;
38486       let match;
38487       let keepPrevChar, prevChar;
38488       if (this.tokens.links) {
38489         const links = Object.keys(this.tokens.links);
38490         if (links.length > 0) {
38491           while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
38492             if (links.includes(match[0].slice(match[0].lastIndexOf("[") + 1, -1))) {
38493               maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
38494             }
38495           }
38496         }
38497       }
38498       while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
38499         maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
38500       }
38501       while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) {
38502         maskedSrc = maskedSrc.slice(0, match.index) + "++" + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
38503       }
38504       while (src) {
38505         if (!keepPrevChar) {
38506           prevChar = "";
38507         }
38508         keepPrevChar = false;
38509         if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((extTokenizer) => {
38510           if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
38511             src = src.substring(token.raw.length);
38512             tokens.push(token);
38513             return true;
38514           }
38515           return false;
38516         })) {
38517           continue;
38518         }
38519         if (token = this.tokenizer.escape(src)) {
38520           src = src.substring(token.raw.length);
38521           tokens.push(token);
38522           continue;
38523         }
38524         if (token = this.tokenizer.tag(src)) {
38525           src = src.substring(token.raw.length);
38526           lastToken = tokens[tokens.length - 1];
38527           if (lastToken && token.type === "text" && lastToken.type === "text") {
38528             lastToken.raw += token.raw;
38529             lastToken.text += token.text;
38530           } else {
38531             tokens.push(token);
38532           }
38533           continue;
38534         }
38535         if (token = this.tokenizer.link(src)) {
38536           src = src.substring(token.raw.length);
38537           tokens.push(token);
38538           continue;
38539         }
38540         if (token = this.tokenizer.reflink(src, this.tokens.links)) {
38541           src = src.substring(token.raw.length);
38542           lastToken = tokens[tokens.length - 1];
38543           if (lastToken && token.type === "text" && lastToken.type === "text") {
38544             lastToken.raw += token.raw;
38545             lastToken.text += token.text;
38546           } else {
38547             tokens.push(token);
38548           }
38549           continue;
38550         }
38551         if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
38552           src = src.substring(token.raw.length);
38553           tokens.push(token);
38554           continue;
38555         }
38556         if (token = this.tokenizer.codespan(src)) {
38557           src = src.substring(token.raw.length);
38558           tokens.push(token);
38559           continue;
38560         }
38561         if (token = this.tokenizer.br(src)) {
38562           src = src.substring(token.raw.length);
38563           tokens.push(token);
38564           continue;
38565         }
38566         if (token = this.tokenizer.del(src)) {
38567           src = src.substring(token.raw.length);
38568           tokens.push(token);
38569           continue;
38570         }
38571         if (token = this.tokenizer.autolink(src)) {
38572           src = src.substring(token.raw.length);
38573           tokens.push(token);
38574           continue;
38575         }
38576         if (!this.state.inLink && (token = this.tokenizer.url(src))) {
38577           src = src.substring(token.raw.length);
38578           tokens.push(token);
38579           continue;
38580         }
38581         cutSrc = src;
38582         if (this.options.extensions && this.options.extensions.startInline) {
38583           let startIndex = Infinity;
38584           const tempSrc = src.slice(1);
38585           let tempStart;
38586           this.options.extensions.startInline.forEach((getStartIndex) => {
38587             tempStart = getStartIndex.call({ lexer: this }, tempSrc);
38588             if (typeof tempStart === "number" && tempStart >= 0) {
38589               startIndex = Math.min(startIndex, tempStart);
38590             }
38591           });
38592           if (startIndex < Infinity && startIndex >= 0) {
38593             cutSrc = src.substring(0, startIndex + 1);
38594           }
38595         }
38596         if (token = this.tokenizer.inlineText(cutSrc)) {
38597           src = src.substring(token.raw.length);
38598           if (token.raw.slice(-1) !== "_") {
38599             prevChar = token.raw.slice(-1);
38600           }
38601           keepPrevChar = true;
38602           lastToken = tokens[tokens.length - 1];
38603           if (lastToken && lastToken.type === "text") {
38604             lastToken.raw += token.raw;
38605             lastToken.text += token.text;
38606           } else {
38607             tokens.push(token);
38608           }
38609           continue;
38610         }
38611         if (src) {
38612           const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
38613           if (this.options.silent) {
38614             console.error(errMsg);
38615             break;
38616           } else {
38617             throw new Error(errMsg);
38618           }
38619         }
38620       }
38621       return tokens;
38622     }
38623   };
38624   var _Renderer = class {
38625     // set by the parser
38626     constructor(options2) {
38627       __publicField(this, "options");
38628       __publicField(this, "parser");
38629       this.options = options2 || _defaults;
38630     }
38631     space(token) {
38632       return "";
38633     }
38634     code({ text, lang, escaped }) {
38635       var _a3;
38636       const langString = (_a3 = (lang || "").match(/^\S*/)) == null ? void 0 : _a3[0];
38637       const code = text.replace(/\n$/, "") + "\n";
38638       if (!langString) {
38639         return "<pre><code>" + (escaped ? code : escape$1(code, true)) + "</code></pre>\n";
38640       }
38641       return '<pre><code class="language-' + escape$1(langString) + '">' + (escaped ? code : escape$1(code, true)) + "</code></pre>\n";
38642     }
38643     blockquote({ tokens }) {
38644       const body = this.parser.parse(tokens);
38645       return "<blockquote>\n".concat(body, "</blockquote>\n");
38646     }
38647     html({ text }) {
38648       return text;
38649     }
38650     heading({ tokens, depth }) {
38651       return "<h".concat(depth, ">").concat(this.parser.parseInline(tokens), "</h").concat(depth, ">\n");
38652     }
38653     hr(token) {
38654       return "<hr>\n";
38655     }
38656     list(token) {
38657       const ordered = token.ordered;
38658       const start2 = token.start;
38659       let body = "";
38660       for (let j2 = 0; j2 < token.items.length; j2++) {
38661         const item = token.items[j2];
38662         body += this.listitem(item);
38663       }
38664       const type2 = ordered ? "ol" : "ul";
38665       const startAttr = ordered && start2 !== 1 ? ' start="' + start2 + '"' : "";
38666       return "<" + type2 + startAttr + ">\n" + body + "</" + type2 + ">\n";
38667     }
38668     listitem(item) {
38669       let itemBody = "";
38670       if (item.task) {
38671         const checkbox = this.checkbox({ checked: !!item.checked });
38672         if (item.loose) {
38673           if (item.tokens.length > 0 && item.tokens[0].type === "paragraph") {
38674             item.tokens[0].text = checkbox + " " + item.tokens[0].text;
38675             if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") {
38676               item.tokens[0].tokens[0].text = checkbox + " " + item.tokens[0].tokens[0].text;
38677             }
38678           } else {
38679             item.tokens.unshift({
38680               type: "text",
38681               raw: checkbox + " ",
38682               text: checkbox + " "
38683             });
38684           }
38685         } else {
38686           itemBody += checkbox + " ";
38687         }
38688       }
38689       itemBody += this.parser.parse(item.tokens, !!item.loose);
38690       return "<li>".concat(itemBody, "</li>\n");
38691     }
38692     checkbox({ checked }) {
38693       return "<input " + (checked ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
38694     }
38695     paragraph({ tokens }) {
38696       return "<p>".concat(this.parser.parseInline(tokens), "</p>\n");
38697     }
38698     table(token) {
38699       let header = "";
38700       let cell = "";
38701       for (let j2 = 0; j2 < token.header.length; j2++) {
38702         cell += this.tablecell(token.header[j2]);
38703       }
38704       header += this.tablerow({ text: cell });
38705       let body = "";
38706       for (let j2 = 0; j2 < token.rows.length; j2++) {
38707         const row = token.rows[j2];
38708         cell = "";
38709         for (let k2 = 0; k2 < row.length; k2++) {
38710           cell += this.tablecell(row[k2]);
38711         }
38712         body += this.tablerow({ text: cell });
38713       }
38714       if (body)
38715         body = "<tbody>".concat(body, "</tbody>");
38716       return "<table>\n<thead>\n" + header + "</thead>\n" + body + "</table>\n";
38717     }
38718     tablerow({ text }) {
38719       return "<tr>\n".concat(text, "</tr>\n");
38720     }
38721     tablecell(token) {
38722       const content = this.parser.parseInline(token.tokens);
38723       const type2 = token.header ? "th" : "td";
38724       const tag2 = token.align ? "<".concat(type2, ' align="').concat(token.align, '">') : "<".concat(type2, ">");
38725       return tag2 + content + "</".concat(type2, ">\n");
38726     }
38727     /**
38728      * span level renderer
38729      */
38730     strong({ tokens }) {
38731       return "<strong>".concat(this.parser.parseInline(tokens), "</strong>");
38732     }
38733     em({ tokens }) {
38734       return "<em>".concat(this.parser.parseInline(tokens), "</em>");
38735     }
38736     codespan({ text }) {
38737       return "<code>".concat(text, "</code>");
38738     }
38739     br(token) {
38740       return "<br>";
38741     }
38742     del({ tokens }) {
38743       return "<del>".concat(this.parser.parseInline(tokens), "</del>");
38744     }
38745     link({ href, title, tokens }) {
38746       const text = this.parser.parseInline(tokens);
38747       const cleanHref = cleanUrl(href);
38748       if (cleanHref === null) {
38749         return text;
38750       }
38751       href = cleanHref;
38752       let out = '<a href="' + href + '"';
38753       if (title) {
38754         out += ' title="' + title + '"';
38755       }
38756       out += ">" + text + "</a>";
38757       return out;
38758     }
38759     image({ href, title, text }) {
38760       const cleanHref = cleanUrl(href);
38761       if (cleanHref === null) {
38762         return text;
38763       }
38764       href = cleanHref;
38765       let out = '<img src="'.concat(href, '" alt="').concat(text, '"');
38766       if (title) {
38767         out += ' title="'.concat(title, '"');
38768       }
38769       out += ">";
38770       return out;
38771     }
38772     text(token) {
38773       return "tokens" in token && token.tokens ? this.parser.parseInline(token.tokens) : token.text;
38774     }
38775   };
38776   var _TextRenderer = class {
38777     // no need for block level renderers
38778     strong({ text }) {
38779       return text;
38780     }
38781     em({ text }) {
38782       return text;
38783     }
38784     codespan({ text }) {
38785       return text;
38786     }
38787     del({ text }) {
38788       return text;
38789     }
38790     html({ text }) {
38791       return text;
38792     }
38793     text({ text }) {
38794       return text;
38795     }
38796     link({ text }) {
38797       return "" + text;
38798     }
38799     image({ text }) {
38800       return "" + text;
38801     }
38802     br() {
38803       return "";
38804     }
38805   };
38806   var _Parser = class __Parser {
38807     constructor(options2) {
38808       __publicField(this, "options");
38809       __publicField(this, "renderer");
38810       __publicField(this, "textRenderer");
38811       this.options = options2 || _defaults;
38812       this.options.renderer = this.options.renderer || new _Renderer();
38813       this.renderer = this.options.renderer;
38814       this.renderer.options = this.options;
38815       this.renderer.parser = this;
38816       this.textRenderer = new _TextRenderer();
38817     }
38818     /**
38819      * Static Parse Method
38820      */
38821     static parse(tokens, options2) {
38822       const parser3 = new __Parser(options2);
38823       return parser3.parse(tokens);
38824     }
38825     /**
38826      * Static Parse Inline Method
38827      */
38828     static parseInline(tokens, options2) {
38829       const parser3 = new __Parser(options2);
38830       return parser3.parseInline(tokens);
38831     }
38832     /**
38833      * Parse Loop
38834      */
38835     parse(tokens, top = true) {
38836       let out = "";
38837       for (let i3 = 0; i3 < tokens.length; i3++) {
38838         const anyToken = tokens[i3];
38839         if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[anyToken.type]) {
38840           const genericToken = anyToken;
38841           const ret = this.options.extensions.renderers[genericToken.type].call({ parser: this }, genericToken);
38842           if (ret !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(genericToken.type)) {
38843             out += ret || "";
38844             continue;
38845           }
38846         }
38847         const token = anyToken;
38848         switch (token.type) {
38849           case "space": {
38850             out += this.renderer.space(token);
38851             continue;
38852           }
38853           case "hr": {
38854             out += this.renderer.hr(token);
38855             continue;
38856           }
38857           case "heading": {
38858             out += this.renderer.heading(token);
38859             continue;
38860           }
38861           case "code": {
38862             out += this.renderer.code(token);
38863             continue;
38864           }
38865           case "table": {
38866             out += this.renderer.table(token);
38867             continue;
38868           }
38869           case "blockquote": {
38870             out += this.renderer.blockquote(token);
38871             continue;
38872           }
38873           case "list": {
38874             out += this.renderer.list(token);
38875             continue;
38876           }
38877           case "html": {
38878             out += this.renderer.html(token);
38879             continue;
38880           }
38881           case "paragraph": {
38882             out += this.renderer.paragraph(token);
38883             continue;
38884           }
38885           case "text": {
38886             let textToken = token;
38887             let body = this.renderer.text(textToken);
38888             while (i3 + 1 < tokens.length && tokens[i3 + 1].type === "text") {
38889               textToken = tokens[++i3];
38890               body += "\n" + this.renderer.text(textToken);
38891             }
38892             if (top) {
38893               out += this.renderer.paragraph({
38894                 type: "paragraph",
38895                 raw: body,
38896                 text: body,
38897                 tokens: [{ type: "text", raw: body, text: body }]
38898               });
38899             } else {
38900               out += body;
38901             }
38902             continue;
38903           }
38904           default: {
38905             const errMsg = 'Token with "' + token.type + '" type was not found.';
38906             if (this.options.silent) {
38907               console.error(errMsg);
38908               return "";
38909             } else {
38910               throw new Error(errMsg);
38911             }
38912           }
38913         }
38914       }
38915       return out;
38916     }
38917     /**
38918      * Parse Inline Tokens
38919      */
38920     parseInline(tokens, renderer) {
38921       renderer = renderer || this.renderer;
38922       let out = "";
38923       for (let i3 = 0; i3 < tokens.length; i3++) {
38924         const anyToken = tokens[i3];
38925         if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[anyToken.type]) {
38926           const ret = this.options.extensions.renderers[anyToken.type].call({ parser: this }, anyToken);
38927           if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(anyToken.type)) {
38928             out += ret || "";
38929             continue;
38930           }
38931         }
38932         const token = anyToken;
38933         switch (token.type) {
38934           case "escape": {
38935             out += renderer.text(token);
38936             break;
38937           }
38938           case "html": {
38939             out += renderer.html(token);
38940             break;
38941           }
38942           case "link": {
38943             out += renderer.link(token);
38944             break;
38945           }
38946           case "image": {
38947             out += renderer.image(token);
38948             break;
38949           }
38950           case "strong": {
38951             out += renderer.strong(token);
38952             break;
38953           }
38954           case "em": {
38955             out += renderer.em(token);
38956             break;
38957           }
38958           case "codespan": {
38959             out += renderer.codespan(token);
38960             break;
38961           }
38962           case "br": {
38963             out += renderer.br(token);
38964             break;
38965           }
38966           case "del": {
38967             out += renderer.del(token);
38968             break;
38969           }
38970           case "text": {
38971             out += renderer.text(token);
38972             break;
38973           }
38974           default: {
38975             const errMsg = 'Token with "' + token.type + '" type was not found.';
38976             if (this.options.silent) {
38977               console.error(errMsg);
38978               return "";
38979             } else {
38980               throw new Error(errMsg);
38981             }
38982           }
38983         }
38984       }
38985       return out;
38986     }
38987   };
38988   var _Hooks = class {
38989     constructor(options2) {
38990       __publicField(this, "options");
38991       this.options = options2 || _defaults;
38992     }
38993     /**
38994      * Process markdown before marked
38995      */
38996     preprocess(markdown) {
38997       return markdown;
38998     }
38999     /**
39000      * Process HTML after marked is finished
39001      */
39002     postprocess(html3) {
39003       return html3;
39004     }
39005     /**
39006      * Process all tokens before walk tokens
39007      */
39008     processAllTokens(tokens) {
39009       return tokens;
39010     }
39011   };
39012   __publicField(_Hooks, "passThroughHooks", /* @__PURE__ */ new Set([
39013     "preprocess",
39014     "postprocess",
39015     "processAllTokens"
39016   ]));
39017   var Marked = class {
39018     constructor(...args) {
39019       __publicField(this, "defaults", _getDefaults());
39020       __publicField(this, "options", this.setOptions);
39021       __publicField(this, "parse", this.parseMarkdown(_Lexer.lex, _Parser.parse));
39022       __publicField(this, "parseInline", this.parseMarkdown(_Lexer.lexInline, _Parser.parseInline));
39023       __publicField(this, "Parser", _Parser);
39024       __publicField(this, "Renderer", _Renderer);
39025       __publicField(this, "TextRenderer", _TextRenderer);
39026       __publicField(this, "Lexer", _Lexer);
39027       __publicField(this, "Tokenizer", _Tokenizer);
39028       __publicField(this, "Hooks", _Hooks);
39029       this.use(...args);
39030     }
39031     /**
39032      * Run callback for every token
39033      */
39034     walkTokens(tokens, callback) {
39035       var _a3, _b3;
39036       let values = [];
39037       for (const token of tokens) {
39038         values = values.concat(callback.call(this, token));
39039         switch (token.type) {
39040           case "table": {
39041             const tableToken = token;
39042             for (const cell of tableToken.header) {
39043               values = values.concat(this.walkTokens(cell.tokens, callback));
39044             }
39045             for (const row of tableToken.rows) {
39046               for (const cell of row) {
39047                 values = values.concat(this.walkTokens(cell.tokens, callback));
39048               }
39049             }
39050             break;
39051           }
39052           case "list": {
39053             const listToken = token;
39054             values = values.concat(this.walkTokens(listToken.items, callback));
39055             break;
39056           }
39057           default: {
39058             const genericToken = token;
39059             if ((_b3 = (_a3 = this.defaults.extensions) == null ? void 0 : _a3.childTokens) == null ? void 0 : _b3[genericToken.type]) {
39060               this.defaults.extensions.childTokens[genericToken.type].forEach((childTokens) => {
39061                 const tokens2 = genericToken[childTokens].flat(Infinity);
39062                 values = values.concat(this.walkTokens(tokens2, callback));
39063               });
39064             } else if (genericToken.tokens) {
39065               values = values.concat(this.walkTokens(genericToken.tokens, callback));
39066             }
39067           }
39068         }
39069       }
39070       return values;
39071     }
39072     use(...args) {
39073       const extensions = this.defaults.extensions || { renderers: {}, childTokens: {} };
39074       args.forEach((pack) => {
39075         const opts = { ...pack };
39076         opts.async = this.defaults.async || opts.async || false;
39077         if (pack.extensions) {
39078           pack.extensions.forEach((ext) => {
39079             if (!ext.name) {
39080               throw new Error("extension name required");
39081             }
39082             if ("renderer" in ext) {
39083               const prevRenderer = extensions.renderers[ext.name];
39084               if (prevRenderer) {
39085                 extensions.renderers[ext.name] = function(...args2) {
39086                   let ret = ext.renderer.apply(this, args2);
39087                   if (ret === false) {
39088                     ret = prevRenderer.apply(this, args2);
39089                   }
39090                   return ret;
39091                 };
39092               } else {
39093                 extensions.renderers[ext.name] = ext.renderer;
39094               }
39095             }
39096             if ("tokenizer" in ext) {
39097               if (!ext.level || ext.level !== "block" && ext.level !== "inline") {
39098                 throw new Error("extension level must be 'block' or 'inline'");
39099               }
39100               const extLevel = extensions[ext.level];
39101               if (extLevel) {
39102                 extLevel.unshift(ext.tokenizer);
39103               } else {
39104                 extensions[ext.level] = [ext.tokenizer];
39105               }
39106               if (ext.start) {
39107                 if (ext.level === "block") {
39108                   if (extensions.startBlock) {
39109                     extensions.startBlock.push(ext.start);
39110                   } else {
39111                     extensions.startBlock = [ext.start];
39112                   }
39113                 } else if (ext.level === "inline") {
39114                   if (extensions.startInline) {
39115                     extensions.startInline.push(ext.start);
39116                   } else {
39117                     extensions.startInline = [ext.start];
39118                   }
39119                 }
39120               }
39121             }
39122             if ("childTokens" in ext && ext.childTokens) {
39123               extensions.childTokens[ext.name] = ext.childTokens;
39124             }
39125           });
39126           opts.extensions = extensions;
39127         }
39128         if (pack.renderer) {
39129           const renderer = this.defaults.renderer || new _Renderer(this.defaults);
39130           for (const prop in pack.renderer) {
39131             if (!(prop in renderer)) {
39132               throw new Error("renderer '".concat(prop, "' does not exist"));
39133             }
39134             if (["options", "parser"].includes(prop)) {
39135               continue;
39136             }
39137             const rendererProp = prop;
39138             const rendererFunc = pack.renderer[rendererProp];
39139             const prevRenderer = renderer[rendererProp];
39140             renderer[rendererProp] = (...args2) => {
39141               let ret = rendererFunc.apply(renderer, args2);
39142               if (ret === false) {
39143                 ret = prevRenderer.apply(renderer, args2);
39144               }
39145               return ret || "";
39146             };
39147           }
39148           opts.renderer = renderer;
39149         }
39150         if (pack.tokenizer) {
39151           const tokenizer = this.defaults.tokenizer || new _Tokenizer(this.defaults);
39152           for (const prop in pack.tokenizer) {
39153             if (!(prop in tokenizer)) {
39154               throw new Error("tokenizer '".concat(prop, "' does not exist"));
39155             }
39156             if (["options", "rules", "lexer"].includes(prop)) {
39157               continue;
39158             }
39159             const tokenizerProp = prop;
39160             const tokenizerFunc = pack.tokenizer[tokenizerProp];
39161             const prevTokenizer = tokenizer[tokenizerProp];
39162             tokenizer[tokenizerProp] = (...args2) => {
39163               let ret = tokenizerFunc.apply(tokenizer, args2);
39164               if (ret === false) {
39165                 ret = prevTokenizer.apply(tokenizer, args2);
39166               }
39167               return ret;
39168             };
39169           }
39170           opts.tokenizer = tokenizer;
39171         }
39172         if (pack.hooks) {
39173           const hooks = this.defaults.hooks || new _Hooks();
39174           for (const prop in pack.hooks) {
39175             if (!(prop in hooks)) {
39176               throw new Error("hook '".concat(prop, "' does not exist"));
39177             }
39178             if (prop === "options") {
39179               continue;
39180             }
39181             const hooksProp = prop;
39182             const hooksFunc = pack.hooks[hooksProp];
39183             const prevHook = hooks[hooksProp];
39184             if (_Hooks.passThroughHooks.has(prop)) {
39185               hooks[hooksProp] = (arg) => {
39186                 if (this.defaults.async) {
39187                   return Promise.resolve(hooksFunc.call(hooks, arg)).then((ret2) => {
39188                     return prevHook.call(hooks, ret2);
39189                   });
39190                 }
39191                 const ret = hooksFunc.call(hooks, arg);
39192                 return prevHook.call(hooks, ret);
39193               };
39194             } else {
39195               hooks[hooksProp] = (...args2) => {
39196                 let ret = hooksFunc.apply(hooks, args2);
39197                 if (ret === false) {
39198                   ret = prevHook.apply(hooks, args2);
39199                 }
39200                 return ret;
39201               };
39202             }
39203           }
39204           opts.hooks = hooks;
39205         }
39206         if (pack.walkTokens) {
39207           const walkTokens2 = this.defaults.walkTokens;
39208           const packWalktokens = pack.walkTokens;
39209           opts.walkTokens = function(token) {
39210             let values = [];
39211             values.push(packWalktokens.call(this, token));
39212             if (walkTokens2) {
39213               values = values.concat(walkTokens2.call(this, token));
39214             }
39215             return values;
39216           };
39217         }
39218         this.defaults = { ...this.defaults, ...opts };
39219       });
39220       return this;
39221     }
39222     setOptions(opt) {
39223       this.defaults = { ...this.defaults, ...opt };
39224       return this;
39225     }
39226     lexer(src, options2) {
39227       return _Lexer.lex(src, options2 != null ? options2 : this.defaults);
39228     }
39229     parser(tokens, options2) {
39230       return _Parser.parse(tokens, options2 != null ? options2 : this.defaults);
39231     }
39232     parseMarkdown(lexer2, parser3) {
39233       const parse = (src, options2) => {
39234         const origOpt = { ...options2 };
39235         const opt = { ...this.defaults, ...origOpt };
39236         const throwError = this.onError(!!opt.silent, !!opt.async);
39237         if (this.defaults.async === true && origOpt.async === false) {
39238           return throwError(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
39239         }
39240         if (typeof src === "undefined" || src === null) {
39241           return throwError(new Error("marked(): input parameter is undefined or null"));
39242         }
39243         if (typeof src !== "string") {
39244           return throwError(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected"));
39245         }
39246         if (opt.hooks) {
39247           opt.hooks.options = opt;
39248         }
39249         if (opt.async) {
39250           return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then((src2) => lexer2(src2, opt)).then((tokens) => opt.hooks ? opt.hooks.processAllTokens(tokens) : tokens).then((tokens) => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens).then((tokens) => parser3(tokens, opt)).then((html3) => opt.hooks ? opt.hooks.postprocess(html3) : html3).catch(throwError);
39251         }
39252         try {
39253           if (opt.hooks) {
39254             src = opt.hooks.preprocess(src);
39255           }
39256           let tokens = lexer2(src, opt);
39257           if (opt.hooks) {
39258             tokens = opt.hooks.processAllTokens(tokens);
39259           }
39260           if (opt.walkTokens) {
39261             this.walkTokens(tokens, opt.walkTokens);
39262           }
39263           let html3 = parser3(tokens, opt);
39264           if (opt.hooks) {
39265             html3 = opt.hooks.postprocess(html3);
39266           }
39267           return html3;
39268         } catch (e3) {
39269           return throwError(e3);
39270         }
39271       };
39272       return parse;
39273     }
39274     onError(silent, async) {
39275       return (e3) => {
39276         e3.message += "\nPlease report this to https://github.com/markedjs/marked.";
39277         if (silent) {
39278           const msg = "<p>An error occurred:</p><pre>" + escape$1(e3.message + "", true) + "</pre>";
39279           if (async) {
39280             return Promise.resolve(msg);
39281           }
39282           return msg;
39283         }
39284         if (async) {
39285           return Promise.reject(e3);
39286         }
39287         throw e3;
39288       };
39289     }
39290   };
39291   var markedInstance = new Marked();
39292   function marked(src, opt) {
39293     return markedInstance.parse(src, opt);
39294   }
39295   marked.options = marked.setOptions = function(options2) {
39296     markedInstance.setOptions(options2);
39297     marked.defaults = markedInstance.defaults;
39298     changeDefaults(marked.defaults);
39299     return marked;
39300   };
39301   marked.getDefaults = _getDefaults;
39302   marked.defaults = _defaults;
39303   marked.use = function(...args) {
39304     markedInstance.use(...args);
39305     marked.defaults = markedInstance.defaults;
39306     changeDefaults(marked.defaults);
39307     return marked;
39308   };
39309   marked.walkTokens = function(tokens, callback) {
39310     return markedInstance.walkTokens(tokens, callback);
39311   };
39312   marked.parseInline = markedInstance.parseInline;
39313   marked.Parser = _Parser;
39314   marked.parser = _Parser.parse;
39315   marked.Renderer = _Renderer;
39316   marked.TextRenderer = _TextRenderer;
39317   marked.Lexer = _Lexer;
39318   marked.lexer = _Lexer.lex;
39319   marked.Tokenizer = _Tokenizer;
39320   marked.Hooks = _Hooks;
39321   marked.parse = marked;
39322   var options = marked.options;
39323   var setOptions = marked.setOptions;
39324   var use = marked.use;
39325   var walkTokens = marked.walkTokens;
39326   var parseInline = marked.parseInline;
39327   var parser2 = _Parser.parse;
39328   var lexer = _Lexer.lex;
39329
39330   // modules/services/osmose.js
39331   var tiler2 = utilTiler();
39332   var dispatch3 = dispatch_default("loaded");
39333   var _tileZoom2 = 14;
39334   var _osmoseUrlRoot = "https://osmose.openstreetmap.fr/api/0.3";
39335   var _osmoseData = { icons: {}, items: [] };
39336   var _cache2;
39337   function abortRequest2(controller) {
39338     if (controller) {
39339       controller.abort();
39340     }
39341   }
39342   function abortUnwantedRequests2(cache, tiles) {
39343     Object.keys(cache.inflightTile).forEach((k2) => {
39344       let wanted = tiles.find((tile) => k2 === tile.id);
39345       if (!wanted) {
39346         abortRequest2(cache.inflightTile[k2]);
39347         delete cache.inflightTile[k2];
39348       }
39349     });
39350   }
39351   function encodeIssueRtree2(d2) {
39352     return { minX: d2.loc[0], minY: d2.loc[1], maxX: d2.loc[0], maxY: d2.loc[1], data: d2 };
39353   }
39354   function updateRtree2(item, replace) {
39355     _cache2.rtree.remove(item, (a2, b2) => a2.data.id === b2.data.id);
39356     if (replace) {
39357       _cache2.rtree.insert(item);
39358     }
39359   }
39360   function preventCoincident(loc) {
39361     let coincident = false;
39362     do {
39363       let delta = coincident ? [1e-5, 0] : [0, 1e-5];
39364       loc = geoVecAdd(loc, delta);
39365       let bbox2 = geoExtent(loc).bbox();
39366       coincident = _cache2.rtree.search(bbox2).length;
39367     } while (coincident);
39368     return loc;
39369   }
39370   var osmose_default = {
39371     title: "osmose",
39372     init() {
39373       _mainFileFetcher.get("qa_data").then((d2) => {
39374         _osmoseData = d2.osmose;
39375         _osmoseData.items = Object.keys(d2.osmose.icons).map((s2) => s2.split("-")[0]).reduce((unique, item) => unique.indexOf(item) !== -1 ? unique : [...unique, item], []);
39376       });
39377       if (!_cache2) {
39378         this.reset();
39379       }
39380       this.event = utilRebind(this, dispatch3, "on");
39381     },
39382     reset() {
39383       let _strings = {};
39384       let _colors = {};
39385       if (_cache2) {
39386         Object.values(_cache2.inflightTile).forEach(abortRequest2);
39387         _strings = _cache2.strings;
39388         _colors = _cache2.colors;
39389       }
39390       _cache2 = {
39391         data: {},
39392         loadedTile: {},
39393         inflightTile: {},
39394         inflightPost: {},
39395         closed: {},
39396         rtree: new RBush(),
39397         strings: _strings,
39398         colors: _colors
39399       };
39400     },
39401     loadIssues(projection2) {
39402       let params = {
39403         // Tiles return a maximum # of issues
39404         // So we want to filter our request for only types iD supports
39405         item: _osmoseData.items
39406       };
39407       let tiles = tiler2.zoomExtent([_tileZoom2, _tileZoom2]).getTiles(projection2);
39408       abortUnwantedRequests2(_cache2, tiles);
39409       tiles.forEach((tile) => {
39410         if (_cache2.loadedTile[tile.id] || _cache2.inflightTile[tile.id]) return;
39411         let [x2, y2, z2] = tile.xyz;
39412         let url = "".concat(_osmoseUrlRoot, "/issues/").concat(z2, "/").concat(x2, "/").concat(y2, ".geojson?") + utilQsString(params);
39413         let controller = new AbortController();
39414         _cache2.inflightTile[tile.id] = controller;
39415         json_default(url, { signal: controller.signal }).then((data) => {
39416           delete _cache2.inflightTile[tile.id];
39417           _cache2.loadedTile[tile.id] = true;
39418           if (data.features) {
39419             data.features.forEach((issue) => {
39420               const { item, class: cl, uuid: id2 } = issue.properties;
39421               const itemType = "".concat(item, "-").concat(cl);
39422               if (itemType in _osmoseData.icons) {
39423                 let loc = issue.geometry.coordinates;
39424                 loc = preventCoincident(loc);
39425                 let d2 = new QAItem(loc, this, itemType, id2, { item });
39426                 if (item === 8300 || item === 8360) {
39427                   d2.elems = [];
39428                 }
39429                 _cache2.data[d2.id] = d2;
39430                 _cache2.rtree.insert(encodeIssueRtree2(d2));
39431               }
39432             });
39433           }
39434           dispatch3.call("loaded");
39435         }).catch(() => {
39436           delete _cache2.inflightTile[tile.id];
39437           _cache2.loadedTile[tile.id] = true;
39438         });
39439       });
39440     },
39441     loadIssueDetail(issue) {
39442       if (issue.elems !== void 0) {
39443         return Promise.resolve(issue);
39444       }
39445       const url = "".concat(_osmoseUrlRoot, "/issue/").concat(issue.id, "?langs=").concat(_mainLocalizer.localeCode());
39446       const cacheDetails = (data) => {
39447         issue.elems = data.elems.map((e3) => e3.type.substring(0, 1) + e3.id);
39448         issue.detail = data.subtitle ? marked(data.subtitle.auto) : "";
39449         this.replaceItem(issue);
39450       };
39451       return json_default(url).then(cacheDetails).then(() => issue);
39452     },
39453     loadStrings(locale2 = _mainLocalizer.localeCode()) {
39454       const items = Object.keys(_osmoseData.icons);
39455       if (locale2 in _cache2.strings && Object.keys(_cache2.strings[locale2]).length === items.length) {
39456         return Promise.resolve(_cache2.strings[locale2]);
39457       }
39458       if (!(locale2 in _cache2.strings)) {
39459         _cache2.strings[locale2] = {};
39460       }
39461       const allRequests = items.map((itemType) => {
39462         if (itemType in _cache2.strings[locale2]) return null;
39463         const cacheData = (data) => {
39464           const [cat = { items: [] }] = data.categories;
39465           const [item2 = { class: [] }] = cat.items;
39466           const [cl2 = null] = item2.class;
39467           if (!cl2) {
39468             console.log("Osmose strings request (".concat(itemType, ") had unexpected data"));
39469             return;
39470           }
39471           const { item: itemInt, color: color2 } = item2;
39472           if (/^#[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/.test(color2)) {
39473             _cache2.colors[itemInt] = color2;
39474           }
39475           const { title, detail, fix, trap } = cl2;
39476           let issueStrings = {};
39477           if (title) issueStrings.title = title.auto;
39478           if (detail) issueStrings.detail = marked(detail.auto);
39479           if (trap) issueStrings.trap = marked(trap.auto);
39480           if (fix) issueStrings.fix = marked(fix.auto);
39481           _cache2.strings[locale2][itemType] = issueStrings;
39482         };
39483         const [item, cl] = itemType.split("-");
39484         const url = "".concat(_osmoseUrlRoot, "/items/").concat(item, "/class/").concat(cl, "?langs=").concat(locale2);
39485         return json_default(url).then(cacheData);
39486       }).filter(Boolean);
39487       return Promise.all(allRequests).then(() => _cache2.strings[locale2]);
39488     },
39489     getStrings(itemType, locale2 = _mainLocalizer.localeCode()) {
39490       return locale2 in _cache2.strings ? _cache2.strings[locale2][itemType] : {};
39491     },
39492     getColor(itemType) {
39493       return itemType in _cache2.colors ? _cache2.colors[itemType] : "#FFFFFF";
39494     },
39495     postUpdate(issue, callback) {
39496       if (_cache2.inflightPost[issue.id]) {
39497         return callback({ message: "Issue update already inflight", status: -2 }, issue);
39498       }
39499       const url = "".concat(_osmoseUrlRoot, "/issue/").concat(issue.id, "/").concat(issue.newStatus);
39500       const controller = new AbortController();
39501       const after = () => {
39502         delete _cache2.inflightPost[issue.id];
39503         this.removeItem(issue);
39504         if (issue.newStatus === "done") {
39505           if (!(issue.item in _cache2.closed)) {
39506             _cache2.closed[issue.item] = 0;
39507           }
39508           _cache2.closed[issue.item] += 1;
39509         }
39510         if (callback) callback(null, issue);
39511       };
39512       _cache2.inflightPost[issue.id] = controller;
39513       fetch(url, { signal: controller.signal }).then(after).catch((err) => {
39514         delete _cache2.inflightPost[issue.id];
39515         if (callback) callback(err.message);
39516       });
39517     },
39518     // Get all cached QAItems covering the viewport
39519     getItems(projection2) {
39520       const viewport = projection2.clipExtent();
39521       const min3 = [viewport[0][0], viewport[1][1]];
39522       const max3 = [viewport[1][0], viewport[0][1]];
39523       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
39524       return _cache2.rtree.search(bbox2).map((d2) => d2.data);
39525     },
39526     // Get a QAItem from cache
39527     // NOTE: Don't change method name until UI v3 is merged
39528     getError(id2) {
39529       return _cache2.data[id2];
39530     },
39531     // get the name of the icon to display for this item
39532     getIcon(itemType) {
39533       return _osmoseData.icons[itemType];
39534     },
39535     // Replace a single QAItem in the cache
39536     replaceItem(item) {
39537       if (!(item instanceof QAItem) || !item.id) return;
39538       _cache2.data[item.id] = item;
39539       updateRtree2(encodeIssueRtree2(item), true);
39540       return item;
39541     },
39542     // Remove a single QAItem from the cache
39543     removeItem(item) {
39544       if (!(item instanceof QAItem) || !item.id) return;
39545       delete _cache2.data[item.id];
39546       updateRtree2(encodeIssueRtree2(item), false);
39547     },
39548     // Used to populate `closed:osmose:*` changeset tags
39549     getClosedCounts() {
39550       return _cache2.closed;
39551     },
39552     itemURL(item) {
39553       return "https://osmose.openstreetmap.fr/en/error/".concat(item.id);
39554     }
39555   };
39556
39557   // node_modules/pbf/index.js
39558   var SHIFT_LEFT_32 = (1 << 16) * (1 << 16);
39559   var SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;
39560   var TEXT_DECODER_MIN_LENGTH = 12;
39561   var utf8TextDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder("utf-8");
39562   var PBF_VARINT = 0;
39563   var PBF_FIXED64 = 1;
39564   var PBF_BYTES = 2;
39565   var PBF_FIXED32 = 5;
39566   var Pbf = class {
39567     /**
39568      * @param {Uint8Array | ArrayBuffer} [buf]
39569      */
39570     constructor(buf = new Uint8Array(16)) {
39571       this.buf = ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf);
39572       this.dataView = new DataView(this.buf.buffer);
39573       this.pos = 0;
39574       this.type = 0;
39575       this.length = this.buf.length;
39576     }
39577     // === READING =================================================================
39578     /**
39579      * @template T
39580      * @param {(tag: number, result: T, pbf: Pbf) => void} readField
39581      * @param {T} result
39582      * @param {number} [end]
39583      */
39584     readFields(readField, result, end = this.length) {
39585       while (this.pos < end) {
39586         const val = this.readVarint(), tag2 = val >> 3, startPos = this.pos;
39587         this.type = val & 7;
39588         readField(tag2, result, this);
39589         if (this.pos === startPos) this.skip(val);
39590       }
39591       return result;
39592     }
39593     /**
39594      * @template T
39595      * @param {(tag: number, result: T, pbf: Pbf) => void} readField
39596      * @param {T} result
39597      */
39598     readMessage(readField, result) {
39599       return this.readFields(readField, result, this.readVarint() + this.pos);
39600     }
39601     readFixed32() {
39602       const val = this.dataView.getUint32(this.pos, true);
39603       this.pos += 4;
39604       return val;
39605     }
39606     readSFixed32() {
39607       const val = this.dataView.getInt32(this.pos, true);
39608       this.pos += 4;
39609       return val;
39610     }
39611     // 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed)
39612     readFixed64() {
39613       const val = this.dataView.getUint32(this.pos, true) + this.dataView.getUint32(this.pos + 4, true) * SHIFT_LEFT_32;
39614       this.pos += 8;
39615       return val;
39616     }
39617     readSFixed64() {
39618       const val = this.dataView.getUint32(this.pos, true) + this.dataView.getInt32(this.pos + 4, true) * SHIFT_LEFT_32;
39619       this.pos += 8;
39620       return val;
39621     }
39622     readFloat() {
39623       const val = this.dataView.getFloat32(this.pos, true);
39624       this.pos += 4;
39625       return val;
39626     }
39627     readDouble() {
39628       const val = this.dataView.getFloat64(this.pos, true);
39629       this.pos += 8;
39630       return val;
39631     }
39632     /**
39633      * @param {boolean} [isSigned]
39634      */
39635     readVarint(isSigned) {
39636       const buf = this.buf;
39637       let val, b2;
39638       b2 = buf[this.pos++];
39639       val = b2 & 127;
39640       if (b2 < 128) return val;
39641       b2 = buf[this.pos++];
39642       val |= (b2 & 127) << 7;
39643       if (b2 < 128) return val;
39644       b2 = buf[this.pos++];
39645       val |= (b2 & 127) << 14;
39646       if (b2 < 128) return val;
39647       b2 = buf[this.pos++];
39648       val |= (b2 & 127) << 21;
39649       if (b2 < 128) return val;
39650       b2 = buf[this.pos];
39651       val |= (b2 & 15) << 28;
39652       return readVarintRemainder(val, isSigned, this);
39653     }
39654     readVarint64() {
39655       return this.readVarint(true);
39656     }
39657     readSVarint() {
39658       const num = this.readVarint();
39659       return num % 2 === 1 ? (num + 1) / -2 : num / 2;
39660     }
39661     readBoolean() {
39662       return Boolean(this.readVarint());
39663     }
39664     readString() {
39665       const end = this.readVarint() + this.pos;
39666       const pos = this.pos;
39667       this.pos = end;
39668       if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {
39669         return utf8TextDecoder.decode(this.buf.subarray(pos, end));
39670       }
39671       return readUtf8(this.buf, pos, end);
39672     }
39673     readBytes() {
39674       const end = this.readVarint() + this.pos, buffer = this.buf.subarray(this.pos, end);
39675       this.pos = end;
39676       return buffer;
39677     }
39678     // verbose for performance reasons; doesn't affect gzipped size
39679     /**
39680      * @param {number[]} [arr]
39681      * @param {boolean} [isSigned]
39682      */
39683     readPackedVarint(arr = [], isSigned) {
39684       const end = this.readPackedEnd();
39685       while (this.pos < end) arr.push(this.readVarint(isSigned));
39686       return arr;
39687     }
39688     /** @param {number[]} [arr] */
39689     readPackedSVarint(arr = []) {
39690       const end = this.readPackedEnd();
39691       while (this.pos < end) arr.push(this.readSVarint());
39692       return arr;
39693     }
39694     /** @param {boolean[]} [arr] */
39695     readPackedBoolean(arr = []) {
39696       const end = this.readPackedEnd();
39697       while (this.pos < end) arr.push(this.readBoolean());
39698       return arr;
39699     }
39700     /** @param {number[]} [arr] */
39701     readPackedFloat(arr = []) {
39702       const end = this.readPackedEnd();
39703       while (this.pos < end) arr.push(this.readFloat());
39704       return arr;
39705     }
39706     /** @param {number[]} [arr] */
39707     readPackedDouble(arr = []) {
39708       const end = this.readPackedEnd();
39709       while (this.pos < end) arr.push(this.readDouble());
39710       return arr;
39711     }
39712     /** @param {number[]} [arr] */
39713     readPackedFixed32(arr = []) {
39714       const end = this.readPackedEnd();
39715       while (this.pos < end) arr.push(this.readFixed32());
39716       return arr;
39717     }
39718     /** @param {number[]} [arr] */
39719     readPackedSFixed32(arr = []) {
39720       const end = this.readPackedEnd();
39721       while (this.pos < end) arr.push(this.readSFixed32());
39722       return arr;
39723     }
39724     /** @param {number[]} [arr] */
39725     readPackedFixed64(arr = []) {
39726       const end = this.readPackedEnd();
39727       while (this.pos < end) arr.push(this.readFixed64());
39728       return arr;
39729     }
39730     /** @param {number[]} [arr] */
39731     readPackedSFixed64(arr = []) {
39732       const end = this.readPackedEnd();
39733       while (this.pos < end) arr.push(this.readSFixed64());
39734       return arr;
39735     }
39736     readPackedEnd() {
39737       return this.type === PBF_BYTES ? this.readVarint() + this.pos : this.pos + 1;
39738     }
39739     /** @param {number} val */
39740     skip(val) {
39741       const type2 = val & 7;
39742       if (type2 === PBF_VARINT) while (this.buf[this.pos++] > 127) {
39743       }
39744       else if (type2 === PBF_BYTES) this.pos = this.readVarint() + this.pos;
39745       else if (type2 === PBF_FIXED32) this.pos += 4;
39746       else if (type2 === PBF_FIXED64) this.pos += 8;
39747       else throw new Error("Unimplemented type: ".concat(type2));
39748     }
39749     // === WRITING =================================================================
39750     /**
39751      * @param {number} tag
39752      * @param {number} type
39753      */
39754     writeTag(tag2, type2) {
39755       this.writeVarint(tag2 << 3 | type2);
39756     }
39757     /** @param {number} min */
39758     realloc(min3) {
39759       let length2 = this.length || 16;
39760       while (length2 < this.pos + min3) length2 *= 2;
39761       if (length2 !== this.length) {
39762         const buf = new Uint8Array(length2);
39763         buf.set(this.buf);
39764         this.buf = buf;
39765         this.dataView = new DataView(buf.buffer);
39766         this.length = length2;
39767       }
39768     }
39769     finish() {
39770       this.length = this.pos;
39771       this.pos = 0;
39772       return this.buf.subarray(0, this.length);
39773     }
39774     /** @param {number} val */
39775     writeFixed32(val) {
39776       this.realloc(4);
39777       this.dataView.setInt32(this.pos, val, true);
39778       this.pos += 4;
39779     }
39780     /** @param {number} val */
39781     writeSFixed32(val) {
39782       this.realloc(4);
39783       this.dataView.setInt32(this.pos, val, true);
39784       this.pos += 4;
39785     }
39786     /** @param {number} val */
39787     writeFixed64(val) {
39788       this.realloc(8);
39789       this.dataView.setInt32(this.pos, val & -1, true);
39790       this.dataView.setInt32(this.pos + 4, Math.floor(val * SHIFT_RIGHT_32), true);
39791       this.pos += 8;
39792     }
39793     /** @param {number} val */
39794     writeSFixed64(val) {
39795       this.realloc(8);
39796       this.dataView.setInt32(this.pos, val & -1, true);
39797       this.dataView.setInt32(this.pos + 4, Math.floor(val * SHIFT_RIGHT_32), true);
39798       this.pos += 8;
39799     }
39800     /** @param {number} val */
39801     writeVarint(val) {
39802       val = +val || 0;
39803       if (val > 268435455 || val < 0) {
39804         writeBigVarint(val, this);
39805         return;
39806       }
39807       this.realloc(4);
39808       this.buf[this.pos++] = val & 127 | (val > 127 ? 128 : 0);
39809       if (val <= 127) return;
39810       this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
39811       if (val <= 127) return;
39812       this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
39813       if (val <= 127) return;
39814       this.buf[this.pos++] = val >>> 7 & 127;
39815     }
39816     /** @param {number} val */
39817     writeSVarint(val) {
39818       this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);
39819     }
39820     /** @param {boolean} val */
39821     writeBoolean(val) {
39822       this.writeVarint(+val);
39823     }
39824     /** @param {string} str */
39825     writeString(str) {
39826       str = String(str);
39827       this.realloc(str.length * 4);
39828       this.pos++;
39829       const startPos = this.pos;
39830       this.pos = writeUtf8(this.buf, str, this.pos);
39831       const len = this.pos - startPos;
39832       if (len >= 128) makeRoomForExtraLength(startPos, len, this);
39833       this.pos = startPos - 1;
39834       this.writeVarint(len);
39835       this.pos += len;
39836     }
39837     /** @param {number} val */
39838     writeFloat(val) {
39839       this.realloc(4);
39840       this.dataView.setFloat32(this.pos, val, true);
39841       this.pos += 4;
39842     }
39843     /** @param {number} val */
39844     writeDouble(val) {
39845       this.realloc(8);
39846       this.dataView.setFloat64(this.pos, val, true);
39847       this.pos += 8;
39848     }
39849     /** @param {Uint8Array} buffer */
39850     writeBytes(buffer) {
39851       const len = buffer.length;
39852       this.writeVarint(len);
39853       this.realloc(len);
39854       for (let i3 = 0; i3 < len; i3++) this.buf[this.pos++] = buffer[i3];
39855     }
39856     /**
39857      * @template T
39858      * @param {(obj: T, pbf: Pbf) => void} fn
39859      * @param {T} obj
39860      */
39861     writeRawMessage(fn, obj) {
39862       this.pos++;
39863       const startPos = this.pos;
39864       fn(obj, this);
39865       const len = this.pos - startPos;
39866       if (len >= 128) makeRoomForExtraLength(startPos, len, this);
39867       this.pos = startPos - 1;
39868       this.writeVarint(len);
39869       this.pos += len;
39870     }
39871     /**
39872      * @template T
39873      * @param {number} tag
39874      * @param {(obj: T, pbf: Pbf) => void} fn
39875      * @param {T} obj
39876      */
39877     writeMessage(tag2, fn, obj) {
39878       this.writeTag(tag2, PBF_BYTES);
39879       this.writeRawMessage(fn, obj);
39880     }
39881     /**
39882      * @param {number} tag
39883      * @param {number[]} arr
39884      */
39885     writePackedVarint(tag2, arr) {
39886       if (arr.length) this.writeMessage(tag2, writePackedVarint, arr);
39887     }
39888     /**
39889      * @param {number} tag
39890      * @param {number[]} arr
39891      */
39892     writePackedSVarint(tag2, arr) {
39893       if (arr.length) this.writeMessage(tag2, writePackedSVarint, arr);
39894     }
39895     /**
39896      * @param {number} tag
39897      * @param {boolean[]} arr
39898      */
39899     writePackedBoolean(tag2, arr) {
39900       if (arr.length) this.writeMessage(tag2, writePackedBoolean, arr);
39901     }
39902     /**
39903      * @param {number} tag
39904      * @param {number[]} arr
39905      */
39906     writePackedFloat(tag2, arr) {
39907       if (arr.length) this.writeMessage(tag2, writePackedFloat, arr);
39908     }
39909     /**
39910      * @param {number} tag
39911      * @param {number[]} arr
39912      */
39913     writePackedDouble(tag2, arr) {
39914       if (arr.length) this.writeMessage(tag2, writePackedDouble, arr);
39915     }
39916     /**
39917      * @param {number} tag
39918      * @param {number[]} arr
39919      */
39920     writePackedFixed32(tag2, arr) {
39921       if (arr.length) this.writeMessage(tag2, writePackedFixed32, arr);
39922     }
39923     /**
39924      * @param {number} tag
39925      * @param {number[]} arr
39926      */
39927     writePackedSFixed32(tag2, arr) {
39928       if (arr.length) this.writeMessage(tag2, writePackedSFixed32, arr);
39929     }
39930     /**
39931      * @param {number} tag
39932      * @param {number[]} arr
39933      */
39934     writePackedFixed64(tag2, arr) {
39935       if (arr.length) this.writeMessage(tag2, writePackedFixed64, arr);
39936     }
39937     /**
39938      * @param {number} tag
39939      * @param {number[]} arr
39940      */
39941     writePackedSFixed64(tag2, arr) {
39942       if (arr.length) this.writeMessage(tag2, writePackedSFixed64, arr);
39943     }
39944     /**
39945      * @param {number} tag
39946      * @param {Uint8Array} buffer
39947      */
39948     writeBytesField(tag2, buffer) {
39949       this.writeTag(tag2, PBF_BYTES);
39950       this.writeBytes(buffer);
39951     }
39952     /**
39953      * @param {number} tag
39954      * @param {number} val
39955      */
39956     writeFixed32Field(tag2, val) {
39957       this.writeTag(tag2, PBF_FIXED32);
39958       this.writeFixed32(val);
39959     }
39960     /**
39961      * @param {number} tag
39962      * @param {number} val
39963      */
39964     writeSFixed32Field(tag2, val) {
39965       this.writeTag(tag2, PBF_FIXED32);
39966       this.writeSFixed32(val);
39967     }
39968     /**
39969      * @param {number} tag
39970      * @param {number} val
39971      */
39972     writeFixed64Field(tag2, val) {
39973       this.writeTag(tag2, PBF_FIXED64);
39974       this.writeFixed64(val);
39975     }
39976     /**
39977      * @param {number} tag
39978      * @param {number} val
39979      */
39980     writeSFixed64Field(tag2, val) {
39981       this.writeTag(tag2, PBF_FIXED64);
39982       this.writeSFixed64(val);
39983     }
39984     /**
39985      * @param {number} tag
39986      * @param {number} val
39987      */
39988     writeVarintField(tag2, val) {
39989       this.writeTag(tag2, PBF_VARINT);
39990       this.writeVarint(val);
39991     }
39992     /**
39993      * @param {number} tag
39994      * @param {number} val
39995      */
39996     writeSVarintField(tag2, val) {
39997       this.writeTag(tag2, PBF_VARINT);
39998       this.writeSVarint(val);
39999     }
40000     /**
40001      * @param {number} tag
40002      * @param {string} str
40003      */
40004     writeStringField(tag2, str) {
40005       this.writeTag(tag2, PBF_BYTES);
40006       this.writeString(str);
40007     }
40008     /**
40009      * @param {number} tag
40010      * @param {number} val
40011      */
40012     writeFloatField(tag2, val) {
40013       this.writeTag(tag2, PBF_FIXED32);
40014       this.writeFloat(val);
40015     }
40016     /**
40017      * @param {number} tag
40018      * @param {number} val
40019      */
40020     writeDoubleField(tag2, val) {
40021       this.writeTag(tag2, PBF_FIXED64);
40022       this.writeDouble(val);
40023     }
40024     /**
40025      * @param {number} tag
40026      * @param {boolean} val
40027      */
40028     writeBooleanField(tag2, val) {
40029       this.writeVarintField(tag2, +val);
40030     }
40031   };
40032   function readVarintRemainder(l2, s2, p2) {
40033     const buf = p2.buf;
40034     let h2, b2;
40035     b2 = buf[p2.pos++];
40036     h2 = (b2 & 112) >> 4;
40037     if (b2 < 128) return toNum(l2, h2, s2);
40038     b2 = buf[p2.pos++];
40039     h2 |= (b2 & 127) << 3;
40040     if (b2 < 128) return toNum(l2, h2, s2);
40041     b2 = buf[p2.pos++];
40042     h2 |= (b2 & 127) << 10;
40043     if (b2 < 128) return toNum(l2, h2, s2);
40044     b2 = buf[p2.pos++];
40045     h2 |= (b2 & 127) << 17;
40046     if (b2 < 128) return toNum(l2, h2, s2);
40047     b2 = buf[p2.pos++];
40048     h2 |= (b2 & 127) << 24;
40049     if (b2 < 128) return toNum(l2, h2, s2);
40050     b2 = buf[p2.pos++];
40051     h2 |= (b2 & 1) << 31;
40052     if (b2 < 128) return toNum(l2, h2, s2);
40053     throw new Error("Expected varint not more than 10 bytes");
40054   }
40055   function toNum(low, high, isSigned) {
40056     return isSigned ? high * 4294967296 + (low >>> 0) : (high >>> 0) * 4294967296 + (low >>> 0);
40057   }
40058   function writeBigVarint(val, pbf) {
40059     let low, high;
40060     if (val >= 0) {
40061       low = val % 4294967296 | 0;
40062       high = val / 4294967296 | 0;
40063     } else {
40064       low = ~(-val % 4294967296);
40065       high = ~(-val / 4294967296);
40066       if (low ^ 4294967295) {
40067         low = low + 1 | 0;
40068       } else {
40069         low = 0;
40070         high = high + 1 | 0;
40071       }
40072     }
40073     if (val >= 18446744073709552e3 || val < -18446744073709552e3) {
40074       throw new Error("Given varint doesn't fit into 10 bytes");
40075     }
40076     pbf.realloc(10);
40077     writeBigVarintLow(low, high, pbf);
40078     writeBigVarintHigh(high, pbf);
40079   }
40080   function writeBigVarintLow(low, high, pbf) {
40081     pbf.buf[pbf.pos++] = low & 127 | 128;
40082     low >>>= 7;
40083     pbf.buf[pbf.pos++] = low & 127 | 128;
40084     low >>>= 7;
40085     pbf.buf[pbf.pos++] = low & 127 | 128;
40086     low >>>= 7;
40087     pbf.buf[pbf.pos++] = low & 127 | 128;
40088     low >>>= 7;
40089     pbf.buf[pbf.pos] = low & 127;
40090   }
40091   function writeBigVarintHigh(high, pbf) {
40092     const lsb = (high & 7) << 4;
40093     pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 128 : 0);
40094     if (!high) return;
40095     pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
40096     if (!high) return;
40097     pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
40098     if (!high) return;
40099     pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
40100     if (!high) return;
40101     pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
40102     if (!high) return;
40103     pbf.buf[pbf.pos++] = high & 127;
40104   }
40105   function makeRoomForExtraLength(startPos, len, pbf) {
40106     const extraLen = len <= 16383 ? 1 : len <= 2097151 ? 2 : len <= 268435455 ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));
40107     pbf.realloc(extraLen);
40108     for (let i3 = pbf.pos - 1; i3 >= startPos; i3--) pbf.buf[i3 + extraLen] = pbf.buf[i3];
40109   }
40110   function writePackedVarint(arr, pbf) {
40111     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeVarint(arr[i3]);
40112   }
40113   function writePackedSVarint(arr, pbf) {
40114     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeSVarint(arr[i3]);
40115   }
40116   function writePackedFloat(arr, pbf) {
40117     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeFloat(arr[i3]);
40118   }
40119   function writePackedDouble(arr, pbf) {
40120     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeDouble(arr[i3]);
40121   }
40122   function writePackedBoolean(arr, pbf) {
40123     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeBoolean(arr[i3]);
40124   }
40125   function writePackedFixed32(arr, pbf) {
40126     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeFixed32(arr[i3]);
40127   }
40128   function writePackedSFixed32(arr, pbf) {
40129     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeSFixed32(arr[i3]);
40130   }
40131   function writePackedFixed64(arr, pbf) {
40132     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeFixed64(arr[i3]);
40133   }
40134   function writePackedSFixed64(arr, pbf) {
40135     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeSFixed64(arr[i3]);
40136   }
40137   function readUtf8(buf, pos, end) {
40138     let str = "";
40139     let i3 = pos;
40140     while (i3 < end) {
40141       const b0 = buf[i3];
40142       let c2 = null;
40143       let bytesPerSequence = b0 > 239 ? 4 : b0 > 223 ? 3 : b0 > 191 ? 2 : 1;
40144       if (i3 + bytesPerSequence > end) break;
40145       let b1, b2, b3;
40146       if (bytesPerSequence === 1) {
40147         if (b0 < 128) {
40148           c2 = b0;
40149         }
40150       } else if (bytesPerSequence === 2) {
40151         b1 = buf[i3 + 1];
40152         if ((b1 & 192) === 128) {
40153           c2 = (b0 & 31) << 6 | b1 & 63;
40154           if (c2 <= 127) {
40155             c2 = null;
40156           }
40157         }
40158       } else if (bytesPerSequence === 3) {
40159         b1 = buf[i3 + 1];
40160         b2 = buf[i3 + 2];
40161         if ((b1 & 192) === 128 && (b2 & 192) === 128) {
40162           c2 = (b0 & 15) << 12 | (b1 & 63) << 6 | b2 & 63;
40163           if (c2 <= 2047 || c2 >= 55296 && c2 <= 57343) {
40164             c2 = null;
40165           }
40166         }
40167       } else if (bytesPerSequence === 4) {
40168         b1 = buf[i3 + 1];
40169         b2 = buf[i3 + 2];
40170         b3 = buf[i3 + 3];
40171         if ((b1 & 192) === 128 && (b2 & 192) === 128 && (b3 & 192) === 128) {
40172           c2 = (b0 & 15) << 18 | (b1 & 63) << 12 | (b2 & 63) << 6 | b3 & 63;
40173           if (c2 <= 65535 || c2 >= 1114112) {
40174             c2 = null;
40175           }
40176         }
40177       }
40178       if (c2 === null) {
40179         c2 = 65533;
40180         bytesPerSequence = 1;
40181       } else if (c2 > 65535) {
40182         c2 -= 65536;
40183         str += String.fromCharCode(c2 >>> 10 & 1023 | 55296);
40184         c2 = 56320 | c2 & 1023;
40185       }
40186       str += String.fromCharCode(c2);
40187       i3 += bytesPerSequence;
40188     }
40189     return str;
40190   }
40191   function writeUtf8(buf, str, pos) {
40192     for (let i3 = 0, c2, lead; i3 < str.length; i3++) {
40193       c2 = str.charCodeAt(i3);
40194       if (c2 > 55295 && c2 < 57344) {
40195         if (lead) {
40196           if (c2 < 56320) {
40197             buf[pos++] = 239;
40198             buf[pos++] = 191;
40199             buf[pos++] = 189;
40200             lead = c2;
40201             continue;
40202           } else {
40203             c2 = lead - 55296 << 10 | c2 - 56320 | 65536;
40204             lead = null;
40205           }
40206         } else {
40207           if (c2 > 56319 || i3 + 1 === str.length) {
40208             buf[pos++] = 239;
40209             buf[pos++] = 191;
40210             buf[pos++] = 189;
40211           } else {
40212             lead = c2;
40213           }
40214           continue;
40215         }
40216       } else if (lead) {
40217         buf[pos++] = 239;
40218         buf[pos++] = 191;
40219         buf[pos++] = 189;
40220         lead = null;
40221       }
40222       if (c2 < 128) {
40223         buf[pos++] = c2;
40224       } else {
40225         if (c2 < 2048) {
40226           buf[pos++] = c2 >> 6 | 192;
40227         } else {
40228           if (c2 < 65536) {
40229             buf[pos++] = c2 >> 12 | 224;
40230           } else {
40231             buf[pos++] = c2 >> 18 | 240;
40232             buf[pos++] = c2 >> 12 & 63 | 128;
40233           }
40234           buf[pos++] = c2 >> 6 & 63 | 128;
40235         }
40236         buf[pos++] = c2 & 63 | 128;
40237       }
40238     }
40239     return pos;
40240   }
40241
40242   // node_modules/@mapbox/point-geometry/index.js
40243   function Point(x2, y2) {
40244     this.x = x2;
40245     this.y = y2;
40246   }
40247   Point.prototype = {
40248     /**
40249      * Clone this point, returning a new point that can be modified
40250      * without affecting the old one.
40251      * @return {Point} the clone
40252      */
40253     clone() {
40254       return new Point(this.x, this.y);
40255     },
40256     /**
40257      * Add this point's x & y coordinates to another point,
40258      * yielding a new point.
40259      * @param {Point} p the other point
40260      * @return {Point} output point
40261      */
40262     add(p2) {
40263       return this.clone()._add(p2);
40264     },
40265     /**
40266      * Subtract this point's x & y coordinates to from point,
40267      * yielding a new point.
40268      * @param {Point} p the other point
40269      * @return {Point} output point
40270      */
40271     sub(p2) {
40272       return this.clone()._sub(p2);
40273     },
40274     /**
40275      * Multiply this point's x & y coordinates by point,
40276      * yielding a new point.
40277      * @param {Point} p the other point
40278      * @return {Point} output point
40279      */
40280     multByPoint(p2) {
40281       return this.clone()._multByPoint(p2);
40282     },
40283     /**
40284      * Divide this point's x & y coordinates by point,
40285      * yielding a new point.
40286      * @param {Point} p the other point
40287      * @return {Point} output point
40288      */
40289     divByPoint(p2) {
40290       return this.clone()._divByPoint(p2);
40291     },
40292     /**
40293      * Multiply this point's x & y coordinates by a factor,
40294      * yielding a new point.
40295      * @param {number} k factor
40296      * @return {Point} output point
40297      */
40298     mult(k2) {
40299       return this.clone()._mult(k2);
40300     },
40301     /**
40302      * Divide this point's x & y coordinates by a factor,
40303      * yielding a new point.
40304      * @param {number} k factor
40305      * @return {Point} output point
40306      */
40307     div(k2) {
40308       return this.clone()._div(k2);
40309     },
40310     /**
40311      * Rotate this point around the 0, 0 origin by an angle a,
40312      * given in radians
40313      * @param {number} a angle to rotate around, in radians
40314      * @return {Point} output point
40315      */
40316     rotate(a2) {
40317       return this.clone()._rotate(a2);
40318     },
40319     /**
40320      * Rotate this point around p point by an angle a,
40321      * given in radians
40322      * @param {number} a angle to rotate around, in radians
40323      * @param {Point} p Point to rotate around
40324      * @return {Point} output point
40325      */
40326     rotateAround(a2, p2) {
40327       return this.clone()._rotateAround(a2, p2);
40328     },
40329     /**
40330      * Multiply this point by a 4x1 transformation matrix
40331      * @param {[number, number, number, number]} m transformation matrix
40332      * @return {Point} output point
40333      */
40334     matMult(m2) {
40335       return this.clone()._matMult(m2);
40336     },
40337     /**
40338      * Calculate this point but as a unit vector from 0, 0, meaning
40339      * that the distance from the resulting point to the 0, 0
40340      * coordinate will be equal to 1 and the angle from the resulting
40341      * point to the 0, 0 coordinate will be the same as before.
40342      * @return {Point} unit vector point
40343      */
40344     unit() {
40345       return this.clone()._unit();
40346     },
40347     /**
40348      * Compute a perpendicular point, where the new y coordinate
40349      * is the old x coordinate and the new x coordinate is the old y
40350      * coordinate multiplied by -1
40351      * @return {Point} perpendicular point
40352      */
40353     perp() {
40354       return this.clone()._perp();
40355     },
40356     /**
40357      * Return a version of this point with the x & y coordinates
40358      * rounded to integers.
40359      * @return {Point} rounded point
40360      */
40361     round() {
40362       return this.clone()._round();
40363     },
40364     /**
40365      * Return the magnitude of this point: this is the Euclidean
40366      * distance from the 0, 0 coordinate to this point's x and y
40367      * coordinates.
40368      * @return {number} magnitude
40369      */
40370     mag() {
40371       return Math.sqrt(this.x * this.x + this.y * this.y);
40372     },
40373     /**
40374      * Judge whether this point is equal to another point, returning
40375      * true or false.
40376      * @param {Point} other the other point
40377      * @return {boolean} whether the points are equal
40378      */
40379     equals(other) {
40380       return this.x === other.x && this.y === other.y;
40381     },
40382     /**
40383      * Calculate the distance from this point to another point
40384      * @param {Point} p the other point
40385      * @return {number} distance
40386      */
40387     dist(p2) {
40388       return Math.sqrt(this.distSqr(p2));
40389     },
40390     /**
40391      * Calculate the distance from this point to another point,
40392      * without the square root step. Useful if you're comparing
40393      * relative distances.
40394      * @param {Point} p the other point
40395      * @return {number} distance
40396      */
40397     distSqr(p2) {
40398       const dx = p2.x - this.x, dy = p2.y - this.y;
40399       return dx * dx + dy * dy;
40400     },
40401     /**
40402      * Get the angle from the 0, 0 coordinate to this point, in radians
40403      * coordinates.
40404      * @return {number} angle
40405      */
40406     angle() {
40407       return Math.atan2(this.y, this.x);
40408     },
40409     /**
40410      * Get the angle from this point to another point, in radians
40411      * @param {Point} b the other point
40412      * @return {number} angle
40413      */
40414     angleTo(b2) {
40415       return Math.atan2(this.y - b2.y, this.x - b2.x);
40416     },
40417     /**
40418      * Get the angle between this point and another point, in radians
40419      * @param {Point} b the other point
40420      * @return {number} angle
40421      */
40422     angleWith(b2) {
40423       return this.angleWithSep(b2.x, b2.y);
40424     },
40425     /**
40426      * Find the angle of the two vectors, solving the formula for
40427      * the cross product a x b = |a||b|sin(θ) for θ.
40428      * @param {number} x the x-coordinate
40429      * @param {number} y the y-coordinate
40430      * @return {number} the angle in radians
40431      */
40432     angleWithSep(x2, y2) {
40433       return Math.atan2(
40434         this.x * y2 - this.y * x2,
40435         this.x * x2 + this.y * y2
40436       );
40437     },
40438     /** @param {[number, number, number, number]} m */
40439     _matMult(m2) {
40440       const x2 = m2[0] * this.x + m2[1] * this.y, y2 = m2[2] * this.x + m2[3] * this.y;
40441       this.x = x2;
40442       this.y = y2;
40443       return this;
40444     },
40445     /** @param {Point} p */
40446     _add(p2) {
40447       this.x += p2.x;
40448       this.y += p2.y;
40449       return this;
40450     },
40451     /** @param {Point} p */
40452     _sub(p2) {
40453       this.x -= p2.x;
40454       this.y -= p2.y;
40455       return this;
40456     },
40457     /** @param {number} k */
40458     _mult(k2) {
40459       this.x *= k2;
40460       this.y *= k2;
40461       return this;
40462     },
40463     /** @param {number} k */
40464     _div(k2) {
40465       this.x /= k2;
40466       this.y /= k2;
40467       return this;
40468     },
40469     /** @param {Point} p */
40470     _multByPoint(p2) {
40471       this.x *= p2.x;
40472       this.y *= p2.y;
40473       return this;
40474     },
40475     /** @param {Point} p */
40476     _divByPoint(p2) {
40477       this.x /= p2.x;
40478       this.y /= p2.y;
40479       return this;
40480     },
40481     _unit() {
40482       this._div(this.mag());
40483       return this;
40484     },
40485     _perp() {
40486       const y2 = this.y;
40487       this.y = this.x;
40488       this.x = -y2;
40489       return this;
40490     },
40491     /** @param {number} angle */
40492     _rotate(angle2) {
40493       const cos2 = Math.cos(angle2), sin2 = Math.sin(angle2), x2 = cos2 * this.x - sin2 * this.y, y2 = sin2 * this.x + cos2 * this.y;
40494       this.x = x2;
40495       this.y = y2;
40496       return this;
40497     },
40498     /**
40499      * @param {number} angle
40500      * @param {Point} p
40501      */
40502     _rotateAround(angle2, p2) {
40503       const cos2 = Math.cos(angle2), sin2 = Math.sin(angle2), x2 = p2.x + cos2 * (this.x - p2.x) - sin2 * (this.y - p2.y), y2 = p2.y + sin2 * (this.x - p2.x) + cos2 * (this.y - p2.y);
40504       this.x = x2;
40505       this.y = y2;
40506       return this;
40507     },
40508     _round() {
40509       this.x = Math.round(this.x);
40510       this.y = Math.round(this.y);
40511       return this;
40512     },
40513     constructor: Point
40514   };
40515   Point.convert = function(p2) {
40516     if (p2 instanceof Point) {
40517       return (
40518         /** @type {Point} */
40519         p2
40520       );
40521     }
40522     if (Array.isArray(p2)) {
40523       return new Point(+p2[0], +p2[1]);
40524     }
40525     if (p2.x !== void 0 && p2.y !== void 0) {
40526       return new Point(+p2.x, +p2.y);
40527     }
40528     throw new Error("Expected [x, y] or {x, y} point format");
40529   };
40530
40531   // node_modules/@mapbox/vector-tile/index.js
40532   var VectorTileFeature = class {
40533     /**
40534      * @param {Pbf} pbf
40535      * @param {number} end
40536      * @param {number} extent
40537      * @param {string[]} keys
40538      * @param {unknown[]} values
40539      */
40540     constructor(pbf, end, extent, keys2, values) {
40541       this.properties = {};
40542       this.extent = extent;
40543       this.type = 0;
40544       this.id = void 0;
40545       this._pbf = pbf;
40546       this._geometry = -1;
40547       this._keys = keys2;
40548       this._values = values;
40549       pbf.readFields(readFeature, this, end);
40550     }
40551     loadGeometry() {
40552       const pbf = this._pbf;
40553       pbf.pos = this._geometry;
40554       const end = pbf.readVarint() + pbf.pos;
40555       const lines = [];
40556       let line;
40557       let cmd = 1;
40558       let length2 = 0;
40559       let x2 = 0;
40560       let y2 = 0;
40561       while (pbf.pos < end) {
40562         if (length2 <= 0) {
40563           const cmdLen = pbf.readVarint();
40564           cmd = cmdLen & 7;
40565           length2 = cmdLen >> 3;
40566         }
40567         length2--;
40568         if (cmd === 1 || cmd === 2) {
40569           x2 += pbf.readSVarint();
40570           y2 += pbf.readSVarint();
40571           if (cmd === 1) {
40572             if (line) lines.push(line);
40573             line = [];
40574           }
40575           if (line) line.push(new Point(x2, y2));
40576         } else if (cmd === 7) {
40577           if (line) {
40578             line.push(line[0].clone());
40579           }
40580         } else {
40581           throw new Error("unknown command ".concat(cmd));
40582         }
40583       }
40584       if (line) lines.push(line);
40585       return lines;
40586     }
40587     bbox() {
40588       const pbf = this._pbf;
40589       pbf.pos = this._geometry;
40590       const end = pbf.readVarint() + pbf.pos;
40591       let cmd = 1, length2 = 0, x2 = 0, y2 = 0, x12 = Infinity, x22 = -Infinity, y12 = Infinity, y22 = -Infinity;
40592       while (pbf.pos < end) {
40593         if (length2 <= 0) {
40594           const cmdLen = pbf.readVarint();
40595           cmd = cmdLen & 7;
40596           length2 = cmdLen >> 3;
40597         }
40598         length2--;
40599         if (cmd === 1 || cmd === 2) {
40600           x2 += pbf.readSVarint();
40601           y2 += pbf.readSVarint();
40602           if (x2 < x12) x12 = x2;
40603           if (x2 > x22) x22 = x2;
40604           if (y2 < y12) y12 = y2;
40605           if (y2 > y22) y22 = y2;
40606         } else if (cmd !== 7) {
40607           throw new Error("unknown command ".concat(cmd));
40608         }
40609       }
40610       return [x12, y12, x22, y22];
40611     }
40612     /**
40613      * @param {number} x
40614      * @param {number} y
40615      * @param {number} z
40616      * @return {Feature}
40617      */
40618     toGeoJSON(x2, y2, z2) {
40619       const size = this.extent * Math.pow(2, z2), x05 = this.extent * x2, y05 = this.extent * y2, vtCoords = this.loadGeometry();
40620       function projectPoint(p2) {
40621         return [
40622           (p2.x + x05) * 360 / size - 180,
40623           360 / Math.PI * Math.atan(Math.exp((1 - (p2.y + y05) * 2 / size) * Math.PI)) - 90
40624         ];
40625       }
40626       function projectLine(line) {
40627         return line.map(projectPoint);
40628       }
40629       let geometry;
40630       if (this.type === 1) {
40631         const points = [];
40632         for (const line of vtCoords) {
40633           points.push(line[0]);
40634         }
40635         const coordinates = projectLine(points);
40636         geometry = points.length === 1 ? { type: "Point", coordinates: coordinates[0] } : { type: "MultiPoint", coordinates };
40637       } else if (this.type === 2) {
40638         const coordinates = vtCoords.map(projectLine);
40639         geometry = coordinates.length === 1 ? { type: "LineString", coordinates: coordinates[0] } : { type: "MultiLineString", coordinates };
40640       } else if (this.type === 3) {
40641         const polygons = classifyRings(vtCoords);
40642         const coordinates = [];
40643         for (const polygon2 of polygons) {
40644           coordinates.push(polygon2.map(projectLine));
40645         }
40646         geometry = coordinates.length === 1 ? { type: "Polygon", coordinates: coordinates[0] } : { type: "MultiPolygon", coordinates };
40647       } else {
40648         throw new Error("unknown feature type");
40649       }
40650       const result = {
40651         type: "Feature",
40652         geometry,
40653         properties: this.properties
40654       };
40655       if (this.id != null) {
40656         result.id = this.id;
40657       }
40658       return result;
40659     }
40660   };
40661   VectorTileFeature.types = ["Unknown", "Point", "LineString", "Polygon"];
40662   function readFeature(tag2, feature3, pbf) {
40663     if (tag2 === 1) feature3.id = pbf.readVarint();
40664     else if (tag2 === 2) readTag(pbf, feature3);
40665     else if (tag2 === 3) feature3.type = /** @type {0 | 1 | 2 | 3} */
40666     pbf.readVarint();
40667     else if (tag2 === 4) feature3._geometry = pbf.pos;
40668   }
40669   function readTag(pbf, feature3) {
40670     const end = pbf.readVarint() + pbf.pos;
40671     while (pbf.pos < end) {
40672       const key = feature3._keys[pbf.readVarint()], value = feature3._values[pbf.readVarint()];
40673       feature3.properties[key] = value;
40674     }
40675   }
40676   function classifyRings(rings) {
40677     const len = rings.length;
40678     if (len <= 1) return [rings];
40679     const polygons = [];
40680     let polygon2, ccw;
40681     for (let i3 = 0; i3 < len; i3++) {
40682       const area = signedArea(rings[i3]);
40683       if (area === 0) continue;
40684       if (ccw === void 0) ccw = area < 0;
40685       if (ccw === area < 0) {
40686         if (polygon2) polygons.push(polygon2);
40687         polygon2 = [rings[i3]];
40688       } else if (polygon2) {
40689         polygon2.push(rings[i3]);
40690       }
40691     }
40692     if (polygon2) polygons.push(polygon2);
40693     return polygons;
40694   }
40695   function signedArea(ring) {
40696     let sum = 0;
40697     for (let i3 = 0, len = ring.length, j2 = len - 1, p1, p2; i3 < len; j2 = i3++) {
40698       p1 = ring[i3];
40699       p2 = ring[j2];
40700       sum += (p2.x - p1.x) * (p1.y + p2.y);
40701     }
40702     return sum;
40703   }
40704   var VectorTileLayer = class {
40705     /**
40706      * @param {Pbf} pbf
40707      * @param {number} [end]
40708      */
40709     constructor(pbf, end) {
40710       this.version = 1;
40711       this.name = "";
40712       this.extent = 4096;
40713       this.length = 0;
40714       this._pbf = pbf;
40715       this._keys = [];
40716       this._values = [];
40717       this._features = [];
40718       pbf.readFields(readLayer, this, end);
40719       this.length = this._features.length;
40720     }
40721     /** return feature `i` from this layer as a `VectorTileFeature`
40722      * @param {number} i
40723      */
40724     feature(i3) {
40725       if (i3 < 0 || i3 >= this._features.length) throw new Error("feature index out of bounds");
40726       this._pbf.pos = this._features[i3];
40727       const end = this._pbf.readVarint() + this._pbf.pos;
40728       return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values);
40729     }
40730   };
40731   function readLayer(tag2, layer, pbf) {
40732     if (tag2 === 15) layer.version = pbf.readVarint();
40733     else if (tag2 === 1) layer.name = pbf.readString();
40734     else if (tag2 === 5) layer.extent = pbf.readVarint();
40735     else if (tag2 === 2) layer._features.push(pbf.pos);
40736     else if (tag2 === 3) layer._keys.push(pbf.readString());
40737     else if (tag2 === 4) layer._values.push(readValueMessage(pbf));
40738   }
40739   function readValueMessage(pbf) {
40740     let value = null;
40741     const end = pbf.readVarint() + pbf.pos;
40742     while (pbf.pos < end) {
40743       const tag2 = pbf.readVarint() >> 3;
40744       value = tag2 === 1 ? pbf.readString() : tag2 === 2 ? pbf.readFloat() : tag2 === 3 ? pbf.readDouble() : tag2 === 4 ? pbf.readVarint64() : tag2 === 5 ? pbf.readVarint() : tag2 === 6 ? pbf.readSVarint() : tag2 === 7 ? pbf.readBoolean() : null;
40745     }
40746     return value;
40747   }
40748   var VectorTile = class {
40749     /**
40750      * @param {Pbf} pbf
40751      * @param {number} [end]
40752      */
40753     constructor(pbf, end) {
40754       this.layers = pbf.readFields(readTile, {}, end);
40755     }
40756   };
40757   function readTile(tag2, layers, pbf) {
40758     if (tag2 === 3) {
40759       const layer = new VectorTileLayer(pbf, pbf.readVarint() + pbf.pos);
40760       if (layer.length) layers[layer.name] = layer;
40761     }
40762   }
40763
40764   // modules/services/mapillary.js
40765   var accessToken = "MLY|4100327730013843|5bb78b81720791946a9a7b956c57b7cf";
40766   var apiUrl = "https://graph.mapillary.com/";
40767   var baseTileUrl = "https://tiles.mapillary.com/maps/vtp";
40768   var mapFeatureTileUrl = "".concat(baseTileUrl, "/mly_map_feature_point/2/{z}/{x}/{y}?access_token=").concat(accessToken);
40769   var tileUrl = "".concat(baseTileUrl, "/mly1_public/2/{z}/{x}/{y}?access_token=").concat(accessToken);
40770   var trafficSignTileUrl = "".concat(baseTileUrl, "/mly_map_feature_traffic_sign/2/{z}/{x}/{y}?access_token=").concat(accessToken);
40771   var viewercss = "mapillary-js/mapillary.css";
40772   var viewerjs = "mapillary-js/mapillary.js";
40773   var minZoom = 14;
40774   var dispatch4 = dispatch_default("change", "loadedImages", "loadedSigns", "loadedMapFeatures", "bearingChanged", "imageChanged");
40775   var _loadViewerPromise;
40776   var _mlyActiveImage;
40777   var _mlyCache;
40778   var _mlyFallback = false;
40779   var _mlyHighlightedDetection;
40780   var _mlyShowFeatureDetections = false;
40781   var _mlyShowSignDetections = false;
40782   var _mlyViewer;
40783   var _mlyViewerFilter = ["all"];
40784   var _isViewerOpen = false;
40785   function loadTiles(which, url, maxZoom2, projection2) {
40786     const tiler8 = utilTiler().zoomExtent([minZoom, maxZoom2]).skipNullIsland(true);
40787     const tiles = tiler8.getTiles(projection2);
40788     tiles.forEach(function(tile) {
40789       loadTile(which, url, tile);
40790     });
40791   }
40792   function loadTile(which, url, tile) {
40793     const cache = _mlyCache.requests;
40794     const tileId = "".concat(tile.id, "-").concat(which);
40795     if (cache.loaded[tileId] || cache.inflight[tileId]) return;
40796     const controller = new AbortController();
40797     cache.inflight[tileId] = controller;
40798     const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
40799     fetch(requestUrl, { signal: controller.signal }).then(function(response) {
40800       if (!response.ok) {
40801         throw new Error(response.status + " " + response.statusText);
40802       }
40803       cache.loaded[tileId] = true;
40804       delete cache.inflight[tileId];
40805       return response.arrayBuffer();
40806     }).then(function(data) {
40807       if (!data) {
40808         throw new Error("No Data");
40809       }
40810       loadTileDataToCache(data, tile, which);
40811       if (which === "images") {
40812         dispatch4.call("loadedImages");
40813       } else if (which === "signs") {
40814         dispatch4.call("loadedSigns");
40815       } else if (which === "points") {
40816         dispatch4.call("loadedMapFeatures");
40817       }
40818     }).catch(function() {
40819       cache.loaded[tileId] = true;
40820       delete cache.inflight[tileId];
40821     });
40822   }
40823   function loadTileDataToCache(data, tile, which) {
40824     const vectorTile = new VectorTile(new Pbf(data));
40825     let features, cache, layer, i3, feature3, loc, d2;
40826     if (vectorTile.layers.hasOwnProperty("image")) {
40827       features = [];
40828       cache = _mlyCache.images;
40829       layer = vectorTile.layers.image;
40830       for (i3 = 0; i3 < layer.length; i3++) {
40831         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
40832         loc = feature3.geometry.coordinates;
40833         d2 = {
40834           loc,
40835           captured_at: feature3.properties.captured_at,
40836           ca: feature3.properties.compass_angle,
40837           id: feature3.properties.id,
40838           is_pano: feature3.properties.is_pano,
40839           sequence_id: feature3.properties.sequence_id
40840         };
40841         cache.forImageId[d2.id] = d2;
40842         features.push({
40843           minX: loc[0],
40844           minY: loc[1],
40845           maxX: loc[0],
40846           maxY: loc[1],
40847           data: d2
40848         });
40849       }
40850       if (cache.rtree) {
40851         cache.rtree.load(features);
40852       }
40853     }
40854     if (vectorTile.layers.hasOwnProperty("sequence")) {
40855       features = [];
40856       cache = _mlyCache.sequences;
40857       layer = vectorTile.layers.sequence;
40858       for (i3 = 0; i3 < layer.length; i3++) {
40859         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
40860         if (cache.lineString[feature3.properties.id]) {
40861           cache.lineString[feature3.properties.id].push(feature3);
40862         } else {
40863           cache.lineString[feature3.properties.id] = [feature3];
40864         }
40865       }
40866     }
40867     if (vectorTile.layers.hasOwnProperty("point")) {
40868       features = [];
40869       cache = _mlyCache[which];
40870       layer = vectorTile.layers.point;
40871       for (i3 = 0; i3 < layer.length; i3++) {
40872         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
40873         loc = feature3.geometry.coordinates;
40874         d2 = {
40875           loc,
40876           id: feature3.properties.id,
40877           first_seen_at: feature3.properties.first_seen_at,
40878           last_seen_at: feature3.properties.last_seen_at,
40879           value: feature3.properties.value
40880         };
40881         features.push({
40882           minX: loc[0],
40883           minY: loc[1],
40884           maxX: loc[0],
40885           maxY: loc[1],
40886           data: d2
40887         });
40888       }
40889       if (cache.rtree) {
40890         cache.rtree.load(features);
40891       }
40892     }
40893     if (vectorTile.layers.hasOwnProperty("traffic_sign")) {
40894       features = [];
40895       cache = _mlyCache[which];
40896       layer = vectorTile.layers.traffic_sign;
40897       for (i3 = 0; i3 < layer.length; i3++) {
40898         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
40899         loc = feature3.geometry.coordinates;
40900         d2 = {
40901           loc,
40902           id: feature3.properties.id,
40903           first_seen_at: feature3.properties.first_seen_at,
40904           last_seen_at: feature3.properties.last_seen_at,
40905           value: feature3.properties.value
40906         };
40907         features.push({
40908           minX: loc[0],
40909           minY: loc[1],
40910           maxX: loc[0],
40911           maxY: loc[1],
40912           data: d2
40913         });
40914       }
40915       if (cache.rtree) {
40916         cache.rtree.load(features);
40917       }
40918     }
40919   }
40920   function loadData(url) {
40921     return fetch(url).then(function(response) {
40922       if (!response.ok) {
40923         throw new Error(response.status + " " + response.statusText);
40924       }
40925       return response.json();
40926     }).then(function(result) {
40927       if (!result) {
40928         return [];
40929       }
40930       return result.data || [];
40931     });
40932   }
40933   function partitionViewport(projection2) {
40934     const z2 = geoScaleToZoom(projection2.scale());
40935     const z22 = Math.ceil(z2 * 2) / 2 + 2.5;
40936     const tiler8 = utilTiler().zoomExtent([z22, z22]);
40937     return tiler8.getTiles(projection2).map(function(tile) {
40938       return tile.extent;
40939     });
40940   }
40941   function searchLimited(limit, projection2, rtree) {
40942     limit = limit || 5;
40943     return partitionViewport(projection2).reduce(function(result, extent) {
40944       const found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
40945         return d2.data;
40946       });
40947       return found.length ? result.concat(found) : result;
40948     }, []);
40949   }
40950   var mapillary_default = {
40951     // Initialize Mapillary
40952     init: function() {
40953       if (!_mlyCache) {
40954         this.reset();
40955       }
40956       this.event = utilRebind(this, dispatch4, "on");
40957     },
40958     // Reset cache and state
40959     reset: function() {
40960       if (_mlyCache) {
40961         Object.values(_mlyCache.requests.inflight).forEach(function(request3) {
40962           request3.abort();
40963         });
40964       }
40965       _mlyCache = {
40966         images: { rtree: new RBush(), forImageId: {} },
40967         image_detections: { forImageId: {} },
40968         signs: { rtree: new RBush() },
40969         points: { rtree: new RBush() },
40970         sequences: { rtree: new RBush(), lineString: {} },
40971         requests: { loaded: {}, inflight: {} }
40972       };
40973       _mlyActiveImage = null;
40974     },
40975     // Get visible images
40976     images: function(projection2) {
40977       const limit = 5;
40978       return searchLimited(limit, projection2, _mlyCache.images.rtree);
40979     },
40980     // Get visible traffic signs
40981     signs: function(projection2) {
40982       const limit = 5;
40983       return searchLimited(limit, projection2, _mlyCache.signs.rtree);
40984     },
40985     // Get visible map (point) features
40986     mapFeatures: function(projection2) {
40987       const limit = 5;
40988       return searchLimited(limit, projection2, _mlyCache.points.rtree);
40989     },
40990     // Get cached image by id
40991     cachedImage: function(imageId) {
40992       return _mlyCache.images.forImageId[imageId];
40993     },
40994     // Get visible sequences
40995     sequences: function(projection2) {
40996       const viewport = projection2.clipExtent();
40997       const min3 = [viewport[0][0], viewport[1][1]];
40998       const max3 = [viewport[1][0], viewport[0][1]];
40999       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
41000       const sequenceIds = {};
41001       let lineStrings = [];
41002       _mlyCache.images.rtree.search(bbox2).forEach(function(d2) {
41003         if (d2.data.sequence_id) {
41004           sequenceIds[d2.data.sequence_id] = true;
41005         }
41006       });
41007       Object.keys(sequenceIds).forEach(function(sequenceId) {
41008         if (_mlyCache.sequences.lineString[sequenceId]) {
41009           lineStrings = lineStrings.concat(_mlyCache.sequences.lineString[sequenceId]);
41010         }
41011       });
41012       return lineStrings;
41013     },
41014     // Load images in the visible area
41015     loadImages: function(projection2) {
41016       loadTiles("images", tileUrl, 14, projection2);
41017     },
41018     // Load traffic signs in the visible area
41019     loadSigns: function(projection2) {
41020       loadTiles("signs", trafficSignTileUrl, 14, projection2);
41021     },
41022     // Load map (point) features in the visible area
41023     loadMapFeatures: function(projection2) {
41024       loadTiles("points", mapFeatureTileUrl, 14, projection2);
41025     },
41026     // Return a promise that resolves when the image viewer (Mapillary JS) library has finished loading
41027     ensureViewerLoaded: function(context) {
41028       if (_loadViewerPromise) return _loadViewerPromise;
41029       const wrap2 = context.container().select(".photoviewer").selectAll(".mly-wrapper").data([0]);
41030       wrap2.enter().append("div").attr("id", "ideditor-mly").attr("class", "photo-wrapper mly-wrapper").classed("hide", true);
41031       const that = this;
41032       _loadViewerPromise = new Promise((resolve, reject) => {
41033         let loadedCount = 0;
41034         function loaded() {
41035           loadedCount += 1;
41036           if (loadedCount === 2) resolve();
41037         }
41038         const head = select_default2("head");
41039         head.selectAll("#ideditor-mapillary-viewercss").data([0]).enter().append("link").attr("id", "ideditor-mapillary-viewercss").attr("rel", "stylesheet").attr("crossorigin", "anonymous").attr("href", context.asset(viewercss)).on("load.serviceMapillary", loaded).on("error.serviceMapillary", function() {
41040           reject();
41041         });
41042         head.selectAll("#ideditor-mapillary-viewerjs").data([0]).enter().append("script").attr("id", "ideditor-mapillary-viewerjs").attr("crossorigin", "anonymous").attr("src", context.asset(viewerjs)).on("load.serviceMapillary", loaded).on("error.serviceMapillary", function() {
41043           reject();
41044         });
41045       }).catch(function() {
41046         _loadViewerPromise = null;
41047       }).then(function() {
41048         that.initViewer(context);
41049       });
41050       return _loadViewerPromise;
41051     },
41052     // Load traffic sign image sprites
41053     loadSignResources: function(context) {
41054       context.ui().svgDefs.addSprites(
41055         ["mapillary-sprite"],
41056         false
41057         /* don't override colors */
41058       );
41059       return this;
41060     },
41061     // Load map (point) feature image sprites
41062     loadObjectResources: function(context) {
41063       context.ui().svgDefs.addSprites(
41064         ["mapillary-object-sprite"],
41065         false
41066         /* don't override colors */
41067       );
41068       return this;
41069     },
41070     // Remove previous detections in image viewer
41071     resetTags: function() {
41072       if (_mlyViewer && !_mlyFallback) {
41073         _mlyViewer.getComponent("tag").removeAll();
41074       }
41075     },
41076     // Show map feature detections in image viewer
41077     showFeatureDetections: function(value) {
41078       _mlyShowFeatureDetections = value;
41079       if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
41080         this.resetTags();
41081       }
41082     },
41083     // Show traffic sign detections in image viewer
41084     showSignDetections: function(value) {
41085       _mlyShowSignDetections = value;
41086       if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
41087         this.resetTags();
41088       }
41089     },
41090     // Apply filter to image viewer
41091     filterViewer: function(context) {
41092       const showsPano = context.photos().showsPanoramic();
41093       const showsFlat = context.photos().showsFlat();
41094       const fromDate = context.photos().fromDate();
41095       const toDate = context.photos().toDate();
41096       const filter2 = ["all"];
41097       if (!showsPano) filter2.push(["!=", "cameraType", "spherical"]);
41098       if (!showsFlat && showsPano) filter2.push(["==", "pano", true]);
41099       if (fromDate) {
41100         filter2.push([">=", "capturedAt", new Date(fromDate).getTime()]);
41101       }
41102       if (toDate) {
41103         filter2.push([">=", "capturedAt", new Date(toDate).getTime()]);
41104       }
41105       if (_mlyViewer) {
41106         _mlyViewer.setFilter(filter2);
41107       }
41108       _mlyViewerFilter = filter2;
41109       return filter2;
41110     },
41111     // Make the image viewer visible
41112     showViewer: function(context) {
41113       const wrap2 = context.container().select(".photoviewer").classed("hide", false);
41114       const isHidden = wrap2.selectAll(".photo-wrapper.mly-wrapper.hide").size();
41115       if (isHidden && _mlyViewer) {
41116         wrap2.selectAll(".photo-wrapper:not(.mly-wrapper)").classed("hide", true);
41117         wrap2.selectAll(".photo-wrapper.mly-wrapper").classed("hide", false);
41118         _mlyViewer.resize();
41119       }
41120       _isViewerOpen = true;
41121       return this;
41122     },
41123     // Hide the image viewer and resets map markers
41124     hideViewer: function(context) {
41125       _mlyActiveImage = null;
41126       if (!_mlyFallback && _mlyViewer) {
41127         _mlyViewer.getComponent("sequence").stop();
41128       }
41129       const viewer = context.container().select(".photoviewer");
41130       if (!viewer.empty()) viewer.datum(null);
41131       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
41132       this.updateUrlImage(null);
41133       dispatch4.call("imageChanged");
41134       dispatch4.call("loadedMapFeatures");
41135       dispatch4.call("loadedSigns");
41136       _isViewerOpen = false;
41137       return this.setStyles(context, null);
41138     },
41139     // Get viewer status
41140     isViewerOpen: function() {
41141       return _isViewerOpen;
41142     },
41143     // Update the URL with current image id
41144     updateUrlImage: function(imageId) {
41145       if (!window.mocha) {
41146         const hash = utilStringQs(window.location.hash);
41147         if (imageId) {
41148           hash.photo = "mapillary/" + imageId;
41149         } else {
41150           delete hash.photo;
41151         }
41152         window.location.replace("#" + utilQsString(hash, true));
41153       }
41154     },
41155     // Highlight the detection in the viewer that is related to the clicked map feature
41156     highlightDetection: function(detection) {
41157       if (detection) {
41158         _mlyHighlightedDetection = detection.id;
41159       }
41160       return this;
41161     },
41162     // Initialize image viewer (Mapillar JS)
41163     initViewer: function(context) {
41164       const that = this;
41165       if (!window.mapillary) return;
41166       const opts = {
41167         accessToken,
41168         component: {
41169           cover: false,
41170           keyboard: false,
41171           tag: true
41172         },
41173         container: "ideditor-mly"
41174       };
41175       if (!mapillary.isSupported() && mapillary.isFallbackSupported()) {
41176         _mlyFallback = true;
41177         opts.component = {
41178           cover: false,
41179           direction: false,
41180           imagePlane: false,
41181           keyboard: false,
41182           mouse: false,
41183           sequence: false,
41184           tag: false,
41185           image: true,
41186           // fallback
41187           navigation: true
41188           // fallback
41189         };
41190       }
41191       _mlyViewer = new mapillary.Viewer(opts);
41192       _mlyViewer.on("image", imageChanged);
41193       _mlyViewer.on("bearing", bearingChanged);
41194       if (_mlyViewerFilter) {
41195         _mlyViewer.setFilter(_mlyViewerFilter);
41196       }
41197       context.ui().photoviewer.on("resize.mapillary", function() {
41198         if (_mlyViewer) _mlyViewer.resize();
41199       });
41200       function imageChanged(node) {
41201         that.resetTags();
41202         const image = node.image;
41203         that.setActiveImage(image);
41204         that.setStyles(context, null);
41205         const loc = [image.originalLngLat.lng, image.originalLngLat.lat];
41206         context.map().centerEase(loc);
41207         that.updateUrlImage(image.id);
41208         if (_mlyShowFeatureDetections || _mlyShowSignDetections) {
41209           that.updateDetections(image.id, "".concat(apiUrl, "/").concat(image.id, "/detections?access_token=").concat(accessToken, "&fields=id,image,geometry,value"));
41210         }
41211         dispatch4.call("imageChanged");
41212       }
41213       function bearingChanged(e3) {
41214         dispatch4.call("bearingChanged", void 0, e3);
41215       }
41216     },
41217     // Move to an image
41218     selectImage: function(context, imageId) {
41219       if (_mlyViewer && imageId) {
41220         _mlyViewer.moveTo(imageId).catch(function(e3) {
41221           console.error("mly3", e3);
41222         });
41223       }
41224       return this;
41225     },
41226     // Return the currently displayed image
41227     getActiveImage: function() {
41228       return _mlyActiveImage;
41229     },
41230     // Return a list of detection objects for the given id
41231     getDetections: function(id2) {
41232       return loadData("".concat(apiUrl, "/").concat(id2, "/detections?access_token=").concat(accessToken, "&fields=id,value,image"));
41233     },
41234     // Set the currently visible image
41235     setActiveImage: function(image) {
41236       if (image) {
41237         _mlyActiveImage = {
41238           ca: image.originalCompassAngle,
41239           id: image.id,
41240           loc: [image.originalLngLat.lng, image.originalLngLat.lat],
41241           is_pano: image.cameraType === "spherical",
41242           sequence_id: image.sequenceId
41243         };
41244       } else {
41245         _mlyActiveImage = null;
41246       }
41247     },
41248     // Update the currently highlighted sequence and selected bubble.
41249     setStyles: function(context, hovered) {
41250       const hoveredImageId = hovered && hovered.id;
41251       const hoveredSequenceId = hovered && hovered.sequence_id;
41252       const selectedSequenceId = _mlyActiveImage && _mlyActiveImage.sequence_id;
41253       context.container().selectAll(".layer-mapillary .viewfield-group").classed("highlighted", function(d2) {
41254         return d2.sequence_id === selectedSequenceId || d2.id === hoveredImageId;
41255       }).classed("hovered", function(d2) {
41256         return d2.id === hoveredImageId;
41257       });
41258       context.container().selectAll(".layer-mapillary .sequence").classed("highlighted", function(d2) {
41259         return d2.properties.id === hoveredSequenceId;
41260       }).classed("currentView", function(d2) {
41261         return d2.properties.id === selectedSequenceId;
41262       });
41263       return this;
41264     },
41265     // Get detections for the current image and shows them in the image viewer
41266     updateDetections: function(imageId, url) {
41267       if (!_mlyViewer || _mlyFallback) return;
41268       if (!imageId) return;
41269       const cache = _mlyCache.image_detections;
41270       if (cache.forImageId[imageId]) {
41271         showDetections(_mlyCache.image_detections.forImageId[imageId]);
41272       } else {
41273         loadData(url).then((detections) => {
41274           detections.forEach(function(detection) {
41275             if (!cache.forImageId[imageId]) {
41276               cache.forImageId[imageId] = [];
41277             }
41278             cache.forImageId[imageId].push({
41279               geometry: detection.geometry,
41280               id: detection.id,
41281               image_id: imageId,
41282               value: detection.value
41283             });
41284           });
41285           showDetections(_mlyCache.image_detections.forImageId[imageId] || []);
41286         });
41287       }
41288       function showDetections(detections) {
41289         const tagComponent = _mlyViewer.getComponent("tag");
41290         detections.forEach(function(data) {
41291           const tag2 = makeTag(data);
41292           if (tag2) {
41293             tagComponent.add([tag2]);
41294           }
41295         });
41296       }
41297       function makeTag(data) {
41298         const valueParts = data.value.split("--");
41299         if (!valueParts.length) return;
41300         let tag2;
41301         let text;
41302         let color2 = 16777215;
41303         if (_mlyHighlightedDetection === data.id) {
41304           color2 = 16776960;
41305           text = valueParts[1];
41306           if (text === "flat" || text === "discrete" || text === "sign") {
41307             text = valueParts[2];
41308           }
41309           text = text.replace(/-/g, " ");
41310           text = text.charAt(0).toUpperCase() + text.slice(1);
41311           _mlyHighlightedDetection = null;
41312         }
41313         var decodedGeometry = window.atob(data.geometry);
41314         var uintArray = new Uint8Array(decodedGeometry.length);
41315         for (var i3 = 0; i3 < decodedGeometry.length; i3++) {
41316           uintArray[i3] = decodedGeometry.charCodeAt(i3);
41317         }
41318         const tile = new VectorTile(new Pbf(uintArray.buffer));
41319         const layer = tile.layers["mpy-or"];
41320         const geometries = layer.feature(0).loadGeometry();
41321         const polygon2 = geometries.map((ring) => ring.map((point) => [point.x / layer.extent, point.y / layer.extent]));
41322         tag2 = new mapillary.OutlineTag(
41323           data.id,
41324           new mapillary.PolygonGeometry(polygon2[0]),
41325           {
41326             text,
41327             textColor: color2,
41328             lineColor: color2,
41329             lineWidth: 2,
41330             fillColor: color2,
41331             fillOpacity: 0.3
41332           }
41333         );
41334         return tag2;
41335       }
41336     },
41337     // Return the current cache
41338     cache: function() {
41339       return _mlyCache;
41340     }
41341   };
41342
41343   // modules/core/validation/models.js
41344   function validationIssue(attrs) {
41345     this.type = attrs.type;
41346     this.subtype = attrs.subtype;
41347     this.severity = attrs.severity;
41348     this.message = attrs.message;
41349     this.reference = attrs.reference;
41350     this.entityIds = attrs.entityIds;
41351     this.loc = attrs.loc;
41352     this.data = attrs.data;
41353     this.dynamicFixes = attrs.dynamicFixes;
41354     this.hash = attrs.hash;
41355     this.id = generateID.apply(this);
41356     this.key = generateKey.apply(this);
41357     this.autoFix = null;
41358     function generateID() {
41359       var parts = [this.type];
41360       if (this.hash) {
41361         parts.push(this.hash);
41362       }
41363       if (this.subtype) {
41364         parts.push(this.subtype);
41365       }
41366       if (this.entityIds) {
41367         var entityKeys = this.entityIds.slice().sort();
41368         parts.push.apply(parts, entityKeys);
41369       }
41370       return parts.join(":");
41371     }
41372     function generateKey() {
41373       return this.id + ":" + Date.now().toString();
41374     }
41375     this.extent = function(resolver) {
41376       if (this.loc) {
41377         return geoExtent(this.loc);
41378       }
41379       if (this.entityIds && this.entityIds.length) {
41380         return this.entityIds.reduce(function(extent, entityId) {
41381           return extent.extend(resolver.entity(entityId).extent(resolver));
41382         }, geoExtent());
41383       }
41384       return null;
41385     };
41386     this.fixes = function(context) {
41387       var fixes = this.dynamicFixes ? this.dynamicFixes(context) : [];
41388       var issue = this;
41389       if (issue.severity === "warning") {
41390         fixes.push(new validationIssueFix({
41391           title: _t.append("issues.fix.ignore_issue.title"),
41392           icon: "iD-icon-close",
41393           onClick: function() {
41394             context.validator().ignoreIssue(this.issue.id);
41395           }
41396         }));
41397       }
41398       fixes.forEach(function(fix) {
41399         fix.id = fix.title.stringId;
41400         fix.issue = issue;
41401         if (fix.autoArgs) {
41402           issue.autoFix = fix;
41403         }
41404       });
41405       return fixes;
41406     };
41407   }
41408   function validationIssueFix(attrs) {
41409     this.title = attrs.title;
41410     this.onClick = attrs.onClick;
41411     this.disabledReason = attrs.disabledReason;
41412     this.icon = attrs.icon;
41413     this.entityIds = attrs.entityIds || [];
41414     this.autoArgs = attrs.autoArgs;
41415     this.issue = null;
41416   }
41417
41418   // modules/services/maprules.js
41419   var buildRuleChecks = function() {
41420     return {
41421       equals: function(equals) {
41422         return function(tags) {
41423           return Object.keys(equals).every(function(k2) {
41424             return equals[k2] === tags[k2];
41425           });
41426         };
41427       },
41428       notEquals: function(notEquals) {
41429         return function(tags) {
41430           return Object.keys(notEquals).some(function(k2) {
41431             return notEquals[k2] !== tags[k2];
41432           });
41433         };
41434       },
41435       absence: function(absence) {
41436         return function(tags) {
41437           return Object.keys(tags).indexOf(absence) === -1;
41438         };
41439       },
41440       presence: function(presence) {
41441         return function(tags) {
41442           return Object.keys(tags).indexOf(presence) > -1;
41443         };
41444       },
41445       greaterThan: function(greaterThan) {
41446         var key = Object.keys(greaterThan)[0];
41447         var value = greaterThan[key];
41448         return function(tags) {
41449           return tags[key] > value;
41450         };
41451       },
41452       greaterThanEqual: function(greaterThanEqual) {
41453         var key = Object.keys(greaterThanEqual)[0];
41454         var value = greaterThanEqual[key];
41455         return function(tags) {
41456           return tags[key] >= value;
41457         };
41458       },
41459       lessThan: function(lessThan) {
41460         var key = Object.keys(lessThan)[0];
41461         var value = lessThan[key];
41462         return function(tags) {
41463           return tags[key] < value;
41464         };
41465       },
41466       lessThanEqual: function(lessThanEqual) {
41467         var key = Object.keys(lessThanEqual)[0];
41468         var value = lessThanEqual[key];
41469         return function(tags) {
41470           return tags[key] <= value;
41471         };
41472       },
41473       positiveRegex: function(positiveRegex) {
41474         var tagKey = Object.keys(positiveRegex)[0];
41475         var expression = positiveRegex[tagKey].join("|");
41476         var regex = new RegExp(expression);
41477         return function(tags) {
41478           return regex.test(tags[tagKey]);
41479         };
41480       },
41481       negativeRegex: function(negativeRegex) {
41482         var tagKey = Object.keys(negativeRegex)[0];
41483         var expression = negativeRegex[tagKey].join("|");
41484         var regex = new RegExp(expression);
41485         return function(tags) {
41486           return !regex.test(tags[tagKey]);
41487         };
41488       }
41489     };
41490   };
41491   var buildLineKeys = function() {
41492     return {
41493       highway: {
41494         rest_area: true,
41495         services: true
41496       },
41497       railway: {
41498         roundhouse: true,
41499         station: true,
41500         traverser: true,
41501         turntable: true,
41502         wash: true
41503       }
41504     };
41505   };
41506   var maprules_default = {
41507     init: function() {
41508       this._ruleChecks = buildRuleChecks();
41509       this._validationRules = [];
41510       this._areaKeys = osmAreaKeys;
41511       this._lineKeys = buildLineKeys();
41512     },
41513     // list of rules only relevant to tag checks...
41514     filterRuleChecks: function(selector) {
41515       var _ruleChecks = this._ruleChecks;
41516       return Object.keys(selector).reduce(function(rules, key) {
41517         if (["geometry", "error", "warning"].indexOf(key) === -1) {
41518           rules.push(_ruleChecks[key](selector[key]));
41519         }
41520         return rules;
41521       }, []);
41522     },
41523     // builds tagMap from mapcss-parse selector object...
41524     buildTagMap: function(selector) {
41525       var getRegexValues = function(regexes) {
41526         return regexes.map(function(regex) {
41527           return regex.replace(/\$|\^/g, "");
41528         });
41529       };
41530       var tagMap = Object.keys(selector).reduce(function(expectedTags, key) {
41531         var values;
41532         var isRegex = /regex/gi.test(key);
41533         var isEqual4 = /equals/gi.test(key);
41534         if (isRegex || isEqual4) {
41535           Object.keys(selector[key]).forEach(function(selectorKey) {
41536             values = isEqual4 ? [selector[key][selectorKey]] : getRegexValues(selector[key][selectorKey]);
41537             if (expectedTags.hasOwnProperty(selectorKey)) {
41538               values = values.concat(expectedTags[selectorKey]);
41539             }
41540             expectedTags[selectorKey] = values;
41541           });
41542         } else if (/(greater|less)Than(Equal)?|presence/g.test(key)) {
41543           var tagKey = /presence/.test(key) ? selector[key] : Object.keys(selector[key])[0];
41544           values = [selector[key][tagKey]];
41545           if (expectedTags.hasOwnProperty(tagKey)) {
41546             values = values.concat(expectedTags[tagKey]);
41547           }
41548           expectedTags[tagKey] = values;
41549         }
41550         return expectedTags;
41551       }, {});
41552       return tagMap;
41553     },
41554     // inspired by osmWay#isArea()
41555     inferGeometry: function(tagMap) {
41556       var _lineKeys = this._lineKeys;
41557       var _areaKeys = this._areaKeys;
41558       var keyValueDoesNotImplyArea = function(key2) {
41559         return utilArrayIntersection(tagMap[key2], Object.keys(_areaKeys[key2])).length > 0;
41560       };
41561       var keyValueImpliesLine = function(key2) {
41562         return utilArrayIntersection(tagMap[key2], Object.keys(_lineKeys[key2])).length > 0;
41563       };
41564       if (tagMap.hasOwnProperty("area")) {
41565         if (tagMap.area.indexOf("yes") > -1) {
41566           return "area";
41567         }
41568         if (tagMap.area.indexOf("no") > -1) {
41569           return "line";
41570         }
41571       }
41572       for (var key in tagMap) {
41573         if (key in _areaKeys && !keyValueDoesNotImplyArea(key)) {
41574           return "area";
41575         }
41576         if (key in _lineKeys && keyValueImpliesLine(key)) {
41577           return "area";
41578         }
41579       }
41580       return "line";
41581     },
41582     // adds from mapcss-parse selector check...
41583     addRule: function(selector) {
41584       var rule = {
41585         // checks relevant to mapcss-selector
41586         checks: this.filterRuleChecks(selector),
41587         // true if all conditions for a tag error are true..
41588         matches: function(entity) {
41589           return this.checks.every(function(check) {
41590             return check(entity.tags);
41591           });
41592         },
41593         // borrowed from Way#isArea()
41594         inferredGeometry: this.inferGeometry(this.buildTagMap(selector), this._areaKeys),
41595         geometryMatches: function(entity, graph) {
41596           if (entity.type === "node" || entity.type === "relation") {
41597             return selector.geometry === entity.type;
41598           } else if (entity.type === "way") {
41599             return this.inferredGeometry === entity.geometry(graph);
41600           }
41601         },
41602         // when geometries match and tag matches are present, return a warning...
41603         findIssues: function(entity, graph, issues) {
41604           if (this.geometryMatches(entity, graph) && this.matches(entity)) {
41605             var severity = Object.keys(selector).indexOf("error") > -1 ? "error" : "warning";
41606             var message = selector[severity];
41607             issues.push(new validationIssue({
41608               type: "maprules",
41609               severity,
41610               message: function() {
41611                 return message;
41612               },
41613               entityIds: [entity.id]
41614             }));
41615           }
41616         }
41617       };
41618       this._validationRules.push(rule);
41619     },
41620     clearRules: function() {
41621       this._validationRules = [];
41622     },
41623     // returns validationRules...
41624     validationRules: function() {
41625       return this._validationRules;
41626     },
41627     // returns ruleChecks
41628     ruleChecks: function() {
41629       return this._ruleChecks;
41630     }
41631   };
41632
41633   // modules/core/difference.js
41634   var import_fast_deep_equal3 = __toESM(require_fast_deep_equal());
41635   function coreDifference(base, head) {
41636     var _changes = {};
41637     var _didChange = {};
41638     var _diff = {};
41639     function checkEntityID(id2) {
41640       var h2 = head.entities[id2];
41641       var b2 = base.entities[id2];
41642       if (h2 === b2) return;
41643       if (_changes[id2]) return;
41644       if (!h2 && b2) {
41645         _changes[id2] = { base: b2, head: h2 };
41646         _didChange.deletion = true;
41647         return;
41648       }
41649       if (h2 && !b2) {
41650         _changes[id2] = { base: b2, head: h2 };
41651         _didChange.addition = true;
41652         return;
41653       }
41654       if (h2 && b2) {
41655         if (h2.members && b2.members && !(0, import_fast_deep_equal3.default)(h2.members, b2.members)) {
41656           _changes[id2] = { base: b2, head: h2 };
41657           _didChange.geometry = true;
41658           _didChange.properties = true;
41659           return;
41660         }
41661         if (h2.loc && b2.loc && !geoVecEqual(h2.loc, b2.loc)) {
41662           _changes[id2] = { base: b2, head: h2 };
41663           _didChange.geometry = true;
41664         }
41665         if (h2.nodes && b2.nodes && !(0, import_fast_deep_equal3.default)(h2.nodes, b2.nodes)) {
41666           _changes[id2] = { base: b2, head: h2 };
41667           _didChange.geometry = true;
41668         }
41669         if (h2.tags && b2.tags && !(0, import_fast_deep_equal3.default)(h2.tags, b2.tags)) {
41670           _changes[id2] = { base: b2, head: h2 };
41671           _didChange.properties = true;
41672         }
41673       }
41674     }
41675     function load() {
41676       var ids = utilArrayUniq(Object.keys(head.entities).concat(Object.keys(base.entities)));
41677       for (var i3 = 0; i3 < ids.length; i3++) {
41678         checkEntityID(ids[i3]);
41679       }
41680     }
41681     load();
41682     _diff.length = function length2() {
41683       return Object.keys(_changes).length;
41684     };
41685     _diff.changes = function changes() {
41686       return _changes;
41687     };
41688     _diff.didChange = _didChange;
41689     _diff.extantIDs = function extantIDs(includeRelMembers) {
41690       var result = /* @__PURE__ */ new Set();
41691       Object.keys(_changes).forEach(function(id2) {
41692         if (_changes[id2].head) {
41693           result.add(id2);
41694         }
41695         var h2 = _changes[id2].head;
41696         var b2 = _changes[id2].base;
41697         var entity = h2 || b2;
41698         if (includeRelMembers && entity.type === "relation") {
41699           var mh = h2 ? h2.members.map(function(m2) {
41700             return m2.id;
41701           }) : [];
41702           var mb = b2 ? b2.members.map(function(m2) {
41703             return m2.id;
41704           }) : [];
41705           utilArrayUnion(mh, mb).forEach(function(memberID) {
41706             if (head.hasEntity(memberID)) {
41707               result.add(memberID);
41708             }
41709           });
41710         }
41711       });
41712       return Array.from(result);
41713     };
41714     _diff.modified = function modified() {
41715       var result = [];
41716       Object.values(_changes).forEach(function(change) {
41717         if (change.base && change.head) {
41718           result.push(change.head);
41719         }
41720       });
41721       return result;
41722     };
41723     _diff.created = function created() {
41724       var result = [];
41725       Object.values(_changes).forEach(function(change) {
41726         if (!change.base && change.head) {
41727           result.push(change.head);
41728         }
41729       });
41730       return result;
41731     };
41732     _diff.deleted = function deleted() {
41733       var result = [];
41734       Object.values(_changes).forEach(function(change) {
41735         if (change.base && !change.head) {
41736           result.push(change.base);
41737         }
41738       });
41739       return result;
41740     };
41741     _diff.summary = function summary() {
41742       var relevant = {};
41743       var keys2 = Object.keys(_changes);
41744       for (var i3 = 0; i3 < keys2.length; i3++) {
41745         var change = _changes[keys2[i3]];
41746         if (change.head && change.head.geometry(head) !== "vertex") {
41747           addEntity(change.head, head, change.base ? "modified" : "created");
41748         } else if (change.base && change.base.geometry(base) !== "vertex") {
41749           addEntity(change.base, base, "deleted");
41750         } else if (change.base && change.head) {
41751           var moved = !(0, import_fast_deep_equal3.default)(change.base.loc, change.head.loc);
41752           var retagged = !(0, import_fast_deep_equal3.default)(change.base.tags, change.head.tags);
41753           if (moved) {
41754             addParents(change.head);
41755           }
41756           if (retagged || moved && change.head.hasInterestingTags()) {
41757             addEntity(change.head, head, "modified");
41758           }
41759         } else if (change.head && change.head.hasInterestingTags()) {
41760           addEntity(change.head, head, "created");
41761         } else if (change.base && change.base.hasInterestingTags()) {
41762           addEntity(change.base, base, "deleted");
41763         }
41764       }
41765       return Object.values(relevant);
41766       function addEntity(entity, graph, changeType) {
41767         relevant[entity.id] = {
41768           entity,
41769           graph,
41770           changeType
41771         };
41772       }
41773       function addParents(entity) {
41774         var parents = head.parentWays(entity);
41775         for (var j2 = parents.length - 1; j2 >= 0; j2--) {
41776           var parent = parents[j2];
41777           if (!(parent.id in relevant)) {
41778             addEntity(parent, head, "modified");
41779           }
41780         }
41781       }
41782     };
41783     _diff.complete = function complete(extent) {
41784       var result = {};
41785       var id2, change;
41786       for (id2 in _changes) {
41787         change = _changes[id2];
41788         var h2 = change.head;
41789         var b2 = change.base;
41790         var entity = h2 || b2;
41791         var i3;
41792         if (extent && (!h2 || !h2.intersects(extent, head)) && (!b2 || !b2.intersects(extent, base))) {
41793           continue;
41794         }
41795         result[id2] = h2;
41796         if (entity.type === "way") {
41797           var nh = h2 ? h2.nodes : [];
41798           var nb = b2 ? b2.nodes : [];
41799           var diff;
41800           diff = utilArrayDifference(nh, nb);
41801           for (i3 = 0; i3 < diff.length; i3++) {
41802             result[diff[i3]] = head.hasEntity(diff[i3]);
41803           }
41804           diff = utilArrayDifference(nb, nh);
41805           for (i3 = 0; i3 < diff.length; i3++) {
41806             result[diff[i3]] = head.hasEntity(diff[i3]);
41807           }
41808         }
41809         if (entity.type === "relation" && entity.isMultipolygon()) {
41810           var mh = h2 ? h2.members.map(function(m2) {
41811             return m2.id;
41812           }) : [];
41813           var mb = b2 ? b2.members.map(function(m2) {
41814             return m2.id;
41815           }) : [];
41816           var ids = utilArrayUnion(mh, mb);
41817           for (i3 = 0; i3 < ids.length; i3++) {
41818             var member = head.hasEntity(ids[i3]);
41819             if (!member) continue;
41820             if (extent && !member.intersects(extent, head)) continue;
41821             result[ids[i3]] = member;
41822           }
41823         }
41824         addParents(head.parentWays(entity), result);
41825         addParents(head.parentRelations(entity), result);
41826       }
41827       return result;
41828       function addParents(parents, result2) {
41829         for (var i4 = 0; i4 < parents.length; i4++) {
41830           var parent = parents[i4];
41831           if (parent.id in result2) continue;
41832           result2[parent.id] = parent;
41833           addParents(head.parentRelations(parent), result2);
41834         }
41835       }
41836     };
41837     return _diff;
41838   }
41839
41840   // modules/core/tree.js
41841   function coreTree(head) {
41842     var _rtree = new RBush();
41843     var _bboxes = {};
41844     var _segmentsRTree = new RBush();
41845     var _segmentsBBoxes = {};
41846     var _segmentsByWayId = {};
41847     var tree = {};
41848     function entityBBox(entity) {
41849       var bbox2 = entity.extent(head).bbox();
41850       bbox2.id = entity.id;
41851       _bboxes[entity.id] = bbox2;
41852       return bbox2;
41853     }
41854     function segmentBBox(segment) {
41855       var extent = segment.extent(head);
41856       if (!extent) return null;
41857       var bbox2 = extent.bbox();
41858       bbox2.segment = segment;
41859       _segmentsBBoxes[segment.id] = bbox2;
41860       return bbox2;
41861     }
41862     function removeEntity(entity) {
41863       _rtree.remove(_bboxes[entity.id]);
41864       delete _bboxes[entity.id];
41865       if (_segmentsByWayId[entity.id]) {
41866         _segmentsByWayId[entity.id].forEach(function(segment) {
41867           _segmentsRTree.remove(_segmentsBBoxes[segment.id]);
41868           delete _segmentsBBoxes[segment.id];
41869         });
41870         delete _segmentsByWayId[entity.id];
41871       }
41872     }
41873     function loadEntities(entities) {
41874       _rtree.load(entities.map(entityBBox));
41875       var segments = [];
41876       entities.forEach(function(entity) {
41877         if (entity.segments) {
41878           var entitySegments = entity.segments(head);
41879           _segmentsByWayId[entity.id] = entitySegments;
41880           segments = segments.concat(entitySegments);
41881         }
41882       });
41883       if (segments.length) _segmentsRTree.load(segments.map(segmentBBox).filter(Boolean));
41884     }
41885     function updateParents(entity, insertions, memo) {
41886       head.parentWays(entity).forEach(function(way) {
41887         if (_bboxes[way.id]) {
41888           removeEntity(way);
41889           insertions[way.id] = way;
41890         }
41891         updateParents(way, insertions, memo);
41892       });
41893       head.parentRelations(entity).forEach(function(relation) {
41894         if (memo[relation.id]) return;
41895         memo[relation.id] = true;
41896         if (_bboxes[relation.id]) {
41897           removeEntity(relation);
41898           insertions[relation.id] = relation;
41899         }
41900         updateParents(relation, insertions, memo);
41901       });
41902     }
41903     tree.rebase = function(entities, force) {
41904       var insertions = {};
41905       for (var i3 = 0; i3 < entities.length; i3++) {
41906         var entity = entities[i3];
41907         if (!entity.visible) continue;
41908         if (head.entities.hasOwnProperty(entity.id) || _bboxes[entity.id]) {
41909           if (!force) {
41910             continue;
41911           } else if (_bboxes[entity.id]) {
41912             removeEntity(entity);
41913           }
41914         }
41915         insertions[entity.id] = entity;
41916         updateParents(entity, insertions, {});
41917       }
41918       loadEntities(Object.values(insertions));
41919       return tree;
41920     };
41921     function updateToGraph(graph) {
41922       if (graph === head) return;
41923       var diff = coreDifference(head, graph);
41924       head = graph;
41925       var changed = diff.didChange;
41926       if (!changed.addition && !changed.deletion && !changed.geometry) return;
41927       var insertions = {};
41928       if (changed.deletion) {
41929         diff.deleted().forEach(function(entity) {
41930           removeEntity(entity);
41931         });
41932       }
41933       if (changed.geometry) {
41934         diff.modified().forEach(function(entity) {
41935           removeEntity(entity);
41936           insertions[entity.id] = entity;
41937           updateParents(entity, insertions, {});
41938         });
41939       }
41940       if (changed.addition) {
41941         diff.created().forEach(function(entity) {
41942           insertions[entity.id] = entity;
41943         });
41944       }
41945       loadEntities(Object.values(insertions));
41946     }
41947     tree.intersects = function(extent, graph) {
41948       updateToGraph(graph);
41949       return _rtree.search(extent.bbox()).map(function(bbox2) {
41950         return graph.entity(bbox2.id);
41951       });
41952     };
41953     tree.waySegments = function(extent, graph) {
41954       updateToGraph(graph);
41955       return _segmentsRTree.search(extent.bbox()).map(function(bbox2) {
41956         return bbox2.segment;
41957       });
41958     };
41959     return tree;
41960   }
41961
41962   // modules/svg/icon.js
41963   function svgIcon(name, svgklass, useklass) {
41964     return function drawIcon(selection2) {
41965       selection2.selectAll("svg.icon" + (svgklass ? "." + svgklass.split(" ")[0] : "")).data([0]).enter().append("svg").attr("class", "icon " + (svgklass || "")).append("use").attr("xlink:href", name).attr("class", useklass);
41966     };
41967   }
41968
41969   // modules/ui/modal.js
41970   function uiModal(selection2, blocking) {
41971     let keybinding = utilKeybinding("modal");
41972     let previous = selection2.select("div.modal");
41973     let animate = previous.empty();
41974     previous.transition().duration(200).style("opacity", 0).remove();
41975     let shaded = selection2.append("div").attr("class", "shaded").style("opacity", 0);
41976     shaded.close = () => {
41977       shaded.transition().duration(200).style("opacity", 0).remove();
41978       modal.transition().duration(200).style("top", "0px");
41979       select_default2(document).call(keybinding.unbind);
41980     };
41981     let modal = shaded.append("div").attr("class", "modal fillL");
41982     modal.append("input").attr("class", "keytrap keytrap-first").on("focus.keytrap", moveFocusToLast);
41983     if (!blocking) {
41984       shaded.on("click.remove-modal", (d3_event) => {
41985         if (d3_event.target === this) {
41986           shaded.close();
41987         }
41988       });
41989       modal.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", shaded.close).call(svgIcon("#iD-icon-close"));
41990       keybinding.on("\u232B", shaded.close).on("\u238B", shaded.close);
41991       select_default2(document).call(keybinding);
41992     }
41993     modal.append("div").attr("class", "content");
41994     modal.append("input").attr("class", "keytrap keytrap-last").on("focus.keytrap", moveFocusToFirst);
41995     if (animate) {
41996       shaded.transition().style("opacity", 1);
41997     } else {
41998       shaded.style("opacity", 1);
41999     }
42000     return shaded;
42001     function moveFocusToFirst() {
42002       let node = modal.select("a, button, input:not(.keytrap), select, textarea").node();
42003       if (node) {
42004         node.focus();
42005       } else {
42006         select_default2(this).node().blur();
42007       }
42008     }
42009     function moveFocusToLast() {
42010       let nodes = modal.selectAll("a, button, input:not(.keytrap), select, textarea").nodes();
42011       if (nodes.length) {
42012         nodes[nodes.length - 1].focus();
42013       } else {
42014         select_default2(this).node().blur();
42015       }
42016     }
42017   }
42018
42019   // modules/ui/loading.js
42020   function uiLoading(context) {
42021     let _modalSelection = select_default2(null);
42022     let _message = "";
42023     let _blocking = false;
42024     let loading = (selection2) => {
42025       _modalSelection = uiModal(selection2, _blocking);
42026       let loadertext = _modalSelection.select(".content").classed("loading-modal", true).append("div").attr("class", "modal-section fillL");
42027       loadertext.append("img").attr("class", "loader").attr("src", context.imagePath("loader-white.gif"));
42028       loadertext.append("h3").html(_message);
42029       _modalSelection.select("button.close").attr("class", "hide");
42030       return loading;
42031     };
42032     loading.message = function(val) {
42033       if (!arguments.length) return _message;
42034       _message = val;
42035       return loading;
42036     };
42037     loading.blocking = function(val) {
42038       if (!arguments.length) return _blocking;
42039       _blocking = val;
42040       return loading;
42041     };
42042     loading.close = () => {
42043       _modalSelection.remove();
42044     };
42045     loading.isShown = () => {
42046       return _modalSelection && !_modalSelection.empty() && _modalSelection.node().parentNode;
42047     };
42048     return loading;
42049   }
42050
42051   // modules/core/history.js
42052   function coreHistory(context) {
42053     var dispatch14 = dispatch_default("reset", "change", "merge", "restore", "undone", "redone", "storage_error");
42054     var lock = utilSessionMutex("lock");
42055     var _hasUnresolvedRestorableChanges = lock.lock() && !!corePreferences(getKey("saved_history"));
42056     var duration = 150;
42057     var _imageryUsed = [];
42058     var _photoOverlaysUsed = [];
42059     var _checkpoints = {};
42060     var _pausedGraph;
42061     var _stack;
42062     var _index;
42063     var _tree;
42064     function _act(actions, t2) {
42065       actions = Array.prototype.slice.call(actions);
42066       var annotation;
42067       if (typeof actions[actions.length - 1] !== "function") {
42068         annotation = actions.pop();
42069       }
42070       var graph = _stack[_index].graph;
42071       for (var i3 = 0; i3 < actions.length; i3++) {
42072         graph = actions[i3](graph, t2);
42073       }
42074       return {
42075         graph,
42076         annotation,
42077         imageryUsed: _imageryUsed,
42078         photoOverlaysUsed: _photoOverlaysUsed,
42079         transform: context.projection.transform(),
42080         selectedIDs: context.selectedIDs()
42081       };
42082     }
42083     function _perform(args, t2) {
42084       var previous = _stack[_index].graph;
42085       _stack = _stack.slice(0, _index + 1);
42086       var actionResult = _act(args, t2);
42087       _stack.push(actionResult);
42088       _index++;
42089       return change(previous);
42090     }
42091     function _replace(args, t2) {
42092       var previous = _stack[_index].graph;
42093       var actionResult = _act(args, t2);
42094       _stack[_index] = actionResult;
42095       return change(previous);
42096     }
42097     function _overwrite(args, t2) {
42098       var previous = _stack[_index].graph;
42099       if (_index > 0) {
42100         _index--;
42101         _stack.pop();
42102       }
42103       _stack = _stack.slice(0, _index + 1);
42104       var actionResult = _act(args, t2);
42105       _stack.push(actionResult);
42106       _index++;
42107       return change(previous);
42108     }
42109     function change(previous) {
42110       var difference2 = coreDifference(previous, history.graph());
42111       if (!_pausedGraph) {
42112         dispatch14.call("change", this, difference2);
42113       }
42114       return difference2;
42115     }
42116     function getKey(n3) {
42117       return "iD_" + window.location.origin + "_" + n3;
42118     }
42119     var history = {
42120       graph: function() {
42121         return _stack[_index].graph;
42122       },
42123       tree: function() {
42124         return _tree;
42125       },
42126       base: function() {
42127         return _stack[0].graph;
42128       },
42129       merge: function(entities) {
42130         var stack = _stack.map(function(state) {
42131           return state.graph;
42132         });
42133         _stack[0].graph.rebase(entities, stack, false);
42134         _tree.rebase(entities, false);
42135         dispatch14.call("merge", this, entities);
42136       },
42137       perform: function() {
42138         select_default2(document).interrupt("history.perform");
42139         var transitionable = false;
42140         var action0 = arguments[0];
42141         if (arguments.length === 1 || arguments.length === 2 && typeof arguments[1] !== "function") {
42142           transitionable = !!action0.transitionable;
42143         }
42144         if (transitionable) {
42145           var origArguments = arguments;
42146           select_default2(document).transition("history.perform").duration(duration).ease(linear2).tween("history.tween", function() {
42147             return function(t2) {
42148               if (t2 < 1) _overwrite([action0], t2);
42149             };
42150           }).on("start", function() {
42151             _perform([action0], 0);
42152           }).on("end interrupt", function() {
42153             _overwrite(origArguments, 1);
42154           });
42155         } else {
42156           return _perform(arguments);
42157         }
42158       },
42159       replace: function() {
42160         select_default2(document).interrupt("history.perform");
42161         return _replace(arguments, 1);
42162       },
42163       // Same as calling pop and then perform
42164       overwrite: function() {
42165         select_default2(document).interrupt("history.perform");
42166         return _overwrite(arguments, 1);
42167       },
42168       pop: function(n3) {
42169         select_default2(document).interrupt("history.perform");
42170         var previous = _stack[_index].graph;
42171         if (isNaN(+n3) || +n3 < 0) {
42172           n3 = 1;
42173         }
42174         while (n3-- > 0 && _index > 0) {
42175           _index--;
42176           _stack.pop();
42177         }
42178         return change(previous);
42179       },
42180       // Back to the previous annotated state or _index = 0.
42181       undo: function() {
42182         select_default2(document).interrupt("history.perform");
42183         var previousStack = _stack[_index];
42184         var previous = previousStack.graph;
42185         while (_index > 0) {
42186           _index--;
42187           if (_stack[_index].annotation) break;
42188         }
42189         dispatch14.call("undone", this, _stack[_index], previousStack);
42190         return change(previous);
42191       },
42192       // Forward to the next annotated state.
42193       redo: function() {
42194         select_default2(document).interrupt("history.perform");
42195         var previousStack = _stack[_index];
42196         var previous = previousStack.graph;
42197         var tryIndex = _index;
42198         while (tryIndex < _stack.length - 1) {
42199           tryIndex++;
42200           if (_stack[tryIndex].annotation) {
42201             _index = tryIndex;
42202             dispatch14.call("redone", this, _stack[_index], previousStack);
42203             break;
42204           }
42205         }
42206         return change(previous);
42207       },
42208       pauseChangeDispatch: function() {
42209         if (!_pausedGraph) {
42210           _pausedGraph = _stack[_index].graph;
42211         }
42212       },
42213       resumeChangeDispatch: function() {
42214         if (_pausedGraph) {
42215           var previous = _pausedGraph;
42216           _pausedGraph = null;
42217           return change(previous);
42218         }
42219       },
42220       undoAnnotation: function() {
42221         var i3 = _index;
42222         while (i3 >= 0) {
42223           if (_stack[i3].annotation) return _stack[i3].annotation;
42224           i3--;
42225         }
42226       },
42227       redoAnnotation: function() {
42228         var i3 = _index + 1;
42229         while (i3 <= _stack.length - 1) {
42230           if (_stack[i3].annotation) return _stack[i3].annotation;
42231           i3++;
42232         }
42233       },
42234       // Returns the entities from the active graph with bounding boxes
42235       // overlapping the given `extent`.
42236       intersects: function(extent) {
42237         return _tree.intersects(extent, _stack[_index].graph);
42238       },
42239       difference: function() {
42240         var base = _stack[0].graph;
42241         var head = _stack[_index].graph;
42242         return coreDifference(base, head);
42243       },
42244       changes: function(action) {
42245         var base = _stack[0].graph;
42246         var head = _stack[_index].graph;
42247         if (action) {
42248           head = action(head);
42249         }
42250         var difference2 = coreDifference(base, head);
42251         return {
42252           modified: difference2.modified(),
42253           created: difference2.created(),
42254           deleted: difference2.deleted()
42255         };
42256       },
42257       hasChanges: function() {
42258         return this.difference().length() > 0;
42259       },
42260       imageryUsed: function(sources) {
42261         if (sources) {
42262           _imageryUsed = sources;
42263           return history;
42264         } else {
42265           var s2 = /* @__PURE__ */ new Set();
42266           _stack.slice(1, _index + 1).forEach(function(state) {
42267             state.imageryUsed.forEach(function(source) {
42268               if (source !== "Custom") {
42269                 s2.add(source);
42270               }
42271             });
42272           });
42273           return Array.from(s2);
42274         }
42275       },
42276       photoOverlaysUsed: function(sources) {
42277         if (sources) {
42278           _photoOverlaysUsed = sources;
42279           return history;
42280         } else {
42281           var s2 = /* @__PURE__ */ new Set();
42282           _stack.slice(1, _index + 1).forEach(function(state) {
42283             if (state.photoOverlaysUsed && Array.isArray(state.photoOverlaysUsed)) {
42284               state.photoOverlaysUsed.forEach(function(photoOverlay) {
42285                 s2.add(photoOverlay);
42286               });
42287             }
42288           });
42289           return Array.from(s2);
42290         }
42291       },
42292       // save the current history state
42293       checkpoint: function(key) {
42294         _checkpoints[key] = {
42295           stack: _stack,
42296           index: _index
42297         };
42298         return history;
42299       },
42300       // restore history state to a given checkpoint or reset completely
42301       reset: function(key) {
42302         if (key !== void 0 && _checkpoints.hasOwnProperty(key)) {
42303           _stack = _checkpoints[key].stack;
42304           _index = _checkpoints[key].index;
42305         } else {
42306           _stack = [{ graph: coreGraph() }];
42307           _index = 0;
42308           _tree = coreTree(_stack[0].graph);
42309           _checkpoints = {};
42310         }
42311         dispatch14.call("reset");
42312         dispatch14.call("change");
42313         return history;
42314       },
42315       // `toIntroGraph()` is used to export the intro graph used by the walkthrough.
42316       //
42317       // To use it:
42318       //  1. Start the walkthrough.
42319       //  2. Get to a "free editing" tutorial step
42320       //  3. Make your edits to the walkthrough map
42321       //  4. In your browser dev console run:
42322       //        `id.history().toIntroGraph()`
42323       //  5. This outputs stringified JSON to the browser console
42324       //  6. Copy it to `data/intro_graph.json` and prettify it in your code editor
42325       toIntroGraph: function() {
42326         var nextID = { n: 0, r: 0, w: 0 };
42327         var permIDs = {};
42328         var graph = this.graph();
42329         var baseEntities = {};
42330         Object.values(graph.base().entities).forEach(function(entity) {
42331           var copy2 = copyIntroEntity(entity);
42332           baseEntities[copy2.id] = copy2;
42333         });
42334         Object.keys(graph.entities).forEach(function(id2) {
42335           var entity = graph.entities[id2];
42336           if (entity) {
42337             var copy2 = copyIntroEntity(entity);
42338             baseEntities[copy2.id] = copy2;
42339           } else {
42340             delete baseEntities[id2];
42341           }
42342         });
42343         Object.values(baseEntities).forEach(function(entity) {
42344           if (Array.isArray(entity.nodes)) {
42345             entity.nodes = entity.nodes.map(function(node) {
42346               return permIDs[node] || node;
42347             });
42348           }
42349           if (Array.isArray(entity.members)) {
42350             entity.members = entity.members.map(function(member) {
42351               member.id = permIDs[member.id] || member.id;
42352               return member;
42353             });
42354           }
42355         });
42356         return JSON.stringify({ dataIntroGraph: baseEntities });
42357         function copyIntroEntity(source) {
42358           var copy2 = utilObjectOmit(source, ["type", "user", "v", "version", "visible"]);
42359           if (copy2.tags && !Object.keys(copy2.tags)) {
42360             delete copy2.tags;
42361           }
42362           if (Array.isArray(copy2.loc)) {
42363             copy2.loc[0] = +copy2.loc[0].toFixed(6);
42364             copy2.loc[1] = +copy2.loc[1].toFixed(6);
42365           }
42366           var match = source.id.match(/([nrw])-\d*/);
42367           if (match !== null) {
42368             var nrw = match[1];
42369             var permID;
42370             do {
42371               permID = nrw + ++nextID[nrw];
42372             } while (baseEntities.hasOwnProperty(permID));
42373             copy2.id = permIDs[source.id] = permID;
42374           }
42375           return copy2;
42376         }
42377       },
42378       toJSON: function() {
42379         if (!this.hasChanges()) return;
42380         var allEntities = {};
42381         var baseEntities = {};
42382         var base = _stack[0];
42383         var s2 = _stack.map(function(i3) {
42384           var modified = [];
42385           var deleted = [];
42386           Object.keys(i3.graph.entities).forEach(function(id2) {
42387             var entity = i3.graph.entities[id2];
42388             if (entity) {
42389               var key = osmEntity.key(entity);
42390               allEntities[key] = entity;
42391               modified.push(key);
42392             } else {
42393               deleted.push(id2);
42394             }
42395             if (id2 in base.graph.entities) {
42396               baseEntities[id2] = base.graph.entities[id2];
42397             }
42398             if (entity && entity.nodes) {
42399               entity.nodes.forEach(function(nodeID) {
42400                 if (nodeID in base.graph.entities) {
42401                   baseEntities[nodeID] = base.graph.entities[nodeID];
42402                 }
42403               });
42404             }
42405             var baseParents = base.graph._parentWays[id2];
42406             if (baseParents) {
42407               baseParents.forEach(function(parentID) {
42408                 if (parentID in base.graph.entities) {
42409                   baseEntities[parentID] = base.graph.entities[parentID];
42410                 }
42411               });
42412             }
42413           });
42414           var x2 = {};
42415           if (modified.length) x2.modified = modified;
42416           if (deleted.length) x2.deleted = deleted;
42417           if (i3.imageryUsed) x2.imageryUsed = i3.imageryUsed;
42418           if (i3.photoOverlaysUsed) x2.photoOverlaysUsed = i3.photoOverlaysUsed;
42419           if (i3.annotation) x2.annotation = i3.annotation;
42420           if (i3.transform) x2.transform = i3.transform;
42421           if (i3.selectedIDs) x2.selectedIDs = i3.selectedIDs;
42422           return x2;
42423         });
42424         return JSON.stringify({
42425           version: 3,
42426           entities: Object.values(allEntities),
42427           baseEntities: Object.values(baseEntities),
42428           stack: s2,
42429           nextIDs: osmEntity.id.next,
42430           index: _index,
42431           // note the time the changes were saved
42432           timestamp: (/* @__PURE__ */ new Date()).getTime()
42433         });
42434       },
42435       fromJSON: function(json, loadChildNodes) {
42436         var h2 = JSON.parse(json);
42437         var loadComplete = true;
42438         osmEntity.id.next = h2.nextIDs;
42439         _index = h2.index;
42440         if (h2.version === 2 || h2.version === 3) {
42441           var allEntities = {};
42442           h2.entities.forEach(function(entity) {
42443             allEntities[osmEntity.key(entity)] = osmEntity(entity);
42444           });
42445           if (h2.version === 3) {
42446             var baseEntities = h2.baseEntities.map(function(d2) {
42447               return osmEntity(d2);
42448             });
42449             var stack = _stack.map(function(state) {
42450               return state.graph;
42451             });
42452             _stack[0].graph.rebase(baseEntities, stack, true);
42453             _tree.rebase(baseEntities, true);
42454             if (loadChildNodes) {
42455               var osm = context.connection();
42456               var baseWays = baseEntities.filter(function(e3) {
42457                 return e3.type === "way";
42458               });
42459               var nodeIDs = baseWays.reduce(function(acc, way) {
42460                 return utilArrayUnion(acc, way.nodes);
42461               }, []);
42462               var missing = nodeIDs.filter(function(n3) {
42463                 return !_stack[0].graph.hasEntity(n3);
42464               });
42465               if (missing.length && osm) {
42466                 loadComplete = false;
42467                 context.map().redrawEnable(false);
42468                 var loading = uiLoading(context).blocking(true);
42469                 context.container().call(loading);
42470                 var childNodesLoaded = function(err, result) {
42471                   if (!err) {
42472                     var visibleGroups = utilArrayGroupBy(result.data, "visible");
42473                     var visibles = visibleGroups.true || [];
42474                     var invisibles = visibleGroups.false || [];
42475                     if (visibles.length) {
42476                       var visibleIDs = visibles.map(function(entity) {
42477                         return entity.id;
42478                       });
42479                       var stack2 = _stack.map(function(state) {
42480                         return state.graph;
42481                       });
42482                       missing = utilArrayDifference(missing, visibleIDs);
42483                       _stack[0].graph.rebase(visibles, stack2, true);
42484                       _tree.rebase(visibles, true);
42485                     }
42486                     invisibles.forEach(function(entity) {
42487                       osm.loadEntityVersion(entity.id, +entity.version - 1, childNodesLoaded);
42488                     });
42489                   }
42490                   if (err || !missing.length) {
42491                     loading.close();
42492                     context.map().redrawEnable(true);
42493                     dispatch14.call("change");
42494                     dispatch14.call("restore", this);
42495                   }
42496                 };
42497                 osm.loadMultiple(missing, childNodesLoaded);
42498               }
42499             }
42500           }
42501           _stack = h2.stack.map(function(d2) {
42502             var entities = {}, entity;
42503             if (d2.modified) {
42504               d2.modified.forEach(function(key) {
42505                 entity = allEntities[key];
42506                 entities[entity.id] = entity;
42507               });
42508             }
42509             if (d2.deleted) {
42510               d2.deleted.forEach(function(id2) {
42511                 entities[id2] = void 0;
42512               });
42513             }
42514             return {
42515               graph: coreGraph(_stack[0].graph).load(entities),
42516               annotation: d2.annotation,
42517               imageryUsed: d2.imageryUsed,
42518               photoOverlaysUsed: d2.photoOverlaysUsed,
42519               transform: d2.transform,
42520               selectedIDs: d2.selectedIDs
42521             };
42522           });
42523         } else {
42524           _stack = h2.stack.map(function(d2) {
42525             var entities = {};
42526             for (var i3 in d2.entities) {
42527               var entity = d2.entities[i3];
42528               entities[i3] = entity === "undefined" ? void 0 : osmEntity(entity);
42529             }
42530             d2.graph = coreGraph(_stack[0].graph).load(entities);
42531             return d2;
42532           });
42533         }
42534         var transform2 = _stack[_index].transform;
42535         if (transform2) {
42536           context.map().transformEase(transform2, 0);
42537         }
42538         if (loadComplete) {
42539           dispatch14.call("change");
42540           dispatch14.call("restore", this);
42541         }
42542         return history;
42543       },
42544       lock: function() {
42545         return lock.lock();
42546       },
42547       unlock: function() {
42548         lock.unlock();
42549       },
42550       save: function() {
42551         if (lock.locked() && // don't overwrite existing, unresolved changes
42552         !_hasUnresolvedRestorableChanges) {
42553           const success = corePreferences(getKey("saved_history"), history.toJSON() || null);
42554           if (!success) dispatch14.call("storage_error");
42555         }
42556         return history;
42557       },
42558       // delete the history version saved in localStorage
42559       clearSaved: function() {
42560         context.debouncedSave.cancel();
42561         if (lock.locked()) {
42562           _hasUnresolvedRestorableChanges = false;
42563           corePreferences(getKey("saved_history"), null);
42564           corePreferences("comment", null);
42565           corePreferences("hashtags", null);
42566           corePreferences("source", null);
42567         }
42568         return history;
42569       },
42570       savedHistoryJSON: function() {
42571         return corePreferences(getKey("saved_history"));
42572       },
42573       hasRestorableChanges: function() {
42574         return _hasUnresolvedRestorableChanges;
42575       },
42576       // load history from a version stored in localStorage
42577       restore: function() {
42578         if (lock.locked()) {
42579           _hasUnresolvedRestorableChanges = false;
42580           var json = this.savedHistoryJSON();
42581           if (json) history.fromJSON(json, true);
42582         }
42583       },
42584       _getKey: getKey
42585     };
42586     history.reset();
42587     return utilRebind(history, dispatch14, "on");
42588   }
42589
42590   // modules/validations/index.js
42591   var validations_exports = {};
42592   __export(validations_exports, {
42593     validationAlmostJunction: () => validationAlmostJunction,
42594     validationCloseNodes: () => validationCloseNodes,
42595     validationCrossingWays: () => validationCrossingWays,
42596     validationDisconnectedWay: () => validationDisconnectedWay,
42597     validationFormatting: () => validationFormatting,
42598     validationHelpRequest: () => validationHelpRequest,
42599     validationImpossibleOneway: () => validationImpossibleOneway,
42600     validationIncompatibleSource: () => validationIncompatibleSource,
42601     validationMaprules: () => validationMaprules,
42602     validationMismatchedGeometry: () => validationMismatchedGeometry,
42603     validationMissingRole: () => validationMissingRole,
42604     validationMissingTag: () => validationMissingTag,
42605     validationMutuallyExclusiveTags: () => validationMutuallyExclusiveTags,
42606     validationOutdatedTags: () => validationOutdatedTags,
42607     validationPrivateData: () => validationPrivateData,
42608     validationSuspiciousName: () => validationSuspiciousName,
42609     validationUnsquareWay: () => validationUnsquareWay
42610   });
42611
42612   // modules/validations/almost_junction.js
42613   function validationAlmostJunction(context) {
42614     const type2 = "almost_junction";
42615     const EXTEND_TH_METERS = 5;
42616     const WELD_TH_METERS = 0.75;
42617     const CLOSE_NODE_TH = EXTEND_TH_METERS - WELD_TH_METERS;
42618     const SIG_ANGLE_TH = Math.atan(WELD_TH_METERS / EXTEND_TH_METERS);
42619     function isHighway(entity) {
42620       return entity.type === "way" && osmRoutableHighwayTagValues[entity.tags.highway];
42621     }
42622     function isTaggedAsNotContinuing(node) {
42623       return node.tags.noexit === "yes" || node.tags.amenity === "parking_entrance" || node.tags.entrance && node.tags.entrance !== "no";
42624     }
42625     const validation = function checkAlmostJunction(entity, graph) {
42626       if (!isHighway(entity)) return [];
42627       if (entity.isDegenerate()) return [];
42628       const tree = context.history().tree();
42629       const extendableNodeInfos = findConnectableEndNodesByExtension(entity);
42630       let issues = [];
42631       extendableNodeInfos.forEach((extendableNodeInfo) => {
42632         issues.push(new validationIssue({
42633           type: type2,
42634           subtype: "highway-highway",
42635           severity: "warning",
42636           message: function(context2) {
42637             const entity1 = context2.hasEntity(this.entityIds[0]);
42638             if (this.entityIds[0] === this.entityIds[2]) {
42639               return entity1 ? _t.append("issues.almost_junction.self.message", {
42640                 feature: utilDisplayLabel(entity1, context2.graph())
42641               }) : "";
42642             } else {
42643               const entity2 = context2.hasEntity(this.entityIds[2]);
42644               return entity1 && entity2 ? _t.append("issues.almost_junction.message", {
42645                 feature: utilDisplayLabel(entity1, context2.graph()),
42646                 feature2: utilDisplayLabel(entity2, context2.graph())
42647               }) : "";
42648             }
42649           },
42650           reference: showReference,
42651           entityIds: [
42652             entity.id,
42653             extendableNodeInfo.node.id,
42654             extendableNodeInfo.wid
42655           ],
42656           loc: extendableNodeInfo.node.loc,
42657           hash: JSON.stringify(extendableNodeInfo.node.loc),
42658           data: {
42659             midId: extendableNodeInfo.mid.id,
42660             edge: extendableNodeInfo.edge,
42661             cross_loc: extendableNodeInfo.cross_loc
42662           },
42663           dynamicFixes: makeFixes
42664         }));
42665       });
42666       return issues;
42667       function makeFixes(context2) {
42668         let fixes = [new validationIssueFix({
42669           icon: "iD-icon-abutment",
42670           title: _t.append("issues.fix.connect_features.title"),
42671           onClick: function(context3) {
42672             const annotation = _t("issues.fix.connect_almost_junction.annotation");
42673             const [, endNodeId, crossWayId] = this.issue.entityIds;
42674             const midNode = context3.entity(this.issue.data.midId);
42675             const endNode = context3.entity(endNodeId);
42676             const crossWay = context3.entity(crossWayId);
42677             const nearEndNodes = findNearbyEndNodes(endNode, crossWay);
42678             if (nearEndNodes.length > 0) {
42679               const collinear = findSmallJoinAngle(midNode, endNode, nearEndNodes);
42680               if (collinear) {
42681                 context3.perform(
42682                   actionMergeNodes([collinear.id, endNode.id], collinear.loc),
42683                   annotation
42684                 );
42685                 return;
42686               }
42687             }
42688             const targetEdge = this.issue.data.edge;
42689             const crossLoc = this.issue.data.cross_loc;
42690             const edgeNodes = [context3.entity(targetEdge[0]), context3.entity(targetEdge[1])];
42691             const closestNodeInfo = geoSphericalClosestNode(edgeNodes, crossLoc);
42692             if (closestNodeInfo.distance < WELD_TH_METERS) {
42693               context3.perform(
42694                 actionMergeNodes([closestNodeInfo.node.id, endNode.id], closestNodeInfo.node.loc),
42695                 annotation
42696               );
42697             } else {
42698               context3.perform(
42699                 actionAddMidpoint({ loc: crossLoc, edge: targetEdge }, endNode),
42700                 annotation
42701               );
42702             }
42703           }
42704         })];
42705         const node = context2.hasEntity(this.entityIds[1]);
42706         if (node && !node.hasInterestingTags()) {
42707           fixes.push(new validationIssueFix({
42708             icon: "maki-barrier",
42709             title: _t.append("issues.fix.tag_as_disconnected.title"),
42710             onClick: function(context3) {
42711               const nodeID = this.issue.entityIds[1];
42712               const tags = Object.assign({}, context3.entity(nodeID).tags);
42713               tags.noexit = "yes";
42714               context3.perform(
42715                 actionChangeTags(nodeID, tags),
42716                 _t("issues.fix.tag_as_disconnected.annotation")
42717               );
42718             }
42719           }));
42720         }
42721         return fixes;
42722       }
42723       function showReference(selection2) {
42724         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.almost_junction.highway-highway.reference"));
42725       }
42726       function isExtendableCandidate(node, way) {
42727         const osm = services.osm;
42728         if (osm && !osm.isDataLoaded(node.loc)) {
42729           return false;
42730         }
42731         if (isTaggedAsNotContinuing(node) || graph.parentWays(node).length !== 1) {
42732           return false;
42733         }
42734         let occurrences = 0;
42735         for (const index in way.nodes) {
42736           if (way.nodes[index] === node.id) {
42737             occurrences += 1;
42738             if (occurrences > 1) {
42739               return false;
42740             }
42741           }
42742         }
42743         return true;
42744       }
42745       function findConnectableEndNodesByExtension(way) {
42746         let results = [];
42747         if (way.isClosed()) return results;
42748         let testNodes;
42749         const indices = [0, way.nodes.length - 1];
42750         indices.forEach((nodeIndex) => {
42751           const nodeID = way.nodes[nodeIndex];
42752           const node = graph.entity(nodeID);
42753           if (!isExtendableCandidate(node, way)) return;
42754           const connectionInfo = canConnectByExtend(way, nodeIndex);
42755           if (!connectionInfo) return;
42756           testNodes = graph.childNodes(way).slice();
42757           testNodes[nodeIndex] = testNodes[nodeIndex].move(connectionInfo.cross_loc);
42758           if (geoHasSelfIntersections(testNodes, nodeID)) return;
42759           results.push(connectionInfo);
42760         });
42761         return results;
42762       }
42763       function findNearbyEndNodes(node, way) {
42764         return [
42765           way.nodes[0],
42766           way.nodes[way.nodes.length - 1]
42767         ].map((d2) => graph.entity(d2)).filter((d2) => {
42768           return d2.id !== node.id && geoSphericalDistance(node.loc, d2.loc) <= CLOSE_NODE_TH;
42769         });
42770       }
42771       function findSmallJoinAngle(midNode, tipNode, endNodes) {
42772         let joinTo;
42773         let minAngle = Infinity;
42774         endNodes.forEach((endNode) => {
42775           const a1 = geoAngle(midNode, tipNode, context.projection) + Math.PI;
42776           const a2 = geoAngle(midNode, endNode, context.projection) + Math.PI;
42777           const diff = Math.max(a1, a2) - Math.min(a1, a2);
42778           if (diff < minAngle) {
42779             joinTo = endNode;
42780             minAngle = diff;
42781           }
42782         });
42783         if (minAngle <= SIG_ANGLE_TH) return joinTo;
42784         return null;
42785       }
42786       function hasTag(tags, key) {
42787         return tags[key] !== void 0 && tags[key] !== "no";
42788       }
42789       function canConnectWays(way, way2) {
42790         if (way.id === way2.id) return true;
42791         if ((hasTag(way.tags, "bridge") || hasTag(way2.tags, "bridge")) && !(hasTag(way.tags, "bridge") && hasTag(way2.tags, "bridge"))) return false;
42792         if ((hasTag(way.tags, "tunnel") || hasTag(way2.tags, "tunnel")) && !(hasTag(way.tags, "tunnel") && hasTag(way2.tags, "tunnel"))) return false;
42793         const layer1 = way.tags.layer || "0", layer2 = way2.tags.layer || "0";
42794         if (layer1 !== layer2) return false;
42795         const level1 = way.tags.level || "0", level2 = way2.tags.level || "0";
42796         if (level1 !== level2) return false;
42797         return true;
42798       }
42799       function canConnectByExtend(way, endNodeIdx) {
42800         const tipNid = way.nodes[endNodeIdx];
42801         const midNid = endNodeIdx === 0 ? way.nodes[1] : way.nodes[way.nodes.length - 2];
42802         const tipNode = graph.entity(tipNid);
42803         const midNode = graph.entity(midNid);
42804         const lon = tipNode.loc[0];
42805         const lat = tipNode.loc[1];
42806         const lon_range = geoMetersToLon(EXTEND_TH_METERS, lat) / 2;
42807         const lat_range = geoMetersToLat(EXTEND_TH_METERS) / 2;
42808         const queryExtent = geoExtent([
42809           [lon - lon_range, lat - lat_range],
42810           [lon + lon_range, lat + lat_range]
42811         ]);
42812         const edgeLen = geoSphericalDistance(midNode.loc, tipNode.loc);
42813         const t2 = EXTEND_TH_METERS / edgeLen + 1;
42814         const extTipLoc = geoVecInterp(midNode.loc, tipNode.loc, t2);
42815         const segmentInfos = tree.waySegments(queryExtent, graph);
42816         for (let i3 = 0; i3 < segmentInfos.length; i3++) {
42817           let segmentInfo = segmentInfos[i3];
42818           let way2 = graph.entity(segmentInfo.wayId);
42819           if (!isHighway(way2)) continue;
42820           if (!canConnectWays(way, way2)) continue;
42821           let nAid = segmentInfo.nodes[0], nBid = segmentInfo.nodes[1];
42822           if (nAid === tipNid || nBid === tipNid) continue;
42823           let nA = graph.entity(nAid), nB = graph.entity(nBid);
42824           let crossLoc = geoLineIntersection([tipNode.loc, extTipLoc], [nA.loc, nB.loc]);
42825           if (crossLoc) {
42826             return {
42827               mid: midNode,
42828               node: tipNode,
42829               wid: way2.id,
42830               edge: [nA.id, nB.id],
42831               cross_loc: crossLoc
42832             };
42833           }
42834         }
42835         return null;
42836       }
42837     };
42838     validation.type = type2;
42839     return validation;
42840   }
42841
42842   // modules/validations/close_nodes.js
42843   function validationCloseNodes(context) {
42844     var type2 = "close_nodes";
42845     var pointThresholdMeters = 0.2;
42846     var validation = function(entity, graph) {
42847       if (entity.type === "node") {
42848         return getIssuesForNode(entity);
42849       } else if (entity.type === "way") {
42850         return getIssuesForWay(entity);
42851       }
42852       return [];
42853       function getIssuesForNode(node) {
42854         var parentWays = graph.parentWays(node);
42855         if (parentWays.length) {
42856           return getIssuesForVertex(node, parentWays);
42857         } else {
42858           return getIssuesForDetachedPoint(node);
42859         }
42860       }
42861       function wayTypeFor(way) {
42862         if (way.tags.boundary && way.tags.boundary !== "no") return "boundary";
42863         if (way.tags.indoor && way.tags.indoor !== "no") return "indoor";
42864         if (way.tags.building && way.tags.building !== "no" || way.tags["building:part"] && way.tags["building:part"] !== "no") return "building";
42865         if (osmPathHighwayTagValues[way.tags.highway]) return "path";
42866         var parentRelations = graph.parentRelations(way);
42867         for (var i3 in parentRelations) {
42868           var relation = parentRelations[i3];
42869           if (relation.tags.type === "boundary") return "boundary";
42870           if (relation.isMultipolygon()) {
42871             if (relation.tags.indoor && relation.tags.indoor !== "no") return "indoor";
42872             if (relation.tags.building && relation.tags.building !== "no" || relation.tags["building:part"] && relation.tags["building:part"] !== "no") return "building";
42873           }
42874         }
42875         return "other";
42876       }
42877       function shouldCheckWay(way) {
42878         if (way.nodes.length <= 2 || way.isClosed() && way.nodes.length <= 4) return false;
42879         var bbox2 = way.extent(graph).bbox();
42880         var hypotenuseMeters = geoSphericalDistance([bbox2.minX, bbox2.minY], [bbox2.maxX, bbox2.maxY]);
42881         if (hypotenuseMeters < 1.5) return false;
42882         return true;
42883       }
42884       function getIssuesForWay(way) {
42885         if (!shouldCheckWay(way)) return [];
42886         var issues = [], nodes = graph.childNodes(way);
42887         for (var i3 = 0; i3 < nodes.length - 1; i3++) {
42888           var node1 = nodes[i3];
42889           var node2 = nodes[i3 + 1];
42890           var issue = getWayIssueIfAny(node1, node2, way);
42891           if (issue) issues.push(issue);
42892         }
42893         return issues;
42894       }
42895       function getIssuesForVertex(node, parentWays) {
42896         var issues = [];
42897         function checkForCloseness(node1, node2, way) {
42898           var issue = getWayIssueIfAny(node1, node2, way);
42899           if (issue) issues.push(issue);
42900         }
42901         for (var i3 = 0; i3 < parentWays.length; i3++) {
42902           var parentWay = parentWays[i3];
42903           if (!shouldCheckWay(parentWay)) continue;
42904           var lastIndex = parentWay.nodes.length - 1;
42905           for (var j2 = 0; j2 < parentWay.nodes.length; j2++) {
42906             if (j2 !== 0) {
42907               if (parentWay.nodes[j2 - 1] === node.id) {
42908                 checkForCloseness(node, graph.entity(parentWay.nodes[j2]), parentWay);
42909               }
42910             }
42911             if (j2 !== lastIndex) {
42912               if (parentWay.nodes[j2 + 1] === node.id) {
42913                 checkForCloseness(graph.entity(parentWay.nodes[j2]), node, parentWay);
42914               }
42915             }
42916           }
42917         }
42918         return issues;
42919       }
42920       function thresholdMetersForWay(way) {
42921         if (!shouldCheckWay(way)) return 0;
42922         var wayType = wayTypeFor(way);
42923         if (wayType === "boundary") return 0;
42924         if (wayType === "indoor") return 0.01;
42925         if (wayType === "building") return 0.05;
42926         if (wayType === "path") return 0.1;
42927         return 0.2;
42928       }
42929       function getIssuesForDetachedPoint(node) {
42930         var issues = [];
42931         var lon = node.loc[0];
42932         var lat = node.loc[1];
42933         var lon_range = geoMetersToLon(pointThresholdMeters, lat) / 2;
42934         var lat_range = geoMetersToLat(pointThresholdMeters) / 2;
42935         var queryExtent = geoExtent([
42936           [lon - lon_range, lat - lat_range],
42937           [lon + lon_range, lat + lat_range]
42938         ]);
42939         var intersected = context.history().tree().intersects(queryExtent, graph);
42940         for (var j2 = 0; j2 < intersected.length; j2++) {
42941           var nearby = intersected[j2];
42942           if (nearby.id === node.id) continue;
42943           if (nearby.type !== "node" || nearby.geometry(graph) !== "point") continue;
42944           if (nearby.loc === node.loc || geoSphericalDistance(node.loc, nearby.loc) < pointThresholdMeters) {
42945             if ("memorial:type" in node.tags && "memorial:type" in nearby.tags && node.tags["memorial:type"] === "stolperstein" && nearby.tags["memorial:type"] === "stolperstein") continue;
42946             if ("memorial" in node.tags && "memorial" in nearby.tags && node.tags.memorial === "stolperstein" && nearby.tags.memorial === "stolperstein") continue;
42947             var zAxisKeys = { layer: true, level: true, "addr:housenumber": true, "addr:unit": true };
42948             var zAxisDifferentiates = false;
42949             for (var key in zAxisKeys) {
42950               var nodeValue = node.tags[key] || "0";
42951               var nearbyValue = nearby.tags[key] || "0";
42952               if (nodeValue !== nearbyValue) {
42953                 zAxisDifferentiates = true;
42954                 break;
42955               }
42956             }
42957             if (zAxisDifferentiates) continue;
42958             issues.push(new validationIssue({
42959               type: type2,
42960               subtype: "detached",
42961               severity: "warning",
42962               message: function(context2) {
42963                 var entity2 = context2.hasEntity(this.entityIds[0]), entity22 = context2.hasEntity(this.entityIds[1]);
42964                 return entity2 && entity22 ? _t.append("issues.close_nodes.detached.message", {
42965                   feature: utilDisplayLabel(entity2, context2.graph()),
42966                   feature2: utilDisplayLabel(entity22, context2.graph())
42967                 }) : "";
42968               },
42969               reference: showReference,
42970               entityIds: [node.id, nearby.id],
42971               dynamicFixes: function() {
42972                 return [
42973                   new validationIssueFix({
42974                     icon: "iD-operation-disconnect",
42975                     title: _t.append("issues.fix.move_points_apart.title")
42976                   }),
42977                   new validationIssueFix({
42978                     icon: "iD-icon-layers",
42979                     title: _t.append("issues.fix.use_different_layers_or_levels.title")
42980                   })
42981                 ];
42982               }
42983             }));
42984           }
42985         }
42986         return issues;
42987         function showReference(selection2) {
42988           var referenceText = _t("issues.close_nodes.detached.reference");
42989           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
42990         }
42991       }
42992       function getWayIssueIfAny(node1, node2, way) {
42993         if (node1.id === node2.id || node1.hasInterestingTags() && node2.hasInterestingTags()) {
42994           return null;
42995         }
42996         if (node1.loc !== node2.loc) {
42997           var parentWays1 = graph.parentWays(node1);
42998           var parentWays2 = new Set(graph.parentWays(node2));
42999           var sharedWays = parentWays1.filter(function(parentWay) {
43000             return parentWays2.has(parentWay);
43001           });
43002           var thresholds = sharedWays.map(function(parentWay) {
43003             return thresholdMetersForWay(parentWay);
43004           });
43005           var threshold = Math.min(...thresholds);
43006           var distance = geoSphericalDistance(node1.loc, node2.loc);
43007           if (distance > threshold) return null;
43008         }
43009         return new validationIssue({
43010           type: type2,
43011           subtype: "vertices",
43012           severity: "warning",
43013           message: function(context2) {
43014             var entity2 = context2.hasEntity(this.entityIds[0]);
43015             return entity2 ? _t.append("issues.close_nodes.message", { way: utilDisplayLabel(entity2, context2.graph()) }) : "";
43016           },
43017           reference: showReference,
43018           entityIds: [way.id, node1.id, node2.id],
43019           loc: node1.loc,
43020           dynamicFixes: function() {
43021             return [
43022               new validationIssueFix({
43023                 icon: "iD-icon-plus",
43024                 title: _t.append("issues.fix.merge_points.title"),
43025                 onClick: function(context2) {
43026                   var entityIds = this.issue.entityIds;
43027                   var action = actionMergeNodes([entityIds[1], entityIds[2]]);
43028                   context2.perform(action, _t("issues.fix.merge_close_vertices.annotation"));
43029                 }
43030               }),
43031               new validationIssueFix({
43032                 icon: "iD-operation-disconnect",
43033                 title: _t.append("issues.fix.move_points_apart.title")
43034               })
43035             ];
43036           }
43037         });
43038         function showReference(selection2) {
43039           var referenceText = _t("issues.close_nodes.reference");
43040           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
43041         }
43042       }
43043     };
43044     validation.type = type2;
43045     return validation;
43046   }
43047
43048   // modules/validations/crossing_ways.js
43049   var import_lodash3 = __toESM(require_lodash());
43050   function validationCrossingWays(context) {
43051     var type2 = "crossing_ways";
43052     function getFeatureWithFeatureTypeTagsForWay(way, graph) {
43053       if (getFeatureType(way, graph) === null) {
43054         var parentRels = graph.parentRelations(way);
43055         for (var i3 = 0; i3 < parentRels.length; i3++) {
43056           var rel = parentRels[i3];
43057           if (getFeatureType(rel, graph) !== null) {
43058             return rel;
43059           }
43060         }
43061       }
43062       return way;
43063     }
43064     function hasTag(tags, key) {
43065       return tags[key] !== void 0 && tags[key] !== "no";
43066     }
43067     function taggedAsIndoor(tags) {
43068       return hasTag(tags, "indoor") || hasTag(tags, "level") || tags.highway === "corridor";
43069     }
43070     function allowsBridge(featureType) {
43071       return featureType === "highway" || featureType === "railway" || featureType === "waterway";
43072     }
43073     function allowsTunnel(featureType) {
43074       return featureType === "highway" || featureType === "railway" || featureType === "waterway";
43075     }
43076     var ignoredBuildings = {
43077       demolished: true,
43078       dismantled: true,
43079       proposed: true,
43080       razed: true
43081     };
43082     function getFeatureType(entity, graph) {
43083       var geometry = entity.geometry(graph);
43084       if (geometry !== "line" && geometry !== "area") return null;
43085       var tags = entity.tags;
43086       if (hasTag(tags, "building") && !ignoredBuildings[tags.building]) return "building";
43087       if (hasTag(tags, "highway") && osmRoutableHighwayTagValues[tags.highway]) return "highway";
43088       if (geometry !== "line") return null;
43089       if (hasTag(tags, "railway") && osmRailwayTrackTagValues[tags.railway]) return "railway";
43090       if (hasTag(tags, "waterway") && osmFlowingWaterwayTagValues[tags.waterway]) return "waterway";
43091       return null;
43092     }
43093     function isLegitCrossing(tags1, featureType1, tags2, featureType2) {
43094       var level1 = tags1.level || "0";
43095       var level2 = tags2.level || "0";
43096       if (taggedAsIndoor(tags1) && taggedAsIndoor(tags2) && level1 !== level2) {
43097         return true;
43098       }
43099       var layer1 = tags1.layer || "0";
43100       var layer2 = tags2.layer || "0";
43101       if (allowsBridge(featureType1) && allowsBridge(featureType2)) {
43102         if (hasTag(tags1, "bridge") && !hasTag(tags2, "bridge")) return true;
43103         if (!hasTag(tags1, "bridge") && hasTag(tags2, "bridge")) return true;
43104         if (hasTag(tags1, "bridge") && hasTag(tags2, "bridge") && layer1 !== layer2) return true;
43105       } else if (allowsBridge(featureType1) && hasTag(tags1, "bridge")) return true;
43106       else if (allowsBridge(featureType2) && hasTag(tags2, "bridge")) return true;
43107       if (allowsTunnel(featureType1) && allowsTunnel(featureType2)) {
43108         if (hasTag(tags1, "tunnel") && !hasTag(tags2, "tunnel")) return true;
43109         if (!hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel")) return true;
43110         if (hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel") && layer1 !== layer2) return true;
43111       } else if (allowsTunnel(featureType1) && hasTag(tags1, "tunnel")) return true;
43112       else if (allowsTunnel(featureType2) && hasTag(tags2, "tunnel")) return true;
43113       if (featureType1 === "waterway" && featureType2 === "highway" && tags2.man_made === "pier") return true;
43114       if (featureType2 === "waterway" && featureType1 === "highway" && tags1.man_made === "pier") return true;
43115       if (featureType1 === "building" || featureType2 === "building" || taggedAsIndoor(tags1) || taggedAsIndoor(tags2)) {
43116         if (layer1 !== layer2) return true;
43117       }
43118       return false;
43119     }
43120     var highwaysDisallowingFords = {
43121       motorway: true,
43122       motorway_link: true,
43123       trunk: true,
43124       trunk_link: true,
43125       primary: true,
43126       primary_link: true,
43127       secondary: true,
43128       secondary_link: true
43129     };
43130     function tagsForConnectionNodeIfAllowed(entity1, entity2, graph, lessLikelyTags) {
43131       var featureType1 = getFeatureType(entity1, graph);
43132       var featureType2 = getFeatureType(entity2, graph);
43133       var geometry1 = entity1.geometry(graph);
43134       var geometry2 = entity2.geometry(graph);
43135       var bothLines = geometry1 === "line" && geometry2 === "line";
43136       if (featureType1 === featureType2) {
43137         if (featureType1 === "highway") {
43138           var entity1IsPath = osmPathHighwayTagValues[entity1.tags.highway];
43139           var entity2IsPath = osmPathHighwayTagValues[entity2.tags.highway];
43140           if ((entity1IsPath || entity2IsPath) && entity1IsPath !== entity2IsPath) {
43141             var roadFeature = entity1IsPath ? entity2 : entity1;
43142             var pathFeature = entity1IsPath ? entity1 : entity2;
43143             if (roadFeature.tags.highway === "track") {
43144               return {};
43145             }
43146             if (!lessLikelyTags && roadFeature.tags.highway === "service" && pathFeature.tags.highway === "footway" && pathFeature.tags.footway === "sidewalk") {
43147               return {};
43148             }
43149             if (["marked", "unmarked", "traffic_signals", "uncontrolled"].indexOf(pathFeature.tags.crossing) !== -1) {
43150               return bothLines ? { highway: "crossing", crossing: pathFeature.tags.crossing } : {};
43151             }
43152             return bothLines ? { highway: "crossing" } : {};
43153           }
43154           return {};
43155         }
43156         if (featureType1 === "waterway") return {};
43157         if (featureType1 === "railway") return {};
43158       } else {
43159         var featureTypes = [featureType1, featureType2];
43160         if (featureTypes.indexOf("highway") !== -1) {
43161           if (featureTypes.indexOf("railway") !== -1) {
43162             if (!bothLines) return {};
43163             var isTram = entity1.tags.railway === "tram" || entity2.tags.railway === "tram";
43164             if (osmPathHighwayTagValues[entity1.tags.highway] || osmPathHighwayTagValues[entity2.tags.highway]) {
43165               if (isTram) return { railway: "tram_crossing" };
43166               return { railway: "crossing" };
43167             } else {
43168               if (isTram) return { railway: "tram_level_crossing" };
43169               return { railway: "level_crossing" };
43170             }
43171           }
43172           if (featureTypes.indexOf("waterway") !== -1) {
43173             if (hasTag(entity1.tags, "tunnel") && hasTag(entity2.tags, "tunnel")) return null;
43174             if (hasTag(entity1.tags, "bridge") && hasTag(entity2.tags, "bridge")) return null;
43175             if (highwaysDisallowingFords[entity1.tags.highway] || highwaysDisallowingFords[entity2.tags.highway]) {
43176               return null;
43177             }
43178             return bothLines ? { ford: "yes" } : {};
43179           }
43180         }
43181       }
43182       return null;
43183     }
43184     function findCrossingsByWay(way1, graph, tree) {
43185       var edgeCrossInfos = [];
43186       if (way1.type !== "way") return edgeCrossInfos;
43187       var taggedFeature1 = getFeatureWithFeatureTypeTagsForWay(way1, graph);
43188       var way1FeatureType = getFeatureType(taggedFeature1, graph);
43189       if (way1FeatureType === null) return edgeCrossInfos;
43190       var checkedSingleCrossingWays = {};
43191       var i3, j2;
43192       var extent;
43193       var n1, n22, nA, nB, nAId, nBId;
43194       var segment1, segment2;
43195       var oneOnly;
43196       var segmentInfos, segment2Info, way2, taggedFeature2, way2FeatureType;
43197       var way1Nodes = graph.childNodes(way1);
43198       var comparedWays = {};
43199       for (i3 = 0; i3 < way1Nodes.length - 1; i3++) {
43200         n1 = way1Nodes[i3];
43201         n22 = way1Nodes[i3 + 1];
43202         extent = geoExtent([
43203           [
43204             Math.min(n1.loc[0], n22.loc[0]),
43205             Math.min(n1.loc[1], n22.loc[1])
43206           ],
43207           [
43208             Math.max(n1.loc[0], n22.loc[0]),
43209             Math.max(n1.loc[1], n22.loc[1])
43210           ]
43211         ]);
43212         segmentInfos = tree.waySegments(extent, graph);
43213         for (j2 = 0; j2 < segmentInfos.length; j2++) {
43214           segment2Info = segmentInfos[j2];
43215           if (segment2Info.wayId === way1.id) continue;
43216           if (checkedSingleCrossingWays[segment2Info.wayId]) continue;
43217           comparedWays[segment2Info.wayId] = true;
43218           way2 = graph.hasEntity(segment2Info.wayId);
43219           if (!way2) continue;
43220           taggedFeature2 = getFeatureWithFeatureTypeTagsForWay(way2, graph);
43221           way2FeatureType = getFeatureType(taggedFeature2, graph);
43222           if (way2FeatureType === null || isLegitCrossing(taggedFeature1.tags, way1FeatureType, taggedFeature2.tags, way2FeatureType)) {
43223             continue;
43224           }
43225           oneOnly = way1FeatureType === "building" || way2FeatureType === "building";
43226           nAId = segment2Info.nodes[0];
43227           nBId = segment2Info.nodes[1];
43228           if (nAId === n1.id || nAId === n22.id || nBId === n1.id || nBId === n22.id) {
43229             continue;
43230           }
43231           nA = graph.hasEntity(nAId);
43232           if (!nA) continue;
43233           nB = graph.hasEntity(nBId);
43234           if (!nB) continue;
43235           segment1 = [n1.loc, n22.loc];
43236           segment2 = [nA.loc, nB.loc];
43237           var point = geoLineIntersection(segment1, segment2);
43238           if (point) {
43239             edgeCrossInfos.push({
43240               wayInfos: [
43241                 {
43242                   way: way1,
43243                   featureType: way1FeatureType,
43244                   edge: [n1.id, n22.id]
43245                 },
43246                 {
43247                   way: way2,
43248                   featureType: way2FeatureType,
43249                   edge: [nA.id, nB.id]
43250                 }
43251               ],
43252               crossPoint: point
43253             });
43254             if (oneOnly) {
43255               checkedSingleCrossingWays[way2.id] = true;
43256               break;
43257             }
43258           }
43259         }
43260       }
43261       return edgeCrossInfos;
43262     }
43263     function waysToCheck(entity, graph) {
43264       var featureType = getFeatureType(entity, graph);
43265       if (!featureType) return [];
43266       if (entity.type === "way") {
43267         return [entity];
43268       } else if (entity.type === "relation") {
43269         return entity.members.reduce(function(array2, member) {
43270           if (member.type === "way" && // only look at geometry ways
43271           (!member.role || member.role === "outer" || member.role === "inner")) {
43272             var entity2 = graph.hasEntity(member.id);
43273             if (entity2 && array2.indexOf(entity2) === -1) {
43274               array2.push(entity2);
43275             }
43276           }
43277           return array2;
43278         }, []);
43279       }
43280       return [];
43281     }
43282     var validation = function checkCrossingWays(entity, graph) {
43283       var tree = context.history().tree();
43284       var ways = waysToCheck(entity, graph);
43285       var issues = [];
43286       var wayIndex, crossingIndex, crossings;
43287       for (wayIndex in ways) {
43288         crossings = findCrossingsByWay(ways[wayIndex], graph, tree);
43289         for (crossingIndex in crossings) {
43290           issues.push(createIssue(crossings[crossingIndex], graph));
43291         }
43292       }
43293       return issues;
43294     };
43295     function createIssue(crossing, graph) {
43296       crossing.wayInfos.sort(function(way1Info, way2Info) {
43297         var type1 = way1Info.featureType;
43298         var type22 = way2Info.featureType;
43299         if (type1 === type22) {
43300           return utilDisplayLabel(way1Info.way, graph) > utilDisplayLabel(way2Info.way, graph);
43301         } else if (type1 === "waterway") {
43302           return true;
43303         } else if (type22 === "waterway") {
43304           return false;
43305         }
43306         return type1 < type22;
43307       });
43308       var entities = crossing.wayInfos.map(function(wayInfo) {
43309         return getFeatureWithFeatureTypeTagsForWay(wayInfo.way, graph);
43310       });
43311       var edges = [crossing.wayInfos[0].edge, crossing.wayInfos[1].edge];
43312       var featureTypes = [crossing.wayInfos[0].featureType, crossing.wayInfos[1].featureType];
43313       var connectionTags = tagsForConnectionNodeIfAllowed(entities[0], entities[1], graph);
43314       var featureType1 = crossing.wayInfos[0].featureType;
43315       var featureType2 = crossing.wayInfos[1].featureType;
43316       var isCrossingIndoors = taggedAsIndoor(entities[0].tags) && taggedAsIndoor(entities[1].tags);
43317       var isCrossingTunnels = allowsTunnel(featureType1) && hasTag(entities[0].tags, "tunnel") && allowsTunnel(featureType2) && hasTag(entities[1].tags, "tunnel");
43318       var isCrossingBridges = allowsBridge(featureType1) && hasTag(entities[0].tags, "bridge") && allowsBridge(featureType2) && hasTag(entities[1].tags, "bridge");
43319       var subtype = [featureType1, featureType2].sort().join("-");
43320       var crossingTypeID = subtype;
43321       if (isCrossingIndoors) {
43322         crossingTypeID = "indoor-indoor";
43323       } else if (isCrossingTunnels) {
43324         crossingTypeID = "tunnel-tunnel";
43325       } else if (isCrossingBridges) {
43326         crossingTypeID = "bridge-bridge";
43327       }
43328       if (connectionTags && (isCrossingIndoors || isCrossingTunnels || isCrossingBridges)) {
43329         crossingTypeID += "_connectable";
43330       }
43331       var uniqueID = crossing.crossPoint[0].toFixed(4) + "," + crossing.crossPoint[1].toFixed(4);
43332       return new validationIssue({
43333         type: type2,
43334         subtype,
43335         severity: "warning",
43336         message: function(context2) {
43337           var graph2 = context2.graph();
43338           var entity1 = graph2.hasEntity(this.entityIds[0]), entity2 = graph2.hasEntity(this.entityIds[1]);
43339           return entity1 && entity2 ? _t.append("issues.crossing_ways.message", {
43340             feature: utilDisplayLabel(entity1, graph2),
43341             feature2: utilDisplayLabel(entity2, graph2)
43342           }) : "";
43343         },
43344         reference: showReference,
43345         entityIds: entities.map(function(entity) {
43346           return entity.id;
43347         }),
43348         data: {
43349           edges,
43350           featureTypes,
43351           connectionTags
43352         },
43353         hash: uniqueID,
43354         loc: crossing.crossPoint,
43355         dynamicFixes: function(context2) {
43356           var mode = context2.mode();
43357           if (!mode || mode.id !== "select" || mode.selectedIDs().length !== 1) return [];
43358           var selectedIndex = this.entityIds[0] === mode.selectedIDs()[0] ? 0 : 1;
43359           var selectedFeatureType = this.data.featureTypes[selectedIndex];
43360           var otherFeatureType = this.data.featureTypes[selectedIndex === 0 ? 1 : 0];
43361           var fixes = [];
43362           if (connectionTags) {
43363             fixes.push(makeConnectWaysFix(this.data.connectionTags));
43364             let lessLikelyConnectionTags = tagsForConnectionNodeIfAllowed(entities[0], entities[1], graph, true);
43365             if (lessLikelyConnectionTags && !(0, import_lodash3.isEqual)(connectionTags, lessLikelyConnectionTags)) {
43366               fixes.push(makeConnectWaysFix(lessLikelyConnectionTags));
43367             }
43368           }
43369           if (isCrossingIndoors) {
43370             fixes.push(new validationIssueFix({
43371               icon: "iD-icon-layers",
43372               title: _t.append("issues.fix.use_different_levels.title")
43373             }));
43374           } else if (isCrossingTunnels || isCrossingBridges || featureType1 === "building" || featureType2 === "building") {
43375             fixes.push(makeChangeLayerFix("higher"));
43376             fixes.push(makeChangeLayerFix("lower"));
43377           } else if (context2.graph().geometry(this.entityIds[0]) === "line" && context2.graph().geometry(this.entityIds[1]) === "line") {
43378             if (allowsBridge(selectedFeatureType) && selectedFeatureType !== "waterway") {
43379               fixes.push(makeAddBridgeOrTunnelFix("add_a_bridge", "temaki-bridge", "bridge"));
43380             }
43381             var skipTunnelFix = otherFeatureType === "waterway" && selectedFeatureType !== "waterway";
43382             if (allowsTunnel(selectedFeatureType) && !skipTunnelFix) {
43383               fixes.push(makeAddBridgeOrTunnelFix("add_a_tunnel", "temaki-tunnel", "tunnel"));
43384             }
43385           }
43386           fixes.push(new validationIssueFix({
43387             icon: "iD-operation-move",
43388             title: _t.append("issues.fix.reposition_features.title")
43389           }));
43390           return fixes;
43391         }
43392       });
43393       function showReference(selection2) {
43394         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.crossing_ways." + crossingTypeID + ".reference"));
43395       }
43396     }
43397     function makeAddBridgeOrTunnelFix(fixTitleID, iconName, bridgeOrTunnel) {
43398       return new validationIssueFix({
43399         icon: iconName,
43400         title: _t.append("issues.fix." + fixTitleID + ".title"),
43401         onClick: function(context2) {
43402           var mode = context2.mode();
43403           if (!mode || mode.id !== "select") return;
43404           var selectedIDs = mode.selectedIDs();
43405           if (selectedIDs.length !== 1) return;
43406           var selectedWayID = selectedIDs[0];
43407           if (!context2.hasEntity(selectedWayID)) return;
43408           var resultWayIDs = [selectedWayID];
43409           var edge, crossedEdge, crossedWayID;
43410           if (this.issue.entityIds[0] === selectedWayID) {
43411             edge = this.issue.data.edges[0];
43412             crossedEdge = this.issue.data.edges[1];
43413             crossedWayID = this.issue.entityIds[1];
43414           } else {
43415             edge = this.issue.data.edges[1];
43416             crossedEdge = this.issue.data.edges[0];
43417             crossedWayID = this.issue.entityIds[0];
43418           }
43419           var crossingLoc = this.issue.loc;
43420           var projection2 = context2.projection;
43421           var action = function actionAddStructure(graph) {
43422             var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
43423             var crossedWay = graph.hasEntity(crossedWayID);
43424             var structLengthMeters = crossedWay && isFinite(crossedWay.tags.width) && Number(crossedWay.tags.width);
43425             if (!structLengthMeters) {
43426               structLengthMeters = crossedWay && crossedWay.impliedLineWidthMeters();
43427             }
43428             if (structLengthMeters) {
43429               if (getFeatureType(crossedWay, graph) === "railway") {
43430                 structLengthMeters *= 2;
43431               }
43432             } else {
43433               structLengthMeters = 8;
43434             }
43435             var a1 = geoAngle(edgeNodes[0], edgeNodes[1], projection2) + Math.PI;
43436             var a2 = geoAngle(graph.entity(crossedEdge[0]), graph.entity(crossedEdge[1]), projection2) + Math.PI;
43437             var crossingAngle = Math.max(a1, a2) - Math.min(a1, a2);
43438             if (crossingAngle > Math.PI) crossingAngle -= Math.PI;
43439             structLengthMeters = structLengthMeters / 2 / Math.sin(crossingAngle) * 2;
43440             structLengthMeters += 4;
43441             structLengthMeters = Math.min(Math.max(structLengthMeters, 4), 50);
43442             function geomToProj(geoPoint) {
43443               return [
43444                 geoLonToMeters(geoPoint[0], geoPoint[1]),
43445                 geoLatToMeters(geoPoint[1])
43446               ];
43447             }
43448             function projToGeom(projPoint) {
43449               var lat = geoMetersToLat(projPoint[1]);
43450               return [
43451                 geoMetersToLon(projPoint[0], lat),
43452                 lat
43453               ];
43454             }
43455             var projEdgeNode1 = geomToProj(edgeNodes[0].loc);
43456             var projEdgeNode2 = geomToProj(edgeNodes[1].loc);
43457             var projectedAngle = geoVecAngle(projEdgeNode1, projEdgeNode2);
43458             var projectedCrossingLoc = geomToProj(crossingLoc);
43459             var linearToSphericalMetersRatio = geoVecLength(projEdgeNode1, projEdgeNode2) / geoSphericalDistance(edgeNodes[0].loc, edgeNodes[1].loc);
43460             function locSphericalDistanceFromCrossingLoc(angle2, distanceMeters) {
43461               var lengthSphericalMeters = distanceMeters * linearToSphericalMetersRatio;
43462               return projToGeom([
43463                 projectedCrossingLoc[0] + Math.cos(angle2) * lengthSphericalMeters,
43464                 projectedCrossingLoc[1] + Math.sin(angle2) * lengthSphericalMeters
43465               ]);
43466             }
43467             var endpointLocGetter1 = function(lengthMeters) {
43468               return locSphericalDistanceFromCrossingLoc(projectedAngle, lengthMeters);
43469             };
43470             var endpointLocGetter2 = function(lengthMeters) {
43471               return locSphericalDistanceFromCrossingLoc(projectedAngle + Math.PI, lengthMeters);
43472             };
43473             var minEdgeLengthMeters = 0.55;
43474             function determineEndpoint(edge2, endNode, locGetter) {
43475               var newNode;
43476               var idealLengthMeters = structLengthMeters / 2;
43477               var crossingToEdgeEndDistance = geoSphericalDistance(crossingLoc, endNode.loc);
43478               if (crossingToEdgeEndDistance - idealLengthMeters > minEdgeLengthMeters) {
43479                 var idealNodeLoc = locGetter(idealLengthMeters);
43480                 newNode = osmNode();
43481                 graph = actionAddMidpoint({ loc: idealNodeLoc, edge: edge2 }, newNode)(graph);
43482               } else {
43483                 var edgeCount = 0;
43484                 endNode.parentIntersectionWays(graph).forEach(function(way) {
43485                   way.nodes.forEach(function(nodeID) {
43486                     if (nodeID === endNode.id) {
43487                       if (endNode.id === way.first() && endNode.id !== way.last() || endNode.id === way.last() && endNode.id !== way.first()) {
43488                         edgeCount += 1;
43489                       } else {
43490                         edgeCount += 2;
43491                       }
43492                     }
43493                   });
43494                 });
43495                 if (edgeCount >= 3) {
43496                   var insetLength = crossingToEdgeEndDistance - minEdgeLengthMeters;
43497                   if (insetLength > minEdgeLengthMeters) {
43498                     var insetNodeLoc = locGetter(insetLength);
43499                     newNode = osmNode();
43500                     graph = actionAddMidpoint({ loc: insetNodeLoc, edge: edge2 }, newNode)(graph);
43501                   }
43502                 }
43503               }
43504               if (!newNode) newNode = endNode;
43505               var splitAction = actionSplit([newNode.id]).limitWays(resultWayIDs);
43506               graph = splitAction(graph);
43507               if (splitAction.getCreatedWayIDs().length) {
43508                 resultWayIDs.push(splitAction.getCreatedWayIDs()[0]);
43509               }
43510               return newNode;
43511             }
43512             var structEndNode1 = determineEndpoint(edge, edgeNodes[1], endpointLocGetter1);
43513             var structEndNode2 = determineEndpoint([edgeNodes[0].id, structEndNode1.id], edgeNodes[0], endpointLocGetter2);
43514             var structureWay = resultWayIDs.map(function(id2) {
43515               return graph.entity(id2);
43516             }).find(function(way) {
43517               return way.nodes.indexOf(structEndNode1.id) !== -1 && way.nodes.indexOf(structEndNode2.id) !== -1;
43518             });
43519             var tags = Object.assign({}, structureWay.tags);
43520             if (bridgeOrTunnel === "bridge") {
43521               tags.bridge = "yes";
43522               tags.layer = "1";
43523             } else {
43524               var tunnelValue = "yes";
43525               if (getFeatureType(structureWay, graph) === "waterway") {
43526                 tunnelValue = "culvert";
43527               }
43528               tags.tunnel = tunnelValue;
43529               tags.layer = "-1";
43530             }
43531             graph = actionChangeTags(structureWay.id, tags)(graph);
43532             return graph;
43533           };
43534           context2.perform(action, _t("issues.fix." + fixTitleID + ".annotation"));
43535           context2.enter(modeSelect(context2, resultWayIDs));
43536         }
43537       });
43538     }
43539     function makeConnectWaysFix(connectionTags) {
43540       var fixTitleID = "connect_features";
43541       var fixIcon = "iD-icon-crossing";
43542       if (connectionTags.highway === "crossing") {
43543         fixTitleID = "connect_using_crossing";
43544         fixIcon = "temaki-pedestrian";
43545       }
43546       if (connectionTags.ford) {
43547         fixTitleID = "connect_using_ford";
43548         fixIcon = "roentgen-ford";
43549       }
43550       const fix = new validationIssueFix({
43551         icon: fixIcon,
43552         title: _t.append("issues.fix." + fixTitleID + ".title"),
43553         onClick: function(context2) {
43554           var loc = this.issue.loc;
43555           var edges = this.issue.data.edges;
43556           context2.perform(
43557             function actionConnectCrossingWays(graph) {
43558               var node = osmNode({ loc, tags: connectionTags });
43559               graph = graph.replace(node);
43560               var nodesToMerge = [node.id];
43561               var mergeThresholdInMeters = 0.75;
43562               edges.forEach(function(edge) {
43563                 var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
43564                 var nearby = geoSphericalClosestNode(edgeNodes, loc);
43565                 if ((!nearby.node.hasInterestingTags() || nearby.node.isCrossing()) && nearby.distance < mergeThresholdInMeters) {
43566                   nodesToMerge.push(nearby.node.id);
43567                 } else {
43568                   graph = actionAddMidpoint({ loc, edge }, node)(graph);
43569                 }
43570               });
43571               if (nodesToMerge.length > 1) {
43572                 graph = actionMergeNodes(nodesToMerge, loc)(graph);
43573               }
43574               return graph;
43575             },
43576             _t("issues.fix.connect_crossing_features.annotation")
43577           );
43578         }
43579       });
43580       fix._connectionTags = connectionTags;
43581       return fix;
43582     }
43583     function makeChangeLayerFix(higherOrLower) {
43584       return new validationIssueFix({
43585         icon: "iD-icon-" + (higherOrLower === "higher" ? "up" : "down"),
43586         title: _t.append("issues.fix.tag_this_as_" + higherOrLower + ".title"),
43587         onClick: function(context2) {
43588           var mode = context2.mode();
43589           if (!mode || mode.id !== "select") return;
43590           var selectedIDs = mode.selectedIDs();
43591           if (selectedIDs.length !== 1) return;
43592           var selectedID = selectedIDs[0];
43593           if (!this.issue.entityIds.some(function(entityId) {
43594             return entityId === selectedID;
43595           })) return;
43596           var entity = context2.hasEntity(selectedID);
43597           if (!entity) return;
43598           var tags = Object.assign({}, entity.tags);
43599           var layer = tags.layer && Number(tags.layer);
43600           if (layer && !isNaN(layer)) {
43601             if (higherOrLower === "higher") {
43602               layer += 1;
43603             } else {
43604               layer -= 1;
43605             }
43606           } else {
43607             if (higherOrLower === "higher") {
43608               layer = 1;
43609             } else {
43610               layer = -1;
43611             }
43612           }
43613           tags.layer = layer.toString();
43614           context2.perform(
43615             actionChangeTags(entity.id, tags),
43616             _t("operations.change_tags.annotation")
43617           );
43618         }
43619       });
43620     }
43621     validation.type = type2;
43622     return validation;
43623   }
43624
43625   // modules/behavior/draw_way.js
43626   function behaviorDrawWay(context, wayID, mode, startGraph) {
43627     const keybinding = utilKeybinding("drawWay");
43628     var dispatch14 = dispatch_default("rejectedSelfIntersection");
43629     var behavior = behaviorDraw(context);
43630     var _nodeIndex;
43631     var _origWay;
43632     var _wayGeometry;
43633     var _headNodeID;
43634     var _annotation;
43635     var _pointerHasMoved = false;
43636     var _drawNode;
43637     var _didResolveTempEdit = false;
43638     function createDrawNode(loc) {
43639       _drawNode = osmNode({ loc });
43640       context.pauseChangeDispatch();
43641       context.replace(function actionAddDrawNode(graph) {
43642         var way = graph.entity(wayID);
43643         return graph.replace(_drawNode).replace(way.addNode(_drawNode.id, _nodeIndex));
43644       }, _annotation);
43645       context.resumeChangeDispatch();
43646       setActiveElements();
43647     }
43648     function removeDrawNode() {
43649       context.pauseChangeDispatch();
43650       context.replace(
43651         function actionDeleteDrawNode(graph) {
43652           var way = graph.entity(wayID);
43653           return graph.replace(way.removeNode(_drawNode.id)).remove(_drawNode);
43654         },
43655         _annotation
43656       );
43657       _drawNode = void 0;
43658       context.resumeChangeDispatch();
43659     }
43660     function keydown(d3_event) {
43661       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
43662         if (context.surface().classed("nope")) {
43663           context.surface().classed("nope-suppressed", true);
43664         }
43665         context.surface().classed("nope", false).classed("nope-disabled", true);
43666       }
43667     }
43668     function keyup(d3_event) {
43669       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
43670         if (context.surface().classed("nope-suppressed")) {
43671           context.surface().classed("nope", true);
43672         }
43673         context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
43674       }
43675     }
43676     function allowsVertex(d2) {
43677       return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
43678     }
43679     function move(d3_event, datum2) {
43680       var loc = context.map().mouseCoordinates();
43681       if (!_drawNode) createDrawNode(loc);
43682       context.surface().classed("nope-disabled", d3_event.altKey);
43683       var targetLoc = datum2 && datum2.properties && datum2.properties.entity && allowsVertex(datum2.properties.entity) && datum2.properties.entity.loc;
43684       var targetNodes = datum2 && datum2.properties && datum2.properties.nodes;
43685       if (targetLoc) {
43686         loc = targetLoc;
43687       } else if (targetNodes) {
43688         var choice = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, _drawNode.id);
43689         if (choice) {
43690           loc = choice.loc;
43691         }
43692       }
43693       context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
43694       _drawNode = context.entity(_drawNode.id);
43695       checkGeometry(
43696         true
43697         /* includeDrawNode */
43698       );
43699     }
43700     function checkGeometry(includeDrawNode) {
43701       var nopeDisabled = context.surface().classed("nope-disabled");
43702       var isInvalid = isInvalidGeometry(includeDrawNode);
43703       if (nopeDisabled) {
43704         context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
43705       } else {
43706         context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
43707       }
43708     }
43709     function isInvalidGeometry(includeDrawNode) {
43710       var testNode = _drawNode;
43711       var parentWay = context.graph().entity(wayID);
43712       var nodes = context.graph().childNodes(parentWay).slice();
43713       if (includeDrawNode) {
43714         if (parentWay.isClosed()) {
43715           nodes.pop();
43716         }
43717       } else {
43718         if (parentWay.isClosed()) {
43719           if (nodes.length < 3) return false;
43720           if (_drawNode) nodes.splice(-2, 1);
43721           testNode = nodes[nodes.length - 2];
43722         } else {
43723           return false;
43724         }
43725       }
43726       return testNode && geoHasSelfIntersections(nodes, testNode.id);
43727     }
43728     function undone() {
43729       _didResolveTempEdit = true;
43730       context.pauseChangeDispatch();
43731       var nextMode;
43732       if (context.graph() === startGraph) {
43733         nextMode = modeSelect(context, [wayID]);
43734       } else {
43735         context.pop(1);
43736         nextMode = mode;
43737       }
43738       context.perform(actionNoop());
43739       context.pop(1);
43740       context.resumeChangeDispatch();
43741       context.enter(nextMode);
43742     }
43743     function setActiveElements() {
43744       if (!_drawNode) return;
43745       context.surface().selectAll("." + _drawNode.id).classed("active", true);
43746     }
43747     function resetToStartGraph() {
43748       while (context.graph() !== startGraph) {
43749         context.pop();
43750       }
43751     }
43752     var drawWay = function(surface) {
43753       _drawNode = void 0;
43754       _didResolveTempEdit = false;
43755       _origWay = context.entity(wayID);
43756       if (typeof _nodeIndex === "number") {
43757         _headNodeID = _origWay.nodes[_nodeIndex];
43758       } else if (_origWay.isClosed()) {
43759         _headNodeID = _origWay.nodes[_origWay.nodes.length - 2];
43760       } else {
43761         _headNodeID = _origWay.nodes[_origWay.nodes.length - 1];
43762       }
43763       _wayGeometry = _origWay.geometry(context.graph());
43764       _annotation = _t(
43765         (_origWay.nodes.length === (_origWay.isClosed() ? 2 : 1) ? "operations.start.annotation." : "operations.continue.annotation.") + _wayGeometry
43766       );
43767       _pointerHasMoved = false;
43768       context.pauseChangeDispatch();
43769       context.perform(actionNoop(), _annotation);
43770       context.resumeChangeDispatch();
43771       behavior.hover().initialNodeID(_headNodeID);
43772       behavior.on("move", function() {
43773         _pointerHasMoved = true;
43774         move.apply(this, arguments);
43775       }).on("down", function() {
43776         move.apply(this, arguments);
43777       }).on("downcancel", function() {
43778         if (_drawNode) removeDrawNode();
43779       }).on("click", drawWay.add).on("clickWay", drawWay.addWay).on("clickNode", drawWay.addNode).on("undo", context.undo).on("cancel", drawWay.cancel).on("finish", drawWay.finish);
43780       select_default2(window).on("keydown.drawWay", keydown).on("keyup.drawWay", keyup);
43781       context.map().dblclickZoomEnable(false).on("drawn.draw", setActiveElements);
43782       setActiveElements();
43783       surface.call(behavior);
43784       context.history().on("undone.draw", undone);
43785     };
43786     drawWay.off = function(surface) {
43787       if (!_didResolveTempEdit) {
43788         context.pauseChangeDispatch();
43789         resetToStartGraph();
43790         context.resumeChangeDispatch();
43791       }
43792       _drawNode = void 0;
43793       _nodeIndex = void 0;
43794       context.map().on("drawn.draw", null);
43795       surface.call(behavior.off).selectAll(".active").classed("active", false);
43796       surface.classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false);
43797       select_default2(window).on("keydown.drawWay", null).on("keyup.drawWay", null);
43798       context.history().on("undone.draw", null);
43799     };
43800     function attemptAdd(d2, loc, doAdd) {
43801       if (_drawNode) {
43802         context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
43803         _drawNode = context.entity(_drawNode.id);
43804       } else {
43805         createDrawNode(loc);
43806       }
43807       checkGeometry(
43808         true
43809         /* includeDrawNode */
43810       );
43811       if (d2 && d2.properties && d2.properties.nope || context.surface().classed("nope")) {
43812         if (!_pointerHasMoved) {
43813           removeDrawNode();
43814         }
43815         dispatch14.call("rejectedSelfIntersection", this);
43816         return;
43817       }
43818       context.pauseChangeDispatch();
43819       doAdd();
43820       _didResolveTempEdit = true;
43821       context.resumeChangeDispatch();
43822       context.enter(mode);
43823     }
43824     drawWay.add = function(loc, d2) {
43825       attemptAdd(d2, loc, function() {
43826       });
43827     };
43828     drawWay.addWay = function(loc, edge, d2) {
43829       attemptAdd(d2, loc, function() {
43830         context.replace(
43831           actionAddMidpoint({ loc, edge }, _drawNode),
43832           _annotation
43833         );
43834       });
43835     };
43836     drawWay.addNode = function(node, d2) {
43837       if (node.id === _headNodeID || // or the first node when drawing an area
43838       _origWay.isClosed() && node.id === _origWay.first()) {
43839         drawWay.finish();
43840         return;
43841       }
43842       attemptAdd(d2, node.loc, function() {
43843         context.replace(
43844           function actionReplaceDrawNode(graph) {
43845             graph = graph.replace(graph.entity(wayID).removeNode(_drawNode.id)).remove(_drawNode);
43846             return graph.replace(graph.entity(wayID).addNode(node.id, _nodeIndex));
43847           },
43848           _annotation
43849         );
43850       });
43851     };
43852     function getFeatureType(ways) {
43853       if (ways.every((way) => way.isClosed())) return "area";
43854       if (ways.every((way) => !way.isClosed())) return "line";
43855       return "generic";
43856     }
43857     function followMode() {
43858       if (_didResolveTempEdit) return;
43859       try {
43860         const isDrawingArea = _origWay.nodes[0] === _origWay.nodes.slice(-1)[0];
43861         const [secondLastNodeId, lastNodeId] = _origWay.nodes.slice(isDrawingArea ? -3 : -2);
43862         const historyGraph = context.history().graph();
43863         if (!lastNodeId || !secondLastNodeId || !historyGraph.hasEntity(lastNodeId) || !historyGraph.hasEntity(secondLastNodeId)) {
43864           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.needs_more_initial_nodes"))();
43865           return;
43866         }
43867         const lastNodesParents = historyGraph.parentWays(historyGraph.entity(lastNodeId)).filter((w2) => w2.id !== wayID);
43868         const secondLastNodesParents = historyGraph.parentWays(historyGraph.entity(secondLastNodeId)).filter((w2) => w2.id !== wayID);
43869         const featureType = getFeatureType(lastNodesParents);
43870         if (lastNodesParents.length !== 1 || secondLastNodesParents.length === 0) {
43871           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.intersection_of_multiple_ways.".concat(featureType)))();
43872           return;
43873         }
43874         if (!secondLastNodesParents.some((n3) => n3.id === lastNodesParents[0].id)) {
43875           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.intersection_of_different_ways.".concat(featureType)))();
43876           return;
43877         }
43878         const way = lastNodesParents[0];
43879         const indexOfLast = way.nodes.indexOf(lastNodeId);
43880         const indexOfSecondLast = way.nodes.indexOf(secondLastNodeId);
43881         const isDescendingPastZero = indexOfLast === way.nodes.length - 2 && indexOfSecondLast === 0;
43882         let nextNodeIndex = indexOfLast + (indexOfLast > indexOfSecondLast && !isDescendingPastZero ? 1 : -1);
43883         if (nextNodeIndex === -1) nextNodeIndex = indexOfSecondLast === 1 ? way.nodes.length - 2 : 1;
43884         const nextNode = historyGraph.entity(way.nodes[nextNodeIndex]);
43885         drawWay.addNode(nextNode, {
43886           geometry: { type: "Point", coordinates: nextNode.loc },
43887           id: nextNode.id,
43888           properties: { target: true, entity: nextNode }
43889         });
43890       } catch {
43891         context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.unknown"))();
43892       }
43893     }
43894     keybinding.on(_t("operations.follow.key"), followMode);
43895     select_default2(document).call(keybinding);
43896     drawWay.finish = function() {
43897       checkGeometry(
43898         false
43899         /* includeDrawNode */
43900       );
43901       if (context.surface().classed("nope")) {
43902         dispatch14.call("rejectedSelfIntersection", this);
43903         return;
43904       }
43905       context.pauseChangeDispatch();
43906       context.pop(1);
43907       _didResolveTempEdit = true;
43908       context.resumeChangeDispatch();
43909       var way = context.hasEntity(wayID);
43910       if (!way || way.isDegenerate()) {
43911         drawWay.cancel();
43912         return;
43913       }
43914       window.setTimeout(function() {
43915         context.map().dblclickZoomEnable(true);
43916       }, 1e3);
43917       var isNewFeature = !mode.isContinuing;
43918       context.enter(modeSelect(context, [wayID]).newFeature(isNewFeature));
43919     };
43920     drawWay.cancel = function() {
43921       context.pauseChangeDispatch();
43922       resetToStartGraph();
43923       context.resumeChangeDispatch();
43924       window.setTimeout(function() {
43925         context.map().dblclickZoomEnable(true);
43926       }, 1e3);
43927       context.surface().classed("nope", false).classed("nope-disabled", false).classed("nope-suppressed", false);
43928       context.enter(modeBrowse(context));
43929     };
43930     drawWay.nodeIndex = function(val) {
43931       if (!arguments.length) return _nodeIndex;
43932       _nodeIndex = val;
43933       return drawWay;
43934     };
43935     drawWay.activeID = function() {
43936       if (!arguments.length) return _drawNode && _drawNode.id;
43937       return drawWay;
43938     };
43939     return utilRebind(drawWay, dispatch14, "on");
43940   }
43941
43942   // modules/modes/draw_line.js
43943   function modeDrawLine(context, wayID, startGraph, button, affix, continuing) {
43944     var mode = {
43945       button,
43946       id: "draw-line"
43947     };
43948     var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawLine", function() {
43949       context.ui().flash.iconName("#iD-icon-no").label(_t.append("self_intersection.error.lines"))();
43950     });
43951     mode.wayID = wayID;
43952     mode.isContinuing = continuing;
43953     mode.enter = function() {
43954       behavior.nodeIndex(affix === "prefix" ? 0 : void 0);
43955       context.install(behavior);
43956     };
43957     mode.exit = function() {
43958       context.uninstall(behavior);
43959     };
43960     mode.selectedIDs = function() {
43961       return [wayID];
43962     };
43963     mode.activeID = function() {
43964       return behavior && behavior.activeID() || [];
43965     };
43966     return mode;
43967   }
43968
43969   // modules/validations/disconnected_way.js
43970   function validationDisconnectedWay() {
43971     var type2 = "disconnected_way";
43972     function isTaggedAsHighway(entity) {
43973       return osmRoutableHighwayTagValues[entity.tags.highway];
43974     }
43975     var validation = function checkDisconnectedWay(entity, graph) {
43976       var routingIslandWays = routingIslandForEntity(entity);
43977       if (!routingIslandWays) return [];
43978       return [new validationIssue({
43979         type: type2,
43980         subtype: "highway",
43981         severity: "warning",
43982         message: function(context) {
43983           var entity2 = this.entityIds.length && context.hasEntity(this.entityIds[0]);
43984           var label = entity2 && utilDisplayLabel(entity2, context.graph());
43985           return _t.append("issues.disconnected_way.routable.message", { count: this.entityIds.length, highway: label });
43986         },
43987         reference: showReference,
43988         entityIds: Array.from(routingIslandWays).map(function(way) {
43989           return way.id;
43990         }),
43991         dynamicFixes: makeFixes
43992       })];
43993       function makeFixes(context) {
43994         var fixes = [];
43995         var singleEntity = this.entityIds.length === 1 && context.hasEntity(this.entityIds[0]);
43996         if (singleEntity) {
43997           if (singleEntity.type === "way" && !singleEntity.isClosed()) {
43998             var textDirection = _mainLocalizer.textDirection();
43999             var startFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.first(), "start");
44000             if (startFix) fixes.push(startFix);
44001             var endFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.last(), "end");
44002             if (endFix) fixes.push(endFix);
44003           }
44004           if (!fixes.length) {
44005             fixes.push(new validationIssueFix({
44006               title: _t.append("issues.fix.connect_feature.title")
44007             }));
44008           }
44009           fixes.push(new validationIssueFix({
44010             icon: "iD-operation-delete",
44011             title: _t.append("issues.fix.delete_feature.title"),
44012             entityIds: [singleEntity.id],
44013             onClick: function(context2) {
44014               var id2 = this.issue.entityIds[0];
44015               var operation2 = operationDelete(context2, [id2]);
44016               if (!operation2.disabled()) {
44017                 operation2();
44018               }
44019             }
44020           }));
44021         } else {
44022           fixes.push(new validationIssueFix({
44023             title: _t.append("issues.fix.connect_features.title")
44024           }));
44025         }
44026         return fixes;
44027       }
44028       function showReference(selection2) {
44029         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.disconnected_way.routable.reference"));
44030       }
44031       function routingIslandForEntity(entity2) {
44032         var routingIsland = /* @__PURE__ */ new Set();
44033         var waysToCheck = [];
44034         function queueParentWays(node) {
44035           graph.parentWays(node).forEach(function(parentWay) {
44036             if (!routingIsland.has(parentWay) && // only check each feature once
44037             isRoutableWay(parentWay, false)) {
44038               routingIsland.add(parentWay);
44039               waysToCheck.push(parentWay);
44040             }
44041           });
44042         }
44043         if (entity2.type === "way" && isRoutableWay(entity2, true)) {
44044           routingIsland.add(entity2);
44045           waysToCheck.push(entity2);
44046         } else if (entity2.type === "node" && isRoutableNode(entity2)) {
44047           routingIsland.add(entity2);
44048           queueParentWays(entity2);
44049         } else {
44050           return null;
44051         }
44052         while (waysToCheck.length) {
44053           var wayToCheck = waysToCheck.pop();
44054           var childNodes = graph.childNodes(wayToCheck);
44055           for (var i3 in childNodes) {
44056             var vertex = childNodes[i3];
44057             if (isConnectedVertex(vertex)) {
44058               return null;
44059             }
44060             if (isRoutableNode(vertex)) {
44061               routingIsland.add(vertex);
44062             }
44063             queueParentWays(vertex);
44064           }
44065         }
44066         return routingIsland;
44067       }
44068       function isConnectedVertex(vertex) {
44069         var osm = services.osm;
44070         if (osm && !osm.isDataLoaded(vertex.loc)) return true;
44071         if (vertex.tags.entrance && vertex.tags.entrance !== "no") return true;
44072         if (vertex.tags.amenity === "parking_entrance") return true;
44073         return false;
44074       }
44075       function isRoutableNode(node) {
44076         if (node.tags.highway === "elevator") return true;
44077         return false;
44078       }
44079       function isRoutableWay(way, ignoreInnerWays) {
44080         if (isTaggedAsHighway(way) || way.tags.route === "ferry") return true;
44081         return graph.parentRelations(way).some(function(parentRelation) {
44082           if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry") return true;
44083           if (parentRelation.isMultipolygon() && isTaggedAsHighway(parentRelation) && (!ignoreInnerWays || parentRelation.memberById(way.id).role !== "inner")) return true;
44084           return false;
44085         });
44086       }
44087       function makeContinueDrawingFixIfAllowed(textDirection, vertexID, whichEnd) {
44088         var vertex = graph.hasEntity(vertexID);
44089         if (!vertex || vertex.tags.noexit === "yes") return null;
44090         var useLeftContinue = whichEnd === "start" && textDirection === "ltr" || whichEnd === "end" && textDirection === "rtl";
44091         return new validationIssueFix({
44092           icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
44093           title: _t.append("issues.fix.continue_from_" + whichEnd + ".title"),
44094           entityIds: [vertexID],
44095           onClick: function(context) {
44096             var wayId = this.issue.entityIds[0];
44097             var way = context.hasEntity(wayId);
44098             var vertexId = this.entityIds[0];
44099             var vertex2 = context.hasEntity(vertexId);
44100             if (!way || !vertex2) return;
44101             var map2 = context.map();
44102             if (!context.editable() || !map2.trimmedExtent().contains(vertex2.loc)) {
44103               map2.zoomToEase(vertex2);
44104             }
44105             context.enter(
44106               modeDrawLine(context, wayId, context.graph(), "line", way.affix(vertexId), true)
44107             );
44108           }
44109         });
44110       }
44111     };
44112     validation.type = type2;
44113     return validation;
44114   }
44115
44116   // modules/validations/invalid_format.js
44117   function validationFormatting() {
44118     var type2 = "invalid_format";
44119     var validation = function(entity) {
44120       var issues = [];
44121       function isValidEmail(email) {
44122         var valid_email = /^[^\(\)\\,":;<>@\[\]]+@[^\(\)\\,":;<>@\[\]\.]+(?:\.[a-z0-9-]+)*$/i;
44123         return !email || valid_email.test(email);
44124       }
44125       function showReferenceEmail(selection2) {
44126         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.invalid_format.email.reference"));
44127       }
44128       if (entity.tags.email) {
44129         var emails = entity.tags.email.split(";").map(function(s2) {
44130           return s2.trim();
44131         }).filter(function(x2) {
44132           return !isValidEmail(x2);
44133         });
44134         if (emails.length) {
44135           issues.push(new validationIssue({
44136             type: type2,
44137             subtype: "email",
44138             severity: "warning",
44139             message: function(context) {
44140               var entity2 = context.hasEntity(this.entityIds[0]);
44141               return entity2 ? _t.append(
44142                 "issues.invalid_format.email.message" + this.data,
44143                 { feature: utilDisplayLabel(entity2, context.graph()), email: emails.join(", ") }
44144               ) : "";
44145             },
44146             reference: showReferenceEmail,
44147             entityIds: [entity.id],
44148             hash: emails.join(),
44149             data: emails.length > 1 ? "_multi" : ""
44150           }));
44151         }
44152       }
44153       return issues;
44154     };
44155     validation.type = type2;
44156     return validation;
44157   }
44158
44159   // modules/validations/help_request.js
44160   function validationHelpRequest(context) {
44161     var type2 = "help_request";
44162     var validation = function checkFixmeTag(entity) {
44163       if (!entity.tags.fixme) return [];
44164       if (entity.version === void 0) return [];
44165       if (entity.v !== void 0) {
44166         var baseEntity = context.history().base().hasEntity(entity.id);
44167         if (!baseEntity || !baseEntity.tags.fixme) return [];
44168       }
44169       return [new validationIssue({
44170         type: type2,
44171         subtype: "fixme_tag",
44172         severity: "warning",
44173         message: function(context2) {
44174           var entity2 = context2.hasEntity(this.entityIds[0]);
44175           return entity2 ? _t.append("issues.fixme_tag.message", {
44176             feature: utilDisplayLabel(
44177               entity2,
44178               context2.graph(),
44179               true
44180               /* verbose */
44181             )
44182           }) : "";
44183         },
44184         dynamicFixes: function() {
44185           return [
44186             new validationIssueFix({
44187               title: _t.append("issues.fix.address_the_concern.title")
44188             })
44189           ];
44190         },
44191         reference: showReference,
44192         entityIds: [entity.id]
44193       })];
44194       function showReference(selection2) {
44195         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.fixme_tag.reference"));
44196       }
44197     };
44198     validation.type = type2;
44199     return validation;
44200   }
44201
44202   // modules/validations/impossible_oneway.js
44203   function validationImpossibleOneway() {
44204     var type2 = "impossible_oneway";
44205     var validation = function checkImpossibleOneway(entity, graph) {
44206       if (entity.type !== "way" || entity.geometry(graph) !== "line") return [];
44207       if (entity.isClosed()) return [];
44208       if (!typeForWay(entity)) return [];
44209       if (!isOneway(entity)) return [];
44210       var firstIssues = issuesForNode(entity, entity.first());
44211       var lastIssues = issuesForNode(entity, entity.last());
44212       return firstIssues.concat(lastIssues);
44213       function typeForWay(way) {
44214         if (way.geometry(graph) !== "line") return null;
44215         if (osmRoutableHighwayTagValues[way.tags.highway]) return "highway";
44216         if (osmFlowingWaterwayTagValues[way.tags.waterway]) return "waterway";
44217         return null;
44218       }
44219       function isOneway(way) {
44220         if (way.tags.oneway === "yes") return true;
44221         if (way.tags.oneway) return false;
44222         for (var key in way.tags) {
44223           if (osmOneWayTags[key] && osmOneWayTags[key][way.tags[key]]) {
44224             return true;
44225           }
44226         }
44227         return false;
44228       }
44229       function nodeOccursMoreThanOnce(way, nodeID) {
44230         var occurrences = 0;
44231         for (var index in way.nodes) {
44232           if (way.nodes[index] === nodeID) {
44233             occurrences += 1;
44234             if (occurrences > 1) return true;
44235           }
44236         }
44237         return false;
44238       }
44239       function isConnectedViaOtherTypes(way, node) {
44240         var wayType = typeForWay(way);
44241         if (wayType === "highway") {
44242           if (node.tags.entrance && node.tags.entrance !== "no") return true;
44243           if (node.tags.amenity === "parking_entrance") return true;
44244         } else if (wayType === "waterway") {
44245           if (node.id === way.first()) {
44246             if (node.tags.natural === "spring") return true;
44247           } else {
44248             if (node.tags.manhole === "drain") return true;
44249           }
44250         }
44251         return graph.parentWays(node).some(function(parentWay) {
44252           if (parentWay.id === way.id) return false;
44253           if (wayType === "highway") {
44254             if (parentWay.geometry(graph) === "area" && osmRoutableHighwayTagValues[parentWay.tags.highway]) return true;
44255             if (parentWay.tags.route === "ferry") return true;
44256             return graph.parentRelations(parentWay).some(function(parentRelation) {
44257               if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry") return true;
44258               return parentRelation.isMultipolygon() && osmRoutableHighwayTagValues[parentRelation.tags.highway];
44259             });
44260           } else if (wayType === "waterway") {
44261             if (parentWay.tags.natural === "water" || parentWay.tags.natural === "coastline") return true;
44262           }
44263           return false;
44264         });
44265       }
44266       function issuesForNode(way, nodeID) {
44267         var isFirst = nodeID === way.first();
44268         var wayType = typeForWay(way);
44269         if (nodeOccursMoreThanOnce(way, nodeID)) return [];
44270         var osm = services.osm;
44271         if (!osm) return [];
44272         var node = graph.hasEntity(nodeID);
44273         if (!node || !osm.isDataLoaded(node.loc)) return [];
44274         if (isConnectedViaOtherTypes(way, node)) return [];
44275         var attachedWaysOfSameType = graph.parentWays(node).filter(function(parentWay) {
44276           if (parentWay.id === way.id) return false;
44277           return typeForWay(parentWay) === wayType;
44278         });
44279         if (wayType === "waterway" && attachedWaysOfSameType.length === 0) return [];
44280         var attachedOneways = attachedWaysOfSameType.filter(function(attachedWay) {
44281           return isOneway(attachedWay);
44282         });
44283         if (attachedOneways.length < attachedWaysOfSameType.length) return [];
44284         if (attachedOneways.length) {
44285           var connectedEndpointsOkay = attachedOneways.some(function(attachedOneway) {
44286             if ((isFirst ? attachedOneway.first() : attachedOneway.last()) !== nodeID) return true;
44287             if (nodeOccursMoreThanOnce(attachedOneway, nodeID)) return true;
44288             return false;
44289           });
44290           if (connectedEndpointsOkay) return [];
44291         }
44292         var placement = isFirst ? "start" : "end", messageID = wayType + ".", referenceID = wayType + ".";
44293         if (wayType === "waterway") {
44294           messageID += "connected." + placement;
44295           referenceID += "connected";
44296         } else {
44297           messageID += placement;
44298           referenceID += placement;
44299         }
44300         return [new validationIssue({
44301           type: type2,
44302           subtype: wayType,
44303           severity: "warning",
44304           message: function(context) {
44305             var entity2 = context.hasEntity(this.entityIds[0]);
44306             return entity2 ? _t.append("issues.impossible_oneway." + messageID + ".message", {
44307               feature: utilDisplayLabel(entity2, context.graph())
44308             }) : "";
44309           },
44310           reference: getReference(referenceID),
44311           entityIds: [way.id, node.id],
44312           dynamicFixes: function() {
44313             var fixes = [];
44314             if (attachedOneways.length) {
44315               fixes.push(new validationIssueFix({
44316                 icon: "iD-operation-reverse",
44317                 title: _t.append("issues.fix.reverse_feature.title"),
44318                 entityIds: [way.id],
44319                 onClick: function(context) {
44320                   var id2 = this.issue.entityIds[0];
44321                   context.perform(actionReverse(id2), _t("operations.reverse.annotation.line", { n: 1 }));
44322                 }
44323               }));
44324             }
44325             if (node.tags.noexit !== "yes") {
44326               var textDirection = _mainLocalizer.textDirection();
44327               var useLeftContinue = isFirst && textDirection === "ltr" || !isFirst && textDirection === "rtl";
44328               fixes.push(new validationIssueFix({
44329                 icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
44330                 title: _t.append("issues.fix.continue_from_" + (isFirst ? "start" : "end") + ".title"),
44331                 onClick: function(context) {
44332                   var entityID = this.issue.entityIds[0];
44333                   var vertexID = this.issue.entityIds[1];
44334                   var way2 = context.entity(entityID);
44335                   var vertex = context.entity(vertexID);
44336                   continueDrawing(way2, vertex, context);
44337                 }
44338               }));
44339             }
44340             return fixes;
44341           },
44342           loc: node.loc
44343         })];
44344         function getReference(referenceID2) {
44345           return function showReference(selection2) {
44346             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.impossible_oneway." + referenceID2 + ".reference"));
44347           };
44348         }
44349       }
44350     };
44351     function continueDrawing(way, vertex, context) {
44352       var map2 = context.map();
44353       if (!context.editable() || !map2.trimmedExtent().contains(vertex.loc)) {
44354         map2.zoomToEase(vertex);
44355       }
44356       context.enter(
44357         modeDrawLine(context, way.id, context.graph(), "line", way.affix(vertex.id), true)
44358       );
44359     }
44360     validation.type = type2;
44361     return validation;
44362   }
44363
44364   // modules/validations/incompatible_source.js
44365   function validationIncompatibleSource() {
44366     const type2 = "incompatible_source";
44367     const incompatibleRules = [
44368       {
44369         id: "amap",
44370         regex: /(^amap$|^amap\.com|autonavi|mapabc|高德)/i
44371       },
44372       {
44373         id: "baidu",
44374         regex: /(baidu|mapbar|百度)/i
44375       },
44376       {
44377         id: "google",
44378         regex: /google/i,
44379         exceptRegex: /((books|drive)\.google|google\s?(books|drive|plus))|(esri\/Google_Africa_Buildings)/i
44380       }
44381     ];
44382     const validation = function checkIncompatibleSource(entity) {
44383       const entitySources = entity.tags && entity.tags.source && entity.tags.source.split(";");
44384       if (!entitySources) return [];
44385       const entityID = entity.id;
44386       return entitySources.map((source) => {
44387         const matchRule = incompatibleRules.find((rule) => {
44388           if (!rule.regex.test(source)) return false;
44389           if (rule.exceptRegex && rule.exceptRegex.test(source)) return false;
44390           return true;
44391         });
44392         if (!matchRule) return null;
44393         return new validationIssue({
44394           type: type2,
44395           severity: "warning",
44396           message: (context) => {
44397             const entity2 = context.hasEntity(entityID);
44398             return entity2 ? _t.append("issues.incompatible_source.feature.message", {
44399               feature: utilDisplayLabel(
44400                 entity2,
44401                 context.graph(),
44402                 true
44403                 /* verbose */
44404               ),
44405               value: source
44406             }) : "";
44407           },
44408           reference: getReference(matchRule.id),
44409           entityIds: [entityID],
44410           hash: source,
44411           dynamicFixes: () => {
44412             return [
44413               new validationIssueFix({ title: _t.append("issues.fix.remove_proprietary_data.title") })
44414             ];
44415           }
44416         });
44417       }).filter(Boolean);
44418       function getReference(id2) {
44419         return function showReference(selection2) {
44420           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.incompatible_source.reference.".concat(id2)));
44421         };
44422       }
44423     };
44424     validation.type = type2;
44425     return validation;
44426   }
44427
44428   // modules/validations/maprules.js
44429   function validationMaprules() {
44430     var type2 = "maprules";
44431     var validation = function checkMaprules(entity, graph) {
44432       if (!services.maprules) return [];
44433       var rules = services.maprules.validationRules();
44434       var issues = [];
44435       for (var i3 = 0; i3 < rules.length; i3++) {
44436         var rule = rules[i3];
44437         rule.findIssues(entity, graph, issues);
44438       }
44439       return issues;
44440     };
44441     validation.type = type2;
44442     return validation;
44443   }
44444
44445   // modules/validations/mismatched_geometry.js
44446   var import_fast_deep_equal4 = __toESM(require_fast_deep_equal());
44447   function validationMismatchedGeometry() {
44448     var type2 = "mismatched_geometry";
44449     function tagSuggestingLineIsArea(entity) {
44450       if (entity.type !== "way" || entity.isClosed()) return null;
44451       var tagSuggestingArea = entity.tagSuggestingArea();
44452       if (!tagSuggestingArea) {
44453         return null;
44454       }
44455       var asLine = _mainPresetIndex.matchTags(tagSuggestingArea, "line");
44456       var asArea = _mainPresetIndex.matchTags(tagSuggestingArea, "area");
44457       if (asLine && asArea && (0, import_fast_deep_equal4.default)(asLine.tags, asArea.tags)) {
44458         return null;
44459       }
44460       return tagSuggestingArea;
44461     }
44462     function makeConnectEndpointsFixOnClick(way, graph) {
44463       if (way.nodes.length < 3) return null;
44464       var nodes = graph.childNodes(way), testNodes;
44465       var firstToLastDistanceMeters = geoSphericalDistance(nodes[0].loc, nodes[nodes.length - 1].loc);
44466       if (firstToLastDistanceMeters < 0.75) {
44467         testNodes = nodes.slice();
44468         testNodes.pop();
44469         testNodes.push(testNodes[0]);
44470         if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
44471           return function(context) {
44472             var way2 = context.entity(this.issue.entityIds[0]);
44473             context.perform(
44474               actionMergeNodes([way2.nodes[0], way2.nodes[way2.nodes.length - 1]], nodes[0].loc),
44475               _t("issues.fix.connect_endpoints.annotation")
44476             );
44477           };
44478         }
44479       }
44480       testNodes = nodes.slice();
44481       testNodes.push(testNodes[0]);
44482       if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
44483         return function(context) {
44484           var wayId = this.issue.entityIds[0];
44485           var way2 = context.entity(wayId);
44486           var nodeId = way2.nodes[0];
44487           var index = way2.nodes.length;
44488           context.perform(
44489             actionAddVertex(wayId, nodeId, index),
44490             _t("issues.fix.connect_endpoints.annotation")
44491           );
44492         };
44493       }
44494     }
44495     function lineTaggedAsAreaIssue(entity) {
44496       var tagSuggestingArea = tagSuggestingLineIsArea(entity);
44497       if (!tagSuggestingArea) return null;
44498       var validAsLine = false;
44499       var presetAsLine = _mainPresetIndex.matchTags(entity.tags, "line");
44500       if (presetAsLine) {
44501         validAsLine = true;
44502         var key = Object.keys(tagSuggestingArea)[0];
44503         if (presetAsLine.tags[key] && presetAsLine.tags[key] === "*") {
44504           validAsLine = false;
44505         }
44506         if (Object.keys(presetAsLine.tags).length === 0) {
44507           validAsLine = false;
44508         }
44509       }
44510       return new validationIssue({
44511         type: type2,
44512         subtype: "area_as_line",
44513         severity: "warning",
44514         message: function(context) {
44515           var entity2 = context.hasEntity(this.entityIds[0]);
44516           return entity2 ? _t.append("issues.tag_suggests_area.message", {
44517             feature: utilDisplayLabel(
44518               entity2,
44519               "area",
44520               true
44521               /* verbose */
44522             ),
44523             tag: utilTagText({ tags: tagSuggestingArea })
44524           }) : "";
44525         },
44526         reference: showReference,
44527         entityIds: [entity.id],
44528         hash: JSON.stringify(tagSuggestingArea),
44529         dynamicFixes: function(context) {
44530           var fixes = [];
44531           var entity2 = context.entity(this.entityIds[0]);
44532           var connectEndsOnClick = makeConnectEndpointsFixOnClick(entity2, context.graph());
44533           if (!validAsLine) {
44534             fixes.push(new validationIssueFix({
44535               title: _t.append("issues.fix.connect_endpoints.title"),
44536               onClick: connectEndsOnClick
44537             }));
44538           }
44539           fixes.push(new validationIssueFix({
44540             icon: "iD-operation-delete",
44541             title: _t.append("issues.fix.remove_tag.title"),
44542             onClick: function(context2) {
44543               var entityId = this.issue.entityIds[0];
44544               var entity3 = context2.entity(entityId);
44545               var tags = Object.assign({}, entity3.tags);
44546               for (var key2 in tagSuggestingArea) {
44547                 delete tags[key2];
44548               }
44549               context2.perform(
44550                 actionChangeTags(entityId, tags),
44551                 _t("issues.fix.remove_tag.annotation")
44552               );
44553             }
44554           }));
44555           return fixes;
44556         }
44557       });
44558       function showReference(selection2) {
44559         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.tag_suggests_area.reference"));
44560       }
44561     }
44562     function vertexPointIssue(entity, graph) {
44563       if (entity.type !== "node") return null;
44564       if (Object.keys(entity.tags).length === 0) return null;
44565       if (entity.isOnAddressLine(graph)) return null;
44566       var geometry = entity.geometry(graph);
44567       var allowedGeometries = osmNodeGeometriesForTags(entity.tags);
44568       if (geometry === "point" && !allowedGeometries.point && allowedGeometries.vertex) {
44569         return new validationIssue({
44570           type: type2,
44571           subtype: "vertex_as_point",
44572           severity: "warning",
44573           message: function(context) {
44574             var entity2 = context.hasEntity(this.entityIds[0]);
44575             return entity2 ? _t.append("issues.vertex_as_point.message", {
44576               feature: utilDisplayLabel(
44577                 entity2,
44578                 "vertex",
44579                 true
44580                 /* verbose */
44581               )
44582             }) : "";
44583           },
44584           reference: function showReference(selection2) {
44585             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.vertex_as_point.reference"));
44586           },
44587           entityIds: [entity.id]
44588         });
44589       } else if (geometry === "vertex" && !allowedGeometries.vertex && allowedGeometries.point) {
44590         return new validationIssue({
44591           type: type2,
44592           subtype: "point_as_vertex",
44593           severity: "warning",
44594           message: function(context) {
44595             var entity2 = context.hasEntity(this.entityIds[0]);
44596             return entity2 ? _t.append("issues.point_as_vertex.message", {
44597               feature: utilDisplayLabel(
44598                 entity2,
44599                 "point",
44600                 true
44601                 /* verbose */
44602               )
44603             }) : "";
44604           },
44605           reference: function showReference(selection2) {
44606             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.point_as_vertex.reference"));
44607           },
44608           entityIds: [entity.id],
44609           dynamicFixes: extractPointDynamicFixes
44610         });
44611       }
44612       return null;
44613     }
44614     function otherMismatchIssue(entity, graph) {
44615       if (!entity.hasInterestingTags()) return null;
44616       if (entity.type !== "node" && entity.type !== "way") return null;
44617       if (entity.type === "node" && entity.isOnAddressLine(graph)) return null;
44618       var sourceGeom = entity.geometry(graph);
44619       var targetGeoms = entity.type === "way" ? ["point", "vertex"] : ["line", "area"];
44620       if (sourceGeom === "area") targetGeoms.unshift("line");
44621       var asSource = _mainPresetIndex.match(entity, graph);
44622       var targetGeom = targetGeoms.find((nodeGeom) => {
44623         var asTarget = _mainPresetIndex.matchTags(entity.tags, nodeGeom);
44624         if (!asSource || !asTarget || asSource === asTarget || // sometimes there are two presets with the same tags for different geometries
44625         (0, import_fast_deep_equal4.default)(asSource.tags, asTarget.tags)) return false;
44626         if (asTarget.isFallback()) return false;
44627         var primaryKey = Object.keys(asTarget.tags)[0];
44628         if (primaryKey === "building") return false;
44629         if (asTarget.tags[primaryKey] === "*") return false;
44630         return asSource.isFallback() || asSource.tags[primaryKey] === "*";
44631       });
44632       if (!targetGeom) return null;
44633       var subtype = targetGeom + "_as_" + sourceGeom;
44634       if (targetGeom === "vertex") targetGeom = "point";
44635       if (sourceGeom === "vertex") sourceGeom = "point";
44636       var referenceId = targetGeom + "_as_" + sourceGeom;
44637       var dynamicFixes;
44638       if (targetGeom === "point") {
44639         dynamicFixes = extractPointDynamicFixes;
44640       } else if (sourceGeom === "area" && targetGeom === "line") {
44641         dynamicFixes = lineToAreaDynamicFixes;
44642       }
44643       return new validationIssue({
44644         type: type2,
44645         subtype,
44646         severity: "warning",
44647         message: function(context) {
44648           var entity2 = context.hasEntity(this.entityIds[0]);
44649           return entity2 ? _t.append("issues." + referenceId + ".message", {
44650             feature: utilDisplayLabel(
44651               entity2,
44652               targetGeom,
44653               true
44654               /* verbose */
44655             )
44656           }) : "";
44657         },
44658         reference: function showReference(selection2) {
44659           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.mismatched_geometry.reference"));
44660         },
44661         entityIds: [entity.id],
44662         dynamicFixes
44663       });
44664     }
44665     function lineToAreaDynamicFixes(context) {
44666       var convertOnClick;
44667       var entityId = this.entityIds[0];
44668       var entity = context.entity(entityId);
44669       var tags = Object.assign({}, entity.tags);
44670       delete tags.area;
44671       if (!osmTagSuggestingArea(tags)) {
44672         convertOnClick = function(context2) {
44673           var entityId2 = this.issue.entityIds[0];
44674           var entity2 = context2.entity(entityId2);
44675           var tags2 = Object.assign({}, entity2.tags);
44676           if (tags2.area) {
44677             delete tags2.area;
44678           }
44679           context2.perform(
44680             actionChangeTags(entityId2, tags2),
44681             _t("issues.fix.convert_to_line.annotation")
44682           );
44683         };
44684       }
44685       return [
44686         new validationIssueFix({
44687           icon: "iD-icon-line",
44688           title: _t.append("issues.fix.convert_to_line.title"),
44689           onClick: convertOnClick
44690         })
44691       ];
44692     }
44693     function extractPointDynamicFixes(context) {
44694       var entityId = this.entityIds[0];
44695       var extractOnClick = null;
44696       if (!context.hasHiddenConnections(entityId)) {
44697         extractOnClick = function(context2) {
44698           var entityId2 = this.issue.entityIds[0];
44699           var action = actionExtract(entityId2, context2.projection);
44700           context2.perform(
44701             action,
44702             _t("operations.extract.annotation", { n: 1 })
44703           );
44704           context2.enter(modeSelect(context2, [action.getExtractedNodeID()]));
44705         };
44706       }
44707       return [
44708         new validationIssueFix({
44709           icon: "iD-operation-extract",
44710           title: _t.append("issues.fix.extract_point.title"),
44711           onClick: extractOnClick
44712         })
44713       ];
44714     }
44715     function unclosedMultipolygonPartIssues(entity, graph) {
44716       if (entity.type !== "relation" || !entity.isMultipolygon() || entity.isDegenerate() || // cannot determine issues for incompletely-downloaded relations
44717       !entity.isComplete(graph)) return [];
44718       var sequences = osmJoinWays(entity.members, graph);
44719       var issues = [];
44720       for (var i3 in sequences) {
44721         var sequence = sequences[i3];
44722         if (!sequence.nodes) continue;
44723         var firstNode = sequence.nodes[0];
44724         var lastNode = sequence.nodes[sequence.nodes.length - 1];
44725         if (firstNode === lastNode) continue;
44726         var issue = new validationIssue({
44727           type: type2,
44728           subtype: "unclosed_multipolygon_part",
44729           severity: "warning",
44730           message: function(context) {
44731             var entity2 = context.hasEntity(this.entityIds[0]);
44732             return entity2 ? _t.append("issues.unclosed_multipolygon_part.message", {
44733               feature: utilDisplayLabel(
44734                 entity2,
44735                 context.graph(),
44736                 true
44737                 /* verbose */
44738               )
44739             }) : "";
44740           },
44741           reference: showReference,
44742           loc: sequence.nodes[0].loc,
44743           entityIds: [entity.id],
44744           hash: sequence.map(function(way) {
44745             return way.id;
44746           }).join()
44747         });
44748         issues.push(issue);
44749       }
44750       return issues;
44751       function showReference(selection2) {
44752         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unclosed_multipolygon_part.reference"));
44753       }
44754     }
44755     var validation = function checkMismatchedGeometry(entity, graph) {
44756       var vertexPoint = vertexPointIssue(entity, graph);
44757       if (vertexPoint) return [vertexPoint];
44758       var lineAsArea = lineTaggedAsAreaIssue(entity);
44759       if (lineAsArea) return [lineAsArea];
44760       var mismatch = otherMismatchIssue(entity, graph);
44761       if (mismatch) return [mismatch];
44762       return unclosedMultipolygonPartIssues(entity, graph);
44763     };
44764     validation.type = type2;
44765     return validation;
44766   }
44767
44768   // modules/validations/missing_role.js
44769   function validationMissingRole() {
44770     var type2 = "missing_role";
44771     var validation = function checkMissingRole(entity, graph) {
44772       var issues = [];
44773       if (entity.type === "way") {
44774         graph.parentRelations(entity).forEach(function(relation) {
44775           if (!relation.isMultipolygon()) return;
44776           var member = relation.memberById(entity.id);
44777           if (member && isMissingRole(member)) {
44778             issues.push(makeIssue(entity, relation, member));
44779           }
44780         });
44781       } else if (entity.type === "relation" && entity.isMultipolygon()) {
44782         entity.indexedMembers().forEach(function(member) {
44783           var way = graph.hasEntity(member.id);
44784           if (way && isMissingRole(member)) {
44785             issues.push(makeIssue(way, entity, member));
44786           }
44787         });
44788       }
44789       return issues;
44790     };
44791     function isMissingRole(member) {
44792       return !member.role || !member.role.trim().length;
44793     }
44794     function makeIssue(way, relation, member) {
44795       return new validationIssue({
44796         type: type2,
44797         severity: "warning",
44798         message: function(context) {
44799           var member2 = context.hasEntity(this.entityIds[1]), relation2 = context.hasEntity(this.entityIds[0]);
44800           return member2 && relation2 ? _t.append("issues.missing_role.message", {
44801             member: utilDisplayLabel(member2, context.graph()),
44802             relation: utilDisplayLabel(relation2, context.graph())
44803           }) : "";
44804         },
44805         reference: showReference,
44806         entityIds: [relation.id, way.id],
44807         data: {
44808           member
44809         },
44810         hash: member.index.toString(),
44811         dynamicFixes: function() {
44812           return [
44813             makeAddRoleFix("inner"),
44814             makeAddRoleFix("outer"),
44815             new validationIssueFix({
44816               icon: "iD-operation-delete",
44817               title: _t.append("issues.fix.remove_from_relation.title"),
44818               onClick: function(context) {
44819                 context.perform(
44820                   actionDeleteMember(this.issue.entityIds[0], this.issue.data.member.index),
44821                   _t("operations.delete_member.annotation", {
44822                     n: 1
44823                   })
44824                 );
44825               }
44826             })
44827           ];
44828         }
44829       });
44830       function showReference(selection2) {
44831         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.missing_role.multipolygon.reference"));
44832       }
44833     }
44834     function makeAddRoleFix(role) {
44835       return new validationIssueFix({
44836         title: _t.append("issues.fix.set_as_" + role + ".title"),
44837         onClick: function(context) {
44838           var oldMember = this.issue.data.member;
44839           var member = { id: this.issue.entityIds[1], type: oldMember.type, role };
44840           context.perform(
44841             actionChangeMember(this.issue.entityIds[0], member, oldMember.index),
44842             _t("operations.change_role.annotation", {
44843               n: 1
44844             })
44845           );
44846         }
44847       });
44848     }
44849     validation.type = type2;
44850     return validation;
44851   }
44852
44853   // modules/validations/missing_tag.js
44854   function validationMissingTag(context) {
44855     var type2 = "missing_tag";
44856     function hasDescriptiveTags(entity) {
44857       var onlyAttributeKeys = ["description", "name", "note", "start_date"];
44858       var entityDescriptiveKeys = Object.keys(entity.tags).filter(function(k2) {
44859         if (k2 === "area" || !osmIsInterestingTag(k2)) return false;
44860         return !onlyAttributeKeys.some(function(attributeKey) {
44861           return k2 === attributeKey || k2.indexOf(attributeKey + ":") === 0;
44862         });
44863       });
44864       if (entity.type === "relation" && entityDescriptiveKeys.length === 1 && entity.tags.type === "multipolygon") {
44865         return false;
44866       }
44867       return entityDescriptiveKeys.length > 0;
44868     }
44869     function isUnknownRoad(entity) {
44870       return entity.type === "way" && entity.tags.highway === "road";
44871     }
44872     function isUntypedRelation(entity) {
44873       return entity.type === "relation" && !entity.tags.type;
44874     }
44875     var validation = function checkMissingTag(entity, graph) {
44876       var subtype;
44877       var osm = context.connection();
44878       var isUnloadedNode = entity.type === "node" && osm && !osm.isDataLoaded(entity.loc);
44879       if (!isUnloadedNode && // allow untagged nodes that are part of ways
44880       entity.geometry(graph) !== "vertex" && // allow untagged entities that are part of relations
44881       !entity.hasParentRelations(graph)) {
44882         if (Object.keys(entity.tags).length === 0) {
44883           subtype = "any";
44884         } else if (!hasDescriptiveTags(entity)) {
44885           subtype = "descriptive";
44886         } else if (isUntypedRelation(entity)) {
44887           subtype = "relation_type";
44888         }
44889       }
44890       if (!subtype && isUnknownRoad(entity)) {
44891         subtype = "highway_classification";
44892       }
44893       if (!subtype) return [];
44894       var messageID = subtype === "highway_classification" ? "unknown_road" : "missing_tag." + subtype;
44895       var referenceID = subtype === "highway_classification" ? "unknown_road" : "missing_tag";
44896       var canDelete = entity.version === void 0 || entity.v !== void 0;
44897       var severity = canDelete && subtype !== "highway_classification" ? "error" : "warning";
44898       return [new validationIssue({
44899         type: type2,
44900         subtype,
44901         severity,
44902         message: function(context2) {
44903           var entity2 = context2.hasEntity(this.entityIds[0]);
44904           return entity2 ? _t.append("issues." + messageID + ".message", {
44905             feature: utilDisplayLabel(entity2, context2.graph())
44906           }) : "";
44907         },
44908         reference: showReference,
44909         entityIds: [entity.id],
44910         dynamicFixes: function(context2) {
44911           var fixes = [];
44912           var selectFixType = subtype === "highway_classification" ? "select_road_type" : "select_preset";
44913           fixes.push(new validationIssueFix({
44914             icon: "iD-icon-search",
44915             title: _t.append("issues.fix." + selectFixType + ".title"),
44916             onClick: function(context3) {
44917               context3.ui().sidebar.showPresetList();
44918             }
44919           }));
44920           var deleteOnClick;
44921           var id2 = this.entityIds[0];
44922           var operation2 = operationDelete(context2, [id2]);
44923           var disabledReasonID = operation2.disabled();
44924           if (!disabledReasonID) {
44925             deleteOnClick = function(context3) {
44926               var id3 = this.issue.entityIds[0];
44927               var operation3 = operationDelete(context3, [id3]);
44928               if (!operation3.disabled()) {
44929                 operation3();
44930               }
44931             };
44932           }
44933           fixes.push(
44934             new validationIssueFix({
44935               icon: "iD-operation-delete",
44936               title: _t.append("issues.fix.delete_feature.title"),
44937               disabledReason: disabledReasonID ? _t("operations.delete." + disabledReasonID + ".single") : void 0,
44938               onClick: deleteOnClick
44939             })
44940           );
44941           return fixes;
44942         }
44943       })];
44944       function showReference(selection2) {
44945         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues." + referenceID + ".reference"));
44946       }
44947     };
44948     validation.type = type2;
44949     return validation;
44950   }
44951
44952   // modules/validations/mutually_exclusive_tags.js
44953   function validationMutuallyExclusiveTags() {
44954     const type2 = "mutually_exclusive_tags";
44955     const tagKeyPairs = osmMutuallyExclusiveTagPairs;
44956     const validation = function checkMutuallyExclusiveTags(entity) {
44957       let pairsFounds = tagKeyPairs.filter((pair3) => {
44958         return pair3[0] in entity.tags && pair3[1] in entity.tags;
44959       }).filter((pair3) => {
44960         return !(pair3[0].match(/^(addr:)?no[a-z]/) && entity.tags[pair3[0]] === "no" || pair3[1].match(/^(addr:)?no[a-z]/) && entity.tags[pair3[1]] === "no");
44961       });
44962       Object.keys(entity.tags).forEach((key) => {
44963         let negative_key = "not:" + key;
44964         if (negative_key in entity.tags && entity.tags[negative_key].split(";").includes(entity.tags[key])) {
44965           pairsFounds.push([negative_key, key, "same_value"]);
44966         }
44967         if (key.match(/^name:[a-z]+/)) {
44968           negative_key = "not:name";
44969           if (negative_key in entity.tags && entity.tags[negative_key].split(";").includes(entity.tags[key])) {
44970             pairsFounds.push([negative_key, key, "same_value"]);
44971           }
44972         }
44973       });
44974       let issues = pairsFounds.map((pair3) => {
44975         const subtype = pair3[2] || "default";
44976         return new validationIssue({
44977           type: type2,
44978           subtype,
44979           severity: "warning",
44980           message: function(context) {
44981             let entity2 = context.hasEntity(this.entityIds[0]);
44982             return entity2 ? _t.append("issues.".concat(type2, ".").concat(subtype, ".message"), {
44983               feature: utilDisplayLabel(entity2, context.graph()),
44984               tag1: pair3[0],
44985               tag2: pair3[1]
44986             }) : "";
44987           },
44988           reference: (selection2) => showReference(selection2, pair3, subtype),
44989           entityIds: [entity.id],
44990           dynamicFixes: () => pair3.slice(0, 2).map((tagToRemove) => createIssueFix(tagToRemove))
44991         });
44992       });
44993       function createIssueFix(tagToRemove) {
44994         return new validationIssueFix({
44995           icon: "iD-operation-delete",
44996           title: _t.append("issues.fix.remove_named_tag.title", { tag: tagToRemove }),
44997           onClick: function(context) {
44998             const entityId = this.issue.entityIds[0];
44999             const entity2 = context.entity(entityId);
45000             let tags = Object.assign({}, entity2.tags);
45001             delete tags[tagToRemove];
45002             context.perform(
45003               actionChangeTags(entityId, tags),
45004               _t("issues.fix.remove_named_tag.annotation", { tag: tagToRemove })
45005             );
45006           }
45007         });
45008       }
45009       function showReference(selection2, pair3, subtype) {
45010         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.".concat(type2, ".").concat(subtype, ".reference"), { tag1: pair3[0], tag2: pair3[1] }));
45011       }
45012       return issues;
45013     };
45014     validation.type = type2;
45015     return validation;
45016   }
45017
45018   // modules/validations/outdated_tags.js
45019   function validationOutdatedTags() {
45020     const type2 = "outdated_tags";
45021     let _waitingForDeprecated = true;
45022     let _dataDeprecated;
45023     _mainFileFetcher.get("deprecated").then((d2) => _dataDeprecated = d2).catch(() => {
45024     }).finally(() => _waitingForDeprecated = false);
45025     function oldTagIssues(entity, graph) {
45026       if (!entity.hasInterestingTags()) return [];
45027       let preset = _mainPresetIndex.match(entity, graph);
45028       if (!preset) return [];
45029       const oldTags = Object.assign({}, entity.tags);
45030       let subtype = "deprecated_tags";
45031       if (preset.replacement) {
45032         const newPreset = _mainPresetIndex.item(preset.replacement);
45033         graph = actionChangePreset(
45034           entity.id,
45035           preset,
45036           newPreset,
45037           true
45038           /* skip field defaults */
45039         )(graph);
45040         entity = graph.entity(entity.id);
45041         preset = newPreset;
45042       }
45043       const upgradeReasons = [];
45044       if (_dataDeprecated) {
45045         const deprecatedTags = entity.deprecatedTags(_dataDeprecated);
45046         if (entity.type === "way" && entity.isClosed() && entity.tags.traffic_calming === "island" && !entity.tags.highway) {
45047           deprecatedTags.push({
45048             old: { traffic_calming: "island" },
45049             replace: { "area:highway": "traffic_island" }
45050           });
45051         }
45052         if (deprecatedTags.length) {
45053           deprecatedTags.forEach((tag2) => {
45054             graph = actionUpgradeTags(entity.id, tag2.old, tag2.replace)(graph);
45055             upgradeReasons.push({
45056               source: "id-tagging-schema--deprecated",
45057               data: tag2
45058             });
45059           });
45060           entity = graph.entity(entity.id);
45061         }
45062       }
45063       let newTags = Object.assign({}, entity.tags);
45064       if (preset.tags !== preset.addTags) {
45065         Object.keys(preset.addTags).forEach((k2) => {
45066           if (!newTags[k2]) {
45067             if (preset.addTags[k2] === "*") {
45068               newTags[k2] = "yes";
45069             } else if (preset.addTags[k2]) {
45070               newTags[k2] = preset.addTags[k2];
45071             }
45072             upgradeReasons.push({
45073               source: "id-tagging-schema--preset-addTags",
45074               data: preset
45075             });
45076           }
45077         });
45078       }
45079       const nsi = services.nsi;
45080       let waitingForNsi = false;
45081       let nsiResult;
45082       if (nsi) {
45083         waitingForNsi = nsi.status() === "loading";
45084         if (!waitingForNsi) {
45085           const loc = entity.extent(graph).center();
45086           nsiResult = nsi.upgradeTags(newTags, loc);
45087           if (nsiResult) {
45088             newTags = nsiResult.newTags;
45089             subtype = "noncanonical_brand";
45090             upgradeReasons.push({
45091               source: "name-suggestion-index",
45092               data: nsiResult
45093             });
45094           }
45095         }
45096       }
45097       let issues = [];
45098       issues.provisional = _waitingForDeprecated || waitingForNsi;
45099       const tagDiff = utilTagDiff(oldTags, newTags);
45100       if (!tagDiff.length) return issues;
45101       const isOnlyAddingTags = tagDiff.every((d2) => d2.type === "+");
45102       let prefix = "";
45103       if (nsiResult) {
45104         prefix = "noncanonical_brand.";
45105       } else if (subtype === "deprecated_tags" && isOnlyAddingTags) {
45106         subtype = "incomplete_tags";
45107         prefix = "incomplete.";
45108       }
45109       let autoArgs = subtype !== "noncanonical_brand" ? [doUpgrade, _t("issues.fix.upgrade_tags.annotation")] : null;
45110       issues.push(new validationIssue({
45111         type: type2,
45112         subtype,
45113         severity: "warning",
45114         message: showMessage,
45115         reference: showReference,
45116         entityIds: [entity.id],
45117         hash: utilHashcode(JSON.stringify(tagDiff)),
45118         dynamicFixes: () => {
45119           let fixes = [
45120             new validationIssueFix({
45121               autoArgs,
45122               title: _t.append("issues.fix.upgrade_tags.title"),
45123               onClick: (context) => {
45124                 context.perform(doUpgrade, _t("issues.fix.upgrade_tags.annotation"));
45125               }
45126             })
45127           ];
45128           const item = nsiResult && nsiResult.matched;
45129           if (item) {
45130             fixes.push(
45131               new validationIssueFix({
45132                 title: _t.append("issues.fix.tag_as_not.title", { name: item.displayName }),
45133                 onClick: (context) => {
45134                   context.perform(addNotTag, _t("issues.fix.tag_as_not.annotation"));
45135                 }
45136               })
45137             );
45138           }
45139           return fixes;
45140         }
45141       }));
45142       return issues;
45143       function doUpgrade(graph2) {
45144         const currEntity = graph2.hasEntity(entity.id);
45145         if (!currEntity) return graph2;
45146         let newTags2 = Object.assign({}, currEntity.tags);
45147         tagDiff.forEach((diff) => {
45148           if (diff.type === "-") {
45149             delete newTags2[diff.key];
45150           } else if (diff.type === "+") {
45151             newTags2[diff.key] = diff.newVal;
45152           }
45153         });
45154         return actionChangeTags(currEntity.id, newTags2)(graph2);
45155       }
45156       function addNotTag(graph2) {
45157         const currEntity = graph2.hasEntity(entity.id);
45158         if (!currEntity) return graph2;
45159         const item = nsiResult && nsiResult.matched;
45160         if (!item) return graph2;
45161         let newTags2 = Object.assign({}, currEntity.tags);
45162         const wd = item.mainTag;
45163         const notwd = "not:".concat(wd);
45164         const qid = item.tags[wd];
45165         newTags2[notwd] = qid;
45166         if (newTags2[wd] === qid) {
45167           const wp = item.mainTag.replace("wikidata", "wikipedia");
45168           delete newTags2[wd];
45169           delete newTags2[wp];
45170         }
45171         return actionChangeTags(currEntity.id, newTags2)(graph2);
45172       }
45173       function showMessage(context) {
45174         const currEntity = context.hasEntity(entity.id);
45175         if (!currEntity) return "";
45176         let messageID = "issues.outdated_tags.".concat(prefix, "message");
45177         if (subtype === "noncanonical_brand" && isOnlyAddingTags) {
45178           messageID += "_incomplete";
45179         }
45180         return _t.append(messageID, {
45181           feature: utilDisplayLabel(
45182             currEntity,
45183             context.graph(),
45184             true
45185             /* verbose */
45186           )
45187         });
45188       }
45189       function showReference(selection2) {
45190         let enter = selection2.selectAll(".issue-reference").data([0]).enter();
45191         enter.append("div").attr("class", "issue-reference").call(_t.append("issues.outdated_tags.".concat(prefix, "reference")));
45192         enter.append("strong").call(_t.append("issues.suggested"));
45193         enter.append("table").attr("class", "tagDiff-table").selectAll(".tagDiff-row").data(tagDiff).enter().append("tr").attr("class", "tagDiff-row").append("td").attr("class", (d2) => {
45194           let klass = d2.type === "+" ? "add" : "remove";
45195           return "tagDiff-cell tagDiff-cell-".concat(klass);
45196         }).html((d2) => d2.display);
45197       }
45198     }
45199     let validation = oldTagIssues;
45200     validation.type = type2;
45201     return validation;
45202   }
45203
45204   // modules/validations/private_data.js
45205   function validationPrivateData() {
45206     var type2 = "private_data";
45207     var privateBuildingValues = {
45208       detached: true,
45209       farm: true,
45210       house: true,
45211       houseboat: true,
45212       residential: true,
45213       semidetached_house: true,
45214       static_caravan: true
45215     };
45216     var publicKeys = {
45217       amenity: true,
45218       craft: true,
45219       historic: true,
45220       leisure: true,
45221       office: true,
45222       shop: true,
45223       tourism: true
45224     };
45225     var personalTags = {
45226       "contact:email": true,
45227       "contact:fax": true,
45228       "contact:phone": true,
45229       email: true,
45230       fax: true,
45231       phone: true
45232     };
45233     var validation = function checkPrivateData(entity) {
45234       var tags = entity.tags;
45235       if (!tags.building || !privateBuildingValues[tags.building]) return [];
45236       var keepTags = {};
45237       for (var k2 in tags) {
45238         if (publicKeys[k2]) return [];
45239         if (!personalTags[k2]) {
45240           keepTags[k2] = tags[k2];
45241         }
45242       }
45243       var tagDiff = utilTagDiff(tags, keepTags);
45244       if (!tagDiff.length) return [];
45245       var fixID = tagDiff.length === 1 ? "remove_tag" : "remove_tags";
45246       return [new validationIssue({
45247         type: type2,
45248         severity: "warning",
45249         message: showMessage,
45250         reference: showReference,
45251         entityIds: [entity.id],
45252         dynamicFixes: function() {
45253           return [
45254             new validationIssueFix({
45255               icon: "iD-operation-delete",
45256               title: _t.append("issues.fix." + fixID + ".title"),
45257               onClick: function(context) {
45258                 context.perform(doUpgrade, _t("issues.fix.remove_tag.annotation"));
45259               }
45260             })
45261           ];
45262         }
45263       })];
45264       function doUpgrade(graph) {
45265         var currEntity = graph.hasEntity(entity.id);
45266         if (!currEntity) return graph;
45267         var newTags = Object.assign({}, currEntity.tags);
45268         tagDiff.forEach(function(diff) {
45269           if (diff.type === "-") {
45270             delete newTags[diff.key];
45271           } else if (diff.type === "+") {
45272             newTags[diff.key] = diff.newVal;
45273           }
45274         });
45275         return actionChangeTags(currEntity.id, newTags)(graph);
45276       }
45277       function showMessage(context) {
45278         var currEntity = context.hasEntity(this.entityIds[0]);
45279         if (!currEntity) return "";
45280         return _t.append(
45281           "issues.private_data.contact.message",
45282           { feature: utilDisplayLabel(currEntity, context.graph()) }
45283         );
45284       }
45285       function showReference(selection2) {
45286         var enter = selection2.selectAll(".issue-reference").data([0]).enter();
45287         enter.append("div").attr("class", "issue-reference").call(_t.append("issues.private_data.reference"));
45288         enter.append("strong").call(_t.append("issues.suggested"));
45289         enter.append("table").attr("class", "tagDiff-table").selectAll(".tagDiff-row").data(tagDiff).enter().append("tr").attr("class", "tagDiff-row").append("td").attr("class", function(d2) {
45290           var klass = d2.type === "+" ? "add" : "remove";
45291           return "tagDiff-cell tagDiff-cell-" + klass;
45292         }).html(function(d2) {
45293           return d2.display;
45294         });
45295       }
45296     };
45297     validation.type = type2;
45298     return validation;
45299   }
45300
45301   // modules/validations/suspicious_name.js
45302   function validationSuspiciousName() {
45303     const type2 = "suspicious_name";
45304     const keysToTestForGenericValues = [
45305       "aerialway",
45306       "aeroway",
45307       "amenity",
45308       "building",
45309       "craft",
45310       "highway",
45311       "leisure",
45312       "railway",
45313       "man_made",
45314       "office",
45315       "shop",
45316       "tourism",
45317       "waterway"
45318     ];
45319     let _waitingForNsi = false;
45320     function isGenericMatchInNsi(tags) {
45321       const nsi = services.nsi;
45322       if (nsi) {
45323         _waitingForNsi = nsi.status() === "loading";
45324         if (!_waitingForNsi) {
45325           return nsi.isGenericName(tags);
45326         }
45327       }
45328       return false;
45329     }
45330     function nameMatchesRawTag(lowercaseName, tags) {
45331       for (let i3 = 0; i3 < keysToTestForGenericValues.length; i3++) {
45332         let key = keysToTestForGenericValues[i3];
45333         let val = tags[key];
45334         if (val) {
45335           val = val.toLowerCase();
45336           if (key === lowercaseName || val === lowercaseName || key.replace(/\_/g, " ") === lowercaseName || val.replace(/\_/g, " ") === lowercaseName) {
45337             return true;
45338           }
45339         }
45340       }
45341       return false;
45342     }
45343     function isGenericName(name, tags) {
45344       name = name.toLowerCase();
45345       return nameMatchesRawTag(name, tags) || isGenericMatchInNsi(tags);
45346     }
45347     function makeGenericNameIssue(entityId, nameKey, genericName, langCode) {
45348       return new validationIssue({
45349         type: type2,
45350         subtype: "generic_name",
45351         severity: "warning",
45352         message: function(context) {
45353           let entity = context.hasEntity(this.entityIds[0]);
45354           if (!entity) return "";
45355           let preset = _mainPresetIndex.match(entity, context.graph());
45356           let langName = langCode && _mainLocalizer.languageName(langCode);
45357           return _t.append(
45358             "issues.generic_name.message" + (langName ? "_language" : ""),
45359             { feature: preset.name(), name: genericName, language: langName }
45360           );
45361         },
45362         reference: showReference,
45363         entityIds: [entityId],
45364         hash: "".concat(nameKey, "=").concat(genericName),
45365         dynamicFixes: function() {
45366           return [
45367             new validationIssueFix({
45368               icon: "iD-operation-delete",
45369               title: _t.append("issues.fix.remove_the_name.title"),
45370               onClick: function(context) {
45371                 let entityId2 = this.issue.entityIds[0];
45372                 let entity = context.entity(entityId2);
45373                 let tags = Object.assign({}, entity.tags);
45374                 delete tags[nameKey];
45375                 context.perform(
45376                   actionChangeTags(entityId2, tags),
45377                   _t("issues.fix.remove_generic_name.annotation")
45378                 );
45379               }
45380             })
45381           ];
45382         }
45383       });
45384       function showReference(selection2) {
45385         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.generic_name.reference"));
45386       }
45387     }
45388     let validation = function checkGenericName(entity) {
45389       const tags = entity.tags;
45390       const hasWikidata = !!tags.wikidata || !!tags["brand:wikidata"] || !!tags["operator:wikidata"];
45391       if (hasWikidata) return [];
45392       let issues = [];
45393       for (let key in tags) {
45394         const m2 = key.match(/^name(?:(?::)([a-zA-Z_-]+))?$/);
45395         if (!m2) continue;
45396         const langCode = m2.length >= 2 ? m2[1] : null;
45397         const value = tags[key];
45398         if (isGenericName(value, tags)) {
45399           issues.provisional = _waitingForNsi;
45400           issues.push(makeGenericNameIssue(entity.id, key, value, langCode));
45401         }
45402       }
45403       return issues;
45404     };
45405     validation.type = type2;
45406     return validation;
45407   }
45408
45409   // modules/validations/unsquare_way.js
45410   function validationUnsquareWay(context) {
45411     var type2 = "unsquare_way";
45412     var DEFAULT_DEG_THRESHOLD = 5;
45413     var epsilon3 = 0.05;
45414     var nodeThreshold = 10;
45415     function isBuilding(entity, graph) {
45416       if (entity.type !== "way" || entity.geometry(graph) !== "area") return false;
45417       return entity.tags.building && entity.tags.building !== "no";
45418     }
45419     var validation = function checkUnsquareWay(entity, graph) {
45420       if (!isBuilding(entity, graph)) return [];
45421       if (entity.tags.nonsquare === "yes") return [];
45422       var isClosed = entity.isClosed();
45423       if (!isClosed) return [];
45424       var nodes = graph.childNodes(entity).slice();
45425       if (nodes.length > nodeThreshold + 1) return [];
45426       var osm = services.osm;
45427       if (!osm || nodes.some(function(node) {
45428         return !osm.isDataLoaded(node.loc);
45429       })) return [];
45430       var hasConnectedSquarableWays = nodes.some(function(node) {
45431         return graph.parentWays(node).some(function(way) {
45432           if (way.id === entity.id) return false;
45433           if (isBuilding(way, graph)) return true;
45434           return graph.parentRelations(way).some(function(parentRelation) {
45435             return parentRelation.isMultipolygon() && parentRelation.tags.building && parentRelation.tags.building !== "no";
45436           });
45437         });
45438       });
45439       if (hasConnectedSquarableWays) return [];
45440       var storedDegreeThreshold = corePreferences("validate-square-degrees");
45441       var degreeThreshold = isFinite(storedDegreeThreshold) ? Number(storedDegreeThreshold) : DEFAULT_DEG_THRESHOLD;
45442       var points = nodes.map(function(node) {
45443         return context.projection(node.loc);
45444       });
45445       if (!geoOrthoCanOrthogonalize(points, isClosed, epsilon3, degreeThreshold, true)) return [];
45446       var autoArgs;
45447       if (!entity.tags.wikidata) {
45448         var autoAction = actionOrthogonalize(entity.id, context.projection, void 0, degreeThreshold);
45449         autoAction.transitionable = false;
45450         autoArgs = [autoAction, _t("operations.orthogonalize.annotation.feature", { n: 1 })];
45451       }
45452       return [new validationIssue({
45453         type: type2,
45454         subtype: "building",
45455         severity: "warning",
45456         message: function(context2) {
45457           var entity2 = context2.hasEntity(this.entityIds[0]);
45458           return entity2 ? _t.append("issues.unsquare_way.message", {
45459             feature: utilDisplayLabel(entity2, context2.graph())
45460           }) : "";
45461         },
45462         reference: showReference,
45463         entityIds: [entity.id],
45464         hash: degreeThreshold,
45465         dynamicFixes: function() {
45466           return [
45467             new validationIssueFix({
45468               icon: "iD-operation-orthogonalize",
45469               title: _t.append("issues.fix.square_feature.title"),
45470               autoArgs,
45471               onClick: function(context2, completionHandler) {
45472                 var entityId = this.issue.entityIds[0];
45473                 context2.perform(
45474                   actionOrthogonalize(entityId, context2.projection, void 0, degreeThreshold),
45475                   _t("operations.orthogonalize.annotation.feature", { n: 1 })
45476                 );
45477                 window.setTimeout(function() {
45478                   completionHandler();
45479                 }, 175);
45480               }
45481             })
45482             /*
45483             new validationIssueFix({
45484                 title: t.append('issues.fix.tag_as_unsquare.title'),
45485                 onClick: function(context) {
45486                     var entityId = this.issue.entityIds[0];
45487                     var entity = context.entity(entityId);
45488                     var tags = Object.assign({}, entity.tags);  // shallow copy
45489                     tags.nonsquare = 'yes';
45490                     context.perform(
45491                         actionChangeTags(entityId, tags),
45492                         t('issues.fix.tag_as_unsquare.annotation')
45493                     );
45494                 }
45495             })
45496             */
45497           ];
45498         }
45499       })];
45500       function showReference(selection2) {
45501         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unsquare_way.buildings.reference"));
45502       }
45503     };
45504     validation.type = type2;
45505     return validation;
45506   }
45507
45508   // modules/core/validator.js
45509   function coreValidator(context) {
45510     let dispatch14 = dispatch_default("validated", "focusedIssue");
45511     let validator = utilRebind({}, dispatch14, "on");
45512     let _rules = {};
45513     let _disabledRules = {};
45514     let _ignoredIssueIDs = /* @__PURE__ */ new Set();
45515     let _resolvedIssueIDs = /* @__PURE__ */ new Set();
45516     let _baseCache = validationCache("base");
45517     let _headCache = validationCache("head");
45518     let _completeDiff = {};
45519     let _headIsCurrent = false;
45520     let _deferredRIC = {};
45521     let _deferredST = /* @__PURE__ */ new Set();
45522     let _headPromise;
45523     const RETRY = 5e3;
45524     const _errorOverrides = parseHashParam(context.initialHashParams.validationError);
45525     const _warningOverrides = parseHashParam(context.initialHashParams.validationWarning);
45526     const _disableOverrides = parseHashParam(context.initialHashParams.validationDisable);
45527     function parseHashParam(param) {
45528       let result = [];
45529       let rules = (param || "").split(",");
45530       rules.forEach((rule) => {
45531         rule = rule.trim();
45532         const parts = rule.split("/", 2);
45533         const type2 = parts[0];
45534         const subtype = parts[1] || "*";
45535         if (!type2 || !subtype) return;
45536         result.push({ type: makeRegExp(type2), subtype: makeRegExp(subtype) });
45537       });
45538       return result;
45539       function makeRegExp(str) {
45540         const escaped = str.replace(/[-\/\\^$+?.()|[\]{}]/g, "\\$&").replace(/\*/g, ".*");
45541         return new RegExp("^" + escaped + "$");
45542       }
45543     }
45544     validator.init = () => {
45545       Object.values(validations_exports).forEach((validation) => {
45546         if (typeof validation !== "function") return;
45547         const fn = validation(context);
45548         const key = fn.type;
45549         _rules[key] = fn;
45550       });
45551       let disabledRules = corePreferences("validate-disabledRules");
45552       if (disabledRules) {
45553         disabledRules.split(",").forEach((k2) => _disabledRules[k2] = true);
45554       }
45555     };
45556     function reset(resetIgnored) {
45557       _baseCache.queue = [];
45558       _headCache.queue = [];
45559       Object.keys(_deferredRIC).forEach((key) => {
45560         window.cancelIdleCallback(key);
45561         _deferredRIC[key]();
45562       });
45563       _deferredRIC = {};
45564       _deferredST.forEach(window.clearTimeout);
45565       _deferredST.clear();
45566       if (resetIgnored) _ignoredIssueIDs.clear();
45567       _resolvedIssueIDs.clear();
45568       _baseCache = validationCache("base");
45569       _headCache = validationCache("head");
45570       _completeDiff = {};
45571       _headIsCurrent = false;
45572     }
45573     validator.reset = () => {
45574       reset(true);
45575     };
45576     validator.resetIgnoredIssues = () => {
45577       _ignoredIssueIDs.clear();
45578       dispatch14.call("validated");
45579     };
45580     validator.revalidateUnsquare = () => {
45581       revalidateUnsquare(_headCache);
45582       revalidateUnsquare(_baseCache);
45583       dispatch14.call("validated");
45584     };
45585     function revalidateUnsquare(cache) {
45586       const checkUnsquareWay = _rules.unsquare_way;
45587       if (!cache.graph || typeof checkUnsquareWay !== "function") return;
45588       cache.uncacheIssuesOfType("unsquare_way");
45589       const buildings = context.history().tree().intersects(geoExtent([-180, -90], [180, 90]), cache.graph).filter((entity) => entity.type === "way" && entity.tags.building && entity.tags.building !== "no");
45590       buildings.forEach((entity) => {
45591         const detected = checkUnsquareWay(entity, cache.graph);
45592         if (!detected.length) return;
45593         cache.cacheIssues(detected);
45594       });
45595     }
45596     validator.getIssues = (options2) => {
45597       const opts = Object.assign({ what: "all", where: "all", includeIgnored: false, includeDisabledRules: false }, options2);
45598       const view = context.map().extent();
45599       let seen = /* @__PURE__ */ new Set();
45600       let results = [];
45601       if (_headCache.graph && _headCache.graph !== _baseCache.graph) {
45602         Object.values(_headCache.issuesByIssueID).forEach((issue) => {
45603           const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
45604           if (opts.what === "edited" && !userModified) return;
45605           if (!filter2(issue)) return;
45606           seen.add(issue.id);
45607           results.push(issue);
45608         });
45609       }
45610       if (opts.what === "all") {
45611         Object.values(_baseCache.issuesByIssueID).forEach((issue) => {
45612           if (!filter2(issue)) return;
45613           seen.add(issue.id);
45614           results.push(issue);
45615         });
45616       }
45617       return results;
45618       function filter2(issue) {
45619         if (!issue) return false;
45620         if (seen.has(issue.id)) return false;
45621         if (_resolvedIssueIDs.has(issue.id)) return false;
45622         if (opts.includeDisabledRules === "only" && !_disabledRules[issue.type]) return false;
45623         if (!opts.includeDisabledRules && _disabledRules[issue.type]) return false;
45624         if (opts.includeIgnored === "only" && !_ignoredIssueIDs.has(issue.id)) return false;
45625         if (!opts.includeIgnored && _ignoredIssueIDs.has(issue.id)) return false;
45626         if ((issue.entityIds || []).some((id2) => !context.hasEntity(id2))) return false;
45627         if (opts.where === "visible") {
45628           const extent = issue.extent(context.graph());
45629           if (!view.intersects(extent)) return false;
45630         }
45631         return true;
45632       }
45633     };
45634     validator.getResolvedIssues = () => {
45635       return Array.from(_resolvedIssueIDs).map((issueID) => _baseCache.issuesByIssueID[issueID]).filter(Boolean);
45636     };
45637     validator.focusIssue = (issue) => {
45638       const graph = context.graph();
45639       let selectID;
45640       let focusCenter;
45641       const issueExtent = issue.extent(graph);
45642       if (issueExtent) {
45643         focusCenter = issueExtent.center();
45644       }
45645       if (issue.entityIds && issue.entityIds.length) {
45646         selectID = issue.entityIds[0];
45647         if (selectID && selectID.charAt(0) === "r") {
45648           const ids = utilEntityAndDeepMemberIDs([selectID], graph);
45649           let nodeID = ids.find((id2) => id2.charAt(0) === "n" && graph.hasEntity(id2));
45650           if (!nodeID) {
45651             const wayID = ids.find((id2) => id2.charAt(0) === "w" && graph.hasEntity(id2));
45652             if (wayID) {
45653               nodeID = graph.entity(wayID).first();
45654             }
45655           }
45656           if (nodeID) {
45657             focusCenter = graph.entity(nodeID).loc;
45658           }
45659         }
45660       }
45661       if (focusCenter) {
45662         const setZoom = Math.max(context.map().zoom(), 19);
45663         context.map().unobscuredCenterZoomEase(focusCenter, setZoom);
45664       }
45665       if (selectID) {
45666         window.setTimeout(() => {
45667           context.enter(modeSelect(context, [selectID]));
45668           dispatch14.call("focusedIssue", this, issue);
45669         }, 250);
45670       }
45671     };
45672     validator.getIssuesBySeverity = (options2) => {
45673       let groups = utilArrayGroupBy(validator.getIssues(options2), "severity");
45674       groups.error = groups.error || [];
45675       groups.warning = groups.warning || [];
45676       return groups;
45677     };
45678     validator.getSharedEntityIssues = (entityIDs, options2) => {
45679       const orderedIssueTypes = [
45680         // Show some issue types in a particular order:
45681         "missing_tag",
45682         "missing_role",
45683         // - missing data first
45684         "outdated_tags",
45685         "mismatched_geometry",
45686         // - identity issues
45687         "crossing_ways",
45688         "almost_junction",
45689         // - geometry issues where fixing them might solve connectivity issues
45690         "disconnected_way",
45691         "impossible_oneway"
45692         // - finally connectivity issues
45693       ];
45694       const allIssues = validator.getIssues(options2);
45695       const forEntityIDs = new Set(entityIDs);
45696       return allIssues.filter((issue) => (issue.entityIds || []).some((entityID) => forEntityIDs.has(entityID))).sort((issue1, issue2) => {
45697         if (issue1.type === issue2.type) {
45698           return issue1.id < issue2.id ? -1 : 1;
45699         }
45700         const index1 = orderedIssueTypes.indexOf(issue1.type);
45701         const index2 = orderedIssueTypes.indexOf(issue2.type);
45702         if (index1 !== -1 && index2 !== -1) {
45703           return index1 - index2;
45704         } else if (index1 === -1 && index2 === -1) {
45705           return issue1.type < issue2.type ? -1 : 1;
45706         } else {
45707           return index1 !== -1 ? -1 : 1;
45708         }
45709       });
45710     };
45711     validator.getEntityIssues = (entityID, options2) => {
45712       return validator.getSharedEntityIssues([entityID], options2);
45713     };
45714     validator.getRuleKeys = () => {
45715       return Object.keys(_rules);
45716     };
45717     validator.isRuleEnabled = (key) => {
45718       return !_disabledRules[key];
45719     };
45720     validator.toggleRule = (key) => {
45721       if (_disabledRules[key]) {
45722         delete _disabledRules[key];
45723       } else {
45724         _disabledRules[key] = true;
45725       }
45726       corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
45727       validator.validate();
45728     };
45729     validator.disableRules = (keys2) => {
45730       _disabledRules = {};
45731       keys2.forEach((k2) => _disabledRules[k2] = true);
45732       corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
45733       validator.validate();
45734     };
45735     validator.ignoreIssue = (issueID) => {
45736       _ignoredIssueIDs.add(issueID);
45737     };
45738     validator.validate = () => {
45739       const baseGraph = context.history().base();
45740       if (!_headCache.graph) _headCache.graph = baseGraph;
45741       if (!_baseCache.graph) _baseCache.graph = baseGraph;
45742       const prevGraph = _headCache.graph;
45743       const currGraph = context.graph();
45744       if (currGraph === prevGraph) {
45745         _headIsCurrent = true;
45746         dispatch14.call("validated");
45747         return Promise.resolve();
45748       }
45749       if (_headPromise) {
45750         _headIsCurrent = false;
45751         return _headPromise;
45752       }
45753       _headCache.graph = currGraph;
45754       _completeDiff = context.history().difference().complete();
45755       const incrementalDiff = coreDifference(prevGraph, currGraph);
45756       let entityIDs = Object.keys(incrementalDiff.complete());
45757       entityIDs = _headCache.withAllRelatedEntities(entityIDs);
45758       if (!entityIDs.size) {
45759         dispatch14.call("validated");
45760         return Promise.resolve();
45761       }
45762       _headPromise = validateEntitiesAsync(entityIDs, _headCache).then(() => updateResolvedIssues(entityIDs)).then(() => dispatch14.call("validated")).catch(() => {
45763       }).then(() => {
45764         _headPromise = null;
45765         if (!_headIsCurrent) {
45766           validator.validate();
45767         }
45768       });
45769       return _headPromise;
45770     };
45771     context.history().on("restore.validator", validator.validate).on("undone.validator", validator.validate).on("redone.validator", validator.validate).on("reset.validator", () => {
45772       reset(false);
45773       validator.validate();
45774     });
45775     context.on("exit.validator", validator.validate);
45776     context.history().on("merge.validator", (entities) => {
45777       if (!entities) return;
45778       const baseGraph = context.history().base();
45779       if (!_headCache.graph) _headCache.graph = baseGraph;
45780       if (!_baseCache.graph) _baseCache.graph = baseGraph;
45781       let entityIDs = entities.map((entity) => entity.id);
45782       entityIDs = _baseCache.withAllRelatedEntities(entityIDs);
45783       validateEntitiesAsync(entityIDs, _baseCache);
45784     });
45785     function validateEntity(entity, graph) {
45786       let result = { issues: [], provisional: false };
45787       Object.keys(_rules).forEach(runValidation);
45788       return result;
45789       function runValidation(key) {
45790         const fn = _rules[key];
45791         if (typeof fn !== "function") {
45792           console.error("no such validation rule = " + key);
45793           return;
45794         }
45795         let detected = fn(entity, graph);
45796         if (detected.provisional) {
45797           result.provisional = true;
45798         }
45799         detected = detected.filter(applySeverityOverrides);
45800         result.issues = result.issues.concat(detected);
45801         function applySeverityOverrides(issue) {
45802           const type2 = issue.type;
45803           const subtype = issue.subtype || "";
45804           let i3;
45805           for (i3 = 0; i3 < _errorOverrides.length; i3++) {
45806             if (_errorOverrides[i3].type.test(type2) && _errorOverrides[i3].subtype.test(subtype)) {
45807               issue.severity = "error";
45808               return true;
45809             }
45810           }
45811           for (i3 = 0; i3 < _warningOverrides.length; i3++) {
45812             if (_warningOverrides[i3].type.test(type2) && _warningOverrides[i3].subtype.test(subtype)) {
45813               issue.severity = "warning";
45814               return true;
45815             }
45816           }
45817           for (i3 = 0; i3 < _disableOverrides.length; i3++) {
45818             if (_disableOverrides[i3].type.test(type2) && _disableOverrides[i3].subtype.test(subtype)) {
45819               return false;
45820             }
45821           }
45822           return true;
45823         }
45824       }
45825     }
45826     function updateResolvedIssues(entityIDs) {
45827       entityIDs.forEach((entityID) => {
45828         const baseIssues = _baseCache.issuesByEntityID[entityID];
45829         if (!baseIssues) return;
45830         baseIssues.forEach((issueID) => {
45831           const issue = _baseCache.issuesByIssueID[issueID];
45832           const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
45833           if (userModified && !_headCache.issuesByIssueID[issueID]) {
45834             _resolvedIssueIDs.add(issueID);
45835           } else {
45836             _resolvedIssueIDs.delete(issueID);
45837           }
45838         });
45839       });
45840     }
45841     function validateEntitiesAsync(entityIDs, cache) {
45842       const jobs = Array.from(entityIDs).map((entityID) => {
45843         if (cache.queuedEntityIDs.has(entityID)) return null;
45844         cache.queuedEntityIDs.add(entityID);
45845         cache.uncacheEntityID(entityID);
45846         return () => {
45847           cache.queuedEntityIDs.delete(entityID);
45848           const graph = cache.graph;
45849           if (!graph) return;
45850           const entity = graph.hasEntity(entityID);
45851           if (!entity) return;
45852           const result = validateEntity(entity, graph);
45853           if (result.provisional) {
45854             cache.provisionalEntityIDs.add(entityID);
45855           }
45856           cache.cacheIssues(result.issues);
45857         };
45858       }).filter(Boolean);
45859       cache.queue = cache.queue.concat(utilArrayChunk(jobs, 100));
45860       if (cache.queuePromise) return cache.queuePromise;
45861       cache.queuePromise = processQueue(cache).then(() => revalidateProvisionalEntities(cache)).catch(() => {
45862       }).finally(() => cache.queuePromise = null);
45863       return cache.queuePromise;
45864     }
45865     function revalidateProvisionalEntities(cache) {
45866       if (!cache.provisionalEntityIDs.size) return;
45867       const handle = window.setTimeout(() => {
45868         _deferredST.delete(handle);
45869         if (!cache.provisionalEntityIDs.size) return;
45870         validateEntitiesAsync(Array.from(cache.provisionalEntityIDs), cache);
45871       }, RETRY);
45872       _deferredST.add(handle);
45873     }
45874     function processQueue(cache) {
45875       if (!cache.queue.length) return Promise.resolve();
45876       const chunk = cache.queue.pop();
45877       return new Promise((resolvePromise, rejectPromise) => {
45878         const handle = window.requestIdleCallback(() => {
45879           delete _deferredRIC[handle];
45880           chunk.forEach((job) => job());
45881           resolvePromise();
45882         });
45883         _deferredRIC[handle] = rejectPromise;
45884       }).then(() => {
45885         if (cache.queue.length % 25 === 0) dispatch14.call("validated");
45886       }).then(() => processQueue(cache));
45887     }
45888     return validator;
45889   }
45890   function validationCache(which) {
45891     let cache = {
45892       which,
45893       graph: null,
45894       queue: [],
45895       queuePromise: null,
45896       queuedEntityIDs: /* @__PURE__ */ new Set(),
45897       provisionalEntityIDs: /* @__PURE__ */ new Set(),
45898       issuesByIssueID: {},
45899       // issue.id -> issue
45900       issuesByEntityID: {}
45901       // entity.id -> Set(issue.id)
45902     };
45903     cache.cacheIssue = (issue) => {
45904       (issue.entityIds || []).forEach((entityID) => {
45905         if (!cache.issuesByEntityID[entityID]) {
45906           cache.issuesByEntityID[entityID] = /* @__PURE__ */ new Set();
45907         }
45908         cache.issuesByEntityID[entityID].add(issue.id);
45909       });
45910       cache.issuesByIssueID[issue.id] = issue;
45911     };
45912     cache.uncacheIssue = (issue) => {
45913       (issue.entityIds || []).forEach((entityID) => {
45914         if (cache.issuesByEntityID[entityID]) {
45915           cache.issuesByEntityID[entityID].delete(issue.id);
45916         }
45917       });
45918       delete cache.issuesByIssueID[issue.id];
45919     };
45920     cache.cacheIssues = (issues) => {
45921       issues.forEach(cache.cacheIssue);
45922     };
45923     cache.uncacheIssues = (issues) => {
45924       issues.forEach(cache.uncacheIssue);
45925     };
45926     cache.uncacheIssuesOfType = (type2) => {
45927       const issuesOfType = Object.values(cache.issuesByIssueID).filter((issue) => issue.type === type2);
45928       cache.uncacheIssues(issuesOfType);
45929     };
45930     cache.uncacheEntityID = (entityID) => {
45931       const entityIssueIDs = cache.issuesByEntityID[entityID];
45932       if (entityIssueIDs) {
45933         entityIssueIDs.forEach((issueID) => {
45934           const issue = cache.issuesByIssueID[issueID];
45935           if (issue) {
45936             cache.uncacheIssue(issue);
45937           } else {
45938             delete cache.issuesByIssueID[issueID];
45939           }
45940         });
45941       }
45942       delete cache.issuesByEntityID[entityID];
45943       cache.provisionalEntityIDs.delete(entityID);
45944     };
45945     cache.withAllRelatedEntities = (entityIDs) => {
45946       let result = /* @__PURE__ */ new Set();
45947       (entityIDs || []).forEach((entityID) => {
45948         result.add(entityID);
45949         const entityIssueIDs = cache.issuesByEntityID[entityID];
45950         if (entityIssueIDs) {
45951           entityIssueIDs.forEach((issueID) => {
45952             const issue = cache.issuesByIssueID[issueID];
45953             if (issue) {
45954               (issue.entityIds || []).forEach((relatedID) => result.add(relatedID));
45955             } else {
45956               delete cache.issuesByIssueID[issueID];
45957             }
45958           });
45959         }
45960       });
45961       return result;
45962     };
45963     return cache;
45964   }
45965
45966   // modules/core/uploader.js
45967   function coreUploader(context) {
45968     var dispatch14 = dispatch_default(
45969       // Start and end events are dispatched exactly once each per legitimate outside call to `save`
45970       "saveStarted",
45971       // dispatched as soon as a call to `save` has been deemed legitimate
45972       "saveEnded",
45973       // dispatched after the result event has been dispatched
45974       "willAttemptUpload",
45975       // dispatched before the actual upload call occurs, if it will
45976       "progressChanged",
45977       // Each save results in one of these outcomes:
45978       "resultNoChanges",
45979       // upload wasn't attempted since there were no edits
45980       "resultErrors",
45981       // upload failed due to errors
45982       "resultConflicts",
45983       // upload failed due to data conflicts
45984       "resultSuccess"
45985       // upload completed without errors
45986     );
45987     var _isSaving = false;
45988     var _conflicts = [];
45989     var _errors = [];
45990     var _origChanges;
45991     var _discardTags = {};
45992     _mainFileFetcher.get("discarded").then(function(d2) {
45993       _discardTags = d2;
45994     }).catch(function() {
45995     });
45996     var uploader = utilRebind({}, dispatch14, "on");
45997     uploader.isSaving = function() {
45998       return _isSaving;
45999     };
46000     uploader.save = function(changeset, tryAgain, checkConflicts) {
46001       if (_isSaving && !tryAgain) {
46002         return;
46003       }
46004       var osm = context.connection();
46005       if (!osm) return;
46006       if (!osm.authenticated()) {
46007         osm.authenticate(function(err) {
46008           if (!err) {
46009             uploader.save(changeset, tryAgain, checkConflicts);
46010           }
46011         });
46012         return;
46013       }
46014       if (!_isSaving) {
46015         _isSaving = true;
46016         dispatch14.call("saveStarted", this);
46017       }
46018       var history = context.history();
46019       _conflicts = [];
46020       _errors = [];
46021       _origChanges = history.changes(actionDiscardTags(history.difference(), _discardTags));
46022       if (!tryAgain) {
46023         history.perform(actionNoop());
46024       }
46025       if (!checkConflicts) {
46026         upload(changeset);
46027       } else {
46028         performFullConflictCheck(changeset);
46029       }
46030     };
46031     function performFullConflictCheck(changeset) {
46032       var osm = context.connection();
46033       if (!osm) return;
46034       var history = context.history();
46035       var localGraph = context.graph();
46036       var remoteGraph = coreGraph(history.base(), true);
46037       var summary = history.difference().summary();
46038       var _toCheck = [];
46039       for (var i3 = 0; i3 < summary.length; i3++) {
46040         var item = summary[i3];
46041         if (item.changeType === "modified") {
46042           _toCheck.push(item.entity.id);
46043         }
46044       }
46045       var _toLoad = withChildNodes(_toCheck, localGraph);
46046       var _loaded = {};
46047       var _toLoadCount = 0;
46048       var _toLoadTotal = _toLoad.length;
46049       if (_toCheck.length) {
46050         dispatch14.call("progressChanged", this, _toLoadCount, _toLoadTotal);
46051         _toLoad.forEach(function(id2) {
46052           _loaded[id2] = false;
46053         });
46054         osm.loadMultiple(_toLoad, loaded);
46055       } else {
46056         upload(changeset);
46057       }
46058       return;
46059       function withChildNodes(ids, graph) {
46060         var s2 = new Set(ids);
46061         ids.forEach(function(id2) {
46062           var entity = graph.entity(id2);
46063           if (entity.type !== "way") return;
46064           graph.childNodes(entity).forEach(function(child) {
46065             if (child.version !== void 0) {
46066               s2.add(child.id);
46067             }
46068           });
46069         });
46070         return Array.from(s2);
46071       }
46072       function loaded(err, result) {
46073         if (_errors.length) return;
46074         if (err) {
46075           _errors.push({
46076             msg: err.message || err.responseText,
46077             details: [_t("save.status_code", { code: err.status })]
46078           });
46079           didResultInErrors();
46080         } else {
46081           var loadMore = [];
46082           result.data.forEach(function(entity) {
46083             remoteGraph.replace(entity);
46084             _loaded[entity.id] = true;
46085             _toLoad = _toLoad.filter(function(val) {
46086               return val !== entity.id;
46087             });
46088             if (!entity.visible) return;
46089             var i4, id2;
46090             if (entity.type === "way") {
46091               for (i4 = 0; i4 < entity.nodes.length; i4++) {
46092                 id2 = entity.nodes[i4];
46093                 if (_loaded[id2] === void 0) {
46094                   _loaded[id2] = false;
46095                   loadMore.push(id2);
46096                 }
46097               }
46098             } else if (entity.type === "relation" && entity.isMultipolygon()) {
46099               for (i4 = 0; i4 < entity.members.length; i4++) {
46100                 id2 = entity.members[i4].id;
46101                 if (_loaded[id2] === void 0) {
46102                   _loaded[id2] = false;
46103                   loadMore.push(id2);
46104                 }
46105               }
46106             }
46107           });
46108           _toLoadCount += result.data.length;
46109           _toLoadTotal += loadMore.length;
46110           dispatch14.call("progressChanged", this, _toLoadCount, _toLoadTotal);
46111           if (loadMore.length) {
46112             _toLoad.push.apply(_toLoad, loadMore);
46113             osm.loadMultiple(loadMore, loaded);
46114           }
46115           if (!_toLoad.length) {
46116             detectConflicts();
46117             upload(changeset);
46118           }
46119         }
46120       }
46121       function detectConflicts() {
46122         function choice(id2, text, action) {
46123           return {
46124             id: id2,
46125             text,
46126             action: function() {
46127               history.replace(action);
46128             }
46129           };
46130         }
46131         function formatUser(d2) {
46132           return '<a href="' + osm.userURL(d2) + '" target="_blank">' + escape_default(d2) + "</a>";
46133         }
46134         function entityName(entity) {
46135           return utilDisplayName(entity) || utilDisplayType(entity.id) + " " + entity.id;
46136         }
46137         function sameVersions(local, remote) {
46138           if (local.version !== remote.version) return false;
46139           if (local.type === "way") {
46140             var children2 = utilArrayUnion(local.nodes, remote.nodes);
46141             for (var i4 = 0; i4 < children2.length; i4++) {
46142               var a2 = localGraph.hasEntity(children2[i4]);
46143               var b2 = remoteGraph.hasEntity(children2[i4]);
46144               if (a2 && b2 && a2.version !== b2.version) return false;
46145             }
46146           }
46147           return true;
46148         }
46149         _toCheck.forEach(function(id2) {
46150           var local = localGraph.entity(id2);
46151           var remote = remoteGraph.entity(id2);
46152           if (sameVersions(local, remote)) return;
46153           var merge2 = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags, formatUser);
46154           history.replace(merge2);
46155           var mergeConflicts = merge2.conflicts();
46156           if (!mergeConflicts.length) return;
46157           var forceLocal = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_local");
46158           var forceRemote = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_remote");
46159           var keepMine = _t("save.conflict." + (remote.visible ? "keep_local" : "restore"));
46160           var keepTheirs = _t("save.conflict." + (remote.visible ? "keep_remote" : "delete"));
46161           _conflicts.push({
46162             id: id2,
46163             name: entityName(local),
46164             details: mergeConflicts,
46165             chosen: 1,
46166             choices: [
46167               choice(id2, keepMine, forceLocal),
46168               choice(id2, keepTheirs, forceRemote)
46169             ]
46170           });
46171         });
46172       }
46173     }
46174     function upload(changeset) {
46175       var osm = context.connection();
46176       if (!osm) {
46177         _errors.push({ msg: "No OSM Service" });
46178       }
46179       if (_conflicts.length) {
46180         didResultInConflicts(changeset);
46181       } else if (_errors.length) {
46182         didResultInErrors();
46183       } else {
46184         var history = context.history();
46185         var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
46186         if (changes.modified.length || changes.created.length || changes.deleted.length) {
46187           dispatch14.call("willAttemptUpload", this);
46188           osm.putChangeset(changeset, changes, uploadCallback);
46189         } else {
46190           didResultInNoChanges();
46191         }
46192       }
46193     }
46194     function uploadCallback(err, changeset) {
46195       if (err) {
46196         if (err.status === 409) {
46197           uploader.save(changeset, true, true);
46198         } else {
46199           _errors.push({
46200             msg: err.message || err.responseText,
46201             details: [_t("save.status_code", { code: err.status })]
46202           });
46203           didResultInErrors();
46204         }
46205       } else {
46206         didResultInSuccess(changeset);
46207       }
46208     }
46209     function didResultInNoChanges() {
46210       dispatch14.call("resultNoChanges", this);
46211       endSave();
46212       context.flush();
46213     }
46214     function didResultInErrors() {
46215       context.history().pop();
46216       dispatch14.call("resultErrors", this, _errors);
46217       endSave();
46218     }
46219     function didResultInConflicts(changeset) {
46220       _conflicts.sort(function(a2, b2) {
46221         return b2.id.localeCompare(a2.id);
46222       });
46223       dispatch14.call("resultConflicts", this, changeset, _conflicts, _origChanges);
46224       endSave();
46225     }
46226     function didResultInSuccess(changeset) {
46227       context.history().clearSaved();
46228       dispatch14.call("resultSuccess", this, changeset);
46229       window.setTimeout(function() {
46230         endSave();
46231         context.flush();
46232       }, 2500);
46233     }
46234     function endSave() {
46235       _isSaving = false;
46236       dispatch14.call("saveEnded", this);
46237     }
46238     uploader.cancelConflictResolution = function() {
46239       context.history().pop();
46240     };
46241     uploader.processResolvedConflicts = function(changeset) {
46242       var history = context.history();
46243       for (var i3 = 0; i3 < _conflicts.length; i3++) {
46244         if (_conflicts[i3].chosen === 1) {
46245           var entity = context.hasEntity(_conflicts[i3].id);
46246           if (entity && entity.type === "way") {
46247             var children2 = utilArrayUniq(entity.nodes);
46248             for (var j2 = 0; j2 < children2.length; j2++) {
46249               history.replace(actionRevert(children2[j2]));
46250             }
46251           }
46252           history.replace(actionRevert(_conflicts[i3].id));
46253         }
46254       }
46255       uploader.save(changeset, true, false);
46256     };
46257     uploader.reset = function() {
46258     };
46259     return uploader;
46260   }
46261
46262   // modules/modes/draw_area.js
46263   function modeDrawArea(context, wayID, startGraph, button) {
46264     var mode = {
46265       button,
46266       id: "draw-area"
46267     };
46268     var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawArea", function() {
46269       context.ui().flash.iconName("#iD-icon-no").label(_t.append("self_intersection.error.areas"))();
46270     });
46271     mode.wayID = wayID;
46272     mode.enter = function() {
46273       context.install(behavior);
46274     };
46275     mode.exit = function() {
46276       context.uninstall(behavior);
46277     };
46278     mode.selectedIDs = function() {
46279       return [wayID];
46280     };
46281     mode.activeID = function() {
46282       return behavior && behavior.activeID() || [];
46283     };
46284     return mode;
46285   }
46286
46287   // modules/modes/add_area.js
46288   function modeAddArea(context, mode) {
46289     mode.id = "add-area";
46290     var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
46291     function defaultTags(loc) {
46292       var defaultTags2 = { area: "yes" };
46293       if (mode.preset) defaultTags2 = mode.preset.setTags(defaultTags2, "area", false, loc);
46294       return defaultTags2;
46295     }
46296     function actionClose(wayId) {
46297       return function(graph) {
46298         return graph.replace(graph.entity(wayId).close());
46299       };
46300     }
46301     function start2(loc) {
46302       var startGraph = context.graph();
46303       var node = osmNode({ loc });
46304       var way = osmWay({ tags: defaultTags(loc) });
46305       context.perform(
46306         actionAddEntity(node),
46307         actionAddEntity(way),
46308         actionAddVertex(way.id, node.id),
46309         actionClose(way.id)
46310       );
46311       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
46312     }
46313     function startFromWay(loc, edge) {
46314       var startGraph = context.graph();
46315       var node = osmNode({ loc });
46316       var way = osmWay({ tags: defaultTags(loc) });
46317       context.perform(
46318         actionAddEntity(node),
46319         actionAddEntity(way),
46320         actionAddVertex(way.id, node.id),
46321         actionClose(way.id),
46322         actionAddMidpoint({ loc, edge }, node)
46323       );
46324       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
46325     }
46326     function startFromNode(node) {
46327       var startGraph = context.graph();
46328       var way = osmWay({ tags: defaultTags(node.loc) });
46329       context.perform(
46330         actionAddEntity(way),
46331         actionAddVertex(way.id, node.id),
46332         actionClose(way.id)
46333       );
46334       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
46335     }
46336     mode.enter = function() {
46337       context.install(behavior);
46338     };
46339     mode.exit = function() {
46340       context.uninstall(behavior);
46341     };
46342     return mode;
46343   }
46344
46345   // modules/modes/add_line.js
46346   function modeAddLine(context, mode) {
46347     mode.id = "add-line";
46348     var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
46349     function defaultTags(loc) {
46350       var defaultTags2 = {};
46351       if (mode.preset) defaultTags2 = mode.preset.setTags(defaultTags2, "line", false, loc);
46352       return defaultTags2;
46353     }
46354     function start2(loc) {
46355       var startGraph = context.graph();
46356       var node = osmNode({ loc });
46357       var way = osmWay({ tags: defaultTags(loc) });
46358       context.perform(
46359         actionAddEntity(node),
46360         actionAddEntity(way),
46361         actionAddVertex(way.id, node.id)
46362       );
46363       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
46364     }
46365     function startFromWay(loc, edge) {
46366       var startGraph = context.graph();
46367       var node = osmNode({ loc });
46368       var way = osmWay({ tags: defaultTags(loc) });
46369       context.perform(
46370         actionAddEntity(node),
46371         actionAddEntity(way),
46372         actionAddVertex(way.id, node.id),
46373         actionAddMidpoint({ loc, edge }, node)
46374       );
46375       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
46376     }
46377     function startFromNode(node) {
46378       var startGraph = context.graph();
46379       var way = osmWay({ tags: defaultTags(node.loc) });
46380       context.perform(
46381         actionAddEntity(way),
46382         actionAddVertex(way.id, node.id)
46383       );
46384       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
46385     }
46386     mode.enter = function() {
46387       context.install(behavior);
46388     };
46389     mode.exit = function() {
46390       context.uninstall(behavior);
46391     };
46392     return mode;
46393   }
46394
46395   // modules/modes/add_point.js
46396   function modeAddPoint(context, mode) {
46397     mode.id = "add-point";
46398     var behavior = behaviorDraw(context).on("click", add).on("clickWay", addWay).on("clickNode", addNode).on("cancel", cancel).on("finish", cancel);
46399     function defaultTags(loc) {
46400       var defaultTags2 = {};
46401       if (mode.preset) defaultTags2 = mode.preset.setTags(defaultTags2, "point", false, loc);
46402       return defaultTags2;
46403     }
46404     function add(loc) {
46405       var node = osmNode({ loc, tags: defaultTags(loc) });
46406       context.perform(
46407         actionAddEntity(node),
46408         _t("operations.add.annotation.point")
46409       );
46410       enterSelectMode(node);
46411     }
46412     function addWay(loc, edge) {
46413       var node = osmNode({ tags: defaultTags(loc) });
46414       context.perform(
46415         actionAddMidpoint({ loc, edge }, node),
46416         _t("operations.add.annotation.vertex")
46417       );
46418       enterSelectMode(node);
46419     }
46420     function enterSelectMode(node) {
46421       context.enter(
46422         modeSelect(context, [node.id]).newFeature(true)
46423       );
46424     }
46425     function addNode(node) {
46426       const _defaultTags = defaultTags(node.loc);
46427       if (Object.keys(_defaultTags).length === 0) {
46428         enterSelectMode(node);
46429         return;
46430       }
46431       var tags = Object.assign({}, node.tags);
46432       for (var key in _defaultTags) {
46433         tags[key] = _defaultTags[key];
46434       }
46435       context.perform(
46436         actionChangeTags(node.id, tags),
46437         _t("operations.add.annotation.point")
46438       );
46439       enterSelectMode(node);
46440     }
46441     function cancel() {
46442       context.enter(modeBrowse(context));
46443     }
46444     mode.enter = function() {
46445       context.install(behavior);
46446     };
46447     mode.exit = function() {
46448       context.uninstall(behavior);
46449     };
46450     return mode;
46451   }
46452
46453   // modules/ui/note_comments.js
46454   function uiNoteComments() {
46455     var _note;
46456     function noteComments(selection2) {
46457       if (_note.isNew()) return;
46458       var comments = selection2.selectAll(".comments-container").data([0]);
46459       comments = comments.enter().append("div").attr("class", "comments-container").merge(comments);
46460       var commentEnter = comments.selectAll(".comment").data(_note.comments).enter().append("div").attr("class", "comment");
46461       commentEnter.append("div").attr("class", function(d2) {
46462         return "comment-avatar user-" + d2.uid;
46463       }).call(svgIcon("#iD-icon-avatar", "comment-avatar-icon"));
46464       var mainEnter = commentEnter.append("div").attr("class", "comment-main");
46465       var metadataEnter = mainEnter.append("div").attr("class", "comment-metadata");
46466       metadataEnter.append("div").attr("class", "comment-author").each(function(d2) {
46467         var selection3 = select_default2(this);
46468         var osm = services.osm;
46469         if (osm && d2.user) {
46470           selection3 = selection3.append("a").attr("class", "comment-author-link").attr("href", osm.userURL(d2.user)).attr("target", "_blank");
46471         }
46472         if (d2.user) {
46473           selection3.text(d2.user);
46474         } else {
46475           selection3.call(_t.append("note.anonymous"));
46476         }
46477       });
46478       metadataEnter.append("div").attr("class", "comment-date").html(function(d2) {
46479         return _t.html("note.status." + d2.action, { when: localeDateString2(d2.date) });
46480       });
46481       mainEnter.append("div").attr("class", "comment-text").html(function(d2) {
46482         return d2.html;
46483       }).selectAll("a").attr("rel", "noopener nofollow").attr("target", "_blank");
46484       comments.call(replaceAvatars);
46485     }
46486     function replaceAvatars(selection2) {
46487       var showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
46488       var osm = services.osm;
46489       if (showThirdPartyIcons !== "true" || !osm) return;
46490       var uids = {};
46491       _note.comments.forEach(function(d2) {
46492         if (d2.uid) uids[d2.uid] = true;
46493       });
46494       Object.keys(uids).forEach(function(uid) {
46495         osm.loadUser(uid, function(err, user) {
46496           if (!user || !user.image_url) return;
46497           selection2.selectAll(".comment-avatar.user-" + uid).html("").append("img").attr("class", "icon comment-avatar-icon").attr("src", user.image_url).attr("alt", user.display_name);
46498         });
46499       });
46500     }
46501     function localeDateString2(s2) {
46502       if (!s2) return null;
46503       var options2 = { day: "numeric", month: "short", year: "numeric" };
46504       s2 = s2.replace(/-/g, "/");
46505       var d2 = new Date(s2);
46506       if (isNaN(d2.getTime())) return null;
46507       return d2.toLocaleDateString(_mainLocalizer.localeCode(), options2);
46508     }
46509     noteComments.note = function(val) {
46510       if (!arguments.length) return _note;
46511       _note = val;
46512       return noteComments;
46513     };
46514     return noteComments;
46515   }
46516
46517   // modules/ui/note_header.js
46518   function uiNoteHeader() {
46519     var _note;
46520     function noteHeader(selection2) {
46521       var header = selection2.selectAll(".note-header").data(
46522         _note ? [_note] : [],
46523         function(d2) {
46524           return d2.status + d2.id;
46525         }
46526       );
46527       header.exit().remove();
46528       var headerEnter = header.enter().append("div").attr("class", "note-header");
46529       var iconEnter = headerEnter.append("div").attr("class", function(d2) {
46530         return "note-header-icon " + d2.status;
46531       }).classed("new", function(d2) {
46532         return d2.id < 0;
46533       });
46534       iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-note", "note-fill"));
46535       iconEnter.each(function(d2) {
46536         var statusIcon;
46537         if (d2.id < 0) {
46538           statusIcon = "#iD-icon-plus";
46539         } else if (d2.status === "open") {
46540           statusIcon = "#iD-icon-close";
46541         } else {
46542           statusIcon = "#iD-icon-apply";
46543         }
46544         iconEnter.append("div").attr("class", "note-icon-annotation").attr("title", _t("icons.close")).call(svgIcon(statusIcon, "icon-annotation"));
46545       });
46546       headerEnter.append("div").attr("class", "note-header-label").html(function(d2) {
46547         if (_note.isNew()) {
46548           return _t.html("note.new");
46549         }
46550         return _t.html("note.note") + " " + d2.id + " " + (d2.status === "closed" ? _t.html("note.closed") : "");
46551       });
46552     }
46553     noteHeader.note = function(val) {
46554       if (!arguments.length) return _note;
46555       _note = val;
46556       return noteHeader;
46557     };
46558     return noteHeader;
46559   }
46560
46561   // modules/ui/note_report.js
46562   function uiNoteReport() {
46563     var _note;
46564     function noteReport(selection2) {
46565       var url;
46566       if (services.osm && _note instanceof osmNote && !_note.isNew()) {
46567         url = services.osm.noteReportURL(_note);
46568       }
46569       var link3 = selection2.selectAll(".note-report").data(url ? [url] : []);
46570       link3.exit().remove();
46571       var linkEnter = link3.enter().append("a").attr("class", "note-report").attr("target", "_blank").attr("href", function(d2) {
46572         return d2;
46573       }).call(svgIcon("#iD-icon-out-link", "inline"));
46574       linkEnter.append("span").call(_t.append("note.report"));
46575     }
46576     noteReport.note = function(val) {
46577       if (!arguments.length) return _note;
46578       _note = val;
46579       return noteReport;
46580     };
46581     return noteReport;
46582   }
46583
46584   // modules/ui/view_on_osm.js
46585   function uiViewOnOSM(context) {
46586     var _what;
46587     function viewOnOSM(selection2) {
46588       var url;
46589       if (_what instanceof osmEntity) {
46590         url = context.connection().entityURL(_what);
46591       } else if (_what instanceof osmNote) {
46592         url = context.connection().noteURL(_what);
46593       }
46594       var data = !_what || _what.isNew() ? [] : [_what];
46595       var link3 = selection2.selectAll(".view-on-osm").data(data, function(d2) {
46596         return d2.id;
46597       });
46598       link3.exit().remove();
46599       var linkEnter = link3.enter().append("a").attr("class", "view-on-osm").attr("target", "_blank").attr("href", url).call(svgIcon("#iD-icon-out-link", "inline"));
46600       linkEnter.append("span").call(_t.append("inspector.view_on_osm"));
46601     }
46602     viewOnOSM.what = function(_2) {
46603       if (!arguments.length) return _what;
46604       _what = _2;
46605       return viewOnOSM;
46606     };
46607     return viewOnOSM;
46608   }
46609
46610   // modules/ui/note_editor.js
46611   function uiNoteEditor(context) {
46612     var dispatch14 = dispatch_default("change");
46613     var noteComments = uiNoteComments(context);
46614     var noteHeader = uiNoteHeader();
46615     var _note;
46616     var _newNote;
46617     function noteEditor(selection2) {
46618       var header = selection2.selectAll(".header").data([0]);
46619       var headerEnter = header.enter().append("div").attr("class", "header fillL");
46620       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
46621         context.enter(modeBrowse(context));
46622       }).call(svgIcon("#iD-icon-close"));
46623       headerEnter.append("h2").call(_t.append("note.title"));
46624       var body = selection2.selectAll(".body").data([0]);
46625       body = body.enter().append("div").attr("class", "body").merge(body);
46626       var editor = body.selectAll(".note-editor").data([0]);
46627       editor.enter().append("div").attr("class", "modal-section note-editor").merge(editor).call(noteHeader.note(_note)).call(noteComments.note(_note)).call(noteSaveSection);
46628       var footer = selection2.selectAll(".footer").data([0]);
46629       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOSM(context).what(_note)).call(uiNoteReport(context).note(_note));
46630       var osm = services.osm;
46631       if (osm) {
46632         osm.on("change.note-save", function() {
46633           selection2.call(noteEditor);
46634         });
46635       }
46636     }
46637     function noteSaveSection(selection2) {
46638       var isSelected = _note && _note.id === context.selectedNoteID();
46639       var noteSave = selection2.selectAll(".note-save").data(isSelected ? [_note] : [], function(d2) {
46640         return d2.status + d2.id;
46641       });
46642       noteSave.exit().remove();
46643       var noteSaveEnter = noteSave.enter().append("div").attr("class", "note-save save-section cf");
46644       noteSaveEnter.append("h4").attr("class", ".note-save-header").text("").each(function() {
46645         if (_note.isNew()) {
46646           _t.append("note.newDescription")(select_default2(this));
46647         } else {
46648           _t.append("note.newComment")(select_default2(this));
46649         }
46650       });
46651       var commentTextarea = noteSaveEnter.append("textarea").attr("class", "new-comment-input").attr("placeholder", _t("note.inputPlaceholder")).attr("maxlength", 1e3).property("value", function(d2) {
46652         return d2.newComment;
46653       }).call(utilNoAuto).on("keydown.note-input", keydown).on("input.note-input", changeInput).on("blur.note-input", changeInput);
46654       if (!commentTextarea.empty() && _newNote) {
46655         commentTextarea.node().focus();
46656       }
46657       noteSave = noteSaveEnter.merge(noteSave).call(userDetails).call(noteSaveButtons);
46658       function keydown(d3_event) {
46659         if (!(d3_event.keyCode === 13 && // ↩ Return
46660         d3_event.metaKey)) return;
46661         var osm = services.osm;
46662         if (!osm) return;
46663         var hasAuth = osm.authenticated();
46664         if (!hasAuth) return;
46665         if (!_note.newComment) return;
46666         d3_event.preventDefault();
46667         select_default2(this).on("keydown.note-input", null);
46668         window.setTimeout(function() {
46669           if (_note.isNew()) {
46670             noteSave.selectAll(".save-button").node().focus();
46671             clickSave(_note);
46672           } else {
46673             noteSave.selectAll(".comment-button").node().focus();
46674             clickComment(_note);
46675           }
46676         }, 10);
46677       }
46678       function changeInput() {
46679         var input = select_default2(this);
46680         var val = input.property("value").trim() || void 0;
46681         _note = _note.update({ newComment: val });
46682         var osm = services.osm;
46683         if (osm) {
46684           osm.replaceNote(_note);
46685         }
46686         noteSave.call(noteSaveButtons);
46687       }
46688     }
46689     function userDetails(selection2) {
46690       var detailSection = selection2.selectAll(".detail-section").data([0]);
46691       detailSection = detailSection.enter().append("div").attr("class", "detail-section").merge(detailSection);
46692       var osm = services.osm;
46693       if (!osm) return;
46694       var hasAuth = osm.authenticated();
46695       var authWarning = detailSection.selectAll(".auth-warning").data(hasAuth ? [] : [0]);
46696       authWarning.exit().transition().duration(200).style("opacity", 0).remove();
46697       var authEnter = authWarning.enter().insert("div", ".tag-reference-body").attr("class", "field-warning auth-warning").style("opacity", 0);
46698       authEnter.call(svgIcon("#iD-icon-alert", "inline"));
46699       authEnter.append("span").call(_t.append("note.login"));
46700       authEnter.append("a").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).append("span").call(_t.append("login")).on("click.note-login", function(d3_event) {
46701         d3_event.preventDefault();
46702         osm.authenticate();
46703       });
46704       authEnter.transition().duration(200).style("opacity", 1);
46705       var prose = detailSection.selectAll(".note-save-prose").data(hasAuth ? [0] : []);
46706       prose.exit().remove();
46707       prose = prose.enter().append("p").attr("class", "note-save-prose").call(_t.append("note.upload_explanation")).merge(prose);
46708       osm.userDetails(function(err, user) {
46709         if (err) return;
46710         var userLink = select_default2(document.createElement("div"));
46711         if (user.image_url) {
46712           userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
46713         }
46714         userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
46715         prose.html(_t.html("note.upload_explanation_with_user", { user: { html: userLink.html() } }));
46716       });
46717     }
46718     function noteSaveButtons(selection2) {
46719       var osm = services.osm;
46720       var hasAuth = osm && osm.authenticated();
46721       var isSelected = _note && _note.id === context.selectedNoteID();
46722       var buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_note] : [], function(d2) {
46723         return d2.status + d2.id;
46724       });
46725       buttonSection.exit().remove();
46726       var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
46727       if (_note.isNew()) {
46728         buttonEnter.append("button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
46729         buttonEnter.append("button").attr("class", "button save-button action").call(_t.append("note.save"));
46730       } else {
46731         buttonEnter.append("button").attr("class", "button status-button action");
46732         buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("note.comment"));
46733       }
46734       buttonSection = buttonSection.merge(buttonEnter);
46735       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
46736       buttonSection.select(".save-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
46737       buttonSection.select(".status-button").attr("disabled", hasAuth ? null : true).each(function(d2) {
46738         var action = d2.status === "open" ? "close" : "open";
46739         var andComment = d2.newComment ? "_comment" : "";
46740         _t.addOrUpdate("note." + action + andComment)(select_default2(this));
46741       }).on("click.status", clickStatus);
46742       buttonSection.select(".comment-button").attr("disabled", isSaveDisabled).on("click.comment", clickComment);
46743       function isSaveDisabled(d2) {
46744         return hasAuth && d2.status === "open" && d2.newComment ? null : true;
46745       }
46746     }
46747     function clickCancel(d3_event, d2) {
46748       this.blur();
46749       var osm = services.osm;
46750       if (osm) {
46751         osm.removeNote(d2);
46752       }
46753       context.enter(modeBrowse(context));
46754       dispatch14.call("change");
46755     }
46756     function clickSave(d3_event, d2) {
46757       this.blur();
46758       var osm = services.osm;
46759       if (osm) {
46760         osm.postNoteCreate(d2, function(err, note) {
46761           dispatch14.call("change", note);
46762         });
46763       }
46764     }
46765     function clickStatus(d3_event, d2) {
46766       this.blur();
46767       var osm = services.osm;
46768       if (osm) {
46769         var setStatus = d2.status === "open" ? "closed" : "open";
46770         osm.postNoteUpdate(d2, setStatus, function(err, note) {
46771           dispatch14.call("change", note);
46772         });
46773       }
46774     }
46775     function clickComment(d3_event, d2) {
46776       this.blur();
46777       var osm = services.osm;
46778       if (osm) {
46779         osm.postNoteUpdate(d2, d2.status, function(err, note) {
46780           dispatch14.call("change", note);
46781         });
46782       }
46783     }
46784     noteEditor.note = function(val) {
46785       if (!arguments.length) return _note;
46786       _note = val;
46787       return noteEditor;
46788     };
46789     noteEditor.newNote = function(val) {
46790       if (!arguments.length) return _newNote;
46791       _newNote = val;
46792       return noteEditor;
46793     };
46794     return utilRebind(noteEditor, dispatch14, "on");
46795   }
46796
46797   // modules/modes/select_note.js
46798   function modeSelectNote(context, selectedNoteID) {
46799     var mode = {
46800       id: "select-note",
46801       button: "browse"
46802     };
46803     var _keybinding = utilKeybinding("select-note");
46804     var _noteEditor = uiNoteEditor(context).on("change", function() {
46805       context.map().pan([0, 0]);
46806       var note = checkSelectedID();
46807       if (!note) return;
46808       context.ui().sidebar.show(_noteEditor.note(note));
46809     });
46810     var _behaviors = [
46811       behaviorBreathe(context),
46812       behaviorHover(context),
46813       behaviorSelect(context),
46814       behaviorLasso(context),
46815       modeDragNode(context).behavior,
46816       modeDragNote(context).behavior
46817     ];
46818     var _newFeature = false;
46819     function checkSelectedID() {
46820       if (!services.osm) return;
46821       var note = services.osm.getNote(selectedNoteID);
46822       if (!note) {
46823         context.enter(modeBrowse(context));
46824       }
46825       return note;
46826     }
46827     function selectNote(d3_event, drawn) {
46828       if (!checkSelectedID()) return;
46829       var selection2 = context.surface().selectAll(".layer-notes .note-" + selectedNoteID);
46830       if (selection2.empty()) {
46831         var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
46832         if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
46833           context.enter(modeBrowse(context));
46834         }
46835       } else {
46836         selection2.classed("selected", true);
46837         context.selectedNoteID(selectedNoteID);
46838       }
46839     }
46840     function esc() {
46841       if (context.container().select(".combobox").size()) return;
46842       context.enter(modeBrowse(context));
46843     }
46844     mode.zoomToSelected = function() {
46845       if (!services.osm) return;
46846       var note = services.osm.getNote(selectedNoteID);
46847       if (note) {
46848         context.map().centerZoomEase(note.loc, 20);
46849       }
46850     };
46851     mode.newFeature = function(val) {
46852       if (!arguments.length) return _newFeature;
46853       _newFeature = val;
46854       return mode;
46855     };
46856     mode.enter = function() {
46857       var note = checkSelectedID();
46858       if (!note) return;
46859       _behaviors.forEach(context.install);
46860       _keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
46861       select_default2(document).call(_keybinding);
46862       selectNote();
46863       var sidebar = context.ui().sidebar;
46864       sidebar.show(_noteEditor.note(note).newNote(_newFeature));
46865       sidebar.expand(sidebar.intersects(note.extent()));
46866       context.map().on("drawn.select", selectNote);
46867     };
46868     mode.exit = function() {
46869       _behaviors.forEach(context.uninstall);
46870       select_default2(document).call(_keybinding.unbind);
46871       context.surface().selectAll(".layer-notes .selected").classed("selected hover", false);
46872       context.map().on("drawn.select", null);
46873       context.ui().sidebar.hide();
46874       context.selectedNoteID(null);
46875     };
46876     return mode;
46877   }
46878
46879   // modules/modes/add_note.js
46880   function modeAddNote(context) {
46881     var mode = {
46882       id: "add-note",
46883       button: "note",
46884       description: _t.append("modes.add_note.description"),
46885       key: _t("modes.add_note.key")
46886     };
46887     var behavior = behaviorDraw(context).on("click", add).on("cancel", cancel).on("finish", cancel);
46888     function add(loc) {
46889       var osm = services.osm;
46890       if (!osm) return;
46891       var note = osmNote({ loc, status: "open", comments: [] });
46892       osm.replaceNote(note);
46893       context.map().pan([0, 0]);
46894       context.selectedNoteID(note.id).enter(modeSelectNote(context, note.id).newFeature(true));
46895     }
46896     function cancel() {
46897       context.enter(modeBrowse(context));
46898     }
46899     mode.enter = function() {
46900       context.install(behavior);
46901     };
46902     mode.exit = function() {
46903       context.uninstall(behavior);
46904     };
46905     return mode;
46906   }
46907
46908   // modules/util/jxon.js
46909   var JXON = new function() {
46910     var sValueProp = "keyValue", sAttributesProp = "keyAttributes", sAttrPref = "@", aCache = [], rIsNull = /^\s*$/, rIsBool = /^(?:true|false)$/i;
46911     function parseText(sValue) {
46912       if (rIsNull.test(sValue)) {
46913         return null;
46914       }
46915       if (rIsBool.test(sValue)) {
46916         return sValue.toLowerCase() === "true";
46917       }
46918       if (isFinite(sValue)) {
46919         return parseFloat(sValue);
46920       }
46921       if (isFinite(Date.parse(sValue))) {
46922         return new Date(sValue);
46923       }
46924       return sValue;
46925     }
46926     function EmptyTree() {
46927     }
46928     EmptyTree.prototype.toString = function() {
46929       return "null";
46930     };
46931     EmptyTree.prototype.valueOf = function() {
46932       return null;
46933     };
46934     function objectify(vValue) {
46935       return vValue === null ? new EmptyTree() : vValue instanceof Object ? vValue : new vValue.constructor(vValue);
46936     }
46937     function createObjTree(oParentNode, nVerb, bFreeze, bNesteAttr) {
46938       var nLevelStart = aCache.length, bChildren = oParentNode.hasChildNodes(), bAttributes = oParentNode.hasAttributes(), bHighVerb = Boolean(nVerb & 2);
46939       var sProp, vContent, nLength = 0, sCollectedTxt = "", vResult = bHighVerb ? {} : (
46940         /* put here the default value for empty nodes: */
46941         true
46942       );
46943       if (bChildren) {
46944         for (var oNode, nItem = 0; nItem < oParentNode.childNodes.length; nItem++) {
46945           oNode = oParentNode.childNodes.item(nItem);
46946           if (oNode.nodeType === 4) {
46947             sCollectedTxt += oNode.nodeValue;
46948           } else if (oNode.nodeType === 3) {
46949             sCollectedTxt += oNode.nodeValue.trim();
46950           } else if (oNode.nodeType === 1 && !oNode.prefix) {
46951             aCache.push(oNode);
46952           }
46953         }
46954       }
46955       var nLevelEnd = aCache.length, vBuiltVal = parseText(sCollectedTxt);
46956       if (!bHighVerb && (bChildren || bAttributes)) {
46957         vResult = nVerb === 0 ? objectify(vBuiltVal) : {};
46958       }
46959       for (var nElId = nLevelStart; nElId < nLevelEnd; nElId++) {
46960         sProp = aCache[nElId].nodeName.toLowerCase();
46961         vContent = createObjTree(aCache[nElId], nVerb, bFreeze, bNesteAttr);
46962         if (vResult.hasOwnProperty(sProp)) {
46963           if (vResult[sProp].constructor !== Array) {
46964             vResult[sProp] = [vResult[sProp]];
46965           }
46966           vResult[sProp].push(vContent);
46967         } else {
46968           vResult[sProp] = vContent;
46969           nLength++;
46970         }
46971       }
46972       if (bAttributes) {
46973         var nAttrLen = oParentNode.attributes.length, sAPrefix = bNesteAttr ? "" : sAttrPref, oAttrParent = bNesteAttr ? {} : vResult;
46974         for (var oAttrib, nAttrib = 0; nAttrib < nAttrLen; nLength++, nAttrib++) {
46975           oAttrib = oParentNode.attributes.item(nAttrib);
46976           oAttrParent[sAPrefix + oAttrib.name.toLowerCase()] = parseText(oAttrib.value.trim());
46977         }
46978         if (bNesteAttr) {
46979           if (bFreeze) {
46980             Object.freeze(oAttrParent);
46981           }
46982           vResult[sAttributesProp] = oAttrParent;
46983           nLength -= nAttrLen - 1;
46984         }
46985       }
46986       if (nVerb === 3 || (nVerb === 2 || nVerb === 1 && nLength > 0) && sCollectedTxt) {
46987         vResult[sValueProp] = vBuiltVal;
46988       } else if (!bHighVerb && nLength === 0 && sCollectedTxt) {
46989         vResult = vBuiltVal;
46990       }
46991       if (bFreeze && (bHighVerb || nLength > 0)) {
46992         Object.freeze(vResult);
46993       }
46994       aCache.length = nLevelStart;
46995       return vResult;
46996     }
46997     function loadObjTree(oXMLDoc, oParentEl, oParentObj) {
46998       var vValue, oChild;
46999       if (oParentObj instanceof String || oParentObj instanceof Number || oParentObj instanceof Boolean) {
47000         oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toString()));
47001       } else if (oParentObj.constructor === Date) {
47002         oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toGMTString()));
47003       }
47004       for (var sName in oParentObj) {
47005         vValue = oParentObj[sName];
47006         if (isFinite(sName) || vValue instanceof Function) {
47007           continue;
47008         }
47009         if (sName === sValueProp) {
47010           if (vValue !== null && vValue !== true) {
47011             oParentEl.appendChild(oXMLDoc.createTextNode(vValue.constructor === Date ? vValue.toGMTString() : String(vValue)));
47012           }
47013         } else if (sName === sAttributesProp) {
47014           for (var sAttrib in vValue) {
47015             oParentEl.setAttribute(sAttrib, vValue[sAttrib]);
47016           }
47017         } else if (sName.charAt(0) === sAttrPref) {
47018           oParentEl.setAttribute(sName.slice(1), vValue);
47019         } else if (vValue.constructor === Array) {
47020           for (var nItem = 0; nItem < vValue.length; nItem++) {
47021             oChild = oXMLDoc.createElement(sName);
47022             loadObjTree(oXMLDoc, oChild, vValue[nItem]);
47023             oParentEl.appendChild(oChild);
47024           }
47025         } else {
47026           oChild = oXMLDoc.createElement(sName);
47027           if (vValue instanceof Object) {
47028             loadObjTree(oXMLDoc, oChild, vValue);
47029           } else if (vValue !== null && vValue !== true) {
47030             oChild.appendChild(oXMLDoc.createTextNode(vValue.toString()));
47031           }
47032           oParentEl.appendChild(oChild);
47033         }
47034       }
47035     }
47036     this.build = function(oXMLParent, nVerbosity, bFreeze, bNesteAttributes) {
47037       var _nVerb = arguments.length > 1 && typeof nVerbosity === "number" ? nVerbosity & 3 : (
47038         /* put here the default verbosity level: */
47039         1
47040       );
47041       return createObjTree(oXMLParent, _nVerb, bFreeze || false, arguments.length > 3 ? bNesteAttributes : _nVerb === 3);
47042     };
47043     this.unbuild = function(oObjTree) {
47044       var oNewDoc = document.implementation.createDocument("", "", null);
47045       loadObjTree(oNewDoc, oNewDoc, oObjTree);
47046       return oNewDoc;
47047     };
47048     this.stringify = function(oObjTree) {
47049       return new XMLSerializer().serializeToString(JXON.unbuild(oObjTree));
47050     };
47051   }();
47052
47053   // modules/ui/conflicts.js
47054   function uiConflicts(context) {
47055     var dispatch14 = dispatch_default("cancel", "save");
47056     var keybinding = utilKeybinding("conflicts");
47057     var _origChanges;
47058     var _conflictList;
47059     var _shownConflictIndex;
47060     function keybindingOn() {
47061       select_default2(document).call(keybinding.on("\u238B", cancel, true));
47062     }
47063     function keybindingOff() {
47064       select_default2(document).call(keybinding.unbind);
47065     }
47066     function tryAgain() {
47067       keybindingOff();
47068       dispatch14.call("save");
47069     }
47070     function cancel() {
47071       keybindingOff();
47072       dispatch14.call("cancel");
47073     }
47074     function conflicts(selection2) {
47075       keybindingOn();
47076       var headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
47077       headerEnter.append("button").attr("class", "fr").attr("title", _t("icons.close")).on("click", cancel).call(svgIcon("#iD-icon-close"));
47078       headerEnter.append("h2").call(_t.append("save.conflict.header"));
47079       var bodyEnter = selection2.selectAll(".body").data([0]).enter().append("div").attr("class", "body fillL");
47080       var conflictsHelpEnter = bodyEnter.append("div").attr("class", "conflicts-help").call(_t.append("save.conflict.help"));
47081       var changeset = new osmChangeset();
47082       delete changeset.id;
47083       var data = JXON.stringify(changeset.osmChangeJXON(_origChanges));
47084       var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
47085       var fileName = "changes.osc";
47086       var linkEnter = conflictsHelpEnter.selectAll(".download-changes").append("a").attr("class", "download-changes");
47087       linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
47088       linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("save.conflict.download_changes"));
47089       bodyEnter.append("div").attr("class", "conflict-container fillL3").call(showConflict, 0);
47090       bodyEnter.append("div").attr("class", "conflicts-done").attr("opacity", 0).style("display", "none").call(_t.append("save.conflict.done"));
47091       var buttonsEnter = bodyEnter.append("div").attr("class", "buttons col12 joined conflicts-buttons");
47092       buttonsEnter.append("button").attr("disabled", _conflictList.length > 1).attr("class", "action conflicts-button col6").call(_t.append("save.title")).on("click.try_again", tryAgain);
47093       buttonsEnter.append("button").attr("class", "secondary-action conflicts-button col6").call(_t.append("confirm.cancel")).on("click.cancel", cancel);
47094     }
47095     function showConflict(selection2, index) {
47096       index = utilWrap(index, _conflictList.length);
47097       _shownConflictIndex = index;
47098       var parent = select_default2(selection2.node().parentNode);
47099       if (index === _conflictList.length - 1) {
47100         window.setTimeout(function() {
47101           parent.select(".conflicts-button").attr("disabled", null);
47102           parent.select(".conflicts-done").transition().attr("opacity", 1).style("display", "block");
47103         }, 250);
47104       }
47105       var conflict = selection2.selectAll(".conflict").data([_conflictList[index]]);
47106       conflict.exit().remove();
47107       var conflictEnter = conflict.enter().append("div").attr("class", "conflict");
47108       conflictEnter.append("h4").attr("class", "conflict-count").call(_t.append("save.conflict.count", { num: index + 1, total: _conflictList.length }));
47109       conflictEnter.append("a").attr("class", "conflict-description").attr("href", "#").text(function(d2) {
47110         return d2.name;
47111       }).on("click", function(d3_event, d2) {
47112         d3_event.preventDefault();
47113         zoomToEntity(d2.id);
47114       });
47115       var details = conflictEnter.append("div").attr("class", "conflict-detail-container");
47116       details.append("ul").attr("class", "conflict-detail-list").selectAll("li").data(function(d2) {
47117         return d2.details || [];
47118       }).enter().append("li").attr("class", "conflict-detail-item").html(function(d2) {
47119         return d2;
47120       });
47121       details.append("div").attr("class", "conflict-choices").call(addChoices);
47122       details.append("div").attr("class", "conflict-nav-buttons joined cf").selectAll("button").data(["previous", "next"]).enter().append("button").attr("class", "conflict-nav-button action col6").attr("disabled", function(d2, i3) {
47123         return i3 === 0 && index === 0 || i3 === 1 && index === _conflictList.length - 1 || null;
47124       }).on("click", function(d3_event, d2) {
47125         d3_event.preventDefault();
47126         var container = parent.selectAll(".conflict-container");
47127         var sign2 = d2 === "previous" ? -1 : 1;
47128         container.selectAll(".conflict").remove();
47129         container.call(showConflict, index + sign2);
47130       }).each(function(d2) {
47131         _t.append("save.conflict." + d2)(select_default2(this));
47132       });
47133     }
47134     function addChoices(selection2) {
47135       var choices = selection2.append("ul").attr("class", "layer-list").selectAll("li").data(function(d2) {
47136         return d2.choices || [];
47137       });
47138       var choicesEnter = choices.enter().append("li").attr("class", "layer");
47139       var labelEnter = choicesEnter.append("label");
47140       labelEnter.append("input").attr("type", "radio").attr("name", function(d2) {
47141         return d2.id;
47142       }).on("change", function(d3_event, d2) {
47143         var ul = this.parentNode.parentNode.parentNode;
47144         ul.__data__.chosen = d2.id;
47145         choose(d3_event, ul, d2);
47146       });
47147       labelEnter.append("span").text(function(d2) {
47148         return d2.text;
47149       });
47150       choicesEnter.merge(choices).each(function(d2) {
47151         var ul = this.parentNode;
47152         if (ul.__data__.chosen === d2.id) {
47153           choose(null, ul, d2);
47154         }
47155       });
47156     }
47157     function choose(d3_event, ul, datum2) {
47158       if (d3_event) d3_event.preventDefault();
47159       select_default2(ul).selectAll("li").classed("active", function(d2) {
47160         return d2 === datum2;
47161       }).selectAll("input").property("checked", function(d2) {
47162         return d2 === datum2;
47163       });
47164       var extent = geoExtent();
47165       var entity;
47166       entity = context.graph().hasEntity(datum2.id);
47167       if (entity) extent._extend(entity.extent(context.graph()));
47168       datum2.action();
47169       entity = context.graph().hasEntity(datum2.id);
47170       if (entity) extent._extend(entity.extent(context.graph()));
47171       zoomToEntity(datum2.id, extent);
47172     }
47173     function zoomToEntity(id2, extent) {
47174       context.surface().selectAll(".hover").classed("hover", false);
47175       var entity = context.graph().hasEntity(id2);
47176       if (entity) {
47177         if (extent) {
47178           context.map().trimmedExtent(extent);
47179         } else {
47180           context.map().zoomToEase(entity);
47181         }
47182         context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
47183       }
47184     }
47185     conflicts.conflictList = function(_2) {
47186       if (!arguments.length) return _conflictList;
47187       _conflictList = _2;
47188       return conflicts;
47189     };
47190     conflicts.origChanges = function(_2) {
47191       if (!arguments.length) return _origChanges;
47192       _origChanges = _2;
47193       return conflicts;
47194     };
47195     conflicts.shownEntityIds = function() {
47196       if (_conflictList && typeof _shownConflictIndex === "number") {
47197         return [_conflictList[_shownConflictIndex].id];
47198       }
47199       return [];
47200     };
47201     return utilRebind(conflicts, dispatch14, "on");
47202   }
47203
47204   // modules/ui/confirm.js
47205   function uiConfirm(selection2) {
47206     var modalSelection = uiModal(selection2);
47207     modalSelection.select(".modal").classed("modal-alert", true);
47208     var section = modalSelection.select(".content");
47209     section.append("div").attr("class", "modal-section header");
47210     section.append("div").attr("class", "modal-section message-text");
47211     var buttons = section.append("div").attr("class", "modal-section buttons cf");
47212     modalSelection.okButton = function() {
47213       buttons.append("button").attr("class", "button ok-button action").on("click.confirm", function() {
47214         modalSelection.remove();
47215       }).call(_t.append("confirm.okay")).node().focus();
47216       return modalSelection;
47217     };
47218     return modalSelection;
47219   }
47220
47221   // modules/ui/commit.js
47222   var import_fast_deep_equal10 = __toESM(require_fast_deep_equal());
47223
47224   // modules/ui/popover.js
47225   var _popoverID = 0;
47226   function uiPopover(klass) {
47227     var _id = _popoverID++;
47228     var _anchorSelection = select_default2(null);
47229     var popover = function(selection2) {
47230       _anchorSelection = selection2;
47231       selection2.each(setup);
47232     };
47233     var _animation = utilFunctor(false);
47234     var _placement = utilFunctor("top");
47235     var _alignment = utilFunctor("center");
47236     var _scrollContainer = utilFunctor(select_default2(null));
47237     var _content;
47238     var _displayType = utilFunctor("");
47239     var _hasArrow = utilFunctor(true);
47240     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
47241     popover.displayType = function(val) {
47242       if (arguments.length) {
47243         _displayType = utilFunctor(val);
47244         return popover;
47245       } else {
47246         return _displayType;
47247       }
47248     };
47249     popover.hasArrow = function(val) {
47250       if (arguments.length) {
47251         _hasArrow = utilFunctor(val);
47252         return popover;
47253       } else {
47254         return _hasArrow;
47255       }
47256     };
47257     popover.placement = function(val) {
47258       if (arguments.length) {
47259         _placement = utilFunctor(val);
47260         return popover;
47261       } else {
47262         return _placement;
47263       }
47264     };
47265     popover.alignment = function(val) {
47266       if (arguments.length) {
47267         _alignment = utilFunctor(val);
47268         return popover;
47269       } else {
47270         return _alignment;
47271       }
47272     };
47273     popover.scrollContainer = function(val) {
47274       if (arguments.length) {
47275         _scrollContainer = utilFunctor(val);
47276         return popover;
47277       } else {
47278         return _scrollContainer;
47279       }
47280     };
47281     popover.content = function(val) {
47282       if (arguments.length) {
47283         _content = val;
47284         return popover;
47285       } else {
47286         return _content;
47287       }
47288     };
47289     popover.isShown = function() {
47290       var popoverSelection = _anchorSelection.select(".popover-" + _id);
47291       return !popoverSelection.empty() && popoverSelection.classed("in");
47292     };
47293     popover.show = function() {
47294       _anchorSelection.each(show);
47295     };
47296     popover.updateContent = function() {
47297       _anchorSelection.each(updateContent);
47298     };
47299     popover.hide = function() {
47300       _anchorSelection.each(hide);
47301     };
47302     popover.toggle = function() {
47303       _anchorSelection.each(toggle);
47304     };
47305     popover.destroy = function(selection2, selector) {
47306       selector = selector || ".popover-" + _id;
47307       selection2.on(_pointerPrefix + "enter.popover", null).on(_pointerPrefix + "leave.popover", null).on(_pointerPrefix + "up.popover", null).on(_pointerPrefix + "down.popover", null).on("click.popover", null).attr("title", function() {
47308         return this.getAttribute("data-original-title") || this.getAttribute("title");
47309       }).attr("data-original-title", null).selectAll(selector).remove();
47310     };
47311     popover.destroyAny = function(selection2) {
47312       selection2.call(popover.destroy, ".popover");
47313     };
47314     function setup() {
47315       var anchor = select_default2(this);
47316       var animate = _animation.apply(this, arguments);
47317       var popoverSelection = anchor.selectAll(".popover-" + _id).data([0]);
47318       var enter = popoverSelection.enter().append("div").attr("class", "popover popover-" + _id + " " + (klass ? klass : "")).classed("arrowed", _hasArrow.apply(this, arguments));
47319       enter.append("div").attr("class", "popover-arrow");
47320       enter.append("div").attr("class", "popover-inner");
47321       popoverSelection = enter.merge(popoverSelection);
47322       if (animate) {
47323         popoverSelection.classed("fade", true);
47324       }
47325       var display = _displayType.apply(this, arguments);
47326       if (display === "hover") {
47327         var _lastNonMouseEnterTime;
47328         anchor.on(_pointerPrefix + "enter.popover", function(d3_event) {
47329           if (d3_event.pointerType) {
47330             if (d3_event.pointerType !== "mouse") {
47331               _lastNonMouseEnterTime = d3_event.timeStamp;
47332               return;
47333             } else if (_lastNonMouseEnterTime && d3_event.timeStamp - _lastNonMouseEnterTime < 1500) {
47334               return;
47335             }
47336           }
47337           if (d3_event.buttons !== 0) return;
47338           show.apply(this, arguments);
47339         }).on(_pointerPrefix + "leave.popover", function() {
47340           hide.apply(this, arguments);
47341         }).on("focus.popover", function() {
47342           show.apply(this, arguments);
47343         }).on("blur.popover", function() {
47344           hide.apply(this, arguments);
47345         });
47346       } else if (display === "clickFocus") {
47347         anchor.on(_pointerPrefix + "down.popover", function(d3_event) {
47348           d3_event.preventDefault();
47349           d3_event.stopPropagation();
47350         }).on(_pointerPrefix + "up.popover", function(d3_event) {
47351           d3_event.preventDefault();
47352           d3_event.stopPropagation();
47353         }).on("click.popover", toggle);
47354         popoverSelection.attr("tabindex", 0).on("blur.popover", function() {
47355           anchor.each(function() {
47356             hide.apply(this, arguments);
47357           });
47358         });
47359       }
47360     }
47361     function show() {
47362       var anchor = select_default2(this);
47363       var popoverSelection = anchor.selectAll(".popover-" + _id);
47364       if (popoverSelection.empty()) {
47365         anchor.call(popover.destroy);
47366         anchor.each(setup);
47367         popoverSelection = anchor.selectAll(".popover-" + _id);
47368       }
47369       popoverSelection.classed("in", true);
47370       var displayType = _displayType.apply(this, arguments);
47371       if (displayType === "clickFocus") {
47372         anchor.classed("active", true);
47373         popoverSelection.node().focus();
47374       }
47375       anchor.each(updateContent);
47376     }
47377     function updateContent() {
47378       var anchor = select_default2(this);
47379       if (_content) {
47380         anchor.selectAll(".popover-" + _id + " > .popover-inner").call(_content.apply(this, arguments));
47381       }
47382       updatePosition.apply(this, arguments);
47383       updatePosition.apply(this, arguments);
47384       updatePosition.apply(this, arguments);
47385     }
47386     function updatePosition() {
47387       var anchor = select_default2(this);
47388       var popoverSelection = anchor.selectAll(".popover-" + _id);
47389       var scrollContainer = _scrollContainer && _scrollContainer.apply(this, arguments);
47390       var scrollNode = scrollContainer && !scrollContainer.empty() && scrollContainer.node();
47391       var scrollLeft = scrollNode ? scrollNode.scrollLeft : 0;
47392       var scrollTop = scrollNode ? scrollNode.scrollTop : 0;
47393       var placement = _placement.apply(this, arguments);
47394       popoverSelection.classed("left", false).classed("right", false).classed("top", false).classed("bottom", false).classed(placement, true);
47395       var alignment = _alignment.apply(this, arguments);
47396       var alignFactor = 0.5;
47397       if (alignment === "leading") {
47398         alignFactor = 0;
47399       } else if (alignment === "trailing") {
47400         alignFactor = 1;
47401       }
47402       var anchorFrame = getFrame(anchor.node());
47403       var popoverFrame = getFrame(popoverSelection.node());
47404       var position;
47405       switch (placement) {
47406         case "top":
47407           position = {
47408             x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
47409             y: anchorFrame.y - popoverFrame.h
47410           };
47411           break;
47412         case "bottom":
47413           position = {
47414             x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
47415             y: anchorFrame.y + anchorFrame.h
47416           };
47417           break;
47418         case "left":
47419           position = {
47420             x: anchorFrame.x - popoverFrame.w,
47421             y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
47422           };
47423           break;
47424         case "right":
47425           position = {
47426             x: anchorFrame.x + anchorFrame.w,
47427             y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
47428           };
47429           break;
47430       }
47431       if (position) {
47432         if (scrollNode && (placement === "top" || placement === "bottom")) {
47433           var initialPosX = position.x;
47434           if (position.x + popoverFrame.w > scrollNode.offsetWidth - 10) {
47435             position.x = scrollNode.offsetWidth - 10 - popoverFrame.w;
47436           } else if (position.x < 10) {
47437             position.x = 10;
47438           }
47439           var arrow = anchor.selectAll(".popover-" + _id + " > .popover-arrow");
47440           var arrowPosX = Math.min(Math.max(popoverFrame.w / 2 - (position.x - initialPosX), 10), popoverFrame.w - 10);
47441           arrow.style("left", ~~arrowPosX + "px");
47442         }
47443         popoverSelection.style("left", ~~position.x + "px").style("top", ~~position.y + "px");
47444       } else {
47445         popoverSelection.style("left", null).style("top", null);
47446       }
47447       function getFrame(node) {
47448         var positionStyle = select_default2(node).style("position");
47449         if (positionStyle === "absolute" || positionStyle === "static") {
47450           return {
47451             x: node.offsetLeft - scrollLeft,
47452             y: node.offsetTop - scrollTop,
47453             w: node.offsetWidth,
47454             h: node.offsetHeight
47455           };
47456         } else {
47457           return {
47458             x: 0,
47459             y: 0,
47460             w: node.offsetWidth,
47461             h: node.offsetHeight
47462           };
47463         }
47464       }
47465     }
47466     function hide() {
47467       var anchor = select_default2(this);
47468       if (_displayType.apply(this, arguments) === "clickFocus") {
47469         anchor.classed("active", false);
47470       }
47471       anchor.selectAll(".popover-" + _id).classed("in", false);
47472     }
47473     function toggle() {
47474       if (select_default2(this).select(".popover-" + _id).classed("in")) {
47475         hide.apply(this, arguments);
47476       } else {
47477         show.apply(this, arguments);
47478       }
47479     }
47480     return popover;
47481   }
47482
47483   // modules/ui/tooltip.js
47484   function uiTooltip(klass) {
47485     var tooltip = uiPopover((klass || "") + " tooltip").displayType("hover");
47486     var _title = function() {
47487       var title = this.getAttribute("data-original-title");
47488       if (title) {
47489         return title;
47490       } else {
47491         title = this.getAttribute("title");
47492         this.removeAttribute("title");
47493         this.setAttribute("data-original-title", title);
47494       }
47495       return title;
47496     };
47497     var _heading = utilFunctor(null);
47498     var _keys = utilFunctor(null);
47499     tooltip.title = function(val) {
47500       if (!arguments.length) return _title;
47501       _title = utilFunctor(val);
47502       return tooltip;
47503     };
47504     tooltip.heading = function(val) {
47505       if (!arguments.length) return _heading;
47506       _heading = utilFunctor(val);
47507       return tooltip;
47508     };
47509     tooltip.keys = function(val) {
47510       if (!arguments.length) return _keys;
47511       _keys = utilFunctor(val);
47512       return tooltip;
47513     };
47514     tooltip.content(function() {
47515       var heading2 = _heading.apply(this, arguments);
47516       var text = _title.apply(this, arguments);
47517       var keys2 = _keys.apply(this, arguments);
47518       var headingCallback = typeof heading2 === "function" ? heading2 : (s2) => s2.text(heading2);
47519       var textCallback = typeof text === "function" ? text : (s2) => s2.text(text);
47520       return function(selection2) {
47521         var headingSelect = selection2.selectAll(".tooltip-heading").data(heading2 ? [heading2] : []);
47522         headingSelect.exit().remove();
47523         headingSelect.enter().append("div").attr("class", "tooltip-heading").merge(headingSelect).text("").call(headingCallback);
47524         var textSelect = selection2.selectAll(".tooltip-text").data(text ? [text] : []);
47525         textSelect.exit().remove();
47526         textSelect.enter().append("div").attr("class", "tooltip-text").merge(textSelect).text("").call(textCallback);
47527         var keyhintWrap = selection2.selectAll(".keyhint-wrap").data(keys2 && keys2.length ? [0] : []);
47528         keyhintWrap.exit().remove();
47529         var keyhintWrapEnter = keyhintWrap.enter().append("div").attr("class", "keyhint-wrap");
47530         keyhintWrapEnter.append("span").call(_t.append("tooltip_keyhint"));
47531         keyhintWrap = keyhintWrapEnter.merge(keyhintWrap);
47532         keyhintWrap.selectAll("kbd.shortcut").data(keys2 && keys2.length ? keys2 : []).enter().append("kbd").attr("class", "shortcut").text(function(d2) {
47533           return d2;
47534         });
47535       };
47536     });
47537     return tooltip;
47538   }
47539
47540   // modules/ui/combobox.js
47541   var _comboHideTimerID;
47542   function uiCombobox(context, klass) {
47543     var dispatch14 = dispatch_default("accept", "cancel", "update");
47544     var container = context.container();
47545     var _suggestions = [];
47546     var _data = [];
47547     var _fetched = {};
47548     var _selected = null;
47549     var _canAutocomplete = true;
47550     var _caseSensitive = false;
47551     var _cancelFetch = false;
47552     var _minItems = 2;
47553     var _tDown = 0;
47554     var _mouseEnterHandler, _mouseLeaveHandler;
47555     var _fetcher = function(val, cb) {
47556       cb(_data.filter(function(d2) {
47557         var terms = d2.terms || [];
47558         terms.push(d2.value);
47559         if (d2.key) {
47560           terms.push(d2.key);
47561         }
47562         return terms.some(function(term) {
47563           return term.toString().toLowerCase().indexOf(val.toLowerCase()) !== -1;
47564         });
47565       }));
47566     };
47567     var combobox = function(input, attachTo) {
47568       if (!input || input.empty()) return;
47569       input.classed("combobox-input", true).on("focus.combo-input", focus).on("blur.combo-input", blur).on("keydown.combo-input", keydown).on("keyup.combo-input", keyup).on("input.combo-input", change).on("mousedown.combo-input", mousedown).each(function() {
47570         var parent = this.parentNode;
47571         var sibling = this.nextSibling;
47572         select_default2(parent).selectAll(".combobox-caret").filter(function(d2) {
47573           return d2 === input.node();
47574         }).data([input.node()]).enter().insert("div", function() {
47575           return sibling;
47576         }).attr("class", "combobox-caret").on("mousedown.combo-caret", function(d3_event) {
47577           d3_event.preventDefault();
47578           input.node().focus();
47579           mousedown(d3_event);
47580         }).on("mouseup.combo-caret", function(d3_event) {
47581           d3_event.preventDefault();
47582           mouseup(d3_event);
47583         });
47584       });
47585       function mousedown(d3_event) {
47586         if (d3_event.button !== 0) return;
47587         if (input.classed("disabled")) return;
47588         _tDown = +/* @__PURE__ */ new Date();
47589         var start2 = input.property("selectionStart");
47590         var end = input.property("selectionEnd");
47591         if (start2 !== end) {
47592           var val = utilGetSetValue(input);
47593           input.node().setSelectionRange(val.length, val.length);
47594           return;
47595         }
47596         input.on("mouseup.combo-input", mouseup);
47597       }
47598       function mouseup(d3_event) {
47599         input.on("mouseup.combo-input", null);
47600         if (d3_event.button !== 0) return;
47601         if (input.classed("disabled")) return;
47602         if (input.node() !== document.activeElement) return;
47603         var start2 = input.property("selectionStart");
47604         var end = input.property("selectionEnd");
47605         if (start2 !== end) return;
47606         var combo = container.selectAll(".combobox");
47607         if (combo.empty() || combo.datum() !== input.node()) {
47608           var tOrig = _tDown;
47609           window.setTimeout(function() {
47610             if (tOrig !== _tDown) return;
47611             fetchComboData("", function() {
47612               show();
47613               render();
47614             });
47615           }, 250);
47616         } else {
47617           hide();
47618         }
47619       }
47620       function focus() {
47621         fetchComboData("");
47622       }
47623       function blur() {
47624         _comboHideTimerID = window.setTimeout(hide, 75);
47625       }
47626       function show() {
47627         hide();
47628         container.insert("div", ":first-child").datum(input.node()).attr("class", "combobox" + (klass ? " combobox-" + klass : "")).style("position", "absolute").style("display", "block").style("left", "0px").on("mousedown.combo-container", function(d3_event) {
47629           d3_event.preventDefault();
47630         });
47631         container.on("scroll.combo-scroll", render, true);
47632       }
47633       function hide() {
47634         if (_comboHideTimerID) {
47635           window.clearTimeout(_comboHideTimerID);
47636           _comboHideTimerID = void 0;
47637         }
47638         container.selectAll(".combobox").remove();
47639         container.on("scroll.combo-scroll", null);
47640       }
47641       function keydown(d3_event) {
47642         var shown = !container.selectAll(".combobox").empty();
47643         var tagName = input.node() ? input.node().tagName.toLowerCase() : "";
47644         switch (d3_event.keyCode) {
47645           case 8:
47646           // ⌫ Backspace
47647           case 46:
47648             d3_event.stopPropagation();
47649             _selected = null;
47650             render();
47651             input.on("input.combo-input", function() {
47652               var start2 = input.property("selectionStart");
47653               input.node().setSelectionRange(start2, start2);
47654               input.on("input.combo-input", change);
47655               change(false);
47656             });
47657             break;
47658           case 9:
47659             accept(d3_event);
47660             break;
47661           case 13:
47662             d3_event.preventDefault();
47663             d3_event.stopPropagation();
47664             accept(d3_event);
47665             break;
47666           case 38:
47667             if (tagName === "textarea" && !shown) return;
47668             d3_event.preventDefault();
47669             if (tagName === "input" && !shown) {
47670               show();
47671             }
47672             nav(-1);
47673             break;
47674           case 40:
47675             if (tagName === "textarea" && !shown) return;
47676             d3_event.preventDefault();
47677             if (tagName === "input" && !shown) {
47678               show();
47679             }
47680             nav(1);
47681             break;
47682         }
47683       }
47684       function keyup(d3_event) {
47685         switch (d3_event.keyCode) {
47686           case 27:
47687             cancel();
47688             break;
47689         }
47690       }
47691       function change(doAutoComplete) {
47692         if (doAutoComplete === void 0) doAutoComplete = true;
47693         fetchComboData(value(), function(skipAutosuggest) {
47694           _selected = null;
47695           var val = input.property("value");
47696           if (_suggestions.length) {
47697             if (doAutoComplete && !skipAutosuggest && input.property("selectionEnd") === val.length) {
47698               _selected = tryAutocomplete();
47699             }
47700             if (!_selected) {
47701               _selected = val;
47702             }
47703           }
47704           if (val.length) {
47705             var combo = container.selectAll(".combobox");
47706             if (combo.empty()) {
47707               show();
47708             }
47709           } else {
47710             hide();
47711           }
47712           render();
47713         });
47714       }
47715       function nav(dir) {
47716         if (_suggestions.length) {
47717           var index = -1;
47718           for (var i3 = 0; i3 < _suggestions.length; i3++) {
47719             if (_selected && _suggestions[i3].value === _selected) {
47720               index = i3;
47721               break;
47722             }
47723           }
47724           index = Math.max(Math.min(index + dir, _suggestions.length - 1), 0);
47725           _selected = _suggestions[index].value;
47726           utilGetSetValue(input, _selected);
47727           dispatch14.call("update");
47728         }
47729         render();
47730         ensureVisible();
47731       }
47732       function ensureVisible() {
47733         var combo = container.selectAll(".combobox");
47734         if (combo.empty()) return;
47735         var containerRect = container.node().getBoundingClientRect();
47736         var comboRect = combo.node().getBoundingClientRect();
47737         if (comboRect.bottom > containerRect.bottom) {
47738           var node = attachTo ? attachTo.node() : input.node();
47739           node.scrollIntoView({ behavior: "instant", block: "center" });
47740           render();
47741         }
47742         var selected = combo.selectAll(".combobox-option.selected").node();
47743         if (selected) {
47744           selected.scrollIntoView({ behavior: "smooth", block: "nearest" });
47745         }
47746       }
47747       function value() {
47748         var value2 = input.property("value");
47749         var start2 = input.property("selectionStart");
47750         var end = input.property("selectionEnd");
47751         if (start2 && end) {
47752           value2 = value2.substring(0, start2);
47753         }
47754         return value2;
47755       }
47756       function fetchComboData(v2, cb) {
47757         _cancelFetch = false;
47758         _fetcher.call(input, v2, function(results, skipAutosuggest) {
47759           if (_cancelFetch) return;
47760           _suggestions = results;
47761           results.forEach(function(d2) {
47762             _fetched[d2.value] = d2;
47763           });
47764           if (cb) {
47765             cb(skipAutosuggest);
47766           }
47767         });
47768       }
47769       function tryAutocomplete() {
47770         if (!_canAutocomplete) return;
47771         var val = _caseSensitive ? value() : value().toLowerCase();
47772         if (!val) return;
47773         if (isFinite(val)) return;
47774         const suggestionValues = [];
47775         _suggestions.forEach((s2) => {
47776           suggestionValues.push(s2.value);
47777           if (s2.key && s2.key !== s2.value) {
47778             suggestionValues.push(s2.key);
47779           }
47780         });
47781         var bestIndex = -1;
47782         for (var i3 = 0; i3 < suggestionValues.length; i3++) {
47783           var suggestion = suggestionValues[i3];
47784           var compare2 = _caseSensitive ? suggestion : suggestion.toLowerCase();
47785           if (compare2 === val) {
47786             bestIndex = i3;
47787             break;
47788           } else if (bestIndex === -1 && compare2.indexOf(val) === 0) {
47789             bestIndex = i3;
47790           }
47791         }
47792         if (bestIndex !== -1) {
47793           var bestVal = suggestionValues[bestIndex];
47794           input.property("value", bestVal);
47795           input.node().setSelectionRange(val.length, bestVal.length);
47796           dispatch14.call("update");
47797           return bestVal;
47798         }
47799       }
47800       function render() {
47801         if (_suggestions.length < _minItems || document.activeElement !== input.node()) {
47802           hide();
47803           return;
47804         }
47805         var shown = !container.selectAll(".combobox").empty();
47806         if (!shown) return;
47807         var combo = container.selectAll(".combobox");
47808         var options2 = combo.selectAll(".combobox-option").data(_suggestions, function(d2) {
47809           return d2.value;
47810         });
47811         options2.exit().remove();
47812         options2.enter().append("a").attr("class", function(d2) {
47813           return "combobox-option " + (d2.klass || "");
47814         }).attr("title", function(d2) {
47815           return d2.title;
47816         }).each(function(d2) {
47817           if (d2.display) {
47818             d2.display(select_default2(this));
47819           } else {
47820             select_default2(this).text(d2.value);
47821           }
47822         }).on("mouseenter", _mouseEnterHandler).on("mouseleave", _mouseLeaveHandler).merge(options2).classed("selected", function(d2) {
47823           return d2.value === _selected || d2.key === _selected;
47824         }).on("click.combo-option", accept).order();
47825         var node = attachTo ? attachTo.node() : input.node();
47826         var containerRect = container.node().getBoundingClientRect();
47827         var rect = node.getBoundingClientRect();
47828         combo.style("left", rect.left + 5 - containerRect.left + "px").style("width", rect.width - 10 + "px").style("top", rect.height + rect.top - containerRect.top + "px");
47829       }
47830       function accept(d3_event, d2) {
47831         _cancelFetch = true;
47832         var thiz = input.node();
47833         if (d2) {
47834           utilGetSetValue(input, d2.value);
47835           utilTriggerEvent(input, "change");
47836         }
47837         var val = utilGetSetValue(input);
47838         thiz.setSelectionRange(val.length, val.length);
47839         if (!d2) {
47840           d2 = _fetched[val];
47841         }
47842         dispatch14.call("accept", thiz, d2, val);
47843         hide();
47844       }
47845       function cancel() {
47846         _cancelFetch = true;
47847         var thiz = input.node();
47848         var val = utilGetSetValue(input);
47849         var start2 = input.property("selectionStart");
47850         var end = input.property("selectionEnd");
47851         val = val.slice(0, start2) + val.slice(end);
47852         utilGetSetValue(input, val);
47853         thiz.setSelectionRange(val.length, val.length);
47854         dispatch14.call("cancel", thiz);
47855         hide();
47856       }
47857     };
47858     combobox.canAutocomplete = function(val) {
47859       if (!arguments.length) return _canAutocomplete;
47860       _canAutocomplete = val;
47861       return combobox;
47862     };
47863     combobox.caseSensitive = function(val) {
47864       if (!arguments.length) return _caseSensitive;
47865       _caseSensitive = val;
47866       return combobox;
47867     };
47868     combobox.data = function(val) {
47869       if (!arguments.length) return _data;
47870       _data = val;
47871       return combobox;
47872     };
47873     combobox.fetcher = function(val) {
47874       if (!arguments.length) return _fetcher;
47875       _fetcher = val;
47876       return combobox;
47877     };
47878     combobox.minItems = function(val) {
47879       if (!arguments.length) return _minItems;
47880       _minItems = val;
47881       return combobox;
47882     };
47883     combobox.itemsMouseEnter = function(val) {
47884       if (!arguments.length) return _mouseEnterHandler;
47885       _mouseEnterHandler = val;
47886       return combobox;
47887     };
47888     combobox.itemsMouseLeave = function(val) {
47889       if (!arguments.length) return _mouseLeaveHandler;
47890       _mouseLeaveHandler = val;
47891       return combobox;
47892     };
47893     return utilRebind(combobox, dispatch14, "on");
47894   }
47895   uiCombobox.off = function(input, context) {
47896     input.on("focus.combo-input", null).on("blur.combo-input", null).on("keydown.combo-input", null).on("keyup.combo-input", null).on("input.combo-input", null).on("mousedown.combo-input", null).on("mouseup.combo-input", null);
47897     context.container().on("scroll.combo-scroll", null);
47898   };
47899
47900   // modules/ui/intro/helper.js
47901   function pointBox(loc, context) {
47902     var rect = context.surfaceRect();
47903     var point = context.curtainProjection(loc);
47904     return {
47905       left: point[0] + rect.left - 40,
47906       top: point[1] + rect.top - 60,
47907       width: 80,
47908       height: 90
47909     };
47910   }
47911   function pad(locOrBox, padding, context) {
47912     var box;
47913     if (locOrBox instanceof Array) {
47914       var rect = context.surfaceRect();
47915       var point = context.curtainProjection(locOrBox);
47916       box = {
47917         left: point[0] + rect.left,
47918         top: point[1] + rect.top
47919       };
47920     } else {
47921       box = locOrBox;
47922     }
47923     return {
47924       left: box.left - padding,
47925       top: box.top - padding,
47926       width: (box.width || 0) + 2 * padding,
47927       height: (box.width || 0) + 2 * padding
47928     };
47929   }
47930   function icon(name, svgklass, useklass) {
47931     return '<svg class="icon ' + (svgklass || "") + '"><use xlink:href="' + name + '"' + (useklass ? ' class="' + useklass + '"' : "") + "></use></svg>";
47932   }
47933   var helpStringReplacements;
47934   function helpHtml(id2, replacements) {
47935     if (!helpStringReplacements) {
47936       helpStringReplacements = {
47937         // insert icons corresponding to various UI elements
47938         point_icon: icon("#iD-icon-point", "inline"),
47939         line_icon: icon("#iD-icon-line", "inline"),
47940         area_icon: icon("#iD-icon-area", "inline"),
47941         note_icon: icon("#iD-icon-note", "inline add-note"),
47942         plus: icon("#iD-icon-plus", "inline"),
47943         minus: icon("#iD-icon-minus", "inline"),
47944         layers_icon: icon("#iD-icon-layers", "inline"),
47945         data_icon: icon("#iD-icon-data", "inline"),
47946         inspect: icon("#iD-icon-inspect", "inline"),
47947         help_icon: icon("#iD-icon-help", "inline"),
47948         undo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo", "inline"),
47949         redo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-undo" : "#iD-icon-redo", "inline"),
47950         save_icon: icon("#iD-icon-save", "inline"),
47951         // operation icons
47952         circularize_icon: icon("#iD-operation-circularize", "inline operation"),
47953         continue_icon: icon("#iD-operation-continue", "inline operation"),
47954         copy_icon: icon("#iD-operation-copy", "inline operation"),
47955         delete_icon: icon("#iD-operation-delete", "inline operation"),
47956         disconnect_icon: icon("#iD-operation-disconnect", "inline operation"),
47957         downgrade_icon: icon("#iD-operation-downgrade", "inline operation"),
47958         extract_icon: icon("#iD-operation-extract", "inline operation"),
47959         merge_icon: icon("#iD-operation-merge", "inline operation"),
47960         move_icon: icon("#iD-operation-move", "inline operation"),
47961         orthogonalize_icon: icon("#iD-operation-orthogonalize", "inline operation"),
47962         paste_icon: icon("#iD-operation-paste", "inline operation"),
47963         reflect_long_icon: icon("#iD-operation-reflect-long", "inline operation"),
47964         reflect_short_icon: icon("#iD-operation-reflect-short", "inline operation"),
47965         reverse_icon: icon("#iD-operation-reverse", "inline operation"),
47966         rotate_icon: icon("#iD-operation-rotate", "inline operation"),
47967         split_icon: icon("#iD-operation-split", "inline operation"),
47968         straighten_icon: icon("#iD-operation-straighten", "inline operation"),
47969         // interaction icons
47970         leftclick: icon("#iD-walkthrough-mouse-left", "inline operation"),
47971         rightclick: icon("#iD-walkthrough-mouse-right", "inline operation"),
47972         mousewheel_icon: icon("#iD-walkthrough-mousewheel", "inline operation"),
47973         tap_icon: icon("#iD-walkthrough-tap", "inline operation"),
47974         doubletap_icon: icon("#iD-walkthrough-doubletap", "inline operation"),
47975         longpress_icon: icon("#iD-walkthrough-longpress", "inline operation"),
47976         touchdrag_icon: icon("#iD-walkthrough-touchdrag", "inline operation"),
47977         pinch_icon: icon("#iD-walkthrough-pinch-apart", "inline operation"),
47978         // insert keys; may be localized and platform-dependent
47979         shift: uiCmd.display("\u21E7"),
47980         alt: uiCmd.display("\u2325"),
47981         return: uiCmd.display("\u21B5"),
47982         esc: _t.html("shortcuts.key.esc"),
47983         space: _t.html("shortcuts.key.space"),
47984         add_note_key: _t.html("modes.add_note.key"),
47985         help_key: _t.html("help.key"),
47986         shortcuts_key: _t.html("shortcuts.toggle.key"),
47987         // reference localized UI labels directly so that they'll always match
47988         save: _t.html("save.title"),
47989         undo: _t.html("undo.title"),
47990         redo: _t.html("redo.title"),
47991         upload: _t.html("commit.save"),
47992         point: _t.html("modes.add_point.title"),
47993         line: _t.html("modes.add_line.title"),
47994         area: _t.html("modes.add_area.title"),
47995         note: _t.html("modes.add_note.label"),
47996         circularize: _t.html("operations.circularize.title"),
47997         continue: _t.html("operations.continue.title"),
47998         copy: _t.html("operations.copy.title"),
47999         delete: _t.html("operations.delete.title"),
48000         disconnect: _t.html("operations.disconnect.title"),
48001         downgrade: _t.html("operations.downgrade.title"),
48002         extract: _t.html("operations.extract.title"),
48003         merge: _t.html("operations.merge.title"),
48004         move: _t.html("operations.move.title"),
48005         orthogonalize: _t.html("operations.orthogonalize.title"),
48006         paste: _t.html("operations.paste.title"),
48007         reflect_long: _t.html("operations.reflect.title.long"),
48008         reflect_short: _t.html("operations.reflect.title.short"),
48009         reverse: _t.html("operations.reverse.title"),
48010         rotate: _t.html("operations.rotate.title"),
48011         split: _t.html("operations.split.title"),
48012         straighten: _t.html("operations.straighten.title"),
48013         map_data: _t.html("map_data.title"),
48014         osm_notes: _t.html("map_data.layers.notes.title"),
48015         fields: _t.html("inspector.fields"),
48016         tags: _t.html("inspector.tags"),
48017         relations: _t.html("inspector.relations"),
48018         new_relation: _t.html("inspector.new_relation"),
48019         turn_restrictions: _t.html("_tagging.presets.fields.restrictions.label"),
48020         background_settings: _t.html("background.description"),
48021         imagery_offset: _t.html("background.fix_misalignment"),
48022         start_the_walkthrough: _t.html("splash.walkthrough"),
48023         help: _t.html("help.title"),
48024         ok: _t.html("intro.ok")
48025       };
48026       for (var key in helpStringReplacements) {
48027         helpStringReplacements[key] = { html: helpStringReplacements[key] };
48028       }
48029     }
48030     var reps;
48031     if (replacements) {
48032       reps = Object.assign(replacements, helpStringReplacements);
48033     } else {
48034       reps = helpStringReplacements;
48035     }
48036     return _t.html(id2, reps).replace(/\`(.*?)\`/g, "<kbd>$1</kbd>");
48037   }
48038   function slugify(text) {
48039     return text.toString().toLowerCase().replace(/\s+/g, "-").replace(/[^\w\-]+/g, "").replace(/\-\-+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
48040   }
48041   var missingStrings = {};
48042   function checkKey(key, text) {
48043     if (_t(key, { default: void 0 }) === void 0) {
48044       if (missingStrings.hasOwnProperty(key)) return;
48045       missingStrings[key] = text;
48046       var missing = key + ": " + text;
48047       if (typeof console !== "undefined") console.log(missing);
48048     }
48049   }
48050   function localize(obj) {
48051     var key;
48052     var name = obj.tags && obj.tags.name;
48053     if (name) {
48054       key = "intro.graph.name." + slugify(name);
48055       obj.tags.name = _t(key, { default: name });
48056       checkKey(key, name);
48057     }
48058     var street = obj.tags && obj.tags["addr:street"];
48059     if (street) {
48060       key = "intro.graph.name." + slugify(street);
48061       obj.tags["addr:street"] = _t(key, { default: street });
48062       checkKey(key, street);
48063       var addrTags = [
48064         "block_number",
48065         "city",
48066         "county",
48067         "district",
48068         "hamlet",
48069         "neighbourhood",
48070         "postcode",
48071         "province",
48072         "quarter",
48073         "state",
48074         "subdistrict",
48075         "suburb"
48076       ];
48077       addrTags.forEach(function(k2) {
48078         var key2 = "intro.graph." + k2;
48079         var tag2 = "addr:" + k2;
48080         var val = obj.tags && obj.tags[tag2];
48081         var str = _t(key2, { default: val });
48082         if (str) {
48083           if (str.match(/^<.*>$/) !== null) {
48084             delete obj.tags[tag2];
48085           } else {
48086             obj.tags[tag2] = str;
48087           }
48088         }
48089       });
48090     }
48091     return obj;
48092   }
48093   function isMostlySquare(points) {
48094     var threshold = 15;
48095     var lowerBound = Math.cos((90 - threshold) * Math.PI / 180);
48096     var upperBound = Math.cos(threshold * Math.PI / 180);
48097     for (var i3 = 0; i3 < points.length; i3++) {
48098       var a2 = points[(i3 - 1 + points.length) % points.length];
48099       var origin = points[i3];
48100       var b2 = points[(i3 + 1) % points.length];
48101       var dotp = geoVecNormalizedDot(a2, b2, origin);
48102       var mag = Math.abs(dotp);
48103       if (mag > lowerBound && mag < upperBound) {
48104         return false;
48105       }
48106     }
48107     return true;
48108   }
48109   function selectMenuItem(context, operation2) {
48110     return context.container().select(".edit-menu .edit-menu-item-" + operation2);
48111   }
48112   function transitionTime(point1, point2) {
48113     var distance = geoSphericalDistance(point1, point2);
48114     if (distance === 0) {
48115       return 0;
48116     } else if (distance < 80) {
48117       return 500;
48118     } else {
48119       return 1e3;
48120     }
48121   }
48122
48123   // modules/ui/field_help.js
48124   function uiFieldHelp(context, fieldName) {
48125     var fieldHelp = {};
48126     var _inspector = select_default2(null);
48127     var _wrap = select_default2(null);
48128     var _body = select_default2(null);
48129     var fieldHelpKeys = {
48130       restrictions: [
48131         ["about", [
48132           "about",
48133           "from_via_to",
48134           "maxdist",
48135           "maxvia"
48136         ]],
48137         ["inspecting", [
48138           "about",
48139           "from_shadow",
48140           "allow_shadow",
48141           "restrict_shadow",
48142           "only_shadow",
48143           "restricted",
48144           "only"
48145         ]],
48146         ["modifying", [
48147           "about",
48148           "indicators",
48149           "allow_turn",
48150           "restrict_turn",
48151           "only_turn"
48152         ]],
48153         ["tips", [
48154           "simple",
48155           "simple_example",
48156           "indirect",
48157           "indirect_example",
48158           "indirect_noedit"
48159         ]]
48160       ]
48161     };
48162     var fieldHelpHeadings = {};
48163     var replacements = {
48164       distField: { html: _t.html("restriction.controls.distance") },
48165       viaField: { html: _t.html("restriction.controls.via") },
48166       fromShadow: { html: icon("#iD-turn-shadow", "inline shadow from") },
48167       allowShadow: { html: icon("#iD-turn-shadow", "inline shadow allow") },
48168       restrictShadow: { html: icon("#iD-turn-shadow", "inline shadow restrict") },
48169       onlyShadow: { html: icon("#iD-turn-shadow", "inline shadow only") },
48170       allowTurn: { html: icon("#iD-turn-yes", "inline turn") },
48171       restrictTurn: { html: icon("#iD-turn-no", "inline turn") },
48172       onlyTurn: { html: icon("#iD-turn-only", "inline turn") }
48173     };
48174     var docs = fieldHelpKeys[fieldName].map(function(key) {
48175       var helpkey = "help.field." + fieldName + "." + key[0];
48176       var text = key[1].reduce(function(all, part) {
48177         var subkey = helpkey + "." + part;
48178         var depth = fieldHelpHeadings[subkey];
48179         var hhh = depth ? Array(depth + 1).join("#") + " " : "";
48180         return all + hhh + _t.html(subkey, replacements) + "\n\n";
48181       }, "");
48182       return {
48183         key: helpkey,
48184         title: _t.html(helpkey + ".title"),
48185         html: marked(text.trim())
48186       };
48187     });
48188     function show() {
48189       updatePosition();
48190       _body.classed("hide", false).style("opacity", "0").transition().duration(200).style("opacity", "1");
48191     }
48192     function hide() {
48193       _body.classed("hide", true).transition().duration(200).style("opacity", "0").on("end", function() {
48194         _body.classed("hide", true);
48195       });
48196     }
48197     function clickHelp(index) {
48198       var d2 = docs[index];
48199       var tkeys = fieldHelpKeys[fieldName][index][1];
48200       _body.selectAll(".field-help-nav-item").classed("active", function(d4, i3) {
48201         return i3 === index;
48202       });
48203       var content = _body.selectAll(".field-help-content").html(d2.html);
48204       content.selectAll("p").attr("class", function(d4, i3) {
48205         return tkeys[i3];
48206       });
48207       if (d2.key === "help.field.restrictions.inspecting") {
48208         content.insert("img", "p.from_shadow").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_inspect.gif"));
48209       } else if (d2.key === "help.field.restrictions.modifying") {
48210         content.insert("img", "p.allow_turn").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_modify.gif"));
48211       }
48212     }
48213     fieldHelp.button = function(selection2) {
48214       if (_body.empty()) return;
48215       var button = selection2.selectAll(".field-help-button").data([0]);
48216       button.enter().append("button").attr("class", "field-help-button").call(svgIcon("#iD-icon-help")).merge(button).on("click", function(d3_event) {
48217         d3_event.stopPropagation();
48218         d3_event.preventDefault();
48219         if (_body.classed("hide")) {
48220           show();
48221         } else {
48222           hide();
48223         }
48224       });
48225     };
48226     function updatePosition() {
48227       var wrap2 = _wrap.node();
48228       var inspector = _inspector.node();
48229       var wRect = wrap2.getBoundingClientRect();
48230       var iRect = inspector.getBoundingClientRect();
48231       _body.style("top", wRect.top + inspector.scrollTop - iRect.top + "px");
48232     }
48233     fieldHelp.body = function(selection2) {
48234       _wrap = selection2.selectAll(".form-field-input-wrap");
48235       if (_wrap.empty()) return;
48236       _inspector = context.container().select(".sidebar .entity-editor-pane .inspector-body");
48237       if (_inspector.empty()) return;
48238       _body = _inspector.selectAll(".field-help-body").data([0]);
48239       var enter = _body.enter().append("div").attr("class", "field-help-body hide");
48240       var titleEnter = enter.append("div").attr("class", "field-help-title cf");
48241       titleEnter.append("h2").attr("class", _mainLocalizer.textDirection() === "rtl" ? "fr" : "fl").call(_t.append("help.field." + fieldName + ".title"));
48242       titleEnter.append("button").attr("class", "fr close").attr("title", _t("icons.close")).on("click", function(d3_event) {
48243         d3_event.stopPropagation();
48244         d3_event.preventDefault();
48245         hide();
48246       }).call(svgIcon("#iD-icon-close"));
48247       var navEnter = enter.append("div").attr("class", "field-help-nav cf");
48248       var titles = docs.map(function(d2) {
48249         return d2.title;
48250       });
48251       navEnter.selectAll(".field-help-nav-item").data(titles).enter().append("div").attr("class", "field-help-nav-item").html(function(d2) {
48252         return d2;
48253       }).on("click", function(d3_event, d2) {
48254         d3_event.stopPropagation();
48255         d3_event.preventDefault();
48256         clickHelp(titles.indexOf(d2));
48257       });
48258       enter.append("div").attr("class", "field-help-content");
48259       _body = _body.merge(enter);
48260       clickHelp(0);
48261     };
48262     return fieldHelp;
48263   }
48264
48265   // modules/ui/fields/check.js
48266   function uiFieldCheck(field, context) {
48267     var dispatch14 = dispatch_default("change");
48268     var options2 = field.options;
48269     var values = [];
48270     var texts = [];
48271     var _tags;
48272     var input = select_default2(null);
48273     var text = select_default2(null);
48274     var label = select_default2(null);
48275     var reverser = select_default2(null);
48276     var _impliedYes;
48277     var _entityIDs = [];
48278     var _value;
48279     var stringsField = field.resolveReference("stringsCrossReference");
48280     if (!options2 && stringsField.options) {
48281       options2 = stringsField.options;
48282     }
48283     if (options2) {
48284       for (var i3 in options2) {
48285         var v2 = options2[i3];
48286         values.push(v2 === "undefined" ? void 0 : v2);
48287         texts.push(stringsField.t.html("options." + v2, { "default": v2 }));
48288       }
48289     } else {
48290       values = [void 0, "yes"];
48291       texts = [_t.html("inspector.unknown"), _t.html("inspector.check.yes")];
48292       if (field.type !== "defaultCheck") {
48293         values.push("no");
48294         texts.push(_t.html("inspector.check.no"));
48295       }
48296     }
48297     function checkImpliedYes() {
48298       _impliedYes = field.id === "oneway_yes";
48299       if (field.id === "oneway") {
48300         var entity = context.entity(_entityIDs[0]);
48301         for (var key in entity.tags) {
48302           if (key in osmOneWayTags && entity.tags[key] in osmOneWayTags[key]) {
48303             _impliedYes = true;
48304             texts[0] = _t.html("_tagging.presets.fields.oneway_yes.options.undefined");
48305             break;
48306           }
48307         }
48308       }
48309     }
48310     function reverserHidden() {
48311       if (!context.container().select("div.inspector-hover").empty()) return true;
48312       return !(_value === "yes" || _impliedYes && !_value);
48313     }
48314     function reverserSetText(selection2) {
48315       var entity = _entityIDs.length && context.hasEntity(_entityIDs[0]);
48316       if (reverserHidden() || !entity) return selection2;
48317       var first = entity.first();
48318       var last = entity.isClosed() ? entity.nodes[entity.nodes.length - 2] : entity.last();
48319       var pseudoDirection = first < last;
48320       var icon2 = pseudoDirection ? "#iD-icon-forward" : "#iD-icon-backward";
48321       selection2.selectAll(".reverser-span").html("").call(_t.append("inspector.check.reverser")).call(svgIcon(icon2, "inline"));
48322       return selection2;
48323     }
48324     var check = function(selection2) {
48325       checkImpliedYes();
48326       label = selection2.selectAll(".form-field-input-wrap").data([0]);
48327       var enter = label.enter().append("label").attr("class", "form-field-input-wrap form-field-input-check");
48328       enter.append("input").property("indeterminate", field.type !== "defaultCheck").attr("type", "checkbox").attr("id", field.domId);
48329       enter.append("span").html(texts[0]).attr("class", "value");
48330       if (field.type === "onewayCheck") {
48331         enter.append("button").attr("class", "reverser" + (reverserHidden() ? " hide" : "")).append("span").attr("class", "reverser-span");
48332       }
48333       label = label.merge(enter);
48334       input = label.selectAll("input");
48335       text = label.selectAll("span.value");
48336       input.on("click", function(d3_event) {
48337         d3_event.stopPropagation();
48338         var t2 = {};
48339         if (Array.isArray(_tags[field.key])) {
48340           if (values.indexOf("yes") !== -1) {
48341             t2[field.key] = "yes";
48342           } else {
48343             t2[field.key] = values[0];
48344           }
48345         } else {
48346           t2[field.key] = values[(values.indexOf(_value) + 1) % values.length];
48347         }
48348         if (t2[field.key] === "reversible" || t2[field.key] === "alternating") {
48349           t2[field.key] = values[0];
48350         }
48351         dispatch14.call("change", this, t2);
48352       });
48353       if (field.type === "onewayCheck") {
48354         reverser = label.selectAll(".reverser");
48355         reverser.call(reverserSetText).on("click", function(d3_event) {
48356           d3_event.preventDefault();
48357           d3_event.stopPropagation();
48358           context.perform(
48359             function(graph) {
48360               for (var i4 in _entityIDs) {
48361                 graph = actionReverse(_entityIDs[i4])(graph);
48362               }
48363               return graph;
48364             },
48365             _t("operations.reverse.annotation.line", { n: 1 })
48366           );
48367           context.validator().validate();
48368           select_default2(this).call(reverserSetText);
48369         });
48370       }
48371     };
48372     check.entityIDs = function(val) {
48373       if (!arguments.length) return _entityIDs;
48374       _entityIDs = val;
48375       return check;
48376     };
48377     check.tags = function(tags) {
48378       _tags = tags;
48379       function isChecked(val) {
48380         return val !== "no" && val !== "" && val !== void 0 && val !== null;
48381       }
48382       function textFor(val) {
48383         if (val === "") val = void 0;
48384         var index = values.indexOf(val);
48385         return index !== -1 ? texts[index] : '"' + val + '"';
48386       }
48387       checkImpliedYes();
48388       var isMixed = Array.isArray(tags[field.key]);
48389       _value = !isMixed && tags[field.key] && tags[field.key].toLowerCase();
48390       if (field.type === "onewayCheck" && (_value === "1" || _value === "-1")) {
48391         _value = "yes";
48392       }
48393       input.property("indeterminate", isMixed || field.type !== "defaultCheck" && !_value).property("checked", isChecked(_value));
48394       text.html(isMixed ? _t.html("inspector.multiple_values") : textFor(_value)).classed("mixed", isMixed);
48395       label.classed("set", !!_value);
48396       if (field.type === "onewayCheck") {
48397         reverser.classed("hide", reverserHidden()).call(reverserSetText);
48398       }
48399     };
48400     check.focus = function() {
48401       input.node().focus();
48402     };
48403     return utilRebind(check, dispatch14, "on");
48404   }
48405
48406   // modules/svg/areas.js
48407   var import_fast_deep_equal5 = __toESM(require_fast_deep_equal());
48408
48409   // modules/svg/helpers.js
48410   function svgPassiveVertex(node, graph, activeID) {
48411     if (!activeID) return 1;
48412     if (activeID === node.id) return 0;
48413     var parents = graph.parentWays(node);
48414     var i3, j2, nodes, isClosed, ix1, ix2, ix3, ix4, max3;
48415     for (i3 = 0; i3 < parents.length; i3++) {
48416       nodes = parents[i3].nodes;
48417       isClosed = parents[i3].isClosed();
48418       for (j2 = 0; j2 < nodes.length; j2++) {
48419         if (nodes[j2] === node.id) {
48420           ix1 = j2 - 2;
48421           ix2 = j2 - 1;
48422           ix3 = j2 + 1;
48423           ix4 = j2 + 2;
48424           if (isClosed) {
48425             max3 = nodes.length - 1;
48426             if (ix1 < 0) ix1 = max3 + ix1;
48427             if (ix2 < 0) ix2 = max3 + ix2;
48428             if (ix3 > max3) ix3 = ix3 - max3;
48429             if (ix4 > max3) ix4 = ix4 - max3;
48430           }
48431           if (nodes[ix1] === activeID) return 0;
48432           else if (nodes[ix2] === activeID) return 2;
48433           else if (nodes[ix3] === activeID) return 2;
48434           else if (nodes[ix4] === activeID) return 0;
48435           else if (isClosed && nodes.indexOf(activeID) !== -1) return 0;
48436         }
48437       }
48438     }
48439     return 1;
48440   }
48441   function svgMarkerSegments(projection2, graph, dt2, shouldReverse, bothDirections) {
48442     return function(entity) {
48443       var i3 = 0;
48444       var offset = dt2;
48445       var segments = [];
48446       var clip = identity_default2().clipExtent(projection2.clipExtent()).stream;
48447       var coordinates = graph.childNodes(entity).map(function(n3) {
48448         return n3.loc;
48449       });
48450       var a2, b2;
48451       if (shouldReverse(entity)) {
48452         coordinates.reverse();
48453       }
48454       stream_default({
48455         type: "LineString",
48456         coordinates
48457       }, projection2.stream(clip({
48458         lineStart: function() {
48459         },
48460         lineEnd: function() {
48461           a2 = null;
48462         },
48463         point: function(x2, y2) {
48464           b2 = [x2, y2];
48465           if (a2) {
48466             var span = geoVecLength(a2, b2) - offset;
48467             if (span >= 0) {
48468               var heading2 = geoVecAngle(a2, b2);
48469               var dx = dt2 * Math.cos(heading2);
48470               var dy = dt2 * Math.sin(heading2);
48471               var p2 = [
48472                 a2[0] + offset * Math.cos(heading2),
48473                 a2[1] + offset * Math.sin(heading2)
48474               ];
48475               var coord2 = [a2, p2];
48476               for (span -= dt2; span >= 0; span -= dt2) {
48477                 p2 = geoVecAdd(p2, [dx, dy]);
48478                 coord2.push(p2);
48479               }
48480               coord2.push(b2);
48481               var segment = "";
48482               var j2;
48483               for (j2 = 0; j2 < coord2.length; j2++) {
48484                 segment += (j2 === 0 ? "M" : "L") + coord2[j2][0] + "," + coord2[j2][1];
48485               }
48486               segments.push({ id: entity.id, index: i3++, d: segment });
48487               if (bothDirections(entity)) {
48488                 segment = "";
48489                 for (j2 = coord2.length - 1; j2 >= 0; j2--) {
48490                   segment += (j2 === coord2.length - 1 ? "M" : "L") + coord2[j2][0] + "," + coord2[j2][1];
48491                 }
48492                 segments.push({ id: entity.id, index: i3++, d: segment });
48493               }
48494             }
48495             offset = -span;
48496           }
48497           a2 = b2;
48498         }
48499       })));
48500       return segments;
48501     };
48502   }
48503   function svgPath(projection2, graph, isArea) {
48504     var cache = {};
48505     var padding = isArea ? 65 : 5;
48506     var viewport = projection2.clipExtent();
48507     var paddedExtent = [
48508       [viewport[0][0] - padding, viewport[0][1] - padding],
48509       [viewport[1][0] + padding, viewport[1][1] + padding]
48510     ];
48511     var clip = identity_default2().clipExtent(paddedExtent).stream;
48512     var project = projection2.stream;
48513     var path = path_default().projection({ stream: function(output) {
48514       return project(clip(output));
48515     } });
48516     var svgpath = function(entity) {
48517       if (entity.id in cache) {
48518         return cache[entity.id];
48519       } else {
48520         return cache[entity.id] = path(entity.asGeoJSON(graph));
48521       }
48522     };
48523     svgpath.geojson = function(d2) {
48524       if (d2.__featurehash__ !== void 0) {
48525         if (d2.__featurehash__ in cache) {
48526           return cache[d2.__featurehash__];
48527         } else {
48528           return cache[d2.__featurehash__] = path(d2);
48529         }
48530       } else {
48531         return path(d2);
48532       }
48533     };
48534     return svgpath;
48535   }
48536   function svgPointTransform(projection2) {
48537     var svgpoint = function(entity) {
48538       var pt2 = projection2(entity.loc);
48539       return "translate(" + pt2[0] + "," + pt2[1] + ")";
48540     };
48541     svgpoint.geojson = function(d2) {
48542       return svgpoint(d2.properties.entity);
48543     };
48544     return svgpoint;
48545   }
48546   function svgRelationMemberTags(graph) {
48547     return function(entity) {
48548       var tags = entity.tags;
48549       var shouldCopyMultipolygonTags = !entity.hasInterestingTags();
48550       graph.parentRelations(entity).forEach(function(relation) {
48551         var type2 = relation.tags.type;
48552         if (type2 === "multipolygon" && shouldCopyMultipolygonTags || type2 === "boundary") {
48553           tags = Object.assign({}, relation.tags, tags);
48554         }
48555       });
48556       return tags;
48557     };
48558   }
48559   function svgSegmentWay(way, graph, activeID) {
48560     if (activeID === void 0) {
48561       return graph.transient(way, "waySegments", getWaySegments);
48562     } else {
48563       return getWaySegments();
48564     }
48565     function getWaySegments() {
48566       var isActiveWay = way.nodes.indexOf(activeID) !== -1;
48567       var features = { passive: [], active: [] };
48568       var start2 = {};
48569       var end = {};
48570       var node, type2;
48571       for (var i3 = 0; i3 < way.nodes.length; i3++) {
48572         node = graph.entity(way.nodes[i3]);
48573         type2 = svgPassiveVertex(node, graph, activeID);
48574         end = { node, type: type2 };
48575         if (start2.type !== void 0) {
48576           if (start2.node.id === activeID || end.node.id === activeID) {
48577           } else if (isActiveWay && (start2.type === 2 || end.type === 2)) {
48578             pushActive(start2, end, i3);
48579           } else if (start2.type === 0 && end.type === 0) {
48580             pushActive(start2, end, i3);
48581           } else {
48582             pushPassive(start2, end, i3);
48583           }
48584         }
48585         start2 = end;
48586       }
48587       return features;
48588       function pushActive(start3, end2, index) {
48589         features.active.push({
48590           type: "Feature",
48591           id: way.id + "-" + index + "-nope",
48592           properties: {
48593             nope: true,
48594             target: true,
48595             entity: way,
48596             nodes: [start3.node, end2.node],
48597             index
48598           },
48599           geometry: {
48600             type: "LineString",
48601             coordinates: [start3.node.loc, end2.node.loc]
48602           }
48603         });
48604       }
48605       function pushPassive(start3, end2, index) {
48606         features.passive.push({
48607           type: "Feature",
48608           id: way.id + "-" + index,
48609           properties: {
48610             target: true,
48611             entity: way,
48612             nodes: [start3.node, end2.node],
48613             index
48614           },
48615           geometry: {
48616             type: "LineString",
48617             coordinates: [start3.node.loc, end2.node.loc]
48618           }
48619         });
48620       }
48621     }
48622   }
48623
48624   // modules/svg/tag_classes.js
48625   function svgTagClasses() {
48626     var primaries = [
48627       "building",
48628       "highway",
48629       "railway",
48630       "waterway",
48631       "aeroway",
48632       "aerialway",
48633       "piste:type",
48634       "boundary",
48635       "power",
48636       "amenity",
48637       "natural",
48638       "landuse",
48639       "leisure",
48640       "military",
48641       "place",
48642       "man_made",
48643       "route",
48644       "attraction",
48645       "roller_coaster",
48646       "building:part",
48647       "indoor"
48648     ];
48649     var statuses = Object.keys(osmLifecyclePrefixes);
48650     var secondaries = [
48651       "oneway",
48652       "bridge",
48653       "tunnel",
48654       "embankment",
48655       "cutting",
48656       "barrier",
48657       "surface",
48658       "tracktype",
48659       "footway",
48660       "crossing",
48661       "service",
48662       "sport",
48663       "public_transport",
48664       "location",
48665       "parking",
48666       "golf",
48667       "type",
48668       "leisure",
48669       "man_made",
48670       "indoor",
48671       "construction",
48672       "proposed"
48673     ];
48674     var _tags = function(entity) {
48675       return entity.tags;
48676     };
48677     var tagClasses = function(selection2) {
48678       selection2.each(function tagClassesEach(entity) {
48679         var value = this.className;
48680         if (value.baseVal !== void 0) {
48681           value = value.baseVal;
48682         }
48683         var t2 = _tags(entity);
48684         var computed = tagClasses.getClassesString(t2, value);
48685         if (computed !== value) {
48686           select_default2(this).attr("class", computed);
48687         }
48688       });
48689     };
48690     tagClasses.getClassesString = function(t2, value) {
48691       var primary, status;
48692       var i3, j2, k2, v2;
48693       var overrideGeometry;
48694       if (/\bstroke\b/.test(value)) {
48695         if (!!t2.barrier && t2.barrier !== "no") {
48696           overrideGeometry = "line";
48697         }
48698       }
48699       var classes = value.trim().split(/\s+/).filter(function(klass) {
48700         return klass.length && !/^tag-/.test(klass);
48701       }).map(function(klass) {
48702         return klass === "line" || klass === "area" ? overrideGeometry || klass : klass;
48703       });
48704       for (i3 = 0; i3 < primaries.length; i3++) {
48705         k2 = primaries[i3];
48706         v2 = t2[k2];
48707         if (!v2 || v2 === "no") continue;
48708         if (k2 === "piste:type") {
48709           k2 = "piste";
48710         } else if (k2 === "building:part") {
48711           k2 = "building_part";
48712         }
48713         primary = k2;
48714         if (statuses.indexOf(v2) !== -1) {
48715           status = v2;
48716           classes.push("tag-" + k2);
48717         } else {
48718           classes.push("tag-" + k2);
48719           classes.push("tag-" + k2 + "-" + v2);
48720         }
48721         break;
48722       }
48723       if (!primary) {
48724         for (i3 = 0; i3 < statuses.length; i3++) {
48725           for (j2 = 0; j2 < primaries.length; j2++) {
48726             k2 = statuses[i3] + ":" + primaries[j2];
48727             v2 = t2[k2];
48728             if (!v2 || v2 === "no") continue;
48729             status = statuses[i3];
48730             break;
48731           }
48732         }
48733       }
48734       if (!status) {
48735         for (i3 = 0; i3 < statuses.length; i3++) {
48736           k2 = statuses[i3];
48737           v2 = t2[k2];
48738           if (!v2 || v2 === "no") continue;
48739           if (v2 === "yes") {
48740             status = k2;
48741           } else if (primary && primary === v2) {
48742             status = k2;
48743           } else if (!primary && primaries.indexOf(v2) !== -1) {
48744             status = k2;
48745             primary = v2;
48746             classes.push("tag-" + v2);
48747           }
48748           if (status) break;
48749         }
48750       }
48751       if (status) {
48752         classes.push("tag-status");
48753         classes.push("tag-status-" + status);
48754       }
48755       for (i3 = 0; i3 < secondaries.length; i3++) {
48756         k2 = secondaries[i3];
48757         v2 = t2[k2];
48758         if (!v2 || v2 === "no" || k2 === primary) continue;
48759         classes.push("tag-" + k2);
48760         classes.push("tag-" + k2 + "-" + v2);
48761       }
48762       if (primary === "highway" && !osmPathHighwayTagValues[t2.highway] || primary === "aeroway") {
48763         var surface = t2.highway === "track" ? "unpaved" : "paved";
48764         for (k2 in t2) {
48765           v2 = t2[k2];
48766           if (k2 in osmPavedTags) {
48767             surface = osmPavedTags[k2][v2] ? "paved" : "unpaved";
48768           }
48769           if (k2 in osmSemipavedTags && !!osmSemipavedTags[k2][v2]) {
48770             surface = "semipaved";
48771           }
48772         }
48773         classes.push("tag-" + surface);
48774       }
48775       var qid = t2.wikidata || t2["flag:wikidata"] || t2["brand:wikidata"] || t2["network:wikidata"] || t2["operator:wikidata"];
48776       if (qid) {
48777         classes.push("tag-wikidata");
48778       }
48779       return classes.filter((klass) => /^[-_a-z0-9]+$/.test(klass)).join(" ").trim();
48780     };
48781     tagClasses.tags = function(val) {
48782       if (!arguments.length) return _tags;
48783       _tags = val;
48784       return tagClasses;
48785     };
48786     return tagClasses;
48787   }
48788
48789   // modules/svg/tag_pattern.js
48790   var patterns = {
48791     // tag - pattern name
48792     // -or-
48793     // tag - value - pattern name
48794     // -or-
48795     // tag - value - rules (optional tag-values, pattern name)
48796     // (matches earlier rules first, so fallback should be last entry)
48797     amenity: {
48798       grave_yard: "cemetery",
48799       fountain: "water_standing"
48800     },
48801     landuse: {
48802       cemetery: [
48803         { religion: "christian", pattern: "cemetery_christian" },
48804         { religion: "buddhist", pattern: "cemetery_buddhist" },
48805         { religion: "muslim", pattern: "cemetery_muslim" },
48806         { religion: "jewish", pattern: "cemetery_jewish" },
48807         { pattern: "cemetery" }
48808       ],
48809       construction: "construction",
48810       farmland: "farmland",
48811       farmyard: "farmyard",
48812       forest: [
48813         { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
48814         { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
48815         { leaf_type: "leafless", pattern: "forest_leafless" },
48816         { pattern: "forest" }
48817         // same as 'leaf_type:mixed'
48818       ],
48819       grave_yard: "cemetery",
48820       grass: "grass",
48821       landfill: "landfill",
48822       meadow: "meadow",
48823       military: "construction",
48824       orchard: "orchard",
48825       quarry: "quarry",
48826       vineyard: "vineyard"
48827     },
48828     leisure: {
48829       horse_riding: "farmyard"
48830     },
48831     natural: {
48832       beach: "beach",
48833       grassland: "grass",
48834       sand: "beach",
48835       scrub: "scrub",
48836       water: [
48837         { water: "pond", pattern: "pond" },
48838         { water: "reservoir", pattern: "water_standing" },
48839         { pattern: "waves" }
48840       ],
48841       wetland: [
48842         { wetland: "marsh", pattern: "wetland_marsh" },
48843         { wetland: "swamp", pattern: "wetland_swamp" },
48844         { wetland: "bog", pattern: "wetland_bog" },
48845         { wetland: "reedbed", pattern: "wetland_reedbed" },
48846         { pattern: "wetland" }
48847       ],
48848       wood: [
48849         { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
48850         { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
48851         { leaf_type: "leafless", pattern: "forest_leafless" },
48852         { pattern: "forest" }
48853         // same as 'leaf_type:mixed'
48854       ]
48855     },
48856     golf: {
48857       green: "golf_green",
48858       tee: "grass",
48859       fairway: "grass",
48860       rough: "scrub"
48861     },
48862     surface: {
48863       grass: "grass",
48864       sand: "beach"
48865     }
48866   };
48867   function svgTagPattern(tags) {
48868     if (tags.building && tags.building !== "no") {
48869       return null;
48870     }
48871     for (var tag2 in patterns) {
48872       var entityValue = tags[tag2];
48873       if (!entityValue) continue;
48874       if (typeof patterns[tag2] === "string") {
48875         return "pattern-" + patterns[tag2];
48876       } else {
48877         var values = patterns[tag2];
48878         for (var value in values) {
48879           if (entityValue !== value) continue;
48880           var rules = values[value];
48881           if (typeof rules === "string") {
48882             return "pattern-" + rules;
48883           }
48884           for (var ruleKey in rules) {
48885             var rule = rules[ruleKey];
48886             var pass = true;
48887             for (var criterion in rule) {
48888               if (criterion !== "pattern") {
48889                 var v2 = tags[criterion];
48890                 if (!v2 || v2 !== rule[criterion]) {
48891                   pass = false;
48892                   break;
48893                 }
48894               }
48895             }
48896             if (pass) {
48897               return "pattern-" + rule.pattern;
48898             }
48899           }
48900         }
48901       }
48902     }
48903     return null;
48904   }
48905
48906   // modules/svg/areas.js
48907   function svgAreas(projection2, context) {
48908     function getPatternStyle(tags) {
48909       var imageID = svgTagPattern(tags);
48910       if (imageID) {
48911         return 'url("#ideditor-' + imageID + '")';
48912       }
48913       return "";
48914     }
48915     function drawTargets(selection2, graph, entities, filter2) {
48916       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
48917       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
48918       var getPath = svgPath(projection2).geojson;
48919       var activeID = context.activeID();
48920       var base = context.history().base();
48921       var data = { targets: [], nopes: [] };
48922       entities.forEach(function(way) {
48923         var features = svgSegmentWay(way, graph, activeID);
48924         data.targets.push.apply(data.targets, features.passive);
48925         data.nopes.push.apply(data.nopes, features.active);
48926       });
48927       var targetData = data.targets.filter(getPath);
48928       var targets = selection2.selectAll(".area.target-allowed").filter(function(d2) {
48929         return filter2(d2.properties.entity);
48930       }).data(targetData, function key(d2) {
48931         return d2.id;
48932       });
48933       targets.exit().remove();
48934       var segmentWasEdited = function(d2) {
48935         var wayID = d2.properties.entity.id;
48936         if (!base.entities[wayID] || !(0, import_fast_deep_equal5.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
48937           return false;
48938         }
48939         return d2.properties.nodes.some(function(n3) {
48940           return !base.entities[n3.id] || !(0, import_fast_deep_equal5.default)(graph.entities[n3.id].loc, base.entities[n3.id].loc);
48941         });
48942       };
48943       targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d2) {
48944         return "way area target target-allowed " + targetClass + d2.id;
48945       }).classed("segment-edited", segmentWasEdited);
48946       var nopeData = data.nopes.filter(getPath);
48947       var nopes = selection2.selectAll(".area.target-nope").filter(function(d2) {
48948         return filter2(d2.properties.entity);
48949       }).data(nopeData, function key(d2) {
48950         return d2.id;
48951       });
48952       nopes.exit().remove();
48953       nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d2) {
48954         return "way area target target-nope " + nopeClass + d2.id;
48955       }).classed("segment-edited", segmentWasEdited);
48956     }
48957     function drawAreas(selection2, graph, entities, filter2) {
48958       var path = svgPath(projection2, graph, true);
48959       var areas = {};
48960       var base = context.history().base();
48961       for (var i3 = 0; i3 < entities.length; i3++) {
48962         var entity = entities[i3];
48963         if (entity.geometry(graph) !== "area") continue;
48964         if (!areas[entity.id]) {
48965           areas[entity.id] = {
48966             entity,
48967             area: Math.abs(entity.area(graph))
48968           };
48969         }
48970       }
48971       var fills = Object.values(areas).filter(function hasPath(a2) {
48972         return path(a2.entity);
48973       });
48974       fills.sort(function areaSort(a2, b2) {
48975         return b2.area - a2.area;
48976       });
48977       fills = fills.map(function(a2) {
48978         return a2.entity;
48979       });
48980       var strokes = fills.filter(function(area) {
48981         return area.type === "way";
48982       });
48983       var data = {
48984         clip: fills,
48985         shadow: strokes,
48986         stroke: strokes,
48987         fill: fills
48988       };
48989       var clipPaths = context.surface().selectAll("defs").selectAll(".clipPath-osm").filter(filter2).data(data.clip, osmEntity.key);
48990       clipPaths.exit().remove();
48991       var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-osm").attr("id", function(entity2) {
48992         return "ideditor-" + entity2.id + "-clippath";
48993       });
48994       clipPathsEnter.append("path");
48995       clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", path);
48996       var drawLayer = selection2.selectAll(".layer-osm.areas");
48997       var touchLayer = selection2.selectAll(".layer-touch.areas");
48998       var areagroup = drawLayer.selectAll("g.areagroup").data(["fill", "shadow", "stroke"]);
48999       areagroup = areagroup.enter().append("g").attr("class", function(d2) {
49000         return "areagroup area-" + d2;
49001       }).merge(areagroup);
49002       var paths = areagroup.selectAll("path").filter(filter2).data(function(layer) {
49003         return data[layer];
49004       }, osmEntity.key);
49005       paths.exit().remove();
49006       var fillpaths = selection2.selectAll(".area-fill path.area").nodes();
49007       var bisect = bisector(function(node) {
49008         return -node.__data__.area(graph);
49009       }).left;
49010       function sortedByArea(entity2) {
49011         if (this._parent.__data__ === "fill") {
49012           return fillpaths[bisect(fillpaths, -entity2.area(graph))];
49013         }
49014       }
49015       paths = paths.enter().insert("path", sortedByArea).merge(paths).each(function(entity2) {
49016         var layer = this.parentNode.__data__;
49017         this.setAttribute("class", entity2.type + " area " + layer + " " + entity2.id);
49018         if (layer === "fill") {
49019           this.setAttribute("clip-path", "url(#ideditor-" + entity2.id + "-clippath)");
49020           this.style.fill = this.style.stroke = getPatternStyle(entity2.tags);
49021         }
49022       }).classed("added", function(d2) {
49023         return !base.entities[d2.id];
49024       }).classed("geometry-edited", function(d2) {
49025         return graph.entities[d2.id] && base.entities[d2.id] && !(0, import_fast_deep_equal5.default)(graph.entities[d2.id].nodes, base.entities[d2.id].nodes);
49026       }).classed("retagged", function(d2) {
49027         return graph.entities[d2.id] && base.entities[d2.id] && !(0, import_fast_deep_equal5.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
49028       }).call(svgTagClasses()).attr("d", path);
49029       touchLayer.call(drawTargets, graph, data.stroke, filter2);
49030     }
49031     return drawAreas;
49032   }
49033
49034   // modules/svg/data.js
49035   var import_fast_json_stable_stringify = __toESM(require_fast_json_stable_stringify());
49036
49037   // node_modules/@tmcw/togeojson/dist/togeojson.es.mjs
49038   function $(element, tagName) {
49039     return Array.from(element.getElementsByTagName(tagName));
49040   }
49041   function normalizeId(id2) {
49042     return id2[0] === "#" ? id2 : "#".concat(id2);
49043   }
49044   function $ns(element, tagName, ns) {
49045     return Array.from(element.getElementsByTagNameNS(ns, tagName));
49046   }
49047   function nodeVal(node) {
49048     node == null ? void 0 : node.normalize();
49049     return node && node.textContent || "";
49050   }
49051   function get1(node, tagName, callback) {
49052     const n3 = node.getElementsByTagName(tagName);
49053     const result = n3.length ? n3[0] : null;
49054     if (result && callback)
49055       callback(result);
49056     return result;
49057   }
49058   function get3(node, tagName, callback) {
49059     const properties = {};
49060     if (!node)
49061       return properties;
49062     const n3 = node.getElementsByTagName(tagName);
49063     const result = n3.length ? n3[0] : null;
49064     if (result && callback) {
49065       return callback(result, properties);
49066     }
49067     return properties;
49068   }
49069   function val1(node, tagName, callback) {
49070     const val = nodeVal(get1(node, tagName));
49071     if (val && callback)
49072       return callback(val) || {};
49073     return {};
49074   }
49075   function $num(node, tagName, callback) {
49076     const val = parseFloat(nodeVal(get1(node, tagName)));
49077     if (isNaN(val))
49078       return void 0;
49079     if (val && callback)
49080       return callback(val) || {};
49081     return {};
49082   }
49083   function num1(node, tagName, callback) {
49084     const val = parseFloat(nodeVal(get1(node, tagName)));
49085     if (isNaN(val))
49086       return void 0;
49087     if (callback)
49088       callback(val);
49089     return val;
49090   }
49091   function getMulti(node, propertyNames) {
49092     const properties = {};
49093     for (const property of propertyNames) {
49094       val1(node, property, (val) => {
49095         properties[property] = val;
49096       });
49097     }
49098     return properties;
49099   }
49100   function isElement(node) {
49101     return (node == null ? void 0 : node.nodeType) === 1;
49102   }
49103   function getLineStyle(node) {
49104     return get3(node, "line", (lineStyle) => {
49105       const val = Object.assign({}, val1(lineStyle, "color", (color2) => {
49106         return { stroke: "#".concat(color2) };
49107       }), $num(lineStyle, "opacity", (opacity) => {
49108         return { "stroke-opacity": opacity };
49109       }), $num(lineStyle, "width", (width) => {
49110         return { "stroke-width": width * 96 / 25.4 };
49111       }));
49112       return val;
49113     });
49114   }
49115   function getExtensions(node) {
49116     let values = [];
49117     if (node === null)
49118       return values;
49119     for (const child of Array.from(node.childNodes)) {
49120       if (!isElement(child))
49121         continue;
49122       const name = abbreviateName(child.nodeName);
49123       if (name === "gpxtpx:TrackPointExtension") {
49124         values = values.concat(getExtensions(child));
49125       } else {
49126         const val = nodeVal(child);
49127         values.push([name, parseNumeric(val)]);
49128       }
49129     }
49130     return values;
49131   }
49132   function abbreviateName(name) {
49133     return ["heart", "gpxtpx:hr", "hr"].includes(name) ? "heart" : name;
49134   }
49135   function parseNumeric(val) {
49136     const num = parseFloat(val);
49137     return isNaN(num) ? val : num;
49138   }
49139   function coordPair$1(node) {
49140     const ll = [
49141       parseFloat(node.getAttribute("lon") || ""),
49142       parseFloat(node.getAttribute("lat") || "")
49143     ];
49144     if (isNaN(ll[0]) || isNaN(ll[1])) {
49145       return null;
49146     }
49147     num1(node, "ele", (val) => {
49148       ll.push(val);
49149     });
49150     const time = get1(node, "time");
49151     return {
49152       coordinates: ll,
49153       time: time ? nodeVal(time) : null,
49154       extendedValues: getExtensions(get1(node, "extensions"))
49155     };
49156   }
49157   function extractProperties(node) {
49158     var _a3;
49159     const properties = getMulti(node, [
49160       "name",
49161       "cmt",
49162       "desc",
49163       "type",
49164       "time",
49165       "keywords"
49166     ]);
49167     const extensions = Array.from(node.getElementsByTagNameNS("http://www.garmin.com/xmlschemas/GpxExtensions/v3", "*"));
49168     for (const child of extensions) {
49169       if (((_a3 = child.parentNode) == null ? void 0 : _a3.parentNode) === node) {
49170         properties[child.tagName.replace(":", "_")] = nodeVal(child);
49171       }
49172     }
49173     const links = $(node, "link");
49174     if (links.length) {
49175       properties.links = links.map((link3) => Object.assign({ href: link3.getAttribute("href") }, getMulti(link3, ["text", "type"])));
49176     }
49177     return properties;
49178   }
49179   function getPoints$1(node, pointname) {
49180     const pts = $(node, pointname);
49181     const line = [];
49182     const times = [];
49183     const extendedValues = {};
49184     for (let i3 = 0; i3 < pts.length; i3++) {
49185       const c2 = coordPair$1(pts[i3]);
49186       if (!c2) {
49187         continue;
49188       }
49189       line.push(c2.coordinates);
49190       if (c2.time)
49191         times.push(c2.time);
49192       for (const [name, val] of c2.extendedValues) {
49193         const plural = name === "heart" ? name : name.replace("gpxtpx:", "") + "s";
49194         if (!extendedValues[plural]) {
49195           extendedValues[plural] = Array(pts.length).fill(null);
49196         }
49197         extendedValues[plural][i3] = val;
49198       }
49199     }
49200     if (line.length < 2)
49201       return;
49202     return {
49203       line,
49204       times,
49205       extendedValues
49206     };
49207   }
49208   function getRoute(node) {
49209     const line = getPoints$1(node, "rtept");
49210     if (!line)
49211       return;
49212     return {
49213       type: "Feature",
49214       properties: Object.assign({ _gpxType: "rte" }, extractProperties(node), getLineStyle(get1(node, "extensions"))),
49215       geometry: {
49216         type: "LineString",
49217         coordinates: line.line
49218       }
49219     };
49220   }
49221   function getTrack(node) {
49222     const segments = $(node, "trkseg");
49223     const track = [];
49224     const times = [];
49225     const extractedLines = [];
49226     for (const segment of segments) {
49227       const line = getPoints$1(segment, "trkpt");
49228       if (line) {
49229         extractedLines.push(line);
49230         if (line.times && line.times.length)
49231           times.push(line.times);
49232       }
49233     }
49234     if (extractedLines.length === 0)
49235       return null;
49236     const multi = extractedLines.length > 1;
49237     const properties = Object.assign({ _gpxType: "trk" }, extractProperties(node), getLineStyle(get1(node, "extensions")), times.length ? {
49238       coordinateProperties: {
49239         times: multi ? times : times[0]
49240       }
49241     } : {});
49242     for (const line of extractedLines) {
49243       track.push(line.line);
49244       if (!properties.coordinateProperties) {
49245         properties.coordinateProperties = {};
49246       }
49247       const props = properties.coordinateProperties;
49248       const entries = Object.entries(line.extendedValues);
49249       for (let i3 = 0; i3 < entries.length; i3++) {
49250         const [name, val] = entries[i3];
49251         if (multi) {
49252           if (!props[name]) {
49253             props[name] = extractedLines.map((line2) => new Array(line2.line.length).fill(null));
49254           }
49255           props[name][i3] = val;
49256         } else {
49257           props[name] = val;
49258         }
49259       }
49260     }
49261     return {
49262       type: "Feature",
49263       properties,
49264       geometry: multi ? {
49265         type: "MultiLineString",
49266         coordinates: track
49267       } : {
49268         type: "LineString",
49269         coordinates: track[0]
49270       }
49271     };
49272   }
49273   function getPoint(node) {
49274     const properties = Object.assign(extractProperties(node), getMulti(node, ["sym"]));
49275     const pair3 = coordPair$1(node);
49276     if (!pair3)
49277       return null;
49278     return {
49279       type: "Feature",
49280       properties,
49281       geometry: {
49282         type: "Point",
49283         coordinates: pair3.coordinates
49284       }
49285     };
49286   }
49287   function* gpxGen(node) {
49288     for (const track of $(node, "trk")) {
49289       const feature3 = getTrack(track);
49290       if (feature3)
49291         yield feature3;
49292     }
49293     for (const route of $(node, "rte")) {
49294       const feature3 = getRoute(route);
49295       if (feature3)
49296         yield feature3;
49297     }
49298     for (const waypoint of $(node, "wpt")) {
49299       const point = getPoint(waypoint);
49300       if (point)
49301         yield point;
49302     }
49303   }
49304   function gpx(node) {
49305     return {
49306       type: "FeatureCollection",
49307       features: Array.from(gpxGen(node))
49308     };
49309   }
49310   function fixColor(v2, prefix) {
49311     const properties = {};
49312     const colorProp = prefix == "stroke" || prefix === "fill" ? prefix : prefix + "-color";
49313     if (v2[0] === "#") {
49314       v2 = v2.substring(1);
49315     }
49316     if (v2.length === 6 || v2.length === 3) {
49317       properties[colorProp] = "#" + v2;
49318     } else if (v2.length === 8) {
49319       properties[prefix + "-opacity"] = parseInt(v2.substring(0, 2), 16) / 255;
49320       properties[colorProp] = "#" + v2.substring(6, 8) + v2.substring(4, 6) + v2.substring(2, 4);
49321     }
49322     return properties;
49323   }
49324   function numericProperty(node, source, target) {
49325     const properties = {};
49326     num1(node, source, (val) => {
49327       properties[target] = val;
49328     });
49329     return properties;
49330   }
49331   function getColor(node, output) {
49332     return get3(node, "color", (elem) => fixColor(nodeVal(elem), output));
49333   }
49334   function extractIconHref(node) {
49335     return get3(node, "Icon", (icon2, properties) => {
49336       val1(icon2, "href", (href) => {
49337         properties.icon = href;
49338       });
49339       return properties;
49340     });
49341   }
49342   function extractIcon(node) {
49343     return get3(node, "IconStyle", (iconStyle) => {
49344       return Object.assign(getColor(iconStyle, "icon"), numericProperty(iconStyle, "scale", "icon-scale"), numericProperty(iconStyle, "heading", "icon-heading"), get3(iconStyle, "hotSpot", (hotspot) => {
49345         const left = parseFloat(hotspot.getAttribute("x") || "");
49346         const top = parseFloat(hotspot.getAttribute("y") || "");
49347         const xunits = hotspot.getAttribute("xunits") || "";
49348         const yunits = hotspot.getAttribute("yunits") || "";
49349         if (!isNaN(left) && !isNaN(top))
49350           return {
49351             "icon-offset": [left, top],
49352             "icon-offset-units": [xunits, yunits]
49353           };
49354         return {};
49355       }), extractIconHref(iconStyle));
49356     });
49357   }
49358   function extractLabel(node) {
49359     return get3(node, "LabelStyle", (labelStyle) => {
49360       return Object.assign(getColor(labelStyle, "label"), numericProperty(labelStyle, "scale", "label-scale"));
49361     });
49362   }
49363   function extractLine(node) {
49364     return get3(node, "LineStyle", (lineStyle) => {
49365       return Object.assign(getColor(lineStyle, "stroke"), numericProperty(lineStyle, "width", "stroke-width"));
49366     });
49367   }
49368   function extractPoly(node) {
49369     return get3(node, "PolyStyle", (polyStyle, properties) => {
49370       return Object.assign(properties, get3(polyStyle, "color", (elem) => fixColor(nodeVal(elem), "fill")), val1(polyStyle, "fill", (fill) => {
49371         if (fill === "0")
49372           return { "fill-opacity": 0 };
49373       }), val1(polyStyle, "outline", (outline) => {
49374         if (outline === "0")
49375           return { "stroke-opacity": 0 };
49376       }));
49377     });
49378   }
49379   function extractStyle(node) {
49380     return Object.assign({}, extractPoly(node), extractLine(node), extractLabel(node), extractIcon(node));
49381   }
49382   var toNumber2 = (x2) => Number(x2);
49383   var typeConverters = {
49384     string: (x2) => x2,
49385     int: toNumber2,
49386     uint: toNumber2,
49387     short: toNumber2,
49388     ushort: toNumber2,
49389     float: toNumber2,
49390     double: toNumber2,
49391     bool: (x2) => Boolean(x2)
49392   };
49393   function extractExtendedData(node, schema) {
49394     return get3(node, "ExtendedData", (extendedData, properties) => {
49395       for (const data of $(extendedData, "Data")) {
49396         properties[data.getAttribute("name") || ""] = nodeVal(get1(data, "value"));
49397       }
49398       for (const simpleData of $(extendedData, "SimpleData")) {
49399         const name = simpleData.getAttribute("name") || "";
49400         const typeConverter = schema[name] || typeConverters.string;
49401         properties[name] = typeConverter(nodeVal(simpleData));
49402       }
49403       return properties;
49404     });
49405   }
49406   function getMaybeHTMLDescription(node) {
49407     const descriptionNode = get1(node, "description");
49408     for (const c2 of Array.from((descriptionNode == null ? void 0 : descriptionNode.childNodes) || [])) {
49409       if (c2.nodeType === 4) {
49410         return {
49411           description: {
49412             "@type": "html",
49413             value: nodeVal(c2)
49414           }
49415         };
49416       }
49417     }
49418     return {};
49419   }
49420   function extractTimeSpan(node) {
49421     return get3(node, "TimeSpan", (timeSpan) => {
49422       return {
49423         timespan: {
49424           begin: nodeVal(get1(timeSpan, "begin")),
49425           end: nodeVal(get1(timeSpan, "end"))
49426         }
49427       };
49428     });
49429   }
49430   function extractTimeStamp(node) {
49431     return get3(node, "TimeStamp", (timeStamp) => {
49432       return { timestamp: nodeVal(get1(timeStamp, "when")) };
49433     });
49434   }
49435   function extractCascadedStyle(node, styleMap) {
49436     return val1(node, "styleUrl", (styleUrl) => {
49437       styleUrl = normalizeId(styleUrl);
49438       if (styleMap[styleUrl]) {
49439         return Object.assign({ styleUrl }, styleMap[styleUrl]);
49440       }
49441       return { styleUrl };
49442     });
49443   }
49444   var removeSpace = /\s*/g;
49445   var trimSpace = /^\s*|\s*$/g;
49446   var splitSpace = /\s+/;
49447   function coord1(value) {
49448     return value.replace(removeSpace, "").split(",").map(parseFloat).filter((num) => !isNaN(num)).slice(0, 3);
49449   }
49450   function coord(value) {
49451     return value.replace(trimSpace, "").split(splitSpace).map(coord1).filter((coord2) => {
49452       return coord2.length >= 2;
49453     });
49454   }
49455   function gxCoords(node) {
49456     let elems = $(node, "coord");
49457     if (elems.length === 0) {
49458       elems = $ns(node, "coord", "*");
49459     }
49460     const coordinates = elems.map((elem) => {
49461       return nodeVal(elem).split(" ").map(parseFloat);
49462     });
49463     if (coordinates.length === 0) {
49464       return null;
49465     }
49466     return {
49467       geometry: coordinates.length > 2 ? {
49468         type: "LineString",
49469         coordinates
49470       } : {
49471         type: "Point",
49472         coordinates: coordinates[0]
49473       },
49474       times: $(node, "when").map((elem) => nodeVal(elem))
49475     };
49476   }
49477   function fixRing(ring) {
49478     if (ring.length === 0)
49479       return ring;
49480     const first = ring[0];
49481     const last = ring[ring.length - 1];
49482     let equal = true;
49483     for (let i3 = 0; i3 < Math.max(first.length, last.length); i3++) {
49484       if (first[i3] !== last[i3]) {
49485         equal = false;
49486         break;
49487       }
49488     }
49489     if (!equal) {
49490       return ring.concat([ring[0]]);
49491     }
49492     return ring;
49493   }
49494   function getCoordinates(node) {
49495     return nodeVal(get1(node, "coordinates"));
49496   }
49497   function getGeometry(node) {
49498     let geometries = [];
49499     let coordTimes = [];
49500     for (let i3 = 0; i3 < node.childNodes.length; i3++) {
49501       const child = node.childNodes.item(i3);
49502       if (isElement(child)) {
49503         switch (child.tagName) {
49504           case "MultiGeometry":
49505           case "MultiTrack":
49506           case "gx:MultiTrack": {
49507             const childGeometries = getGeometry(child);
49508             geometries = geometries.concat(childGeometries.geometries);
49509             coordTimes = coordTimes.concat(childGeometries.coordTimes);
49510             break;
49511           }
49512           case "Point": {
49513             const coordinates = coord1(getCoordinates(child));
49514             if (coordinates.length >= 2) {
49515               geometries.push({
49516                 type: "Point",
49517                 coordinates
49518               });
49519             }
49520             break;
49521           }
49522           case "LinearRing":
49523           case "LineString": {
49524             const coordinates = coord(getCoordinates(child));
49525             if (coordinates.length >= 2) {
49526               geometries.push({
49527                 type: "LineString",
49528                 coordinates
49529               });
49530             }
49531             break;
49532           }
49533           case "Polygon": {
49534             const coords = [];
49535             for (const linearRing of $(child, "LinearRing")) {
49536               const ring = fixRing(coord(getCoordinates(linearRing)));
49537               if (ring.length >= 4) {
49538                 coords.push(ring);
49539               }
49540             }
49541             if (coords.length) {
49542               geometries.push({
49543                 type: "Polygon",
49544                 coordinates: coords
49545               });
49546             }
49547             break;
49548           }
49549           case "Track":
49550           case "gx:Track": {
49551             const gx = gxCoords(child);
49552             if (!gx)
49553               break;
49554             const { times, geometry } = gx;
49555             geometries.push(geometry);
49556             if (times.length)
49557               coordTimes.push(times);
49558             break;
49559           }
49560         }
49561       }
49562     }
49563     return {
49564       geometries,
49565       coordTimes
49566     };
49567   }
49568   function geometryListToGeometry(geometries) {
49569     return geometries.length === 0 ? null : geometries.length === 1 ? geometries[0] : {
49570       type: "GeometryCollection",
49571       geometries
49572     };
49573   }
49574   function getPlacemark(node, styleMap, schema, options2) {
49575     var _a3;
49576     const { coordTimes, geometries } = getGeometry(node);
49577     const geometry = geometryListToGeometry(geometries);
49578     if (!geometry && options2.skipNullGeometry) {
49579       return null;
49580     }
49581     const feature3 = {
49582       type: "Feature",
49583       geometry,
49584       properties: Object.assign(getMulti(node, [
49585         "name",
49586         "address",
49587         "visibility",
49588         "open",
49589         "phoneNumber",
49590         "description"
49591       ]), getMaybeHTMLDescription(node), extractCascadedStyle(node, styleMap), extractStyle(node), extractExtendedData(node, schema), extractTimeSpan(node), extractTimeStamp(node), coordTimes.length ? {
49592         coordinateProperties: {
49593           times: coordTimes.length === 1 ? coordTimes[0] : coordTimes
49594         }
49595       } : {})
49596     };
49597     if (((_a3 = feature3.properties) == null ? void 0 : _a3.visibility) !== void 0) {
49598       feature3.properties.visibility = feature3.properties.visibility !== "0";
49599     }
49600     const id2 = node.getAttribute("id");
49601     if (id2 !== null && id2 !== "")
49602       feature3.id = id2;
49603     return feature3;
49604   }
49605   function getGroundOverlayBox(node) {
49606     const latLonQuad = get1(node, "gx:LatLonQuad");
49607     if (latLonQuad) {
49608       const ring = fixRing(coord(getCoordinates(node)));
49609       return {
49610         geometry: {
49611           type: "Polygon",
49612           coordinates: [ring]
49613         }
49614       };
49615     }
49616     return getLatLonBox(node);
49617   }
49618   var DEGREES_TO_RADIANS = Math.PI / 180;
49619   function rotateBox(bbox2, coordinates, rotation) {
49620     const center = [(bbox2[0] + bbox2[2]) / 2, (bbox2[1] + bbox2[3]) / 2];
49621     return [
49622       coordinates[0].map((coordinate) => {
49623         const dy = coordinate[1] - center[1];
49624         const dx = coordinate[0] - center[0];
49625         const distance = Math.sqrt(Math.pow(dy, 2) + Math.pow(dx, 2));
49626         const angle2 = Math.atan2(dy, dx) + rotation * DEGREES_TO_RADIANS;
49627         return [
49628           center[0] + Math.cos(angle2) * distance,
49629           center[1] + Math.sin(angle2) * distance
49630         ];
49631       })
49632     ];
49633   }
49634   function getLatLonBox(node) {
49635     const latLonBox = get1(node, "LatLonBox");
49636     if (latLonBox) {
49637       const north = num1(latLonBox, "north");
49638       const west = num1(latLonBox, "west");
49639       const east = num1(latLonBox, "east");
49640       const south = num1(latLonBox, "south");
49641       const rotation = num1(latLonBox, "rotation");
49642       if (typeof north === "number" && typeof south === "number" && typeof west === "number" && typeof east === "number") {
49643         const bbox2 = [west, south, east, north];
49644         let coordinates = [
49645           [
49646             [west, north],
49647             [east, north],
49648             [east, south],
49649             [west, south],
49650             [west, north]
49651             // top left (again)
49652           ]
49653         ];
49654         if (typeof rotation === "number") {
49655           coordinates = rotateBox(bbox2, coordinates, rotation);
49656         }
49657         return {
49658           bbox: bbox2,
49659           geometry: {
49660             type: "Polygon",
49661             coordinates
49662           }
49663         };
49664       }
49665     }
49666     return null;
49667   }
49668   function getGroundOverlay(node, styleMap, schema, options2) {
49669     var _a3;
49670     const box = getGroundOverlayBox(node);
49671     const geometry = (box == null ? void 0 : box.geometry) || null;
49672     if (!geometry && options2.skipNullGeometry) {
49673       return null;
49674     }
49675     const feature3 = {
49676       type: "Feature",
49677       geometry,
49678       properties: Object.assign(
49679         /**
49680          * Related to
49681          * https://gist.github.com/tmcw/037a1cb6660d74a392e9da7446540f46
49682          */
49683         { "@geometry-type": "groundoverlay" },
49684         getMulti(node, [
49685           "name",
49686           "address",
49687           "visibility",
49688           "open",
49689           "phoneNumber",
49690           "description"
49691         ]),
49692         getMaybeHTMLDescription(node),
49693         extractCascadedStyle(node, styleMap),
49694         extractStyle(node),
49695         extractIconHref(node),
49696         extractExtendedData(node, schema),
49697         extractTimeSpan(node),
49698         extractTimeStamp(node)
49699       )
49700     };
49701     if (box == null ? void 0 : box.bbox) {
49702       feature3.bbox = box.bbox;
49703     }
49704     if (((_a3 = feature3.properties) == null ? void 0 : _a3.visibility) !== void 0) {
49705       feature3.properties.visibility = feature3.properties.visibility !== "0";
49706     }
49707     const id2 = node.getAttribute("id");
49708     if (id2 !== null && id2 !== "")
49709       feature3.id = id2;
49710     return feature3;
49711   }
49712   function getStyleId(style) {
49713     let id2 = style.getAttribute("id");
49714     const parentNode = style.parentNode;
49715     if (!id2 && isElement(parentNode) && parentNode.localName === "CascadingStyle") {
49716       id2 = parentNode.getAttribute("kml:id") || parentNode.getAttribute("id");
49717     }
49718     return normalizeId(id2 || "");
49719   }
49720   function buildStyleMap(node) {
49721     const styleMap = {};
49722     for (const style of $(node, "Style")) {
49723       styleMap[getStyleId(style)] = extractStyle(style);
49724     }
49725     for (const map2 of $(node, "StyleMap")) {
49726       const id2 = normalizeId(map2.getAttribute("id") || "");
49727       val1(map2, "styleUrl", (styleUrl) => {
49728         styleUrl = normalizeId(styleUrl);
49729         if (styleMap[styleUrl]) {
49730           styleMap[id2] = styleMap[styleUrl];
49731         }
49732       });
49733     }
49734     return styleMap;
49735   }
49736   function buildSchema(node) {
49737     const schema = {};
49738     for (const field of $(node, "SimpleField")) {
49739       schema[field.getAttribute("name") || ""] = typeConverters[field.getAttribute("type") || ""] || typeConverters["string"];
49740     }
49741     return schema;
49742   }
49743   function* kmlGen(node, options2 = {
49744     skipNullGeometry: false
49745   }) {
49746     const styleMap = buildStyleMap(node);
49747     const schema = buildSchema(node);
49748     for (const placemark of $(node, "Placemark")) {
49749       const feature3 = getPlacemark(placemark, styleMap, schema, options2);
49750       if (feature3)
49751         yield feature3;
49752     }
49753     for (const groundOverlay of $(node, "GroundOverlay")) {
49754       const feature3 = getGroundOverlay(groundOverlay, styleMap, schema, options2);
49755       if (feature3)
49756         yield feature3;
49757     }
49758   }
49759   function kml(node, options2 = {
49760     skipNullGeometry: false
49761   }) {
49762     return {
49763       type: "FeatureCollection",
49764       features: Array.from(kmlGen(node, options2))
49765     };
49766   }
49767
49768   // modules/svg/data.js
49769   var _initialized = false;
49770   var _enabled = false;
49771   var _geojson;
49772   function svgData(projection2, context, dispatch14) {
49773     var throttledRedraw = throttle_default(function() {
49774       dispatch14.call("change");
49775     }, 1e3);
49776     var _showLabels = true;
49777     var detected = utilDetect();
49778     var layer = select_default2(null);
49779     var _vtService;
49780     var _fileList;
49781     var _template;
49782     var _src;
49783     const supportedFormats = [
49784       ".gpx",
49785       ".kml",
49786       ".geojson",
49787       ".json"
49788     ];
49789     function init2() {
49790       if (_initialized) return;
49791       _geojson = {};
49792       _enabled = true;
49793       function over(d3_event) {
49794         d3_event.stopPropagation();
49795         d3_event.preventDefault();
49796         d3_event.dataTransfer.dropEffect = "copy";
49797       }
49798       context.container().attr("dropzone", "copy").on("drop.svgData", function(d3_event) {
49799         d3_event.stopPropagation();
49800         d3_event.preventDefault();
49801         if (!detected.filedrop) return;
49802         var f2 = d3_event.dataTransfer.files[0];
49803         var extension = getExtension(f2.name);
49804         if (!supportedFormats.includes(extension)) return;
49805         drawData.fileList(d3_event.dataTransfer.files);
49806       }).on("dragenter.svgData", over).on("dragexit.svgData", over).on("dragover.svgData", over);
49807       _initialized = true;
49808     }
49809     function getService() {
49810       if (services.vectorTile && !_vtService) {
49811         _vtService = services.vectorTile;
49812         _vtService.event.on("loadedData", throttledRedraw);
49813       } else if (!services.vectorTile && _vtService) {
49814         _vtService = null;
49815       }
49816       return _vtService;
49817     }
49818     function showLayer() {
49819       layerOn();
49820       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
49821         dispatch14.call("change");
49822       });
49823     }
49824     function hideLayer() {
49825       throttledRedraw.cancel();
49826       layer.transition().duration(250).style("opacity", 0).on("end", layerOff);
49827     }
49828     function layerOn() {
49829       layer.style("display", "block");
49830     }
49831     function layerOff() {
49832       layer.selectAll(".viewfield-group").remove();
49833       layer.style("display", "none");
49834     }
49835     function ensureIDs(gj) {
49836       if (!gj) return null;
49837       if (gj.type === "FeatureCollection") {
49838         for (var i3 = 0; i3 < gj.features.length; i3++) {
49839           ensureFeatureID(gj.features[i3]);
49840         }
49841       } else {
49842         ensureFeatureID(gj);
49843       }
49844       return gj;
49845     }
49846     function ensureFeatureID(feature3) {
49847       if (!feature3) return;
49848       feature3.__featurehash__ = utilHashcode((0, import_fast_json_stable_stringify.default)(feature3));
49849       return feature3;
49850     }
49851     function getFeatures(gj) {
49852       if (!gj) return [];
49853       if (gj.type === "FeatureCollection") {
49854         return gj.features;
49855       } else {
49856         return [gj];
49857       }
49858     }
49859     function featureKey(d2) {
49860       return d2.__featurehash__;
49861     }
49862     function isPolygon(d2) {
49863       return d2.geometry.type === "Polygon" || d2.geometry.type === "MultiPolygon";
49864     }
49865     function clipPathID(d2) {
49866       return "ideditor-data-" + d2.__featurehash__ + "-clippath";
49867     }
49868     function featureClasses(d2) {
49869       return [
49870         "data" + d2.__featurehash__,
49871         d2.geometry.type,
49872         isPolygon(d2) ? "area" : "",
49873         d2.__layerID__ || ""
49874       ].filter(Boolean).join(" ");
49875     }
49876     function drawData(selection2) {
49877       var vtService = getService();
49878       var getPath = svgPath(projection2).geojson;
49879       var getAreaPath = svgPath(projection2, null, true).geojson;
49880       var hasData = drawData.hasData();
49881       layer = selection2.selectAll(".layer-mapdata").data(_enabled && hasData ? [0] : []);
49882       layer.exit().remove();
49883       layer = layer.enter().append("g").attr("class", "layer-mapdata").merge(layer);
49884       var surface = context.surface();
49885       if (!surface || surface.empty()) return;
49886       var geoData, polygonData;
49887       if (_template && vtService) {
49888         var sourceID = _template;
49889         vtService.loadTiles(sourceID, _template, projection2);
49890         geoData = vtService.data(sourceID, projection2);
49891       } else {
49892         geoData = getFeatures(_geojson);
49893       }
49894       geoData = geoData.filter(getPath);
49895       polygonData = geoData.filter(isPolygon);
49896       var clipPaths = surface.selectAll("defs").selectAll(".clipPath-data").data(polygonData, featureKey);
49897       clipPaths.exit().remove();
49898       var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-data").attr("id", clipPathID);
49899       clipPathsEnter.append("path");
49900       clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", getAreaPath);
49901       var datagroups = layer.selectAll("g.datagroup").data(["fill", "shadow", "stroke"]);
49902       datagroups = datagroups.enter().append("g").attr("class", function(d2) {
49903         return "datagroup datagroup-" + d2;
49904       }).merge(datagroups);
49905       var pathData = {
49906         fill: polygonData,
49907         shadow: geoData,
49908         stroke: geoData
49909       };
49910       var paths = datagroups.selectAll("path").data(function(layer2) {
49911         return pathData[layer2];
49912       }, featureKey);
49913       paths.exit().remove();
49914       paths = paths.enter().append("path").attr("class", function(d2) {
49915         var datagroup = this.parentNode.__data__;
49916         return "pathdata " + datagroup + " " + featureClasses(d2);
49917       }).attr("clip-path", function(d2) {
49918         var datagroup = this.parentNode.__data__;
49919         return datagroup === "fill" ? "url(#" + clipPathID(d2) + ")" : null;
49920       }).merge(paths).attr("d", function(d2) {
49921         var datagroup = this.parentNode.__data__;
49922         return datagroup === "fill" ? getAreaPath(d2) : getPath(d2);
49923       });
49924       layer.call(drawLabels, "label-halo", geoData).call(drawLabels, "label", geoData);
49925       function drawLabels(selection3, textClass, data) {
49926         var labelPath = path_default(projection2);
49927         var labelData = data.filter(function(d2) {
49928           return _showLabels && d2.properties && (d2.properties.desc || d2.properties.name);
49929         });
49930         var labels = selection3.selectAll("text." + textClass).data(labelData, featureKey);
49931         labels.exit().remove();
49932         labels = labels.enter().append("text").attr("class", function(d2) {
49933           return textClass + " " + featureClasses(d2);
49934         }).merge(labels).text(function(d2) {
49935           return d2.properties.desc || d2.properties.name;
49936         }).attr("x", function(d2) {
49937           var centroid = labelPath.centroid(d2);
49938           return centroid[0] + 11;
49939         }).attr("y", function(d2) {
49940           var centroid = labelPath.centroid(d2);
49941           return centroid[1];
49942         });
49943       }
49944     }
49945     function getExtension(fileName) {
49946       if (!fileName) return;
49947       var re3 = /\.(gpx|kml|(geo)?json|png)$/i;
49948       var match = fileName.toLowerCase().match(re3);
49949       return match && match.length && match[0];
49950     }
49951     function xmlToDom(textdata) {
49952       return new DOMParser().parseFromString(textdata, "text/xml");
49953     }
49954     function stringifyGeojsonProperties(feature3) {
49955       const properties = feature3.properties;
49956       for (const key in properties) {
49957         const property = properties[key];
49958         if (typeof property === "number" || typeof property === "boolean" || Array.isArray(property)) {
49959           properties[key] = property.toString();
49960         } else if (property === null) {
49961           properties[key] = "null";
49962         } else if (typeof property === "object") {
49963           properties[key] = JSON.stringify(property);
49964         }
49965       }
49966     }
49967     drawData.setFile = function(extension, data) {
49968       _template = null;
49969       _fileList = null;
49970       _geojson = null;
49971       _src = null;
49972       var gj;
49973       switch (extension) {
49974         case ".gpx":
49975           gj = gpx(xmlToDom(data));
49976           break;
49977         case ".kml":
49978           gj = kml(xmlToDom(data));
49979           break;
49980         case ".geojson":
49981         case ".json":
49982           gj = JSON.parse(data);
49983           if (gj.type === "FeatureCollection") {
49984             gj.features.forEach(stringifyGeojsonProperties);
49985           } else if (gj.type === "Feature") {
49986             stringifyGeojsonProperties(gj);
49987           }
49988           break;
49989       }
49990       gj = gj || {};
49991       if (Object.keys(gj).length) {
49992         _geojson = ensureIDs(gj);
49993         _src = extension + " data file";
49994         this.fitZoom();
49995       }
49996       dispatch14.call("change");
49997       return this;
49998     };
49999     drawData.showLabels = function(val) {
50000       if (!arguments.length) return _showLabels;
50001       _showLabels = val;
50002       return this;
50003     };
50004     drawData.enabled = function(val) {
50005       if (!arguments.length) return _enabled;
50006       _enabled = val;
50007       if (_enabled) {
50008         showLayer();
50009       } else {
50010         hideLayer();
50011       }
50012       dispatch14.call("change");
50013       return this;
50014     };
50015     drawData.hasData = function() {
50016       var gj = _geojson || {};
50017       return !!(_template || Object.keys(gj).length);
50018     };
50019     drawData.template = function(val, src) {
50020       if (!arguments.length) return _template;
50021       var osm = context.connection();
50022       if (osm) {
50023         var blocklists = osm.imageryBlocklists();
50024         var fail = false;
50025         var tested = 0;
50026         var regex;
50027         for (var i3 = 0; i3 < blocklists.length; i3++) {
50028           regex = blocklists[i3];
50029           fail = regex.test(val);
50030           tested++;
50031           if (fail) break;
50032         }
50033         if (!tested) {
50034           regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
50035           fail = regex.test(val);
50036         }
50037       }
50038       _template = val;
50039       _fileList = null;
50040       _geojson = null;
50041       _src = src || "vectortile:" + val.split(/[?#]/)[0];
50042       dispatch14.call("change");
50043       return this;
50044     };
50045     drawData.geojson = function(gj, src) {
50046       if (!arguments.length) return _geojson;
50047       _template = null;
50048       _fileList = null;
50049       _geojson = null;
50050       _src = null;
50051       gj = gj || {};
50052       if (Object.keys(gj).length) {
50053         _geojson = ensureIDs(gj);
50054         _src = src || "unknown.geojson";
50055       }
50056       dispatch14.call("change");
50057       return this;
50058     };
50059     drawData.fileList = function(fileList) {
50060       if (!arguments.length) return _fileList;
50061       _template = null;
50062       _geojson = null;
50063       _src = null;
50064       _fileList = fileList;
50065       if (!fileList || !fileList.length) return this;
50066       var f2 = fileList[0];
50067       var extension = getExtension(f2.name);
50068       var reader = new FileReader();
50069       reader.onload = /* @__PURE__ */ function() {
50070         return function(e3) {
50071           drawData.setFile(extension, e3.target.result);
50072         };
50073       }(f2);
50074       reader.readAsText(f2);
50075       return this;
50076     };
50077     drawData.url = function(url, defaultExtension) {
50078       _template = null;
50079       _fileList = null;
50080       _geojson = null;
50081       _src = null;
50082       var testUrl = url.split(/[?#]/)[0];
50083       var extension = getExtension(testUrl) || defaultExtension;
50084       if (extension) {
50085         _template = null;
50086         text_default3(url).then(function(data) {
50087           drawData.setFile(extension, data);
50088         }).catch(function() {
50089         });
50090       } else {
50091         drawData.template(url);
50092       }
50093       return this;
50094     };
50095     drawData.getSrc = function() {
50096       return _src || "";
50097     };
50098     drawData.fitZoom = function() {
50099       var features = getFeatures(_geojson);
50100       if (!features.length) return;
50101       var map2 = context.map();
50102       var viewport = map2.trimmedExtent().polygon();
50103       var coords = features.reduce(function(coords2, feature3) {
50104         var geom = feature3.geometry;
50105         if (!geom) return coords2;
50106         var c2 = geom.coordinates;
50107         switch (geom.type) {
50108           case "Point":
50109             c2 = [c2];
50110           case "MultiPoint":
50111           case "LineString":
50112             break;
50113           case "MultiPolygon":
50114             c2 = utilArrayFlatten(c2);
50115           case "Polygon":
50116           case "MultiLineString":
50117             c2 = utilArrayFlatten(c2);
50118             break;
50119         }
50120         return utilArrayUnion(coords2, c2);
50121       }, []);
50122       if (!geoPolygonIntersectsPolygon(viewport, coords, true)) {
50123         var extent = geoExtent(bounds_default({ type: "LineString", coordinates: coords }));
50124         map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
50125       }
50126       return this;
50127     };
50128     init2();
50129     return drawData;
50130   }
50131
50132   // modules/svg/debug.js
50133   function svgDebug(projection2, context) {
50134     function drawDebug(selection2) {
50135       const showTile = context.getDebug("tile");
50136       const showCollision = context.getDebug("collision");
50137       const showImagery = context.getDebug("imagery");
50138       const showTouchTargets = context.getDebug("target");
50139       const showDownloaded = context.getDebug("downloaded");
50140       let debugData = [];
50141       if (showTile) {
50142         debugData.push({ class: "red", label: "tile" });
50143       }
50144       if (showCollision) {
50145         debugData.push({ class: "yellow", label: "collision" });
50146       }
50147       if (showImagery) {
50148         debugData.push({ class: "orange", label: "imagery" });
50149       }
50150       if (showTouchTargets) {
50151         debugData.push({ class: "pink", label: "touchTargets" });
50152       }
50153       if (showDownloaded) {
50154         debugData.push({ class: "purple", label: "downloaded" });
50155       }
50156       let legend = context.container().select(".main-content").selectAll(".debug-legend").data(debugData.length ? [0] : []);
50157       legend.exit().remove();
50158       legend = legend.enter().append("div").attr("class", "fillD debug-legend").merge(legend);
50159       let legendItems = legend.selectAll(".debug-legend-item").data(debugData, (d2) => d2.label);
50160       legendItems.exit().remove();
50161       legendItems.enter().append("span").attr("class", (d2) => "debug-legend-item ".concat(d2.class)).text((d2) => d2.label);
50162       let layer = selection2.selectAll(".layer-debug").data(showImagery || showDownloaded ? [0] : []);
50163       layer.exit().remove();
50164       layer = layer.enter().append("g").attr("class", "layer-debug").merge(layer);
50165       const extent = context.map().extent();
50166       _mainFileFetcher.get("imagery").then((d2) => {
50167         const hits = showImagery && d2.query.bbox(extent.rectangle(), true) || [];
50168         const features = hits.map((d4) => d4.features[d4.id]);
50169         let imagery = layer.selectAll("path.debug-imagery").data(features);
50170         imagery.exit().remove();
50171         imagery.enter().append("path").attr("class", "debug-imagery debug orange");
50172       }).catch(() => {
50173       });
50174       const osm = context.connection();
50175       let dataDownloaded = [];
50176       if (osm && showDownloaded) {
50177         const rtree = osm.caches("get").tile.rtree;
50178         dataDownloaded = rtree.all().map((bbox2) => {
50179           return {
50180             type: "Feature",
50181             properties: { id: bbox2.id },
50182             geometry: {
50183               type: "Polygon",
50184               coordinates: [[
50185                 [bbox2.minX, bbox2.minY],
50186                 [bbox2.minX, bbox2.maxY],
50187                 [bbox2.maxX, bbox2.maxY],
50188                 [bbox2.maxX, bbox2.minY],
50189                 [bbox2.minX, bbox2.minY]
50190               ]]
50191             }
50192           };
50193         });
50194       }
50195       let downloaded = layer.selectAll("path.debug-downloaded").data(showDownloaded ? dataDownloaded : []);
50196       downloaded.exit().remove();
50197       downloaded.enter().append("path").attr("class", "debug-downloaded debug purple");
50198       layer.selectAll("path").attr("d", svgPath(projection2).geojson);
50199     }
50200     drawDebug.enabled = function() {
50201       if (!arguments.length) {
50202         return context.getDebug("tile") || context.getDebug("collision") || context.getDebug("imagery") || context.getDebug("target") || context.getDebug("downloaded");
50203       } else {
50204         return this;
50205       }
50206     };
50207     return drawDebug;
50208   }
50209
50210   // modules/svg/defs.js
50211   function svgDefs(context) {
50212     var _defsSelection = select_default2(null);
50213     var _spritesheetIds = [
50214       "iD-sprite",
50215       "maki-sprite",
50216       "temaki-sprite",
50217       "fa-sprite",
50218       "roentgen-sprite",
50219       "community-sprite"
50220     ];
50221     function drawDefs(selection2) {
50222       _defsSelection = selection2.append("defs");
50223       _defsSelection.append("marker").attr("id", "ideditor-oneway-marker").attr("viewBox", "0 0 10 5").attr("refX", 2.5).attr("refY", 2.5).attr("markerWidth", 2).attr("markerHeight", 2).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("class", "oneway-marker-path").attr("d", "M 5,3 L 0,3 L 0,2 L 5,2 L 5,0 L 10,2.5 L 5,5 z").attr("stroke", "none").attr("fill", "#000").attr("opacity", "0.75");
50224       function addSidedMarker(name, color2, offset) {
50225         _defsSelection.append("marker").attr("id", "ideditor-sided-marker-" + name).attr("viewBox", "0 0 2 2").attr("refX", 1).attr("refY", -offset).attr("markerWidth", 1.5).attr("markerHeight", 1.5).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("class", "sided-marker-path sided-marker-" + name + "-path").attr("d", "M 0,0 L 1,1 L 2,0 z").attr("stroke", "none").attr("fill", color2);
50226       }
50227       addSidedMarker("natural", "rgb(170, 170, 170)", 0);
50228       addSidedMarker("coastline", "#77dede", 1);
50229       addSidedMarker("waterway", "#77dede", 1);
50230       addSidedMarker("barrier", "#ddd", 1);
50231       addSidedMarker("man_made", "#fff", 0);
50232       _defsSelection.append("marker").attr("id", "ideditor-viewfield-marker").attr("viewBox", "0 0 16 16").attr("refX", 8).attr("refY", 16).attr("markerWidth", 4).attr("markerHeight", 4).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("class", "viewfield-marker-path").attr("d", "M 6,14 C 8,13.4 8,13.4 10,14 L 16,3 C 12,0 4,0 0,3 z").attr("fill", "#333").attr("fill-opacity", "0.75").attr("stroke", "#fff").attr("stroke-width", "0.5px").attr("stroke-opacity", "0.75");
50233       _defsSelection.append("marker").attr("id", "ideditor-viewfield-marker-wireframe").attr("viewBox", "0 0 16 16").attr("refX", 8).attr("refY", 16).attr("markerWidth", 4).attr("markerHeight", 4).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("class", "viewfield-marker-path").attr("d", "M 6,14 C 8,13.4 8,13.4 10,14 L 16,3 C 12,0 4,0 0,3 z").attr("fill", "none").attr("stroke", "#fff").attr("stroke-width", "0.5px").attr("stroke-opacity", "0.75");
50234       var patterns2 = _defsSelection.selectAll("pattern").data([
50235         // pattern name, pattern image name
50236         ["beach", "dots"],
50237         ["construction", "construction"],
50238         ["cemetery", "cemetery"],
50239         ["cemetery_christian", "cemetery_christian"],
50240         ["cemetery_buddhist", "cemetery_buddhist"],
50241         ["cemetery_muslim", "cemetery_muslim"],
50242         ["cemetery_jewish", "cemetery_jewish"],
50243         ["farmland", "farmland"],
50244         ["farmyard", "farmyard"],
50245         ["forest", "forest"],
50246         ["forest_broadleaved", "forest_broadleaved"],
50247         ["forest_needleleaved", "forest_needleleaved"],
50248         ["forest_leafless", "forest_leafless"],
50249         ["golf_green", "grass"],
50250         ["grass", "grass"],
50251         ["landfill", "landfill"],
50252         ["meadow", "grass"],
50253         ["orchard", "orchard"],
50254         ["pond", "pond"],
50255         ["quarry", "quarry"],
50256         ["scrub", "bushes"],
50257         ["vineyard", "vineyard"],
50258         ["water_standing", "lines"],
50259         ["waves", "waves"],
50260         ["wetland", "wetland"],
50261         ["wetland_marsh", "wetland_marsh"],
50262         ["wetland_swamp", "wetland_swamp"],
50263         ["wetland_bog", "wetland_bog"],
50264         ["wetland_reedbed", "wetland_reedbed"]
50265       ]).enter().append("pattern").attr("id", function(d2) {
50266         return "ideditor-pattern-" + d2[0];
50267       }).attr("width", 32).attr("height", 32).attr("patternUnits", "userSpaceOnUse");
50268       patterns2.append("rect").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("class", function(d2) {
50269         return "pattern-color-" + d2[0];
50270       });
50271       patterns2.append("image").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("xlink:href", function(d2) {
50272         return context.imagePath("pattern/" + d2[1] + ".png");
50273       });
50274       _defsSelection.selectAll("clipPath").data([12, 18, 20, 32, 45]).enter().append("clipPath").attr("id", function(d2) {
50275         return "ideditor-clip-square-" + d2;
50276       }).append("rect").attr("x", 0).attr("y", 0).attr("width", function(d2) {
50277         return d2;
50278       }).attr("height", function(d2) {
50279         return d2;
50280       });
50281       addSprites(_spritesheetIds, true);
50282     }
50283     function addSprites(ids, overrideColors) {
50284       _spritesheetIds = utilArrayUniq(_spritesheetIds.concat(ids));
50285       var spritesheets = _defsSelection.selectAll(".spritesheet").data(_spritesheetIds);
50286       spritesheets.enter().append("g").attr("class", function(d2) {
50287         return "spritesheet spritesheet-" + d2;
50288       }).each(function(d2) {
50289         var url = context.imagePath(d2 + ".svg");
50290         var node = select_default2(this).node();
50291         svg(url).then(function(svg2) {
50292           node.appendChild(
50293             select_default2(svg2.documentElement).attr("id", "ideditor-" + d2).node()
50294           );
50295           if (overrideColors && d2 !== "iD-sprite") {
50296             select_default2(node).selectAll("path").attr("fill", "currentColor");
50297           }
50298         }).catch(function() {
50299         });
50300       });
50301       spritesheets.exit().remove();
50302     }
50303     drawDefs.addSprites = addSprites;
50304     return drawDefs;
50305   }
50306
50307   // modules/svg/keepRight.js
50308   var _layerEnabled = false;
50309   var _qaService;
50310   function svgKeepRight(projection2, context, dispatch14) {
50311     const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
50312     const minZoom5 = 12;
50313     let touchLayer = select_default2(null);
50314     let drawLayer = select_default2(null);
50315     let layerVisible = false;
50316     function markerPath(selection2, klass) {
50317       selection2.attr("class", klass).attr("transform", "translate(-4, -24)").attr("d", "M11.6,6.2H7.1l1.4-5.1C8.6,0.6,8.1,0,7.5,0H2.2C1.7,0,1.3,0.3,1.3,0.8L0,10.2c-0.1,0.6,0.4,1.1,0.9,1.1h4.6l-1.8,7.6C3.6,19.4,4.1,20,4.7,20c0.3,0,0.6-0.2,0.8-0.5l6.9-11.9C12.7,7,12.3,6.2,11.6,6.2z");
50318     }
50319     function getService() {
50320       if (services.keepRight && !_qaService) {
50321         _qaService = services.keepRight;
50322         _qaService.on("loaded", throttledRedraw);
50323       } else if (!services.keepRight && _qaService) {
50324         _qaService = null;
50325       }
50326       return _qaService;
50327     }
50328     function editOn() {
50329       if (!layerVisible) {
50330         layerVisible = true;
50331         drawLayer.style("display", "block");
50332       }
50333     }
50334     function editOff() {
50335       if (layerVisible) {
50336         layerVisible = false;
50337         drawLayer.style("display", "none");
50338         drawLayer.selectAll(".qaItem.keepRight").remove();
50339         touchLayer.selectAll(".qaItem.keepRight").remove();
50340       }
50341     }
50342     function layerOn() {
50343       editOn();
50344       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch14.call("change"));
50345     }
50346     function layerOff() {
50347       throttledRedraw.cancel();
50348       drawLayer.interrupt();
50349       touchLayer.selectAll(".qaItem.keepRight").remove();
50350       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
50351         editOff();
50352         dispatch14.call("change");
50353       });
50354     }
50355     function updateMarkers() {
50356       if (!layerVisible || !_layerEnabled) return;
50357       const service = getService();
50358       const selectedID = context.selectedErrorID();
50359       const data = service ? service.getItems(projection2) : [];
50360       const getTransform = svgPointTransform(projection2);
50361       const markers = drawLayer.selectAll(".qaItem.keepRight").data(data, (d2) => d2.id);
50362       markers.exit().remove();
50363       const markersEnter = markers.enter().append("g").attr("class", (d2) => "qaItem ".concat(d2.service, " itemId-").concat(d2.id, " itemType-").concat(d2.parentIssueType));
50364       markersEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
50365       markersEnter.append("path").call(markerPath, "shadow");
50366       markersEnter.append("use").attr("class", "qaItem-fill").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").attr("xlink:href", "#iD-icon-bolt");
50367       markers.merge(markersEnter).sort(sortY).classed("selected", (d2) => d2.id === selectedID).attr("transform", getTransform);
50368       if (touchLayer.empty()) return;
50369       const fillClass = context.getDebug("target") ? "pink " : "nocolor ";
50370       const targets = touchLayer.selectAll(".qaItem.keepRight").data(data, (d2) => d2.id);
50371       targets.exit().remove();
50372       targets.enter().append("rect").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").merge(targets).sort(sortY).attr("class", (d2) => "qaItem ".concat(d2.service, " target ").concat(fillClass, " itemId-").concat(d2.id)).attr("transform", getTransform);
50373       function sortY(a2, b2) {
50374         return a2.id === selectedID ? 1 : b2.id === selectedID ? -1 : a2.severity === "error" && b2.severity !== "error" ? 1 : b2.severity === "error" && a2.severity !== "error" ? -1 : b2.loc[1] - a2.loc[1];
50375       }
50376     }
50377     function drawKeepRight(selection2) {
50378       const service = getService();
50379       const surface = context.surface();
50380       if (surface && !surface.empty()) {
50381         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
50382       }
50383       drawLayer = selection2.selectAll(".layer-keepRight").data(service ? [0] : []);
50384       drawLayer.exit().remove();
50385       drawLayer = drawLayer.enter().append("g").attr("class", "layer-keepRight").style("display", _layerEnabled ? "block" : "none").merge(drawLayer);
50386       if (_layerEnabled) {
50387         if (service && ~~context.map().zoom() >= minZoom5) {
50388           editOn();
50389           service.loadIssues(projection2);
50390           updateMarkers();
50391         } else {
50392           editOff();
50393         }
50394       }
50395     }
50396     drawKeepRight.enabled = function(val) {
50397       if (!arguments.length) return _layerEnabled;
50398       _layerEnabled = val;
50399       if (_layerEnabled) {
50400         layerOn();
50401       } else {
50402         layerOff();
50403         if (context.selectedErrorID()) {
50404           context.enter(modeBrowse(context));
50405         }
50406       }
50407       dispatch14.call("change");
50408       return this;
50409     };
50410     drawKeepRight.supported = () => !!getService();
50411     return drawKeepRight;
50412   }
50413
50414   // modules/svg/geolocate.js
50415   function svgGeolocate(projection2) {
50416     var layer = select_default2(null);
50417     var _position;
50418     function init2() {
50419       if (svgGeolocate.initialized) return;
50420       svgGeolocate.enabled = false;
50421       svgGeolocate.initialized = true;
50422     }
50423     function showLayer() {
50424       layer.style("display", "block");
50425     }
50426     function hideLayer() {
50427       layer.transition().duration(250).style("opacity", 0);
50428     }
50429     function layerOn() {
50430       layer.style("opacity", 0).transition().duration(250).style("opacity", 1);
50431     }
50432     function layerOff() {
50433       layer.style("display", "none");
50434     }
50435     function transform2(d2) {
50436       return svgPointTransform(projection2)(d2);
50437     }
50438     function accuracy(accuracy2, loc) {
50439       var degreesRadius = geoMetersToLat(accuracy2), tangentLoc = [loc[0], loc[1] + degreesRadius], projectedTangent = projection2(tangentLoc), projectedLoc = projection2([loc[0], loc[1]]);
50440       return Math.round(projectedLoc[1] - projectedTangent[1]).toString();
50441     }
50442     function update() {
50443       var geolocation = { loc: [_position.coords.longitude, _position.coords.latitude] };
50444       var groups = layer.selectAll(".geolocations").selectAll(".geolocation").data([geolocation]);
50445       groups.exit().remove();
50446       var pointsEnter = groups.enter().append("g").attr("class", "geolocation");
50447       pointsEnter.append("circle").attr("class", "geolocate-radius").attr("dx", "0").attr("dy", "0").attr("fill", "rgb(15,128,225)").attr("fill-opacity", "0.3").attr("r", "0");
50448       pointsEnter.append("circle").attr("dx", "0").attr("dy", "0").attr("fill", "rgb(15,128,225)").attr("stroke", "white").attr("stroke-width", "1.5").attr("r", "6");
50449       groups.merge(pointsEnter).attr("transform", transform2);
50450       layer.select(".geolocate-radius").attr("r", accuracy(_position.coords.accuracy, geolocation.loc));
50451     }
50452     function drawLocation(selection2) {
50453       var enabled = svgGeolocate.enabled;
50454       layer = selection2.selectAll(".layer-geolocate").data([0]);
50455       layer.exit().remove();
50456       var layerEnter = layer.enter().append("g").attr("class", "layer-geolocate").style("display", enabled ? "block" : "none");
50457       layerEnter.append("g").attr("class", "geolocations");
50458       layer = layerEnter.merge(layer);
50459       if (enabled) {
50460         update();
50461       } else {
50462         layerOff();
50463       }
50464     }
50465     drawLocation.enabled = function(position, enabled) {
50466       if (!arguments.length) return svgGeolocate.enabled;
50467       _position = position;
50468       svgGeolocate.enabled = enabled;
50469       if (svgGeolocate.enabled) {
50470         showLayer();
50471         layerOn();
50472       } else {
50473         hideLayer();
50474       }
50475       return this;
50476     };
50477     init2();
50478     return drawLocation;
50479   }
50480
50481   // modules/svg/labels.js
50482   function svgLabels(projection2, context) {
50483     var path = path_default(projection2);
50484     var detected = utilDetect();
50485     var baselineHack = detected.ie || detected.browser.toLowerCase() === "edge" || detected.browser.toLowerCase() === "firefox" && detected.version >= 70;
50486     var _rdrawn = new RBush();
50487     var _rskipped = new RBush();
50488     var _textWidthCache = {};
50489     var _entitybboxes = {};
50490     var labelStack = [
50491       ["line", "aeroway", "*", 12],
50492       ["line", "highway", "motorway", 12],
50493       ["line", "highway", "trunk", 12],
50494       ["line", "highway", "primary", 12],
50495       ["line", "highway", "secondary", 12],
50496       ["line", "highway", "tertiary", 12],
50497       ["line", "highway", "*", 12],
50498       ["line", "railway", "*", 12],
50499       ["line", "waterway", "*", 12],
50500       ["area", "aeroway", "*", 12],
50501       ["area", "amenity", "*", 12],
50502       ["area", "building", "*", 12],
50503       ["area", "historic", "*", 12],
50504       ["area", "leisure", "*", 12],
50505       ["area", "man_made", "*", 12],
50506       ["area", "natural", "*", 12],
50507       ["area", "shop", "*", 12],
50508       ["area", "tourism", "*", 12],
50509       ["area", "camp_site", "*", 12],
50510       ["point", "aeroway", "*", 10],
50511       ["point", "amenity", "*", 10],
50512       ["point", "building", "*", 10],
50513       ["point", "historic", "*", 10],
50514       ["point", "leisure", "*", 10],
50515       ["point", "man_made", "*", 10],
50516       ["point", "natural", "*", 10],
50517       ["point", "shop", "*", 10],
50518       ["point", "tourism", "*", 10],
50519       ["point", "camp_site", "*", 10],
50520       ["line", "ref", "*", 12],
50521       ["area", "ref", "*", 12],
50522       ["point", "ref", "*", 10],
50523       ["line", "name", "*", 12],
50524       ["area", "name", "*", 12],
50525       ["point", "name", "*", 10]
50526     ];
50527     function shouldSkipIcon(preset) {
50528       var noIcons = ["building", "landuse", "natural"];
50529       return noIcons.some(function(s2) {
50530         return preset.id.indexOf(s2) >= 0;
50531       });
50532     }
50533     function get4(array2, prop) {
50534       return function(d2, i3) {
50535         return array2[i3][prop];
50536       };
50537     }
50538     function textWidth(text, size, elem) {
50539       var c2 = _textWidthCache[size];
50540       if (!c2) c2 = _textWidthCache[size] = {};
50541       if (c2[text]) {
50542         return c2[text];
50543       } else if (elem) {
50544         c2[text] = elem.getComputedTextLength();
50545         return c2[text];
50546       } else {
50547         var str = encodeURIComponent(text).match(/%[CDEFcdef]/g);
50548         if (str === null) {
50549           return size / 3 * 2 * text.length;
50550         } else {
50551           return size / 3 * (2 * text.length + str.length);
50552         }
50553       }
50554     }
50555     function drawLinePaths(selection2, entities, filter2, classes, labels) {
50556       var paths = selection2.selectAll("path").filter(filter2).data(entities, osmEntity.key);
50557       paths.exit().remove();
50558       paths.enter().append("path").style("stroke-width", get4(labels, "font-size")).attr("id", function(d2) {
50559         return "ideditor-labelpath-" + d2.id;
50560       }).attr("class", classes).merge(paths).attr("d", get4(labels, "lineString"));
50561     }
50562     function drawLineLabels(selection2, entities, filter2, classes, labels) {
50563       var texts = selection2.selectAll("text." + classes).filter(filter2).data(entities, osmEntity.key);
50564       texts.exit().remove();
50565       texts.enter().append("text").attr("class", function(d2, i3) {
50566         return classes + " " + labels[i3].classes + " " + d2.id;
50567       }).attr("dy", baselineHack ? "0.35em" : null).append("textPath").attr("class", "textpath");
50568       selection2.selectAll("text." + classes).selectAll(".textpath").filter(filter2).data(entities, osmEntity.key).attr("startOffset", "50%").attr("xlink:href", function(d2) {
50569         return "#ideditor-labelpath-" + d2.id;
50570       }).text(utilDisplayNameForPath);
50571     }
50572     function drawPointLabels(selection2, entities, filter2, classes, labels) {
50573       var texts = selection2.selectAll("text." + classes).filter(filter2).data(entities, osmEntity.key);
50574       texts.exit().remove();
50575       texts.enter().append("text").attr("class", function(d2, i3) {
50576         return classes + " " + labels[i3].classes + " " + d2.id;
50577       }).merge(texts).attr("x", get4(labels, "x")).attr("y", get4(labels, "y")).style("text-anchor", get4(labels, "textAnchor")).text(utilDisplayName).each(function(d2, i3) {
50578         textWidth(utilDisplayName(d2), labels[i3].height, this);
50579       });
50580     }
50581     function drawAreaLabels(selection2, entities, filter2, classes, labels) {
50582       entities = entities.filter(hasText);
50583       labels = labels.filter(hasText);
50584       drawPointLabels(selection2, entities, filter2, classes, labels);
50585       function hasText(d2, i3) {
50586         return labels[i3].hasOwnProperty("x") && labels[i3].hasOwnProperty("y");
50587       }
50588     }
50589     function drawAreaIcons(selection2, entities, filter2, classes, labels) {
50590       var icons = selection2.selectAll("use." + classes).filter(filter2).data(entities, osmEntity.key);
50591       icons.exit().remove();
50592       icons.enter().append("use").attr("class", "icon " + classes).attr("width", "17px").attr("height", "17px").merge(icons).attr("transform", get4(labels, "transform")).attr("xlink:href", function(d2) {
50593         var preset = _mainPresetIndex.match(d2, context.graph());
50594         var picon = preset && preset.icon;
50595         return picon ? "#" + picon : "";
50596       });
50597     }
50598     function drawCollisionBoxes(selection2, rtree, which) {
50599       var classes = "debug " + which + " " + (which === "debug-skipped" ? "orange" : "yellow");
50600       var gj = [];
50601       if (context.getDebug("collision")) {
50602         gj = rtree.all().map(function(d2) {
50603           return { type: "Polygon", coordinates: [[
50604             [d2.minX, d2.minY],
50605             [d2.maxX, d2.minY],
50606             [d2.maxX, d2.maxY],
50607             [d2.minX, d2.maxY],
50608             [d2.minX, d2.minY]
50609           ]] };
50610         });
50611       }
50612       var boxes = selection2.selectAll("." + which).data(gj);
50613       boxes.exit().remove();
50614       boxes.enter().append("path").attr("class", classes).merge(boxes).attr("d", path_default());
50615     }
50616     function drawLabels(selection2, graph, entities, filter2, dimensions, fullRedraw) {
50617       var wireframe = context.surface().classed("fill-wireframe");
50618       var zoom = geoScaleToZoom(projection2.scale());
50619       var labelable = [];
50620       var renderNodeAs = {};
50621       var i3, j2, k2, entity, geometry;
50622       for (i3 = 0; i3 < labelStack.length; i3++) {
50623         labelable.push([]);
50624       }
50625       if (fullRedraw) {
50626         _rdrawn.clear();
50627         _rskipped.clear();
50628         _entitybboxes = {};
50629       } else {
50630         for (i3 = 0; i3 < entities.length; i3++) {
50631           entity = entities[i3];
50632           var toRemove = [].concat(_entitybboxes[entity.id] || []).concat(_entitybboxes[entity.id + "I"] || []);
50633           for (j2 = 0; j2 < toRemove.length; j2++) {
50634             _rdrawn.remove(toRemove[j2]);
50635             _rskipped.remove(toRemove[j2]);
50636           }
50637         }
50638       }
50639       for (i3 = 0; i3 < entities.length; i3++) {
50640         entity = entities[i3];
50641         geometry = entity.geometry(graph);
50642         if (geometry === "point" || geometry === "vertex" && isInterestingVertex(entity)) {
50643           var hasDirections = entity.directions(graph, projection2).length;
50644           var markerPadding;
50645           if (!wireframe && geometry === "point" && !(zoom >= 18 && hasDirections)) {
50646             renderNodeAs[entity.id] = "point";
50647             markerPadding = 20;
50648           } else {
50649             renderNodeAs[entity.id] = "vertex";
50650             markerPadding = 0;
50651           }
50652           var coord2 = projection2(entity.loc);
50653           var nodePadding = 10;
50654           var bbox2 = {
50655             minX: coord2[0] - nodePadding,
50656             minY: coord2[1] - nodePadding - markerPadding,
50657             maxX: coord2[0] + nodePadding,
50658             maxY: coord2[1] + nodePadding
50659           };
50660           doInsert(bbox2, entity.id + "P");
50661         }
50662         if (geometry === "vertex") {
50663           geometry = "point";
50664         }
50665         var preset = geometry === "area" && _mainPresetIndex.match(entity, graph);
50666         var icon2 = preset && !shouldSkipIcon(preset) && preset.icon;
50667         if (!icon2 && !utilDisplayName(entity)) continue;
50668         for (k2 = 0; k2 < labelStack.length; k2++) {
50669           var matchGeom = labelStack[k2][0];
50670           var matchKey = labelStack[k2][1];
50671           var matchVal = labelStack[k2][2];
50672           var hasVal = entity.tags[matchKey];
50673           if (geometry === matchGeom && hasVal && (matchVal === "*" || matchVal === hasVal)) {
50674             labelable[k2].push(entity);
50675             break;
50676           }
50677         }
50678       }
50679       var positions = {
50680         point: [],
50681         line: [],
50682         area: []
50683       };
50684       var labelled = {
50685         point: [],
50686         line: [],
50687         area: []
50688       };
50689       for (k2 = 0; k2 < labelable.length; k2++) {
50690         var fontSize = labelStack[k2][3];
50691         for (i3 = 0; i3 < labelable[k2].length; i3++) {
50692           entity = labelable[k2][i3];
50693           geometry = entity.geometry(graph);
50694           var getName = geometry === "line" ? utilDisplayNameForPath : utilDisplayName;
50695           var name = getName(entity);
50696           var width = name && textWidth(name, fontSize);
50697           var p2 = null;
50698           if (geometry === "point" || geometry === "vertex") {
50699             if (wireframe) continue;
50700             var renderAs = renderNodeAs[entity.id];
50701             if (renderAs === "vertex" && zoom < 17) continue;
50702             p2 = getPointLabel(entity, width, fontSize, renderAs);
50703           } else if (geometry === "line") {
50704             p2 = getLineLabel(entity, width, fontSize);
50705           } else if (geometry === "area") {
50706             p2 = getAreaLabel(entity, width, fontSize);
50707           }
50708           if (p2) {
50709             if (geometry === "vertex") {
50710               geometry = "point";
50711             }
50712             p2.classes = geometry + " tag-" + labelStack[k2][1];
50713             positions[geometry].push(p2);
50714             labelled[geometry].push(entity);
50715           }
50716         }
50717       }
50718       function isInterestingVertex(entity2) {
50719         var selectedIDs = context.selectedIDs();
50720         return entity2.hasInterestingTags() || entity2.isEndpoint(graph) || entity2.isConnected(graph) || selectedIDs.indexOf(entity2.id) !== -1 || graph.parentWays(entity2).some(function(parent) {
50721           return selectedIDs.indexOf(parent.id) !== -1;
50722         });
50723       }
50724       function getPointLabel(entity2, width2, height, geometry2) {
50725         var y2 = geometry2 === "point" ? -12 : 0;
50726         var pointOffsets = {
50727           ltr: [15, y2, "start"],
50728           rtl: [-15, y2, "end"]
50729         };
50730         var textDirection = _mainLocalizer.textDirection();
50731         var coord3 = projection2(entity2.loc);
50732         var textPadding = 2;
50733         var offset = pointOffsets[textDirection];
50734         var p3 = {
50735           height,
50736           width: width2,
50737           x: coord3[0] + offset[0],
50738           y: coord3[1] + offset[1],
50739           textAnchor: offset[2]
50740         };
50741         var bbox3;
50742         if (textDirection === "rtl") {
50743           bbox3 = {
50744             minX: p3.x - width2 - textPadding,
50745             minY: p3.y - height / 2 - textPadding,
50746             maxX: p3.x + textPadding,
50747             maxY: p3.y + height / 2 + textPadding
50748           };
50749         } else {
50750           bbox3 = {
50751             minX: p3.x - textPadding,
50752             minY: p3.y - height / 2 - textPadding,
50753             maxX: p3.x + width2 + textPadding,
50754             maxY: p3.y + height / 2 + textPadding
50755           };
50756         }
50757         if (tryInsert([bbox3], entity2.id, true)) {
50758           return p3;
50759         }
50760       }
50761       function getLineLabel(entity2, width2, height) {
50762         var viewport = geoExtent(context.projection.clipExtent()).polygon();
50763         var points = graph.childNodes(entity2).map(function(node) {
50764           return projection2(node.loc);
50765         });
50766         var length2 = geoPathLength(points);
50767         if (length2 < width2 + 20) return;
50768         var lineOffsets = [
50769           50,
50770           45,
50771           55,
50772           40,
50773           60,
50774           35,
50775           65,
50776           30,
50777           70,
50778           25,
50779           75,
50780           20,
50781           80,
50782           15,
50783           95,
50784           10,
50785           90,
50786           5,
50787           95
50788         ];
50789         var padding = 3;
50790         for (var i4 = 0; i4 < lineOffsets.length; i4++) {
50791           var offset = lineOffsets[i4];
50792           var middle = offset / 100 * length2;
50793           var start2 = middle - width2 / 2;
50794           if (start2 < 0 || start2 + width2 > length2) continue;
50795           var sub = subpath(points, start2, start2 + width2);
50796           if (!sub || !geoPolygonIntersectsPolygon(viewport, sub, true)) {
50797             continue;
50798           }
50799           var isReverse = reverse(sub);
50800           if (isReverse) {
50801             sub = sub.reverse();
50802           }
50803           var bboxes = [];
50804           var boxsize = (height + 2) / 2;
50805           for (var j3 = 0; j3 < sub.length - 1; j3++) {
50806             var a2 = sub[j3];
50807             var b2 = sub[j3 + 1];
50808             var num = Math.max(1, Math.floor(geoVecLength(a2, b2) / boxsize / 2));
50809             for (var box = 0; box < num; box++) {
50810               var p3 = geoVecInterp(a2, b2, box / num);
50811               var x05 = p3[0] - boxsize - padding;
50812               var y05 = p3[1] - boxsize - padding;
50813               var x12 = p3[0] + boxsize + padding;
50814               var y12 = p3[1] + boxsize + padding;
50815               bboxes.push({
50816                 minX: Math.min(x05, x12),
50817                 minY: Math.min(y05, y12),
50818                 maxX: Math.max(x05, x12),
50819                 maxY: Math.max(y05, y12)
50820               });
50821             }
50822           }
50823           if (tryInsert(bboxes, entity2.id, false)) {
50824             return {
50825               "font-size": height + 2,
50826               lineString: lineString2(sub),
50827               startOffset: offset + "%"
50828             };
50829           }
50830         }
50831         function reverse(p4) {
50832           var angle2 = Math.atan2(p4[1][1] - p4[0][1], p4[1][0] - p4[0][0]);
50833           return !(p4[0][0] < p4[p4.length - 1][0] && angle2 < Math.PI / 2 && angle2 > -Math.PI / 2);
50834         }
50835         function lineString2(points2) {
50836           return "M" + points2.join("L");
50837         }
50838         function subpath(points2, from, to) {
50839           var sofar = 0;
50840           var start3, end, i0, i1;
50841           for (var i5 = 0; i5 < points2.length - 1; i5++) {
50842             var a3 = points2[i5];
50843             var b3 = points2[i5 + 1];
50844             var current = geoVecLength(a3, b3);
50845             var portion;
50846             if (!start3 && sofar + current >= from) {
50847               portion = (from - sofar) / current;
50848               start3 = [
50849                 a3[0] + portion * (b3[0] - a3[0]),
50850                 a3[1] + portion * (b3[1] - a3[1])
50851               ];
50852               i0 = i5 + 1;
50853             }
50854             if (!end && sofar + current >= to) {
50855               portion = (to - sofar) / current;
50856               end = [
50857                 a3[0] + portion * (b3[0] - a3[0]),
50858                 a3[1] + portion * (b3[1] - a3[1])
50859               ];
50860               i1 = i5 + 1;
50861             }
50862             sofar += current;
50863           }
50864           var result = points2.slice(i0, i1);
50865           result.unshift(start3);
50866           result.push(end);
50867           return result;
50868         }
50869       }
50870       function getAreaLabel(entity2, width2, height) {
50871         var centroid = path.centroid(entity2.asGeoJSON(graph));
50872         var extent = entity2.extent(graph);
50873         var areaWidth = projection2(extent[1])[0] - projection2(extent[0])[0];
50874         if (isNaN(centroid[0]) || areaWidth < 20) return;
50875         var preset2 = _mainPresetIndex.match(entity2, context.graph());
50876         var picon = preset2 && preset2.icon;
50877         var iconSize = 17;
50878         var padding = 2;
50879         var p3 = {};
50880         if (picon) {
50881           if (addIcon()) {
50882             addLabel(iconSize + padding);
50883             return p3;
50884           }
50885         } else {
50886           if (addLabel(0)) {
50887             return p3;
50888           }
50889         }
50890         function addIcon() {
50891           var iconX = centroid[0] - iconSize / 2;
50892           var iconY = centroid[1] - iconSize / 2;
50893           var bbox3 = {
50894             minX: iconX,
50895             minY: iconY,
50896             maxX: iconX + iconSize,
50897             maxY: iconY + iconSize
50898           };
50899           if (tryInsert([bbox3], entity2.id + "I", true)) {
50900             p3.transform = "translate(" + iconX + "," + iconY + ")";
50901             return true;
50902           }
50903           return false;
50904         }
50905         function addLabel(yOffset) {
50906           if (width2 && areaWidth >= width2 + 20) {
50907             var labelX = centroid[0];
50908             var labelY = centroid[1] + yOffset;
50909             var bbox3 = {
50910               minX: labelX - width2 / 2 - padding,
50911               minY: labelY - height / 2 - padding,
50912               maxX: labelX + width2 / 2 + padding,
50913               maxY: labelY + height / 2 + padding
50914             };
50915             if (tryInsert([bbox3], entity2.id, true)) {
50916               p3.x = labelX;
50917               p3.y = labelY;
50918               p3.textAnchor = "middle";
50919               p3.height = height;
50920               return true;
50921             }
50922           }
50923           return false;
50924         }
50925       }
50926       function doInsert(bbox3, id2) {
50927         bbox3.id = id2;
50928         var oldbox = _entitybboxes[id2];
50929         if (oldbox) {
50930           _rdrawn.remove(oldbox);
50931         }
50932         _entitybboxes[id2] = bbox3;
50933         _rdrawn.insert(bbox3);
50934       }
50935       function tryInsert(bboxes, id2, saveSkipped) {
50936         var skipped = false;
50937         for (var i4 = 0; i4 < bboxes.length; i4++) {
50938           var bbox3 = bboxes[i4];
50939           bbox3.id = id2;
50940           if (bbox3.minX < 0 || bbox3.minY < 0 || bbox3.maxX > dimensions[0] || bbox3.maxY > dimensions[1]) {
50941             skipped = true;
50942             break;
50943           }
50944           if (_rdrawn.collides(bbox3)) {
50945             skipped = true;
50946             break;
50947           }
50948         }
50949         _entitybboxes[id2] = bboxes;
50950         if (skipped) {
50951           if (saveSkipped) {
50952             _rskipped.load(bboxes);
50953           }
50954         } else {
50955           _rdrawn.load(bboxes);
50956         }
50957         return !skipped;
50958       }
50959       var layer = selection2.selectAll(".layer-osm.labels");
50960       layer.selectAll(".labels-group").data(["halo", "label", "debug"]).enter().append("g").attr("class", function(d2) {
50961         return "labels-group " + d2;
50962       });
50963       var halo = layer.selectAll(".labels-group.halo");
50964       var label = layer.selectAll(".labels-group.label");
50965       var debug2 = layer.selectAll(".labels-group.debug");
50966       drawPointLabels(label, labelled.point, filter2, "pointlabel", positions.point);
50967       drawPointLabels(halo, labelled.point, filter2, "pointlabel-halo", positions.point);
50968       drawLinePaths(layer, labelled.line, filter2, "", positions.line);
50969       drawLineLabels(label, labelled.line, filter2, "linelabel", positions.line);
50970       drawLineLabels(halo, labelled.line, filter2, "linelabel-halo", positions.line);
50971       drawAreaLabels(label, labelled.area, filter2, "arealabel", positions.area);
50972       drawAreaLabels(halo, labelled.area, filter2, "arealabel-halo", positions.area);
50973       drawAreaIcons(label, labelled.area, filter2, "areaicon", positions.area);
50974       drawAreaIcons(halo, labelled.area, filter2, "areaicon-halo", positions.area);
50975       drawCollisionBoxes(debug2, _rskipped, "debug-skipped");
50976       drawCollisionBoxes(debug2, _rdrawn, "debug-drawn");
50977       layer.call(filterLabels);
50978     }
50979     function filterLabels(selection2) {
50980       var drawLayer = selection2.selectAll(".layer-osm.labels");
50981       var layers = drawLayer.selectAll(".labels-group.halo, .labels-group.label");
50982       layers.selectAll(".nolabel").classed("nolabel", false);
50983       var mouse = context.map().mouse();
50984       var graph = context.graph();
50985       var selectedIDs = context.selectedIDs();
50986       var ids = [];
50987       var pad2, bbox2;
50988       if (mouse) {
50989         pad2 = 20;
50990         bbox2 = { minX: mouse[0] - pad2, minY: mouse[1] - pad2, maxX: mouse[0] + pad2, maxY: mouse[1] + pad2 };
50991         var nearMouse = _rdrawn.search(bbox2).map(function(entity2) {
50992           return entity2.id;
50993         });
50994         ids.push.apply(ids, nearMouse);
50995       }
50996       for (var i3 = 0; i3 < selectedIDs.length; i3++) {
50997         var entity = graph.hasEntity(selectedIDs[i3]);
50998         if (entity && entity.type === "node") {
50999           ids.push(selectedIDs[i3]);
51000         }
51001       }
51002       layers.selectAll(utilEntitySelector(ids)).classed("nolabel", true);
51003       var debug2 = selection2.selectAll(".labels-group.debug");
51004       var gj = [];
51005       if (context.getDebug("collision")) {
51006         gj = bbox2 ? [{
51007           type: "Polygon",
51008           coordinates: [[
51009             [bbox2.minX, bbox2.minY],
51010             [bbox2.maxX, bbox2.minY],
51011             [bbox2.maxX, bbox2.maxY],
51012             [bbox2.minX, bbox2.maxY],
51013             [bbox2.minX, bbox2.minY]
51014           ]]
51015         }] : [];
51016       }
51017       var box = debug2.selectAll(".debug-mouse").data(gj);
51018       box.exit().remove();
51019       box.enter().append("path").attr("class", "debug debug-mouse yellow").merge(box).attr("d", path_default());
51020     }
51021     var throttleFilterLabels = throttle_default(filterLabels, 100);
51022     drawLabels.observe = function(selection2) {
51023       var listener = function() {
51024         throttleFilterLabels(selection2);
51025       };
51026       selection2.on("mousemove.hidelabels", listener);
51027       context.on("enter.hidelabels", listener);
51028     };
51029     drawLabels.off = function(selection2) {
51030       throttleFilterLabels.cancel();
51031       selection2.on("mousemove.hidelabels", null);
51032       context.on("enter.hidelabels", null);
51033     };
51034     return drawLabels;
51035   }
51036
51037   // node_modules/exifr/dist/full.esm.mjs
51038   var e = "undefined" != typeof self ? self : global;
51039   var t = "undefined" != typeof navigator;
51040   var i2 = t && "undefined" == typeof HTMLImageElement;
51041   var n2 = !("undefined" == typeof global || "undefined" == typeof process || !process.versions || !process.versions.node);
51042   var s = e.Buffer;
51043   var r = e.BigInt;
51044   var a = !!s;
51045   var o = (e3) => e3;
51046   function l(e3, t2 = o) {
51047     if (n2) try {
51048       return "function" == typeof __require ? Promise.resolve(t2(__require(e3))) : import(
51049         /* webpackIgnore: true */
51050         e3
51051       ).then(t2);
51052     } catch (t3) {
51053       console.warn("Couldn't load ".concat(e3));
51054     }
51055   }
51056   var h = e.fetch;
51057   var u = (e3) => h = e3;
51058   if (!e.fetch) {
51059     const e3 = l("http", (e4) => e4), t2 = l("https", (e4) => e4), i3 = (n3, { headers: s2 } = {}) => new Promise(async (r2, a2) => {
51060       let { port: o2, hostname: l2, pathname: h2, protocol: u2, search: c2 } = new URL(n3);
51061       const f2 = { method: "GET", hostname: l2, path: encodeURI(h2) + c2, headers: s2 };
51062       "" !== o2 && (f2.port = Number(o2));
51063       const d2 = ("https:" === u2 ? await t2 : await e3).request(f2, (e4) => {
51064         if (301 === e4.statusCode || 302 === e4.statusCode) {
51065           let t3 = new URL(e4.headers.location, n3).toString();
51066           return i3(t3, { headers: s2 }).then(r2).catch(a2);
51067         }
51068         r2({ status: e4.statusCode, arrayBuffer: () => new Promise((t3) => {
51069           let i4 = [];
51070           e4.on("data", (e6) => i4.push(e6)), e4.on("end", () => t3(Buffer.concat(i4)));
51071         }) });
51072       });
51073       d2.on("error", a2), d2.end();
51074     });
51075     u(i3);
51076   }
51077   function c(e3, t2, i3) {
51078     return t2 in e3 ? Object.defineProperty(e3, t2, { value: i3, enumerable: true, configurable: true, writable: true }) : e3[t2] = i3, e3;
51079   }
51080   var f = (e3) => p(e3) ? void 0 : e3;
51081   var d = (e3) => void 0 !== e3;
51082   function p(e3) {
51083     return void 0 === e3 || (e3 instanceof Map ? 0 === e3.size : 0 === Object.values(e3).filter(d).length);
51084   }
51085   function g2(e3) {
51086     let t2 = new Error(e3);
51087     throw delete t2.stack, t2;
51088   }
51089   function m(e3) {
51090     return "" === (e3 = function(e4) {
51091       for (; e4.endsWith("\0"); ) e4 = e4.slice(0, -1);
51092       return e4;
51093     }(e3).trim()) ? void 0 : e3;
51094   }
51095   function S(e3) {
51096     let t2 = function(e4) {
51097       let t3 = 0;
51098       return e4.ifd0.enabled && (t3 += 1024), e4.exif.enabled && (t3 += 2048), e4.makerNote && (t3 += 2048), e4.userComment && (t3 += 1024), e4.gps.enabled && (t3 += 512), e4.interop.enabled && (t3 += 100), e4.ifd1.enabled && (t3 += 1024), t3 + 2048;
51099     }(e3);
51100     return e3.jfif.enabled && (t2 += 50), e3.xmp.enabled && (t2 += 2e4), e3.iptc.enabled && (t2 += 14e3), e3.icc.enabled && (t2 += 6e3), t2;
51101   }
51102   var C = (e3) => String.fromCharCode.apply(null, e3);
51103   var y = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : void 0;
51104   function b(e3) {
51105     return y ? y.decode(e3) : a ? Buffer.from(e3).toString("utf8") : decodeURIComponent(escape(C(e3)));
51106   }
51107   var I = class _I {
51108     static from(e3, t2) {
51109       return e3 instanceof this && e3.le === t2 ? e3 : new _I(e3, void 0, void 0, t2);
51110     }
51111     constructor(e3, t2 = 0, i3, n3) {
51112       if ("boolean" == typeof n3 && (this.le = n3), Array.isArray(e3) && (e3 = new Uint8Array(e3)), 0 === e3) this.byteOffset = 0, this.byteLength = 0;
51113       else if (e3 instanceof ArrayBuffer) {
51114         void 0 === i3 && (i3 = e3.byteLength - t2);
51115         let n4 = new DataView(e3, t2, i3);
51116         this._swapDataView(n4);
51117       } else if (e3 instanceof Uint8Array || e3 instanceof DataView || e3 instanceof _I) {
51118         void 0 === i3 && (i3 = e3.byteLength - t2), (t2 += e3.byteOffset) + i3 > e3.byteOffset + e3.byteLength && g2("Creating view outside of available memory in ArrayBuffer");
51119         let n4 = new DataView(e3.buffer, t2, i3);
51120         this._swapDataView(n4);
51121       } else if ("number" == typeof e3) {
51122         let t3 = new DataView(new ArrayBuffer(e3));
51123         this._swapDataView(t3);
51124       } else g2("Invalid input argument for BufferView: " + e3);
51125     }
51126     _swapArrayBuffer(e3) {
51127       this._swapDataView(new DataView(e3));
51128     }
51129     _swapBuffer(e3) {
51130       this._swapDataView(new DataView(e3.buffer, e3.byteOffset, e3.byteLength));
51131     }
51132     _swapDataView(e3) {
51133       this.dataView = e3, this.buffer = e3.buffer, this.byteOffset = e3.byteOffset, this.byteLength = e3.byteLength;
51134     }
51135     _lengthToEnd(e3) {
51136       return this.byteLength - e3;
51137     }
51138     set(e3, t2, i3 = _I) {
51139       return e3 instanceof DataView || e3 instanceof _I ? e3 = new Uint8Array(e3.buffer, e3.byteOffset, e3.byteLength) : e3 instanceof ArrayBuffer && (e3 = new Uint8Array(e3)), e3 instanceof Uint8Array || g2("BufferView.set(): Invalid data argument."), this.toUint8().set(e3, t2), new i3(this, t2, e3.byteLength);
51140     }
51141     subarray(e3, t2) {
51142       return t2 = t2 || this._lengthToEnd(e3), new _I(this, e3, t2);
51143     }
51144     toUint8() {
51145       return new Uint8Array(this.buffer, this.byteOffset, this.byteLength);
51146     }
51147     getUint8Array(e3, t2) {
51148       return new Uint8Array(this.buffer, this.byteOffset + e3, t2);
51149     }
51150     getString(e3 = 0, t2 = this.byteLength) {
51151       return b(this.getUint8Array(e3, t2));
51152     }
51153     getLatin1String(e3 = 0, t2 = this.byteLength) {
51154       let i3 = this.getUint8Array(e3, t2);
51155       return C(i3);
51156     }
51157     getUnicodeString(e3 = 0, t2 = this.byteLength) {
51158       const i3 = [];
51159       for (let n3 = 0; n3 < t2 && e3 + n3 < this.byteLength; n3 += 2) i3.push(this.getUint16(e3 + n3));
51160       return C(i3);
51161     }
51162     getInt8(e3) {
51163       return this.dataView.getInt8(e3);
51164     }
51165     getUint8(e3) {
51166       return this.dataView.getUint8(e3);
51167     }
51168     getInt16(e3, t2 = this.le) {
51169       return this.dataView.getInt16(e3, t2);
51170     }
51171     getInt32(e3, t2 = this.le) {
51172       return this.dataView.getInt32(e3, t2);
51173     }
51174     getUint16(e3, t2 = this.le) {
51175       return this.dataView.getUint16(e3, t2);
51176     }
51177     getUint32(e3, t2 = this.le) {
51178       return this.dataView.getUint32(e3, t2);
51179     }
51180     getFloat32(e3, t2 = this.le) {
51181       return this.dataView.getFloat32(e3, t2);
51182     }
51183     getFloat64(e3, t2 = this.le) {
51184       return this.dataView.getFloat64(e3, t2);
51185     }
51186     getFloat(e3, t2 = this.le) {
51187       return this.dataView.getFloat32(e3, t2);
51188     }
51189     getDouble(e3, t2 = this.le) {
51190       return this.dataView.getFloat64(e3, t2);
51191     }
51192     getUintBytes(e3, t2, i3) {
51193       switch (t2) {
51194         case 1:
51195           return this.getUint8(e3, i3);
51196         case 2:
51197           return this.getUint16(e3, i3);
51198         case 4:
51199           return this.getUint32(e3, i3);
51200         case 8:
51201           return this.getUint64 && this.getUint64(e3, i3);
51202       }
51203     }
51204     getUint(e3, t2, i3) {
51205       switch (t2) {
51206         case 8:
51207           return this.getUint8(e3, i3);
51208         case 16:
51209           return this.getUint16(e3, i3);
51210         case 32:
51211           return this.getUint32(e3, i3);
51212         case 64:
51213           return this.getUint64 && this.getUint64(e3, i3);
51214       }
51215     }
51216     toString(e3) {
51217       return this.dataView.toString(e3, this.constructor.name);
51218     }
51219     ensureChunk() {
51220     }
51221   };
51222   function P(e3, t2) {
51223     g2("".concat(e3, " '").concat(t2, "' was not loaded, try using full build of exifr."));
51224   }
51225   var k = class extends Map {
51226     constructor(e3) {
51227       super(), this.kind = e3;
51228     }
51229     get(e3, t2) {
51230       return this.has(e3) || P(this.kind, e3), t2 && (e3 in t2 || function(e4, t3) {
51231         g2("Unknown ".concat(e4, " '").concat(t3, "'."));
51232       }(this.kind, e3), t2[e3].enabled || P(this.kind, e3)), super.get(e3);
51233     }
51234     keyList() {
51235       return Array.from(this.keys());
51236     }
51237   };
51238   var w = new k("file parser");
51239   var T = new k("segment parser");
51240   var A = new k("file reader");
51241   function D(e3, n3) {
51242     return "string" == typeof e3 ? O(e3, n3) : t && !i2 && e3 instanceof HTMLImageElement ? O(e3.src, n3) : e3 instanceof Uint8Array || e3 instanceof ArrayBuffer || e3 instanceof DataView ? new I(e3) : t && e3 instanceof Blob ? x(e3, n3, "blob", R) : void g2("Invalid input argument");
51243   }
51244   function O(e3, i3) {
51245     return (s2 = e3).startsWith("data:") || s2.length > 1e4 ? v(e3, i3, "base64") : n2 && e3.includes("://") ? x(e3, i3, "url", M) : n2 ? v(e3, i3, "fs") : t ? x(e3, i3, "url", M) : void g2("Invalid input argument");
51246     var s2;
51247   }
51248   async function x(e3, t2, i3, n3) {
51249     return A.has(i3) ? v(e3, t2, i3) : n3 ? async function(e4, t3) {
51250       let i4 = await t3(e4);
51251       return new I(i4);
51252     }(e3, n3) : void g2("Parser ".concat(i3, " is not loaded"));
51253   }
51254   async function v(e3, t2, i3) {
51255     let n3 = new (A.get(i3))(e3, t2);
51256     return await n3.read(), n3;
51257   }
51258   var M = (e3) => h(e3).then((e4) => e4.arrayBuffer());
51259   var R = (e3) => new Promise((t2, i3) => {
51260     let n3 = new FileReader();
51261     n3.onloadend = () => t2(n3.result || new ArrayBuffer()), n3.onerror = i3, n3.readAsArrayBuffer(e3);
51262   });
51263   var L = class extends Map {
51264     get tagKeys() {
51265       return this.allKeys || (this.allKeys = Array.from(this.keys())), this.allKeys;
51266     }
51267     get tagValues() {
51268       return this.allValues || (this.allValues = Array.from(this.values())), this.allValues;
51269     }
51270   };
51271   function U(e3, t2, i3) {
51272     let n3 = new L();
51273     for (let [e4, t3] of i3) n3.set(e4, t3);
51274     if (Array.isArray(t2)) for (let i4 of t2) e3.set(i4, n3);
51275     else e3.set(t2, n3);
51276     return n3;
51277   }
51278   function F(e3, t2, i3) {
51279     let n3, s2 = e3.get(t2);
51280     for (n3 of i3) s2.set(n3[0], n3[1]);
51281   }
51282   var E = /* @__PURE__ */ new Map();
51283   var B = /* @__PURE__ */ new Map();
51284   var N = /* @__PURE__ */ new Map();
51285   var G = ["chunked", "firstChunkSize", "firstChunkSizeNode", "firstChunkSizeBrowser", "chunkSize", "chunkLimit"];
51286   var V = ["jfif", "xmp", "icc", "iptc", "ihdr"];
51287   var z = ["tiff", ...V];
51288   var H = ["ifd0", "ifd1", "exif", "gps", "interop"];
51289   var j = [...z, ...H];
51290   var W = ["makerNote", "userComment"];
51291   var K = ["translateKeys", "translateValues", "reviveValues", "multiSegment"];
51292   var X = [...K, "sanitize", "mergeOutput", "silentErrors"];
51293   var _ = class {
51294     get translate() {
51295       return this.translateKeys || this.translateValues || this.reviveValues;
51296     }
51297   };
51298   var Y = class extends _ {
51299     get needed() {
51300       return this.enabled || this.deps.size > 0;
51301     }
51302     constructor(e3, t2, i3, n3) {
51303       if (super(), c(this, "enabled", false), c(this, "skip", /* @__PURE__ */ new Set()), c(this, "pick", /* @__PURE__ */ new Set()), c(this, "deps", /* @__PURE__ */ new Set()), c(this, "translateKeys", false), c(this, "translateValues", false), c(this, "reviveValues", false), this.key = e3, this.enabled = t2, this.parse = this.enabled, this.applyInheritables(n3), this.canBeFiltered = H.includes(e3), this.canBeFiltered && (this.dict = E.get(e3)), void 0 !== i3) if (Array.isArray(i3)) this.parse = this.enabled = true, this.canBeFiltered && i3.length > 0 && this.translateTagSet(i3, this.pick);
51304       else if ("object" == typeof i3) {
51305         if (this.enabled = true, this.parse = false !== i3.parse, this.canBeFiltered) {
51306           let { pick: e4, skip: t3 } = i3;
51307           e4 && e4.length > 0 && this.translateTagSet(e4, this.pick), t3 && t3.length > 0 && this.translateTagSet(t3, this.skip);
51308         }
51309         this.applyInheritables(i3);
51310       } else true === i3 || false === i3 ? this.parse = this.enabled = i3 : g2("Invalid options argument: ".concat(i3));
51311     }
51312     applyInheritables(e3) {
51313       let t2, i3;
51314       for (t2 of K) i3 = e3[t2], void 0 !== i3 && (this[t2] = i3);
51315     }
51316     translateTagSet(e3, t2) {
51317       if (this.dict) {
51318         let i3, n3, { tagKeys: s2, tagValues: r2 } = this.dict;
51319         for (i3 of e3) "string" == typeof i3 ? (n3 = r2.indexOf(i3), -1 === n3 && (n3 = s2.indexOf(Number(i3))), -1 !== n3 && t2.add(Number(s2[n3]))) : t2.add(i3);
51320       } else for (let i3 of e3) t2.add(i3);
51321     }
51322     finalizeFilters() {
51323       !this.enabled && this.deps.size > 0 ? (this.enabled = true, ee(this.pick, this.deps)) : this.enabled && this.pick.size > 0 && ee(this.pick, this.deps);
51324     }
51325   };
51326   var $2 = { jfif: false, tiff: true, xmp: false, icc: false, iptc: false, ifd0: true, ifd1: false, exif: true, gps: true, interop: false, ihdr: void 0, makerNote: false, userComment: false, multiSegment: false, skip: [], pick: [], translateKeys: true, translateValues: true, reviveValues: true, sanitize: true, mergeOutput: true, silentErrors: true, chunked: true, firstChunkSize: void 0, firstChunkSizeNode: 512, firstChunkSizeBrowser: 65536, chunkSize: 65536, chunkLimit: 5 };
51327   var J = /* @__PURE__ */ new Map();
51328   var q = class extends _ {
51329     static useCached(e3) {
51330       let t2 = J.get(e3);
51331       return void 0 !== t2 || (t2 = new this(e3), J.set(e3, t2)), t2;
51332     }
51333     constructor(e3) {
51334       super(), true === e3 ? this.setupFromTrue() : void 0 === e3 ? this.setupFromUndefined() : Array.isArray(e3) ? this.setupFromArray(e3) : "object" == typeof e3 ? this.setupFromObject(e3) : g2("Invalid options argument ".concat(e3)), void 0 === this.firstChunkSize && (this.firstChunkSize = t ? this.firstChunkSizeBrowser : this.firstChunkSizeNode), this.mergeOutput && (this.ifd1.enabled = false), this.filterNestedSegmentTags(), this.traverseTiffDependencyTree(), this.checkLoadedPlugins();
51335     }
51336     setupFromUndefined() {
51337       let e3;
51338       for (e3 of G) this[e3] = $2[e3];
51339       for (e3 of X) this[e3] = $2[e3];
51340       for (e3 of W) this[e3] = $2[e3];
51341       for (e3 of j) this[e3] = new Y(e3, $2[e3], void 0, this);
51342     }
51343     setupFromTrue() {
51344       let e3;
51345       for (e3 of G) this[e3] = $2[e3];
51346       for (e3 of X) this[e3] = $2[e3];
51347       for (e3 of W) this[e3] = true;
51348       for (e3 of j) this[e3] = new Y(e3, true, void 0, this);
51349     }
51350     setupFromArray(e3) {
51351       let t2;
51352       for (t2 of G) this[t2] = $2[t2];
51353       for (t2 of X) this[t2] = $2[t2];
51354       for (t2 of W) this[t2] = $2[t2];
51355       for (t2 of j) this[t2] = new Y(t2, false, void 0, this);
51356       this.setupGlobalFilters(e3, void 0, H);
51357     }
51358     setupFromObject(e3) {
51359       let t2;
51360       for (t2 of (H.ifd0 = H.ifd0 || H.image, H.ifd1 = H.ifd1 || H.thumbnail, Object.assign(this, e3), G)) this[t2] = Z(e3[t2], $2[t2]);
51361       for (t2 of X) this[t2] = Z(e3[t2], $2[t2]);
51362       for (t2 of W) this[t2] = Z(e3[t2], $2[t2]);
51363       for (t2 of z) this[t2] = new Y(t2, $2[t2], e3[t2], this);
51364       for (t2 of H) this[t2] = new Y(t2, $2[t2], e3[t2], this.tiff);
51365       this.setupGlobalFilters(e3.pick, e3.skip, H, j), true === e3.tiff ? this.batchEnableWithBool(H, true) : false === e3.tiff ? this.batchEnableWithUserValue(H, e3) : Array.isArray(e3.tiff) ? this.setupGlobalFilters(e3.tiff, void 0, H) : "object" == typeof e3.tiff && this.setupGlobalFilters(e3.tiff.pick, e3.tiff.skip, H);
51366     }
51367     batchEnableWithBool(e3, t2) {
51368       for (let i3 of e3) this[i3].enabled = t2;
51369     }
51370     batchEnableWithUserValue(e3, t2) {
51371       for (let i3 of e3) {
51372         let e4 = t2[i3];
51373         this[i3].enabled = false !== e4 && void 0 !== e4;
51374       }
51375     }
51376     setupGlobalFilters(e3, t2, i3, n3 = i3) {
51377       if (e3 && e3.length) {
51378         for (let e4 of n3) this[e4].enabled = false;
51379         let t3 = Q(e3, i3);
51380         for (let [e4, i4] of t3) ee(this[e4].pick, i4), this[e4].enabled = true;
51381       } else if (t2 && t2.length) {
51382         let e4 = Q(t2, i3);
51383         for (let [t3, i4] of e4) ee(this[t3].skip, i4);
51384       }
51385     }
51386     filterNestedSegmentTags() {
51387       let { ifd0: e3, exif: t2, xmp: i3, iptc: n3, icc: s2 } = this;
51388       this.makerNote ? t2.deps.add(37500) : t2.skip.add(37500), this.userComment ? t2.deps.add(37510) : t2.skip.add(37510), i3.enabled || e3.skip.add(700), n3.enabled || e3.skip.add(33723), s2.enabled || e3.skip.add(34675);
51389     }
51390     traverseTiffDependencyTree() {
51391       let { ifd0: e3, exif: t2, gps: i3, interop: n3 } = this;
51392       n3.needed && (t2.deps.add(40965), e3.deps.add(40965)), t2.needed && e3.deps.add(34665), i3.needed && e3.deps.add(34853), this.tiff.enabled = H.some((e4) => true === this[e4].enabled) || this.makerNote || this.userComment;
51393       for (let e4 of H) this[e4].finalizeFilters();
51394     }
51395     get onlyTiff() {
51396       return !V.map((e3) => this[e3].enabled).some((e3) => true === e3) && this.tiff.enabled;
51397     }
51398     checkLoadedPlugins() {
51399       for (let e3 of z) this[e3].enabled && !T.has(e3) && P("segment parser", e3);
51400     }
51401   };
51402   function Q(e3, t2) {
51403     let i3, n3, s2, r2, a2 = [];
51404     for (s2 of t2) {
51405       for (r2 of (i3 = E.get(s2), n3 = [], i3)) (e3.includes(r2[0]) || e3.includes(r2[1])) && n3.push(r2[0]);
51406       n3.length && a2.push([s2, n3]);
51407     }
51408     return a2;
51409   }
51410   function Z(e3, t2) {
51411     return void 0 !== e3 ? e3 : void 0 !== t2 ? t2 : void 0;
51412   }
51413   function ee(e3, t2) {
51414     for (let i3 of t2) e3.add(i3);
51415   }
51416   c(q, "default", $2);
51417   var te = class {
51418     constructor(e3) {
51419       c(this, "parsers", {}), c(this, "output", {}), c(this, "errors", []), c(this, "pushToErrors", (e4) => this.errors.push(e4)), this.options = q.useCached(e3);
51420     }
51421     async read(e3) {
51422       this.file = await D(e3, this.options);
51423     }
51424     setup() {
51425       if (this.fileParser) return;
51426       let { file: e3 } = this, t2 = e3.getUint16(0);
51427       for (let [i3, n3] of w) if (n3.canHandle(e3, t2)) return this.fileParser = new n3(this.options, this.file, this.parsers), e3[i3] = true;
51428       this.file.close && this.file.close(), g2("Unknown file format");
51429     }
51430     async parse() {
51431       let { output: e3, errors: t2 } = this;
51432       return this.setup(), this.options.silentErrors ? (await this.executeParsers().catch(this.pushToErrors), t2.push(...this.fileParser.errors)) : await this.executeParsers(), this.file.close && this.file.close(), this.options.silentErrors && t2.length > 0 && (e3.errors = t2), f(e3);
51433     }
51434     async executeParsers() {
51435       let { output: e3 } = this;
51436       await this.fileParser.parse();
51437       let t2 = Object.values(this.parsers).map(async (t3) => {
51438         let i3 = await t3.parse();
51439         t3.assignToOutput(e3, i3);
51440       });
51441       this.options.silentErrors && (t2 = t2.map((e4) => e4.catch(this.pushToErrors))), await Promise.all(t2);
51442     }
51443     async extractThumbnail() {
51444       this.setup();
51445       let { options: e3, file: t2 } = this, i3 = T.get("tiff", e3);
51446       var n3;
51447       if (t2.tiff ? n3 = { start: 0, type: "tiff" } : t2.jpeg && (n3 = await this.fileParser.getOrFindSegment("tiff")), void 0 === n3) return;
51448       let s2 = await this.fileParser.ensureSegmentChunk(n3), r2 = this.parsers.tiff = new i3(s2, e3, t2), a2 = await r2.extractThumbnail();
51449       return t2.close && t2.close(), a2;
51450     }
51451   };
51452   async function ie(e3, t2) {
51453     let i3 = new te(t2);
51454     return await i3.read(e3), i3.parse();
51455   }
51456   var ne = Object.freeze({ __proto__: null, parse: ie, Exifr: te, fileParsers: w, segmentParsers: T, fileReaders: A, tagKeys: E, tagValues: B, tagRevivers: N, createDictionary: U, extendDictionary: F, fetchUrlAsArrayBuffer: M, readBlobAsArrayBuffer: R, chunkedProps: G, otherSegments: V, segments: z, tiffBlocks: H, segmentsAndBlocks: j, tiffExtractables: W, inheritables: K, allFormatters: X, Options: q });
51457   var se = class {
51458     constructor(e3, t2, i3) {
51459       c(this, "errors", []), c(this, "ensureSegmentChunk", async (e4) => {
51460         let t3 = e4.start, i4 = e4.size || 65536;
51461         if (this.file.chunked) if (this.file.available(t3, i4)) e4.chunk = this.file.subarray(t3, i4);
51462         else try {
51463           e4.chunk = await this.file.readChunk(t3, i4);
51464         } catch (t4) {
51465           g2("Couldn't read segment: ".concat(JSON.stringify(e4), ". ").concat(t4.message));
51466         }
51467         else this.file.byteLength > t3 + i4 ? e4.chunk = this.file.subarray(t3, i4) : void 0 === e4.size ? e4.chunk = this.file.subarray(t3) : g2("Segment unreachable: " + JSON.stringify(e4));
51468         return e4.chunk;
51469       }), this.extendOptions && this.extendOptions(e3), this.options = e3, this.file = t2, this.parsers = i3;
51470     }
51471     injectSegment(e3, t2) {
51472       this.options[e3].enabled && this.createParser(e3, t2);
51473     }
51474     createParser(e3, t2) {
51475       let i3 = new (T.get(e3))(t2, this.options, this.file);
51476       return this.parsers[e3] = i3;
51477     }
51478     createParsers(e3) {
51479       for (let t2 of e3) {
51480         let { type: e4, chunk: i3 } = t2, n3 = this.options[e4];
51481         if (n3 && n3.enabled) {
51482           let t3 = this.parsers[e4];
51483           t3 && t3.append || t3 || this.createParser(e4, i3);
51484         }
51485       }
51486     }
51487     async readSegments(e3) {
51488       let t2 = e3.map(this.ensureSegmentChunk);
51489       await Promise.all(t2);
51490     }
51491   };
51492   var re2 = class {
51493     static findPosition(e3, t2) {
51494       let i3 = e3.getUint16(t2 + 2) + 2, n3 = "function" == typeof this.headerLength ? this.headerLength(e3, t2, i3) : this.headerLength, s2 = t2 + n3, r2 = i3 - n3;
51495       return { offset: t2, length: i3, headerLength: n3, start: s2, size: r2, end: s2 + r2 };
51496     }
51497     static parse(e3, t2 = {}) {
51498       return new this(e3, new q({ [this.type]: t2 }), e3).parse();
51499     }
51500     normalizeInput(e3) {
51501       return e3 instanceof I ? e3 : new I(e3);
51502     }
51503     constructor(e3, t2 = {}, i3) {
51504       c(this, "errors", []), c(this, "raw", /* @__PURE__ */ new Map()), c(this, "handleError", (e4) => {
51505         if (!this.options.silentErrors) throw e4;
51506         this.errors.push(e4.message);
51507       }), this.chunk = this.normalizeInput(e3), this.file = i3, this.type = this.constructor.type, this.globalOptions = this.options = t2, this.localOptions = t2[this.type], this.canTranslate = this.localOptions && this.localOptions.translate;
51508     }
51509     translate() {
51510       this.canTranslate && (this.translated = this.translateBlock(this.raw, this.type));
51511     }
51512     get output() {
51513       return this.translated ? this.translated : this.raw ? Object.fromEntries(this.raw) : void 0;
51514     }
51515     translateBlock(e3, t2) {
51516       let i3 = N.get(t2), n3 = B.get(t2), s2 = E.get(t2), r2 = this.options[t2], a2 = r2.reviveValues && !!i3, o2 = r2.translateValues && !!n3, l2 = r2.translateKeys && !!s2, h2 = {};
51517       for (let [t3, r3] of e3) a2 && i3.has(t3) ? r3 = i3.get(t3)(r3) : o2 && n3.has(t3) && (r3 = this.translateValue(r3, n3.get(t3))), l2 && s2.has(t3) && (t3 = s2.get(t3) || t3), h2[t3] = r3;
51518       return h2;
51519     }
51520     translateValue(e3, t2) {
51521       return t2[e3] || t2.DEFAULT || e3;
51522     }
51523     assignToOutput(e3, t2) {
51524       this.assignObjectToOutput(e3, this.constructor.type, t2);
51525     }
51526     assignObjectToOutput(e3, t2, i3) {
51527       if (this.globalOptions.mergeOutput) return Object.assign(e3, i3);
51528       e3[t2] ? Object.assign(e3[t2], i3) : e3[t2] = i3;
51529     }
51530   };
51531   c(re2, "headerLength", 4), c(re2, "type", void 0), c(re2, "multiSegment", false), c(re2, "canHandle", () => false);
51532   function ae(e3) {
51533     return 192 === e3 || 194 === e3 || 196 === e3 || 219 === e3 || 221 === e3 || 218 === e3 || 254 === e3;
51534   }
51535   function oe(e3) {
51536     return e3 >= 224 && e3 <= 239;
51537   }
51538   function le(e3, t2, i3) {
51539     for (let [n3, s2] of T) if (s2.canHandle(e3, t2, i3)) return n3;
51540   }
51541   var he = class extends se {
51542     constructor(...e3) {
51543       super(...e3), c(this, "appSegments", []), c(this, "jpegSegments", []), c(this, "unknownSegments", []);
51544     }
51545     static canHandle(e3, t2) {
51546       return 65496 === t2;
51547     }
51548     async parse() {
51549       await this.findAppSegments(), await this.readSegments(this.appSegments), this.mergeMultiSegments(), this.createParsers(this.mergedAppSegments || this.appSegments);
51550     }
51551     setupSegmentFinderArgs(e3) {
51552       true === e3 ? (this.findAll = true, this.wanted = new Set(T.keyList())) : (e3 = void 0 === e3 ? T.keyList().filter((e4) => this.options[e4].enabled) : e3.filter((e4) => this.options[e4].enabled && T.has(e4)), this.findAll = false, this.remaining = new Set(e3), this.wanted = new Set(e3)), this.unfinishedMultiSegment = false;
51553     }
51554     async findAppSegments(e3 = 0, t2) {
51555       this.setupSegmentFinderArgs(t2);
51556       let { file: i3, findAll: n3, wanted: s2, remaining: r2 } = this;
51557       if (!n3 && this.file.chunked && (n3 = Array.from(s2).some((e4) => {
51558         let t3 = T.get(e4), i4 = this.options[e4];
51559         return t3.multiSegment && i4.multiSegment;
51560       }), n3 && await this.file.readWhole()), e3 = this.findAppSegmentsInRange(e3, i3.byteLength), !this.options.onlyTiff && i3.chunked) {
51561         let t3 = false;
51562         for (; r2.size > 0 && !t3 && (i3.canReadNextChunk || this.unfinishedMultiSegment); ) {
51563           let { nextChunkOffset: n4 } = i3, s3 = this.appSegments.some((e4) => !this.file.available(e4.offset || e4.start, e4.length || e4.size));
51564           if (t3 = e3 > n4 && !s3 ? !await i3.readNextChunk(e3) : !await i3.readNextChunk(n4), void 0 === (e3 = this.findAppSegmentsInRange(e3, i3.byteLength))) return;
51565         }
51566       }
51567     }
51568     findAppSegmentsInRange(e3, t2) {
51569       t2 -= 2;
51570       let i3, n3, s2, r2, a2, o2, { file: l2, findAll: h2, wanted: u2, remaining: c2, options: f2 } = this;
51571       for (; e3 < t2; e3++) if (255 === l2.getUint8(e3)) {
51572         if (i3 = l2.getUint8(e3 + 1), oe(i3)) {
51573           if (n3 = l2.getUint16(e3 + 2), s2 = le(l2, e3, n3), s2 && u2.has(s2) && (r2 = T.get(s2), a2 = r2.findPosition(l2, e3), o2 = f2[s2], a2.type = s2, this.appSegments.push(a2), !h2 && (r2.multiSegment && o2.multiSegment ? (this.unfinishedMultiSegment = a2.chunkNumber < a2.chunkCount, this.unfinishedMultiSegment || c2.delete(s2)) : c2.delete(s2), 0 === c2.size))) break;
51574           f2.recordUnknownSegments && (a2 = re2.findPosition(l2, e3), a2.marker = i3, this.unknownSegments.push(a2)), e3 += n3 + 1;
51575         } else if (ae(i3)) {
51576           if (n3 = l2.getUint16(e3 + 2), 218 === i3 && false !== f2.stopAfterSos) return;
51577           f2.recordJpegSegments && this.jpegSegments.push({ offset: e3, length: n3, marker: i3 }), e3 += n3 + 1;
51578         }
51579       }
51580       return e3;
51581     }
51582     mergeMultiSegments() {
51583       if (!this.appSegments.some((e4) => e4.multiSegment)) return;
51584       let e3 = function(e4, t2) {
51585         let i3, n3, s2, r2 = /* @__PURE__ */ new Map();
51586         for (let a2 = 0; a2 < e4.length; a2++) i3 = e4[a2], n3 = i3[t2], r2.has(n3) ? s2 = r2.get(n3) : r2.set(n3, s2 = []), s2.push(i3);
51587         return Array.from(r2);
51588       }(this.appSegments, "type");
51589       this.mergedAppSegments = e3.map(([e4, t2]) => {
51590         let i3 = T.get(e4, this.options);
51591         if (i3.handleMultiSegments) {
51592           return { type: e4, chunk: i3.handleMultiSegments(t2) };
51593         }
51594         return t2[0];
51595       });
51596     }
51597     getSegment(e3) {
51598       return this.appSegments.find((t2) => t2.type === e3);
51599     }
51600     async getOrFindSegment(e3) {
51601       let t2 = this.getSegment(e3);
51602       return void 0 === t2 && (await this.findAppSegments(0, [e3]), t2 = this.getSegment(e3)), t2;
51603     }
51604   };
51605   c(he, "type", "jpeg"), w.set("jpeg", he);
51606   var ue = [void 0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 4];
51607   var ce = class extends re2 {
51608     parseHeader() {
51609       var e3 = this.chunk.getUint16();
51610       18761 === e3 ? this.le = true : 19789 === e3 && (this.le = false), this.chunk.le = this.le, this.headerParsed = true;
51611     }
51612     parseTags(e3, t2, i3 = /* @__PURE__ */ new Map()) {
51613       let { pick: n3, skip: s2 } = this.options[t2];
51614       n3 = new Set(n3);
51615       let r2 = n3.size > 0, a2 = 0 === s2.size, o2 = this.chunk.getUint16(e3);
51616       e3 += 2;
51617       for (let l2 = 0; l2 < o2; l2++) {
51618         let o3 = this.chunk.getUint16(e3);
51619         if (r2) {
51620           if (n3.has(o3) && (i3.set(o3, this.parseTag(e3, o3, t2)), n3.delete(o3), 0 === n3.size)) break;
51621         } else !a2 && s2.has(o3) || i3.set(o3, this.parseTag(e3, o3, t2));
51622         e3 += 12;
51623       }
51624       return i3;
51625     }
51626     parseTag(e3, t2, i3) {
51627       let { chunk: n3 } = this, s2 = n3.getUint16(e3 + 2), r2 = n3.getUint32(e3 + 4), a2 = ue[s2];
51628       if (a2 * r2 <= 4 ? e3 += 8 : e3 = n3.getUint32(e3 + 8), (s2 < 1 || s2 > 13) && g2("Invalid TIFF value type. block: ".concat(i3.toUpperCase(), ", tag: ").concat(t2.toString(16), ", type: ").concat(s2, ", offset ").concat(e3)), e3 > n3.byteLength && g2("Invalid TIFF value offset. block: ".concat(i3.toUpperCase(), ", tag: ").concat(t2.toString(16), ", type: ").concat(s2, ", offset ").concat(e3, " is outside of chunk size ").concat(n3.byteLength)), 1 === s2) return n3.getUint8Array(e3, r2);
51629       if (2 === s2) return m(n3.getString(e3, r2));
51630       if (7 === s2) return n3.getUint8Array(e3, r2);
51631       if (1 === r2) return this.parseTagValue(s2, e3);
51632       {
51633         let t3 = new (function(e4) {
51634           switch (e4) {
51635             case 1:
51636               return Uint8Array;
51637             case 3:
51638               return Uint16Array;
51639             case 4:
51640               return Uint32Array;
51641             case 5:
51642               return Array;
51643             case 6:
51644               return Int8Array;
51645             case 8:
51646               return Int16Array;
51647             case 9:
51648               return Int32Array;
51649             case 10:
51650               return Array;
51651             case 11:
51652               return Float32Array;
51653             case 12:
51654               return Float64Array;
51655             default:
51656               return Array;
51657           }
51658         }(s2))(r2), i4 = a2;
51659         for (let n4 = 0; n4 < r2; n4++) t3[n4] = this.parseTagValue(s2, e3), e3 += i4;
51660         return t3;
51661       }
51662     }
51663     parseTagValue(e3, t2) {
51664       let { chunk: i3 } = this;
51665       switch (e3) {
51666         case 1:
51667           return i3.getUint8(t2);
51668         case 3:
51669           return i3.getUint16(t2);
51670         case 4:
51671           return i3.getUint32(t2);
51672         case 5:
51673           return i3.getUint32(t2) / i3.getUint32(t2 + 4);
51674         case 6:
51675           return i3.getInt8(t2);
51676         case 8:
51677           return i3.getInt16(t2);
51678         case 9:
51679           return i3.getInt32(t2);
51680         case 10:
51681           return i3.getInt32(t2) / i3.getInt32(t2 + 4);
51682         case 11:
51683           return i3.getFloat(t2);
51684         case 12:
51685           return i3.getDouble(t2);
51686         case 13:
51687           return i3.getUint32(t2);
51688         default:
51689           g2("Invalid tiff type ".concat(e3));
51690       }
51691     }
51692   };
51693   var fe = class extends ce {
51694     static canHandle(e3, t2) {
51695       return 225 === e3.getUint8(t2 + 1) && 1165519206 === e3.getUint32(t2 + 4) && 0 === e3.getUint16(t2 + 8);
51696     }
51697     async parse() {
51698       this.parseHeader();
51699       let { options: e3 } = this;
51700       return e3.ifd0.enabled && await this.parseIfd0Block(), e3.exif.enabled && await this.safeParse("parseExifBlock"), e3.gps.enabled && await this.safeParse("parseGpsBlock"), e3.interop.enabled && await this.safeParse("parseInteropBlock"), e3.ifd1.enabled && await this.safeParse("parseThumbnailBlock"), this.createOutput();
51701     }
51702     safeParse(e3) {
51703       let t2 = this[e3]();
51704       return void 0 !== t2.catch && (t2 = t2.catch(this.handleError)), t2;
51705     }
51706     findIfd0Offset() {
51707       void 0 === this.ifd0Offset && (this.ifd0Offset = this.chunk.getUint32(4));
51708     }
51709     findIfd1Offset() {
51710       if (void 0 === this.ifd1Offset) {
51711         this.findIfd0Offset();
51712         let e3 = this.chunk.getUint16(this.ifd0Offset), t2 = this.ifd0Offset + 2 + 12 * e3;
51713         this.ifd1Offset = this.chunk.getUint32(t2);
51714       }
51715     }
51716     parseBlock(e3, t2) {
51717       let i3 = /* @__PURE__ */ new Map();
51718       return this[t2] = i3, this.parseTags(e3, t2, i3), i3;
51719     }
51720     async parseIfd0Block() {
51721       if (this.ifd0) return;
51722       let { file: e3 } = this;
51723       this.findIfd0Offset(), this.ifd0Offset < 8 && g2("Malformed EXIF data"), !e3.chunked && this.ifd0Offset > e3.byteLength && g2("IFD0 offset points to outside of file.\nthis.ifd0Offset: ".concat(this.ifd0Offset, ", file.byteLength: ").concat(e3.byteLength)), e3.tiff && await e3.ensureChunk(this.ifd0Offset, S(this.options));
51724       let t2 = this.parseBlock(this.ifd0Offset, "ifd0");
51725       return 0 !== t2.size ? (this.exifOffset = t2.get(34665), this.interopOffset = t2.get(40965), this.gpsOffset = t2.get(34853), this.xmp = t2.get(700), this.iptc = t2.get(33723), this.icc = t2.get(34675), this.options.sanitize && (t2.delete(34665), t2.delete(40965), t2.delete(34853), t2.delete(700), t2.delete(33723), t2.delete(34675)), t2) : void 0;
51726     }
51727     async parseExifBlock() {
51728       if (this.exif) return;
51729       if (this.ifd0 || await this.parseIfd0Block(), void 0 === this.exifOffset) return;
51730       this.file.tiff && await this.file.ensureChunk(this.exifOffset, S(this.options));
51731       let e3 = this.parseBlock(this.exifOffset, "exif");
51732       return this.interopOffset || (this.interopOffset = e3.get(40965)), this.makerNote = e3.get(37500), this.userComment = e3.get(37510), this.options.sanitize && (e3.delete(40965), e3.delete(37500), e3.delete(37510)), this.unpack(e3, 41728), this.unpack(e3, 41729), e3;
51733     }
51734     unpack(e3, t2) {
51735       let i3 = e3.get(t2);
51736       i3 && 1 === i3.length && e3.set(t2, i3[0]);
51737     }
51738     async parseGpsBlock() {
51739       if (this.gps) return;
51740       if (this.ifd0 || await this.parseIfd0Block(), void 0 === this.gpsOffset) return;
51741       let e3 = this.parseBlock(this.gpsOffset, "gps");
51742       return e3 && e3.has(2) && e3.has(4) && (e3.set("latitude", de(...e3.get(2), e3.get(1))), e3.set("longitude", de(...e3.get(4), e3.get(3)))), e3;
51743     }
51744     async parseInteropBlock() {
51745       if (!this.interop && (this.ifd0 || await this.parseIfd0Block(), void 0 !== this.interopOffset || this.exif || await this.parseExifBlock(), void 0 !== this.interopOffset)) return this.parseBlock(this.interopOffset, "interop");
51746     }
51747     async parseThumbnailBlock(e3 = false) {
51748       if (!this.ifd1 && !this.ifd1Parsed && (!this.options.mergeOutput || e3)) return this.findIfd1Offset(), this.ifd1Offset > 0 && (this.parseBlock(this.ifd1Offset, "ifd1"), this.ifd1Parsed = true), this.ifd1;
51749     }
51750     async extractThumbnail() {
51751       if (this.headerParsed || this.parseHeader(), this.ifd1Parsed || await this.parseThumbnailBlock(true), void 0 === this.ifd1) return;
51752       let e3 = this.ifd1.get(513), t2 = this.ifd1.get(514);
51753       return this.chunk.getUint8Array(e3, t2);
51754     }
51755     get image() {
51756       return this.ifd0;
51757     }
51758     get thumbnail() {
51759       return this.ifd1;
51760     }
51761     createOutput() {
51762       let e3, t2, i3, n3 = {};
51763       for (t2 of H) if (e3 = this[t2], !p(e3)) if (i3 = this.canTranslate ? this.translateBlock(e3, t2) : Object.fromEntries(e3), this.options.mergeOutput) {
51764         if ("ifd1" === t2) continue;
51765         Object.assign(n3, i3);
51766       } else n3[t2] = i3;
51767       return this.makerNote && (n3.makerNote = this.makerNote), this.userComment && (n3.userComment = this.userComment), n3;
51768     }
51769     assignToOutput(e3, t2) {
51770       if (this.globalOptions.mergeOutput) Object.assign(e3, t2);
51771       else for (let [i3, n3] of Object.entries(t2)) this.assignObjectToOutput(e3, i3, n3);
51772     }
51773   };
51774   function de(e3, t2, i3, n3) {
51775     var s2 = e3 + t2 / 60 + i3 / 3600;
51776     return "S" !== n3 && "W" !== n3 || (s2 *= -1), s2;
51777   }
51778   c(fe, "type", "tiff"), c(fe, "headerLength", 10), T.set("tiff", fe);
51779   var pe = Object.freeze({ __proto__: null, default: ne, Exifr: te, fileParsers: w, segmentParsers: T, fileReaders: A, tagKeys: E, tagValues: B, tagRevivers: N, createDictionary: U, extendDictionary: F, fetchUrlAsArrayBuffer: M, readBlobAsArrayBuffer: R, chunkedProps: G, otherSegments: V, segments: z, tiffBlocks: H, segmentsAndBlocks: j, tiffExtractables: W, inheritables: K, allFormatters: X, Options: q, parse: ie });
51780   var ge = { ifd0: false, ifd1: false, exif: false, gps: false, interop: false, sanitize: false, reviveValues: true, translateKeys: false, translateValues: false, mergeOutput: false };
51781   var me = Object.assign({}, ge, { firstChunkSize: 4e4, gps: [1, 2, 3, 4] });
51782   async function Se(e3) {
51783     let t2 = new te(me);
51784     await t2.read(e3);
51785     let i3 = await t2.parse();
51786     if (i3 && i3.gps) {
51787       let { latitude: e4, longitude: t3 } = i3.gps;
51788       return { latitude: e4, longitude: t3 };
51789     }
51790   }
51791   var Ce = Object.assign({}, ge, { tiff: false, ifd1: true, mergeOutput: false });
51792   async function ye(e3) {
51793     let t2 = new te(Ce);
51794     await t2.read(e3);
51795     let i3 = await t2.extractThumbnail();
51796     return i3 && a ? s.from(i3) : i3;
51797   }
51798   async function be(e3) {
51799     let t2 = await this.thumbnail(e3);
51800     if (void 0 !== t2) {
51801       let e4 = new Blob([t2]);
51802       return URL.createObjectURL(e4);
51803     }
51804   }
51805   var Ie = Object.assign({}, ge, { firstChunkSize: 4e4, ifd0: [274] });
51806   async function Pe(e3) {
51807     let t2 = new te(Ie);
51808     await t2.read(e3);
51809     let i3 = await t2.parse();
51810     if (i3 && i3.ifd0) return i3.ifd0[274];
51811   }
51812   var ke = Object.freeze({ 1: { dimensionSwapped: false, scaleX: 1, scaleY: 1, deg: 0, rad: 0 }, 2: { dimensionSwapped: false, scaleX: -1, scaleY: 1, deg: 0, rad: 0 }, 3: { dimensionSwapped: false, scaleX: 1, scaleY: 1, deg: 180, rad: 180 * Math.PI / 180 }, 4: { dimensionSwapped: false, scaleX: -1, scaleY: 1, deg: 180, rad: 180 * Math.PI / 180 }, 5: { dimensionSwapped: true, scaleX: 1, scaleY: -1, deg: 90, rad: 90 * Math.PI / 180 }, 6: { dimensionSwapped: true, scaleX: 1, scaleY: 1, deg: 90, rad: 90 * Math.PI / 180 }, 7: { dimensionSwapped: true, scaleX: 1, scaleY: -1, deg: 270, rad: 270 * Math.PI / 180 }, 8: { dimensionSwapped: true, scaleX: 1, scaleY: 1, deg: 270, rad: 270 * Math.PI / 180 } });
51813   var we = true;
51814   var Te = true;
51815   if ("object" == typeof navigator) {
51816     let e3 = navigator.userAgent;
51817     if (e3.includes("iPad") || e3.includes("iPhone")) {
51818       let t2 = e3.match(/OS (\d+)_(\d+)/);
51819       if (t2) {
51820         let [, e4, i3] = t2, n3 = Number(e4) + 0.1 * Number(i3);
51821         we = n3 < 13.4, Te = false;
51822       }
51823     } else if (e3.includes("OS X 10")) {
51824       let [, t2] = e3.match(/OS X 10[_.](\d+)/);
51825       we = Te = Number(t2) < 15;
51826     }
51827     if (e3.includes("Chrome/")) {
51828       let [, t2] = e3.match(/Chrome\/(\d+)/);
51829       we = Te = Number(t2) < 81;
51830     } else if (e3.includes("Firefox/")) {
51831       let [, t2] = e3.match(/Firefox\/(\d+)/);
51832       we = Te = Number(t2) < 77;
51833     }
51834   }
51835   async function Ae(e3) {
51836     let t2 = await Pe(e3);
51837     return Object.assign({ canvas: we, css: Te }, ke[t2]);
51838   }
51839   var De = class extends I {
51840     constructor(...e3) {
51841       super(...e3), c(this, "ranges", new Oe()), 0 !== this.byteLength && this.ranges.add(0, this.byteLength);
51842     }
51843     _tryExtend(e3, t2, i3) {
51844       if (0 === e3 && 0 === this.byteLength && i3) {
51845         let e4 = new DataView(i3.buffer || i3, i3.byteOffset, i3.byteLength);
51846         this._swapDataView(e4);
51847       } else {
51848         let i4 = e3 + t2;
51849         if (i4 > this.byteLength) {
51850           let { dataView: e4 } = this._extend(i4);
51851           this._swapDataView(e4);
51852         }
51853       }
51854     }
51855     _extend(e3) {
51856       let t2;
51857       t2 = a ? s.allocUnsafe(e3) : new Uint8Array(e3);
51858       let i3 = new DataView(t2.buffer, t2.byteOffset, t2.byteLength);
51859       return t2.set(new Uint8Array(this.buffer, this.byteOffset, this.byteLength), 0), { uintView: t2, dataView: i3 };
51860     }
51861     subarray(e3, t2, i3 = false) {
51862       return t2 = t2 || this._lengthToEnd(e3), i3 && this._tryExtend(e3, t2), this.ranges.add(e3, t2), super.subarray(e3, t2);
51863     }
51864     set(e3, t2, i3 = false) {
51865       i3 && this._tryExtend(t2, e3.byteLength, e3);
51866       let n3 = super.set(e3, t2);
51867       return this.ranges.add(t2, n3.byteLength), n3;
51868     }
51869     async ensureChunk(e3, t2) {
51870       this.chunked && (this.ranges.available(e3, t2) || await this.readChunk(e3, t2));
51871     }
51872     available(e3, t2) {
51873       return this.ranges.available(e3, t2);
51874     }
51875   };
51876   var Oe = class {
51877     constructor() {
51878       c(this, "list", []);
51879     }
51880     get length() {
51881       return this.list.length;
51882     }
51883     add(e3, t2, i3 = 0) {
51884       let n3 = e3 + t2, s2 = this.list.filter((t3) => xe(e3, t3.offset, n3) || xe(e3, t3.end, n3));
51885       if (s2.length > 0) {
51886         e3 = Math.min(e3, ...s2.map((e4) => e4.offset)), n3 = Math.max(n3, ...s2.map((e4) => e4.end)), t2 = n3 - e3;
51887         let i4 = s2.shift();
51888         i4.offset = e3, i4.length = t2, i4.end = n3, this.list = this.list.filter((e4) => !s2.includes(e4));
51889       } else this.list.push({ offset: e3, length: t2, end: n3 });
51890     }
51891     available(e3, t2) {
51892       let i3 = e3 + t2;
51893       return this.list.some((t3) => t3.offset <= e3 && i3 <= t3.end);
51894     }
51895   };
51896   function xe(e3, t2, i3) {
51897     return e3 <= t2 && t2 <= i3;
51898   }
51899   var ve = class extends De {
51900     constructor(e3, t2) {
51901       super(0), c(this, "chunksRead", 0), this.input = e3, this.options = t2;
51902     }
51903     async readWhole() {
51904       this.chunked = false, await this.readChunk(this.nextChunkOffset);
51905     }
51906     async readChunked() {
51907       this.chunked = true, await this.readChunk(0, this.options.firstChunkSize);
51908     }
51909     async readNextChunk(e3 = this.nextChunkOffset) {
51910       if (this.fullyRead) return this.chunksRead++, false;
51911       let t2 = this.options.chunkSize, i3 = await this.readChunk(e3, t2);
51912       return !!i3 && i3.byteLength === t2;
51913     }
51914     async readChunk(e3, t2) {
51915       if (this.chunksRead++, 0 !== (t2 = this.safeWrapAddress(e3, t2))) return this._readChunk(e3, t2);
51916     }
51917     safeWrapAddress(e3, t2) {
51918       return void 0 !== this.size && e3 + t2 > this.size ? Math.max(0, this.size - e3) : t2;
51919     }
51920     get nextChunkOffset() {
51921       if (0 !== this.ranges.list.length) return this.ranges.list[0].length;
51922     }
51923     get canReadNextChunk() {
51924       return this.chunksRead < this.options.chunkLimit;
51925     }
51926     get fullyRead() {
51927       return void 0 !== this.size && this.nextChunkOffset === this.size;
51928     }
51929     read() {
51930       return this.options.chunked ? this.readChunked() : this.readWhole();
51931     }
51932     close() {
51933     }
51934   };
51935   A.set("blob", class extends ve {
51936     async readWhole() {
51937       this.chunked = false;
51938       let e3 = await R(this.input);
51939       this._swapArrayBuffer(e3);
51940     }
51941     readChunked() {
51942       return this.chunked = true, this.size = this.input.size, super.readChunked();
51943     }
51944     async _readChunk(e3, t2) {
51945       let i3 = t2 ? e3 + t2 : void 0, n3 = this.input.slice(e3, i3), s2 = await R(n3);
51946       return this.set(s2, e3, true);
51947     }
51948   });
51949   var Me = Object.freeze({ __proto__: null, default: pe, Exifr: te, fileParsers: w, segmentParsers: T, fileReaders: A, tagKeys: E, tagValues: B, tagRevivers: N, createDictionary: U, extendDictionary: F, fetchUrlAsArrayBuffer: M, readBlobAsArrayBuffer: R, chunkedProps: G, otherSegments: V, segments: z, tiffBlocks: H, segmentsAndBlocks: j, tiffExtractables: W, inheritables: K, allFormatters: X, Options: q, parse: ie, gpsOnlyOptions: me, gps: Se, thumbnailOnlyOptions: Ce, thumbnail: ye, thumbnailUrl: be, orientationOnlyOptions: Ie, orientation: Pe, rotations: ke, get rotateCanvas() {
51950     return we;
51951   }, get rotateCss() {
51952     return Te;
51953   }, rotation: Ae });
51954   A.set("url", class extends ve {
51955     async readWhole() {
51956       this.chunked = false;
51957       let e3 = await M(this.input);
51958       e3 instanceof ArrayBuffer ? this._swapArrayBuffer(e3) : e3 instanceof Uint8Array && this._swapBuffer(e3);
51959     }
51960     async _readChunk(e3, t2) {
51961       let i3 = t2 ? e3 + t2 - 1 : void 0, n3 = this.options.httpHeaders || {};
51962       (e3 || i3) && (n3.range = "bytes=".concat([e3, i3].join("-")));
51963       let s2 = await h(this.input, { headers: n3 }), r2 = await s2.arrayBuffer(), a2 = r2.byteLength;
51964       if (416 !== s2.status) return a2 !== t2 && (this.size = e3 + a2), this.set(r2, e3, true);
51965     }
51966   });
51967   I.prototype.getUint64 = function(e3) {
51968     let t2 = this.getUint32(e3), i3 = this.getUint32(e3 + 4);
51969     return t2 < 1048575 ? t2 << 32 | i3 : void 0 !== typeof r ? (console.warn("Using BigInt because of type 64uint but JS can only handle 53b numbers."), r(t2) << r(32) | r(i3)) : void g2("Trying to read 64b value but JS can only handle 53b numbers.");
51970   };
51971   var Re = class extends se {
51972     parseBoxes(e3 = 0) {
51973       let t2 = [];
51974       for (; e3 < this.file.byteLength - 4; ) {
51975         let i3 = this.parseBoxHead(e3);
51976         if (t2.push(i3), 0 === i3.length) break;
51977         e3 += i3.length;
51978       }
51979       return t2;
51980     }
51981     parseSubBoxes(e3) {
51982       e3.boxes = this.parseBoxes(e3.start);
51983     }
51984     findBox(e3, t2) {
51985       return void 0 === e3.boxes && this.parseSubBoxes(e3), e3.boxes.find((e4) => e4.kind === t2);
51986     }
51987     parseBoxHead(e3) {
51988       let t2 = this.file.getUint32(e3), i3 = this.file.getString(e3 + 4, 4), n3 = e3 + 8;
51989       return 1 === t2 && (t2 = this.file.getUint64(e3 + 8), n3 += 8), { offset: e3, length: t2, kind: i3, start: n3 };
51990     }
51991     parseBoxFullHead(e3) {
51992       if (void 0 !== e3.version) return;
51993       let t2 = this.file.getUint32(e3.start);
51994       e3.version = t2 >> 24, e3.start += 4;
51995     }
51996   };
51997   var Le = class extends Re {
51998     static canHandle(e3, t2) {
51999       if (0 !== t2) return false;
52000       let i3 = e3.getUint16(2);
52001       if (i3 > 50) return false;
52002       let n3 = 16, s2 = [];
52003       for (; n3 < i3; ) s2.push(e3.getString(n3, 4)), n3 += 4;
52004       return s2.includes(this.type);
52005     }
52006     async parse() {
52007       let e3 = this.file.getUint32(0), t2 = this.parseBoxHead(e3);
52008       for (; "meta" !== t2.kind; ) e3 += t2.length, await this.file.ensureChunk(e3, 16), t2 = this.parseBoxHead(e3);
52009       await this.file.ensureChunk(t2.offset, t2.length), this.parseBoxFullHead(t2), this.parseSubBoxes(t2), this.options.icc.enabled && await this.findIcc(t2), this.options.tiff.enabled && await this.findExif(t2);
52010     }
52011     async registerSegment(e3, t2, i3) {
52012       await this.file.ensureChunk(t2, i3);
52013       let n3 = this.file.subarray(t2, i3);
52014       this.createParser(e3, n3);
52015     }
52016     async findIcc(e3) {
52017       let t2 = this.findBox(e3, "iprp");
52018       if (void 0 === t2) return;
52019       let i3 = this.findBox(t2, "ipco");
52020       if (void 0 === i3) return;
52021       let n3 = this.findBox(i3, "colr");
52022       void 0 !== n3 && await this.registerSegment("icc", n3.offset + 12, n3.length);
52023     }
52024     async findExif(e3) {
52025       let t2 = this.findBox(e3, "iinf");
52026       if (void 0 === t2) return;
52027       let i3 = this.findBox(e3, "iloc");
52028       if (void 0 === i3) return;
52029       let n3 = this.findExifLocIdInIinf(t2), s2 = this.findExtentInIloc(i3, n3);
52030       if (void 0 === s2) return;
52031       let [r2, a2] = s2;
52032       await this.file.ensureChunk(r2, a2);
52033       let o2 = 4 + this.file.getUint32(r2);
52034       r2 += o2, a2 -= o2, await this.registerSegment("tiff", r2, a2);
52035     }
52036     findExifLocIdInIinf(e3) {
52037       this.parseBoxFullHead(e3);
52038       let t2, i3, n3, s2, r2 = e3.start, a2 = this.file.getUint16(r2);
52039       for (r2 += 2; a2--; ) {
52040         if (t2 = this.parseBoxHead(r2), this.parseBoxFullHead(t2), i3 = t2.start, t2.version >= 2 && (n3 = 3 === t2.version ? 4 : 2, s2 = this.file.getString(i3 + n3 + 2, 4), "Exif" === s2)) return this.file.getUintBytes(i3, n3);
52041         r2 += t2.length;
52042       }
52043     }
52044     get8bits(e3) {
52045       let t2 = this.file.getUint8(e3);
52046       return [t2 >> 4, 15 & t2];
52047     }
52048     findExtentInIloc(e3, t2) {
52049       this.parseBoxFullHead(e3);
52050       let i3 = e3.start, [n3, s2] = this.get8bits(i3++), [r2, a2] = this.get8bits(i3++), o2 = 2 === e3.version ? 4 : 2, l2 = 1 === e3.version || 2 === e3.version ? 2 : 0, h2 = a2 + n3 + s2, u2 = 2 === e3.version ? 4 : 2, c2 = this.file.getUintBytes(i3, u2);
52051       for (i3 += u2; c2--; ) {
52052         let e4 = this.file.getUintBytes(i3, o2);
52053         i3 += o2 + l2 + 2 + r2;
52054         let u3 = this.file.getUint16(i3);
52055         if (i3 += 2, e4 === t2) return u3 > 1 && console.warn("ILOC box has more than one extent but we're only processing one\nPlease create an issue at https://github.com/MikeKovarik/exifr with this file"), [this.file.getUintBytes(i3 + a2, n3), this.file.getUintBytes(i3 + a2 + n3, s2)];
52056         i3 += u3 * h2;
52057       }
52058     }
52059   };
52060   var Ue = class extends Le {
52061   };
52062   c(Ue, "type", "heic");
52063   var Fe = class extends Le {
52064   };
52065   c(Fe, "type", "avif"), w.set("heic", Ue), w.set("avif", Fe), U(E, ["ifd0", "ifd1"], [[256, "ImageWidth"], [257, "ImageHeight"], [258, "BitsPerSample"], [259, "Compression"], [262, "PhotometricInterpretation"], [270, "ImageDescription"], [271, "Make"], [272, "Model"], [273, "StripOffsets"], [274, "Orientation"], [277, "SamplesPerPixel"], [278, "RowsPerStrip"], [279, "StripByteCounts"], [282, "XResolution"], [283, "YResolution"], [284, "PlanarConfiguration"], [296, "ResolutionUnit"], [301, "TransferFunction"], [305, "Software"], [306, "ModifyDate"], [315, "Artist"], [316, "HostComputer"], [317, "Predictor"], [318, "WhitePoint"], [319, "PrimaryChromaticities"], [513, "ThumbnailOffset"], [514, "ThumbnailLength"], [529, "YCbCrCoefficients"], [530, "YCbCrSubSampling"], [531, "YCbCrPositioning"], [532, "ReferenceBlackWhite"], [700, "ApplicationNotes"], [33432, "Copyright"], [33723, "IPTC"], [34665, "ExifIFD"], [34675, "ICC"], [34853, "GpsIFD"], [330, "SubIFD"], [40965, "InteropIFD"], [40091, "XPTitle"], [40092, "XPComment"], [40093, "XPAuthor"], [40094, "XPKeywords"], [40095, "XPSubject"]]), U(E, "exif", [[33434, "ExposureTime"], [33437, "FNumber"], [34850, "ExposureProgram"], [34852, "SpectralSensitivity"], [34855, "ISO"], [34858, "TimeZoneOffset"], [34859, "SelfTimerMode"], [34864, "SensitivityType"], [34865, "StandardOutputSensitivity"], [34866, "RecommendedExposureIndex"], [34867, "ISOSpeed"], [34868, "ISOSpeedLatitudeyyy"], [34869, "ISOSpeedLatitudezzz"], [36864, "ExifVersion"], [36867, "DateTimeOriginal"], [36868, "CreateDate"], [36873, "GooglePlusUploadCode"], [36880, "OffsetTime"], [36881, "OffsetTimeOriginal"], [36882, "OffsetTimeDigitized"], [37121, "ComponentsConfiguration"], [37122, "CompressedBitsPerPixel"], [37377, "ShutterSpeedValue"], [37378, "ApertureValue"], [37379, "BrightnessValue"], [37380, "ExposureCompensation"], [37381, "MaxApertureValue"], [37382, "SubjectDistance"], [37383, "MeteringMode"], [37384, "LightSource"], [37385, "Flash"], [37386, "FocalLength"], [37393, "ImageNumber"], [37394, "SecurityClassification"], [37395, "ImageHistory"], [37396, "SubjectArea"], [37500, "MakerNote"], [37510, "UserComment"], [37520, "SubSecTime"], [37521, "SubSecTimeOriginal"], [37522, "SubSecTimeDigitized"], [37888, "AmbientTemperature"], [37889, "Humidity"], [37890, "Pressure"], [37891, "WaterDepth"], [37892, "Acceleration"], [37893, "CameraElevationAngle"], [40960, "FlashpixVersion"], [40961, "ColorSpace"], [40962, "ExifImageWidth"], [40963, "ExifImageHeight"], [40964, "RelatedSoundFile"], [41483, "FlashEnergy"], [41486, "FocalPlaneXResolution"], [41487, "FocalPlaneYResolution"], [41488, "FocalPlaneResolutionUnit"], [41492, "SubjectLocation"], [41493, "ExposureIndex"], [41495, "SensingMethod"], [41728, "FileSource"], [41729, "SceneType"], [41730, "CFAPattern"], [41985, "CustomRendered"], [41986, "ExposureMode"], [41987, "WhiteBalance"], [41988, "DigitalZoomRatio"], [41989, "FocalLengthIn35mmFormat"], [41990, "SceneCaptureType"], [41991, "GainControl"], [41992, "Contrast"], [41993, "Saturation"], [41994, "Sharpness"], [41996, "SubjectDistanceRange"], [42016, "ImageUniqueID"], [42032, "OwnerName"], [42033, "SerialNumber"], [42034, "LensInfo"], [42035, "LensMake"], [42036, "LensModel"], [42037, "LensSerialNumber"], [42080, "CompositeImage"], [42081, "CompositeImageCount"], [42082, "CompositeImageExposureTimes"], [42240, "Gamma"], [59932, "Padding"], [59933, "OffsetSchema"], [65e3, "OwnerName"], [65001, "SerialNumber"], [65002, "Lens"], [65100, "RawFile"], [65101, "Converter"], [65102, "WhiteBalance"], [65105, "Exposure"], [65106, "Shadows"], [65107, "Brightness"], [65108, "Contrast"], [65109, "Saturation"], [65110, "Sharpness"], [65111, "Smoothness"], [65112, "MoireFilter"], [40965, "InteropIFD"]]), U(E, "gps", [[0, "GPSVersionID"], [1, "GPSLatitudeRef"], [2, "GPSLatitude"], [3, "GPSLongitudeRef"], [4, "GPSLongitude"], [5, "GPSAltitudeRef"], [6, "GPSAltitude"], [7, "GPSTimeStamp"], [8, "GPSSatellites"], [9, "GPSStatus"], [10, "GPSMeasureMode"], [11, "GPSDOP"], [12, "GPSSpeedRef"], [13, "GPSSpeed"], [14, "GPSTrackRef"], [15, "GPSTrack"], [16, "GPSImgDirectionRef"], [17, "GPSImgDirection"], [18, "GPSMapDatum"], [19, "GPSDestLatitudeRef"], [20, "GPSDestLatitude"], [21, "GPSDestLongitudeRef"], [22, "GPSDestLongitude"], [23, "GPSDestBearingRef"], [24, "GPSDestBearing"], [25, "GPSDestDistanceRef"], [26, "GPSDestDistance"], [27, "GPSProcessingMethod"], [28, "GPSAreaInformation"], [29, "GPSDateStamp"], [30, "GPSDifferential"], [31, "GPSHPositioningError"]]), U(B, ["ifd0", "ifd1"], [[274, { 1: "Horizontal (normal)", 2: "Mirror horizontal", 3: "Rotate 180", 4: "Mirror vertical", 5: "Mirror horizontal and rotate 270 CW", 6: "Rotate 90 CW", 7: "Mirror horizontal and rotate 90 CW", 8: "Rotate 270 CW" }], [296, { 1: "None", 2: "inches", 3: "cm" }]]);
52066   var Ee = U(B, "exif", [[34850, { 0: "Not defined", 1: "Manual", 2: "Normal program", 3: "Aperture priority", 4: "Shutter priority", 5: "Creative program", 6: "Action program", 7: "Portrait mode", 8: "Landscape mode" }], [37121, { 0: "-", 1: "Y", 2: "Cb", 3: "Cr", 4: "R", 5: "G", 6: "B" }], [37383, { 0: "Unknown", 1: "Average", 2: "CenterWeightedAverage", 3: "Spot", 4: "MultiSpot", 5: "Pattern", 6: "Partial", 255: "Other" }], [37384, { 0: "Unknown", 1: "Daylight", 2: "Fluorescent", 3: "Tungsten (incandescent light)", 4: "Flash", 9: "Fine weather", 10: "Cloudy weather", 11: "Shade", 12: "Daylight fluorescent (D 5700 - 7100K)", 13: "Day white fluorescent (N 4600 - 5400K)", 14: "Cool white fluorescent (W 3900 - 4500K)", 15: "White fluorescent (WW 3200 - 3700K)", 17: "Standard light A", 18: "Standard light B", 19: "Standard light C", 20: "D55", 21: "D65", 22: "D75", 23: "D50", 24: "ISO studio tungsten", 255: "Other" }], [37385, { 0: "Flash did not fire", 1: "Flash fired", 5: "Strobe return light not detected", 7: "Strobe return light detected", 9: "Flash fired, compulsory flash mode", 13: "Flash fired, compulsory flash mode, return light not detected", 15: "Flash fired, compulsory flash mode, return light detected", 16: "Flash did not fire, compulsory flash mode", 24: "Flash did not fire, auto mode", 25: "Flash fired, auto mode", 29: "Flash fired, auto mode, return light not detected", 31: "Flash fired, auto mode, return light detected", 32: "No flash function", 65: "Flash fired, red-eye reduction mode", 69: "Flash fired, red-eye reduction mode, return light not detected", 71: "Flash fired, red-eye reduction mode, return light detected", 73: "Flash fired, compulsory flash mode, red-eye reduction mode", 77: "Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected", 79: "Flash fired, compulsory flash mode, red-eye reduction mode, return light detected", 89: "Flash fired, auto mode, red-eye reduction mode", 93: "Flash fired, auto mode, return light not detected, red-eye reduction mode", 95: "Flash fired, auto mode, return light detected, red-eye reduction mode" }], [41495, { 1: "Not defined", 2: "One-chip color area sensor", 3: "Two-chip color area sensor", 4: "Three-chip color area sensor", 5: "Color sequential area sensor", 7: "Trilinear sensor", 8: "Color sequential linear sensor" }], [41728, { 1: "Film Scanner", 2: "Reflection Print Scanner", 3: "Digital Camera" }], [41729, { 1: "Directly photographed" }], [41985, { 0: "Normal", 1: "Custom", 2: "HDR (no original saved)", 3: "HDR (original saved)", 4: "Original (for HDR)", 6: "Panorama", 7: "Portrait HDR", 8: "Portrait" }], [41986, { 0: "Auto", 1: "Manual", 2: "Auto bracket" }], [41987, { 0: "Auto", 1: "Manual" }], [41990, { 0: "Standard", 1: "Landscape", 2: "Portrait", 3: "Night", 4: "Other" }], [41991, { 0: "None", 1: "Low gain up", 2: "High gain up", 3: "Low gain down", 4: "High gain down" }], [41996, { 0: "Unknown", 1: "Macro", 2: "Close", 3: "Distant" }], [42080, { 0: "Unknown", 1: "Not a Composite Image", 2: "General Composite Image", 3: "Composite Image Captured While Shooting" }]]);
52067   var Be = { 1: "No absolute unit of measurement", 2: "Inch", 3: "Centimeter" };
52068   Ee.set(37392, Be), Ee.set(41488, Be);
52069   var Ne = { 0: "Normal", 1: "Low", 2: "High" };
52070   function Ge(e3) {
52071     return "object" == typeof e3 && void 0 !== e3.length ? e3[0] : e3;
52072   }
52073   function Ve(e3) {
52074     let t2 = Array.from(e3).slice(1);
52075     return t2[1] > 15 && (t2 = t2.map((e4) => String.fromCharCode(e4))), "0" !== t2[2] && 0 !== t2[2] || t2.pop(), t2.join(".");
52076   }
52077   function ze(e3) {
52078     if ("string" == typeof e3) {
52079       var [t2, i3, n3, s2, r2, a2] = e3.trim().split(/[-: ]/g).map(Number), o2 = new Date(t2, i3 - 1, n3);
52080       return Number.isNaN(s2) || Number.isNaN(r2) || Number.isNaN(a2) || (o2.setHours(s2), o2.setMinutes(r2), o2.setSeconds(a2)), Number.isNaN(+o2) ? e3 : o2;
52081     }
52082   }
52083   function He(e3) {
52084     if ("string" == typeof e3) return e3;
52085     let t2 = [];
52086     if (0 === e3[1] && 0 === e3[e3.length - 1]) for (let i3 = 0; i3 < e3.length; i3 += 2) t2.push(je(e3[i3 + 1], e3[i3]));
52087     else for (let i3 = 0; i3 < e3.length; i3 += 2) t2.push(je(e3[i3], e3[i3 + 1]));
52088     return m(String.fromCodePoint(...t2));
52089   }
52090   function je(e3, t2) {
52091     return e3 << 8 | t2;
52092   }
52093   Ee.set(41992, Ne), Ee.set(41993, Ne), Ee.set(41994, Ne), U(N, ["ifd0", "ifd1"], [[50827, function(e3) {
52094     return "string" != typeof e3 ? b(e3) : e3;
52095   }], [306, ze], [40091, He], [40092, He], [40093, He], [40094, He], [40095, He]]), U(N, "exif", [[40960, Ve], [36864, Ve], [36867, ze], [36868, ze], [40962, Ge], [40963, Ge]]), U(N, "gps", [[0, (e3) => Array.from(e3).join(".")], [7, (e3) => Array.from(e3).join(":")]]);
52096   var We = class extends re2 {
52097     static canHandle(e3, t2) {
52098       return 225 === e3.getUint8(t2 + 1) && 1752462448 === e3.getUint32(t2 + 4) && "http://ns.adobe.com/" === e3.getString(t2 + 4, "http://ns.adobe.com/".length);
52099     }
52100     static headerLength(e3, t2) {
52101       return "http://ns.adobe.com/xmp/extension/" === e3.getString(t2 + 4, "http://ns.adobe.com/xmp/extension/".length) ? 79 : 4 + "http://ns.adobe.com/xap/1.0/".length + 1;
52102     }
52103     static findPosition(e3, t2) {
52104       let i3 = super.findPosition(e3, t2);
52105       return i3.multiSegment = i3.extended = 79 === i3.headerLength, i3.multiSegment ? (i3.chunkCount = e3.getUint8(t2 + 72), i3.chunkNumber = e3.getUint8(t2 + 76), 0 !== e3.getUint8(t2 + 77) && i3.chunkNumber++) : (i3.chunkCount = 1 / 0, i3.chunkNumber = -1), i3;
52106     }
52107     static handleMultiSegments(e3) {
52108       return e3.map((e4) => e4.chunk.getString()).join("");
52109     }
52110     normalizeInput(e3) {
52111       return "string" == typeof e3 ? e3 : I.from(e3).getString();
52112     }
52113     parse(e3 = this.chunk) {
52114       if (!this.localOptions.parse) return e3;
52115       e3 = function(e4) {
52116         let t3 = {}, i4 = {};
52117         for (let e6 of Ze) t3[e6] = [], i4[e6] = 0;
52118         return e4.replace(et, (e6, n4, s2) => {
52119           if ("<" === n4) {
52120             let n5 = ++i4[s2];
52121             return t3[s2].push(n5), "".concat(e6, "#").concat(n5);
52122           }
52123           return "".concat(e6, "#").concat(t3[s2].pop());
52124         });
52125       }(e3);
52126       let t2 = Xe.findAll(e3, "rdf", "Description");
52127       0 === t2.length && t2.push(new Xe("rdf", "Description", void 0, e3));
52128       let i3, n3 = {};
52129       for (let e4 of t2) for (let t3 of e4.properties) i3 = Je(t3.ns, n3), _e(t3, i3);
52130       return function(e4) {
52131         let t3;
52132         for (let i4 in e4) t3 = e4[i4] = f(e4[i4]), void 0 === t3 && delete e4[i4];
52133         return f(e4);
52134       }(n3);
52135     }
52136     assignToOutput(e3, t2) {
52137       if (this.localOptions.parse) for (let [i3, n3] of Object.entries(t2)) switch (i3) {
52138         case "tiff":
52139           this.assignObjectToOutput(e3, "ifd0", n3);
52140           break;
52141         case "exif":
52142           this.assignObjectToOutput(e3, "exif", n3);
52143           break;
52144         case "xmlns":
52145           break;
52146         default:
52147           this.assignObjectToOutput(e3, i3, n3);
52148       }
52149       else e3.xmp = t2;
52150     }
52151   };
52152   c(We, "type", "xmp"), c(We, "multiSegment", true), T.set("xmp", We);
52153   var Ke = class _Ke {
52154     static findAll(e3) {
52155       return qe(e3, /([a-zA-Z0-9-]+):([a-zA-Z0-9-]+)=("[^"]*"|'[^']*')/gm).map(_Ke.unpackMatch);
52156     }
52157     static unpackMatch(e3) {
52158       let t2 = e3[1], i3 = e3[2], n3 = e3[3].slice(1, -1);
52159       return n3 = Qe(n3), new _Ke(t2, i3, n3);
52160     }
52161     constructor(e3, t2, i3) {
52162       this.ns = e3, this.name = t2, this.value = i3;
52163     }
52164     serialize() {
52165       return this.value;
52166     }
52167   };
52168   var Xe = class _Xe {
52169     static findAll(e3, t2, i3) {
52170       if (void 0 !== t2 || void 0 !== i3) {
52171         t2 = t2 || "[\\w\\d-]+", i3 = i3 || "[\\w\\d-]+";
52172         var n3 = new RegExp("<(".concat(t2, "):(").concat(i3, ")(#\\d+)?((\\s+?[\\w\\d-:]+=(\"[^\"]*\"|'[^']*'))*\\s*)(\\/>|>([\\s\\S]*?)<\\/\\1:\\2\\3>)"), "gm");
52173       } else n3 = /<([\w\d-]+):([\w\d-]+)(#\d+)?((\s+?[\w\d-:]+=("[^"]*"|'[^']*'))*\s*)(\/>|>([\s\S]*?)<\/\1:\2\3>)/gm;
52174       return qe(e3, n3).map(_Xe.unpackMatch);
52175     }
52176     static unpackMatch(e3) {
52177       let t2 = e3[1], i3 = e3[2], n3 = e3[4], s2 = e3[8];
52178       return new _Xe(t2, i3, n3, s2);
52179     }
52180     constructor(e3, t2, i3, n3) {
52181       this.ns = e3, this.name = t2, this.attrString = i3, this.innerXml = n3, this.attrs = Ke.findAll(i3), this.children = _Xe.findAll(n3), this.value = 0 === this.children.length ? Qe(n3) : void 0, this.properties = [...this.attrs, ...this.children];
52182     }
52183     get isPrimitive() {
52184       return void 0 !== this.value && 0 === this.attrs.length && 0 === this.children.length;
52185     }
52186     get isListContainer() {
52187       return 1 === this.children.length && this.children[0].isList;
52188     }
52189     get isList() {
52190       let { ns: e3, name: t2 } = this;
52191       return "rdf" === e3 && ("Seq" === t2 || "Bag" === t2 || "Alt" === t2);
52192     }
52193     get isListItem() {
52194       return "rdf" === this.ns && "li" === this.name;
52195     }
52196     serialize() {
52197       if (0 === this.properties.length && void 0 === this.value) return;
52198       if (this.isPrimitive) return this.value;
52199       if (this.isListContainer) return this.children[0].serialize();
52200       if (this.isList) return $e(this.children.map(Ye));
52201       if (this.isListItem && 1 === this.children.length && 0 === this.attrs.length) return this.children[0].serialize();
52202       let e3 = {};
52203       for (let t2 of this.properties) _e(t2, e3);
52204       return void 0 !== this.value && (e3.value = this.value), f(e3);
52205     }
52206   };
52207   function _e(e3, t2) {
52208     let i3 = e3.serialize();
52209     void 0 !== i3 && (t2[e3.name] = i3);
52210   }
52211   var Ye = (e3) => e3.serialize();
52212   var $e = (e3) => 1 === e3.length ? e3[0] : e3;
52213   var Je = (e3, t2) => t2[e3] ? t2[e3] : t2[e3] = {};
52214   function qe(e3, t2) {
52215     let i3, n3 = [];
52216     if (!e3) return n3;
52217     for (; null !== (i3 = t2.exec(e3)); ) n3.push(i3);
52218     return n3;
52219   }
52220   function Qe(e3) {
52221     if (function(e4) {
52222       return null == e4 || "null" === e4 || "undefined" === e4 || "" === e4 || "" === e4.trim();
52223     }(e3)) return;
52224     let t2 = Number(e3);
52225     if (!Number.isNaN(t2)) return t2;
52226     let i3 = e3.toLowerCase();
52227     return "true" === i3 || "false" !== i3 && e3.trim();
52228   }
52229   var Ze = ["rdf:li", "rdf:Seq", "rdf:Bag", "rdf:Alt", "rdf:Description"];
52230   var et = new RegExp("(<|\\/)(".concat(Ze.join("|"), ")"), "g");
52231   var tt = Object.freeze({ __proto__: null, default: Me, Exifr: te, fileParsers: w, segmentParsers: T, fileReaders: A, tagKeys: E, tagValues: B, tagRevivers: N, createDictionary: U, extendDictionary: F, fetchUrlAsArrayBuffer: M, readBlobAsArrayBuffer: R, chunkedProps: G, otherSegments: V, segments: z, tiffBlocks: H, segmentsAndBlocks: j, tiffExtractables: W, inheritables: K, allFormatters: X, Options: q, parse: ie, gpsOnlyOptions: me, gps: Se, thumbnailOnlyOptions: Ce, thumbnail: ye, thumbnailUrl: be, orientationOnlyOptions: Ie, orientation: Pe, rotations: ke, get rotateCanvas() {
52232     return we;
52233   }, get rotateCss() {
52234     return Te;
52235   }, rotation: Ae });
52236   var at = l("fs", (e3) => e3.promises);
52237   A.set("fs", class extends ve {
52238     async readWhole() {
52239       this.chunked = false, this.fs = await at;
52240       let e3 = await this.fs.readFile(this.input);
52241       this._swapBuffer(e3);
52242     }
52243     async readChunked() {
52244       this.chunked = true, this.fs = await at, await this.open(), await this.readChunk(0, this.options.firstChunkSize);
52245     }
52246     async open() {
52247       void 0 === this.fh && (this.fh = await this.fs.open(this.input, "r"), this.size = (await this.fh.stat(this.input)).size);
52248     }
52249     async _readChunk(e3, t2) {
52250       void 0 === this.fh && await this.open(), e3 + t2 > this.size && (t2 = this.size - e3);
52251       var i3 = this.subarray(e3, t2, true);
52252       return await this.fh.read(i3.dataView, 0, t2, e3), i3;
52253     }
52254     async close() {
52255       if (this.fh) {
52256         let e3 = this.fh;
52257         this.fh = void 0, await e3.close();
52258       }
52259     }
52260   });
52261   A.set("base64", class extends ve {
52262     constructor(...e3) {
52263       super(...e3), this.input = this.input.replace(/^data:([^;]+);base64,/gim, ""), this.size = this.input.length / 4 * 3, this.input.endsWith("==") ? this.size -= 2 : this.input.endsWith("=") && (this.size -= 1);
52264     }
52265     async _readChunk(e3, t2) {
52266       let i3, n3, r2 = this.input;
52267       void 0 === e3 ? (e3 = 0, i3 = 0, n3 = 0) : (i3 = 4 * Math.floor(e3 / 3), n3 = e3 - i3 / 4 * 3), void 0 === t2 && (t2 = this.size);
52268       let o2 = e3 + t2, l2 = i3 + 4 * Math.ceil(o2 / 3);
52269       r2 = r2.slice(i3, l2);
52270       let h2 = Math.min(t2, this.size - e3);
52271       if (a) {
52272         let t3 = s.from(r2, "base64").slice(n3, n3 + h2);
52273         return this.set(t3, e3, true);
52274       }
52275       {
52276         let t3 = this.subarray(e3, h2, true), i4 = atob(r2), s2 = t3.toUint8();
52277         for (let e4 = 0; e4 < h2; e4++) s2[e4] = i4.charCodeAt(n3 + e4);
52278         return t3;
52279       }
52280     }
52281   });
52282   var ot = class extends se {
52283     static canHandle(e3, t2) {
52284       return 18761 === t2 || 19789 === t2;
52285     }
52286     extendOptions(e3) {
52287       let { ifd0: t2, xmp: i3, iptc: n3, icc: s2 } = e3;
52288       i3.enabled && t2.deps.add(700), n3.enabled && t2.deps.add(33723), s2.enabled && t2.deps.add(34675), t2.finalizeFilters();
52289     }
52290     async parse() {
52291       let { tiff: e3, xmp: t2, iptc: i3, icc: n3 } = this.options;
52292       if (e3.enabled || t2.enabled || i3.enabled || n3.enabled) {
52293         let e4 = Math.max(S(this.options), this.options.chunkSize);
52294         await this.file.ensureChunk(0, e4), this.createParser("tiff", this.file), this.parsers.tiff.parseHeader(), await this.parsers.tiff.parseIfd0Block(), this.adaptTiffPropAsSegment("xmp"), this.adaptTiffPropAsSegment("iptc"), this.adaptTiffPropAsSegment("icc");
52295       }
52296     }
52297     adaptTiffPropAsSegment(e3) {
52298       if (this.parsers.tiff[e3]) {
52299         let t2 = this.parsers.tiff[e3];
52300         this.injectSegment(e3, t2);
52301       }
52302     }
52303   };
52304   c(ot, "type", "tiff"), w.set("tiff", ot);
52305   var lt = l("zlib");
52306   var ht = ["ihdr", "iccp", "text", "itxt", "exif"];
52307   var ut = class extends se {
52308     constructor(...e3) {
52309       super(...e3), c(this, "catchError", (e4) => this.errors.push(e4)), c(this, "metaChunks", []), c(this, "unknownChunks", []);
52310     }
52311     static canHandle(e3, t2) {
52312       return 35152 === t2 && 2303741511 === e3.getUint32(0) && 218765834 === e3.getUint32(4);
52313     }
52314     async parse() {
52315       let { file: e3 } = this;
52316       await this.findPngChunksInRange("\x89PNG\r\n\1a\n".length, e3.byteLength), await this.readSegments(this.metaChunks), this.findIhdr(), this.parseTextChunks(), await this.findExif().catch(this.catchError), await this.findXmp().catch(this.catchError), await this.findIcc().catch(this.catchError);
52317     }
52318     async findPngChunksInRange(e3, t2) {
52319       let { file: i3 } = this;
52320       for (; e3 < t2; ) {
52321         let t3 = i3.getUint32(e3), n3 = i3.getUint32(e3 + 4), s2 = i3.getString(e3 + 4, 4).toLowerCase(), r2 = t3 + 4 + 4 + 4, a2 = { type: s2, offset: e3, length: r2, start: e3 + 4 + 4, size: t3, marker: n3 };
52322         ht.includes(s2) ? this.metaChunks.push(a2) : this.unknownChunks.push(a2), e3 += r2;
52323       }
52324     }
52325     parseTextChunks() {
52326       let e3 = this.metaChunks.filter((e4) => "text" === e4.type);
52327       for (let t2 of e3) {
52328         let [e4, i3] = this.file.getString(t2.start, t2.size).split("\0");
52329         this.injectKeyValToIhdr(e4, i3);
52330       }
52331     }
52332     injectKeyValToIhdr(e3, t2) {
52333       let i3 = this.parsers.ihdr;
52334       i3 && i3.raw.set(e3, t2);
52335     }
52336     findIhdr() {
52337       let e3 = this.metaChunks.find((e4) => "ihdr" === e4.type);
52338       e3 && false !== this.options.ihdr.enabled && this.createParser("ihdr", e3.chunk);
52339     }
52340     async findExif() {
52341       let e3 = this.metaChunks.find((e4) => "exif" === e4.type);
52342       e3 && this.injectSegment("tiff", e3.chunk);
52343     }
52344     async findXmp() {
52345       let e3 = this.metaChunks.filter((e4) => "itxt" === e4.type);
52346       for (let t2 of e3) {
52347         "XML:com.adobe.xmp" === t2.chunk.getString(0, "XML:com.adobe.xmp".length) && this.injectSegment("xmp", t2.chunk);
52348       }
52349     }
52350     async findIcc() {
52351       let e3 = this.metaChunks.find((e4) => "iccp" === e4.type);
52352       if (!e3) return;
52353       let { chunk: t2 } = e3, i3 = t2.getUint8Array(0, 81), s2 = 0;
52354       for (; s2 < 80 && 0 !== i3[s2]; ) s2++;
52355       let r2 = s2 + 2, a2 = t2.getString(0, s2);
52356       if (this.injectKeyValToIhdr("ProfileName", a2), n2) {
52357         let e4 = await lt, i4 = t2.getUint8Array(r2);
52358         i4 = e4.inflateSync(i4), this.injectSegment("icc", i4);
52359       }
52360     }
52361   };
52362   c(ut, "type", "png"), w.set("png", ut), U(E, "interop", [[1, "InteropIndex"], [2, "InteropVersion"], [4096, "RelatedImageFileFormat"], [4097, "RelatedImageWidth"], [4098, "RelatedImageHeight"]]), F(E, "ifd0", [[11, "ProcessingSoftware"], [254, "SubfileType"], [255, "OldSubfileType"], [263, "Thresholding"], [264, "CellWidth"], [265, "CellLength"], [266, "FillOrder"], [269, "DocumentName"], [280, "MinSampleValue"], [281, "MaxSampleValue"], [285, "PageName"], [286, "XPosition"], [287, "YPosition"], [290, "GrayResponseUnit"], [297, "PageNumber"], [321, "HalftoneHints"], [322, "TileWidth"], [323, "TileLength"], [332, "InkSet"], [337, "TargetPrinter"], [18246, "Rating"], [18249, "RatingPercent"], [33550, "PixelScale"], [34264, "ModelTransform"], [34377, "PhotoshopSettings"], [50706, "DNGVersion"], [50707, "DNGBackwardVersion"], [50708, "UniqueCameraModel"], [50709, "LocalizedCameraModel"], [50736, "DNGLensInfo"], [50739, "ShadowScale"], [50740, "DNGPrivateData"], [33920, "IntergraphMatrix"], [33922, "ModelTiePoint"], [34118, "SEMInfo"], [34735, "GeoTiffDirectory"], [34736, "GeoTiffDoubleParams"], [34737, "GeoTiffAsciiParams"], [50341, "PrintIM"], [50721, "ColorMatrix1"], [50722, "ColorMatrix2"], [50723, "CameraCalibration1"], [50724, "CameraCalibration2"], [50725, "ReductionMatrix1"], [50726, "ReductionMatrix2"], [50727, "AnalogBalance"], [50728, "AsShotNeutral"], [50729, "AsShotWhiteXY"], [50730, "BaselineExposure"], [50731, "BaselineNoise"], [50732, "BaselineSharpness"], [50734, "LinearResponseLimit"], [50735, "CameraSerialNumber"], [50741, "MakerNoteSafety"], [50778, "CalibrationIlluminant1"], [50779, "CalibrationIlluminant2"], [50781, "RawDataUniqueID"], [50827, "OriginalRawFileName"], [50828, "OriginalRawFileData"], [50831, "AsShotICCProfile"], [50832, "AsShotPreProfileMatrix"], [50833, "CurrentICCProfile"], [50834, "CurrentPreProfileMatrix"], [50879, "ColorimetricReference"], [50885, "SRawType"], [50898, "PanasonicTitle"], [50899, "PanasonicTitle2"], [50931, "CameraCalibrationSig"], [50932, "ProfileCalibrationSig"], [50933, "ProfileIFD"], [50934, "AsShotProfileName"], [50936, "ProfileName"], [50937, "ProfileHueSatMapDims"], [50938, "ProfileHueSatMapData1"], [50939, "ProfileHueSatMapData2"], [50940, "ProfileToneCurve"], [50941, "ProfileEmbedPolicy"], [50942, "ProfileCopyright"], [50964, "ForwardMatrix1"], [50965, "ForwardMatrix2"], [50966, "PreviewApplicationName"], [50967, "PreviewApplicationVersion"], [50968, "PreviewSettingsName"], [50969, "PreviewSettingsDigest"], [50970, "PreviewColorSpace"], [50971, "PreviewDateTime"], [50972, "RawImageDigest"], [50973, "OriginalRawFileDigest"], [50981, "ProfileLookTableDims"], [50982, "ProfileLookTableData"], [51043, "TimeCodes"], [51044, "FrameRate"], [51058, "TStop"], [51081, "ReelName"], [51089, "OriginalDefaultFinalSize"], [51090, "OriginalBestQualitySize"], [51091, "OriginalDefaultCropSize"], [51105, "CameraLabel"], [51107, "ProfileHueSatMapEncoding"], [51108, "ProfileLookTableEncoding"], [51109, "BaselineExposureOffset"], [51110, "DefaultBlackRender"], [51111, "NewRawImageDigest"], [51112, "RawToPreviewGain"]]);
52363   var ct = [[273, "StripOffsets"], [279, "StripByteCounts"], [288, "FreeOffsets"], [289, "FreeByteCounts"], [291, "GrayResponseCurve"], [292, "T4Options"], [293, "T6Options"], [300, "ColorResponseUnit"], [320, "ColorMap"], [324, "TileOffsets"], [325, "TileByteCounts"], [326, "BadFaxLines"], [327, "CleanFaxData"], [328, "ConsecutiveBadFaxLines"], [330, "SubIFD"], [333, "InkNames"], [334, "NumberofInks"], [336, "DotRange"], [338, "ExtraSamples"], [339, "SampleFormat"], [340, "SMinSampleValue"], [341, "SMaxSampleValue"], [342, "TransferRange"], [343, "ClipPath"], [344, "XClipPathUnits"], [345, "YClipPathUnits"], [346, "Indexed"], [347, "JPEGTables"], [351, "OPIProxy"], [400, "GlobalParametersIFD"], [401, "ProfileType"], [402, "FaxProfile"], [403, "CodingMethods"], [404, "VersionYear"], [405, "ModeNumber"], [433, "Decode"], [434, "DefaultImageColor"], [435, "T82Options"], [437, "JPEGTables"], [512, "JPEGProc"], [515, "JPEGRestartInterval"], [517, "JPEGLosslessPredictors"], [518, "JPEGPointTransforms"], [519, "JPEGQTables"], [520, "JPEGDCTables"], [521, "JPEGACTables"], [559, "StripRowCounts"], [999, "USPTOMiscellaneous"], [18247, "XP_DIP_XML"], [18248, "StitchInfo"], [28672, "SonyRawFileType"], [28688, "SonyToneCurve"], [28721, "VignettingCorrection"], [28722, "VignettingCorrParams"], [28724, "ChromaticAberrationCorrection"], [28725, "ChromaticAberrationCorrParams"], [28726, "DistortionCorrection"], [28727, "DistortionCorrParams"], [29895, "SonyCropTopLeft"], [29896, "SonyCropSize"], [32781, "ImageID"], [32931, "WangTag1"], [32932, "WangAnnotation"], [32933, "WangTag3"], [32934, "WangTag4"], [32953, "ImageReferencePoints"], [32954, "RegionXformTackPoint"], [32955, "WarpQuadrilateral"], [32956, "AffineTransformMat"], [32995, "Matteing"], [32996, "DataType"], [32997, "ImageDepth"], [32998, "TileDepth"], [33300, "ImageFullWidth"], [33301, "ImageFullHeight"], [33302, "TextureFormat"], [33303, "WrapModes"], [33304, "FovCot"], [33305, "MatrixWorldToScreen"], [33306, "MatrixWorldToCamera"], [33405, "Model2"], [33421, "CFARepeatPatternDim"], [33422, "CFAPattern2"], [33423, "BatteryLevel"], [33424, "KodakIFD"], [33445, "MDFileTag"], [33446, "MDScalePixel"], [33447, "MDColorTable"], [33448, "MDLabName"], [33449, "MDSampleInfo"], [33450, "MDPrepDate"], [33451, "MDPrepTime"], [33452, "MDFileUnits"], [33589, "AdventScale"], [33590, "AdventRevision"], [33628, "UIC1Tag"], [33629, "UIC2Tag"], [33630, "UIC3Tag"], [33631, "UIC4Tag"], [33918, "IntergraphPacketData"], [33919, "IntergraphFlagRegisters"], [33921, "INGRReserved"], [34016, "Site"], [34017, "ColorSequence"], [34018, "IT8Header"], [34019, "RasterPadding"], [34020, "BitsPerRunLength"], [34021, "BitsPerExtendedRunLength"], [34022, "ColorTable"], [34023, "ImageColorIndicator"], [34024, "BackgroundColorIndicator"], [34025, "ImageColorValue"], [34026, "BackgroundColorValue"], [34027, "PixelIntensityRange"], [34028, "TransparencyIndicator"], [34029, "ColorCharacterization"], [34030, "HCUsage"], [34031, "TrapIndicator"], [34032, "CMYKEquivalent"], [34152, "AFCP_IPTC"], [34232, "PixelMagicJBIGOptions"], [34263, "JPLCartoIFD"], [34306, "WB_GRGBLevels"], [34310, "LeafData"], [34687, "TIFF_FXExtensions"], [34688, "MultiProfiles"], [34689, "SharedData"], [34690, "T88Options"], [34732, "ImageLayer"], [34750, "JBIGOptions"], [34856, "Opto-ElectricConvFactor"], [34857, "Interlace"], [34908, "FaxRecvParams"], [34909, "FaxSubAddress"], [34910, "FaxRecvTime"], [34929, "FedexEDR"], [34954, "LeafSubIFD"], [37387, "FlashEnergy"], [37388, "SpatialFrequencyResponse"], [37389, "Noise"], [37390, "FocalPlaneXResolution"], [37391, "FocalPlaneYResolution"], [37392, "FocalPlaneResolutionUnit"], [37397, "ExposureIndex"], [37398, "TIFF-EPStandardID"], [37399, "SensingMethod"], [37434, "CIP3DataFile"], [37435, "CIP3Sheet"], [37436, "CIP3Side"], [37439, "StoNits"], [37679, "MSDocumentText"], [37680, "MSPropertySetStorage"], [37681, "MSDocumentTextPosition"], [37724, "ImageSourceData"], [40965, "InteropIFD"], [40976, "SamsungRawPointersOffset"], [40977, "SamsungRawPointersLength"], [41217, "SamsungRawByteOrder"], [41218, "SamsungRawUnknown"], [41484, "SpatialFrequencyResponse"], [41485, "Noise"], [41489, "ImageNumber"], [41490, "SecurityClassification"], [41491, "ImageHistory"], [41494, "TIFF-EPStandardID"], [41995, "DeviceSettingDescription"], [42112, "GDALMetadata"], [42113, "GDALNoData"], [44992, "ExpandSoftware"], [44993, "ExpandLens"], [44994, "ExpandFilm"], [44995, "ExpandFilterLens"], [44996, "ExpandScanner"], [44997, "ExpandFlashLamp"], [46275, "HasselbladRawImage"], [48129, "PixelFormat"], [48130, "Transformation"], [48131, "Uncompressed"], [48132, "ImageType"], [48256, "ImageWidth"], [48257, "ImageHeight"], [48258, "WidthResolution"], [48259, "HeightResolution"], [48320, "ImageOffset"], [48321, "ImageByteCount"], [48322, "AlphaOffset"], [48323, "AlphaByteCount"], [48324, "ImageDataDiscard"], [48325, "AlphaDataDiscard"], [50215, "OceScanjobDesc"], [50216, "OceApplicationSelector"], [50217, "OceIDNumber"], [50218, "OceImageLogic"], [50255, "Annotations"], [50459, "HasselbladExif"], [50547, "OriginalFileName"], [50560, "USPTOOriginalContentType"], [50656, "CR2CFAPattern"], [50710, "CFAPlaneColor"], [50711, "CFALayout"], [50712, "LinearizationTable"], [50713, "BlackLevelRepeatDim"], [50714, "BlackLevel"], [50715, "BlackLevelDeltaH"], [50716, "BlackLevelDeltaV"], [50717, "WhiteLevel"], [50718, "DefaultScale"], [50719, "DefaultCropOrigin"], [50720, "DefaultCropSize"], [50733, "BayerGreenSplit"], [50737, "ChromaBlurRadius"], [50738, "AntiAliasStrength"], [50752, "RawImageSegmentation"], [50780, "BestQualityScale"], [50784, "AliasLayerMetadata"], [50829, "ActiveArea"], [50830, "MaskedAreas"], [50935, "NoiseReductionApplied"], [50974, "SubTileBlockSize"], [50975, "RowInterleaveFactor"], [51008, "OpcodeList1"], [51009, "OpcodeList2"], [51022, "OpcodeList3"], [51041, "NoiseProfile"], [51114, "CacheVersion"], [51125, "DefaultUserCrop"], [51157, "NikonNEFInfo"], [65024, "KdcIFD"]];
52364   F(E, "ifd0", ct), F(E, "exif", ct), U(B, "gps", [[23, { M: "Magnetic North", T: "True North" }], [25, { K: "Kilometers", M: "Miles", N: "Nautical Miles" }]]);
52365   var ft = class extends re2 {
52366     static canHandle(e3, t2) {
52367       return 224 === e3.getUint8(t2 + 1) && 1246120262 === e3.getUint32(t2 + 4) && 0 === e3.getUint8(t2 + 8);
52368     }
52369     parse() {
52370       return this.parseTags(), this.translate(), this.output;
52371     }
52372     parseTags() {
52373       this.raw = /* @__PURE__ */ new Map([[0, this.chunk.getUint16(0)], [2, this.chunk.getUint8(2)], [3, this.chunk.getUint16(3)], [5, this.chunk.getUint16(5)], [7, this.chunk.getUint8(7)], [8, this.chunk.getUint8(8)]]);
52374     }
52375   };
52376   c(ft, "type", "jfif"), c(ft, "headerLength", 9), T.set("jfif", ft), U(E, "jfif", [[0, "JFIFVersion"], [2, "ResolutionUnit"], [3, "XResolution"], [5, "YResolution"], [7, "ThumbnailWidth"], [8, "ThumbnailHeight"]]);
52377   var dt = class extends re2 {
52378     parse() {
52379       return this.parseTags(), this.translate(), this.output;
52380     }
52381     parseTags() {
52382       this.raw = new Map([[0, this.chunk.getUint32(0)], [4, this.chunk.getUint32(4)], [8, this.chunk.getUint8(8)], [9, this.chunk.getUint8(9)], [10, this.chunk.getUint8(10)], [11, this.chunk.getUint8(11)], [12, this.chunk.getUint8(12)], ...Array.from(this.raw)]);
52383     }
52384   };
52385   c(dt, "type", "ihdr"), T.set("ihdr", dt), U(E, "ihdr", [[0, "ImageWidth"], [4, "ImageHeight"], [8, "BitDepth"], [9, "ColorType"], [10, "Compression"], [11, "Filter"], [12, "Interlace"]]), U(B, "ihdr", [[9, { 0: "Grayscale", 2: "RGB", 3: "Palette", 4: "Grayscale with Alpha", 6: "RGB with Alpha", DEFAULT: "Unknown" }], [10, { 0: "Deflate/Inflate", DEFAULT: "Unknown" }], [11, { 0: "Adaptive", DEFAULT: "Unknown" }], [12, { 0: "Noninterlaced", 1: "Adam7 Interlace", DEFAULT: "Unknown" }]]);
52386   var pt = class extends re2 {
52387     static canHandle(e3, t2) {
52388       return 226 === e3.getUint8(t2 + 1) && 1229144927 === e3.getUint32(t2 + 4);
52389     }
52390     static findPosition(e3, t2) {
52391       let i3 = super.findPosition(e3, t2);
52392       return i3.chunkNumber = e3.getUint8(t2 + 16), i3.chunkCount = e3.getUint8(t2 + 17), i3.multiSegment = i3.chunkCount > 1, i3;
52393     }
52394     static handleMultiSegments(e3) {
52395       return function(e4) {
52396         let t2 = function(e6) {
52397           let t3 = e6[0].constructor, i3 = 0;
52398           for (let t4 of e6) i3 += t4.length;
52399           let n3 = new t3(i3), s2 = 0;
52400           for (let t4 of e6) n3.set(t4, s2), s2 += t4.length;
52401           return n3;
52402         }(e4.map((e6) => e6.chunk.toUint8()));
52403         return new I(t2);
52404       }(e3);
52405     }
52406     parse() {
52407       return this.raw = /* @__PURE__ */ new Map(), this.parseHeader(), this.parseTags(), this.translate(), this.output;
52408     }
52409     parseHeader() {
52410       let { raw: e3 } = this;
52411       this.chunk.byteLength < 84 && g2("ICC header is too short");
52412       for (let [t2, i3] of Object.entries(gt)) {
52413         t2 = parseInt(t2, 10);
52414         let n3 = i3(this.chunk, t2);
52415         "\0\0\0\0" !== n3 && e3.set(t2, n3);
52416       }
52417     }
52418     parseTags() {
52419       let e3, t2, i3, n3, s2, { raw: r2 } = this, a2 = this.chunk.getUint32(128), o2 = 132, l2 = this.chunk.byteLength;
52420       for (; a2--; ) {
52421         if (e3 = this.chunk.getString(o2, 4), t2 = this.chunk.getUint32(o2 + 4), i3 = this.chunk.getUint32(o2 + 8), n3 = this.chunk.getString(t2, 4), t2 + i3 > l2) return void console.warn("reached the end of the first ICC chunk. Enable options.tiff.multiSegment to read all ICC segments.");
52422         s2 = this.parseTag(n3, t2, i3), void 0 !== s2 && "\0\0\0\0" !== s2 && r2.set(e3, s2), o2 += 12;
52423       }
52424     }
52425     parseTag(e3, t2, i3) {
52426       switch (e3) {
52427         case "desc":
52428           return this.parseDesc(t2);
52429         case "mluc":
52430           return this.parseMluc(t2);
52431         case "text":
52432           return this.parseText(t2, i3);
52433         case "sig ":
52434           return this.parseSig(t2);
52435       }
52436       if (!(t2 + i3 > this.chunk.byteLength)) return this.chunk.getUint8Array(t2, i3);
52437     }
52438     parseDesc(e3) {
52439       let t2 = this.chunk.getUint32(e3 + 8) - 1;
52440       return m(this.chunk.getString(e3 + 12, t2));
52441     }
52442     parseText(e3, t2) {
52443       return m(this.chunk.getString(e3 + 8, t2 - 8));
52444     }
52445     parseSig(e3) {
52446       return m(this.chunk.getString(e3 + 8, 4));
52447     }
52448     parseMluc(e3) {
52449       let { chunk: t2 } = this, i3 = t2.getUint32(e3 + 8), n3 = t2.getUint32(e3 + 12), s2 = e3 + 16, r2 = [];
52450       for (let a2 = 0; a2 < i3; a2++) {
52451         let i4 = t2.getString(s2 + 0, 2), a3 = t2.getString(s2 + 2, 2), o2 = t2.getUint32(s2 + 4), l2 = t2.getUint32(s2 + 8) + e3, h2 = m(t2.getUnicodeString(l2, o2));
52452         r2.push({ lang: i4, country: a3, text: h2 }), s2 += n3;
52453       }
52454       return 1 === i3 ? r2[0].text : r2;
52455     }
52456     translateValue(e3, t2) {
52457       return "string" == typeof e3 ? t2[e3] || t2[e3.toLowerCase()] || e3 : t2[e3] || e3;
52458     }
52459   };
52460   c(pt, "type", "icc"), c(pt, "multiSegment", true), c(pt, "headerLength", 18);
52461   var gt = { 4: mt, 8: function(e3, t2) {
52462     return [e3.getUint8(t2), e3.getUint8(t2 + 1) >> 4, e3.getUint8(t2 + 1) % 16].map((e4) => e4.toString(10)).join(".");
52463   }, 12: mt, 16: mt, 20: mt, 24: function(e3, t2) {
52464     const i3 = e3.getUint16(t2), n3 = e3.getUint16(t2 + 2) - 1, s2 = e3.getUint16(t2 + 4), r2 = e3.getUint16(t2 + 6), a2 = e3.getUint16(t2 + 8), o2 = e3.getUint16(t2 + 10);
52465     return new Date(Date.UTC(i3, n3, s2, r2, a2, o2));
52466   }, 36: mt, 40: mt, 48: mt, 52: mt, 64: (e3, t2) => e3.getUint32(t2), 80: mt };
52467   function mt(e3, t2) {
52468     return m(e3.getString(t2, 4));
52469   }
52470   T.set("icc", pt), U(E, "icc", [[4, "ProfileCMMType"], [8, "ProfileVersion"], [12, "ProfileClass"], [16, "ColorSpaceData"], [20, "ProfileConnectionSpace"], [24, "ProfileDateTime"], [36, "ProfileFileSignature"], [40, "PrimaryPlatform"], [44, "CMMFlags"], [48, "DeviceManufacturer"], [52, "DeviceModel"], [56, "DeviceAttributes"], [64, "RenderingIntent"], [68, "ConnectionSpaceIlluminant"], [80, "ProfileCreator"], [84, "ProfileID"], ["Header", "ProfileHeader"], ["MS00", "WCSProfiles"], ["bTRC", "BlueTRC"], ["bXYZ", "BlueMatrixColumn"], ["bfd", "UCRBG"], ["bkpt", "MediaBlackPoint"], ["calt", "CalibrationDateTime"], ["chad", "ChromaticAdaptation"], ["chrm", "Chromaticity"], ["ciis", "ColorimetricIntentImageState"], ["clot", "ColorantTableOut"], ["clro", "ColorantOrder"], ["clrt", "ColorantTable"], ["cprt", "ProfileCopyright"], ["crdi", "CRDInfo"], ["desc", "ProfileDescription"], ["devs", "DeviceSettings"], ["dmdd", "DeviceModelDesc"], ["dmnd", "DeviceMfgDesc"], ["dscm", "ProfileDescriptionML"], ["fpce", "FocalPlaneColorimetryEstimates"], ["gTRC", "GreenTRC"], ["gXYZ", "GreenMatrixColumn"], ["gamt", "Gamut"], ["kTRC", "GrayTRC"], ["lumi", "Luminance"], ["meas", "Measurement"], ["meta", "Metadata"], ["mmod", "MakeAndModel"], ["ncl2", "NamedColor2"], ["ncol", "NamedColor"], ["ndin", "NativeDisplayInfo"], ["pre0", "Preview0"], ["pre1", "Preview1"], ["pre2", "Preview2"], ["ps2i", "PS2RenderingIntent"], ["ps2s", "PostScript2CSA"], ["psd0", "PostScript2CRD0"], ["psd1", "PostScript2CRD1"], ["psd2", "PostScript2CRD2"], ["psd3", "PostScript2CRD3"], ["pseq", "ProfileSequenceDesc"], ["psid", "ProfileSequenceIdentifier"], ["psvm", "PS2CRDVMSize"], ["rTRC", "RedTRC"], ["rXYZ", "RedMatrixColumn"], ["resp", "OutputResponse"], ["rhoc", "ReflectionHardcopyOrigColorimetry"], ["rig0", "PerceptualRenderingIntentGamut"], ["rig2", "SaturationRenderingIntentGamut"], ["rpoc", "ReflectionPrintOutputColorimetry"], ["sape", "SceneAppearanceEstimates"], ["scoe", "SceneColorimetryEstimates"], ["scrd", "ScreeningDesc"], ["scrn", "Screening"], ["targ", "CharTarget"], ["tech", "Technology"], ["vcgt", "VideoCardGamma"], ["view", "ViewingConditions"], ["vued", "ViewingCondDesc"], ["wtpt", "MediaWhitePoint"]]);
52471   var St = { "4d2p": "Erdt Systems", AAMA: "Aamazing Technologies", ACER: "Acer", ACLT: "Acolyte Color Research", ACTI: "Actix Sytems", ADAR: "Adara Technology", ADBE: "Adobe", ADI: "ADI Systems", AGFA: "Agfa Graphics", ALMD: "Alps Electric", ALPS: "Alps Electric", ALWN: "Alwan Color Expertise", AMTI: "Amiable Technologies", AOC: "AOC International", APAG: "Apago", APPL: "Apple Computer", AST: "AST", "AT&T": "AT&T", BAEL: "BARBIERI electronic", BRCO: "Barco NV", BRKP: "Breakpoint", BROT: "Brother", BULL: "Bull", BUS: "Bus Computer Systems", "C-IT": "C-Itoh", CAMR: "Intel", CANO: "Canon", CARR: "Carroll Touch", CASI: "Casio", CBUS: "Colorbus PL", CEL: "Crossfield", CELx: "Crossfield", CGS: "CGS Publishing Technologies International", CHM: "Rochester Robotics", CIGL: "Colour Imaging Group, London", CITI: "Citizen", CL00: "Candela", CLIQ: "Color IQ", CMCO: "Chromaco", CMiX: "CHROMiX", COLO: "Colorgraphic Communications", COMP: "Compaq", COMp: "Compeq/Focus Technology", CONR: "Conrac Display Products", CORD: "Cordata Technologies", CPQ: "Compaq", CPRO: "ColorPro", CRN: "Cornerstone", CTX: "CTX International", CVIS: "ColorVision", CWC: "Fujitsu Laboratories", DARI: "Darius Technology", DATA: "Dataproducts", DCP: "Dry Creek Photo", DCRC: "Digital Contents Resource Center, Chung-Ang University", DELL: "Dell Computer", DIC: "Dainippon Ink and Chemicals", DICO: "Diconix", DIGI: "Digital", "DL&C": "Digital Light & Color", DPLG: "Doppelganger", DS: "Dainippon Screen", DSOL: "DOOSOL", DUPN: "DuPont", EPSO: "Epson", ESKO: "Esko-Graphics", ETRI: "Electronics and Telecommunications Research Institute", EVER: "Everex Systems", EXAC: "ExactCODE", Eizo: "Eizo", FALC: "Falco Data Products", FF: "Fuji Photo Film", FFEI: "FujiFilm Electronic Imaging", FNRD: "Fnord Software", FORA: "Fora", FORE: "Forefront Technology", FP: "Fujitsu", FPA: "WayTech Development", FUJI: "Fujitsu", FX: "Fuji Xerox", GCC: "GCC Technologies", GGSL: "Global Graphics Software", GMB: "Gretagmacbeth", GMG: "GMG", GOLD: "GoldStar Technology", GOOG: "Google", GPRT: "Giantprint", GTMB: "Gretagmacbeth", GVC: "WayTech Development", GW2K: "Sony", HCI: "HCI", HDM: "Heidelberger Druckmaschinen", HERM: "Hermes", HITA: "Hitachi America", HP: "Hewlett-Packard", HTC: "Hitachi", HiTi: "HiTi Digital", IBM: "IBM", IDNT: "Scitex", IEC: "Hewlett-Packard", IIYA: "Iiyama North America", IKEG: "Ikegami Electronics", IMAG: "Image Systems", IMI: "Ingram Micro", INTC: "Intel", INTL: "N/A (INTL)", INTR: "Intra Electronics", IOCO: "Iocomm International Technology", IPS: "InfoPrint Solutions Company", IRIS: "Scitex", ISL: "Ichikawa Soft Laboratory", ITNL: "N/A (ITNL)", IVM: "IVM", IWAT: "Iwatsu Electric", Idnt: "Scitex", Inca: "Inca Digital Printers", Iris: "Scitex", JPEG: "Joint Photographic Experts Group", JSFT: "Jetsoft Development", JVC: "JVC Information Products", KART: "Scitex", KFC: "KFC Computek Components", KLH: "KLH Computers", KMHD: "Konica Minolta", KNCA: "Konica", KODA: "Kodak", KYOC: "Kyocera", Kart: "Scitex", LCAG: "Leica", LCCD: "Leeds Colour", LDAK: "Left Dakota", LEAD: "Leading Technology", LEXM: "Lexmark International", LINK: "Link Computer", LINO: "Linotronic", LITE: "Lite-On", Leaf: "Leaf", Lino: "Linotronic", MAGC: "Mag Computronic", MAGI: "MAG Innovision", MANN: "Mannesmann", MICN: "Micron Technology", MICR: "Microtek", MICV: "Microvitec", MINO: "Minolta", MITS: "Mitsubishi Electronics America", MITs: "Mitsuba", MNLT: "Minolta", MODG: "Modgraph", MONI: "Monitronix", MONS: "Monaco Systems", MORS: "Morse Technology", MOTI: "Motive Systems", MSFT: "Microsoft", MUTO: "MUTOH INDUSTRIES", Mits: "Mitsubishi Electric", NANA: "NANAO", NEC: "NEC", NEXP: "NexPress Solutions", NISS: "Nissei Sangyo America", NKON: "Nikon", NONE: "none", OCE: "Oce Technologies", OCEC: "OceColor", OKI: "Oki", OKID: "Okidata", OKIP: "Okidata", OLIV: "Olivetti", OLYM: "Olympus", ONYX: "Onyx Graphics", OPTI: "Optiquest", PACK: "Packard Bell", PANA: "Matsushita Electric Industrial", PANT: "Pantone", PBN: "Packard Bell", PFU: "PFU", PHIL: "Philips Consumer Electronics", PNTX: "HOYA", POne: "Phase One A/S", PREM: "Premier Computer Innovations", PRIN: "Princeton Graphic Systems", PRIP: "Princeton Publishing Labs", QLUX: "Hong Kong", QMS: "QMS", QPCD: "QPcard AB", QUAD: "QuadLaser", QUME: "Qume", RADI: "Radius", RDDx: "Integrated Color Solutions", RDG: "Roland DG", REDM: "REDMS Group", RELI: "Relisys", RGMS: "Rolf Gierling Multitools", RICO: "Ricoh", RNLD: "Edmund Ronald", ROYA: "Royal", RPC: "Ricoh Printing Systems", RTL: "Royal Information Electronics", SAMP: "Sampo", SAMS: "Samsung", SANT: "Jaime Santana Pomares", SCIT: "Scitex", SCRN: "Dainippon Screen", SDP: "Scitex", SEC: "Samsung", SEIK: "Seiko Instruments", SEIk: "Seikosha", SGUY: "ScanGuy.com", SHAR: "Sharp Laboratories", SICC: "International Color Consortium", SONY: "Sony", SPCL: "SpectraCal", STAR: "Star", STC: "Sampo Technology", Scit: "Scitex", Sdp: "Scitex", Sony: "Sony", TALO: "Talon Technology", TAND: "Tandy", TATU: "Tatung", TAXA: "TAXAN America", TDS: "Tokyo Denshi Sekei", TECO: "TECO Information Systems", TEGR: "Tegra", TEKT: "Tektronix", TI: "Texas Instruments", TMKR: "TypeMaker", TOSB: "Toshiba", TOSH: "Toshiba", TOTK: "TOTOKU ELECTRIC", TRIU: "Triumph", TSBT: "Toshiba", TTX: "TTX Computer Products", TVM: "TVM Professional Monitor", TW: "TW Casper", ULSX: "Ulead Systems", UNIS: "Unisys", UTZF: "Utz Fehlau & Sohn", VARI: "Varityper", VIEW: "Viewsonic", VISL: "Visual communication", VIVO: "Vivo Mobile Communication", WANG: "Wang", WLBR: "Wilbur Imaging", WTG2: "Ware To Go", WYSE: "WYSE Technology", XERX: "Xerox", XRIT: "X-Rite", ZRAN: "Zoran", Zebr: "Zebra Technologies", appl: "Apple Computer", bICC: "basICColor", berg: "bergdesign", ceyd: "Integrated Color Solutions", clsp: "MacDermid ColorSpan", ds: "Dainippon Screen", dupn: "DuPont", ffei: "FujiFilm Electronic Imaging", flux: "FluxData", iris: "Scitex", kart: "Scitex", lcms: "Little CMS", lino: "Linotronic", none: "none", ob4d: "Erdt Systems", obic: "Medigraph", quby: "Qubyx Sarl", scit: "Scitex", scrn: "Dainippon Screen", sdp: "Scitex", siwi: "SIWI GRAFIKA", yxym: "YxyMaster" };
52472   var Ct = { scnr: "Scanner", mntr: "Monitor", prtr: "Printer", link: "Device Link", abst: "Abstract", spac: "Color Space Conversion Profile", nmcl: "Named Color", cenc: "ColorEncodingSpace profile", mid: "MultiplexIdentification profile", mlnk: "MultiplexLink profile", mvis: "MultiplexVisualization profile", nkpf: "Nikon Input Device Profile (NON-STANDARD!)" };
52473   U(B, "icc", [[4, St], [12, Ct], [40, Object.assign({}, St, Ct)], [48, St], [80, St], [64, { 0: "Perceptual", 1: "Relative Colorimetric", 2: "Saturation", 3: "Absolute Colorimetric" }], ["tech", { amd: "Active Matrix Display", crt: "Cathode Ray Tube Display", kpcd: "Photo CD", pmd: "Passive Matrix Display", dcam: "Digital Camera", dcpj: "Digital Cinema Projector", dmpc: "Digital Motion Picture Camera", dsub: "Dye Sublimation Printer", epho: "Electrophotographic Printer", esta: "Electrostatic Printer", flex: "Flexography", fprn: "Film Writer", fscn: "Film Scanner", grav: "Gravure", ijet: "Ink Jet Printer", imgs: "Photo Image Setter", mpfr: "Motion Picture Film Recorder", mpfs: "Motion Picture Film Scanner", offs: "Offset Lithography", pjtv: "Projection Television", rpho: "Photographic Paper Printer", rscn: "Reflective Scanner", silk: "Silkscreen", twax: "Thermal Wax Printer", vidc: "Video Camera", vidm: "Video Monitor" }]]);
52474   var yt = class extends re2 {
52475     static canHandle(e3, t2, i3) {
52476       return 237 === e3.getUint8(t2 + 1) && "Photoshop" === e3.getString(t2 + 4, 9) && void 0 !== this.containsIptc8bim(e3, t2, i3);
52477     }
52478     static headerLength(e3, t2, i3) {
52479       let n3, s2 = this.containsIptc8bim(e3, t2, i3);
52480       if (void 0 !== s2) return n3 = e3.getUint8(t2 + s2 + 7), n3 % 2 != 0 && (n3 += 1), 0 === n3 && (n3 = 4), s2 + 8 + n3;
52481     }
52482     static containsIptc8bim(e3, t2, i3) {
52483       for (let n3 = 0; n3 < i3; n3++) if (this.isIptcSegmentHead(e3, t2 + n3)) return n3;
52484     }
52485     static isIptcSegmentHead(e3, t2) {
52486       return 56 === e3.getUint8(t2) && 943868237 === e3.getUint32(t2) && 1028 === e3.getUint16(t2 + 4);
52487     }
52488     parse() {
52489       let { raw: e3 } = this, t2 = this.chunk.byteLength - 1, i3 = false;
52490       for (let n3 = 0; n3 < t2; n3++) if (28 === this.chunk.getUint8(n3) && 2 === this.chunk.getUint8(n3 + 1)) {
52491         i3 = true;
52492         let t3 = this.chunk.getUint16(n3 + 3), s2 = this.chunk.getUint8(n3 + 2), r2 = this.chunk.getLatin1String(n3 + 5, t3);
52493         e3.set(s2, this.pluralizeValue(e3.get(s2), r2)), n3 += 4 + t3;
52494       } else if (i3) break;
52495       return this.translate(), this.output;
52496     }
52497     pluralizeValue(e3, t2) {
52498       return void 0 !== e3 ? e3 instanceof Array ? (e3.push(t2), e3) : [e3, t2] : t2;
52499     }
52500   };
52501   c(yt, "type", "iptc"), c(yt, "translateValues", false), c(yt, "reviveValues", false), T.set("iptc", yt), U(E, "iptc", [[0, "ApplicationRecordVersion"], [3, "ObjectTypeReference"], [4, "ObjectAttributeReference"], [5, "ObjectName"], [7, "EditStatus"], [8, "EditorialUpdate"], [10, "Urgency"], [12, "SubjectReference"], [15, "Category"], [20, "SupplementalCategories"], [22, "FixtureIdentifier"], [25, "Keywords"], [26, "ContentLocationCode"], [27, "ContentLocationName"], [30, "ReleaseDate"], [35, "ReleaseTime"], [37, "ExpirationDate"], [38, "ExpirationTime"], [40, "SpecialInstructions"], [42, "ActionAdvised"], [45, "ReferenceService"], [47, "ReferenceDate"], [50, "ReferenceNumber"], [55, "DateCreated"], [60, "TimeCreated"], [62, "DigitalCreationDate"], [63, "DigitalCreationTime"], [65, "OriginatingProgram"], [70, "ProgramVersion"], [75, "ObjectCycle"], [80, "Byline"], [85, "BylineTitle"], [90, "City"], [92, "Sublocation"], [95, "State"], [100, "CountryCode"], [101, "Country"], [103, "OriginalTransmissionReference"], [105, "Headline"], [110, "Credit"], [115, "Source"], [116, "CopyrightNotice"], [118, "Contact"], [120, "Caption"], [121, "LocalCaption"], [122, "Writer"], [125, "RasterizedCaption"], [130, "ImageType"], [131, "ImageOrientation"], [135, "LanguageIdentifier"], [150, "AudioType"], [151, "AudioSamplingRate"], [152, "AudioSamplingResolution"], [153, "AudioDuration"], [154, "AudioOutcue"], [184, "JobID"], [185, "MasterDocumentID"], [186, "ShortDocumentID"], [187, "UniqueDocumentID"], [188, "OwnerID"], [200, "ObjectPreviewFileFormat"], [201, "ObjectPreviewFileVersion"], [202, "ObjectPreviewData"], [221, "Prefs"], [225, "ClassifyState"], [228, "SimilarityIndex"], [230, "DocumentNotes"], [231, "DocumentHistory"], [232, "ExifCameraInfo"], [255, "CatalogSets"]]), U(B, "iptc", [[10, { 0: "0 (reserved)", 1: "1 (most urgent)", 2: "2", 3: "3", 4: "4", 5: "5 (normal urgency)", 6: "6", 7: "7", 8: "8 (least urgent)", 9: "9 (user-defined priority)" }], [75, { a: "Morning", b: "Both Morning and Evening", p: "Evening" }], [131, { L: "Landscape", P: "Portrait", S: "Square" }]]);
52502   var full_esm_default = tt;
52503
52504   // modules/services/plane_photo.js
52505   var dispatch5 = dispatch_default("viewerChanged");
52506   var _photo;
52507   var _wrapper;
52508   var imgZoom;
52509   var _widthOverflow;
52510   function zoomPan(d3_event) {
52511     let t2 = d3_event.transform;
52512     _photo.call(utilSetTransform, t2.x, t2.y, t2.k);
52513   }
52514   function zoomBeahvior() {
52515     const { width: wrapperWidth, height: wrapperHeight } = _wrapper.node().getBoundingClientRect();
52516     const { naturalHeight, naturalWidth } = _photo.node();
52517     const intrinsicRatio = naturalWidth / naturalHeight;
52518     _widthOverflow = wrapperHeight * intrinsicRatio - wrapperWidth;
52519     return zoom_default2().extent([[0, 0], [wrapperWidth, wrapperHeight]]).translateExtent([[0, 0], [wrapperWidth + _widthOverflow, wrapperHeight]]).scaleExtent([1, 15]).on("zoom", zoomPan);
52520   }
52521   function loadImage(selection2, path) {
52522     return new Promise((resolve) => {
52523       selection2.attr("src", path);
52524       selection2.on("load", () => {
52525         resolve(selection2);
52526       });
52527     });
52528   }
52529   var plane_photo_default = {
52530     init: async function(context, selection2) {
52531       this.event = utilRebind(this, dispatch5, "on");
52532       _wrapper = selection2.append("div").attr("class", "photo-frame plane-frame").classed("hide", true);
52533       _photo = _wrapper.append("img").attr("class", "plane-photo");
52534       context.ui().photoviewer.on("resize.plane", () => {
52535         imgZoom = zoomBeahvior();
52536         _wrapper.call(imgZoom);
52537       });
52538       await Promise.resolve();
52539       return this;
52540     },
52541     showPhotoFrame: function(context) {
52542       const isHidden = context.selectAll(".photo-frame.plane-frame.hide").size();
52543       if (isHidden) {
52544         context.selectAll(".photo-frame:not(.plane-frame)").classed("hide", true);
52545         context.selectAll(".photo-frame.plane-frame").classed("hide", false);
52546       }
52547       return this;
52548     },
52549     hidePhotoFrame: function(context) {
52550       context.select("photo-frame.plane-frame").classed("hide", false);
52551       return this;
52552     },
52553     selectPhoto: function(data) {
52554       dispatch5.call("viewerChanged");
52555       loadImage(_photo, "");
52556       loadImage(_photo, data.image_path).then(() => {
52557         imgZoom = zoomBeahvior();
52558         _wrapper.call(imgZoom);
52559         _wrapper.call(imgZoom.transform, identity2.translate(-_widthOverflow / 2, 0));
52560       });
52561       return this;
52562     },
52563     getYaw: function() {
52564       return 0;
52565     }
52566   };
52567
52568   // modules/svg/local_photos.js
52569   var _initialized2 = false;
52570   var _enabled2 = false;
52571   var minViewfieldZoom = 16;
52572   function svgLocalPhotos(projection2, context, dispatch14) {
52573     const detected = utilDetect();
52574     let layer = select_default2(null);
52575     let _fileList;
52576     let _photos = [];
52577     let _idAutoinc = 0;
52578     let _photoFrame;
52579     function init2() {
52580       if (_initialized2) return;
52581       _enabled2 = true;
52582       function over(d3_event) {
52583         d3_event.stopPropagation();
52584         d3_event.preventDefault();
52585         d3_event.dataTransfer.dropEffect = "copy";
52586       }
52587       context.container().attr("dropzone", "copy").on("drop.svgLocalPhotos", function(d3_event) {
52588         d3_event.stopPropagation();
52589         d3_event.preventDefault();
52590         if (!detected.filedrop) return;
52591         drawPhotos.fileList(d3_event.dataTransfer.files, (loaded) => {
52592           if (loaded.length > 0) {
52593             drawPhotos.fitZoom(false);
52594           }
52595         });
52596       }).on("dragenter.svgLocalPhotos", over).on("dragexit.svgLocalPhotos", over).on("dragover.svgLocalPhotos", over);
52597       _initialized2 = true;
52598     }
52599     function ensureViewerLoaded(context2) {
52600       if (_photoFrame) {
52601         return Promise.resolve(_photoFrame);
52602       }
52603       const viewer = context2.container().select(".photoviewer").selectAll(".local-photos-wrapper").data([0]);
52604       const viewerEnter = viewer.enter().append("div").attr("class", "photo-wrapper local-photos-wrapper").classed("hide", true);
52605       viewerEnter.append("div").attr("class", "photo-attribution photo-attribution-dual fillD");
52606       return plane_photo_default.init(context2, viewerEnter).then((planePhotoFrame) => {
52607         _photoFrame = planePhotoFrame;
52608       });
52609     }
52610     function click(d3_event, image, zoomTo) {
52611       ensureViewerLoaded(context).then(() => {
52612         const viewer = context.container().select(".photoviewer").datum(image).classed("hide", false);
52613         const viewerWrap = viewer.select(".local-photos-wrapper").classed("hide", false);
52614         const attribution = viewerWrap.selectAll(".photo-attribution").text("");
52615         if (image.date) {
52616           attribution.append("span").text(image.date.toLocaleString());
52617         }
52618         if (image.name) {
52619           attribution.append("span").classed("filename", true).text(image.name);
52620         }
52621         _photoFrame.selectPhoto({ image_path: "" });
52622         image.getSrc().then((src) => {
52623           _photoFrame.selectPhoto({ image_path: src }).showPhotoFrame(viewerWrap);
52624           setStyles();
52625         });
52626       });
52627       if (zoomTo) {
52628         context.map().centerEase(image.loc);
52629       }
52630     }
52631     function transform2(d2) {
52632       var svgpoint = projection2(d2.loc);
52633       return "translate(" + svgpoint[0] + "," + svgpoint[1] + ")";
52634     }
52635     function setStyles(hovered) {
52636       const viewer = context.container().select(".photoviewer");
52637       const selected = viewer.empty() ? void 0 : viewer.datum();
52638       context.container().selectAll(".layer-local-photos .viewfield-group").classed("hovered", (d2) => d2.id === (hovered == null ? void 0 : hovered.id)).classed("highlighted", (d2) => d2.id === (hovered == null ? void 0 : hovered.id) || d2.id === (selected == null ? void 0 : selected.id)).classed("currentView", (d2) => d2.id === (selected == null ? void 0 : selected.id));
52639     }
52640     function display_markers(imageList) {
52641       imageList = imageList.filter((image) => isArray_default(image.loc) && isNumber_default(image.loc[0]) && isNumber_default(image.loc[1]));
52642       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(imageList, function(d2) {
52643         return d2.id;
52644       });
52645       groups.exit().remove();
52646       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", (d3_event, d2) => setStyles(d2)).on("mouseleave", () => setStyles(null)).on("click", click);
52647       groupsEnter.append("g").attr("class", "viewfield-scale");
52648       const markers = groups.merge(groupsEnter).attr("transform", transform2).select(".viewfield-scale");
52649       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
52650       const showViewfields = context.map().zoom() >= minViewfieldZoom;
52651       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
52652       viewfields.exit().remove();
52653       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", function() {
52654         var _a3;
52655         const d2 = this.parentNode.__data__;
52656         return "rotate(".concat(Math.round((_a3 = d2.direction) != null ? _a3 : 0), ",0,0),scale(1.5,1.5),translate(-8,-13)");
52657       }).attr("d", "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z").style("visibility", function() {
52658         const d2 = this.parentNode.__data__;
52659         return isNumber_default(d2.direction) ? "visible" : "hidden";
52660       });
52661     }
52662     function drawPhotos(selection2) {
52663       layer = selection2.selectAll(".layer-local-photos").data(_photos ? [0] : []);
52664       layer.exit().remove();
52665       const layerEnter = layer.enter().append("g").attr("class", "layer-local-photos");
52666       layerEnter.append("g").attr("class", "markers");
52667       layer = layerEnter.merge(layer);
52668       if (_photos) {
52669         display_markers(_photos);
52670       }
52671     }
52672     function readFileAsDataURL(file) {
52673       return new Promise((resolve, reject) => {
52674         const reader = new FileReader();
52675         reader.onload = () => resolve(reader.result);
52676         reader.onerror = (error) => reject(error);
52677         reader.readAsDataURL(file);
52678       });
52679     }
52680     async function readmultifiles(files, callback) {
52681       const loaded = [];
52682       for (const file of files) {
52683         try {
52684           const exifData = await full_esm_default.parse(file);
52685           const photo = {
52686             id: _idAutoinc++,
52687             name: file.name,
52688             getSrc: () => readFileAsDataURL(file),
52689             file,
52690             loc: [exifData.longitude, exifData.latitude],
52691             direction: exifData.GPSImgDirection,
52692             date: exifData.CreateDate || exifData.DateTimeOriginal || exifData.ModifyDate
52693           };
52694           loaded.push(photo);
52695           const sameName = _photos.filter((i3) => i3.name === photo.name);
52696           if (sameName.length === 0) {
52697             _photos.push(photo);
52698           } else {
52699             const thisContent = await photo.getSrc();
52700             const sameNameContent = await Promise.allSettled(sameName.map((i3) => i3.getSrc()));
52701             if (!sameNameContent.some((i3) => i3.value === thisContent)) {
52702               _photos.push(photo);
52703             }
52704           }
52705         } catch {
52706         }
52707       }
52708       if (typeof callback === "function") callback(loaded);
52709       dispatch14.call("change");
52710     }
52711     drawPhotos.setFiles = function(fileList, callback) {
52712       readmultifiles(Array.from(fileList), callback);
52713       return this;
52714     };
52715     drawPhotos.fileList = function(fileList, callback) {
52716       if (!arguments.length) return _fileList;
52717       _fileList = fileList;
52718       if (!fileList || !fileList.length) return this;
52719       drawPhotos.setFiles(_fileList, callback);
52720       return this;
52721     };
52722     drawPhotos.getPhotos = function() {
52723       return _photos;
52724     };
52725     drawPhotos.removePhoto = function(id2) {
52726       _photos = _photos.filter((i3) => i3.id !== id2);
52727       dispatch14.call("change");
52728       return _photos;
52729     };
52730     drawPhotos.openPhoto = click;
52731     drawPhotos.fitZoom = function(force) {
52732       const coords = _photos.map((image) => image.loc).filter((l2) => isArray_default(l2) && isNumber_default(l2[0]) && isNumber_default(l2[1]));
52733       if (coords.length === 0) return;
52734       const extent = coords.map((l2) => geoExtent(l2, l2)).reduce((a2, b2) => a2.extend(b2));
52735       const map2 = context.map();
52736       var viewport = map2.trimmedExtent().polygon();
52737       if (force !== false || !geoPolygonIntersectsPolygon(viewport, coords, true)) {
52738         map2.centerZoom(extent.center(), Math.min(18, map2.trimmedExtentZoom(extent)));
52739       }
52740     };
52741     function showLayer() {
52742       layer.style("display", "block");
52743       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
52744         dispatch14.call("change");
52745       });
52746     }
52747     function hideLayer() {
52748       layer.transition().duration(250).style("opacity", 0).on("end", () => {
52749         layer.selectAll(".viewfield-group").remove();
52750         layer.style("display", "none");
52751       });
52752     }
52753     drawPhotos.enabled = function(val) {
52754       if (!arguments.length) return _enabled2;
52755       _enabled2 = val;
52756       if (_enabled2) {
52757         showLayer();
52758       } else {
52759         hideLayer();
52760       }
52761       dispatch14.call("change");
52762       return this;
52763     };
52764     drawPhotos.hasData = function() {
52765       return isArray_default(_photos) && _photos.length > 0;
52766     };
52767     init2();
52768     return drawPhotos;
52769   }
52770
52771   // modules/svg/osmose.js
52772   var _layerEnabled2 = false;
52773   var _qaService2;
52774   function svgOsmose(projection2, context, dispatch14) {
52775     const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
52776     const minZoom5 = 12;
52777     let touchLayer = select_default2(null);
52778     let drawLayer = select_default2(null);
52779     let layerVisible = false;
52780     function markerPath(selection2, klass) {
52781       selection2.attr("class", klass).attr("transform", "translate(-10, -28)").attr("points", "16,3 4,3 1,6 1,17 4,20 7,20 10,27 13,20 16,20 19,17.033 19,6");
52782     }
52783     function getService() {
52784       if (services.osmose && !_qaService2) {
52785         _qaService2 = services.osmose;
52786         _qaService2.on("loaded", throttledRedraw);
52787       } else if (!services.osmose && _qaService2) {
52788         _qaService2 = null;
52789       }
52790       return _qaService2;
52791     }
52792     function editOn() {
52793       if (!layerVisible) {
52794         layerVisible = true;
52795         drawLayer.style("display", "block");
52796       }
52797     }
52798     function editOff() {
52799       if (layerVisible) {
52800         layerVisible = false;
52801         drawLayer.style("display", "none");
52802         drawLayer.selectAll(".qaItem.osmose").remove();
52803         touchLayer.selectAll(".qaItem.osmose").remove();
52804       }
52805     }
52806     function layerOn() {
52807       editOn();
52808       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch14.call("change"));
52809     }
52810     function layerOff() {
52811       throttledRedraw.cancel();
52812       drawLayer.interrupt();
52813       touchLayer.selectAll(".qaItem.osmose").remove();
52814       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
52815         editOff();
52816         dispatch14.call("change");
52817       });
52818     }
52819     function updateMarkers() {
52820       if (!layerVisible || !_layerEnabled2) return;
52821       const service = getService();
52822       const selectedID = context.selectedErrorID();
52823       const data = service ? service.getItems(projection2) : [];
52824       const getTransform = svgPointTransform(projection2);
52825       const markers = drawLayer.selectAll(".qaItem.osmose").data(data, (d2) => d2.id);
52826       markers.exit().remove();
52827       const markersEnter = markers.enter().append("g").attr("class", (d2) => "qaItem ".concat(d2.service, " itemId-").concat(d2.id, " itemType-").concat(d2.itemType));
52828       markersEnter.append("polygon").call(markerPath, "shadow");
52829       markersEnter.append("ellipse").attr("cx", 0).attr("cy", 0).attr("rx", 4.5).attr("ry", 2).attr("class", "stroke");
52830       markersEnter.append("polygon").attr("fill", (d2) => service.getColor(d2.item)).call(markerPath, "qaItem-fill");
52831       markersEnter.append("use").attr("class", "icon-annotation").attr("transform", "translate(-6, -22)").attr("width", "12px").attr("height", "12px").attr("xlink:href", (d2) => d2.icon ? "#" + d2.icon : "");
52832       markers.merge(markersEnter).sort(sortY).classed("selected", (d2) => d2.id === selectedID).attr("transform", getTransform);
52833       if (touchLayer.empty()) return;
52834       const fillClass = context.getDebug("target") ? "pink" : "nocolor";
52835       const targets = touchLayer.selectAll(".qaItem.osmose").data(data, (d2) => d2.id);
52836       targets.exit().remove();
52837       targets.enter().append("rect").attr("width", "20px").attr("height", "30px").attr("x", "-10px").attr("y", "-28px").merge(targets).sort(sortY).attr("class", (d2) => "qaItem ".concat(d2.service, " target ").concat(fillClass, " itemId-").concat(d2.id)).attr("transform", getTransform);
52838       function sortY(a2, b2) {
52839         return a2.id === selectedID ? 1 : b2.id === selectedID ? -1 : b2.loc[1] - a2.loc[1];
52840       }
52841     }
52842     function drawOsmose(selection2) {
52843       const service = getService();
52844       const surface = context.surface();
52845       if (surface && !surface.empty()) {
52846         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
52847       }
52848       drawLayer = selection2.selectAll(".layer-osmose").data(service ? [0] : []);
52849       drawLayer.exit().remove();
52850       drawLayer = drawLayer.enter().append("g").attr("class", "layer-osmose").style("display", _layerEnabled2 ? "block" : "none").merge(drawLayer);
52851       if (_layerEnabled2) {
52852         if (service && ~~context.map().zoom() >= minZoom5) {
52853           editOn();
52854           service.loadIssues(projection2);
52855           updateMarkers();
52856         } else {
52857           editOff();
52858         }
52859       }
52860     }
52861     drawOsmose.enabled = function(val) {
52862       if (!arguments.length) return _layerEnabled2;
52863       _layerEnabled2 = val;
52864       if (_layerEnabled2) {
52865         getService().loadStrings().then(layerOn).catch((err) => {
52866           console.log(err);
52867         });
52868       } else {
52869         layerOff();
52870         if (context.selectedErrorID()) {
52871           context.enter(modeBrowse(context));
52872         }
52873       }
52874       dispatch14.call("change");
52875       return this;
52876     };
52877     drawOsmose.supported = () => !!getService();
52878     return drawOsmose;
52879   }
52880
52881   // modules/svg/streetside.js
52882   function svgStreetside(projection2, context, dispatch14) {
52883     var throttledRedraw = throttle_default(function() {
52884       dispatch14.call("change");
52885     }, 1e3);
52886     var minZoom5 = 14;
52887     var minMarkerZoom = 16;
52888     var minViewfieldZoom2 = 18;
52889     var layer = select_default2(null);
52890     var _viewerYaw = 0;
52891     var _selectedSequence = null;
52892     var _streetside;
52893     function init2() {
52894       if (svgStreetside.initialized) return;
52895       svgStreetside.enabled = false;
52896       svgStreetside.initialized = true;
52897     }
52898     function getService() {
52899       if (services.streetside && !_streetside) {
52900         _streetside = services.streetside;
52901         _streetside.event.on("viewerChanged.svgStreetside", viewerChanged).on("loadedImages.svgStreetside", throttledRedraw);
52902       } else if (!services.streetside && _streetside) {
52903         _streetside = null;
52904       }
52905       return _streetside;
52906     }
52907     function showLayer() {
52908       var service = getService();
52909       if (!service) return;
52910       editOn();
52911       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
52912         dispatch14.call("change");
52913       });
52914     }
52915     function hideLayer() {
52916       throttledRedraw.cancel();
52917       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
52918     }
52919     function editOn() {
52920       layer.style("display", "block");
52921     }
52922     function editOff() {
52923       layer.selectAll(".viewfield-group").remove();
52924       layer.style("display", "none");
52925     }
52926     function click(d3_event, d2) {
52927       var service = getService();
52928       if (!service) return;
52929       if (d2.sequenceKey !== _selectedSequence) {
52930         _viewerYaw = 0;
52931       }
52932       _selectedSequence = d2.sequenceKey;
52933       service.ensureViewerLoaded(context).then(function() {
52934         service.selectImage(context, d2.key).yaw(_viewerYaw).showViewer(context);
52935       });
52936       context.map().centerEase(d2.loc);
52937     }
52938     function mouseover(d3_event, d2) {
52939       var service = getService();
52940       if (service) service.setStyles(context, d2);
52941     }
52942     function mouseout() {
52943       var service = getService();
52944       if (service) service.setStyles(context, null);
52945     }
52946     function transform2(d2) {
52947       var t2 = svgPointTransform(projection2)(d2);
52948       var rot = d2.ca + _viewerYaw;
52949       if (rot) {
52950         t2 += " rotate(" + Math.floor(rot) + ",0,0)";
52951       }
52952       return t2;
52953     }
52954     function viewerChanged() {
52955       var service = getService();
52956       if (!service) return;
52957       var viewer = service.viewer();
52958       if (!viewer) return;
52959       _viewerYaw = viewer.getYaw();
52960       if (context.map().isTransformed()) return;
52961       layer.selectAll(".viewfield-group.currentView").attr("transform", transform2);
52962     }
52963     function filterBubbles(bubbles) {
52964       var fromDate = context.photos().fromDate();
52965       var toDate = context.photos().toDate();
52966       var usernames = context.photos().usernames();
52967       if (fromDate) {
52968         var fromTimestamp = new Date(fromDate).getTime();
52969         bubbles = bubbles.filter(function(bubble) {
52970           return new Date(bubble.captured_at).getTime() >= fromTimestamp;
52971         });
52972       }
52973       if (toDate) {
52974         var toTimestamp = new Date(toDate).getTime();
52975         bubbles = bubbles.filter(function(bubble) {
52976           return new Date(bubble.captured_at).getTime() <= toTimestamp;
52977         });
52978       }
52979       if (usernames) {
52980         bubbles = bubbles.filter(function(bubble) {
52981           return usernames.indexOf(bubble.captured_by) !== -1;
52982         });
52983       }
52984       return bubbles;
52985     }
52986     function filterSequences(sequences) {
52987       var fromDate = context.photos().fromDate();
52988       var toDate = context.photos().toDate();
52989       var usernames = context.photos().usernames();
52990       if (fromDate) {
52991         var fromTimestamp = new Date(fromDate).getTime();
52992         sequences = sequences.filter(function(sequences2) {
52993           return new Date(sequences2.properties.captured_at).getTime() >= fromTimestamp;
52994         });
52995       }
52996       if (toDate) {
52997         var toTimestamp = new Date(toDate).getTime();
52998         sequences = sequences.filter(function(sequences2) {
52999           return new Date(sequences2.properties.captured_at).getTime() <= toTimestamp;
53000         });
53001       }
53002       if (usernames) {
53003         sequences = sequences.filter(function(sequences2) {
53004           return usernames.indexOf(sequences2.properties.captured_by) !== -1;
53005         });
53006       }
53007       return sequences;
53008     }
53009     function update() {
53010       var viewer = context.container().select(".photoviewer");
53011       var selected = viewer.empty() ? void 0 : viewer.datum();
53012       var z2 = ~~context.map().zoom();
53013       var showMarkers = z2 >= minMarkerZoom;
53014       var showViewfields = z2 >= minViewfieldZoom2;
53015       var service = getService();
53016       var sequences = [];
53017       var bubbles = [];
53018       if (context.photos().showsPanoramic()) {
53019         sequences = service ? service.sequences(projection2) : [];
53020         bubbles = service && showMarkers ? service.bubbles(projection2) : [];
53021         sequences = filterSequences(sequences);
53022         bubbles = filterBubbles(bubbles);
53023       }
53024       var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
53025         return d2.properties.key;
53026       });
53027       traces.exit().remove();
53028       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
53029       var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(bubbles, function(d2) {
53030         return d2.key + (d2.sequenceKey ? "v1" : "v0");
53031       });
53032       groups.exit().remove();
53033       var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
53034       groupsEnter.append("g").attr("class", "viewfield-scale");
53035       var markers = groups.merge(groupsEnter).sort(function(a2, b2) {
53036         return a2 === selected ? 1 : b2 === selected ? -1 : b2.loc[1] - a2.loc[1];
53037       }).attr("transform", transform2).select(".viewfield-scale");
53038       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
53039       var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
53040       viewfields.exit().remove();
53041       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
53042       function viewfieldPath() {
53043         var d2 = this.parentNode.__data__;
53044         if (d2.pano) {
53045           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
53046         } else {
53047           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
53048         }
53049       }
53050     }
53051     function drawImages(selection2) {
53052       var enabled = svgStreetside.enabled;
53053       var service = getService();
53054       layer = selection2.selectAll(".layer-streetside-images").data(service ? [0] : []);
53055       layer.exit().remove();
53056       var layerEnter = layer.enter().append("g").attr("class", "layer-streetside-images").style("display", enabled ? "block" : "none");
53057       layerEnter.append("g").attr("class", "sequences");
53058       layerEnter.append("g").attr("class", "markers");
53059       layer = layerEnter.merge(layer);
53060       if (enabled) {
53061         if (service && ~~context.map().zoom() >= minZoom5) {
53062           editOn();
53063           update();
53064           service.loadBubbles(projection2);
53065         } else {
53066           editOff();
53067         }
53068       }
53069     }
53070     drawImages.enabled = function(_2) {
53071       if (!arguments.length) return svgStreetside.enabled;
53072       svgStreetside.enabled = _2;
53073       if (svgStreetside.enabled) {
53074         showLayer();
53075         context.photos().on("change.streetside", update);
53076       } else {
53077         hideLayer();
53078         context.photos().on("change.streetside", null);
53079       }
53080       dispatch14.call("change");
53081       return this;
53082     };
53083     drawImages.supported = function() {
53084       return !!getService();
53085     };
53086     drawImages.rendered = function(zoom) {
53087       return zoom >= minZoom5;
53088     };
53089     init2();
53090     return drawImages;
53091   }
53092
53093   // modules/svg/vegbilder.js
53094   function svgVegbilder(projection2, context, dispatch14) {
53095     const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
53096     const minZoom5 = 14;
53097     const minMarkerZoom = 16;
53098     const minViewfieldZoom2 = 18;
53099     let layer = select_default2(null);
53100     let _viewerYaw = 0;
53101     let _vegbilder;
53102     function init2() {
53103       if (svgVegbilder.initialized) return;
53104       svgVegbilder.enabled = false;
53105       svgVegbilder.initialized = true;
53106     }
53107     function getService() {
53108       if (services.vegbilder && !_vegbilder) {
53109         _vegbilder = services.vegbilder;
53110         _vegbilder.event.on("viewerChanged.svgVegbilder", viewerChanged).on("loadedImages.svgVegbilder", throttledRedraw);
53111       } else if (!services.vegbilder && _vegbilder) {
53112         _vegbilder = null;
53113       }
53114       return _vegbilder;
53115     }
53116     function showLayer() {
53117       const service = getService();
53118       if (!service) return;
53119       editOn();
53120       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", () => dispatch14.call("change"));
53121     }
53122     function hideLayer() {
53123       throttledRedraw.cancel();
53124       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
53125     }
53126     function editOn() {
53127       layer.style("display", "block");
53128     }
53129     function editOff() {
53130       layer.selectAll(".viewfield-group").remove();
53131       layer.style("display", "none");
53132     }
53133     function click(d3_event, d2) {
53134       const service = getService();
53135       if (!service) return;
53136       service.ensureViewerLoaded(context).then(() => {
53137         service.selectImage(context, d2.key).showViewer(context);
53138       });
53139       context.map().centerEase(d2.loc);
53140     }
53141     function mouseover(d3_event, d2) {
53142       const service = getService();
53143       if (service) service.setStyles(context, d2);
53144     }
53145     function mouseout() {
53146       const service = getService();
53147       if (service) service.setStyles(context, null);
53148     }
53149     function transform2(d2, selected) {
53150       let t2 = svgPointTransform(projection2)(d2);
53151       let rot = d2.ca;
53152       if (d2 === selected) {
53153         rot += _viewerYaw;
53154       }
53155       if (rot) {
53156         t2 += " rotate(" + Math.floor(rot) + ",0,0)";
53157       }
53158       return t2;
53159     }
53160     function viewerChanged() {
53161       const service = getService();
53162       if (!service) return;
53163       const frame2 = service.photoFrame();
53164       _viewerYaw = frame2.getYaw();
53165       if (context.map().isTransformed()) return;
53166       layer.selectAll(".viewfield-group.currentView").attr("transform", (d2) => transform2(d2, d2));
53167     }
53168     function filterImages(images) {
53169       const photoContext = context.photos();
53170       const fromDateString = photoContext.fromDate();
53171       const toDateString = photoContext.toDate();
53172       const showsFlat = photoContext.showsFlat();
53173       const showsPano = photoContext.showsPanoramic();
53174       if (fromDateString) {
53175         const fromDate = new Date(fromDateString);
53176         images = images.filter((image) => image.captured_at.getTime() >= fromDate.getTime());
53177       }
53178       if (toDateString) {
53179         const toDate = new Date(toDateString);
53180         images = images.filter((image) => image.captured_at.getTime() <= toDate.getTime());
53181       }
53182       if (!showsPano) {
53183         images = images.filter((image) => !image.is_sphere);
53184       }
53185       if (!showsFlat) {
53186         images = images.filter((image) => image.is_sphere);
53187       }
53188       return images;
53189     }
53190     function filterSequences(sequences) {
53191       const photoContext = context.photos();
53192       const fromDateString = photoContext.fromDate();
53193       const toDateString = photoContext.toDate();
53194       const showsFlat = photoContext.showsFlat();
53195       const showsPano = photoContext.showsPanoramic();
53196       if (fromDateString) {
53197         const fromDate = new Date(fromDateString);
53198         sequences = sequences.filter(({ images }) => images[0].captured_at.getTime() >= fromDate.getTime());
53199       }
53200       if (toDateString) {
53201         const toDate = new Date(toDateString);
53202         sequences = sequences.filter(({ images }) => images[images.length - 1].captured_at.getTime() <= toDate.getTime());
53203       }
53204       if (!showsPano) {
53205         sequences = sequences.filter(({ images }) => !images[0].is_sphere);
53206       }
53207       if (!showsFlat) {
53208         sequences = sequences.filter(({ images }) => images[0].is_sphere);
53209       }
53210       return sequences;
53211     }
53212     function update() {
53213       const viewer = context.container().select(".photoviewer");
53214       const selected = viewer.empty() ? void 0 : viewer.datum();
53215       const z2 = ~~context.map().zoom();
53216       const showMarkers = z2 >= minMarkerZoom;
53217       const showViewfields = z2 >= minViewfieldZoom2;
53218       const service = getService();
53219       let sequences = [];
53220       let images = [];
53221       if (service) {
53222         service.loadImages(context);
53223         sequences = service.sequences(projection2);
53224         images = showMarkers ? service.images(projection2) : [];
53225         images = filterImages(images);
53226         sequences = filterSequences(sequences);
53227       }
53228       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, (d2) => d2.key);
53229       traces.exit().remove();
53230       traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
53231       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, (d2) => d2.key);
53232       groups.exit().remove();
53233       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
53234       groupsEnter.append("g").attr("class", "viewfield-scale");
53235       const markers = groups.merge(groupsEnter).sort((a2, b2) => {
53236         return a2 === selected ? 1 : b2 === selected ? -1 : b2.loc[1] - a2.loc[1];
53237       }).attr("transform", (d2) => transform2(d2, selected)).select(".viewfield-scale");
53238       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
53239       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
53240       viewfields.exit().remove();
53241       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
53242       function viewfieldPath() {
53243         const d2 = this.parentNode.__data__;
53244         if (d2.is_sphere) {
53245           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
53246         } else {
53247           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
53248         }
53249       }
53250     }
53251     function drawImages(selection2) {
53252       const enabled = svgVegbilder.enabled;
53253       const service = getService();
53254       layer = selection2.selectAll(".layer-vegbilder").data(service ? [0] : []);
53255       layer.exit().remove();
53256       const layerEnter = layer.enter().append("g").attr("class", "layer-vegbilder").style("display", enabled ? "block" : "none");
53257       layerEnter.append("g").attr("class", "sequences");
53258       layerEnter.append("g").attr("class", "markers");
53259       layer = layerEnter.merge(layer);
53260       if (enabled) {
53261         if (service && ~~context.map().zoom() >= minZoom5) {
53262           editOn();
53263           update();
53264           service.loadImages(context);
53265         } else {
53266           editOff();
53267         }
53268       }
53269     }
53270     drawImages.enabled = function(_2) {
53271       if (!arguments.length) return svgVegbilder.enabled;
53272       svgVegbilder.enabled = _2;
53273       if (svgVegbilder.enabled) {
53274         showLayer();
53275         context.photos().on("change.vegbilder", update);
53276       } else {
53277         hideLayer();
53278         context.photos().on("change.vegbilder", null);
53279       }
53280       dispatch14.call("change");
53281       return this;
53282     };
53283     drawImages.supported = function() {
53284       return !!getService();
53285     };
53286     drawImages.rendered = function(zoom) {
53287       return zoom >= minZoom5;
53288     };
53289     drawImages.validHere = function(extent, zoom) {
53290       return zoom >= minZoom5 - 2 && getService().validHere(extent);
53291     };
53292     init2();
53293     return drawImages;
53294   }
53295
53296   // modules/svg/mapillary_images.js
53297   function svgMapillaryImages(projection2, context, dispatch14) {
53298     const throttledRedraw = throttle_default(function() {
53299       dispatch14.call("change");
53300     }, 1e3);
53301     const minZoom5 = 12;
53302     const minMarkerZoom = 16;
53303     const minViewfieldZoom2 = 18;
53304     let layer = select_default2(null);
53305     let _mapillary;
53306     function init2() {
53307       if (svgMapillaryImages.initialized) return;
53308       svgMapillaryImages.enabled = false;
53309       svgMapillaryImages.initialized = true;
53310     }
53311     function getService() {
53312       if (services.mapillary && !_mapillary) {
53313         _mapillary = services.mapillary;
53314         _mapillary.event.on("loadedImages", throttledRedraw);
53315       } else if (!services.mapillary && _mapillary) {
53316         _mapillary = null;
53317       }
53318       return _mapillary;
53319     }
53320     function showLayer() {
53321       const service = getService();
53322       if (!service) return;
53323       editOn();
53324       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
53325         dispatch14.call("change");
53326       });
53327     }
53328     function hideLayer() {
53329       throttledRedraw.cancel();
53330       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
53331     }
53332     function editOn() {
53333       layer.style("display", "block");
53334     }
53335     function editOff() {
53336       layer.selectAll(".viewfield-group").remove();
53337       layer.style("display", "none");
53338     }
53339     function click(d3_event, image) {
53340       const service = getService();
53341       if (!service) return;
53342       service.ensureViewerLoaded(context).then(function() {
53343         service.selectImage(context, image.id).showViewer(context);
53344       });
53345       context.map().centerEase(image.loc);
53346     }
53347     function mouseover(d3_event, image) {
53348       const service = getService();
53349       if (service) service.setStyles(context, image);
53350     }
53351     function mouseout() {
53352       const service = getService();
53353       if (service) service.setStyles(context, null);
53354     }
53355     function transform2(d2) {
53356       let t2 = svgPointTransform(projection2)(d2);
53357       if (d2.ca) {
53358         t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
53359       }
53360       return t2;
53361     }
53362     function filterImages(images) {
53363       const showsPano = context.photos().showsPanoramic();
53364       const showsFlat = context.photos().showsFlat();
53365       const fromDate = context.photos().fromDate();
53366       const toDate = context.photos().toDate();
53367       if (!showsPano || !showsFlat) {
53368         images = images.filter(function(image) {
53369           if (image.is_pano) return showsPano;
53370           return showsFlat;
53371         });
53372       }
53373       if (fromDate) {
53374         images = images.filter(function(image) {
53375           return new Date(image.captured_at).getTime() >= new Date(fromDate).getTime();
53376         });
53377       }
53378       if (toDate) {
53379         images = images.filter(function(image) {
53380           return new Date(image.captured_at).getTime() <= new Date(toDate).getTime();
53381         });
53382       }
53383       return images;
53384     }
53385     function filterSequences(sequences) {
53386       const showsPano = context.photos().showsPanoramic();
53387       const showsFlat = context.photos().showsFlat();
53388       const fromDate = context.photos().fromDate();
53389       const toDate = context.photos().toDate();
53390       if (!showsPano || !showsFlat) {
53391         sequences = sequences.filter(function(sequence) {
53392           if (sequence.properties.hasOwnProperty("is_pano")) {
53393             if (sequence.properties.is_pano) return showsPano;
53394             return showsFlat;
53395           }
53396           return false;
53397         });
53398       }
53399       if (fromDate) {
53400         sequences = sequences.filter(function(sequence) {
53401           return new Date(sequence.properties.captured_at).getTime() >= new Date(fromDate).getTime().toString();
53402         });
53403       }
53404       if (toDate) {
53405         sequences = sequences.filter(function(sequence) {
53406           return new Date(sequence.properties.captured_at).getTime() <= new Date(toDate).getTime().toString();
53407         });
53408       }
53409       return sequences;
53410     }
53411     function update() {
53412       const z2 = ~~context.map().zoom();
53413       const showMarkers = z2 >= minMarkerZoom;
53414       const showViewfields = z2 >= minViewfieldZoom2;
53415       const service = getService();
53416       let sequences = service ? service.sequences(projection2) : [];
53417       let images = service && showMarkers ? service.images(projection2) : [];
53418       images = filterImages(images);
53419       sequences = filterSequences(sequences, service);
53420       service.filterViewer(context);
53421       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
53422         return d2.properties.id;
53423       });
53424       traces.exit().remove();
53425       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
53426       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
53427         return d2.id;
53428       });
53429       groups.exit().remove();
53430       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
53431       groupsEnter.append("g").attr("class", "viewfield-scale");
53432       const markers = groups.merge(groupsEnter).sort(function(a2, b2) {
53433         return b2.loc[1] - a2.loc[1];
53434       }).attr("transform", transform2).select(".viewfield-scale");
53435       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
53436       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
53437       viewfields.exit().remove();
53438       viewfields.enter().insert("path", "circle").attr("class", "viewfield").classed("pano", function() {
53439         return this.parentNode.__data__.is_pano;
53440       }).attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
53441       function viewfieldPath() {
53442         if (this.parentNode.__data__.is_pano) {
53443           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
53444         } else {
53445           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
53446         }
53447       }
53448     }
53449     function drawImages(selection2) {
53450       const enabled = svgMapillaryImages.enabled;
53451       const service = getService();
53452       layer = selection2.selectAll(".layer-mapillary").data(service ? [0] : []);
53453       layer.exit().remove();
53454       const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary").style("display", enabled ? "block" : "none");
53455       layerEnter.append("g").attr("class", "sequences");
53456       layerEnter.append("g").attr("class", "markers");
53457       layer = layerEnter.merge(layer);
53458       if (enabled) {
53459         if (service && ~~context.map().zoom() >= minZoom5) {
53460           editOn();
53461           update();
53462           service.loadImages(projection2);
53463         } else {
53464           editOff();
53465         }
53466       }
53467     }
53468     drawImages.enabled = function(_2) {
53469       if (!arguments.length) return svgMapillaryImages.enabled;
53470       svgMapillaryImages.enabled = _2;
53471       if (svgMapillaryImages.enabled) {
53472         showLayer();
53473         context.photos().on("change.mapillary_images", update);
53474       } else {
53475         hideLayer();
53476         context.photos().on("change.mapillary_images", null);
53477       }
53478       dispatch14.call("change");
53479       return this;
53480     };
53481     drawImages.supported = function() {
53482       return !!getService();
53483     };
53484     drawImages.rendered = function(zoom) {
53485       return zoom >= minZoom5;
53486     };
53487     init2();
53488     return drawImages;
53489   }
53490
53491   // modules/svg/mapillary_position.js
53492   function svgMapillaryPosition(projection2, context) {
53493     const throttledRedraw = throttle_default(function() {
53494       update();
53495     }, 1e3);
53496     const minZoom5 = 12;
53497     const minViewfieldZoom2 = 18;
53498     let layer = select_default2(null);
53499     let _mapillary;
53500     let viewerCompassAngle;
53501     function init2() {
53502       if (svgMapillaryPosition.initialized) return;
53503       svgMapillaryPosition.initialized = true;
53504     }
53505     function getService() {
53506       if (services.mapillary && !_mapillary) {
53507         _mapillary = services.mapillary;
53508         _mapillary.event.on("imageChanged", throttledRedraw);
53509         _mapillary.event.on("bearingChanged", function(e3) {
53510           viewerCompassAngle = e3.bearing;
53511           if (context.map().isTransformed()) return;
53512           layer.selectAll(".viewfield-group.currentView").filter(function(d2) {
53513             return d2.is_pano;
53514           }).attr("transform", transform2);
53515         });
53516       } else if (!services.mapillary && _mapillary) {
53517         _mapillary = null;
53518       }
53519       return _mapillary;
53520     }
53521     function editOn() {
53522       layer.style("display", "block");
53523     }
53524     function editOff() {
53525       layer.selectAll(".viewfield-group").remove();
53526       layer.style("display", "none");
53527     }
53528     function transform2(d2) {
53529       let t2 = svgPointTransform(projection2)(d2);
53530       if (d2.is_pano && viewerCompassAngle !== null && isFinite(viewerCompassAngle)) {
53531         t2 += " rotate(" + Math.floor(viewerCompassAngle) + ",0,0)";
53532       } else if (d2.ca) {
53533         t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
53534       }
53535       return t2;
53536     }
53537     function update() {
53538       const z2 = ~~context.map().zoom();
53539       const showViewfields = z2 >= minViewfieldZoom2;
53540       const service = getService();
53541       const image = service && service.getActiveImage();
53542       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(image ? [image] : [], function(d2) {
53543         return d2.id;
53544       });
53545       groups.exit().remove();
53546       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group currentView highlighted");
53547       groupsEnter.append("g").attr("class", "viewfield-scale");
53548       const markers = groups.merge(groupsEnter).attr("transform", transform2).select(".viewfield-scale");
53549       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
53550       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
53551       viewfields.exit().remove();
53552       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z");
53553     }
53554     function drawImages(selection2) {
53555       const service = getService();
53556       layer = selection2.selectAll(".layer-mapillary-position").data(service ? [0] : []);
53557       layer.exit().remove();
53558       const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary-position");
53559       layerEnter.append("g").attr("class", "markers");
53560       layer = layerEnter.merge(layer);
53561       if (service && ~~context.map().zoom() >= minZoom5) {
53562         editOn();
53563         update();
53564       } else {
53565         editOff();
53566       }
53567     }
53568     drawImages.enabled = function() {
53569       update();
53570       return this;
53571     };
53572     drawImages.supported = function() {
53573       return !!getService();
53574     };
53575     drawImages.rendered = function(zoom) {
53576       return zoom >= minZoom5;
53577     };
53578     init2();
53579     return drawImages;
53580   }
53581
53582   // modules/svg/mapillary_signs.js
53583   function svgMapillarySigns(projection2, context, dispatch14) {
53584     const throttledRedraw = throttle_default(function() {
53585       dispatch14.call("change");
53586     }, 1e3);
53587     const minZoom5 = 12;
53588     let layer = select_default2(null);
53589     let _mapillary;
53590     function init2() {
53591       if (svgMapillarySigns.initialized) return;
53592       svgMapillarySigns.enabled = false;
53593       svgMapillarySigns.initialized = true;
53594     }
53595     function getService() {
53596       if (services.mapillary && !_mapillary) {
53597         _mapillary = services.mapillary;
53598         _mapillary.event.on("loadedSigns", throttledRedraw);
53599       } else if (!services.mapillary && _mapillary) {
53600         _mapillary = null;
53601       }
53602       return _mapillary;
53603     }
53604     function showLayer() {
53605       const service = getService();
53606       if (!service) return;
53607       service.loadSignResources(context);
53608       editOn();
53609     }
53610     function hideLayer() {
53611       throttledRedraw.cancel();
53612       editOff();
53613     }
53614     function editOn() {
53615       layer.style("display", "block");
53616     }
53617     function editOff() {
53618       layer.selectAll(".icon-sign").remove();
53619       layer.style("display", "none");
53620     }
53621     function click(d3_event, d2) {
53622       const service = getService();
53623       if (!service) return;
53624       context.map().centerEase(d2.loc);
53625       const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
53626       service.getDetections(d2.id).then((detections) => {
53627         if (detections.length) {
53628           const imageId = detections[0].image.id;
53629           if (imageId === selectedImageId) {
53630             service.highlightDetection(detections[0]).selectImage(context, imageId);
53631           } else {
53632             service.ensureViewerLoaded(context).then(function() {
53633               service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
53634             });
53635           }
53636         }
53637       });
53638     }
53639     function filterData(detectedFeatures) {
53640       var fromDate = context.photos().fromDate();
53641       var toDate = context.photos().toDate();
53642       if (fromDate) {
53643         var fromTimestamp = new Date(fromDate).getTime();
53644         detectedFeatures = detectedFeatures.filter(function(feature3) {
53645           return new Date(feature3.last_seen_at).getTime() >= fromTimestamp;
53646         });
53647       }
53648       if (toDate) {
53649         var toTimestamp = new Date(toDate).getTime();
53650         detectedFeatures = detectedFeatures.filter(function(feature3) {
53651           return new Date(feature3.first_seen_at).getTime() <= toTimestamp;
53652         });
53653       }
53654       return detectedFeatures;
53655     }
53656     function update() {
53657       const service = getService();
53658       let data = service ? service.signs(projection2) : [];
53659       data = filterData(data);
53660       const transform2 = svgPointTransform(projection2);
53661       const signs = layer.selectAll(".icon-sign").data(data, function(d2) {
53662         return d2.id;
53663       });
53664       signs.exit().remove();
53665       const enter = signs.enter().append("g").attr("class", "icon-sign icon-detected").on("click", click);
53666       enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d2) {
53667         return "#" + d2.value;
53668       });
53669       enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
53670       signs.merge(enter).attr("transform", transform2);
53671     }
53672     function drawSigns(selection2) {
53673       const enabled = svgMapillarySigns.enabled;
53674       const service = getService();
53675       layer = selection2.selectAll(".layer-mapillary-signs").data(service ? [0] : []);
53676       layer.exit().remove();
53677       layer = layer.enter().append("g").attr("class", "layer-mapillary-signs layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
53678       if (enabled) {
53679         if (service && ~~context.map().zoom() >= minZoom5) {
53680           editOn();
53681           update();
53682           service.loadSigns(projection2);
53683           service.showSignDetections(true);
53684         } else {
53685           editOff();
53686         }
53687       } else if (service) {
53688         service.showSignDetections(false);
53689       }
53690     }
53691     drawSigns.enabled = function(_2) {
53692       if (!arguments.length) return svgMapillarySigns.enabled;
53693       svgMapillarySigns.enabled = _2;
53694       if (svgMapillarySigns.enabled) {
53695         showLayer();
53696         context.photos().on("change.mapillary_signs", update);
53697       } else {
53698         hideLayer();
53699         context.photos().on("change.mapillary_signs", null);
53700       }
53701       dispatch14.call("change");
53702       return this;
53703     };
53704     drawSigns.supported = function() {
53705       return !!getService();
53706     };
53707     drawSigns.rendered = function(zoom) {
53708       return zoom >= minZoom5;
53709     };
53710     init2();
53711     return drawSigns;
53712   }
53713
53714   // modules/svg/mapillary_map_features.js
53715   function svgMapillaryMapFeatures(projection2, context, dispatch14) {
53716     const throttledRedraw = throttle_default(function() {
53717       dispatch14.call("change");
53718     }, 1e3);
53719     const minZoom5 = 12;
53720     let layer = select_default2(null);
53721     let _mapillary;
53722     function init2() {
53723       if (svgMapillaryMapFeatures.initialized) return;
53724       svgMapillaryMapFeatures.enabled = false;
53725       svgMapillaryMapFeatures.initialized = true;
53726     }
53727     function getService() {
53728       if (services.mapillary && !_mapillary) {
53729         _mapillary = services.mapillary;
53730         _mapillary.event.on("loadedMapFeatures", throttledRedraw);
53731       } else if (!services.mapillary && _mapillary) {
53732         _mapillary = null;
53733       }
53734       return _mapillary;
53735     }
53736     function showLayer() {
53737       const service = getService();
53738       if (!service) return;
53739       service.loadObjectResources(context);
53740       editOn();
53741     }
53742     function hideLayer() {
53743       throttledRedraw.cancel();
53744       editOff();
53745     }
53746     function editOn() {
53747       layer.style("display", "block");
53748     }
53749     function editOff() {
53750       layer.selectAll(".icon-map-feature").remove();
53751       layer.style("display", "none");
53752     }
53753     function click(d3_event, d2) {
53754       const service = getService();
53755       if (!service) return;
53756       context.map().centerEase(d2.loc);
53757       const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
53758       service.getDetections(d2.id).then((detections) => {
53759         if (detections.length) {
53760           const imageId = detections[0].image.id;
53761           if (imageId === selectedImageId) {
53762             service.highlightDetection(detections[0]).selectImage(context, imageId);
53763           } else {
53764             service.ensureViewerLoaded(context).then(function() {
53765               service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
53766             });
53767           }
53768         }
53769       });
53770     }
53771     function filterData(detectedFeatures) {
53772       const fromDate = context.photos().fromDate();
53773       const toDate = context.photos().toDate();
53774       if (fromDate) {
53775         detectedFeatures = detectedFeatures.filter(function(feature3) {
53776           return new Date(feature3.last_seen_at).getTime() >= new Date(fromDate).getTime();
53777         });
53778       }
53779       if (toDate) {
53780         detectedFeatures = detectedFeatures.filter(function(feature3) {
53781           return new Date(feature3.first_seen_at).getTime() <= new Date(toDate).getTime();
53782         });
53783       }
53784       return detectedFeatures;
53785     }
53786     function update() {
53787       const service = getService();
53788       let data = service ? service.mapFeatures(projection2) : [];
53789       data = filterData(data);
53790       const transform2 = svgPointTransform(projection2);
53791       const mapFeatures = layer.selectAll(".icon-map-feature").data(data, function(d2) {
53792         return d2.id;
53793       });
53794       mapFeatures.exit().remove();
53795       const enter = mapFeatures.enter().append("g").attr("class", "icon-map-feature icon-detected").on("click", click);
53796       enter.append("title").text(function(d2) {
53797         var id2 = d2.value.replace(/--/g, ".").replace(/-/g, "_");
53798         return _t("mapillary_map_features." + id2);
53799       });
53800       enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d2) {
53801         if (d2.value === "object--billboard") {
53802           return "#object--sign--advertisement";
53803         }
53804         return "#" + d2.value;
53805       });
53806       enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
53807       mapFeatures.merge(enter).attr("transform", transform2);
53808     }
53809     function drawMapFeatures(selection2) {
53810       const enabled = svgMapillaryMapFeatures.enabled;
53811       const service = getService();
53812       layer = selection2.selectAll(".layer-mapillary-map-features").data(service ? [0] : []);
53813       layer.exit().remove();
53814       layer = layer.enter().append("g").attr("class", "layer-mapillary-map-features layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
53815       if (enabled) {
53816         if (service && ~~context.map().zoom() >= minZoom5) {
53817           editOn();
53818           update();
53819           service.loadMapFeatures(projection2);
53820           service.showFeatureDetections(true);
53821         } else {
53822           editOff();
53823         }
53824       } else if (service) {
53825         service.showFeatureDetections(false);
53826       }
53827     }
53828     drawMapFeatures.enabled = function(_2) {
53829       if (!arguments.length) return svgMapillaryMapFeatures.enabled;
53830       svgMapillaryMapFeatures.enabled = _2;
53831       if (svgMapillaryMapFeatures.enabled) {
53832         showLayer();
53833         context.photos().on("change.mapillary_map_features", update);
53834       } else {
53835         hideLayer();
53836         context.photos().on("change.mapillary_map_features", null);
53837       }
53838       dispatch14.call("change");
53839       return this;
53840     };
53841     drawMapFeatures.supported = function() {
53842       return !!getService();
53843     };
53844     drawMapFeatures.rendered = function(zoom) {
53845       return zoom >= minZoom5;
53846     };
53847     init2();
53848     return drawMapFeatures;
53849   }
53850
53851   // modules/svg/kartaview_images.js
53852   function svgKartaviewImages(projection2, context, dispatch14) {
53853     var throttledRedraw = throttle_default(function() {
53854       dispatch14.call("change");
53855     }, 1e3);
53856     var minZoom5 = 12;
53857     var minMarkerZoom = 16;
53858     var minViewfieldZoom2 = 18;
53859     var layer = select_default2(null);
53860     var _kartaview;
53861     function init2() {
53862       if (svgKartaviewImages.initialized) return;
53863       svgKartaviewImages.enabled = false;
53864       svgKartaviewImages.initialized = true;
53865     }
53866     function getService() {
53867       if (services.kartaview && !_kartaview) {
53868         _kartaview = services.kartaview;
53869         _kartaview.event.on("loadedImages", throttledRedraw);
53870       } else if (!services.kartaview && _kartaview) {
53871         _kartaview = null;
53872       }
53873       return _kartaview;
53874     }
53875     function showLayer() {
53876       var service = getService();
53877       if (!service) return;
53878       editOn();
53879       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
53880         dispatch14.call("change");
53881       });
53882     }
53883     function hideLayer() {
53884       throttledRedraw.cancel();
53885       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
53886     }
53887     function editOn() {
53888       layer.style("display", "block");
53889     }
53890     function editOff() {
53891       layer.selectAll(".viewfield-group").remove();
53892       layer.style("display", "none");
53893     }
53894     function click(d3_event, d2) {
53895       var service = getService();
53896       if (!service) return;
53897       service.ensureViewerLoaded(context).then(function() {
53898         service.selectImage(context, d2.key).showViewer(context);
53899       });
53900       context.map().centerEase(d2.loc);
53901     }
53902     function mouseover(d3_event, d2) {
53903       var service = getService();
53904       if (service) service.setStyles(context, d2);
53905     }
53906     function mouseout() {
53907       var service = getService();
53908       if (service) service.setStyles(context, null);
53909     }
53910     function transform2(d2) {
53911       var t2 = svgPointTransform(projection2)(d2);
53912       if (d2.ca) {
53913         t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
53914       }
53915       return t2;
53916     }
53917     function filterImages(images) {
53918       var fromDate = context.photos().fromDate();
53919       var toDate = context.photos().toDate();
53920       var usernames = context.photos().usernames();
53921       if (fromDate) {
53922         var fromTimestamp = new Date(fromDate).getTime();
53923         images = images.filter(function(item) {
53924           return new Date(item.captured_at).getTime() >= fromTimestamp;
53925         });
53926       }
53927       if (toDate) {
53928         var toTimestamp = new Date(toDate).getTime();
53929         images = images.filter(function(item) {
53930           return new Date(item.captured_at).getTime() <= toTimestamp;
53931         });
53932       }
53933       if (usernames) {
53934         images = images.filter(function(item) {
53935           return usernames.indexOf(item.captured_by) !== -1;
53936         });
53937       }
53938       return images;
53939     }
53940     function filterSequences(sequences) {
53941       var fromDate = context.photos().fromDate();
53942       var toDate = context.photos().toDate();
53943       var usernames = context.photos().usernames();
53944       if (fromDate) {
53945         var fromTimestamp = new Date(fromDate).getTime();
53946         sequences = sequences.filter(function(image) {
53947           return new Date(image.properties.captured_at).getTime() >= fromTimestamp;
53948         });
53949       }
53950       if (toDate) {
53951         var toTimestamp = new Date(toDate).getTime();
53952         sequences = sequences.filter(function(image) {
53953           return new Date(image.properties.captured_at).getTime() <= toTimestamp;
53954         });
53955       }
53956       if (usernames) {
53957         sequences = sequences.filter(function(image) {
53958           return usernames.indexOf(image.properties.captured_by) !== -1;
53959         });
53960       }
53961       return sequences;
53962     }
53963     function update() {
53964       var viewer = context.container().select(".photoviewer");
53965       var selected = viewer.empty() ? void 0 : viewer.datum();
53966       var z2 = ~~context.map().zoom();
53967       var showMarkers = z2 >= minMarkerZoom;
53968       var showViewfields = z2 >= minViewfieldZoom2;
53969       var service = getService();
53970       var sequences = [];
53971       var images = [];
53972       if (context.photos().showsFlat()) {
53973         sequences = service ? service.sequences(projection2) : [];
53974         images = service && showMarkers ? service.images(projection2) : [];
53975         sequences = filterSequences(sequences);
53976         images = filterImages(images);
53977       }
53978       var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
53979         return d2.properties.key;
53980       });
53981       traces.exit().remove();
53982       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
53983       var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
53984         return d2.key;
53985       });
53986       groups.exit().remove();
53987       var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
53988       groupsEnter.append("g").attr("class", "viewfield-scale");
53989       var markers = groups.merge(groupsEnter).sort(function(a2, b2) {
53990         return a2 === selected ? 1 : b2 === selected ? -1 : b2.loc[1] - a2.loc[1];
53991       }).attr("transform", transform2).select(".viewfield-scale");
53992       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
53993       var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
53994       viewfields.exit().remove();
53995       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z");
53996     }
53997     function drawImages(selection2) {
53998       var enabled = svgKartaviewImages.enabled, service = getService();
53999       layer = selection2.selectAll(".layer-kartaview").data(service ? [0] : []);
54000       layer.exit().remove();
54001       var layerEnter = layer.enter().append("g").attr("class", "layer-kartaview").style("display", enabled ? "block" : "none");
54002       layerEnter.append("g").attr("class", "sequences");
54003       layerEnter.append("g").attr("class", "markers");
54004       layer = layerEnter.merge(layer);
54005       if (enabled) {
54006         if (service && ~~context.map().zoom() >= minZoom5) {
54007           editOn();
54008           update();
54009           service.loadImages(projection2);
54010         } else {
54011           editOff();
54012         }
54013       }
54014     }
54015     drawImages.enabled = function(_2) {
54016       if (!arguments.length) return svgKartaviewImages.enabled;
54017       svgKartaviewImages.enabled = _2;
54018       if (svgKartaviewImages.enabled) {
54019         showLayer();
54020         context.photos().on("change.kartaview_images", update);
54021       } else {
54022         hideLayer();
54023         context.photos().on("change.kartaview_images", null);
54024       }
54025       dispatch14.call("change");
54026       return this;
54027     };
54028     drawImages.supported = function() {
54029       return !!getService();
54030     };
54031     drawImages.rendered = function(zoom) {
54032       return zoom >= minZoom5;
54033     };
54034     init2();
54035     return drawImages;
54036   }
54037
54038   // modules/svg/mapilio_images.js
54039   function svgMapilioImages(projection2, context, dispatch14) {
54040     const throttledRedraw = throttle_default(function() {
54041       dispatch14.call("change");
54042     }, 1e3);
54043     const minZoom5 = 12;
54044     let layer = select_default2(null);
54045     let _mapilio;
54046     const viewFieldZoomLevel = 18;
54047     function init2() {
54048       if (svgMapilioImages.initialized) return;
54049       svgMapilioImages.enabled = false;
54050       svgMapilioImages.initialized = true;
54051     }
54052     function getService() {
54053       if (services.mapilio && !_mapilio) {
54054         _mapilio = services.mapilio;
54055         _mapilio.event.on("loadedImages", throttledRedraw);
54056       } else if (!services.mapilio && _mapilio) {
54057         _mapilio = null;
54058       }
54059       return _mapilio;
54060     }
54061     function showLayer() {
54062       const service = getService();
54063       if (!service) return;
54064       editOn();
54065       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
54066         dispatch14.call("change");
54067       });
54068     }
54069     function hideLayer() {
54070       throttledRedraw.cancel();
54071       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
54072     }
54073     function transform2(d2) {
54074       let t2 = svgPointTransform(projection2)(d2);
54075       if (d2.heading) {
54076         t2 += " rotate(" + Math.floor(d2.heading) + ",0,0)";
54077       }
54078       return t2;
54079     }
54080     function editOn() {
54081       layer.style("display", "block");
54082     }
54083     function editOff() {
54084       layer.selectAll(".viewfield-group").remove();
54085       layer.style("display", "none");
54086     }
54087     function click(d3_event, image) {
54088       const service = getService();
54089       if (!service) return;
54090       service.ensureViewerLoaded(context, image.id).then(function() {
54091         service.selectImage(context, image.id).showViewer(context);
54092       });
54093       context.map().centerEase(image.loc);
54094     }
54095     function mouseover(d3_event, image) {
54096       const service = getService();
54097       if (service) service.setStyles(context, image);
54098     }
54099     function mouseout() {
54100       const service = getService();
54101       if (service) service.setStyles(context, null);
54102     }
54103     function update() {
54104       const z2 = ~~context.map().zoom();
54105       const showViewfields = z2 >= viewFieldZoomLevel;
54106       const service = getService();
54107       let sequences = service ? service.sequences(projection2) : [];
54108       let images = service ? service.images(projection2) : [];
54109       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
54110         return d2.properties.id;
54111       });
54112       traces.exit().remove();
54113       traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
54114       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
54115         return d2.id;
54116       });
54117       groups.exit().remove();
54118       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
54119       groupsEnter.append("g").attr("class", "viewfield-scale");
54120       const markers = groups.merge(groupsEnter).sort(function(a2, b2) {
54121         return b2.loc[1] - a2.loc[1];
54122       }).attr("transform", transform2).select(".viewfield-scale");
54123       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
54124       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
54125       viewfields.exit().remove();
54126       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
54127       function viewfieldPath() {
54128         if (this.parentNode.__data__.isPano) {
54129           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
54130         } else {
54131           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
54132         }
54133       }
54134     }
54135     function drawImages(selection2) {
54136       const enabled = svgMapilioImages.enabled;
54137       const service = getService();
54138       layer = selection2.selectAll(".layer-mapilio").data(service ? [0] : []);
54139       layer.exit().remove();
54140       const layerEnter = layer.enter().append("g").attr("class", "layer-mapilio").style("display", enabled ? "block" : "none");
54141       layerEnter.append("g").attr("class", "sequences");
54142       layerEnter.append("g").attr("class", "markers");
54143       layer = layerEnter.merge(layer);
54144       if (enabled) {
54145         if (service && ~~context.map().zoom() >= minZoom5) {
54146           editOn();
54147           update();
54148           service.loadImages(projection2);
54149           service.loadLines(projection2);
54150         } else {
54151           editOff();
54152         }
54153       }
54154     }
54155     drawImages.enabled = function(_2) {
54156       if (!arguments.length) return svgMapilioImages.enabled;
54157       svgMapilioImages.enabled = _2;
54158       if (svgMapilioImages.enabled) {
54159         showLayer();
54160         context.photos().on("change.mapilio_images", update);
54161       } else {
54162         hideLayer();
54163         context.photos().on("change.mapilio_images", null);
54164       }
54165       dispatch14.call("change");
54166       return this;
54167     };
54168     drawImages.supported = function() {
54169       return !!getService();
54170     };
54171     drawImages.rendered = function(zoom) {
54172       return zoom >= minZoom5;
54173     };
54174     init2();
54175     return drawImages;
54176   }
54177
54178   // modules/svg/panoramax_images.js
54179   function svgPanoramaxImages(projection2, context, dispatch14) {
54180     const throttledRedraw = throttle_default(function() {
54181       dispatch14.call("change");
54182     }, 1e3);
54183     const imageMinZoom2 = 15;
54184     const lineMinZoom2 = 10;
54185     const viewFieldZoomLevel = 18;
54186     let layer = select_default2(null);
54187     let _panoramax;
54188     let _viewerYaw = 0;
54189     let _selectedSequence;
54190     let _activeUsernameFilter;
54191     let _activeIds;
54192     function init2() {
54193       if (svgPanoramaxImages.initialized) return;
54194       svgPanoramaxImages.enabled = false;
54195       svgPanoramaxImages.initialized = true;
54196     }
54197     function getService() {
54198       if (services.panoramax && !_panoramax) {
54199         _panoramax = services.panoramax;
54200         _panoramax.event.on("viewerChanged", viewerChanged).on("loadedLines", throttledRedraw).on("loadedImages", throttledRedraw);
54201       } else if (!services.panoramax && _panoramax) {
54202         _panoramax = null;
54203       }
54204       return _panoramax;
54205     }
54206     async function filterImages(images) {
54207       const showsPano = context.photos().showsPanoramic();
54208       const showsFlat = context.photos().showsFlat();
54209       const fromDate = context.photos().fromDate();
54210       const toDate = context.photos().toDate();
54211       const username = context.photos().usernames();
54212       const service = getService();
54213       if (!showsPano || !showsFlat) {
54214         images = images.filter(function(image) {
54215           if (image.isPano) return showsPano;
54216           return showsFlat;
54217         });
54218       }
54219       if (fromDate) {
54220         images = images.filter(function(image) {
54221           return new Date(image.capture_time).getTime() >= new Date(fromDate).getTime();
54222         });
54223       }
54224       if (toDate) {
54225         images = images.filter(function(image) {
54226           return new Date(image.capture_time).getTime() <= new Date(toDate).getTime();
54227         });
54228       }
54229       if (username && service) {
54230         if (_activeUsernameFilter !== username) {
54231           _activeUsernameFilter = username;
54232           const tempIds = await service.getUserIds(username);
54233           _activeIds = {};
54234           tempIds.forEach((id2) => {
54235             _activeIds[id2] = true;
54236           });
54237         }
54238         images = images.filter(function(image) {
54239           return _activeIds[image.account_id];
54240         });
54241       }
54242       return images;
54243     }
54244     async function filterSequences(sequences) {
54245       const showsPano = context.photos().showsPanoramic();
54246       const showsFlat = context.photos().showsFlat();
54247       const fromDate = context.photos().fromDate();
54248       const toDate = context.photos().toDate();
54249       const username = context.photos().usernames();
54250       const service = getService();
54251       if (!showsPano || !showsFlat) {
54252         sequences = sequences.filter(function(sequence) {
54253           if (sequence.properties.type === "equirectangular") return showsPano;
54254           return showsFlat;
54255         });
54256       }
54257       if (fromDate) {
54258         sequences = sequences.filter(function(sequence) {
54259           return new Date(sequence.properties.date).getTime() >= new Date(fromDate).getTime().toString();
54260         });
54261       }
54262       if (toDate) {
54263         sequences = sequences.filter(function(sequence) {
54264           return new Date(sequence.properties.date).getTime() <= new Date(toDate).getTime().toString();
54265         });
54266       }
54267       if (username && service) {
54268         if (_activeUsernameFilter !== username) {
54269           _activeUsernameFilter = username;
54270           const tempIds = await service.getUserIds(username);
54271           _activeIds = {};
54272           tempIds.forEach((id2) => {
54273             _activeIds[id2] = true;
54274           });
54275         }
54276         sequences = sequences.filter(function(sequence) {
54277           return _activeIds[sequence.properties.account_id];
54278         });
54279       }
54280       return sequences;
54281     }
54282     function showLayer() {
54283       const service = getService();
54284       if (!service) return;
54285       editOn();
54286       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
54287         dispatch14.call("change");
54288       });
54289     }
54290     function hideLayer() {
54291       throttledRedraw.cancel();
54292       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
54293     }
54294     function transform2(d2, selectedImageId) {
54295       let t2 = svgPointTransform(projection2)(d2);
54296       let rot = d2.heading;
54297       if (d2.id === selectedImageId) {
54298         rot += _viewerYaw;
54299       }
54300       if (rot) {
54301         t2 += " rotate(" + Math.floor(rot) + ",0,0)";
54302       }
54303       return t2;
54304     }
54305     function editOn() {
54306       layer.style("display", "block");
54307     }
54308     function editOff() {
54309       layer.selectAll(".viewfield-group").remove();
54310       layer.style("display", "none");
54311     }
54312     function click(d3_event, image) {
54313       const service = getService();
54314       if (!service) return;
54315       if (image.sequence_id !== _selectedSequence) {
54316         _viewerYaw = 0;
54317       }
54318       _selectedSequence = image.sequence_id;
54319       service.ensureViewerLoaded(context).then(function() {
54320         service.selectImage(context, image.id).showViewer(context);
54321       });
54322       context.map().centerEase(image.loc);
54323     }
54324     function mouseover(d3_event, image) {
54325       const service = getService();
54326       if (service) service.setStyles(context, image);
54327     }
54328     function mouseout() {
54329       const service = getService();
54330       if (service) service.setStyles(context, null);
54331     }
54332     async function update() {
54333       var _a3;
54334       const zoom = ~~context.map().zoom();
54335       const showViewfields = zoom >= viewFieldZoomLevel;
54336       const service = getService();
54337       let sequences = service ? service.sequences(projection2, zoom) : [];
54338       let images = service && zoom >= imageMinZoom2 ? service.images(projection2) : [];
54339       images = await filterImages(images);
54340       sequences = await filterSequences(sequences, service);
54341       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
54342         return d2.properties.id;
54343       });
54344       traces.exit().remove();
54345       traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
54346       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
54347         return d2.id;
54348       });
54349       groups.exit().remove();
54350       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
54351       groupsEnter.append("g").attr("class", "viewfield-scale");
54352       const activeImageId = (_a3 = service.getActiveImage()) == null ? void 0 : _a3.id;
54353       const markers = groups.merge(groupsEnter).sort(function(a2, b2) {
54354         if (a2.id === activeImageId) return 1;
54355         if (b2.id === activeImageId) return -1;
54356         return a2.capture_time_parsed - b2.capture_time_parsed;
54357       }).attr("transform", (d2) => transform2(d2, activeImageId)).select(".viewfield-scale");
54358       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
54359       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
54360       viewfields.exit().remove();
54361       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
54362       service.setStyles(context, null);
54363       function viewfieldPath() {
54364         if (this.parentNode.__data__.isPano) {
54365           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
54366         } else {
54367           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
54368         }
54369       }
54370     }
54371     function viewerChanged() {
54372       const service = getService();
54373       if (!service) return;
54374       const frame2 = service.photoFrame();
54375       if (!frame2) return;
54376       _viewerYaw = frame2.getYaw();
54377       if (context.map().isTransformed()) return;
54378       layer.selectAll(".viewfield-group.currentView").attr("transform", (d2) => transform2(d2, d2.id));
54379     }
54380     function drawImages(selection2) {
54381       const enabled = svgPanoramaxImages.enabled;
54382       const service = getService();
54383       layer = selection2.selectAll(".layer-panoramax").data(service ? [0] : []);
54384       layer.exit().remove();
54385       const layerEnter = layer.enter().append("g").attr("class", "layer-panoramax").style("display", enabled ? "block" : "none");
54386       layerEnter.append("g").attr("class", "sequences");
54387       layerEnter.append("g").attr("class", "markers");
54388       layer = layerEnter.merge(layer);
54389       if (enabled) {
54390         let zoom = ~~context.map().zoom();
54391         if (service) {
54392           if (zoom >= imageMinZoom2) {
54393             editOn();
54394             update();
54395             service.loadImages(projection2);
54396           } else if (zoom >= lineMinZoom2) {
54397             editOn();
54398             update();
54399             service.loadLines(projection2, zoom);
54400           } else {
54401             editOff();
54402           }
54403         } else {
54404           editOff();
54405         }
54406       }
54407     }
54408     drawImages.enabled = function(_2) {
54409       if (!arguments.length) return svgPanoramaxImages.enabled;
54410       svgPanoramaxImages.enabled = _2;
54411       if (svgPanoramaxImages.enabled) {
54412         showLayer();
54413         context.photos().on("change.panoramax_images", update);
54414       } else {
54415         hideLayer();
54416         context.photos().on("change.panoramax_images", null);
54417       }
54418       dispatch14.call("change");
54419       return this;
54420     };
54421     drawImages.supported = function() {
54422       return !!getService();
54423     };
54424     drawImages.rendered = function(zoom) {
54425       return zoom >= lineMinZoom2;
54426     };
54427     init2();
54428     return drawImages;
54429   }
54430
54431   // modules/svg/osm.js
54432   function svgOsm(projection2, context, dispatch14) {
54433     var enabled = true;
54434     function drawOsm(selection2) {
54435       selection2.selectAll(".layer-osm").data(["covered", "areas", "lines", "points", "labels"]).enter().append("g").attr("class", function(d2) {
54436         return "layer-osm " + d2;
54437       });
54438       selection2.selectAll(".layer-osm.points").selectAll(".points-group").data(["points", "midpoints", "vertices", "turns"]).enter().append("g").attr("class", function(d2) {
54439         return "points-group " + d2;
54440       });
54441     }
54442     function showLayer() {
54443       var layer = context.surface().selectAll(".data-layer.osm");
54444       layer.interrupt();
54445       layer.classed("disabled", false).style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
54446         dispatch14.call("change");
54447       });
54448     }
54449     function hideLayer() {
54450       var layer = context.surface().selectAll(".data-layer.osm");
54451       layer.interrupt();
54452       layer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
54453         layer.classed("disabled", true);
54454         dispatch14.call("change");
54455       });
54456     }
54457     drawOsm.enabled = function(val) {
54458       if (!arguments.length) return enabled;
54459       enabled = val;
54460       if (enabled) {
54461         showLayer();
54462       } else {
54463         hideLayer();
54464       }
54465       dispatch14.call("change");
54466       return this;
54467     };
54468     return drawOsm;
54469   }
54470
54471   // modules/svg/notes.js
54472   var _notesEnabled = false;
54473   var _osmService;
54474   function svgNotes(projection2, context, dispatch14) {
54475     if (!dispatch14) {
54476       dispatch14 = dispatch_default("change");
54477     }
54478     var throttledRedraw = throttle_default(function() {
54479       dispatch14.call("change");
54480     }, 1e3);
54481     var minZoom5 = 12;
54482     var touchLayer = select_default2(null);
54483     var drawLayer = select_default2(null);
54484     var _notesVisible = false;
54485     function markerPath(selection2, klass) {
54486       selection2.attr("class", klass).attr("transform", "translate(-8, -22)").attr("d", "m17.5,0l-15,0c-1.37,0 -2.5,1.12 -2.5,2.5l0,11.25c0,1.37 1.12,2.5 2.5,2.5l3.75,0l0,3.28c0,0.38 0.43,0.6 0.75,0.37l4.87,-3.65l5.62,0c1.37,0 2.5,-1.12 2.5,-2.5l0,-11.25c0,-1.37 -1.12,-2.5 -2.5,-2.5z");
54487     }
54488     function getService() {
54489       if (services.osm && !_osmService) {
54490         _osmService = services.osm;
54491         _osmService.on("loadedNotes", throttledRedraw);
54492       } else if (!services.osm && _osmService) {
54493         _osmService = null;
54494       }
54495       return _osmService;
54496     }
54497     function editOn() {
54498       if (!_notesVisible) {
54499         _notesVisible = true;
54500         drawLayer.style("display", "block");
54501       }
54502     }
54503     function editOff() {
54504       if (_notesVisible) {
54505         _notesVisible = false;
54506         drawLayer.style("display", "none");
54507         drawLayer.selectAll(".note").remove();
54508         touchLayer.selectAll(".note").remove();
54509       }
54510     }
54511     function layerOn() {
54512       editOn();
54513       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
54514         dispatch14.call("change");
54515       });
54516     }
54517     function layerOff() {
54518       throttledRedraw.cancel();
54519       drawLayer.interrupt();
54520       touchLayer.selectAll(".note").remove();
54521       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
54522         editOff();
54523         dispatch14.call("change");
54524       });
54525     }
54526     function updateMarkers() {
54527       if (!_notesVisible || !_notesEnabled) return;
54528       var service = getService();
54529       var selectedID = context.selectedNoteID();
54530       var data = service ? service.notes(projection2) : [];
54531       var getTransform = svgPointTransform(projection2);
54532       var notes = drawLayer.selectAll(".note").data(data, function(d2) {
54533         return d2.status + d2.id;
54534       });
54535       notes.exit().remove();
54536       var notesEnter = notes.enter().append("g").attr("class", function(d2) {
54537         return "note note-" + d2.id + " " + d2.status;
54538       }).classed("new", function(d2) {
54539         return d2.id < 0;
54540       });
54541       notesEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
54542       notesEnter.append("path").call(markerPath, "shadow");
54543       notesEnter.append("use").attr("class", "note-fill").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").attr("xlink:href", "#iD-icon-note");
54544       notesEnter.selectAll(".icon-annotation").data(function(d2) {
54545         return [d2];
54546       }).enter().append("use").attr("class", "icon-annotation").attr("width", "10px").attr("height", "10px").attr("x", "-3px").attr("y", "-19px").attr("xlink:href", function(d2) {
54547         if (d2.id < 0) return "#iD-icon-plus";
54548         if (d2.status === "open") return "#iD-icon-close";
54549         return "#iD-icon-apply";
54550       });
54551       notes.merge(notesEnter).sort(sortY).classed("selected", function(d2) {
54552         var mode = context.mode();
54553         var isMoving = mode && mode.id === "drag-note";
54554         return !isMoving && d2.id === selectedID;
54555       }).attr("transform", getTransform);
54556       if (touchLayer.empty()) return;
54557       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
54558       var targets = touchLayer.selectAll(".note").data(data, function(d2) {
54559         return d2.id;
54560       });
54561       targets.exit().remove();
54562       targets.enter().append("rect").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").merge(targets).sort(sortY).attr("class", function(d2) {
54563         var newClass = d2.id < 0 ? "new" : "";
54564         return "note target note-" + d2.id + " " + fillClass + newClass;
54565       }).attr("transform", getTransform);
54566       function sortY(a2, b2) {
54567         if (a2.id === selectedID) return 1;
54568         if (b2.id === selectedID) return -1;
54569         return b2.loc[1] - a2.loc[1];
54570       }
54571     }
54572     function drawNotes(selection2) {
54573       var service = getService();
54574       var surface = context.surface();
54575       if (surface && !surface.empty()) {
54576         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
54577       }
54578       drawLayer = selection2.selectAll(".layer-notes").data(service ? [0] : []);
54579       drawLayer.exit().remove();
54580       drawLayer = drawLayer.enter().append("g").attr("class", "layer-notes").style("display", _notesEnabled ? "block" : "none").merge(drawLayer);
54581       if (_notesEnabled) {
54582         if (service && ~~context.map().zoom() >= minZoom5) {
54583           editOn();
54584           service.loadNotes(projection2);
54585           updateMarkers();
54586         } else {
54587           editOff();
54588         }
54589       }
54590     }
54591     drawNotes.enabled = function(val) {
54592       if (!arguments.length) return _notesEnabled;
54593       _notesEnabled = val;
54594       if (_notesEnabled) {
54595         layerOn();
54596       } else {
54597         layerOff();
54598         if (context.selectedNoteID()) {
54599           context.enter(modeBrowse(context));
54600         }
54601       }
54602       dispatch14.call("change");
54603       return this;
54604     };
54605     return drawNotes;
54606   }
54607
54608   // modules/svg/touch.js
54609   function svgTouch() {
54610     function drawTouch(selection2) {
54611       selection2.selectAll(".layer-touch").data(["areas", "lines", "points", "turns", "markers"]).enter().append("g").attr("class", function(d2) {
54612         return "layer-touch " + d2;
54613       });
54614     }
54615     return drawTouch;
54616   }
54617
54618   // modules/util/dimensions.js
54619   function refresh(selection2, node) {
54620     var cr = node.getBoundingClientRect();
54621     var prop = [cr.width, cr.height];
54622     selection2.property("__dimensions__", prop);
54623     return prop;
54624   }
54625   function utilGetDimensions(selection2, force) {
54626     if (!selection2 || selection2.empty()) {
54627       return [0, 0];
54628     }
54629     var node = selection2.node(), cached = selection2.property("__dimensions__");
54630     return !cached || force ? refresh(selection2, node) : cached;
54631   }
54632   function utilSetDimensions(selection2, dimensions) {
54633     if (!selection2 || selection2.empty()) {
54634       return selection2;
54635     }
54636     var node = selection2.node();
54637     if (dimensions === null) {
54638       refresh(selection2, node);
54639       return selection2;
54640     }
54641     return selection2.property("__dimensions__", [dimensions[0], dimensions[1]]).attr("width", dimensions[0]).attr("height", dimensions[1]);
54642   }
54643
54644   // modules/svg/layers.js
54645   function svgLayers(projection2, context) {
54646     var dispatch14 = dispatch_default("change");
54647     var svg2 = select_default2(null);
54648     var _layers = [
54649       { id: "osm", layer: svgOsm(projection2, context, dispatch14) },
54650       { id: "notes", layer: svgNotes(projection2, context, dispatch14) },
54651       { id: "data", layer: svgData(projection2, context, dispatch14) },
54652       { id: "keepRight", layer: svgKeepRight(projection2, context, dispatch14) },
54653       { id: "osmose", layer: svgOsmose(projection2, context, dispatch14) },
54654       { id: "streetside", layer: svgStreetside(projection2, context, dispatch14) },
54655       { id: "mapillary", layer: svgMapillaryImages(projection2, context, dispatch14) },
54656       { id: "mapillary-position", layer: svgMapillaryPosition(projection2, context, dispatch14) },
54657       { id: "mapillary-map-features", layer: svgMapillaryMapFeatures(projection2, context, dispatch14) },
54658       { id: "mapillary-signs", layer: svgMapillarySigns(projection2, context, dispatch14) },
54659       { id: "kartaview", layer: svgKartaviewImages(projection2, context, dispatch14) },
54660       { id: "mapilio", layer: svgMapilioImages(projection2, context, dispatch14) },
54661       { id: "vegbilder", layer: svgVegbilder(projection2, context, dispatch14) },
54662       { id: "panoramax", layer: svgPanoramaxImages(projection2, context, dispatch14) },
54663       { id: "local-photos", layer: svgLocalPhotos(projection2, context, dispatch14) },
54664       { id: "debug", layer: svgDebug(projection2, context, dispatch14) },
54665       { id: "geolocate", layer: svgGeolocate(projection2, context, dispatch14) },
54666       { id: "touch", layer: svgTouch(projection2, context, dispatch14) }
54667     ];
54668     function drawLayers(selection2) {
54669       svg2 = selection2.selectAll(".surface").data([0]);
54670       svg2 = svg2.enter().append("svg").attr("class", "surface").merge(svg2);
54671       var defs = svg2.selectAll(".surface-defs").data([0]);
54672       defs.enter().append("defs").attr("class", "surface-defs");
54673       var groups = svg2.selectAll(".data-layer").data(_layers);
54674       groups.exit().remove();
54675       groups.enter().append("g").attr("class", function(d2) {
54676         return "data-layer " + d2.id;
54677       }).merge(groups).each(function(d2) {
54678         select_default2(this).call(d2.layer);
54679       });
54680     }
54681     drawLayers.all = function() {
54682       return _layers;
54683     };
54684     drawLayers.layer = function(id2) {
54685       var obj = _layers.find(function(o2) {
54686         return o2.id === id2;
54687       });
54688       return obj && obj.layer;
54689     };
54690     drawLayers.only = function(what) {
54691       var arr = [].concat(what);
54692       var all = _layers.map(function(layer) {
54693         return layer.id;
54694       });
54695       return drawLayers.remove(utilArrayDifference(all, arr));
54696     };
54697     drawLayers.remove = function(what) {
54698       var arr = [].concat(what);
54699       arr.forEach(function(id2) {
54700         _layers = _layers.filter(function(o2) {
54701           return o2.id !== id2;
54702         });
54703       });
54704       dispatch14.call("change");
54705       return this;
54706     };
54707     drawLayers.add = function(what) {
54708       var arr = [].concat(what);
54709       arr.forEach(function(obj) {
54710         if ("id" in obj && "layer" in obj) {
54711           _layers.push(obj);
54712         }
54713       });
54714       dispatch14.call("change");
54715       return this;
54716     };
54717     drawLayers.dimensions = function(val) {
54718       if (!arguments.length) return utilGetDimensions(svg2);
54719       utilSetDimensions(svg2, val);
54720       return this;
54721     };
54722     return utilRebind(drawLayers, dispatch14, "on");
54723   }
54724
54725   // modules/svg/lines.js
54726   var import_fast_deep_equal6 = __toESM(require_fast_deep_equal());
54727   function svgLines(projection2, context) {
54728     var detected = utilDetect();
54729     var highway_stack = {
54730       motorway: 0,
54731       motorway_link: 1,
54732       trunk: 2,
54733       trunk_link: 3,
54734       primary: 4,
54735       primary_link: 5,
54736       secondary: 6,
54737       tertiary: 7,
54738       unclassified: 8,
54739       residential: 9,
54740       service: 10,
54741       busway: 11,
54742       footway: 12
54743     };
54744     function drawTargets(selection2, graph, entities, filter2) {
54745       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
54746       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
54747       var getPath = svgPath(projection2).geojson;
54748       var activeID = context.activeID();
54749       var base = context.history().base();
54750       var data = { targets: [], nopes: [] };
54751       entities.forEach(function(way) {
54752         var features = svgSegmentWay(way, graph, activeID);
54753         data.targets.push.apply(data.targets, features.passive);
54754         data.nopes.push.apply(data.nopes, features.active);
54755       });
54756       var targetData = data.targets.filter(getPath);
54757       var targets = selection2.selectAll(".line.target-allowed").filter(function(d2) {
54758         return filter2(d2.properties.entity);
54759       }).data(targetData, function key(d2) {
54760         return d2.id;
54761       });
54762       targets.exit().remove();
54763       var segmentWasEdited = function(d2) {
54764         var wayID = d2.properties.entity.id;
54765         if (!base.entities[wayID] || !(0, import_fast_deep_equal6.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
54766           return false;
54767         }
54768         return d2.properties.nodes.some(function(n3) {
54769           return !base.entities[n3.id] || !(0, import_fast_deep_equal6.default)(graph.entities[n3.id].loc, base.entities[n3.id].loc);
54770         });
54771       };
54772       targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d2) {
54773         return "way line target target-allowed " + targetClass + d2.id;
54774       }).classed("segment-edited", segmentWasEdited);
54775       var nopeData = data.nopes.filter(getPath);
54776       var nopes = selection2.selectAll(".line.target-nope").filter(function(d2) {
54777         return filter2(d2.properties.entity);
54778       }).data(nopeData, function key(d2) {
54779         return d2.id;
54780       });
54781       nopes.exit().remove();
54782       nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d2) {
54783         return "way line target target-nope " + nopeClass + d2.id;
54784       }).classed("segment-edited", segmentWasEdited);
54785     }
54786     function drawLines(selection2, graph, entities, filter2) {
54787       var base = context.history().base();
54788       function waystack(a2, b2) {
54789         var selected = context.selectedIDs();
54790         var scoreA = selected.indexOf(a2.id) !== -1 ? 20 : 0;
54791         var scoreB = selected.indexOf(b2.id) !== -1 ? 20 : 0;
54792         if (a2.tags.highway) {
54793           scoreA -= highway_stack[a2.tags.highway];
54794         }
54795         if (b2.tags.highway) {
54796           scoreB -= highway_stack[b2.tags.highway];
54797         }
54798         return scoreA - scoreB;
54799       }
54800       function drawLineGroup(selection3, klass, isSelected) {
54801         var mode = context.mode();
54802         var isDrawing = mode && /^draw/.test(mode.id);
54803         var selectedClass = !isDrawing && isSelected ? "selected " : "";
54804         var lines = selection3.selectAll("path").filter(filter2).data(getPathData(isSelected), osmEntity.key);
54805         lines.exit().remove();
54806         lines.enter().append("path").attr("class", function(d2) {
54807           var prefix = "way line";
54808           if (!d2.hasInterestingTags()) {
54809             var parentRelations = graph.parentRelations(d2);
54810             var parentMultipolygons = parentRelations.filter(function(relation) {
54811               return relation.isMultipolygon();
54812             });
54813             if (parentMultipolygons.length > 0 && // and only multipolygon relations
54814             parentRelations.length === parentMultipolygons.length) {
54815               prefix = "relation area";
54816             }
54817           }
54818           var oldMPClass = oldMultiPolygonOuters[d2.id] ? "old-multipolygon " : "";
54819           return prefix + " " + klass + " " + selectedClass + oldMPClass + d2.id;
54820         }).classed("added", function(d2) {
54821           return !base.entities[d2.id];
54822         }).classed("geometry-edited", function(d2) {
54823           return graph.entities[d2.id] && base.entities[d2.id] && !(0, import_fast_deep_equal6.default)(graph.entities[d2.id].nodes, base.entities[d2.id].nodes);
54824         }).classed("retagged", function(d2) {
54825           return graph.entities[d2.id] && base.entities[d2.id] && !(0, import_fast_deep_equal6.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
54826         }).call(svgTagClasses()).merge(lines).sort(waystack).attr("d", getPath).call(svgTagClasses().tags(svgRelationMemberTags(graph)));
54827         return selection3;
54828       }
54829       function getPathData(isSelected) {
54830         return function() {
54831           var layer = this.parentNode.__data__;
54832           var data = pathdata[layer] || [];
54833           return data.filter(function(d2) {
54834             if (isSelected) {
54835               return context.selectedIDs().indexOf(d2.id) !== -1;
54836             } else {
54837               return context.selectedIDs().indexOf(d2.id) === -1;
54838             }
54839           });
54840         };
54841       }
54842       function addMarkers(layergroup, pathclass, groupclass, groupdata, marker) {
54843         var markergroup = layergroup.selectAll("g." + groupclass).data([pathclass]);
54844         markergroup = markergroup.enter().append("g").attr("class", groupclass).merge(markergroup);
54845         var markers = markergroup.selectAll("path").filter(filter2).data(
54846           function data() {
54847             return groupdata[this.parentNode.__data__] || [];
54848           },
54849           function key(d2) {
54850             return [d2.id, d2.index];
54851           }
54852         );
54853         markers.exit().remove();
54854         markers = markers.enter().append("path").attr("class", pathclass).merge(markers).attr("marker-mid", marker).attr("d", function(d2) {
54855           return d2.d;
54856         });
54857         if (detected.ie) {
54858           markers.each(function() {
54859             this.parentNode.insertBefore(this, this);
54860           });
54861         }
54862       }
54863       var getPath = svgPath(projection2, graph);
54864       var ways = [];
54865       var onewaydata = {};
54866       var sideddata = {};
54867       var oldMultiPolygonOuters = {};
54868       for (var i3 = 0; i3 < entities.length; i3++) {
54869         var entity = entities[i3];
54870         if (entity.geometry(graph) === "line" || entity.geometry(graph) === "area" && entity.sidednessIdentifier && entity.sidednessIdentifier() === "coastline") {
54871           ways.push(entity);
54872         }
54873       }
54874       ways = ways.filter(getPath);
54875       var pathdata = utilArrayGroupBy(ways, function(way) {
54876         return way.layer();
54877       });
54878       Object.keys(pathdata).forEach(function(k2) {
54879         var v2 = pathdata[k2];
54880         var onewayArr = v2.filter(function(d2) {
54881           return d2.isOneWay();
54882         });
54883         var onewaySegments = svgMarkerSegments(
54884           projection2,
54885           graph,
54886           35,
54887           function shouldReverse(entity2) {
54888             return entity2.tags.oneway === "-1" || entity2.tags.conveying === "backward";
54889           },
54890           function bothDirections(entity2) {
54891             return entity2.tags.oneway === "alternating" || entity2.tags.oneway === "reversible" || entity2.tags.conveying === "reversible";
54892           }
54893         );
54894         onewaydata[k2] = utilArrayFlatten(onewayArr.map(onewaySegments));
54895         var sidedArr = v2.filter(function(d2) {
54896           return d2.isSided();
54897         });
54898         var sidedSegments = svgMarkerSegments(
54899           projection2,
54900           graph,
54901           30,
54902           function shouldReverse() {
54903             return false;
54904           },
54905           function bothDirections() {
54906             return false;
54907           }
54908         );
54909         sideddata[k2] = utilArrayFlatten(sidedArr.map(sidedSegments));
54910       });
54911       var covered = selection2.selectAll(".layer-osm.covered");
54912       var uncovered = selection2.selectAll(".layer-osm.lines");
54913       var touchLayer = selection2.selectAll(".layer-touch.lines");
54914       [covered, uncovered].forEach(function(selection3) {
54915         var range3 = selection3 === covered ? range(-10, 0) : range(0, 11);
54916         var layergroup = selection3.selectAll("g.layergroup").data(range3);
54917         layergroup = layergroup.enter().append("g").attr("class", function(d2) {
54918           return "layergroup layer" + String(d2);
54919         }).merge(layergroup);
54920         layergroup.selectAll("g.linegroup").data(["shadow", "casing", "stroke", "shadow-highlighted", "casing-highlighted", "stroke-highlighted"]).enter().append("g").attr("class", function(d2) {
54921           return "linegroup line-" + d2;
54922         });
54923         layergroup.selectAll("g.line-shadow").call(drawLineGroup, "shadow", false);
54924         layergroup.selectAll("g.line-casing").call(drawLineGroup, "casing", false);
54925         layergroup.selectAll("g.line-stroke").call(drawLineGroup, "stroke", false);
54926         layergroup.selectAll("g.line-shadow-highlighted").call(drawLineGroup, "shadow", true);
54927         layergroup.selectAll("g.line-casing-highlighted").call(drawLineGroup, "casing", true);
54928         layergroup.selectAll("g.line-stroke-highlighted").call(drawLineGroup, "stroke", true);
54929         addMarkers(layergroup, "oneway", "onewaygroup", onewaydata, "url(#ideditor-oneway-marker)");
54930         addMarkers(
54931           layergroup,
54932           "sided",
54933           "sidedgroup",
54934           sideddata,
54935           function marker(d2) {
54936             var category = graph.entity(d2.id).sidednessIdentifier();
54937             return "url(#ideditor-sided-marker-" + category + ")";
54938           }
54939         );
54940       });
54941       touchLayer.call(drawTargets, graph, ways, filter2);
54942     }
54943     return drawLines;
54944   }
54945
54946   // modules/svg/midpoints.js
54947   function svgMidpoints(projection2, context) {
54948     var targetRadius = 8;
54949     function drawTargets(selection2, graph, entities, filter2) {
54950       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
54951       var getTransform = svgPointTransform(projection2).geojson;
54952       var data = entities.map(function(midpoint) {
54953         return {
54954           type: "Feature",
54955           id: midpoint.id,
54956           properties: {
54957             target: true,
54958             entity: midpoint
54959           },
54960           geometry: {
54961             type: "Point",
54962             coordinates: midpoint.loc
54963           }
54964         };
54965       });
54966       var targets = selection2.selectAll(".midpoint.target").filter(function(d2) {
54967         return filter2(d2.properties.entity);
54968       }).data(data, function key(d2) {
54969         return d2.id;
54970       });
54971       targets.exit().remove();
54972       targets.enter().append("circle").attr("r", targetRadius).merge(targets).attr("class", function(d2) {
54973         return "node midpoint target " + fillClass + d2.id;
54974       }).attr("transform", getTransform);
54975     }
54976     function drawMidpoints(selection2, graph, entities, filter2, extent) {
54977       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.midpoints");
54978       var touchLayer = selection2.selectAll(".layer-touch.points");
54979       var mode = context.mode();
54980       if (mode && mode.id !== "select" || !context.map().withinEditableZoom()) {
54981         drawLayer.selectAll(".midpoint").remove();
54982         touchLayer.selectAll(".midpoint.target").remove();
54983         return;
54984       }
54985       var poly = extent.polygon();
54986       var midpoints = {};
54987       for (var i3 = 0; i3 < entities.length; i3++) {
54988         var entity = entities[i3];
54989         if (entity.type !== "way") continue;
54990         if (!filter2(entity)) continue;
54991         if (context.selectedIDs().indexOf(entity.id) < 0) continue;
54992         var nodes = graph.childNodes(entity);
54993         for (var j2 = 0; j2 < nodes.length - 1; j2++) {
54994           var a2 = nodes[j2];
54995           var b2 = nodes[j2 + 1];
54996           var id2 = [a2.id, b2.id].sort().join("-");
54997           if (midpoints[id2]) {
54998             midpoints[id2].parents.push(entity);
54999           } else if (geoVecLength(projection2(a2.loc), projection2(b2.loc)) > 40) {
55000             var point = geoVecInterp(a2.loc, b2.loc, 0.5);
55001             var loc = null;
55002             if (extent.intersects(point)) {
55003               loc = point;
55004             } else {
55005               for (var k2 = 0; k2 < 4; k2++) {
55006                 point = geoLineIntersection([a2.loc, b2.loc], [poly[k2], poly[k2 + 1]]);
55007                 if (point && geoVecLength(projection2(a2.loc), projection2(point)) > 20 && geoVecLength(projection2(b2.loc), projection2(point)) > 20) {
55008                   loc = point;
55009                   break;
55010                 }
55011               }
55012             }
55013             if (loc) {
55014               midpoints[id2] = {
55015                 type: "midpoint",
55016                 id: id2,
55017                 loc,
55018                 edge: [a2.id, b2.id],
55019                 parents: [entity]
55020               };
55021             }
55022           }
55023         }
55024       }
55025       function midpointFilter(d2) {
55026         if (midpoints[d2.id]) return true;
55027         for (var i4 = 0; i4 < d2.parents.length; i4++) {
55028           if (filter2(d2.parents[i4])) {
55029             return true;
55030           }
55031         }
55032         return false;
55033       }
55034       var groups = drawLayer.selectAll(".midpoint").filter(midpointFilter).data(Object.values(midpoints), function(d2) {
55035         return d2.id;
55036       });
55037       groups.exit().remove();
55038       var enter = groups.enter().insert("g", ":first-child").attr("class", "midpoint");
55039       enter.append("polygon").attr("points", "-6,8 10,0 -6,-8").attr("class", "shadow");
55040       enter.append("polygon").attr("points", "-3,4 5,0 -3,-4").attr("class", "fill");
55041       groups = groups.merge(enter).attr("transform", function(d2) {
55042         var translate = svgPointTransform(projection2);
55043         var a3 = graph.entity(d2.edge[0]);
55044         var b3 = graph.entity(d2.edge[1]);
55045         var angle2 = geoAngle(a3, b3, projection2) * (180 / Math.PI);
55046         return translate(d2) + " rotate(" + angle2 + ")";
55047       }).call(svgTagClasses().tags(
55048         function(d2) {
55049           return d2.parents[0].tags;
55050         }
55051       ));
55052       groups.select("polygon.shadow");
55053       groups.select("polygon.fill");
55054       touchLayer.call(drawTargets, graph, Object.values(midpoints), midpointFilter);
55055     }
55056     return drawMidpoints;
55057   }
55058
55059   // modules/svg/points.js
55060   var import_fast_deep_equal7 = __toESM(require_fast_deep_equal());
55061   function svgPoints(projection2, context) {
55062     function markerPath(selection2, klass) {
55063       selection2.attr("class", klass).attr("transform", "translate(-8, -23)").attr("d", "M 17,8 C 17,13 11,21 8.5,23.5 C 6,21 0,13 0,8 C 0,4 4,-0.5 8.5,-0.5 C 13,-0.5 17,4 17,8 z");
55064     }
55065     function sortY(a2, b2) {
55066       return b2.loc[1] - a2.loc[1];
55067     }
55068     function fastEntityKey(d2) {
55069       var mode = context.mode();
55070       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
55071       return isMoving ? d2.id : osmEntity.key(d2);
55072     }
55073     function drawTargets(selection2, graph, entities, filter2) {
55074       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
55075       var getTransform = svgPointTransform(projection2).geojson;
55076       var activeID = context.activeID();
55077       var data = [];
55078       entities.forEach(function(node) {
55079         if (activeID === node.id) return;
55080         data.push({
55081           type: "Feature",
55082           id: node.id,
55083           properties: {
55084             target: true,
55085             entity: node
55086           },
55087           geometry: node.asGeoJSON()
55088         });
55089       });
55090       var targets = selection2.selectAll(".point.target").filter(function(d2) {
55091         return filter2(d2.properties.entity);
55092       }).data(data, function key(d2) {
55093         return d2.id;
55094       });
55095       targets.exit().remove();
55096       targets.enter().append("rect").attr("x", -10).attr("y", -26).attr("width", 20).attr("height", 30).merge(targets).attr("class", function(d2) {
55097         return "node point target " + fillClass + d2.id;
55098       }).attr("transform", getTransform);
55099     }
55100     function drawPoints(selection2, graph, entities, filter2) {
55101       var wireframe = context.surface().classed("fill-wireframe");
55102       var zoom = geoScaleToZoom(projection2.scale());
55103       var base = context.history().base();
55104       function renderAsPoint(entity) {
55105         return entity.geometry(graph) === "point" && !(zoom >= 18 && entity.directions(graph, projection2).length);
55106       }
55107       var points = wireframe ? [] : entities.filter(renderAsPoint);
55108       points.sort(sortY);
55109       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.points");
55110       var touchLayer = selection2.selectAll(".layer-touch.points");
55111       var groups = drawLayer.selectAll("g.point").filter(filter2).data(points, fastEntityKey);
55112       groups.exit().remove();
55113       var enter = groups.enter().append("g").attr("class", function(d2) {
55114         return "node point " + d2.id;
55115       }).order();
55116       enter.append("path").call(markerPath, "shadow");
55117       enter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
55118       enter.append("path").call(markerPath, "stroke");
55119       enter.append("use").attr("transform", "translate(-5.5, -20)").attr("class", "icon").attr("width", "12px").attr("height", "12px");
55120       groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("added", function(d2) {
55121         return !base.entities[d2.id];
55122       }).classed("moved", function(d2) {
55123         return base.entities[d2.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d2.id].loc, base.entities[d2.id].loc);
55124       }).classed("retagged", function(d2) {
55125         return base.entities[d2.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
55126       }).call(svgTagClasses());
55127       groups.select(".shadow");
55128       groups.select(".stroke");
55129       groups.select(".icon").attr("xlink:href", function(entity) {
55130         var preset = _mainPresetIndex.match(entity, graph);
55131         var picon = preset && preset.icon;
55132         return picon ? "#" + picon : "";
55133       });
55134       touchLayer.call(drawTargets, graph, points, filter2);
55135     }
55136     return drawPoints;
55137   }
55138
55139   // modules/svg/turns.js
55140   function svgTurns(projection2, context) {
55141     function icon2(turn) {
55142       var u2 = turn.u ? "-u" : "";
55143       if (turn.no) return "#iD-turn-no" + u2;
55144       if (turn.only) return "#iD-turn-only" + u2;
55145       return "#iD-turn-yes" + u2;
55146     }
55147     function drawTurns(selection2, graph, turns) {
55148       function turnTransform(d2) {
55149         var pxRadius = 50;
55150         var toWay = graph.entity(d2.to.way);
55151         var toPoints = graph.childNodes(toWay).map(function(n3) {
55152           return n3.loc;
55153         }).map(projection2);
55154         var toLength = geoPathLength(toPoints);
55155         var mid = toLength / 2;
55156         var toNode = graph.entity(d2.to.node);
55157         var toVertex = graph.entity(d2.to.vertex);
55158         var a2 = geoAngle(toVertex, toNode, projection2);
55159         var o2 = projection2(toVertex.loc);
55160         var r2 = d2.u ? 0 : !toWay.__via ? pxRadius : Math.min(mid, pxRadius);
55161         return "translate(" + (r2 * Math.cos(a2) + o2[0]) + "," + (r2 * Math.sin(a2) + o2[1]) + ") rotate(" + a2 * 180 / Math.PI + ")";
55162       }
55163       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.turns");
55164       var touchLayer = selection2.selectAll(".layer-touch.turns");
55165       var groups = drawLayer.selectAll("g.turn").data(turns, function(d2) {
55166         return d2.key;
55167       });
55168       groups.exit().remove();
55169       var groupsEnter = groups.enter().append("g").attr("class", function(d2) {
55170         return "turn " + d2.key;
55171       });
55172       var turnsEnter = groupsEnter.filter(function(d2) {
55173         return !d2.u;
55174       });
55175       turnsEnter.append("rect").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
55176       turnsEnter.append("use").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
55177       var uEnter = groupsEnter.filter(function(d2) {
55178         return d2.u;
55179       });
55180       uEnter.append("circle").attr("r", "16");
55181       uEnter.append("use").attr("transform", "translate(-16, -16)").attr("width", "32").attr("height", "32");
55182       groups = groups.merge(groupsEnter).attr("opacity", function(d2) {
55183         return d2.direct === false ? "0.7" : null;
55184       }).attr("transform", turnTransform);
55185       groups.select("use").attr("xlink:href", icon2);
55186       groups.select("rect");
55187       groups.select("circle");
55188       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
55189       groups = touchLayer.selectAll("g.turn").data(turns, function(d2) {
55190         return d2.key;
55191       });
55192       groups.exit().remove();
55193       groupsEnter = groups.enter().append("g").attr("class", function(d2) {
55194         return "turn " + d2.key;
55195       });
55196       turnsEnter = groupsEnter.filter(function(d2) {
55197         return !d2.u;
55198       });
55199       turnsEnter.append("rect").attr("class", "target " + fillClass).attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
55200       uEnter = groupsEnter.filter(function(d2) {
55201         return d2.u;
55202       });
55203       uEnter.append("circle").attr("class", "target " + fillClass).attr("r", "16");
55204       groups = groups.merge(groupsEnter).attr("transform", turnTransform);
55205       groups.select("rect");
55206       groups.select("circle");
55207       return this;
55208     }
55209     return drawTurns;
55210   }
55211
55212   // modules/svg/vertices.js
55213   var import_fast_deep_equal8 = __toESM(require_fast_deep_equal());
55214   function svgVertices(projection2, context) {
55215     var radiuses = {
55216       //       z16-, z17,   z18+,  w/icon
55217       shadow: [6, 7.5, 7.5, 12],
55218       stroke: [2.5, 3.5, 3.5, 8],
55219       fill: [1, 1.5, 1.5, 1.5]
55220     };
55221     var _currHoverTarget;
55222     var _currPersistent = {};
55223     var _currHover = {};
55224     var _prevHover = {};
55225     var _currSelected = {};
55226     var _prevSelected = {};
55227     var _radii = {};
55228     function sortY(a2, b2) {
55229       return b2.loc[1] - a2.loc[1];
55230     }
55231     function fastEntityKey(d2) {
55232       var mode = context.mode();
55233       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
55234       return isMoving ? d2.id : osmEntity.key(d2);
55235     }
55236     function draw(selection2, graph, vertices, sets2, filter2) {
55237       sets2 = sets2 || { selected: {}, important: {}, hovered: {} };
55238       var icons = {};
55239       var directions = {};
55240       var wireframe = context.surface().classed("fill-wireframe");
55241       var zoom = geoScaleToZoom(projection2.scale());
55242       var z2 = zoom < 17 ? 0 : zoom < 18 ? 1 : 2;
55243       var activeID = context.activeID();
55244       var base = context.history().base();
55245       function getIcon(d2) {
55246         var entity = graph.entity(d2.id);
55247         if (entity.id in icons) return icons[entity.id];
55248         icons[entity.id] = entity.hasInterestingTags() && _mainPresetIndex.match(entity, graph).icon;
55249         return icons[entity.id];
55250       }
55251       function getDirections(entity) {
55252         if (entity.id in directions) return directions[entity.id];
55253         var angles = entity.directions(graph, projection2);
55254         directions[entity.id] = angles.length ? angles : false;
55255         return angles;
55256       }
55257       function updateAttributes(selection3) {
55258         ["shadow", "stroke", "fill"].forEach(function(klass) {
55259           var rads = radiuses[klass];
55260           selection3.selectAll("." + klass).each(function(entity) {
55261             var i3 = z2 && getIcon(entity);
55262             var r2 = rads[i3 ? 3 : z2];
55263             if (entity.id !== activeID && entity.isEndpoint(graph) && !entity.isConnected(graph)) {
55264               r2 += 1.5;
55265             }
55266             if (klass === "shadow") {
55267               _radii[entity.id] = r2;
55268             }
55269             select_default2(this).attr("r", r2).attr("visibility", i3 && klass === "fill" ? "hidden" : null);
55270           });
55271         });
55272       }
55273       vertices.sort(sortY);
55274       var groups = selection2.selectAll("g.vertex").filter(filter2).data(vertices, fastEntityKey);
55275       groups.exit().remove();
55276       var enter = groups.enter().append("g").attr("class", function(d2) {
55277         return "node vertex " + d2.id;
55278       }).order();
55279       enter.append("circle").attr("class", "shadow");
55280       enter.append("circle").attr("class", "stroke");
55281       enter.filter(function(d2) {
55282         return d2.hasInterestingTags();
55283       }).append("circle").attr("class", "fill");
55284       groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("sibling", function(d2) {
55285         return d2.id in sets2.selected;
55286       }).classed("shared", function(d2) {
55287         return graph.isShared(d2);
55288       }).classed("endpoint", function(d2) {
55289         return d2.isEndpoint(graph);
55290       }).classed("added", function(d2) {
55291         return !base.entities[d2.id];
55292       }).classed("moved", function(d2) {
55293         return base.entities[d2.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d2.id].loc, base.entities[d2.id].loc);
55294       }).classed("retagged", function(d2) {
55295         return base.entities[d2.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
55296       }).call(svgTagClasses()).call(updateAttributes);
55297       var iconUse = groups.selectAll(".icon").data(function data(d2) {
55298         return zoom >= 17 && getIcon(d2) ? [d2] : [];
55299       }, fastEntityKey);
55300       iconUse.exit().remove();
55301       iconUse.enter().append("use").attr("class", "icon").attr("width", "12px").attr("height", "12px").attr("transform", "translate(-6, -6)").attr("xlink:href", function(d2) {
55302         var picon = getIcon(d2);
55303         return picon ? "#" + picon : "";
55304       });
55305       var dgroups = groups.selectAll(".viewfieldgroup").data(function data(d2) {
55306         return zoom >= 18 && getDirections(d2) ? [d2] : [];
55307       }, fastEntityKey);
55308       dgroups.exit().remove();
55309       dgroups = dgroups.enter().insert("g", ".shadow").attr("class", "viewfieldgroup").merge(dgroups);
55310       var viewfields = dgroups.selectAll(".viewfield").data(getDirections, function key(d2) {
55311         return osmEntity.key(d2);
55312       });
55313       viewfields.exit().remove();
55314       viewfields.enter().append("path").attr("class", "viewfield").attr("d", "M0,0H0").merge(viewfields).attr("marker-start", "url(#ideditor-viewfield-marker" + (wireframe ? "-wireframe" : "") + ")").attr("transform", function(d2) {
55315         return "rotate(" + d2 + ")";
55316       });
55317     }
55318     function drawTargets(selection2, graph, entities, filter2) {
55319       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
55320       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
55321       var getTransform = svgPointTransform(projection2).geojson;
55322       var activeID = context.activeID();
55323       var data = { targets: [], nopes: [] };
55324       entities.forEach(function(node) {
55325         if (activeID === node.id) return;
55326         var vertexType = svgPassiveVertex(node, graph, activeID);
55327         if (vertexType !== 0) {
55328           data.targets.push({
55329             type: "Feature",
55330             id: node.id,
55331             properties: {
55332               target: true,
55333               entity: node
55334             },
55335             geometry: node.asGeoJSON()
55336           });
55337         } else {
55338           data.nopes.push({
55339             type: "Feature",
55340             id: node.id + "-nope",
55341             properties: {
55342               nope: true,
55343               target: true,
55344               entity: node
55345             },
55346             geometry: node.asGeoJSON()
55347           });
55348         }
55349       });
55350       var targets = selection2.selectAll(".vertex.target-allowed").filter(function(d2) {
55351         return filter2(d2.properties.entity);
55352       }).data(data.targets, function key(d2) {
55353         return d2.id;
55354       });
55355       targets.exit().remove();
55356       targets.enter().append("circle").attr("r", function(d2) {
55357         return _radii[d2.id] || radiuses.shadow[3];
55358       }).merge(targets).attr("class", function(d2) {
55359         return "node vertex target target-allowed " + targetClass + d2.id;
55360       }).attr("transform", getTransform);
55361       var nopes = selection2.selectAll(".vertex.target-nope").filter(function(d2) {
55362         return filter2(d2.properties.entity);
55363       }).data(data.nopes, function key(d2) {
55364         return d2.id;
55365       });
55366       nopes.exit().remove();
55367       nopes.enter().append("circle").attr("r", function(d2) {
55368         return _radii[d2.properties.entity.id] || radiuses.shadow[3];
55369       }).merge(nopes).attr("class", function(d2) {
55370         return "node vertex target target-nope " + nopeClass + d2.id;
55371       }).attr("transform", getTransform);
55372     }
55373     function renderAsVertex(entity, graph, wireframe, zoom) {
55374       var geometry = entity.geometry(graph);
55375       return geometry === "vertex" || geometry === "point" && (wireframe || zoom >= 18 && entity.directions(graph, projection2).length);
55376     }
55377     function isEditedNode(node, base, head) {
55378       var baseNode = base.entities[node.id];
55379       var headNode = head.entities[node.id];
55380       return !headNode || !baseNode || !(0, import_fast_deep_equal8.default)(headNode.tags, baseNode.tags) || !(0, import_fast_deep_equal8.default)(headNode.loc, baseNode.loc);
55381     }
55382     function getSiblingAndChildVertices(ids, graph, wireframe, zoom) {
55383       var results = {};
55384       var seenIds = {};
55385       function addChildVertices(entity) {
55386         if (seenIds[entity.id]) return;
55387         seenIds[entity.id] = true;
55388         var geometry = entity.geometry(graph);
55389         if (!context.features().isHiddenFeature(entity, graph, geometry)) {
55390           var i3;
55391           if (entity.type === "way") {
55392             for (i3 = 0; i3 < entity.nodes.length; i3++) {
55393               var child = graph.hasEntity(entity.nodes[i3]);
55394               if (child) {
55395                 addChildVertices(child);
55396               }
55397             }
55398           } else if (entity.type === "relation") {
55399             for (i3 = 0; i3 < entity.members.length; i3++) {
55400               var member = graph.hasEntity(entity.members[i3].id);
55401               if (member) {
55402                 addChildVertices(member);
55403               }
55404             }
55405           } else if (renderAsVertex(entity, graph, wireframe, zoom)) {
55406             results[entity.id] = entity;
55407           }
55408         }
55409       }
55410       ids.forEach(function(id2) {
55411         var entity = graph.hasEntity(id2);
55412         if (!entity) return;
55413         if (entity.type === "node") {
55414           if (renderAsVertex(entity, graph, wireframe, zoom)) {
55415             results[entity.id] = entity;
55416             graph.parentWays(entity).forEach(function(entity2) {
55417               addChildVertices(entity2);
55418             });
55419           }
55420         } else {
55421           addChildVertices(entity);
55422         }
55423       });
55424       return results;
55425     }
55426     function drawVertices(selection2, graph, entities, filter2, extent, fullRedraw) {
55427       var wireframe = context.surface().classed("fill-wireframe");
55428       var visualDiff = context.surface().classed("highlight-edited");
55429       var zoom = geoScaleToZoom(projection2.scale());
55430       var mode = context.mode();
55431       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
55432       var base = context.history().base();
55433       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.vertices");
55434       var touchLayer = selection2.selectAll(".layer-touch.points");
55435       if (fullRedraw) {
55436         _currPersistent = {};
55437         _radii = {};
55438       }
55439       for (var i3 = 0; i3 < entities.length; i3++) {
55440         var entity = entities[i3];
55441         var geometry = entity.geometry(graph);
55442         var keep = false;
55443         if (geometry === "point" && renderAsVertex(entity, graph, wireframe, zoom)) {
55444           _currPersistent[entity.id] = entity;
55445           keep = true;
55446         } else if (geometry === "vertex" && (entity.hasInterestingTags() || entity.isEndpoint(graph) || entity.isConnected(graph) || visualDiff && isEditedNode(entity, base, graph))) {
55447           _currPersistent[entity.id] = entity;
55448           keep = true;
55449         }
55450         if (!keep && !fullRedraw) {
55451           delete _currPersistent[entity.id];
55452         }
55453       }
55454       var sets2 = {
55455         persistent: _currPersistent,
55456         // persistent = important vertices (render always)
55457         selected: _currSelected,
55458         // selected + siblings of selected (render always)
55459         hovered: _currHover
55460         // hovered + siblings of hovered (render only in draw modes)
55461       };
55462       var all = Object.assign({}, isMoving ? _currHover : {}, _currSelected, _currPersistent);
55463       var filterRendered = function(d2) {
55464         return d2.id in _currPersistent || d2.id in _currSelected || d2.id in _currHover || filter2(d2);
55465       };
55466       drawLayer.call(draw, graph, currentVisible(all), sets2, filterRendered);
55467       var filterTouch = function(d2) {
55468         return isMoving ? true : filterRendered(d2);
55469       };
55470       touchLayer.call(drawTargets, graph, currentVisible(all), filterTouch);
55471       function currentVisible(which) {
55472         return Object.keys(which).map(graph.hasEntity, graph).filter(function(entity2) {
55473           return entity2 && entity2.intersects(extent, graph);
55474         });
55475       }
55476     }
55477     drawVertices.drawSelected = function(selection2, graph, extent) {
55478       var wireframe = context.surface().classed("fill-wireframe");
55479       var zoom = geoScaleToZoom(projection2.scale());
55480       _prevSelected = _currSelected || {};
55481       if (context.map().isInWideSelection()) {
55482         _currSelected = {};
55483         context.selectedIDs().forEach(function(id2) {
55484           var entity = graph.hasEntity(id2);
55485           if (!entity) return;
55486           if (entity.type === "node") {
55487             if (renderAsVertex(entity, graph, wireframe, zoom)) {
55488               _currSelected[entity.id] = entity;
55489             }
55490           }
55491         });
55492       } else {
55493         _currSelected = getSiblingAndChildVertices(context.selectedIDs(), graph, wireframe, zoom);
55494       }
55495       var filter2 = function(d2) {
55496         return d2.id in _prevSelected;
55497       };
55498       drawVertices(selection2, graph, Object.values(_prevSelected), filter2, extent, false);
55499     };
55500     drawVertices.drawHover = function(selection2, graph, target, extent) {
55501       if (target === _currHoverTarget) return;
55502       var wireframe = context.surface().classed("fill-wireframe");
55503       var zoom = geoScaleToZoom(projection2.scale());
55504       _prevHover = _currHover || {};
55505       _currHoverTarget = target;
55506       var entity = target && target.properties && target.properties.entity;
55507       if (entity) {
55508         _currHover = getSiblingAndChildVertices([entity.id], graph, wireframe, zoom);
55509       } else {
55510         _currHover = {};
55511       }
55512       var filter2 = function(d2) {
55513         return d2.id in _prevHover;
55514       };
55515       drawVertices(selection2, graph, Object.values(_prevHover), filter2, extent, false);
55516     };
55517     return drawVertices;
55518   }
55519
55520   // modules/ui/length_indicator.js
55521   function uiLengthIndicator(maxChars) {
55522     var _wrap = select_default2(null);
55523     var _tooltip = uiPopover("tooltip max-length-warning").placement("bottom").hasArrow(true).content(() => (selection2) => {
55524       selection2.text("");
55525       selection2.call(svgIcon("#iD-icon-alert", "inline"));
55526       selection2.call(_t.append("inspector.max_length_reached", { maxChars }));
55527     });
55528     var _silent = false;
55529     var lengthIndicator = function(selection2) {
55530       _wrap = selection2.selectAll("span.length-indicator-wrap").data([0]);
55531       _wrap = _wrap.enter().append("span").merge(_wrap).classed("length-indicator-wrap", true);
55532       selection2.call(_tooltip);
55533     };
55534     lengthIndicator.update = function(val) {
55535       const strLen = utilUnicodeCharsCount(utilCleanOsmString(val, Number.POSITIVE_INFINITY));
55536       let indicator = _wrap.selectAll("span.length-indicator").data([strLen]);
55537       indicator.enter().append("span").merge(indicator).classed("length-indicator", true).classed("limit-reached", (d2) => d2 > maxChars).style("border-right-width", (d2) => "".concat(Math.abs(maxChars - d2) * 2, "px")).style("margin-right", (d2) => d2 > maxChars ? "".concat((maxChars - d2) * 2, "px") : 0).style("opacity", (d2) => d2 > maxChars * 0.8 ? Math.min(1, (d2 / maxChars - 0.8) / (1 - 0.8)) : 0).style("pointer-events", (d2) => d2 > maxChars * 0.8 ? null : "none");
55538       if (_silent) return;
55539       if (strLen > maxChars) {
55540         _tooltip.show();
55541       } else {
55542         _tooltip.hide();
55543       }
55544     };
55545     lengthIndicator.silent = function(val) {
55546       if (!arguments.length) return _silent;
55547       _silent = val;
55548       return lengthIndicator;
55549     };
55550     return lengthIndicator;
55551   }
55552
55553   // modules/ui/fields/combo.js
55554   function uiFieldCombo(field, context) {
55555     var dispatch14 = dispatch_default("change");
55556     var _isMulti = field.type === "multiCombo" || field.type === "manyCombo";
55557     var _isNetwork = field.type === "networkCombo";
55558     var _isSemi = field.type === "semiCombo";
55559     var _showTagInfoSuggestions = field.type !== "manyCombo" && field.autoSuggestions !== false;
55560     var _allowCustomValues = field.type !== "manyCombo" && field.customValues !== false;
55561     var _snake_case = field.snake_case || field.snake_case === void 0;
55562     var _combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(field.caseSensitive).minItems(1);
55563     var _container = select_default2(null);
55564     var _inputWrap = select_default2(null);
55565     var _input = select_default2(null);
55566     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
55567     var _comboData = [];
55568     var _multiData = [];
55569     var _entityIDs = [];
55570     var _tags;
55571     var _countryCode;
55572     var _staticPlaceholder;
55573     var _dataDeprecated = [];
55574     _mainFileFetcher.get("deprecated").then(function(d2) {
55575       _dataDeprecated = d2;
55576     }).catch(function() {
55577     });
55578     if (_isMulti && field.key && /[^:]$/.test(field.key)) {
55579       field.key += ":";
55580     }
55581     function snake(s2) {
55582       return s2.replace(/\s+/g, "_");
55583     }
55584     function clean2(s2) {
55585       return s2.split(";").map(function(s3) {
55586         return s3.trim();
55587       }).join(";");
55588     }
55589     function tagValue(dval) {
55590       dval = clean2(dval || "");
55591       var found = getOptions(true).find(function(o2) {
55592         return o2.key && clean2(o2.value) === dval;
55593       });
55594       if (found) return found.key;
55595       if (field.type === "typeCombo" && !dval) {
55596         return "yes";
55597       }
55598       return restrictTagValueSpelling(dval) || void 0;
55599     }
55600     function restrictTagValueSpelling(dval) {
55601       if (_snake_case) {
55602         dval = snake(dval);
55603       }
55604       if (!field.caseSensitive) {
55605         dval = dval.toLowerCase();
55606       }
55607       return dval;
55608     }
55609     function getLabelId(field2, v2) {
55610       return field2.hasTextForStringId("options.".concat(v2, ".title")) ? "options.".concat(v2, ".title") : "options.".concat(v2);
55611     }
55612     function displayValue(tval) {
55613       tval = tval || "";
55614       var stringsField = field.resolveReference("stringsCrossReference");
55615       const labelId = getLabelId(stringsField, tval);
55616       if (stringsField.hasTextForStringId(labelId)) {
55617         return stringsField.t(labelId, { default: tval });
55618       }
55619       if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
55620         return "";
55621       }
55622       return tval;
55623     }
55624     function renderValue(tval) {
55625       tval = tval || "";
55626       var stringsField = field.resolveReference("stringsCrossReference");
55627       const labelId = getLabelId(stringsField, tval);
55628       if (stringsField.hasTextForStringId(labelId)) {
55629         return stringsField.t.append(labelId, { default: tval });
55630       }
55631       if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
55632         tval = "";
55633       }
55634       return (selection2) => selection2.text(tval);
55635     }
55636     function objectDifference(a2, b2) {
55637       return a2.filter(function(d1) {
55638         return !b2.some(function(d2) {
55639           return d1.value === d2.value;
55640         });
55641       });
55642     }
55643     function initCombo(selection2, attachTo) {
55644       if (!_allowCustomValues) {
55645         selection2.attr("readonly", "readonly");
55646       }
55647       if (_showTagInfoSuggestions && services.taginfo) {
55648         selection2.call(_combobox.fetcher(setTaginfoValues), attachTo);
55649         setTaginfoValues("", setPlaceholder);
55650       } else {
55651         selection2.call(_combobox, attachTo);
55652         setTimeout(() => setStaticValues(setPlaceholder), 0);
55653       }
55654     }
55655     function getOptions(allOptions) {
55656       var stringsField = field.resolveReference("stringsCrossReference");
55657       if (!(field.options || stringsField.options)) return [];
55658       let options2;
55659       if (allOptions !== true) {
55660         options2 = field.options || stringsField.options;
55661       } else {
55662         options2 = [].concat(field.options, stringsField.options).filter(Boolean);
55663       }
55664       return options2.map(function(v2) {
55665         const labelId = getLabelId(stringsField, v2);
55666         return {
55667           key: v2,
55668           value: stringsField.t(labelId, { default: v2 }),
55669           title: stringsField.t("options.".concat(v2, ".description"), { default: v2 }),
55670           display: addComboboxIcons(stringsField.t.append(labelId, { default: v2 }), v2),
55671           klass: stringsField.hasTextForStringId(labelId) ? "" : "raw-option"
55672         };
55673       });
55674     }
55675     function hasStaticValues() {
55676       return getOptions().length > 0;
55677     }
55678     function setStaticValues(callback, filter2) {
55679       _comboData = getOptions();
55680       if (filter2 !== void 0) {
55681         _comboData = _comboData.filter(filter2);
55682       }
55683       _comboData = objectDifference(_comboData, _multiData);
55684       _combobox.data(_comboData);
55685       if (callback) callback(_comboData);
55686     }
55687     function setTaginfoValues(q2, callback) {
55688       var queryFilter = (d2) => d2.value.toLowerCase().includes(q2.toLowerCase()) || d2.key.toLowerCase().includes(q2.toLowerCase());
55689       if (hasStaticValues()) {
55690         setStaticValues(callback, queryFilter);
55691       }
55692       var stringsField = field.resolveReference("stringsCrossReference");
55693       var fn = _isMulti ? "multikeys" : "values";
55694       var query = (_isMulti ? field.key : "") + q2;
55695       var hasCountryPrefix = _isNetwork && _countryCode && _countryCode.indexOf(q2.toLowerCase()) === 0;
55696       if (hasCountryPrefix) {
55697         query = _countryCode + ":";
55698       }
55699       var params = {
55700         debounce: q2 !== "",
55701         key: field.key,
55702         query
55703       };
55704       if (_entityIDs.length) {
55705         params.geometry = context.graph().geometry(_entityIDs[0]);
55706       }
55707       services.taginfo[fn](params, function(err, data) {
55708         if (err) return;
55709         data = data.filter((d2) => field.type !== "typeCombo" || d2.value !== "yes");
55710         data = data.filter((d2) => {
55711           var value = d2.value;
55712           if (_isMulti) {
55713             value = value.slice(field.key.length);
55714           }
55715           return value === restrictTagValueSpelling(value);
55716         });
55717         var deprecatedValues = osmEntity.deprecatedTagValuesByKey(_dataDeprecated)[field.key];
55718         if (deprecatedValues) {
55719           data = data.filter((d2) => !deprecatedValues.includes(d2.value));
55720         }
55721         if (hasCountryPrefix) {
55722           data = data.filter((d2) => d2.value.toLowerCase().indexOf(_countryCode + ":") === 0);
55723         }
55724         const additionalOptions = (field.options || stringsField.options || []).filter((v2) => !data.some((dv) => dv.value === (_isMulti ? field.key + v2 : v2))).map((v2) => ({ value: v2 }));
55725         _container.classed("empty-combobox", data.length === 0);
55726         _comboData = data.concat(additionalOptions).map(function(d2) {
55727           var v2 = d2.value;
55728           if (_isMulti) v2 = v2.replace(field.key, "");
55729           const labelId = getLabelId(stringsField, v2);
55730           var isLocalizable = stringsField.hasTextForStringId(labelId);
55731           var label = stringsField.t(labelId, { default: v2 });
55732           return {
55733             key: v2,
55734             value: label,
55735             title: stringsField.t("options.".concat(v2, ".description"), { default: isLocalizable ? v2 : d2.title !== label ? d2.title : "" }),
55736             display: addComboboxIcons(stringsField.t.append(labelId, { default: v2 }), v2),
55737             klass: isLocalizable ? "" : "raw-option"
55738           };
55739         });
55740         _comboData = _comboData.filter(queryFilter);
55741         _comboData = objectDifference(_comboData, _multiData);
55742         if (callback) callback(_comboData, hasStaticValues());
55743       });
55744     }
55745     function addComboboxIcons(disp, value) {
55746       const iconsField = field.resolveReference("iconsCrossReference");
55747       if (iconsField.icons) {
55748         return function(selection2) {
55749           var span = selection2.insert("span", ":first-child").attr("class", "tag-value-icon");
55750           if (iconsField.icons[value]) {
55751             span.call(svgIcon("#".concat(iconsField.icons[value])));
55752           }
55753           disp.call(this, selection2);
55754         };
55755       }
55756       return disp;
55757     }
55758     function setPlaceholder(values) {
55759       if (_isMulti || _isSemi) {
55760         _staticPlaceholder = field.placeholder() || _t("inspector.add");
55761       } else {
55762         var vals = values.map(function(d2) {
55763           return d2.value;
55764         }).filter(function(s2) {
55765           return s2.length < 20;
55766         });
55767         var placeholders = vals.length > 1 ? vals : values.map(function(d2) {
55768           return d2.key;
55769         });
55770         _staticPlaceholder = field.placeholder() || placeholders.slice(0, 3).join(", ");
55771       }
55772       if (!/(…|\.\.\.)$/.test(_staticPlaceholder)) {
55773         _staticPlaceholder += "\u2026";
55774       }
55775       var ph;
55776       if (!_isMulti && !_isSemi && _tags && Array.isArray(_tags[field.key])) {
55777         ph = _t("inspector.multiple_values");
55778       } else {
55779         ph = _staticPlaceholder;
55780       }
55781       _container.selectAll("input").attr("placeholder", ph);
55782       var hideAdd = !_allowCustomValues && !values.length;
55783       _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null);
55784     }
55785     function change() {
55786       var t2 = {};
55787       var val;
55788       if (_isMulti || _isSemi) {
55789         var vals;
55790         if (_isMulti) {
55791           vals = [tagValue(utilGetSetValue(_input))];
55792         } else if (_isSemi) {
55793           val = tagValue(utilGetSetValue(_input)) || "";
55794           val = val.replace(/,/g, ";");
55795           vals = val.split(";");
55796         }
55797         vals = vals.filter(Boolean);
55798         if (!vals.length) return;
55799         _container.classed("active", false);
55800         utilGetSetValue(_input, "");
55801         if (_isMulti) {
55802           utilArrayUniq(vals).forEach(function(v2) {
55803             var key = (field.key || "") + v2;
55804             if (_tags) {
55805               var old = _tags[key];
55806               if (typeof old === "string" && old.toLowerCase() !== "no") return;
55807             }
55808             key = context.cleanTagKey(key);
55809             field.keys.push(key);
55810             t2[key] = "yes";
55811           });
55812         } else if (_isSemi) {
55813           var arr = _multiData.map(function(d2) {
55814             return d2.key;
55815           });
55816           arr = arr.concat(vals);
55817           t2[field.key] = context.cleanTagValue(utilArrayUniq(arr).filter(Boolean).join(";"));
55818         }
55819         window.setTimeout(function() {
55820           _input.node().focus();
55821         }, 10);
55822       } else {
55823         var rawValue = utilGetSetValue(_input);
55824         if (!rawValue && Array.isArray(_tags[field.key])) return;
55825         val = context.cleanTagValue(tagValue(rawValue));
55826         t2[field.key] = val || void 0;
55827       }
55828       dispatch14.call("change", this, t2);
55829     }
55830     function removeMultikey(d3_event, d2) {
55831       d3_event.preventDefault();
55832       d3_event.stopPropagation();
55833       var t2 = {};
55834       if (_isMulti) {
55835         t2[d2.key] = void 0;
55836       } else if (_isSemi) {
55837         var arr = _multiData.map(function(md) {
55838           return md.key === d2.key ? null : md.key;
55839         }).filter(Boolean);
55840         arr = utilArrayUniq(arr);
55841         t2[field.key] = arr.length ? arr.join(";") : void 0;
55842         _lengthIndicator.update(t2[field.key]);
55843       }
55844       dispatch14.call("change", this, t2);
55845     }
55846     function invertMultikey(d3_event, d2) {
55847       d3_event.preventDefault();
55848       d3_event.stopPropagation();
55849       var t2 = {};
55850       if (_isMulti) {
55851         t2[d2.key] = _tags[d2.key] === "yes" ? "no" : "yes";
55852       }
55853       dispatch14.call("change", this, t2);
55854     }
55855     function combo(selection2) {
55856       _container = selection2.selectAll(".form-field-input-wrap").data([0]);
55857       var type2 = _isMulti || _isSemi ? "multicombo" : "combo";
55858       _container = _container.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + type2).merge(_container);
55859       if (_isMulti || _isSemi) {
55860         _container = _container.selectAll(".chiplist").data([0]);
55861         var listClass = "chiplist";
55862         if (field.key === "destination" || field.key === "via") {
55863           listClass += " full-line-chips";
55864         }
55865         _container = _container.enter().append("ul").attr("class", listClass).on("click", function() {
55866           window.setTimeout(function() {
55867             _input.node().focus();
55868           }, 10);
55869         }).merge(_container);
55870         _inputWrap = _container.selectAll(".input-wrap").data([0]);
55871         _inputWrap = _inputWrap.enter().append("li").attr("class", "input-wrap").merge(_inputWrap);
55872         var hideAdd = !_allowCustomValues && !_comboData.length;
55873         _inputWrap.style("display", hideAdd ? "none" : null);
55874         _input = _inputWrap.selectAll("input").data([0]);
55875       } else {
55876         _input = _container.selectAll("input").data([0]);
55877       }
55878       _input = _input.enter().append("input").attr("type", "text").attr("id", field.domId).call(utilNoAuto).call(initCombo, _container).merge(_input);
55879       if (_isSemi) {
55880         _inputWrap.call(_lengthIndicator);
55881       } else if (!_isMulti) {
55882         _container.call(_lengthIndicator);
55883       }
55884       if (_isNetwork) {
55885         var extent = combinedEntityExtent();
55886         var countryCode = extent && iso1A2Code(extent.center());
55887         _countryCode = countryCode && countryCode.toLowerCase();
55888       }
55889       _input.on("change", change).on("blur", change).on("input", function() {
55890         let val = utilGetSetValue(_input);
55891         updateIcon(val);
55892         if (_isSemi && _tags[field.key]) {
55893           val += ";" + _tags[field.key];
55894         }
55895         _lengthIndicator.update(val);
55896       });
55897       _input.on("keydown.field", function(d3_event) {
55898         switch (d3_event.keyCode) {
55899           case 13:
55900             _input.node().blur();
55901             d3_event.stopPropagation();
55902             break;
55903         }
55904       });
55905       if (_isMulti || _isSemi) {
55906         _combobox.on("accept", function() {
55907           _input.node().blur();
55908           _input.node().focus();
55909         });
55910         _input.on("focus", function() {
55911           _container.classed("active", true);
55912         });
55913       }
55914       _combobox.on("cancel", function() {
55915         _input.node().blur();
55916       }).on("update", function() {
55917         updateIcon(utilGetSetValue(_input));
55918       });
55919     }
55920     function updateIcon(value) {
55921       value = tagValue(value);
55922       let container = _container;
55923       if (field.type === "multiCombo" || field.type === "semiCombo") {
55924         container = _container.select(".input-wrap");
55925       }
55926       const iconsField = field.resolveReference("iconsCrossReference");
55927       if (iconsField.icons) {
55928         container.selectAll(".tag-value-icon").remove();
55929         if (iconsField.icons[value]) {
55930           container.selectAll(".tag-value-icon").data([value]).enter().insert("div", "input").attr("class", "tag-value-icon").call(svgIcon("#".concat(iconsField.icons[value])));
55931         }
55932       }
55933     }
55934     combo.tags = function(tags) {
55935       _tags = tags;
55936       var stringsField = field.resolveReference("stringsCrossReference");
55937       var isMixed = Array.isArray(tags[field.key]);
55938       var showsValue = (value) => !isMixed && value && !(field.type === "typeCombo" && value === "yes");
55939       var isRawValue = (value) => showsValue(value) && !stringsField.hasTextForStringId("options.".concat(value)) && !stringsField.hasTextForStringId("options.".concat(value, ".title"));
55940       var isKnownValue = (value) => showsValue(value) && !isRawValue(value);
55941       var isReadOnly = !_allowCustomValues;
55942       if (_isMulti || _isSemi) {
55943         _multiData = [];
55944         var maxLength;
55945         if (_isMulti) {
55946           for (var k2 in tags) {
55947             if (field.key && k2.indexOf(field.key) !== 0) continue;
55948             if (!field.key && field.keys.indexOf(k2) === -1) continue;
55949             var v2 = tags[k2];
55950             var suffix = field.key ? k2.slice(field.key.length) : k2;
55951             _multiData.push({
55952               key: k2,
55953               value: displayValue(suffix),
55954               display: addComboboxIcons(renderValue(suffix), suffix),
55955               state: typeof v2 === "string" ? v2.toLowerCase() : "",
55956               isMixed: Array.isArray(v2)
55957             });
55958           }
55959           if (field.key) {
55960             field.keys = _multiData.map(function(d2) {
55961               return d2.key;
55962             });
55963             maxLength = context.maxCharsForTagKey() - utilUnicodeCharsCount(field.key);
55964           } else {
55965             maxLength = context.maxCharsForTagKey();
55966           }
55967         } else if (_isSemi) {
55968           var allValues = [];
55969           var commonValues;
55970           if (Array.isArray(tags[field.key])) {
55971             tags[field.key].forEach(function(tagVal) {
55972               var thisVals = utilArrayUniq((tagVal || "").split(";")).filter(Boolean);
55973               allValues = allValues.concat(thisVals);
55974               if (!commonValues) {
55975                 commonValues = thisVals;
55976               } else {
55977                 commonValues = commonValues.filter((value) => thisVals.includes(value));
55978               }
55979             });
55980             allValues = utilArrayUniq(allValues).filter(Boolean);
55981           } else {
55982             allValues = utilArrayUniq((tags[field.key] || "").split(";")).filter(Boolean);
55983             commonValues = allValues;
55984           }
55985           _multiData = allValues.map(function(v3) {
55986             return {
55987               key: v3,
55988               value: displayValue(v3),
55989               display: addComboboxIcons(renderValue(v3), v3),
55990               isMixed: !commonValues.includes(v3)
55991             };
55992           });
55993           var currLength = utilUnicodeCharsCount(commonValues.join(";"));
55994           maxLength = context.maxCharsForTagValue() - currLength;
55995           if (currLength > 0) {
55996             maxLength -= 1;
55997           }
55998         }
55999         maxLength = Math.max(0, maxLength);
56000         var hideAdd = maxLength <= 0 || !_allowCustomValues && !_comboData.length;
56001         _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null);
56002         var allowDragAndDrop = _isSemi && !Array.isArray(tags[field.key]);
56003         var chips = _container.selectAll(".chip").data(_multiData);
56004         chips.exit().remove();
56005         var enter = chips.enter().insert("li", ".input-wrap").attr("class", "chip");
56006         enter.append("span");
56007         const field_buttons = enter.append("div").attr("class", "field_buttons");
56008         field_buttons.append("a").attr("class", "remove");
56009         chips = chips.merge(enter).order().classed("raw-value", function(d2) {
56010           var k3 = d2.key;
56011           if (_isMulti) k3 = k3.replace(field.key, "");
56012           return !stringsField.hasTextForStringId("options." + k3);
56013         }).classed("draggable", allowDragAndDrop).classed("mixed", function(d2) {
56014           return d2.isMixed;
56015         }).attr("title", function(d2) {
56016           if (d2.isMixed) {
56017             return _t("inspector.unshared_value_tooltip");
56018           }
56019           if (!["yes", "no"].includes(d2.state)) {
56020             return d2.state;
56021           }
56022           return null;
56023         }).classed("negated", (d2) => d2.state === "no");
56024         if (!_isSemi) {
56025           chips.selectAll("input[type=checkbox]").remove();
56026           chips.insert("input", "span").attr("type", "checkbox").property("checked", (d2) => d2.state === "yes").property("indeterminate", (d2) => d2.isMixed || !["yes", "no"].includes(d2.state)).on("click", invertMultikey);
56027         }
56028         if (allowDragAndDrop) {
56029           registerDragAndDrop(chips);
56030         }
56031         chips.each(function(d2) {
56032           const selection2 = select_default2(this);
56033           const text_span = selection2.select("span");
56034           const field_buttons2 = selection2.select(".field_buttons");
56035           const clean_value = d2.value.trim();
56036           text_span.text("");
56037           if (!field_buttons2.select("button").empty()) {
56038             field_buttons2.select("button").remove();
56039           }
56040           if (clean_value.startsWith("https://")) {
56041             text_span.text(clean_value);
56042             field_buttons2.append("button").call(svgIcon("#iD-icon-out-link")).attr("class", "form-field-button foreign-id-permalink").attr("title", () => _t("icons.visit_website")).attr("aria-label", () => _t("icons.visit_website")).on("click", function(d3_event) {
56043               d3_event.preventDefault();
56044               window.open(clean_value, "_blank");
56045             });
56046             return;
56047           }
56048           if (d2.display) {
56049             d2.display(text_span);
56050             return;
56051           }
56052           text_span.text(d2.value);
56053         });
56054         chips.select("a.remove").attr("href", "#").on("click", removeMultikey).attr("class", "remove").text("\xD7");
56055         updateIcon("");
56056       } else {
56057         var mixedValues = isMixed && tags[field.key].map(function(val) {
56058           return displayValue(val);
56059         }).filter(Boolean);
56060         utilGetSetValue(_input, !isMixed ? displayValue(tags[field.key]) : "").data([tags[field.key]]).classed("raw-value", isRawValue).classed("known-value", isKnownValue).attr("readonly", isReadOnly ? "readonly" : void 0).attr("title", isMixed ? mixedValues.join("\n") : void 0).attr("placeholder", isMixed ? _t("inspector.multiple_values") : _staticPlaceholder || "").classed("mixed", isMixed).on("keydown.deleteCapture", function(d3_event) {
56061           if (isReadOnly && isKnownValue(tags[field.key]) && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
56062             d3_event.preventDefault();
56063             d3_event.stopPropagation();
56064             var t2 = {};
56065             t2[field.key] = void 0;
56066             dispatch14.call("change", this, t2);
56067           }
56068         });
56069         if (!Array.isArray(tags[field.key])) {
56070           updateIcon(tags[field.key]);
56071         }
56072         if (!isMixed) {
56073           _lengthIndicator.update(tags[field.key]);
56074         }
56075       }
56076       const refreshStyles = () => {
56077         _input.data([tagValue(utilGetSetValue(_input))]).classed("raw-value", isRawValue).classed("known-value", isKnownValue);
56078       };
56079       _input.on("input.refreshStyles", refreshStyles);
56080       _combobox.on("update.refreshStyles", refreshStyles);
56081       refreshStyles();
56082     };
56083     function registerDragAndDrop(selection2) {
56084       var dragOrigin, targetIndex;
56085       selection2.call(
56086         drag_default().on("start", function(d3_event) {
56087           dragOrigin = {
56088             x: d3_event.x,
56089             y: d3_event.y
56090           };
56091           targetIndex = null;
56092         }).on("drag", function(d3_event) {
56093           var x2 = d3_event.x - dragOrigin.x, y2 = d3_event.y - dragOrigin.y;
56094           if (!select_default2(this).classed("dragging") && // don't display drag until dragging beyond a distance threshold
56095           Math.sqrt(Math.pow(x2, 2) + Math.pow(y2, 2)) <= 5) return;
56096           var index = selection2.nodes().indexOf(this);
56097           select_default2(this).classed("dragging", true);
56098           targetIndex = null;
56099           var targetIndexOffsetTop = null;
56100           var draggedTagWidth = select_default2(this).node().offsetWidth;
56101           if (field.key === "destination" || field.key === "via") {
56102             _container.selectAll(".chip").style("transform", function(d2, index2) {
56103               var node = select_default2(this).node();
56104               if (index === index2) {
56105                 return "translate(" + x2 + "px, " + y2 + "px)";
56106               } else if (index2 > index && d3_event.y > node.offsetTop) {
56107                 if (targetIndex === null || index2 > targetIndex) {
56108                   targetIndex = index2;
56109                 }
56110                 return "translateY(-100%)";
56111               } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
56112                 if (targetIndex === null || index2 < targetIndex) {
56113                   targetIndex = index2;
56114                 }
56115                 return "translateY(100%)";
56116               }
56117               return null;
56118             });
56119           } else {
56120             _container.selectAll(".chip").each(function(d2, index2) {
56121               var node = select_default2(this).node();
56122               if (index !== index2 && d3_event.x < node.offsetLeft + node.offsetWidth + 5 && d3_event.x > node.offsetLeft && d3_event.y < node.offsetTop + node.offsetHeight && d3_event.y > node.offsetTop) {
56123                 targetIndex = index2;
56124                 targetIndexOffsetTop = node.offsetTop;
56125               }
56126             }).style("transform", function(d2, index2) {
56127               var node = select_default2(this).node();
56128               if (index === index2) {
56129                 return "translate(" + x2 + "px, " + y2 + "px)";
56130               }
56131               if (node.offsetTop === targetIndexOffsetTop) {
56132                 if (index2 < index && index2 >= targetIndex) {
56133                   return "translateX(" + draggedTagWidth + "px)";
56134                 } else if (index2 > index && index2 <= targetIndex) {
56135                   return "translateX(-" + draggedTagWidth + "px)";
56136                 }
56137               }
56138               return null;
56139             });
56140           }
56141         }).on("end", function() {
56142           if (!select_default2(this).classed("dragging")) {
56143             return;
56144           }
56145           var index = selection2.nodes().indexOf(this);
56146           select_default2(this).classed("dragging", false);
56147           _container.selectAll(".chip").style("transform", null);
56148           if (typeof targetIndex === "number") {
56149             var element = _multiData[index];
56150             _multiData.splice(index, 1);
56151             _multiData.splice(targetIndex, 0, element);
56152             var t2 = {};
56153             if (_multiData.length) {
56154               t2[field.key] = _multiData.map(function(element2) {
56155                 return element2.key;
56156               }).join(";");
56157             } else {
56158               t2[field.key] = void 0;
56159             }
56160             dispatch14.call("change", this, t2);
56161           }
56162           dragOrigin = void 0;
56163           targetIndex = void 0;
56164         })
56165       );
56166     }
56167     combo.focus = function() {
56168       _input.node().focus();
56169     };
56170     combo.entityIDs = function(val) {
56171       if (!arguments.length) return _entityIDs;
56172       _entityIDs = val;
56173       return combo;
56174     };
56175     function combinedEntityExtent() {
56176       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
56177     }
56178     return utilRebind(combo, dispatch14, "on");
56179   }
56180
56181   // modules/ui/account.js
56182   function uiAccount(context) {
56183     const osm = context.connection();
56184     function updateUserDetails(selection2) {
56185       if (!osm) return;
56186       if (!osm.authenticated()) {
56187         render(selection2, null);
56188       } else {
56189         osm.userDetails((err, user) => render(selection2, user));
56190       }
56191     }
56192     function render(selection2, user) {
56193       let userInfo = selection2.select(".userInfo");
56194       let loginLogout = selection2.select(".loginLogout");
56195       if (user) {
56196         userInfo.html("").classed("hide", false);
56197         let userLink = userInfo.append("a").attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
56198         if (user.image_url) {
56199           userLink.append("img").attr("class", "icon pre-text user-icon").attr("src", user.image_url);
56200         } else {
56201           userLink.call(svgIcon("#iD-icon-avatar", "pre-text light"));
56202         }
56203         userLink.append("span").attr("class", "label").text(user.display_name);
56204         loginLogout.classed("hide", false).select("a").text(_t("logout")).on("click", (e3) => {
56205           e3.preventDefault();
56206           osm.logout();
56207           tryLogout();
56208         });
56209       } else {
56210         userInfo.html("").classed("hide", true);
56211         loginLogout.classed("hide", false).select("a").text(_t("login")).on("click", (e3) => {
56212           e3.preventDefault();
56213           osm.authenticate();
56214         });
56215       }
56216     }
56217     function tryLogout() {
56218       if (!osm) return;
56219       const url = osm.getUrlRoot() + "/logout?referer=%2Flogin";
56220       const w2 = 600;
56221       const h2 = 550;
56222       const settings = [
56223         ["width", w2],
56224         ["height", h2],
56225         ["left", window.screen.width / 2 - w2 / 2],
56226         ["top", window.screen.height / 2 - h2 / 2]
56227       ].map((x2) => x2.join("=")).join(",");
56228       window.open(url, "_blank", settings);
56229     }
56230     return function(selection2) {
56231       if (!osm) return;
56232       selection2.append("li").attr("class", "userInfo").classed("hide", true);
56233       selection2.append("li").attr("class", "loginLogout").classed("hide", true).append("a").attr("href", "#");
56234       osm.on("change.account", () => updateUserDetails(selection2));
56235       updateUserDetails(selection2);
56236     };
56237   }
56238
56239   // modules/ui/attribution.js
56240   function uiAttribution(context) {
56241     let _selection = select_default2(null);
56242     function render(selection2, data, klass) {
56243       let div = selection2.selectAll(".".concat(klass)).data([0]);
56244       div = div.enter().append("div").attr("class", klass).merge(div);
56245       let attributions = div.selectAll(".attribution").data(data, (d2) => d2.id);
56246       attributions.exit().remove();
56247       attributions = attributions.enter().append("span").attr("class", "attribution").each((d2, i3, nodes) => {
56248         let attribution = select_default2(nodes[i3]);
56249         if (d2.terms_html) {
56250           attribution.html(d2.terms_html);
56251           return;
56252         }
56253         if (d2.terms_url) {
56254           attribution = attribution.append("a").attr("href", d2.terms_url).attr("target", "_blank");
56255         }
56256         const sourceID = d2.id.replace(/\./g, "<TX_DOT>");
56257         const terms_text = _t(
56258           "imagery.".concat(sourceID, ".attribution.text"),
56259           { default: d2.terms_text || d2.id || d2.name() }
56260         );
56261         if (d2.icon && !d2.overlay) {
56262           attribution.append("img").attr("class", "source-image").attr("src", d2.icon);
56263         }
56264         attribution.append("span").attr("class", "attribution-text").text(terms_text);
56265       }).merge(attributions);
56266       let copyright = attributions.selectAll(".copyright-notice").data((d2) => {
56267         let notice = d2.copyrightNotices(context.map().zoom(), context.map().extent());
56268         return notice ? [notice] : [];
56269       });
56270       copyright.exit().remove();
56271       copyright = copyright.enter().append("span").attr("class", "copyright-notice").merge(copyright);
56272       copyright.text(String);
56273     }
56274     function update() {
56275       let baselayer = context.background().baseLayerSource();
56276       _selection.call(render, baselayer ? [baselayer] : [], "base-layer-attribution");
56277       const z2 = context.map().zoom();
56278       let overlays = context.background().overlayLayerSources() || [];
56279       _selection.call(render, overlays.filter((s2) => s2.validZoom(z2)), "overlay-layer-attribution");
56280     }
56281     return function(selection2) {
56282       _selection = selection2;
56283       context.background().on("change.attribution", update);
56284       context.map().on("move.attribution", throttle_default(update, 400, { leading: false }));
56285       update();
56286     };
56287   }
56288
56289   // modules/ui/contributors.js
56290   function uiContributors(context) {
56291     var osm = context.connection(), debouncedUpdate = debounce_default(function() {
56292       update();
56293     }, 1e3), limit = 4, hidden = false, wrap2 = select_default2(null);
56294     function update() {
56295       if (!osm) return;
56296       var users = {}, entities = context.history().intersects(context.map().extent());
56297       entities.forEach(function(entity) {
56298         if (entity && entity.user) users[entity.user] = true;
56299       });
56300       var u2 = Object.keys(users), subset = u2.slice(0, u2.length > limit ? limit - 1 : limit);
56301       wrap2.html("").call(svgIcon("#iD-icon-nearby", "pre-text light"));
56302       var userList = select_default2(document.createElement("span"));
56303       userList.selectAll().data(subset).enter().append("a").attr("class", "user-link").attr("href", function(d2) {
56304         return osm.userURL(d2);
56305       }).attr("target", "_blank").text(String);
56306       if (u2.length > limit) {
56307         var count = select_default2(document.createElement("span"));
56308         var othersNum = u2.length - limit + 1;
56309         count.append("a").attr("target", "_blank").attr("href", function() {
56310           return osm.changesetsURL(context.map().center(), context.map().zoom());
56311         }).text(othersNum);
56312         wrap2.append("span").html(_t.html("contributors.truncated_list", { n: othersNum, users: { html: userList.html() }, count: { html: count.html() } }));
56313       } else {
56314         wrap2.append("span").html(_t.html("contributors.list", { users: { html: userList.html() } }));
56315       }
56316       if (!u2.length) {
56317         hidden = true;
56318         wrap2.transition().style("opacity", 0);
56319       } else if (hidden) {
56320         wrap2.transition().style("opacity", 1);
56321       }
56322     }
56323     return function(selection2) {
56324       if (!osm) return;
56325       wrap2 = selection2;
56326       update();
56327       osm.on("loaded.contributors", debouncedUpdate);
56328       context.map().on("move.contributors", debouncedUpdate);
56329     };
56330   }
56331
56332   // modules/ui/edit_menu.js
56333   function uiEditMenu(context) {
56334     var dispatch14 = dispatch_default("toggled");
56335     var _menu = select_default2(null);
56336     var _operations = [];
56337     var _anchorLoc = [0, 0];
56338     var _anchorLocLonLat = [0, 0];
56339     var _triggerType = "";
56340     var _vpTopMargin = 85;
56341     var _vpBottomMargin = 45;
56342     var _vpSideMargin = 35;
56343     var _menuTop = false;
56344     var _menuHeight;
56345     var _menuWidth;
56346     var _verticalPadding = 4;
56347     var _tooltipWidth = 210;
56348     var _menuSideMargin = 10;
56349     var _tooltips = [];
56350     var editMenu = function(selection2) {
56351       var isTouchMenu = _triggerType.includes("touch") || _triggerType.includes("pen");
56352       var ops = _operations.filter(function(op) {
56353         return !isTouchMenu || !op.mouseOnly;
56354       });
56355       if (!ops.length) return;
56356       _tooltips = [];
56357       _menuTop = isTouchMenu;
56358       var showLabels = isTouchMenu;
56359       var buttonHeight = showLabels ? 32 : 34;
56360       if (showLabels) {
56361         _menuWidth = 52 + Math.min(120, 6 * Math.max.apply(Math, ops.map(function(op) {
56362           return op.title.length;
56363         })));
56364       } else {
56365         _menuWidth = 44;
56366       }
56367       _menuHeight = _verticalPadding * 2 + ops.length * buttonHeight;
56368       _menu = selection2.append("div").attr("class", "edit-menu").classed("touch-menu", isTouchMenu).style("padding", _verticalPadding + "px 0");
56369       var buttons = _menu.selectAll(".edit-menu-item").data(ops);
56370       var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
56371         return "edit-menu-item edit-menu-item-" + d2.id;
56372       }).style("height", buttonHeight + "px").on("click", click).on("pointerup", pointerup).on("pointerdown mousedown", function pointerdown(d3_event) {
56373         d3_event.stopPropagation();
56374       }).on("mouseenter.highlight", function(d3_event, d2) {
56375         if (!d2.relatedEntityIds || select_default2(this).classed("disabled")) return;
56376         utilHighlightEntities(d2.relatedEntityIds(), true, context);
56377       }).on("mouseleave.highlight", function(d3_event, d2) {
56378         if (!d2.relatedEntityIds) return;
56379         utilHighlightEntities(d2.relatedEntityIds(), false, context);
56380       });
56381       buttonsEnter.each(function(d2) {
56382         var tooltip = uiTooltip().heading(() => d2.title).title(d2.tooltip).keys([d2.keys[0]]);
56383         _tooltips.push(tooltip);
56384         select_default2(this).call(tooltip).append("div").attr("class", "icon-wrap").call(svgIcon(d2.icon && d2.icon() || "#iD-operation-" + d2.id, "operation"));
56385       });
56386       if (showLabels) {
56387         buttonsEnter.append("span").attr("class", "label").each(function(d2) {
56388           select_default2(this).call(d2.title);
56389         });
56390       }
56391       buttonsEnter.merge(buttons).classed("disabled", function(d2) {
56392         return d2.disabled();
56393       });
56394       updatePosition();
56395       var initialScale = context.projection.scale();
56396       context.map().on("move.edit-menu", function() {
56397         if (initialScale !== context.projection.scale()) {
56398           editMenu.close();
56399         }
56400       }).on("drawn.edit-menu", function(info) {
56401         if (info.full) updatePosition();
56402       });
56403       var lastPointerUpType;
56404       function pointerup(d3_event) {
56405         lastPointerUpType = d3_event.pointerType;
56406       }
56407       function click(d3_event, operation2) {
56408         d3_event.stopPropagation();
56409         if (operation2.relatedEntityIds) {
56410           utilHighlightEntities(operation2.relatedEntityIds(), false, context);
56411         }
56412         if (operation2.disabled()) {
56413           if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
56414             context.ui().flash.duration(4e3).iconName("#iD-operation-" + operation2.id).iconClass("operation disabled").label(operation2.tooltip())();
56415           }
56416         } else {
56417           if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
56418             context.ui().flash.duration(2e3).iconName("#iD-operation-" + operation2.id).iconClass("operation").label(operation2.annotation() || operation2.title)();
56419           }
56420           operation2();
56421           editMenu.close();
56422         }
56423         lastPointerUpType = null;
56424       }
56425       dispatch14.call("toggled", this, true);
56426     };
56427     function updatePosition() {
56428       if (!_menu || _menu.empty()) return;
56429       var anchorLoc = context.projection(_anchorLocLonLat);
56430       var viewport = context.surfaceRect();
56431       if (anchorLoc[0] < 0 || anchorLoc[0] > viewport.width || anchorLoc[1] < 0 || anchorLoc[1] > viewport.height) {
56432         editMenu.close();
56433         return;
56434       }
56435       var menuLeft = displayOnLeft(viewport);
56436       var offset = [0, 0];
56437       offset[0] = menuLeft ? -1 * (_menuSideMargin + _menuWidth) : _menuSideMargin;
56438       if (_menuTop) {
56439         if (anchorLoc[1] - _menuHeight < _vpTopMargin) {
56440           offset[1] = -anchorLoc[1] + _vpTopMargin;
56441         } else {
56442           offset[1] = -_menuHeight;
56443         }
56444       } else {
56445         if (anchorLoc[1] + _menuHeight > viewport.height - _vpBottomMargin) {
56446           offset[1] = -anchorLoc[1] - _menuHeight + viewport.height - _vpBottomMargin;
56447         } else {
56448           offset[1] = 0;
56449         }
56450       }
56451       var origin = geoVecAdd(anchorLoc, offset);
56452       _menu.style("left", origin[0] + "px").style("top", origin[1] + "px");
56453       var tooltipSide = tooltipPosition(viewport, menuLeft);
56454       _tooltips.forEach(function(tooltip) {
56455         tooltip.placement(tooltipSide);
56456       });
56457       function displayOnLeft(viewport2) {
56458         if (_mainLocalizer.textDirection() === "ltr") {
56459           if (anchorLoc[0] + _menuSideMargin + _menuWidth > viewport2.width - _vpSideMargin) {
56460             return true;
56461           }
56462           return false;
56463         } else {
56464           if (anchorLoc[0] - _menuSideMargin - _menuWidth < _vpSideMargin) {
56465             return false;
56466           }
56467           return true;
56468         }
56469       }
56470       function tooltipPosition(viewport2, menuLeft2) {
56471         if (_mainLocalizer.textDirection() === "ltr") {
56472           if (menuLeft2) {
56473             return "left";
56474           }
56475           if (anchorLoc[0] + _menuSideMargin + _menuWidth + _tooltipWidth > viewport2.width - _vpSideMargin) {
56476             return "left";
56477           }
56478           return "right";
56479         } else {
56480           if (!menuLeft2) {
56481             return "right";
56482           }
56483           if (anchorLoc[0] - _menuSideMargin - _menuWidth - _tooltipWidth < _vpSideMargin) {
56484             return "right";
56485           }
56486           return "left";
56487         }
56488       }
56489     }
56490     editMenu.close = function() {
56491       context.map().on("move.edit-menu", null).on("drawn.edit-menu", null);
56492       _menu.remove();
56493       _tooltips = [];
56494       dispatch14.call("toggled", this, false);
56495     };
56496     editMenu.anchorLoc = function(val) {
56497       if (!arguments.length) return _anchorLoc;
56498       _anchorLoc = val;
56499       _anchorLocLonLat = context.projection.invert(_anchorLoc);
56500       return editMenu;
56501     };
56502     editMenu.triggerType = function(val) {
56503       if (!arguments.length) return _triggerType;
56504       _triggerType = val;
56505       return editMenu;
56506     };
56507     editMenu.operations = function(val) {
56508       if (!arguments.length) return _operations;
56509       _operations = val;
56510       return editMenu;
56511     };
56512     return utilRebind(editMenu, dispatch14, "on");
56513   }
56514
56515   // modules/ui/feature_info.js
56516   function uiFeatureInfo(context) {
56517     function update(selection2) {
56518       var features = context.features();
56519       var stats = features.stats();
56520       var count = 0;
56521       var hiddenList = features.hidden().map(function(k2) {
56522         if (stats[k2]) {
56523           count += stats[k2];
56524           return _t.append("inspector.title_count", {
56525             title: _t("feature." + k2 + ".description"),
56526             count: stats[k2]
56527           });
56528         }
56529         return null;
56530       }).filter(Boolean);
56531       selection2.text("");
56532       if (hiddenList.length) {
56533         var tooltipBehavior = uiTooltip().placement("top").title(function() {
56534           return (selection3) => {
56535             hiddenList.forEach((hiddenFeature) => {
56536               selection3.append("div").call(hiddenFeature);
56537             });
56538           };
56539         });
56540         selection2.append("a").attr("class", "chip").attr("href", "#").call(_t.append("feature_info.hidden_warning", { count })).call(tooltipBehavior).on("click", function(d3_event) {
56541           tooltipBehavior.hide();
56542           d3_event.preventDefault();
56543           context.ui().togglePanes(context.container().select(".map-panes .map-data-pane"));
56544         });
56545       }
56546       selection2.classed("hide", !hiddenList.length);
56547     }
56548     return function(selection2) {
56549       update(selection2);
56550       context.features().on("change.feature_info", function() {
56551         update(selection2);
56552       });
56553     };
56554   }
56555
56556   // modules/ui/flash.js
56557   function uiFlash(context) {
56558     var _flashTimer;
56559     var _duration = 2e3;
56560     var _iconName = "#iD-icon-no";
56561     var _iconClass = "disabled";
56562     var _label = (s2) => s2.text("");
56563     function flash() {
56564       if (_flashTimer) {
56565         _flashTimer.stop();
56566       }
56567       context.container().select(".main-footer-wrap").classed("footer-hide", true).classed("footer-show", false);
56568       context.container().select(".flash-wrap").classed("footer-hide", false).classed("footer-show", true);
56569       var content = context.container().select(".flash-wrap").selectAll(".flash-content").data([0]);
56570       var contentEnter = content.enter().append("div").attr("class", "flash-content");
56571       var iconEnter = contentEnter.append("svg").attr("class", "flash-icon icon").append("g").attr("transform", "translate(10,10)");
56572       iconEnter.append("circle").attr("r", 9);
56573       iconEnter.append("use").attr("transform", "translate(-7,-7)").attr("width", "14").attr("height", "14");
56574       contentEnter.append("div").attr("class", "flash-text");
56575       content = content.merge(contentEnter);
56576       content.selectAll(".flash-icon").attr("class", "icon flash-icon " + (_iconClass || ""));
56577       content.selectAll(".flash-icon use").attr("xlink:href", _iconName);
56578       content.selectAll(".flash-text").attr("class", "flash-text").call(_label);
56579       _flashTimer = timeout_default(function() {
56580         _flashTimer = null;
56581         context.container().select(".main-footer-wrap").classed("footer-hide", false).classed("footer-show", true);
56582         context.container().select(".flash-wrap").classed("footer-hide", true).classed("footer-show", false);
56583       }, _duration);
56584       return content;
56585     }
56586     flash.duration = function(_2) {
56587       if (!arguments.length) return _duration;
56588       _duration = _2;
56589       return flash;
56590     };
56591     flash.label = function(_2) {
56592       if (!arguments.length) return _label;
56593       if (typeof _2 !== "function") {
56594         _label = (selection2) => selection2.text(_2);
56595       } else {
56596         _label = (selection2) => selection2.text("").call(_2);
56597       }
56598       return flash;
56599     };
56600     flash.iconName = function(_2) {
56601       if (!arguments.length) return _iconName;
56602       _iconName = _2;
56603       return flash;
56604     };
56605     flash.iconClass = function(_2) {
56606       if (!arguments.length) return _iconClass;
56607       _iconClass = _2;
56608       return flash;
56609     };
56610     return flash;
56611   }
56612
56613   // modules/ui/full_screen.js
56614   function uiFullScreen(context) {
56615     var element = context.container().node();
56616     function getFullScreenFn() {
56617       if (element.requestFullscreen) {
56618         return element.requestFullscreen;
56619       } else if (element.msRequestFullscreen) {
56620         return element.msRequestFullscreen;
56621       } else if (element.mozRequestFullScreen) {
56622         return element.mozRequestFullScreen;
56623       } else if (element.webkitRequestFullscreen) {
56624         return element.webkitRequestFullscreen;
56625       }
56626     }
56627     function getExitFullScreenFn() {
56628       if (document.exitFullscreen) {
56629         return document.exitFullscreen;
56630       } else if (document.msExitFullscreen) {
56631         return document.msExitFullscreen;
56632       } else if (document.mozCancelFullScreen) {
56633         return document.mozCancelFullScreen;
56634       } else if (document.webkitExitFullscreen) {
56635         return document.webkitExitFullscreen;
56636       }
56637     }
56638     function isFullScreen() {
56639       return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement;
56640     }
56641     function isSupported() {
56642       return !!getFullScreenFn();
56643     }
56644     function fullScreen(d3_event) {
56645       d3_event.preventDefault();
56646       if (!isFullScreen()) {
56647         getFullScreenFn().apply(element);
56648       } else {
56649         getExitFullScreenFn().apply(document);
56650       }
56651     }
56652     return function() {
56653       if (!isSupported()) return;
56654       var detected = utilDetect();
56655       var keys2 = detected.os === "mac" ? [uiCmd("\u2303\u2318F"), "f11"] : ["f11"];
56656       context.keybinding().on(keys2, fullScreen);
56657     };
56658   }
56659
56660   // modules/ui/geolocate.js
56661   function uiGeolocate(context) {
56662     var _geolocationOptions = {
56663       // prioritize speed and power usage over precision
56664       enableHighAccuracy: false,
56665       // don't hang indefinitely getting the location
56666       timeout: 6e3
56667       // 6sec
56668     };
56669     var _locating = uiLoading(context).message(_t.html("geolocate.locating")).blocking(true);
56670     var _layer = context.layers().layer("geolocate");
56671     var _position;
56672     var _extent;
56673     var _timeoutID;
56674     var _button = select_default2(null);
56675     function click() {
56676       if (context.inIntro()) return;
56677       if (!_layer.enabled() && !_locating.isShown()) {
56678         _timeoutID = setTimeout(
56679           error,
56680           1e4
56681           /* 10sec */
56682         );
56683         context.container().call(_locating);
56684         navigator.geolocation.getCurrentPosition(success, error, _geolocationOptions);
56685       } else {
56686         _locating.close();
56687         _layer.enabled(null, false);
56688         updateButtonState();
56689       }
56690     }
56691     function zoomTo() {
56692       context.enter(modeBrowse(context));
56693       var map2 = context.map();
56694       _layer.enabled(_position, true);
56695       updateButtonState();
56696       map2.centerZoomEase(_extent.center(), Math.min(20, map2.extentZoom(_extent)));
56697     }
56698     function success(geolocation) {
56699       _position = geolocation;
56700       var coords = _position.coords;
56701       _extent = geoExtent([coords.longitude, coords.latitude]).padByMeters(coords.accuracy);
56702       zoomTo();
56703       finish();
56704     }
56705     function error() {
56706       if (_position) {
56707         zoomTo();
56708       } else {
56709         context.ui().flash.label(_t.append("geolocate.location_unavailable")).iconName("#iD-icon-geolocate")();
56710       }
56711       finish();
56712     }
56713     function finish() {
56714       _locating.close();
56715       if (_timeoutID) {
56716         clearTimeout(_timeoutID);
56717       }
56718       _timeoutID = void 0;
56719     }
56720     function updateButtonState() {
56721       _button.classed("active", _layer.enabled());
56722       _button.attr("aria-pressed", _layer.enabled());
56723     }
56724     return function(selection2) {
56725       if (!navigator.geolocation || !navigator.geolocation.getCurrentPosition) return;
56726       _button = selection2.append("button").on("click", click).attr("aria-pressed", false).call(svgIcon("#iD-icon-geolocate", "light")).call(
56727         uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(() => _t.append("geolocate.title")).keys([_t("geolocate.key")])
56728       );
56729       context.keybinding().on(_t("geolocate.key"), click);
56730     };
56731   }
56732
56733   // modules/ui/panels/background.js
56734   function uiPanelBackground(context) {
56735     var background = context.background();
56736     var _currSourceName = null;
56737     var _metadata = {};
56738     var _metadataKeys = [
56739       "zoom",
56740       "vintage",
56741       "source",
56742       "description",
56743       "resolution",
56744       "accuracy"
56745     ];
56746     var debouncedRedraw = debounce_default(redraw, 250);
56747     function redraw(selection2) {
56748       var source = background.baseLayerSource();
56749       if (!source) return;
56750       var isDG = source.id.match(/^DigitalGlobe/i) !== null;
56751       var sourceLabel = source.label();
56752       if (_currSourceName !== sourceLabel) {
56753         _currSourceName = sourceLabel;
56754         _metadata = {};
56755       }
56756       selection2.text("");
56757       var list2 = selection2.append("ul").attr("class", "background-info");
56758       list2.append("li").call(_currSourceName);
56759       _metadataKeys.forEach(function(k2) {
56760         if (isDG && k2 === "vintage") return;
56761         list2.append("li").attr("class", "background-info-list-" + k2).classed("hide", !_metadata[k2]).call(_t.append("info_panels.background." + k2, { suffix: ":" })).append("span").attr("class", "background-info-span-" + k2).text(_metadata[k2]);
56762       });
56763       debouncedGetMetadata(selection2);
56764       var toggleTiles = context.getDebug("tile") ? "hide_tiles" : "show_tiles";
56765       selection2.append("a").call(_t.append("info_panels.background." + toggleTiles)).attr("href", "#").attr("class", "button button-toggle-tiles").on("click", function(d3_event) {
56766         d3_event.preventDefault();
56767         context.setDebug("tile", !context.getDebug("tile"));
56768         selection2.call(redraw);
56769       });
56770       if (isDG) {
56771         var key = source.id + "-vintage";
56772         var sourceVintage = context.background().findSource(key);
56773         var showsVintage = context.background().showsLayer(sourceVintage);
56774         var toggleVintage = showsVintage ? "hide_vintage" : "show_vintage";
56775         selection2.append("a").call(_t.append("info_panels.background." + toggleVintage)).attr("href", "#").attr("class", "button button-toggle-vintage").on("click", function(d3_event) {
56776           d3_event.preventDefault();
56777           context.background().toggleOverlayLayer(sourceVintage);
56778           selection2.call(redraw);
56779         });
56780       }
56781       ["DigitalGlobe-Premium", "DigitalGlobe-Standard"].forEach(function(layerId) {
56782         if (source.id !== layerId) {
56783           var key2 = layerId + "-vintage";
56784           var sourceVintage2 = context.background().findSource(key2);
56785           if (context.background().showsLayer(sourceVintage2)) {
56786             context.background().toggleOverlayLayer(sourceVintage2);
56787           }
56788         }
56789       });
56790     }
56791     var debouncedGetMetadata = debounce_default(getMetadata, 250);
56792     function getMetadata(selection2) {
56793       var tile = context.container().select(".layer-background img.tile-center");
56794       if (tile.empty()) return;
56795       var sourceName = _currSourceName;
56796       var d2 = tile.datum();
56797       var zoom = d2 && d2.length >= 3 && d2[2] || Math.floor(context.map().zoom());
56798       var center = context.map().center();
56799       _metadata.zoom = String(zoom);
56800       selection2.selectAll(".background-info-list-zoom").classed("hide", false).selectAll(".background-info-span-zoom").text(_metadata.zoom);
56801       if (!d2 || !d2.length >= 3) return;
56802       background.baseLayerSource().getMetadata(center, d2, function(err, result) {
56803         if (err || _currSourceName !== sourceName) return;
56804         var vintage = result.vintage;
56805         _metadata.vintage = vintage && vintage.range || _t("info_panels.background.unknown");
56806         selection2.selectAll(".background-info-list-vintage").classed("hide", false).selectAll(".background-info-span-vintage").text(_metadata.vintage);
56807         _metadataKeys.forEach(function(k2) {
56808           if (k2 === "zoom" || k2 === "vintage") return;
56809           var val = result[k2];
56810           _metadata[k2] = val;
56811           selection2.selectAll(".background-info-list-" + k2).classed("hide", !val).selectAll(".background-info-span-" + k2).text(val);
56812         });
56813       });
56814     }
56815     var panel = function(selection2) {
56816       selection2.call(redraw);
56817       context.map().on("drawn.info-background", function() {
56818         selection2.call(debouncedRedraw);
56819       }).on("move.info-background", function() {
56820         selection2.call(debouncedGetMetadata);
56821       });
56822     };
56823     panel.off = function() {
56824       context.map().on("drawn.info-background", null).on("move.info-background", null);
56825     };
56826     panel.id = "background";
56827     panel.label = _t.append("info_panels.background.title");
56828     panel.key = _t("info_panels.background.key");
56829     return panel;
56830   }
56831
56832   // modules/ui/panels/history.js
56833   function uiPanelHistory(context) {
56834     var osm;
56835     function displayTimestamp(timestamp) {
56836       if (!timestamp) return _t("info_panels.history.unknown");
56837       var options2 = {
56838         day: "numeric",
56839         month: "short",
56840         year: "numeric",
56841         hour: "numeric",
56842         minute: "numeric",
56843         second: "numeric"
56844       };
56845       var d2 = new Date(timestamp);
56846       if (isNaN(d2.getTime())) return _t("info_panels.history.unknown");
56847       return d2.toLocaleString(_mainLocalizer.localeCode(), options2);
56848     }
56849     function displayUser(selection2, userName) {
56850       if (!userName) {
56851         selection2.append("span").call(_t.append("info_panels.history.unknown"));
56852         return;
56853       }
56854       selection2.append("span").attr("class", "user-name").text(userName);
56855       var links = selection2.append("div").attr("class", "links");
56856       if (osm) {
56857         links.append("a").attr("class", "user-osm-link").attr("href", osm.userURL(userName)).attr("target", "_blank").call(_t.append("info_panels.history.profile_link"));
56858       }
56859       links.append("a").attr("class", "user-hdyc-link").attr("href", "https://hdyc.neis-one.org/?" + userName).attr("target", "_blank").attr("tabindex", -1).text("HDYC");
56860     }
56861     function displayChangeset(selection2, changeset) {
56862       if (!changeset) {
56863         selection2.append("span").call(_t.append("info_panels.history.unknown"));
56864         return;
56865       }
56866       selection2.append("span").attr("class", "changeset-id").text(changeset);
56867       var links = selection2.append("div").attr("class", "links");
56868       if (osm) {
56869         links.append("a").attr("class", "changeset-osm-link").attr("href", osm.changesetURL(changeset)).attr("target", "_blank").call(_t.append("info_panels.history.changeset_link"));
56870       }
56871       links.append("a").attr("class", "changeset-osmcha-link").attr("href", "https://osmcha.org/changesets/" + changeset).attr("target", "_blank").text("OSMCha");
56872       links.append("a").attr("class", "changeset-achavi-link").attr("href", "https://overpass-api.de/achavi/?changeset=" + changeset).attr("target", "_blank").text("Achavi");
56873     }
56874     function redraw(selection2) {
56875       var selectedNoteID = context.selectedNoteID();
56876       osm = context.connection();
56877       var selected, note, entity;
56878       if (selectedNoteID && osm) {
56879         selected = [_t.html("note.note") + " " + selectedNoteID];
56880         note = osm.getNote(selectedNoteID);
56881       } else {
56882         selected = context.selectedIDs().filter(function(e3) {
56883           return context.hasEntity(e3);
56884         });
56885         if (selected.length) {
56886           entity = context.entity(selected[0]);
56887         }
56888       }
56889       var singular = selected.length === 1 ? selected[0] : null;
56890       selection2.html("");
56891       if (singular) {
56892         selection2.append("h4").attr("class", "history-heading").html(singular);
56893       } else {
56894         selection2.append("h4").attr("class", "history-heading").call(_t.append("info_panels.selected", { n: selected.length }));
56895       }
56896       if (!singular) return;
56897       if (entity) {
56898         selection2.call(redrawEntity, entity);
56899       } else if (note) {
56900         selection2.call(redrawNote, note);
56901       }
56902     }
56903     function redrawNote(selection2, note) {
56904       if (!note || note.isNew()) {
56905         selection2.append("div").call(_t.append("info_panels.history.note_no_history"));
56906         return;
56907       }
56908       var list2 = selection2.append("ul");
56909       list2.append("li").call(_t.append("info_panels.history.note_comments", { suffix: ":" })).append("span").text(note.comments.length);
56910       if (note.comments.length) {
56911         list2.append("li").call(_t.append("info_panels.history.note_created_date", { suffix: ":" })).append("span").text(displayTimestamp(note.comments[0].date));
56912         list2.append("li").call(_t.append("info_panels.history.note_created_user", { suffix: ":" })).call(displayUser, note.comments[0].user);
56913       }
56914       if (osm) {
56915         selection2.append("a").attr("class", "view-history-on-osm").attr("target", "_blank").attr("href", osm.noteURL(note)).call(svgIcon("#iD-icon-out-link", "inline")).append("span").call(_t.append("info_panels.history.note_link_text"));
56916       }
56917     }
56918     function redrawEntity(selection2, entity) {
56919       if (!entity || entity.isNew()) {
56920         selection2.append("div").call(_t.append("info_panels.history.no_history"));
56921         return;
56922       }
56923       var links = selection2.append("div").attr("class", "links");
56924       if (osm) {
56925         links.append("a").attr("class", "view-history-on-osm").attr("href", osm.historyURL(entity)).attr("target", "_blank").call(_t.append("info_panels.history.history_link"));
56926       }
56927       links.append("a").attr("class", "pewu-history-viewer-link").attr("href", "https://pewu.github.io/osm-history/#/" + entity.type + "/" + entity.osmId()).attr("target", "_blank").attr("tabindex", -1).text("PeWu");
56928       var list2 = selection2.append("ul");
56929       list2.append("li").call(_t.append("info_panels.history.version", { suffix: ":" })).append("span").text(entity.version);
56930       list2.append("li").call(_t.append("info_panels.history.last_edit", { suffix: ":" })).append("span").text(displayTimestamp(entity.timestamp));
56931       list2.append("li").call(_t.append("info_panels.history.edited_by", { suffix: ":" })).call(displayUser, entity.user);
56932       list2.append("li").call(_t.append("info_panels.history.changeset", { suffix: ":" })).call(displayChangeset, entity.changeset);
56933     }
56934     var panel = function(selection2) {
56935       selection2.call(redraw);
56936       context.map().on("drawn.info-history", function() {
56937         selection2.call(redraw);
56938       });
56939       context.on("enter.info-history", function() {
56940         selection2.call(redraw);
56941       });
56942     };
56943     panel.off = function() {
56944       context.map().on("drawn.info-history", null);
56945       context.on("enter.info-history", null);
56946     };
56947     panel.id = "history";
56948     panel.label = _t.append("info_panels.history.title");
56949     panel.key = _t("info_panels.history.key");
56950     return panel;
56951   }
56952
56953   // modules/ui/panels/location.js
56954   function uiPanelLocation(context) {
56955     var currLocation = "";
56956     function redraw(selection2) {
56957       selection2.html("");
56958       var list2 = selection2.append("ul");
56959       var coord2 = context.map().mouseCoordinates();
56960       if (coord2.some(isNaN)) {
56961         coord2 = context.map().center();
56962       }
56963       list2.append("li").text(dmsCoordinatePair(coord2)).append("li").text(decimalCoordinatePair(coord2));
56964       selection2.append("div").attr("class", "location-info").text(currLocation || " ");
56965       debouncedGetLocation(selection2, coord2);
56966     }
56967     var debouncedGetLocation = debounce_default(getLocation, 250);
56968     function getLocation(selection2, coord2) {
56969       if (!services.geocoder) {
56970         currLocation = _t("info_panels.location.unknown_location");
56971         selection2.selectAll(".location-info").text(currLocation);
56972       } else {
56973         services.geocoder.reverse(coord2, function(err, result) {
56974           currLocation = result ? result.display_name : _t("info_panels.location.unknown_location");
56975           selection2.selectAll(".location-info").text(currLocation);
56976         });
56977       }
56978     }
56979     var panel = function(selection2) {
56980       selection2.call(redraw);
56981       context.surface().on(("PointerEvent" in window ? "pointer" : "mouse") + "move.info-location", function() {
56982         selection2.call(redraw);
56983       });
56984     };
56985     panel.off = function() {
56986       context.surface().on(".info-location", null);
56987     };
56988     panel.id = "location";
56989     panel.label = _t.append("info_panels.location.title");
56990     panel.key = _t("info_panels.location.key");
56991     return panel;
56992   }
56993
56994   // modules/ui/panels/measurement.js
56995   function uiPanelMeasurement(context) {
56996     function radiansToMeters(r2) {
56997       return r2 * 63710071809e-4;
56998     }
56999     function steradiansToSqmeters(r2) {
57000       return r2 / (4 * Math.PI) * 510065621724e3;
57001     }
57002     function toLineString(feature3) {
57003       if (feature3.type === "LineString") return feature3;
57004       var result = { type: "LineString", coordinates: [] };
57005       if (feature3.type === "Polygon") {
57006         result.coordinates = feature3.coordinates[0];
57007       } else if (feature3.type === "MultiPolygon") {
57008         result.coordinates = feature3.coordinates[0][0];
57009       }
57010       return result;
57011     }
57012     var _isImperial = !_mainLocalizer.usesMetric();
57013     function redraw(selection2) {
57014       var graph = context.graph();
57015       var selectedNoteID = context.selectedNoteID();
57016       var osm = services.osm;
57017       var localeCode = _mainLocalizer.localeCode();
57018       var heading2;
57019       var center, location, centroid;
57020       var closed, geometry;
57021       var totalNodeCount, length2 = 0, area = 0, distance;
57022       if (selectedNoteID && osm) {
57023         var note = osm.getNote(selectedNoteID);
57024         heading2 = _t.html("note.note") + " " + selectedNoteID;
57025         location = note.loc;
57026         geometry = "note";
57027       } else {
57028         var selectedIDs = context.selectedIDs().filter(function(id2) {
57029           return context.hasEntity(id2);
57030         });
57031         var selected = selectedIDs.map(function(id2) {
57032           return context.entity(id2);
57033         });
57034         heading2 = selected.length === 1 ? selected[0].id : _t.html("info_panels.selected", { n: selected.length });
57035         if (selected.length) {
57036           var extent = geoExtent();
57037           for (var i3 in selected) {
57038             var entity = selected[i3];
57039             extent._extend(entity.extent(graph));
57040             geometry = entity.geometry(graph);
57041             if (geometry === "line" || geometry === "area") {
57042               closed = entity.type === "relation" || entity.isClosed() && !entity.isDegenerate();
57043               var feature3 = entity.asGeoJSON(graph);
57044               length2 += radiansToMeters(length_default(toLineString(feature3)));
57045               centroid = path_default(context.projection).centroid(entity.asGeoJSON(graph));
57046               centroid = centroid && context.projection.invert(centroid);
57047               if (!centroid || !isFinite(centroid[0]) || !isFinite(centroid[1])) {
57048                 centroid = entity.extent(graph).center();
57049               }
57050               if (closed) {
57051                 area += steradiansToSqmeters(entity.area(graph));
57052               }
57053             }
57054           }
57055           if (selected.length > 1) {
57056             geometry = null;
57057             closed = null;
57058             centroid = null;
57059           }
57060           if (selected.length === 2 && selected[0].type === "node" && selected[1].type === "node") {
57061             distance = geoSphericalDistance(selected[0].loc, selected[1].loc);
57062           }
57063           if (selected.length === 1 && selected[0].type === "node") {
57064             location = selected[0].loc;
57065           } else {
57066             totalNodeCount = utilGetAllNodes(selectedIDs, context.graph()).length;
57067           }
57068           if (!location && !centroid) {
57069             center = extent.center();
57070           }
57071         }
57072       }
57073       selection2.html("");
57074       if (heading2) {
57075         selection2.append("h4").attr("class", "measurement-heading").html(heading2);
57076       }
57077       var list2 = selection2.append("ul");
57078       var coordItem;
57079       if (geometry) {
57080         list2.append("li").call(_t.append("info_panels.measurement.geometry", { suffix: ":" })).append("span").html(
57081           closed ? _t.html("info_panels.measurement.closed_" + geometry) : _t.html("geometry." + geometry)
57082         );
57083       }
57084       if (totalNodeCount) {
57085         list2.append("li").call(_t.append("info_panels.measurement.node_count", { suffix: ":" })).append("span").text(totalNodeCount.toLocaleString(localeCode));
57086       }
57087       if (area) {
57088         list2.append("li").call(_t.append("info_panels.measurement.area", { suffix: ":" })).append("span").text(displayArea(area, _isImperial));
57089       }
57090       if (length2) {
57091         list2.append("li").call(_t.append("info_panels.measurement." + (closed ? "perimeter" : "length"), { suffix: ":" })).append("span").text(displayLength(length2, _isImperial));
57092       }
57093       if (typeof distance === "number") {
57094         list2.append("li").call(_t.append("info_panels.measurement.distance", { suffix: ":" })).append("span").text(displayLength(distance, _isImperial));
57095       }
57096       if (location) {
57097         coordItem = list2.append("li").call(_t.append("info_panels.measurement.location", { suffix: ":" }));
57098         coordItem.append("span").text(dmsCoordinatePair(location));
57099         coordItem.append("span").text(decimalCoordinatePair(location));
57100       }
57101       if (centroid) {
57102         coordItem = list2.append("li").call(_t.append("info_panels.measurement.centroid", { suffix: ":" }));
57103         coordItem.append("span").text(dmsCoordinatePair(centroid));
57104         coordItem.append("span").text(decimalCoordinatePair(centroid));
57105       }
57106       if (center) {
57107         coordItem = list2.append("li").call(_t.append("info_panels.measurement.center", { suffix: ":" }));
57108         coordItem.append("span").text(dmsCoordinatePair(center));
57109         coordItem.append("span").text(decimalCoordinatePair(center));
57110       }
57111       if (length2 || area || typeof distance === "number") {
57112         var toggle = _isImperial ? "imperial" : "metric";
57113         selection2.append("a").call(_t.append("info_panels.measurement." + toggle)).attr("href", "#").attr("class", "button button-toggle-units").on("click", function(d3_event) {
57114           d3_event.preventDefault();
57115           _isImperial = !_isImperial;
57116           selection2.call(redraw);
57117         });
57118       }
57119     }
57120     var panel = function(selection2) {
57121       selection2.call(redraw);
57122       context.map().on("drawn.info-measurement", function() {
57123         selection2.call(redraw);
57124       });
57125       context.on("enter.info-measurement", function() {
57126         selection2.call(redraw);
57127       });
57128     };
57129     panel.off = function() {
57130       context.map().on("drawn.info-measurement", null);
57131       context.on("enter.info-measurement", null);
57132     };
57133     panel.id = "measurement";
57134     panel.label = _t.append("info_panels.measurement.title");
57135     panel.key = _t("info_panels.measurement.key");
57136     return panel;
57137   }
57138
57139   // modules/ui/panels/index.js
57140   var uiInfoPanels = {
57141     background: uiPanelBackground,
57142     history: uiPanelHistory,
57143     location: uiPanelLocation,
57144     measurement: uiPanelMeasurement
57145   };
57146
57147   // modules/ui/info.js
57148   function uiInfo(context) {
57149     var ids = Object.keys(uiInfoPanels);
57150     var wasActive = ["measurement"];
57151     var panels = {};
57152     var active = {};
57153     ids.forEach(function(k2) {
57154       if (!panels[k2]) {
57155         panels[k2] = uiInfoPanels[k2](context);
57156         active[k2] = false;
57157       }
57158     });
57159     function info(selection2) {
57160       function redraw() {
57161         var activeids = ids.filter(function(k2) {
57162           return active[k2];
57163         }).sort();
57164         var containers = infoPanels.selectAll(".panel-container").data(activeids, function(k2) {
57165           return k2;
57166         });
57167         containers.exit().style("opacity", 1).transition().duration(200).style("opacity", 0).on("end", function(d2) {
57168           select_default2(this).call(panels[d2].off).remove();
57169         });
57170         var enter = containers.enter().append("div").attr("class", function(d2) {
57171           return "fillD2 panel-container panel-container-" + d2;
57172         });
57173         enter.style("opacity", 0).transition().duration(200).style("opacity", 1);
57174         var title = enter.append("div").attr("class", "panel-title fillD2");
57175         title.append("h3").each(function(d2) {
57176           return panels[d2].label(select_default2(this));
57177         });
57178         title.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function(d3_event, d2) {
57179           d3_event.stopImmediatePropagation();
57180           d3_event.preventDefault();
57181           info.toggle(d2);
57182         }).call(svgIcon("#iD-icon-close"));
57183         enter.append("div").attr("class", function(d2) {
57184           return "panel-content panel-content-" + d2;
57185         });
57186         infoPanels.selectAll(".panel-content").each(function(d2) {
57187           select_default2(this).call(panels[d2]);
57188         });
57189       }
57190       info.toggle = function(which) {
57191         var activeids = ids.filter(function(k2) {
57192           return active[k2];
57193         });
57194         if (which) {
57195           active[which] = !active[which];
57196           if (activeids.length === 1 && activeids[0] === which) {
57197             wasActive = [which];
57198           }
57199           context.container().select("." + which + "-panel-toggle-item").classed("active", active[which]).select("input").property("checked", active[which]);
57200         } else {
57201           if (activeids.length) {
57202             wasActive = activeids;
57203             activeids.forEach(function(k2) {
57204               active[k2] = false;
57205             });
57206           } else {
57207             wasActive.forEach(function(k2) {
57208               active[k2] = true;
57209             });
57210           }
57211         }
57212         redraw();
57213       };
57214       var infoPanels = selection2.selectAll(".info-panels").data([0]);
57215       infoPanels = infoPanels.enter().append("div").attr("class", "info-panels").merge(infoPanels);
57216       redraw();
57217       context.keybinding().on(uiCmd("\u2318" + _t("info_panels.key")), function(d3_event) {
57218         d3_event.stopImmediatePropagation();
57219         d3_event.preventDefault();
57220         info.toggle();
57221       });
57222       ids.forEach(function(k2) {
57223         var key = _t("info_panels." + k2 + ".key", { default: null });
57224         if (!key) return;
57225         context.keybinding().on(uiCmd("\u2318\u21E7" + key), function(d3_event) {
57226           d3_event.stopImmediatePropagation();
57227           d3_event.preventDefault();
57228           info.toggle(k2);
57229         });
57230       });
57231     }
57232     return info;
57233   }
57234
57235   // modules/ui/toggle.js
57236   function uiToggle(show, callback) {
57237     return function(selection2) {
57238       selection2.style("opacity", show ? 0 : 1).classed("hide", false).transition().style("opacity", show ? 1 : 0).on("end", function() {
57239         select_default2(this).classed("hide", !show).style("opacity", null);
57240         if (callback) callback.apply(this);
57241       });
57242     };
57243   }
57244
57245   // modules/ui/curtain.js
57246   function uiCurtain(containerNode) {
57247     var surface = select_default2(null), tooltip = select_default2(null), darkness = select_default2(null);
57248     function curtain(selection2) {
57249       surface = selection2.append("svg").attr("class", "curtain").style("top", 0).style("left", 0);
57250       darkness = surface.append("path").attr("x", 0).attr("y", 0).attr("class", "curtain-darkness");
57251       select_default2(window).on("resize.curtain", resize);
57252       tooltip = selection2.append("div").attr("class", "tooltip");
57253       tooltip.append("div").attr("class", "popover-arrow");
57254       tooltip.append("div").attr("class", "popover-inner");
57255       resize();
57256       function resize() {
57257         surface.attr("width", containerNode.clientWidth).attr("height", containerNode.clientHeight);
57258         curtain.cut(darkness.datum());
57259       }
57260     }
57261     curtain.reveal = function(box, html3, options2) {
57262       options2 = options2 || {};
57263       if (typeof box === "string") {
57264         box = select_default2(box).node();
57265       }
57266       if (box && box.getBoundingClientRect) {
57267         box = copyBox(box.getBoundingClientRect());
57268         var containerRect = containerNode.getBoundingClientRect();
57269         box.top -= containerRect.top;
57270         box.left -= containerRect.left;
57271       }
57272       if (box && options2.padding) {
57273         box.top -= options2.padding;
57274         box.left -= options2.padding;
57275         box.bottom += options2.padding;
57276         box.right += options2.padding;
57277         box.height += options2.padding * 2;
57278         box.width += options2.padding * 2;
57279       }
57280       var tooltipBox;
57281       if (options2.tooltipBox) {
57282         tooltipBox = options2.tooltipBox;
57283         if (typeof tooltipBox === "string") {
57284           tooltipBox = select_default2(tooltipBox).node();
57285         }
57286         if (tooltipBox && tooltipBox.getBoundingClientRect) {
57287           tooltipBox = copyBox(tooltipBox.getBoundingClientRect());
57288         }
57289       } else {
57290         tooltipBox = box;
57291       }
57292       if (tooltipBox && html3) {
57293         if (html3.indexOf("**") !== -1) {
57294           if (html3.indexOf("<span") === 0) {
57295             html3 = html3.replace(/^(<span.*?>)(.+?)(\*\*)/, "$1<span>$2</span>$3");
57296           } else {
57297             html3 = html3.replace(/^(.+?)(\*\*)/, "<span>$1</span>$2");
57298           }
57299           html3 = html3.replace(/\*\*(.*?)\*\*/g, '<span class="instruction">$1</span>');
57300         }
57301         html3 = html3.replace(/\*(.*?)\*/g, "<em>$1</em>");
57302         html3 = html3.replace(/\{br\}/g, "<br/><br/>");
57303         if (options2.buttonText && options2.buttonCallback) {
57304           html3 += '<div class="button-section"><button href="#" class="button action">' + options2.buttonText + "</button></div>";
57305         }
57306         var classes = "curtain-tooltip popover tooltip arrowed in " + (options2.tooltipClass || "");
57307         tooltip.classed(classes, true).selectAll(".popover-inner").html(html3);
57308         if (options2.buttonText && options2.buttonCallback) {
57309           var button = tooltip.selectAll(".button-section .button.action");
57310           button.on("click", function(d3_event) {
57311             d3_event.preventDefault();
57312             options2.buttonCallback();
57313           });
57314         }
57315         var tip = copyBox(tooltip.node().getBoundingClientRect()), w2 = containerNode.clientWidth, h2 = containerNode.clientHeight, tooltipWidth = 200, tooltipArrow = 5, side, pos;
57316         if (options2.tooltipClass === "intro-mouse") {
57317           tip.height += 80;
57318         }
57319         if (tooltipBox.top + tooltipBox.height > h2) {
57320           tooltipBox.height -= tooltipBox.top + tooltipBox.height - h2;
57321         }
57322         if (tooltipBox.left + tooltipBox.width > w2) {
57323           tooltipBox.width -= tooltipBox.left + tooltipBox.width - w2;
57324         }
57325         if (tooltipBox.top + tooltipBox.height < 100) {
57326           side = "bottom";
57327           pos = [
57328             tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
57329             tooltipBox.top + tooltipBox.height
57330           ];
57331         } else if (tooltipBox.top > h2 - 140) {
57332           side = "top";
57333           pos = [
57334             tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
57335             tooltipBox.top - tip.height
57336           ];
57337         } else {
57338           var tipY = tooltipBox.top + tooltipBox.height / 2 - tip.height / 2;
57339           if (_mainLocalizer.textDirection() === "rtl") {
57340             if (tooltipBox.left - tooltipWidth - tooltipArrow < 70) {
57341               side = "right";
57342               pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
57343             } else {
57344               side = "left";
57345               pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
57346             }
57347           } else {
57348             if (tooltipBox.left + tooltipBox.width + tooltipArrow + tooltipWidth > w2 - 70) {
57349               side = "left";
57350               pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
57351             } else {
57352               side = "right";
57353               pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
57354             }
57355           }
57356         }
57357         if (options2.duration !== 0 || !tooltip.classed(side)) {
57358           tooltip.call(uiToggle(true));
57359         }
57360         tooltip.style("top", pos[1] + "px").style("left", pos[0] + "px").attr("class", classes + " " + side);
57361         var shiftY = 0;
57362         if (side === "left" || side === "right") {
57363           if (pos[1] < 60) {
57364             shiftY = 60 - pos[1];
57365           } else if (pos[1] + tip.height > h2 - 100) {
57366             shiftY = h2 - pos[1] - tip.height - 100;
57367           }
57368         }
57369         tooltip.selectAll(".popover-inner").style("top", shiftY + "px");
57370       } else {
57371         tooltip.classed("in", false).call(uiToggle(false));
57372       }
57373       curtain.cut(box, options2.duration);
57374       return tooltip;
57375     };
57376     curtain.cut = function(datum2, duration) {
57377       darkness.datum(datum2).interrupt();
57378       var selection2;
57379       if (duration === 0) {
57380         selection2 = darkness;
57381       } else {
57382         selection2 = darkness.transition().duration(duration || 600).ease(linear2);
57383       }
57384       selection2.attr("d", function(d2) {
57385         var containerWidth = containerNode.clientWidth;
57386         var containerHeight = containerNode.clientHeight;
57387         var string = "M 0,0 L 0," + containerHeight + " L " + containerWidth + "," + containerHeight + "L" + containerWidth + ",0 Z";
57388         if (!d2) return string;
57389         return string + "M" + d2.left + "," + d2.top + "L" + d2.left + "," + (d2.top + d2.height) + "L" + (d2.left + d2.width) + "," + (d2.top + d2.height) + "L" + (d2.left + d2.width) + "," + d2.top + "Z";
57390       });
57391     };
57392     curtain.remove = function() {
57393       surface.remove();
57394       tooltip.remove();
57395       select_default2(window).on("resize.curtain", null);
57396     };
57397     function copyBox(src) {
57398       return {
57399         top: src.top,
57400         right: src.right,
57401         bottom: src.bottom,
57402         left: src.left,
57403         width: src.width,
57404         height: src.height
57405       };
57406     }
57407     return curtain;
57408   }
57409
57410   // modules/ui/intro/welcome.js
57411   function uiIntroWelcome(context, reveal) {
57412     var dispatch14 = dispatch_default("done");
57413     var chapter = {
57414       title: "intro.welcome.title"
57415     };
57416     function welcome() {
57417       context.map().centerZoom([-85.63591, 41.94285], 19);
57418       reveal(
57419         ".intro-nav-wrap .chapter-welcome",
57420         helpHtml("intro.welcome.welcome"),
57421         { buttonText: _t.html("intro.ok"), buttonCallback: practice }
57422       );
57423     }
57424     function practice() {
57425       reveal(
57426         ".intro-nav-wrap .chapter-welcome",
57427         helpHtml("intro.welcome.practice"),
57428         { buttonText: _t.html("intro.ok"), buttonCallback: words }
57429       );
57430     }
57431     function words() {
57432       reveal(
57433         ".intro-nav-wrap .chapter-welcome",
57434         helpHtml("intro.welcome.words"),
57435         { buttonText: _t.html("intro.ok"), buttonCallback: chapters }
57436       );
57437     }
57438     function chapters() {
57439       dispatch14.call("done");
57440       reveal(
57441         ".intro-nav-wrap .chapter-navigation",
57442         helpHtml("intro.welcome.chapters", { next: _t("intro.navigation.title") })
57443       );
57444     }
57445     chapter.enter = function() {
57446       welcome();
57447     };
57448     chapter.exit = function() {
57449       context.container().select(".curtain-tooltip.intro-mouse").selectAll(".counter").remove();
57450     };
57451     chapter.restart = function() {
57452       chapter.exit();
57453       chapter.enter();
57454     };
57455     return utilRebind(chapter, dispatch14, "on");
57456   }
57457
57458   // modules/ui/intro/navigation.js
57459   function uiIntroNavigation(context, reveal) {
57460     var dispatch14 = dispatch_default("done");
57461     var timeouts = [];
57462     var hallId = "n2061";
57463     var townHall = [-85.63591, 41.94285];
57464     var springStreetId = "w397";
57465     var springStreetEndId = "n1834";
57466     var springStreet = [-85.63582, 41.94255];
57467     var onewayField = _mainPresetIndex.field("oneway");
57468     var maxspeedField = _mainPresetIndex.field("maxspeed");
57469     var chapter = {
57470       title: "intro.navigation.title"
57471     };
57472     function timeout2(f2, t2) {
57473       timeouts.push(window.setTimeout(f2, t2));
57474     }
57475     function eventCancel(d3_event) {
57476       d3_event.stopPropagation();
57477       d3_event.preventDefault();
57478     }
57479     function isTownHallSelected() {
57480       var ids = context.selectedIDs();
57481       return ids.length === 1 && ids[0] === hallId;
57482     }
57483     function dragMap() {
57484       context.enter(modeBrowse(context));
57485       context.history().reset("initial");
57486       var msec = transitionTime(townHall, context.map().center());
57487       if (msec) {
57488         reveal(null, null, { duration: 0 });
57489       }
57490       context.map().centerZoomEase(townHall, 19, msec);
57491       timeout2(function() {
57492         var centerStart = context.map().center();
57493         var textId = context.lastPointerType() === "mouse" ? "drag" : "drag_touch";
57494         var dragString = helpHtml("intro.navigation.map_info") + "{br}" + helpHtml("intro.navigation." + textId);
57495         reveal(".surface", dragString);
57496         context.map().on("drawn.intro", function() {
57497           reveal(".surface", dragString, { duration: 0 });
57498         });
57499         context.map().on("move.intro", function() {
57500           var centerNow = context.map().center();
57501           if (centerStart[0] !== centerNow[0] || centerStart[1] !== centerNow[1]) {
57502             context.map().on("move.intro", null);
57503             timeout2(function() {
57504               continueTo(zoomMap);
57505             }, 3e3);
57506           }
57507         });
57508       }, msec + 100);
57509       function continueTo(nextStep) {
57510         context.map().on("move.intro drawn.intro", null);
57511         nextStep();
57512       }
57513     }
57514     function zoomMap() {
57515       var zoomStart = context.map().zoom();
57516       var textId = context.lastPointerType() === "mouse" ? "zoom" : "zoom_touch";
57517       var zoomString = helpHtml("intro.navigation." + textId);
57518       reveal(".surface", zoomString);
57519       context.map().on("drawn.intro", function() {
57520         reveal(".surface", zoomString, { duration: 0 });
57521       });
57522       context.map().on("move.intro", function() {
57523         if (context.map().zoom() !== zoomStart) {
57524           context.map().on("move.intro", null);
57525           timeout2(function() {
57526             continueTo(features);
57527           }, 3e3);
57528         }
57529       });
57530       function continueTo(nextStep) {
57531         context.map().on("move.intro drawn.intro", null);
57532         nextStep();
57533       }
57534     }
57535     function features() {
57536       var onClick = function() {
57537         continueTo(pointsLinesAreas);
57538       };
57539       reveal(
57540         ".surface",
57541         helpHtml("intro.navigation.features"),
57542         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57543       );
57544       context.map().on("drawn.intro", function() {
57545         reveal(
57546           ".surface",
57547           helpHtml("intro.navigation.features"),
57548           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57549         );
57550       });
57551       function continueTo(nextStep) {
57552         context.map().on("drawn.intro", null);
57553         nextStep();
57554       }
57555     }
57556     function pointsLinesAreas() {
57557       var onClick = function() {
57558         continueTo(nodesWays);
57559       };
57560       reveal(
57561         ".surface",
57562         helpHtml("intro.navigation.points_lines_areas"),
57563         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57564       );
57565       context.map().on("drawn.intro", function() {
57566         reveal(
57567           ".surface",
57568           helpHtml("intro.navigation.points_lines_areas"),
57569           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57570         );
57571       });
57572       function continueTo(nextStep) {
57573         context.map().on("drawn.intro", null);
57574         nextStep();
57575       }
57576     }
57577     function nodesWays() {
57578       var onClick = function() {
57579         continueTo(clickTownHall);
57580       };
57581       reveal(
57582         ".surface",
57583         helpHtml("intro.navigation.nodes_ways"),
57584         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57585       );
57586       context.map().on("drawn.intro", function() {
57587         reveal(
57588           ".surface",
57589           helpHtml("intro.navigation.nodes_ways"),
57590           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57591         );
57592       });
57593       function continueTo(nextStep) {
57594         context.map().on("drawn.intro", null);
57595         nextStep();
57596       }
57597     }
57598     function clickTownHall() {
57599       context.enter(modeBrowse(context));
57600       context.history().reset("initial");
57601       var entity = context.hasEntity(hallId);
57602       if (!entity) return;
57603       reveal(null, null, { duration: 0 });
57604       context.map().centerZoomEase(entity.loc, 19, 500);
57605       timeout2(function() {
57606         var entity2 = context.hasEntity(hallId);
57607         if (!entity2) return;
57608         var box = pointBox(entity2.loc, context);
57609         var textId = context.lastPointerType() === "mouse" ? "click_townhall" : "tap_townhall";
57610         reveal(box, helpHtml("intro.navigation." + textId));
57611         context.map().on("move.intro drawn.intro", function() {
57612           var entity3 = context.hasEntity(hallId);
57613           if (!entity3) return;
57614           var box2 = pointBox(entity3.loc, context);
57615           reveal(box2, helpHtml("intro.navigation." + textId), { duration: 0 });
57616         });
57617         context.on("enter.intro", function() {
57618           if (isTownHallSelected()) continueTo(selectedTownHall);
57619         });
57620       }, 550);
57621       context.history().on("change.intro", function() {
57622         if (!context.hasEntity(hallId)) {
57623           continueTo(clickTownHall);
57624         }
57625       });
57626       function continueTo(nextStep) {
57627         context.on("enter.intro", null);
57628         context.map().on("move.intro drawn.intro", null);
57629         context.history().on("change.intro", null);
57630         nextStep();
57631       }
57632     }
57633     function selectedTownHall() {
57634       if (!isTownHallSelected()) return clickTownHall();
57635       var entity = context.hasEntity(hallId);
57636       if (!entity) return clickTownHall();
57637       var box = pointBox(entity.loc, context);
57638       var onClick = function() {
57639         continueTo(editorTownHall);
57640       };
57641       reveal(
57642         box,
57643         helpHtml("intro.navigation.selected_townhall"),
57644         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57645       );
57646       context.map().on("move.intro drawn.intro", function() {
57647         var entity2 = context.hasEntity(hallId);
57648         if (!entity2) return;
57649         var box2 = pointBox(entity2.loc, context);
57650         reveal(
57651           box2,
57652           helpHtml("intro.navigation.selected_townhall"),
57653           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57654         );
57655       });
57656       context.history().on("change.intro", function() {
57657         if (!context.hasEntity(hallId)) {
57658           continueTo(clickTownHall);
57659         }
57660       });
57661       function continueTo(nextStep) {
57662         context.map().on("move.intro drawn.intro", null);
57663         context.history().on("change.intro", null);
57664         nextStep();
57665       }
57666     }
57667     function editorTownHall() {
57668       if (!isTownHallSelected()) return clickTownHall();
57669       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
57670       var onClick = function() {
57671         continueTo(presetTownHall);
57672       };
57673       reveal(
57674         ".entity-editor-pane",
57675         helpHtml("intro.navigation.editor_townhall"),
57676         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57677       );
57678       context.on("exit.intro", function() {
57679         continueTo(clickTownHall);
57680       });
57681       context.history().on("change.intro", function() {
57682         if (!context.hasEntity(hallId)) {
57683           continueTo(clickTownHall);
57684         }
57685       });
57686       function continueTo(nextStep) {
57687         context.on("exit.intro", null);
57688         context.history().on("change.intro", null);
57689         context.container().select(".inspector-wrap").on("wheel.intro", null);
57690         nextStep();
57691       }
57692     }
57693     function presetTownHall() {
57694       if (!isTownHallSelected()) return clickTownHall();
57695       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
57696       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
57697       var entity = context.entity(context.selectedIDs()[0]);
57698       var preset = _mainPresetIndex.match(entity, context.graph());
57699       var onClick = function() {
57700         continueTo(fieldsTownHall);
57701       };
57702       reveal(
57703         ".entity-editor-pane .section-feature-type",
57704         helpHtml("intro.navigation.preset_townhall", { preset: preset.name() }),
57705         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57706       );
57707       context.on("exit.intro", function() {
57708         continueTo(clickTownHall);
57709       });
57710       context.history().on("change.intro", function() {
57711         if (!context.hasEntity(hallId)) {
57712           continueTo(clickTownHall);
57713         }
57714       });
57715       function continueTo(nextStep) {
57716         context.on("exit.intro", null);
57717         context.history().on("change.intro", null);
57718         context.container().select(".inspector-wrap").on("wheel.intro", null);
57719         nextStep();
57720       }
57721     }
57722     function fieldsTownHall() {
57723       if (!isTownHallSelected()) return clickTownHall();
57724       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
57725       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
57726       var onClick = function() {
57727         continueTo(closeTownHall);
57728       };
57729       reveal(
57730         ".entity-editor-pane .section-preset-fields",
57731         helpHtml("intro.navigation.fields_townhall"),
57732         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57733       );
57734       context.on("exit.intro", function() {
57735         continueTo(clickTownHall);
57736       });
57737       context.history().on("change.intro", function() {
57738         if (!context.hasEntity(hallId)) {
57739           continueTo(clickTownHall);
57740         }
57741       });
57742       function continueTo(nextStep) {
57743         context.on("exit.intro", null);
57744         context.history().on("change.intro", null);
57745         context.container().select(".inspector-wrap").on("wheel.intro", null);
57746         nextStep();
57747       }
57748     }
57749     function closeTownHall() {
57750       if (!isTownHallSelected()) return clickTownHall();
57751       var selector = ".entity-editor-pane button.close svg use";
57752       var href = select_default2(selector).attr("href") || "#iD-icon-close";
57753       reveal(
57754         ".entity-editor-pane",
57755         helpHtml("intro.navigation.close_townhall", { button: { html: icon(href, "inline") } })
57756       );
57757       context.on("exit.intro", function() {
57758         continueTo(searchStreet);
57759       });
57760       context.history().on("change.intro", function() {
57761         var selector2 = ".entity-editor-pane button.close svg use";
57762         var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
57763         reveal(
57764           ".entity-editor-pane",
57765           helpHtml("intro.navigation.close_townhall", { button: { html: icon(href2, "inline") } }),
57766           { duration: 0 }
57767         );
57768       });
57769       function continueTo(nextStep) {
57770         context.on("exit.intro", null);
57771         context.history().on("change.intro", null);
57772         nextStep();
57773       }
57774     }
57775     function searchStreet() {
57776       context.enter(modeBrowse(context));
57777       context.history().reset("initial");
57778       var msec = transitionTime(springStreet, context.map().center());
57779       if (msec) {
57780         reveal(null, null, { duration: 0 });
57781       }
57782       context.map().centerZoomEase(springStreet, 19, msec);
57783       timeout2(function() {
57784         reveal(
57785           ".search-header input",
57786           helpHtml("intro.navigation.search_street", { name: _t("intro.graph.name.spring-street") })
57787         );
57788         context.container().select(".search-header input").on("keyup.intro", checkSearchResult);
57789       }, msec + 100);
57790     }
57791     function checkSearchResult() {
57792       var first = context.container().select(".feature-list-item:nth-child(0n+2)");
57793       var firstName = first.select(".entity-name");
57794       var name = _t("intro.graph.name.spring-street");
57795       if (!firstName.empty() && firstName.html() === name) {
57796         reveal(
57797           first.node(),
57798           helpHtml("intro.navigation.choose_street", { name }),
57799           { duration: 300 }
57800         );
57801         context.on("exit.intro", function() {
57802           continueTo(selectedStreet);
57803         });
57804         context.container().select(".search-header input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
57805       }
57806       function continueTo(nextStep) {
57807         context.on("exit.intro", null);
57808         context.container().select(".search-header input").on("keydown.intro", null).on("keyup.intro", null);
57809         nextStep();
57810       }
57811     }
57812     function selectedStreet() {
57813       if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
57814         return searchStreet();
57815       }
57816       var onClick = function() {
57817         continueTo(editorStreet);
57818       };
57819       var entity = context.entity(springStreetEndId);
57820       var box = pointBox(entity.loc, context);
57821       box.height = 500;
57822       reveal(
57823         box,
57824         helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }),
57825         { duration: 600, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57826       );
57827       timeout2(function() {
57828         context.map().on("move.intro drawn.intro", function() {
57829           var entity2 = context.hasEntity(springStreetEndId);
57830           if (!entity2) return;
57831           var box2 = pointBox(entity2.loc, context);
57832           box2.height = 500;
57833           reveal(
57834             box2,
57835             helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }),
57836             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57837           );
57838         });
57839       }, 600);
57840       context.on("enter.intro", function(mode) {
57841         if (!context.hasEntity(springStreetId)) {
57842           return continueTo(searchStreet);
57843         }
57844         var ids = context.selectedIDs();
57845         if (mode.id !== "select" || !ids.length || ids[0] !== springStreetId) {
57846           context.enter(modeSelect(context, [springStreetId]));
57847         }
57848       });
57849       context.history().on("change.intro", function() {
57850         if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
57851           timeout2(function() {
57852             continueTo(searchStreet);
57853           }, 300);
57854         }
57855       });
57856       function continueTo(nextStep) {
57857         context.map().on("move.intro drawn.intro", null);
57858         context.on("enter.intro", null);
57859         context.history().on("change.intro", null);
57860         nextStep();
57861       }
57862     }
57863     function editorStreet() {
57864       var selector = ".entity-editor-pane button.close svg use";
57865       var href = select_default2(selector).attr("href") || "#iD-icon-close";
57866       reveal(".entity-editor-pane", helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
57867         button: { html: icon(href, "inline") },
57868         field1: onewayField.title(),
57869         field2: maxspeedField.title()
57870       }));
57871       context.on("exit.intro", function() {
57872         continueTo(play);
57873       });
57874       context.history().on("change.intro", function() {
57875         var selector2 = ".entity-editor-pane button.close svg use";
57876         var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
57877         reveal(
57878           ".entity-editor-pane",
57879           helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
57880             button: { html: icon(href2, "inline") },
57881             field1: onewayField.title(),
57882             field2: maxspeedField.title()
57883           }),
57884           { duration: 0 }
57885         );
57886       });
57887       function continueTo(nextStep) {
57888         context.on("exit.intro", null);
57889         context.history().on("change.intro", null);
57890         nextStep();
57891       }
57892     }
57893     function play() {
57894       dispatch14.call("done");
57895       reveal(
57896         ".ideditor",
57897         helpHtml("intro.navigation.play", { next: _t("intro.points.title") }),
57898         {
57899           tooltipBox: ".intro-nav-wrap .chapter-point",
57900           buttonText: _t.html("intro.ok"),
57901           buttonCallback: function() {
57902             reveal(".ideditor");
57903           }
57904         }
57905       );
57906     }
57907     chapter.enter = function() {
57908       dragMap();
57909     };
57910     chapter.exit = function() {
57911       timeouts.forEach(window.clearTimeout);
57912       context.on("enter.intro exit.intro", null);
57913       context.map().on("move.intro drawn.intro", null);
57914       context.history().on("change.intro", null);
57915       context.container().select(".inspector-wrap").on("wheel.intro", null);
57916       context.container().select(".search-header input").on("keydown.intro keyup.intro", null);
57917     };
57918     chapter.restart = function() {
57919       chapter.exit();
57920       chapter.enter();
57921     };
57922     return utilRebind(chapter, dispatch14, "on");
57923   }
57924
57925   // modules/ui/intro/point.js
57926   function uiIntroPoint(context, reveal) {
57927     var dispatch14 = dispatch_default("done");
57928     var timeouts = [];
57929     var intersection2 = [-85.63279, 41.94394];
57930     var building = [-85.632422, 41.944045];
57931     var cafePreset = _mainPresetIndex.item("amenity/cafe");
57932     var _pointID = null;
57933     var chapter = {
57934       title: "intro.points.title"
57935     };
57936     function timeout2(f2, t2) {
57937       timeouts.push(window.setTimeout(f2, t2));
57938     }
57939     function eventCancel(d3_event) {
57940       d3_event.stopPropagation();
57941       d3_event.preventDefault();
57942     }
57943     function addPoint() {
57944       context.enter(modeBrowse(context));
57945       context.history().reset("initial");
57946       var msec = transitionTime(intersection2, context.map().center());
57947       if (msec) {
57948         reveal(null, null, { duration: 0 });
57949       }
57950       context.map().centerZoomEase(intersection2, 19, msec);
57951       timeout2(function() {
57952         var tooltip = reveal(
57953           "button.add-point",
57954           helpHtml("intro.points.points_info") + "{br}" + helpHtml("intro.points.add_point")
57955         );
57956         _pointID = null;
57957         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-points");
57958         context.on("enter.intro", function(mode) {
57959           if (mode.id !== "add-point") return;
57960           continueTo(placePoint);
57961         });
57962       }, msec + 100);
57963       function continueTo(nextStep) {
57964         context.on("enter.intro", null);
57965         nextStep();
57966       }
57967     }
57968     function placePoint() {
57969       if (context.mode().id !== "add-point") {
57970         return chapter.restart();
57971       }
57972       var pointBox2 = pad(building, 150, context);
57973       var textId = context.lastPointerType() === "mouse" ? "place_point" : "place_point_touch";
57974       reveal(pointBox2, helpHtml("intro.points." + textId));
57975       context.map().on("move.intro drawn.intro", function() {
57976         pointBox2 = pad(building, 150, context);
57977         reveal(pointBox2, helpHtml("intro.points." + textId), { duration: 0 });
57978       });
57979       context.on("enter.intro", function(mode) {
57980         if (mode.id !== "select") return chapter.restart();
57981         _pointID = context.mode().selectedIDs()[0];
57982         if (context.graph().geometry(_pointID) === "vertex") {
57983           context.map().on("move.intro drawn.intro", null);
57984           context.on("enter.intro", null);
57985           reveal(pointBox2, helpHtml("intro.points.place_point_error"), {
57986             buttonText: _t.html("intro.ok"),
57987             buttonCallback: function() {
57988               return chapter.restart();
57989             }
57990           });
57991         } else {
57992           continueTo(searchPreset);
57993         }
57994       });
57995       function continueTo(nextStep) {
57996         context.map().on("move.intro drawn.intro", null);
57997         context.on("enter.intro", null);
57998         nextStep();
57999       }
58000     }
58001     function searchPreset() {
58002       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
58003         return addPoint();
58004       }
58005       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58006       context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
58007       reveal(
58008         ".preset-search-input",
58009         helpHtml("intro.points.search_cafe", { preset: cafePreset.name() })
58010       );
58011       context.on("enter.intro", function(mode) {
58012         if (!_pointID || !context.hasEntity(_pointID)) {
58013           return continueTo(addPoint);
58014         }
58015         var ids = context.selectedIDs();
58016         if (mode.id !== "select" || !ids.length || ids[0] !== _pointID) {
58017           context.enter(modeSelect(context, [_pointID]));
58018           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58019           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
58020           reveal(
58021             ".preset-search-input",
58022             helpHtml("intro.points.search_cafe", { preset: cafePreset.name() })
58023           );
58024           context.history().on("change.intro", null);
58025         }
58026       });
58027       function checkPresetSearch() {
58028         var first = context.container().select(".preset-list-item:first-child");
58029         if (first.classed("preset-amenity-cafe")) {
58030           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
58031           reveal(
58032             first.select(".preset-list-button").node(),
58033             helpHtml("intro.points.choose_cafe", { preset: cafePreset.name() }),
58034             { duration: 300 }
58035           );
58036           context.history().on("change.intro", function() {
58037             continueTo(aboutFeatureEditor);
58038           });
58039         }
58040       }
58041       function continueTo(nextStep) {
58042         context.on("enter.intro", null);
58043         context.history().on("change.intro", null);
58044         context.container().select(".inspector-wrap").on("wheel.intro", null);
58045         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
58046         nextStep();
58047       }
58048     }
58049     function aboutFeatureEditor() {
58050       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
58051         return addPoint();
58052       }
58053       timeout2(function() {
58054         reveal(".entity-editor-pane", helpHtml("intro.points.feature_editor"), {
58055           tooltipClass: "intro-points-describe",
58056           buttonText: _t.html("intro.ok"),
58057           buttonCallback: function() {
58058             continueTo(addName);
58059           }
58060         });
58061       }, 400);
58062       context.on("exit.intro", function() {
58063         continueTo(reselectPoint);
58064       });
58065       function continueTo(nextStep) {
58066         context.on("exit.intro", null);
58067         nextStep();
58068       }
58069     }
58070     function addName() {
58071       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
58072         return addPoint();
58073       }
58074       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58075       var addNameString = helpHtml("intro.points.fields_info") + "{br}" + helpHtml("intro.points.add_name");
58076       timeout2(function() {
58077         var entity = context.entity(_pointID);
58078         if (entity.tags.name) {
58079           var tooltip = reveal(".entity-editor-pane", addNameString, {
58080             tooltipClass: "intro-points-describe",
58081             buttonText: _t.html("intro.ok"),
58082             buttonCallback: function() {
58083               continueTo(addCloseEditor);
58084             }
58085           });
58086           tooltip.select(".instruction").style("display", "none");
58087         } else {
58088           reveal(
58089             ".entity-editor-pane",
58090             addNameString,
58091             { tooltipClass: "intro-points-describe" }
58092           );
58093         }
58094       }, 400);
58095       context.history().on("change.intro", function() {
58096         continueTo(addCloseEditor);
58097       });
58098       context.on("exit.intro", function() {
58099         continueTo(reselectPoint);
58100       });
58101       function continueTo(nextStep) {
58102         context.on("exit.intro", null);
58103         context.history().on("change.intro", null);
58104         nextStep();
58105       }
58106     }
58107     function addCloseEditor() {
58108       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58109       var selector = ".entity-editor-pane button.close svg use";
58110       var href = select_default2(selector).attr("href") || "#iD-icon-close";
58111       context.on("exit.intro", function() {
58112         continueTo(reselectPoint);
58113       });
58114       reveal(
58115         ".entity-editor-pane",
58116         helpHtml("intro.points.add_close", { button: { html: icon(href, "inline") } })
58117       );
58118       function continueTo(nextStep) {
58119         context.on("exit.intro", null);
58120         nextStep();
58121       }
58122     }
58123     function reselectPoint() {
58124       if (!_pointID) return chapter.restart();
58125       var entity = context.hasEntity(_pointID);
58126       if (!entity) return chapter.restart();
58127       var oldPreset = _mainPresetIndex.match(entity, context.graph());
58128       context.replace(actionChangePreset(_pointID, oldPreset, cafePreset));
58129       context.enter(modeBrowse(context));
58130       var msec = transitionTime(entity.loc, context.map().center());
58131       if (msec) {
58132         reveal(null, null, { duration: 0 });
58133       }
58134       context.map().centerEase(entity.loc, msec);
58135       timeout2(function() {
58136         var box = pointBox(entity.loc, context);
58137         reveal(box, helpHtml("intro.points.reselect"), { duration: 600 });
58138         timeout2(function() {
58139           context.map().on("move.intro drawn.intro", function() {
58140             var entity2 = context.hasEntity(_pointID);
58141             if (!entity2) return chapter.restart();
58142             var box2 = pointBox(entity2.loc, context);
58143             reveal(box2, helpHtml("intro.points.reselect"), { duration: 0 });
58144           });
58145         }, 600);
58146         context.on("enter.intro", function(mode) {
58147           if (mode.id !== "select") return;
58148           continueTo(updatePoint);
58149         });
58150       }, msec + 100);
58151       function continueTo(nextStep) {
58152         context.map().on("move.intro drawn.intro", null);
58153         context.on("enter.intro", null);
58154         nextStep();
58155       }
58156     }
58157     function updatePoint() {
58158       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
58159         return continueTo(reselectPoint);
58160       }
58161       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58162       context.on("exit.intro", function() {
58163         continueTo(reselectPoint);
58164       });
58165       context.history().on("change.intro", function() {
58166         continueTo(updateCloseEditor);
58167       });
58168       timeout2(function() {
58169         reveal(
58170           ".entity-editor-pane",
58171           helpHtml("intro.points.update"),
58172           { tooltipClass: "intro-points-describe" }
58173         );
58174       }, 400);
58175       function continueTo(nextStep) {
58176         context.on("exit.intro", null);
58177         context.history().on("change.intro", null);
58178         nextStep();
58179       }
58180     }
58181     function updateCloseEditor() {
58182       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
58183         return continueTo(reselectPoint);
58184       }
58185       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58186       context.on("exit.intro", function() {
58187         continueTo(rightClickPoint);
58188       });
58189       timeout2(function() {
58190         reveal(
58191           ".entity-editor-pane",
58192           helpHtml("intro.points.update_close", { button: { html: icon("#iD-icon-close", "inline") } })
58193         );
58194       }, 500);
58195       function continueTo(nextStep) {
58196         context.on("exit.intro", null);
58197         nextStep();
58198       }
58199     }
58200     function rightClickPoint() {
58201       if (!_pointID) return chapter.restart();
58202       var entity = context.hasEntity(_pointID);
58203       if (!entity) return chapter.restart();
58204       context.enter(modeBrowse(context));
58205       var box = pointBox(entity.loc, context);
58206       var textId = context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch";
58207       reveal(box, helpHtml("intro.points." + textId), { duration: 600 });
58208       timeout2(function() {
58209         context.map().on("move.intro", function() {
58210           var entity2 = context.hasEntity(_pointID);
58211           if (!entity2) return chapter.restart();
58212           var box2 = pointBox(entity2.loc, context);
58213           reveal(box2, helpHtml("intro.points." + textId), { duration: 0 });
58214         });
58215       }, 600);
58216       context.on("enter.intro", function(mode) {
58217         if (mode.id !== "select") return;
58218         var ids = context.selectedIDs();
58219         if (ids.length !== 1 || ids[0] !== _pointID) return;
58220         timeout2(function() {
58221           var node = selectMenuItem(context, "delete").node();
58222           if (!node) return;
58223           continueTo(enterDelete);
58224         }, 50);
58225       });
58226       function continueTo(nextStep) {
58227         context.on("enter.intro", null);
58228         context.map().on("move.intro", null);
58229         nextStep();
58230       }
58231     }
58232     function enterDelete() {
58233       if (!_pointID) return chapter.restart();
58234       var entity = context.hasEntity(_pointID);
58235       if (!entity) return chapter.restart();
58236       var node = selectMenuItem(context, "delete").node();
58237       if (!node) {
58238         return continueTo(rightClickPoint);
58239       }
58240       reveal(
58241         ".edit-menu",
58242         helpHtml("intro.points.delete"),
58243         { padding: 50 }
58244       );
58245       timeout2(function() {
58246         context.map().on("move.intro", function() {
58247           reveal(
58248             ".edit-menu",
58249             helpHtml("intro.points.delete"),
58250             { duration: 0, padding: 50 }
58251           );
58252         });
58253       }, 300);
58254       context.on("exit.intro", function() {
58255         if (!_pointID) return chapter.restart();
58256         var entity2 = context.hasEntity(_pointID);
58257         if (entity2) return continueTo(rightClickPoint);
58258       });
58259       context.history().on("change.intro", function(changed) {
58260         if (changed.deleted().length) {
58261           continueTo(undo);
58262         }
58263       });
58264       function continueTo(nextStep) {
58265         context.map().on("move.intro", null);
58266         context.history().on("change.intro", null);
58267         context.on("exit.intro", null);
58268         nextStep();
58269       }
58270     }
58271     function undo() {
58272       context.history().on("change.intro", function() {
58273         continueTo(play);
58274       });
58275       reveal(
58276         ".top-toolbar button.undo-button",
58277         helpHtml("intro.points.undo")
58278       );
58279       function continueTo(nextStep) {
58280         context.history().on("change.intro", null);
58281         nextStep();
58282       }
58283     }
58284     function play() {
58285       dispatch14.call("done");
58286       reveal(
58287         ".ideditor",
58288         helpHtml("intro.points.play", { next: _t("intro.areas.title") }),
58289         {
58290           tooltipBox: ".intro-nav-wrap .chapter-area",
58291           buttonText: _t.html("intro.ok"),
58292           buttonCallback: function() {
58293             reveal(".ideditor");
58294           }
58295         }
58296       );
58297     }
58298     chapter.enter = function() {
58299       addPoint();
58300     };
58301     chapter.exit = function() {
58302       timeouts.forEach(window.clearTimeout);
58303       context.on("enter.intro exit.intro", null);
58304       context.map().on("move.intro drawn.intro", null);
58305       context.history().on("change.intro", null);
58306       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58307       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
58308     };
58309     chapter.restart = function() {
58310       chapter.exit();
58311       chapter.enter();
58312     };
58313     return utilRebind(chapter, dispatch14, "on");
58314   }
58315
58316   // modules/ui/intro/area.js
58317   function uiIntroArea(context, reveal) {
58318     var dispatch14 = dispatch_default("done");
58319     var playground = [-85.63552, 41.94159];
58320     var playgroundPreset = _mainPresetIndex.item("leisure/playground");
58321     var nameField = _mainPresetIndex.field("name");
58322     var descriptionField = _mainPresetIndex.field("description");
58323     var timeouts = [];
58324     var _areaID;
58325     var chapter = {
58326       title: "intro.areas.title"
58327     };
58328     function timeout2(f2, t2) {
58329       timeouts.push(window.setTimeout(f2, t2));
58330     }
58331     function eventCancel(d3_event) {
58332       d3_event.stopPropagation();
58333       d3_event.preventDefault();
58334     }
58335     function revealPlayground(center, text, options2) {
58336       var padding = 180 * Math.pow(2, context.map().zoom() - 19.5);
58337       var box = pad(center, padding, context);
58338       reveal(box, text, options2);
58339     }
58340     function addArea() {
58341       context.enter(modeBrowse(context));
58342       context.history().reset("initial");
58343       _areaID = null;
58344       var msec = transitionTime(playground, context.map().center());
58345       if (msec) {
58346         reveal(null, null, { duration: 0 });
58347       }
58348       context.map().centerZoomEase(playground, 19, msec);
58349       timeout2(function() {
58350         var tooltip = reveal(
58351           "button.add-area",
58352           helpHtml("intro.areas.add_playground")
58353         );
58354         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-areas");
58355         context.on("enter.intro", function(mode) {
58356           if (mode.id !== "add-area") return;
58357           continueTo(startPlayground);
58358         });
58359       }, msec + 100);
58360       function continueTo(nextStep) {
58361         context.on("enter.intro", null);
58362         nextStep();
58363       }
58364     }
58365     function startPlayground() {
58366       if (context.mode().id !== "add-area") {
58367         return chapter.restart();
58368       }
58369       _areaID = null;
58370       context.map().zoomEase(19.5, 500);
58371       timeout2(function() {
58372         var textId = context.lastPointerType() === "mouse" ? "starting_node_click" : "starting_node_tap";
58373         var startDrawString = helpHtml("intro.areas.start_playground") + helpHtml("intro.areas." + textId);
58374         revealPlayground(
58375           playground,
58376           startDrawString,
58377           { duration: 250 }
58378         );
58379         timeout2(function() {
58380           context.map().on("move.intro drawn.intro", function() {
58381             revealPlayground(
58382               playground,
58383               startDrawString,
58384               { duration: 0 }
58385             );
58386           });
58387           context.on("enter.intro", function(mode) {
58388             if (mode.id !== "draw-area") return chapter.restart();
58389             continueTo(continuePlayground);
58390           });
58391         }, 250);
58392       }, 550);
58393       function continueTo(nextStep) {
58394         context.map().on("move.intro drawn.intro", null);
58395         context.on("enter.intro", null);
58396         nextStep();
58397       }
58398     }
58399     function continuePlayground() {
58400       if (context.mode().id !== "draw-area") {
58401         return chapter.restart();
58402       }
58403       _areaID = null;
58404       revealPlayground(
58405         playground,
58406         helpHtml("intro.areas.continue_playground"),
58407         { duration: 250 }
58408       );
58409       timeout2(function() {
58410         context.map().on("move.intro drawn.intro", function() {
58411           revealPlayground(
58412             playground,
58413             helpHtml("intro.areas.continue_playground"),
58414             { duration: 0 }
58415           );
58416         });
58417       }, 250);
58418       context.on("enter.intro", function(mode) {
58419         if (mode.id === "draw-area") {
58420           var entity = context.hasEntity(context.selectedIDs()[0]);
58421           if (entity && entity.nodes.length >= 6) {
58422             return continueTo(finishPlayground);
58423           } else {
58424             return;
58425           }
58426         } else if (mode.id === "select") {
58427           _areaID = context.selectedIDs()[0];
58428           return continueTo(searchPresets);
58429         } else {
58430           return chapter.restart();
58431         }
58432       });
58433       function continueTo(nextStep) {
58434         context.map().on("move.intro drawn.intro", null);
58435         context.on("enter.intro", null);
58436         nextStep();
58437       }
58438     }
58439     function finishPlayground() {
58440       if (context.mode().id !== "draw-area") {
58441         return chapter.restart();
58442       }
58443       _areaID = null;
58444       var finishString = helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.areas.finish_playground");
58445       revealPlayground(
58446         playground,
58447         finishString,
58448         { duration: 250 }
58449       );
58450       timeout2(function() {
58451         context.map().on("move.intro drawn.intro", function() {
58452           revealPlayground(
58453             playground,
58454             finishString,
58455             { duration: 0 }
58456           );
58457         });
58458       }, 250);
58459       context.on("enter.intro", function(mode) {
58460         if (mode.id === "draw-area") {
58461           return;
58462         } else if (mode.id === "select") {
58463           _areaID = context.selectedIDs()[0];
58464           return continueTo(searchPresets);
58465         } else {
58466           return chapter.restart();
58467         }
58468       });
58469       function continueTo(nextStep) {
58470         context.map().on("move.intro drawn.intro", null);
58471         context.on("enter.intro", null);
58472         nextStep();
58473       }
58474     }
58475     function searchPresets() {
58476       if (!_areaID || !context.hasEntity(_areaID)) {
58477         return addArea();
58478       }
58479       var ids = context.selectedIDs();
58480       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
58481         context.enter(modeSelect(context, [_areaID]));
58482       }
58483       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58484       timeout2(function() {
58485         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
58486         context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
58487         reveal(
58488           ".preset-search-input",
58489           helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() })
58490         );
58491       }, 400);
58492       context.on("enter.intro", function(mode) {
58493         if (!_areaID || !context.hasEntity(_areaID)) {
58494           return continueTo(addArea);
58495         }
58496         var ids2 = context.selectedIDs();
58497         if (mode.id !== "select" || !ids2.length || ids2[0] !== _areaID) {
58498           context.enter(modeSelect(context, [_areaID]));
58499           context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
58500           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58501           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
58502           reveal(
58503             ".preset-search-input",
58504             helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() })
58505           );
58506           context.history().on("change.intro", null);
58507         }
58508       });
58509       function checkPresetSearch() {
58510         var first = context.container().select(".preset-list-item:first-child");
58511         if (first.classed("preset-leisure-playground")) {
58512           reveal(
58513             first.select(".preset-list-button").node(),
58514             helpHtml("intro.areas.choose_playground", { preset: playgroundPreset.name() }),
58515             { duration: 300 }
58516           );
58517           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
58518           context.history().on("change.intro", function() {
58519             continueTo(clickAddField);
58520           });
58521         }
58522       }
58523       function continueTo(nextStep) {
58524         context.container().select(".inspector-wrap").on("wheel.intro", null);
58525         context.on("enter.intro", null);
58526         context.history().on("change.intro", null);
58527         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
58528         nextStep();
58529       }
58530     }
58531     function clickAddField() {
58532       if (!_areaID || !context.hasEntity(_areaID)) {
58533         return addArea();
58534       }
58535       var ids = context.selectedIDs();
58536       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
58537         return searchPresets();
58538       }
58539       if (!context.container().select(".form-field-description").empty()) {
58540         return continueTo(describePlayground);
58541       }
58542       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58543       timeout2(function() {
58544         context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58545         var entity = context.entity(_areaID);
58546         if (entity.tags.description) {
58547           return continueTo(play);
58548         }
58549         var box = context.container().select(".more-fields").node().getBoundingClientRect();
58550         if (box.top > 300) {
58551           var pane = context.container().select(".entity-editor-pane .inspector-body");
58552           var start2 = pane.node().scrollTop;
58553           var end = start2 + (box.top - 300);
58554           pane.transition().duration(250).tween("scroll.inspector", function() {
58555             var node = this;
58556             var i3 = number_default(start2, end);
58557             return function(t2) {
58558               node.scrollTop = i3(t2);
58559             };
58560           });
58561         }
58562         timeout2(function() {
58563           reveal(
58564             ".more-fields .combobox-input",
58565             helpHtml("intro.areas.add_field", {
58566               name: nameField.title(),
58567               description: descriptionField.title()
58568             }),
58569             { duration: 300 }
58570           );
58571           context.container().select(".more-fields .combobox-input").on("click.intro", function() {
58572             var watcher;
58573             watcher = window.setInterval(function() {
58574               if (!context.container().select("div.combobox").empty()) {
58575                 window.clearInterval(watcher);
58576                 continueTo(chooseDescriptionField);
58577               }
58578             }, 300);
58579           });
58580         }, 300);
58581       }, 400);
58582       context.on("exit.intro", function() {
58583         return continueTo(searchPresets);
58584       });
58585       function continueTo(nextStep) {
58586         context.container().select(".inspector-wrap").on("wheel.intro", null);
58587         context.container().select(".more-fields .combobox-input").on("click.intro", null);
58588         context.on("exit.intro", null);
58589         nextStep();
58590       }
58591     }
58592     function chooseDescriptionField() {
58593       if (!_areaID || !context.hasEntity(_areaID)) {
58594         return addArea();
58595       }
58596       var ids = context.selectedIDs();
58597       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
58598         return searchPresets();
58599       }
58600       if (!context.container().select(".form-field-description").empty()) {
58601         return continueTo(describePlayground);
58602       }
58603       if (context.container().select("div.combobox").empty()) {
58604         return continueTo(clickAddField);
58605       }
58606       var watcher;
58607       watcher = window.setInterval(function() {
58608         if (context.container().select("div.combobox").empty()) {
58609           window.clearInterval(watcher);
58610           timeout2(function() {
58611             if (context.container().select(".form-field-description").empty()) {
58612               continueTo(retryChooseDescription);
58613             } else {
58614               continueTo(describePlayground);
58615             }
58616           }, 300);
58617         }
58618       }, 300);
58619       reveal(
58620         "div.combobox",
58621         helpHtml("intro.areas.choose_field", { field: descriptionField.title() }),
58622         { duration: 300 }
58623       );
58624       context.on("exit.intro", function() {
58625         return continueTo(searchPresets);
58626       });
58627       function continueTo(nextStep) {
58628         if (watcher) window.clearInterval(watcher);
58629         context.on("exit.intro", null);
58630         nextStep();
58631       }
58632     }
58633     function describePlayground() {
58634       if (!_areaID || !context.hasEntity(_areaID)) {
58635         return addArea();
58636       }
58637       var ids = context.selectedIDs();
58638       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
58639         return searchPresets();
58640       }
58641       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58642       if (context.container().select(".form-field-description").empty()) {
58643         return continueTo(retryChooseDescription);
58644       }
58645       context.on("exit.intro", function() {
58646         continueTo(play);
58647       });
58648       reveal(
58649         ".entity-editor-pane",
58650         helpHtml("intro.areas.describe_playground", { button: { html: icon("#iD-icon-close", "inline") } }),
58651         { duration: 300 }
58652       );
58653       function continueTo(nextStep) {
58654         context.on("exit.intro", null);
58655         nextStep();
58656       }
58657     }
58658     function retryChooseDescription() {
58659       if (!_areaID || !context.hasEntity(_areaID)) {
58660         return addArea();
58661       }
58662       var ids = context.selectedIDs();
58663       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
58664         return searchPresets();
58665       }
58666       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58667       reveal(
58668         ".entity-editor-pane",
58669         helpHtml("intro.areas.retry_add_field", { field: descriptionField.title() }),
58670         {
58671           buttonText: _t.html("intro.ok"),
58672           buttonCallback: function() {
58673             continueTo(clickAddField);
58674           }
58675         }
58676       );
58677       context.on("exit.intro", function() {
58678         return continueTo(searchPresets);
58679       });
58680       function continueTo(nextStep) {
58681         context.on("exit.intro", null);
58682         nextStep();
58683       }
58684     }
58685     function play() {
58686       dispatch14.call("done");
58687       reveal(
58688         ".ideditor",
58689         helpHtml("intro.areas.play", { next: _t("intro.lines.title") }),
58690         {
58691           tooltipBox: ".intro-nav-wrap .chapter-line",
58692           buttonText: _t.html("intro.ok"),
58693           buttonCallback: function() {
58694             reveal(".ideditor");
58695           }
58696         }
58697       );
58698     }
58699     chapter.enter = function() {
58700       addArea();
58701     };
58702     chapter.exit = function() {
58703       timeouts.forEach(window.clearTimeout);
58704       context.on("enter.intro exit.intro", null);
58705       context.map().on("move.intro drawn.intro", null);
58706       context.history().on("change.intro", null);
58707       context.container().select(".inspector-wrap").on("wheel.intro", null);
58708       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
58709       context.container().select(".more-fields .combobox-input").on("click.intro", null);
58710     };
58711     chapter.restart = function() {
58712       chapter.exit();
58713       chapter.enter();
58714     };
58715     return utilRebind(chapter, dispatch14, "on");
58716   }
58717
58718   // modules/ui/intro/line.js
58719   function uiIntroLine(context, reveal) {
58720     var dispatch14 = dispatch_default("done");
58721     var timeouts = [];
58722     var _tulipRoadID = null;
58723     var flowerRoadID = "w646";
58724     var tulipRoadStart = [-85.6297754121684, 41.95805253325314];
58725     var tulipRoadMidpoint = [-85.62975395449628, 41.95787501510204];
58726     var tulipRoadIntersection = [-85.62974496187628, 41.95742515554585];
58727     var roadCategory = _mainPresetIndex.item("category-road_minor");
58728     var residentialPreset = _mainPresetIndex.item("highway/residential");
58729     var woodRoadID = "w525";
58730     var woodRoadEndID = "n2862";
58731     var woodRoadAddNode = [-85.62390110349587, 41.95397111462291];
58732     var woodRoadDragEndpoint = [-85.623867390213, 41.95466987786487];
58733     var woodRoadDragMidpoint = [-85.62386254803509, 41.95430395953872];
58734     var washingtonStreetID = "w522";
58735     var twelfthAvenueID = "w1";
58736     var eleventhAvenueEndID = "n3550";
58737     var twelfthAvenueEndID = "n5";
58738     var _washingtonSegmentID = null;
58739     var eleventhAvenueEnd = context.entity(eleventhAvenueEndID).loc;
58740     var twelfthAvenueEnd = context.entity(twelfthAvenueEndID).loc;
58741     var deleteLinesLoc = [-85.6219395542764, 41.95228033922477];
58742     var twelfthAvenue = [-85.62219310052491, 41.952505413152956];
58743     var chapter = {
58744       title: "intro.lines.title"
58745     };
58746     function timeout2(f2, t2) {
58747       timeouts.push(window.setTimeout(f2, t2));
58748     }
58749     function eventCancel(d3_event) {
58750       d3_event.stopPropagation();
58751       d3_event.preventDefault();
58752     }
58753     function addLine() {
58754       context.enter(modeBrowse(context));
58755       context.history().reset("initial");
58756       var msec = transitionTime(tulipRoadStart, context.map().center());
58757       if (msec) {
58758         reveal(null, null, { duration: 0 });
58759       }
58760       context.map().centerZoomEase(tulipRoadStart, 18.5, msec);
58761       timeout2(function() {
58762         var tooltip = reveal(
58763           "button.add-line",
58764           helpHtml("intro.lines.add_line")
58765         );
58766         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-lines");
58767         context.on("enter.intro", function(mode) {
58768           if (mode.id !== "add-line") return;
58769           continueTo(startLine);
58770         });
58771       }, msec + 100);
58772       function continueTo(nextStep) {
58773         context.on("enter.intro", null);
58774         nextStep();
58775       }
58776     }
58777     function startLine() {
58778       if (context.mode().id !== "add-line") return chapter.restart();
58779       _tulipRoadID = null;
58780       var padding = 70 * Math.pow(2, context.map().zoom() - 18);
58781       var box = pad(tulipRoadStart, padding, context);
58782       box.height = box.height + 100;
58783       var textId = context.lastPointerType() === "mouse" ? "start_line" : "start_line_tap";
58784       var startLineString = helpHtml("intro.lines.missing_road") + "{br}" + helpHtml("intro.lines.line_draw_info") + helpHtml("intro.lines." + textId);
58785       reveal(box, startLineString);
58786       context.map().on("move.intro drawn.intro", function() {
58787         padding = 70 * Math.pow(2, context.map().zoom() - 18);
58788         box = pad(tulipRoadStart, padding, context);
58789         box.height = box.height + 100;
58790         reveal(box, startLineString, { duration: 0 });
58791       });
58792       context.on("enter.intro", function(mode) {
58793         if (mode.id !== "draw-line") return chapter.restart();
58794         continueTo(drawLine);
58795       });
58796       function continueTo(nextStep) {
58797         context.map().on("move.intro drawn.intro", null);
58798         context.on("enter.intro", null);
58799         nextStep();
58800       }
58801     }
58802     function drawLine() {
58803       if (context.mode().id !== "draw-line") return chapter.restart();
58804       _tulipRoadID = context.mode().selectedIDs()[0];
58805       context.map().centerEase(tulipRoadMidpoint, 500);
58806       timeout2(function() {
58807         var padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
58808         var box = pad(tulipRoadMidpoint, padding, context);
58809         box.height = box.height * 2;
58810         reveal(
58811           box,
58812           helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") })
58813         );
58814         context.map().on("move.intro drawn.intro", function() {
58815           padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
58816           box = pad(tulipRoadMidpoint, padding, context);
58817           box.height = box.height * 2;
58818           reveal(
58819             box,
58820             helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") }),
58821             { duration: 0 }
58822           );
58823         });
58824       }, 550);
58825       context.history().on("change.intro", function() {
58826         if (isLineConnected()) {
58827           continueTo(continueLine);
58828         }
58829       });
58830       context.on("enter.intro", function(mode) {
58831         if (mode.id === "draw-line") {
58832           return;
58833         } else if (mode.id === "select") {
58834           continueTo(retryIntersect);
58835           return;
58836         } else {
58837           return chapter.restart();
58838         }
58839       });
58840       function continueTo(nextStep) {
58841         context.map().on("move.intro drawn.intro", null);
58842         context.history().on("change.intro", null);
58843         context.on("enter.intro", null);
58844         nextStep();
58845       }
58846     }
58847     function isLineConnected() {
58848       var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
58849       if (!entity) return false;
58850       var drawNodes = context.graph().childNodes(entity);
58851       return drawNodes.some(function(node) {
58852         return context.graph().parentWays(node).some(function(parent) {
58853           return parent.id === flowerRoadID;
58854         });
58855       });
58856     }
58857     function retryIntersect() {
58858       select_default2(window).on("pointerdown.intro mousedown.intro", eventCancel, true);
58859       var box = pad(tulipRoadIntersection, 80, context);
58860       reveal(
58861         box,
58862         helpHtml("intro.lines.retry_intersect", { name: _t("intro.graph.name.flower-street") })
58863       );
58864       timeout2(chapter.restart, 3e3);
58865     }
58866     function continueLine() {
58867       if (context.mode().id !== "draw-line") return chapter.restart();
58868       var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
58869       if (!entity) return chapter.restart();
58870       context.map().centerEase(tulipRoadIntersection, 500);
58871       var continueLineText = helpHtml("intro.lines.continue_line") + "{br}" + helpHtml("intro.lines.finish_line_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.lines.finish_road");
58872       reveal(".surface", continueLineText);
58873       context.on("enter.intro", function(mode) {
58874         if (mode.id === "draw-line") {
58875           return;
58876         } else if (mode.id === "select") {
58877           return continueTo(chooseCategoryRoad);
58878         } else {
58879           return chapter.restart();
58880         }
58881       });
58882       function continueTo(nextStep) {
58883         context.on("enter.intro", null);
58884         nextStep();
58885       }
58886     }
58887     function chooseCategoryRoad() {
58888       if (context.mode().id !== "select") return chapter.restart();
58889       context.on("exit.intro", function() {
58890         return chapter.restart();
58891       });
58892       var button = context.container().select(".preset-category-road_minor .preset-list-button");
58893       if (button.empty()) return chapter.restart();
58894       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58895       timeout2(function() {
58896         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
58897         reveal(
58898           button.node(),
58899           helpHtml("intro.lines.choose_category_road", { category: roadCategory.name() })
58900         );
58901         button.on("click.intro", function() {
58902           continueTo(choosePresetResidential);
58903         });
58904       }, 400);
58905       function continueTo(nextStep) {
58906         context.container().select(".inspector-wrap").on("wheel.intro", null);
58907         context.container().select(".preset-list-button").on("click.intro", null);
58908         context.on("exit.intro", null);
58909         nextStep();
58910       }
58911     }
58912     function choosePresetResidential() {
58913       if (context.mode().id !== "select") return chapter.restart();
58914       context.on("exit.intro", function() {
58915         return chapter.restart();
58916       });
58917       var subgrid = context.container().select(".preset-category-road_minor .subgrid");
58918       if (subgrid.empty()) return chapter.restart();
58919       subgrid.selectAll(":not(.preset-highway-residential) .preset-list-button").on("click.intro", function() {
58920         continueTo(retryPresetResidential);
58921       });
58922       subgrid.selectAll(".preset-highway-residential .preset-list-button").on("click.intro", function() {
58923         continueTo(nameRoad);
58924       });
58925       timeout2(function() {
58926         reveal(
58927           subgrid.node(),
58928           helpHtml("intro.lines.choose_preset_residential", { preset: residentialPreset.name() }),
58929           { tooltipBox: ".preset-highway-residential .preset-list-button", duration: 300 }
58930         );
58931       }, 300);
58932       function continueTo(nextStep) {
58933         context.container().select(".preset-list-button").on("click.intro", null);
58934         context.on("exit.intro", null);
58935         nextStep();
58936       }
58937     }
58938     function retryPresetResidential() {
58939       if (context.mode().id !== "select") return chapter.restart();
58940       context.on("exit.intro", function() {
58941         return chapter.restart();
58942       });
58943       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58944       timeout2(function() {
58945         var button = context.container().select(".entity-editor-pane .preset-list-button");
58946         reveal(
58947           button.node(),
58948           helpHtml("intro.lines.retry_preset_residential", { preset: residentialPreset.name() })
58949         );
58950         button.on("click.intro", function() {
58951           continueTo(chooseCategoryRoad);
58952         });
58953       }, 500);
58954       function continueTo(nextStep) {
58955         context.container().select(".inspector-wrap").on("wheel.intro", null);
58956         context.container().select(".preset-list-button").on("click.intro", null);
58957         context.on("exit.intro", null);
58958         nextStep();
58959       }
58960     }
58961     function nameRoad() {
58962       context.on("exit.intro", function() {
58963         continueTo(didNameRoad);
58964       });
58965       timeout2(function() {
58966         reveal(
58967           ".entity-editor-pane",
58968           helpHtml("intro.lines.name_road", { button: { html: icon("#iD-icon-close", "inline") } }),
58969           { tooltipClass: "intro-lines-name_road" }
58970         );
58971       }, 500);
58972       function continueTo(nextStep) {
58973         context.on("exit.intro", null);
58974         nextStep();
58975       }
58976     }
58977     function didNameRoad() {
58978       context.history().checkpoint("doneAddLine");
58979       timeout2(function() {
58980         reveal(".surface", helpHtml("intro.lines.did_name_road"), {
58981           buttonText: _t.html("intro.ok"),
58982           buttonCallback: function() {
58983             continueTo(updateLine);
58984           }
58985         });
58986       }, 500);
58987       function continueTo(nextStep) {
58988         nextStep();
58989       }
58990     }
58991     function updateLine() {
58992       context.history().reset("doneAddLine");
58993       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
58994         return chapter.restart();
58995       }
58996       var msec = transitionTime(woodRoadDragMidpoint, context.map().center());
58997       if (msec) {
58998         reveal(null, null, { duration: 0 });
58999       }
59000       context.map().centerZoomEase(woodRoadDragMidpoint, 19, msec);
59001       timeout2(function() {
59002         var padding = 250 * Math.pow(2, context.map().zoom() - 19);
59003         var box = pad(woodRoadDragMidpoint, padding, context);
59004         var advance = function() {
59005           continueTo(addNode);
59006         };
59007         reveal(
59008           box,
59009           helpHtml("intro.lines.update_line"),
59010           { buttonText: _t.html("intro.ok"), buttonCallback: advance }
59011         );
59012         context.map().on("move.intro drawn.intro", function() {
59013           var padding2 = 250 * Math.pow(2, context.map().zoom() - 19);
59014           var box2 = pad(woodRoadDragMidpoint, padding2, context);
59015           reveal(
59016             box2,
59017             helpHtml("intro.lines.update_line"),
59018             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
59019           );
59020         });
59021       }, msec + 100);
59022       function continueTo(nextStep) {
59023         context.map().on("move.intro drawn.intro", null);
59024         nextStep();
59025       }
59026     }
59027     function addNode() {
59028       context.history().reset("doneAddLine");
59029       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59030         return chapter.restart();
59031       }
59032       var padding = 40 * Math.pow(2, context.map().zoom() - 19);
59033       var box = pad(woodRoadAddNode, padding, context);
59034       var addNodeString = helpHtml("intro.lines.add_node" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
59035       reveal(box, addNodeString);
59036       context.map().on("move.intro drawn.intro", function() {
59037         var padding2 = 40 * Math.pow(2, context.map().zoom() - 19);
59038         var box2 = pad(woodRoadAddNode, padding2, context);
59039         reveal(box2, addNodeString, { duration: 0 });
59040       });
59041       context.history().on("change.intro", function(changed) {
59042         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59043           return continueTo(updateLine);
59044         }
59045         if (changed.created().length === 1) {
59046           timeout2(function() {
59047             continueTo(startDragEndpoint);
59048           }, 500);
59049         }
59050       });
59051       context.on("enter.intro", function(mode) {
59052         if (mode.id !== "select") {
59053           continueTo(updateLine);
59054         }
59055       });
59056       function continueTo(nextStep) {
59057         context.map().on("move.intro drawn.intro", null);
59058         context.history().on("change.intro", null);
59059         context.on("enter.intro", null);
59060         nextStep();
59061       }
59062     }
59063     function startDragEndpoint() {
59064       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59065         return continueTo(updateLine);
59066       }
59067       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
59068       var box = pad(woodRoadDragEndpoint, padding, context);
59069       var startDragString = helpHtml("intro.lines.start_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch")) + helpHtml("intro.lines.drag_to_intersection");
59070       reveal(box, startDragString);
59071       context.map().on("move.intro drawn.intro", function() {
59072         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59073           return continueTo(updateLine);
59074         }
59075         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
59076         var box2 = pad(woodRoadDragEndpoint, padding2, context);
59077         reveal(box2, startDragString, { duration: 0 });
59078         var entity = context.entity(woodRoadEndID);
59079         if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) <= 4) {
59080           continueTo(finishDragEndpoint);
59081         }
59082       });
59083       function continueTo(nextStep) {
59084         context.map().on("move.intro drawn.intro", null);
59085         nextStep();
59086       }
59087     }
59088     function finishDragEndpoint() {
59089       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59090         return continueTo(updateLine);
59091       }
59092       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
59093       var box = pad(woodRoadDragEndpoint, padding, context);
59094       var finishDragString = helpHtml("intro.lines.spot_looks_good") + helpHtml("intro.lines.finish_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
59095       reveal(box, finishDragString);
59096       context.map().on("move.intro drawn.intro", function() {
59097         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59098           return continueTo(updateLine);
59099         }
59100         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
59101         var box2 = pad(woodRoadDragEndpoint, padding2, context);
59102         reveal(box2, finishDragString, { duration: 0 });
59103         var entity = context.entity(woodRoadEndID);
59104         if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) > 4) {
59105           continueTo(startDragEndpoint);
59106         }
59107       });
59108       context.on("enter.intro", function() {
59109         continueTo(startDragMidpoint);
59110       });
59111       function continueTo(nextStep) {
59112         context.map().on("move.intro drawn.intro", null);
59113         context.on("enter.intro", null);
59114         nextStep();
59115       }
59116     }
59117     function startDragMidpoint() {
59118       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59119         return continueTo(updateLine);
59120       }
59121       if (context.selectedIDs().indexOf(woodRoadID) === -1) {
59122         context.enter(modeSelect(context, [woodRoadID]));
59123       }
59124       var padding = 80 * Math.pow(2, context.map().zoom() - 19);
59125       var box = pad(woodRoadDragMidpoint, padding, context);
59126       reveal(box, helpHtml("intro.lines.start_drag_midpoint"));
59127       context.map().on("move.intro drawn.intro", function() {
59128         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59129           return continueTo(updateLine);
59130         }
59131         var padding2 = 80 * Math.pow(2, context.map().zoom() - 19);
59132         var box2 = pad(woodRoadDragMidpoint, padding2, context);
59133         reveal(box2, helpHtml("intro.lines.start_drag_midpoint"), { duration: 0 });
59134       });
59135       context.history().on("change.intro", function(changed) {
59136         if (changed.created().length === 1) {
59137           continueTo(continueDragMidpoint);
59138         }
59139       });
59140       context.on("enter.intro", function(mode) {
59141         if (mode.id !== "select") {
59142           context.enter(modeSelect(context, [woodRoadID]));
59143         }
59144       });
59145       function continueTo(nextStep) {
59146         context.map().on("move.intro drawn.intro", null);
59147         context.history().on("change.intro", null);
59148         context.on("enter.intro", null);
59149         nextStep();
59150       }
59151     }
59152     function continueDragMidpoint() {
59153       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59154         return continueTo(updateLine);
59155       }
59156       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
59157       var box = pad(woodRoadDragEndpoint, padding, context);
59158       box.height += 400;
59159       var advance = function() {
59160         context.history().checkpoint("doneUpdateLine");
59161         continueTo(deleteLines);
59162       };
59163       reveal(
59164         box,
59165         helpHtml("intro.lines.continue_drag_midpoint"),
59166         { buttonText: _t.html("intro.ok"), buttonCallback: advance }
59167       );
59168       context.map().on("move.intro drawn.intro", function() {
59169         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59170           return continueTo(updateLine);
59171         }
59172         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
59173         var box2 = pad(woodRoadDragEndpoint, padding2, context);
59174         box2.height += 400;
59175         reveal(
59176           box2,
59177           helpHtml("intro.lines.continue_drag_midpoint"),
59178           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
59179         );
59180       });
59181       function continueTo(nextStep) {
59182         context.map().on("move.intro drawn.intro", null);
59183         nextStep();
59184       }
59185     }
59186     function deleteLines() {
59187       context.history().reset("doneUpdateLine");
59188       context.enter(modeBrowse(context));
59189       if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59190         return chapter.restart();
59191       }
59192       var msec = transitionTime(deleteLinesLoc, context.map().center());
59193       if (msec) {
59194         reveal(null, null, { duration: 0 });
59195       }
59196       context.map().centerZoomEase(deleteLinesLoc, 18, msec);
59197       timeout2(function() {
59198         var padding = 200 * Math.pow(2, context.map().zoom() - 18);
59199         var box = pad(deleteLinesLoc, padding, context);
59200         box.top -= 200;
59201         box.height += 400;
59202         var advance = function() {
59203           continueTo(rightClickIntersection);
59204         };
59205         reveal(
59206           box,
59207           helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }),
59208           { buttonText: _t.html("intro.ok"), buttonCallback: advance }
59209         );
59210         context.map().on("move.intro drawn.intro", function() {
59211           var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
59212           var box2 = pad(deleteLinesLoc, padding2, context);
59213           box2.top -= 200;
59214           box2.height += 400;
59215           reveal(
59216             box2,
59217             helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }),
59218             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
59219           );
59220         });
59221         context.history().on("change.intro", function() {
59222           timeout2(function() {
59223             continueTo(deleteLines);
59224           }, 500);
59225         });
59226       }, msec + 100);
59227       function continueTo(nextStep) {
59228         context.map().on("move.intro drawn.intro", null);
59229         context.history().on("change.intro", null);
59230         nextStep();
59231       }
59232     }
59233     function rightClickIntersection() {
59234       context.history().reset("doneUpdateLine");
59235       context.enter(modeBrowse(context));
59236       context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
59237       var rightClickString = helpHtml("intro.lines.split_street", {
59238         street1: _t("intro.graph.name.11th-avenue"),
59239         street2: _t("intro.graph.name.washington-street")
59240       }) + helpHtml("intro.lines." + (context.lastPointerType() === "mouse" ? "rightclick_intersection" : "edit_menu_intersection_touch"));
59241       timeout2(function() {
59242         var padding = 60 * Math.pow(2, context.map().zoom() - 18);
59243         var box = pad(eleventhAvenueEnd, padding, context);
59244         reveal(box, rightClickString);
59245         context.map().on("move.intro drawn.intro", function() {
59246           var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
59247           var box2 = pad(eleventhAvenueEnd, padding2, context);
59248           reveal(
59249             box2,
59250             rightClickString,
59251             { duration: 0 }
59252           );
59253         });
59254         context.on("enter.intro", function(mode) {
59255           if (mode.id !== "select") return;
59256           var ids = context.selectedIDs();
59257           if (ids.length !== 1 || ids[0] !== eleventhAvenueEndID) return;
59258           timeout2(function() {
59259             var node = selectMenuItem(context, "split").node();
59260             if (!node) return;
59261             continueTo(splitIntersection);
59262           }, 50);
59263         });
59264         context.history().on("change.intro", function() {
59265           timeout2(function() {
59266             continueTo(deleteLines);
59267           }, 300);
59268         });
59269       }, 600);
59270       function continueTo(nextStep) {
59271         context.map().on("move.intro drawn.intro", null);
59272         context.on("enter.intro", null);
59273         context.history().on("change.intro", null);
59274         nextStep();
59275       }
59276     }
59277     function splitIntersection() {
59278       if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59279         return continueTo(deleteLines);
59280       }
59281       var node = selectMenuItem(context, "split").node();
59282       if (!node) {
59283         return continueTo(rightClickIntersection);
59284       }
59285       var wasChanged = false;
59286       _washingtonSegmentID = null;
59287       reveal(
59288         ".edit-menu",
59289         helpHtml(
59290           "intro.lines.split_intersection",
59291           { street: _t("intro.graph.name.washington-street") }
59292         ),
59293         { padding: 50 }
59294       );
59295       context.map().on("move.intro drawn.intro", function() {
59296         var node2 = selectMenuItem(context, "split").node();
59297         if (!wasChanged && !node2) {
59298           return continueTo(rightClickIntersection);
59299         }
59300         reveal(
59301           ".edit-menu",
59302           helpHtml(
59303             "intro.lines.split_intersection",
59304             { street: _t("intro.graph.name.washington-street") }
59305           ),
59306           { duration: 0, padding: 50 }
59307         );
59308       });
59309       context.history().on("change.intro", function(changed) {
59310         wasChanged = true;
59311         timeout2(function() {
59312           if (context.history().undoAnnotation() === _t("operations.split.annotation.line", { n: 1 })) {
59313             _washingtonSegmentID = changed.created()[0].id;
59314             continueTo(didSplit);
59315           } else {
59316             _washingtonSegmentID = null;
59317             continueTo(retrySplit);
59318           }
59319         }, 300);
59320       });
59321       function continueTo(nextStep) {
59322         context.map().on("move.intro drawn.intro", null);
59323         context.history().on("change.intro", null);
59324         nextStep();
59325       }
59326     }
59327     function retrySplit() {
59328       context.enter(modeBrowse(context));
59329       context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
59330       var advance = function() {
59331         continueTo(rightClickIntersection);
59332       };
59333       var padding = 60 * Math.pow(2, context.map().zoom() - 18);
59334       var box = pad(eleventhAvenueEnd, padding, context);
59335       reveal(
59336         box,
59337         helpHtml("intro.lines.retry_split"),
59338         { buttonText: _t.html("intro.ok"), buttonCallback: advance }
59339       );
59340       context.map().on("move.intro drawn.intro", function() {
59341         var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
59342         var box2 = pad(eleventhAvenueEnd, padding2, context);
59343         reveal(
59344           box2,
59345           helpHtml("intro.lines.retry_split"),
59346           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
59347         );
59348       });
59349       function continueTo(nextStep) {
59350         context.map().on("move.intro drawn.intro", null);
59351         nextStep();
59352       }
59353     }
59354     function didSplit() {
59355       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59356         return continueTo(rightClickIntersection);
59357       }
59358       var ids = context.selectedIDs();
59359       var string = "intro.lines.did_split_" + (ids.length > 1 ? "multi" : "single");
59360       var street = _t("intro.graph.name.washington-street");
59361       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
59362       var box = pad(twelfthAvenue, padding, context);
59363       box.width = box.width / 2;
59364       reveal(
59365         box,
59366         helpHtml(string, { street1: street, street2: street }),
59367         { duration: 500 }
59368       );
59369       timeout2(function() {
59370         context.map().centerZoomEase(twelfthAvenue, 18, 500);
59371         context.map().on("move.intro drawn.intro", function() {
59372           var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
59373           var box2 = pad(twelfthAvenue, padding2, context);
59374           box2.width = box2.width / 2;
59375           reveal(
59376             box2,
59377             helpHtml(string, { street1: street, street2: street }),
59378             { duration: 0 }
59379           );
59380         });
59381       }, 600);
59382       context.on("enter.intro", function() {
59383         var ids2 = context.selectedIDs();
59384         if (ids2.length === 1 && ids2[0] === _washingtonSegmentID) {
59385           continueTo(multiSelect2);
59386         }
59387       });
59388       context.history().on("change.intro", function() {
59389         if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59390           return continueTo(rightClickIntersection);
59391         }
59392       });
59393       function continueTo(nextStep) {
59394         context.map().on("move.intro drawn.intro", null);
59395         context.on("enter.intro", null);
59396         context.history().on("change.intro", null);
59397         nextStep();
59398       }
59399     }
59400     function multiSelect2() {
59401       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59402         return continueTo(rightClickIntersection);
59403       }
59404       var ids = context.selectedIDs();
59405       var hasWashington = ids.indexOf(_washingtonSegmentID) !== -1;
59406       var hasTwelfth = ids.indexOf(twelfthAvenueID) !== -1;
59407       if (hasWashington && hasTwelfth) {
59408         return continueTo(multiRightClick);
59409       } else if (!hasWashington && !hasTwelfth) {
59410         return continueTo(didSplit);
59411       }
59412       context.map().centerZoomEase(twelfthAvenue, 18, 500);
59413       timeout2(function() {
59414         var selected, other, padding, box;
59415         if (hasWashington) {
59416           selected = _t("intro.graph.name.washington-street");
59417           other = _t("intro.graph.name.12th-avenue");
59418           padding = 60 * Math.pow(2, context.map().zoom() - 18);
59419           box = pad(twelfthAvenueEnd, padding, context);
59420           box.width *= 3;
59421         } else {
59422           selected = _t("intro.graph.name.12th-avenue");
59423           other = _t("intro.graph.name.washington-street");
59424           padding = 200 * Math.pow(2, context.map().zoom() - 18);
59425           box = pad(twelfthAvenue, padding, context);
59426           box.width /= 2;
59427         }
59428         reveal(
59429           box,
59430           helpHtml(
59431             "intro.lines.multi_select",
59432             { selected, other1: other }
59433           ) + " " + helpHtml(
59434             "intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"),
59435             { selected, other2: other }
59436           )
59437         );
59438         context.map().on("move.intro drawn.intro", function() {
59439           if (hasWashington) {
59440             selected = _t("intro.graph.name.washington-street");
59441             other = _t("intro.graph.name.12th-avenue");
59442             padding = 60 * Math.pow(2, context.map().zoom() - 18);
59443             box = pad(twelfthAvenueEnd, padding, context);
59444             box.width *= 3;
59445           } else {
59446             selected = _t("intro.graph.name.12th-avenue");
59447             other = _t("intro.graph.name.washington-street");
59448             padding = 200 * Math.pow(2, context.map().zoom() - 18);
59449             box = pad(twelfthAvenue, padding, context);
59450             box.width /= 2;
59451           }
59452           reveal(
59453             box,
59454             helpHtml(
59455               "intro.lines.multi_select",
59456               { selected, other1: other }
59457             ) + " " + helpHtml(
59458               "intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"),
59459               { selected, other2: other }
59460             ),
59461             { duration: 0 }
59462           );
59463         });
59464         context.on("enter.intro", function() {
59465           continueTo(multiSelect2);
59466         });
59467         context.history().on("change.intro", function() {
59468           if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59469             return continueTo(rightClickIntersection);
59470           }
59471         });
59472       }, 600);
59473       function continueTo(nextStep) {
59474         context.map().on("move.intro drawn.intro", null);
59475         context.on("enter.intro", null);
59476         context.history().on("change.intro", null);
59477         nextStep();
59478       }
59479     }
59480     function multiRightClick() {
59481       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59482         return continueTo(rightClickIntersection);
59483       }
59484       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
59485       var box = pad(twelfthAvenue, padding, context);
59486       var rightClickString = helpHtml("intro.lines.multi_select_success") + helpHtml("intro.lines.multi_" + (context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch"));
59487       reveal(box, rightClickString);
59488       context.map().on("move.intro drawn.intro", function() {
59489         var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
59490         var box2 = pad(twelfthAvenue, padding2, context);
59491         reveal(box2, rightClickString, { duration: 0 });
59492       });
59493       context.ui().editMenu().on("toggled.intro", function(open) {
59494         if (!open) return;
59495         timeout2(function() {
59496           var ids = context.selectedIDs();
59497           if (ids.length === 2 && ids.indexOf(twelfthAvenueID) !== -1 && ids.indexOf(_washingtonSegmentID) !== -1) {
59498             var node = selectMenuItem(context, "delete").node();
59499             if (!node) return;
59500             continueTo(multiDelete);
59501           } else if (ids.length === 1 && ids.indexOf(_washingtonSegmentID) !== -1) {
59502             return continueTo(multiSelect2);
59503           } else {
59504             return continueTo(didSplit);
59505           }
59506         }, 300);
59507       });
59508       context.history().on("change.intro", function() {
59509         if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59510           return continueTo(rightClickIntersection);
59511         }
59512       });
59513       function continueTo(nextStep) {
59514         context.map().on("move.intro drawn.intro", null);
59515         context.ui().editMenu().on("toggled.intro", null);
59516         context.history().on("change.intro", null);
59517         nextStep();
59518       }
59519     }
59520     function multiDelete() {
59521       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59522         return continueTo(rightClickIntersection);
59523       }
59524       var node = selectMenuItem(context, "delete").node();
59525       if (!node) return continueTo(multiRightClick);
59526       reveal(
59527         ".edit-menu",
59528         helpHtml("intro.lines.multi_delete"),
59529         { padding: 50 }
59530       );
59531       context.map().on("move.intro drawn.intro", function() {
59532         reveal(
59533           ".edit-menu",
59534           helpHtml("intro.lines.multi_delete"),
59535           { duration: 0, padding: 50 }
59536         );
59537       });
59538       context.on("exit.intro", function() {
59539         if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
59540           return continueTo(multiSelect2);
59541         }
59542       });
59543       context.history().on("change.intro", function() {
59544         if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
59545           continueTo(retryDelete);
59546         } else {
59547           continueTo(play);
59548         }
59549       });
59550       function continueTo(nextStep) {
59551         context.map().on("move.intro drawn.intro", null);
59552         context.on("exit.intro", null);
59553         context.history().on("change.intro", null);
59554         nextStep();
59555       }
59556     }
59557     function retryDelete() {
59558       context.enter(modeBrowse(context));
59559       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
59560       var box = pad(twelfthAvenue, padding, context);
59561       reveal(box, helpHtml("intro.lines.retry_delete"), {
59562         buttonText: _t.html("intro.ok"),
59563         buttonCallback: function() {
59564           continueTo(multiSelect2);
59565         }
59566       });
59567       function continueTo(nextStep) {
59568         nextStep();
59569       }
59570     }
59571     function play() {
59572       dispatch14.call("done");
59573       reveal(
59574         ".ideditor",
59575         helpHtml("intro.lines.play", { next: _t("intro.buildings.title") }),
59576         {
59577           tooltipBox: ".intro-nav-wrap .chapter-building",
59578           buttonText: _t.html("intro.ok"),
59579           buttonCallback: function() {
59580             reveal(".ideditor");
59581           }
59582         }
59583       );
59584     }
59585     chapter.enter = function() {
59586       addLine();
59587     };
59588     chapter.exit = function() {
59589       timeouts.forEach(window.clearTimeout);
59590       select_default2(window).on("pointerdown.intro mousedown.intro", null, true);
59591       context.on("enter.intro exit.intro", null);
59592       context.map().on("move.intro drawn.intro", null);
59593       context.history().on("change.intro", null);
59594       context.container().select(".inspector-wrap").on("wheel.intro", null);
59595       context.container().select(".preset-list-button").on("click.intro", null);
59596     };
59597     chapter.restart = function() {
59598       chapter.exit();
59599       chapter.enter();
59600     };
59601     return utilRebind(chapter, dispatch14, "on");
59602   }
59603
59604   // modules/ui/intro/building.js
59605   function uiIntroBuilding(context, reveal) {
59606     var dispatch14 = dispatch_default("done");
59607     var house = [-85.62815, 41.95638];
59608     var tank = [-85.62732, 41.95347];
59609     var buildingCatetory = _mainPresetIndex.item("category-building");
59610     var housePreset = _mainPresetIndex.item("building/house");
59611     var tankPreset = _mainPresetIndex.item("man_made/storage_tank");
59612     var timeouts = [];
59613     var _houseID = null;
59614     var _tankID = null;
59615     var chapter = {
59616       title: "intro.buildings.title"
59617     };
59618     function timeout2(f2, t2) {
59619       timeouts.push(window.setTimeout(f2, t2));
59620     }
59621     function eventCancel(d3_event) {
59622       d3_event.stopPropagation();
59623       d3_event.preventDefault();
59624     }
59625     function revealHouse(center, text, options2) {
59626       var padding = 160 * Math.pow(2, context.map().zoom() - 20);
59627       var box = pad(center, padding, context);
59628       reveal(box, text, options2);
59629     }
59630     function revealTank(center, text, options2) {
59631       var padding = 190 * Math.pow(2, context.map().zoom() - 19.5);
59632       var box = pad(center, padding, context);
59633       reveal(box, text, options2);
59634     }
59635     function addHouse() {
59636       context.enter(modeBrowse(context));
59637       context.history().reset("initial");
59638       _houseID = null;
59639       var msec = transitionTime(house, context.map().center());
59640       if (msec) {
59641         reveal(null, null, { duration: 0 });
59642       }
59643       context.map().centerZoomEase(house, 19, msec);
59644       timeout2(function() {
59645         var tooltip = reveal(
59646           "button.add-area",
59647           helpHtml("intro.buildings.add_building")
59648         );
59649         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-buildings");
59650         context.on("enter.intro", function(mode) {
59651           if (mode.id !== "add-area") return;
59652           continueTo(startHouse);
59653         });
59654       }, msec + 100);
59655       function continueTo(nextStep) {
59656         context.on("enter.intro", null);
59657         nextStep();
59658       }
59659     }
59660     function startHouse() {
59661       if (context.mode().id !== "add-area") {
59662         return continueTo(addHouse);
59663       }
59664       _houseID = null;
59665       context.map().zoomEase(20, 500);
59666       timeout2(function() {
59667         var startString = helpHtml("intro.buildings.start_building") + helpHtml("intro.buildings.building_corner_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
59668         revealHouse(house, startString);
59669         context.map().on("move.intro drawn.intro", function() {
59670           revealHouse(house, startString, { duration: 0 });
59671         });
59672         context.on("enter.intro", function(mode) {
59673           if (mode.id !== "draw-area") return chapter.restart();
59674           continueTo(continueHouse);
59675         });
59676       }, 550);
59677       function continueTo(nextStep) {
59678         context.map().on("move.intro drawn.intro", null);
59679         context.on("enter.intro", null);
59680         nextStep();
59681       }
59682     }
59683     function continueHouse() {
59684       if (context.mode().id !== "draw-area") {
59685         return continueTo(addHouse);
59686       }
59687       _houseID = null;
59688       var continueString = helpHtml("intro.buildings.continue_building") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_building");
59689       revealHouse(house, continueString);
59690       context.map().on("move.intro drawn.intro", function() {
59691         revealHouse(house, continueString, { duration: 0 });
59692       });
59693       context.on("enter.intro", function(mode) {
59694         if (mode.id === "draw-area") {
59695           return;
59696         } else if (mode.id === "select") {
59697           var graph = context.graph();
59698           var way = context.entity(context.selectedIDs()[0]);
59699           var nodes = graph.childNodes(way);
59700           var points = utilArrayUniq(nodes).map(function(n3) {
59701             return context.projection(n3.loc);
59702           });
59703           if (isMostlySquare(points)) {
59704             _houseID = way.id;
59705             return continueTo(chooseCategoryBuilding);
59706           } else {
59707             return continueTo(retryHouse);
59708           }
59709         } else {
59710           return chapter.restart();
59711         }
59712       });
59713       function continueTo(nextStep) {
59714         context.map().on("move.intro drawn.intro", null);
59715         context.on("enter.intro", null);
59716         nextStep();
59717       }
59718     }
59719     function retryHouse() {
59720       var onClick = function() {
59721         continueTo(addHouse);
59722       };
59723       revealHouse(
59724         house,
59725         helpHtml("intro.buildings.retry_building"),
59726         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
59727       );
59728       context.map().on("move.intro drawn.intro", function() {
59729         revealHouse(
59730           house,
59731           helpHtml("intro.buildings.retry_building"),
59732           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
59733         );
59734       });
59735       function continueTo(nextStep) {
59736         context.map().on("move.intro drawn.intro", null);
59737         nextStep();
59738       }
59739     }
59740     function chooseCategoryBuilding() {
59741       if (!_houseID || !context.hasEntity(_houseID)) {
59742         return addHouse();
59743       }
59744       var ids = context.selectedIDs();
59745       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
59746         context.enter(modeSelect(context, [_houseID]));
59747       }
59748       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
59749       timeout2(function() {
59750         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
59751         var button = context.container().select(".preset-category-building .preset-list-button");
59752         reveal(
59753           button.node(),
59754           helpHtml("intro.buildings.choose_category_building", { category: buildingCatetory.name() })
59755         );
59756         button.on("click.intro", function() {
59757           button.on("click.intro", null);
59758           continueTo(choosePresetHouse);
59759         });
59760       }, 400);
59761       context.on("enter.intro", function(mode) {
59762         if (!_houseID || !context.hasEntity(_houseID)) {
59763           return continueTo(addHouse);
59764         }
59765         var ids2 = context.selectedIDs();
59766         if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
59767           return continueTo(chooseCategoryBuilding);
59768         }
59769       });
59770       function continueTo(nextStep) {
59771         context.container().select(".inspector-wrap").on("wheel.intro", null);
59772         context.container().select(".preset-list-button").on("click.intro", null);
59773         context.on("enter.intro", null);
59774         nextStep();
59775       }
59776     }
59777     function choosePresetHouse() {
59778       if (!_houseID || !context.hasEntity(_houseID)) {
59779         return addHouse();
59780       }
59781       var ids = context.selectedIDs();
59782       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
59783         context.enter(modeSelect(context, [_houseID]));
59784       }
59785       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
59786       timeout2(function() {
59787         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
59788         var button = context.container().select(".preset-building-house .preset-list-button");
59789         reveal(
59790           button.node(),
59791           helpHtml("intro.buildings.choose_preset_house", { preset: housePreset.name() }),
59792           { duration: 300 }
59793         );
59794         button.on("click.intro", function() {
59795           button.on("click.intro", null);
59796           continueTo(closeEditorHouse);
59797         });
59798       }, 400);
59799       context.on("enter.intro", function(mode) {
59800         if (!_houseID || !context.hasEntity(_houseID)) {
59801           return continueTo(addHouse);
59802         }
59803         var ids2 = context.selectedIDs();
59804         if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
59805           return continueTo(chooseCategoryBuilding);
59806         }
59807       });
59808       function continueTo(nextStep) {
59809         context.container().select(".inspector-wrap").on("wheel.intro", null);
59810         context.container().select(".preset-list-button").on("click.intro", null);
59811         context.on("enter.intro", null);
59812         nextStep();
59813       }
59814     }
59815     function closeEditorHouse() {
59816       if (!_houseID || !context.hasEntity(_houseID)) {
59817         return addHouse();
59818       }
59819       var ids = context.selectedIDs();
59820       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
59821         context.enter(modeSelect(context, [_houseID]));
59822       }
59823       context.history().checkpoint("hasHouse");
59824       context.on("exit.intro", function() {
59825         continueTo(rightClickHouse);
59826       });
59827       timeout2(function() {
59828         reveal(
59829           ".entity-editor-pane",
59830           helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } })
59831         );
59832       }, 500);
59833       function continueTo(nextStep) {
59834         context.on("exit.intro", null);
59835         nextStep();
59836       }
59837     }
59838     function rightClickHouse() {
59839       if (!_houseID) return chapter.restart();
59840       context.enter(modeBrowse(context));
59841       context.history().reset("hasHouse");
59842       var zoom = context.map().zoom();
59843       if (zoom < 20) {
59844         zoom = 20;
59845       }
59846       context.map().centerZoomEase(house, zoom, 500);
59847       context.on("enter.intro", function(mode) {
59848         if (mode.id !== "select") return;
59849         var ids = context.selectedIDs();
59850         if (ids.length !== 1 || ids[0] !== _houseID) return;
59851         timeout2(function() {
59852           var node = selectMenuItem(context, "orthogonalize").node();
59853           if (!node) return;
59854           continueTo(clickSquare);
59855         }, 50);
59856       });
59857       context.map().on("move.intro drawn.intro", function() {
59858         var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_building" : "edit_menu_building_touch"));
59859         revealHouse(house, rightclickString, { duration: 0 });
59860       });
59861       context.history().on("change.intro", function() {
59862         continueTo(rightClickHouse);
59863       });
59864       function continueTo(nextStep) {
59865         context.on("enter.intro", null);
59866         context.map().on("move.intro drawn.intro", null);
59867         context.history().on("change.intro", null);
59868         nextStep();
59869       }
59870     }
59871     function clickSquare() {
59872       if (!_houseID) return chapter.restart();
59873       var entity = context.hasEntity(_houseID);
59874       if (!entity) return continueTo(rightClickHouse);
59875       var node = selectMenuItem(context, "orthogonalize").node();
59876       if (!node) {
59877         return continueTo(rightClickHouse);
59878       }
59879       var wasChanged = false;
59880       reveal(
59881         ".edit-menu",
59882         helpHtml("intro.buildings.square_building"),
59883         { padding: 50 }
59884       );
59885       context.on("enter.intro", function(mode) {
59886         if (mode.id === "browse") {
59887           continueTo(rightClickHouse);
59888         } else if (mode.id === "move" || mode.id === "rotate") {
59889           continueTo(retryClickSquare);
59890         }
59891       });
59892       context.map().on("move.intro", function() {
59893         var node2 = selectMenuItem(context, "orthogonalize").node();
59894         if (!wasChanged && !node2) {
59895           return continueTo(rightClickHouse);
59896         }
59897         reveal(
59898           ".edit-menu",
59899           helpHtml("intro.buildings.square_building"),
59900           { duration: 0, padding: 50 }
59901         );
59902       });
59903       context.history().on("change.intro", function() {
59904         wasChanged = true;
59905         context.history().on("change.intro", null);
59906         timeout2(function() {
59907           if (context.history().undoAnnotation() === _t("operations.orthogonalize.annotation.feature", { n: 1 })) {
59908             continueTo(doneSquare);
59909           } else {
59910             continueTo(retryClickSquare);
59911           }
59912         }, 500);
59913       });
59914       function continueTo(nextStep) {
59915         context.on("enter.intro", null);
59916         context.map().on("move.intro", null);
59917         context.history().on("change.intro", null);
59918         nextStep();
59919       }
59920     }
59921     function retryClickSquare() {
59922       context.enter(modeBrowse(context));
59923       revealHouse(house, helpHtml("intro.buildings.retry_square"), {
59924         buttonText: _t.html("intro.ok"),
59925         buttonCallback: function() {
59926           continueTo(rightClickHouse);
59927         }
59928       });
59929       function continueTo(nextStep) {
59930         nextStep();
59931       }
59932     }
59933     function doneSquare() {
59934       context.history().checkpoint("doneSquare");
59935       revealHouse(house, helpHtml("intro.buildings.done_square"), {
59936         buttonText: _t.html("intro.ok"),
59937         buttonCallback: function() {
59938           continueTo(addTank);
59939         }
59940       });
59941       function continueTo(nextStep) {
59942         nextStep();
59943       }
59944     }
59945     function addTank() {
59946       context.enter(modeBrowse(context));
59947       context.history().reset("doneSquare");
59948       _tankID = null;
59949       var msec = transitionTime(tank, context.map().center());
59950       if (msec) {
59951         reveal(null, null, { duration: 0 });
59952       }
59953       context.map().centerZoomEase(tank, 19.5, msec);
59954       timeout2(function() {
59955         reveal(
59956           "button.add-area",
59957           helpHtml("intro.buildings.add_tank")
59958         );
59959         context.on("enter.intro", function(mode) {
59960           if (mode.id !== "add-area") return;
59961           continueTo(startTank);
59962         });
59963       }, msec + 100);
59964       function continueTo(nextStep) {
59965         context.on("enter.intro", null);
59966         nextStep();
59967       }
59968     }
59969     function startTank() {
59970       if (context.mode().id !== "add-area") {
59971         return continueTo(addTank);
59972       }
59973       _tankID = null;
59974       timeout2(function() {
59975         var startString = helpHtml("intro.buildings.start_tank") + helpHtml("intro.buildings.tank_edge_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
59976         revealTank(tank, startString);
59977         context.map().on("move.intro drawn.intro", function() {
59978           revealTank(tank, startString, { duration: 0 });
59979         });
59980         context.on("enter.intro", function(mode) {
59981           if (mode.id !== "draw-area") return chapter.restart();
59982           continueTo(continueTank);
59983         });
59984       }, 550);
59985       function continueTo(nextStep) {
59986         context.map().on("move.intro drawn.intro", null);
59987         context.on("enter.intro", null);
59988         nextStep();
59989       }
59990     }
59991     function continueTank() {
59992       if (context.mode().id !== "draw-area") {
59993         return continueTo(addTank);
59994       }
59995       _tankID = null;
59996       var continueString = helpHtml("intro.buildings.continue_tank") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_tank");
59997       revealTank(tank, continueString);
59998       context.map().on("move.intro drawn.intro", function() {
59999         revealTank(tank, continueString, { duration: 0 });
60000       });
60001       context.on("enter.intro", function(mode) {
60002         if (mode.id === "draw-area") {
60003           return;
60004         } else if (mode.id === "select") {
60005           _tankID = context.selectedIDs()[0];
60006           return continueTo(searchPresetTank);
60007         } else {
60008           return continueTo(addTank);
60009         }
60010       });
60011       function continueTo(nextStep) {
60012         context.map().on("move.intro drawn.intro", null);
60013         context.on("enter.intro", null);
60014         nextStep();
60015       }
60016     }
60017     function searchPresetTank() {
60018       if (!_tankID || !context.hasEntity(_tankID)) {
60019         return addTank();
60020       }
60021       var ids = context.selectedIDs();
60022       if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
60023         context.enter(modeSelect(context, [_tankID]));
60024       }
60025       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
60026       timeout2(function() {
60027         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
60028         context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
60029         reveal(
60030           ".preset-search-input",
60031           helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() })
60032         );
60033       }, 400);
60034       context.on("enter.intro", function(mode) {
60035         if (!_tankID || !context.hasEntity(_tankID)) {
60036           return continueTo(addTank);
60037         }
60038         var ids2 = context.selectedIDs();
60039         if (mode.id !== "select" || !ids2.length || ids2[0] !== _tankID) {
60040           context.enter(modeSelect(context, [_tankID]));
60041           context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
60042           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
60043           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
60044           reveal(
60045             ".preset-search-input",
60046             helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() })
60047           );
60048           context.history().on("change.intro", null);
60049         }
60050       });
60051       function checkPresetSearch() {
60052         var first = context.container().select(".preset-list-item:first-child");
60053         if (first.classed("preset-man_made-storage_tank")) {
60054           reveal(
60055             first.select(".preset-list-button").node(),
60056             helpHtml("intro.buildings.choose_tank", { preset: tankPreset.name() }),
60057             { duration: 300 }
60058           );
60059           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
60060           context.history().on("change.intro", function() {
60061             continueTo(closeEditorTank);
60062           });
60063         }
60064       }
60065       function continueTo(nextStep) {
60066         context.container().select(".inspector-wrap").on("wheel.intro", null);
60067         context.on("enter.intro", null);
60068         context.history().on("change.intro", null);
60069         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
60070         nextStep();
60071       }
60072     }
60073     function closeEditorTank() {
60074       if (!_tankID || !context.hasEntity(_tankID)) {
60075         return addTank();
60076       }
60077       var ids = context.selectedIDs();
60078       if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
60079         context.enter(modeSelect(context, [_tankID]));
60080       }
60081       context.history().checkpoint("hasTank");
60082       context.on("exit.intro", function() {
60083         continueTo(rightClickTank);
60084       });
60085       timeout2(function() {
60086         reveal(
60087           ".entity-editor-pane",
60088           helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } })
60089         );
60090       }, 500);
60091       function continueTo(nextStep) {
60092         context.on("exit.intro", null);
60093         nextStep();
60094       }
60095     }
60096     function rightClickTank() {
60097       if (!_tankID) return continueTo(addTank);
60098       context.enter(modeBrowse(context));
60099       context.history().reset("hasTank");
60100       context.map().centerEase(tank, 500);
60101       timeout2(function() {
60102         context.on("enter.intro", function(mode) {
60103           if (mode.id !== "select") return;
60104           var ids = context.selectedIDs();
60105           if (ids.length !== 1 || ids[0] !== _tankID) return;
60106           timeout2(function() {
60107             var node = selectMenuItem(context, "circularize").node();
60108             if (!node) return;
60109             continueTo(clickCircle);
60110           }, 50);
60111         });
60112         var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_tank" : "edit_menu_tank_touch"));
60113         revealTank(tank, rightclickString);
60114         context.map().on("move.intro drawn.intro", function() {
60115           revealTank(tank, rightclickString, { duration: 0 });
60116         });
60117         context.history().on("change.intro", function() {
60118           continueTo(rightClickTank);
60119         });
60120       }, 600);
60121       function continueTo(nextStep) {
60122         context.on("enter.intro", null);
60123         context.map().on("move.intro drawn.intro", null);
60124         context.history().on("change.intro", null);
60125         nextStep();
60126       }
60127     }
60128     function clickCircle() {
60129       if (!_tankID) return chapter.restart();
60130       var entity = context.hasEntity(_tankID);
60131       if (!entity) return continueTo(rightClickTank);
60132       var node = selectMenuItem(context, "circularize").node();
60133       if (!node) {
60134         return continueTo(rightClickTank);
60135       }
60136       var wasChanged = false;
60137       reveal(
60138         ".edit-menu",
60139         helpHtml("intro.buildings.circle_tank"),
60140         { padding: 50 }
60141       );
60142       context.on("enter.intro", function(mode) {
60143         if (mode.id === "browse") {
60144           continueTo(rightClickTank);
60145         } else if (mode.id === "move" || mode.id === "rotate") {
60146           continueTo(retryClickCircle);
60147         }
60148       });
60149       context.map().on("move.intro", function() {
60150         var node2 = selectMenuItem(context, "circularize").node();
60151         if (!wasChanged && !node2) {
60152           return continueTo(rightClickTank);
60153         }
60154         reveal(
60155           ".edit-menu",
60156           helpHtml("intro.buildings.circle_tank"),
60157           { duration: 0, padding: 50 }
60158         );
60159       });
60160       context.history().on("change.intro", function() {
60161         wasChanged = true;
60162         context.history().on("change.intro", null);
60163         timeout2(function() {
60164           if (context.history().undoAnnotation() === _t("operations.circularize.annotation.feature", { n: 1 })) {
60165             continueTo(play);
60166           } else {
60167             continueTo(retryClickCircle);
60168           }
60169         }, 500);
60170       });
60171       function continueTo(nextStep) {
60172         context.on("enter.intro", null);
60173         context.map().on("move.intro", null);
60174         context.history().on("change.intro", null);
60175         nextStep();
60176       }
60177     }
60178     function retryClickCircle() {
60179       context.enter(modeBrowse(context));
60180       revealTank(tank, helpHtml("intro.buildings.retry_circle"), {
60181         buttonText: _t.html("intro.ok"),
60182         buttonCallback: function() {
60183           continueTo(rightClickTank);
60184         }
60185       });
60186       function continueTo(nextStep) {
60187         nextStep();
60188       }
60189     }
60190     function play() {
60191       dispatch14.call("done");
60192       reveal(
60193         ".ideditor",
60194         helpHtml("intro.buildings.play", { next: _t("intro.startediting.title") }),
60195         {
60196           tooltipBox: ".intro-nav-wrap .chapter-startEditing",
60197           buttonText: _t.html("intro.ok"),
60198           buttonCallback: function() {
60199             reveal(".ideditor");
60200           }
60201         }
60202       );
60203     }
60204     chapter.enter = function() {
60205       addHouse();
60206     };
60207     chapter.exit = function() {
60208       timeouts.forEach(window.clearTimeout);
60209       context.on("enter.intro exit.intro", null);
60210       context.map().on("move.intro drawn.intro", null);
60211       context.history().on("change.intro", null);
60212       context.container().select(".inspector-wrap").on("wheel.intro", null);
60213       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
60214       context.container().select(".more-fields .combobox-input").on("click.intro", null);
60215     };
60216     chapter.restart = function() {
60217       chapter.exit();
60218       chapter.enter();
60219     };
60220     return utilRebind(chapter, dispatch14, "on");
60221   }
60222
60223   // modules/ui/intro/start_editing.js
60224   function uiIntroStartEditing(context, reveal) {
60225     var dispatch14 = dispatch_default("done", "startEditing");
60226     var modalSelection = select_default2(null);
60227     var chapter = {
60228       title: "intro.startediting.title"
60229     };
60230     function showHelp() {
60231       reveal(
60232         ".map-control.help-control",
60233         helpHtml("intro.startediting.help"),
60234         {
60235           buttonText: _t.html("intro.ok"),
60236           buttonCallback: function() {
60237             shortcuts();
60238           }
60239         }
60240       );
60241     }
60242     function shortcuts() {
60243       reveal(
60244         ".map-control.help-control",
60245         helpHtml("intro.startediting.shortcuts"),
60246         {
60247           buttonText: _t.html("intro.ok"),
60248           buttonCallback: function() {
60249             showSave();
60250           }
60251         }
60252       );
60253     }
60254     function showSave() {
60255       context.container().selectAll(".shaded").remove();
60256       reveal(
60257         ".top-toolbar button.save",
60258         helpHtml("intro.startediting.save"),
60259         {
60260           buttonText: _t.html("intro.ok"),
60261           buttonCallback: function() {
60262             showStart();
60263           }
60264         }
60265       );
60266     }
60267     function showStart() {
60268       context.container().selectAll(".shaded").remove();
60269       modalSelection = uiModal(context.container());
60270       modalSelection.select(".modal").attr("class", "modal-splash modal");
60271       modalSelection.selectAll(".close").remove();
60272       var startbutton = modalSelection.select(".content").attr("class", "fillL").append("button").attr("class", "modal-section huge-modal-button").on("click", function() {
60273         modalSelection.remove();
60274       });
60275       startbutton.append("svg").attr("class", "illustration").append("use").attr("xlink:href", "#iD-logo-walkthrough");
60276       startbutton.append("h2").call(_t.append("intro.startediting.start"));
60277       dispatch14.call("startEditing");
60278     }
60279     chapter.enter = function() {
60280       showHelp();
60281     };
60282     chapter.exit = function() {
60283       modalSelection.remove();
60284       context.container().selectAll(".shaded").remove();
60285     };
60286     return utilRebind(chapter, dispatch14, "on");
60287   }
60288
60289   // modules/ui/intro/intro.js
60290   var chapterUi = {
60291     welcome: uiIntroWelcome,
60292     navigation: uiIntroNavigation,
60293     point: uiIntroPoint,
60294     area: uiIntroArea,
60295     line: uiIntroLine,
60296     building: uiIntroBuilding,
60297     startEditing: uiIntroStartEditing
60298   };
60299   var chapterFlow = [
60300     "welcome",
60301     "navigation",
60302     "point",
60303     "area",
60304     "line",
60305     "building",
60306     "startEditing"
60307   ];
60308   function uiIntro(context) {
60309     const INTRO_IMAGERY = "EsriWorldImageryClarity";
60310     let _introGraph = {};
60311     let _currChapter;
60312     function intro(selection2) {
60313       _mainFileFetcher.get("intro_graph").then((dataIntroGraph) => {
60314         for (let id2 in dataIntroGraph) {
60315           if (!_introGraph[id2]) {
60316             _introGraph[id2] = osmEntity(localize(dataIntroGraph[id2]));
60317           }
60318         }
60319         selection2.call(startIntro);
60320       }).catch(function() {
60321       });
60322     }
60323     function startIntro(selection2) {
60324       context.enter(modeBrowse(context));
60325       let osm = context.connection();
60326       let history = context.history().toJSON();
60327       let hash = window.location.hash;
60328       let center = context.map().center();
60329       let zoom = context.map().zoom();
60330       let background = context.background().baseLayerSource();
60331       let overlays = context.background().overlayLayerSources();
60332       let opacity = context.container().selectAll(".main-map .layer-background").style("opacity");
60333       let caches = osm && osm.caches();
60334       let baseEntities = context.history().graph().base().entities;
60335       context.ui().sidebar.expand();
60336       context.container().selectAll("button.sidebar-toggle").classed("disabled", true);
60337       context.inIntro(true);
60338       if (osm) {
60339         osm.toggle(false).reset();
60340       }
60341       context.history().reset();
60342       context.history().merge(Object.values(coreGraph().load(_introGraph).entities));
60343       context.history().checkpoint("initial");
60344       let imagery = context.background().findSource(INTRO_IMAGERY);
60345       if (imagery) {
60346         context.background().baseLayerSource(imagery);
60347       } else {
60348         context.background().bing();
60349       }
60350       overlays.forEach((d2) => context.background().toggleOverlayLayer(d2));
60351       let layers = context.layers();
60352       layers.all().forEach((item) => {
60353         if (typeof item.layer.enabled === "function") {
60354           item.layer.enabled(item.id === "osm");
60355         }
60356       });
60357       context.container().selectAll(".main-map .layer-background").style("opacity", 1);
60358       let curtain = uiCurtain(context.container().node());
60359       selection2.call(curtain);
60360       corePreferences("walkthrough_started", "yes");
60361       let storedProgress = corePreferences("walkthrough_progress") || "";
60362       let progress = storedProgress.split(";").filter(Boolean);
60363       let chapters = chapterFlow.map((chapter, i3) => {
60364         let s2 = chapterUi[chapter](context, curtain.reveal).on("done", () => {
60365           buttons.filter((d2) => d2.title === s2.title).classed("finished", true);
60366           if (i3 < chapterFlow.length - 1) {
60367             const next = chapterFlow[i3 + 1];
60368             context.container().select("button.chapter-".concat(next)).classed("next", true);
60369           }
60370           progress.push(chapter);
60371           corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
60372         });
60373         return s2;
60374       });
60375       chapters[chapters.length - 1].on("startEditing", () => {
60376         progress.push("startEditing");
60377         corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
60378         let incomplete = utilArrayDifference(chapterFlow, progress);
60379         if (!incomplete.length) {
60380           corePreferences("walkthrough_completed", "yes");
60381         }
60382         curtain.remove();
60383         navwrap.remove();
60384         context.container().selectAll(".main-map .layer-background").style("opacity", opacity);
60385         context.container().selectAll("button.sidebar-toggle").classed("disabled", false);
60386         if (osm) {
60387           osm.toggle(true).reset().caches(caches);
60388         }
60389         context.history().reset().merge(Object.values(baseEntities));
60390         context.background().baseLayerSource(background);
60391         overlays.forEach((d2) => context.background().toggleOverlayLayer(d2));
60392         if (history) {
60393           context.history().fromJSON(history, false);
60394         }
60395         context.map().centerZoom(center, zoom);
60396         window.location.replace(hash);
60397         context.inIntro(false);
60398       });
60399       let navwrap = selection2.append("div").attr("class", "intro-nav-wrap fillD");
60400       navwrap.append("svg").attr("class", "intro-nav-wrap-logo").append("use").attr("xlink:href", "#iD-logo-walkthrough");
60401       let buttonwrap = navwrap.append("div").attr("class", "joined").selectAll("button.chapter");
60402       let buttons = buttonwrap.data(chapters).enter().append("button").attr("class", (d2, i3) => "chapter chapter-".concat(chapterFlow[i3])).on("click", enterChapter);
60403       buttons.append("span").html((d2) => _t.html(d2.title));
60404       buttons.append("span").attr("class", "status").call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
60405       enterChapter(null, chapters[0]);
60406       function enterChapter(d3_event, newChapter) {
60407         if (_currChapter) {
60408           _currChapter.exit();
60409         }
60410         context.enter(modeBrowse(context));
60411         _currChapter = newChapter;
60412         _currChapter.enter();
60413         buttons.classed("next", false).classed("active", (d2) => d2.title === _currChapter.title);
60414       }
60415     }
60416     return intro;
60417   }
60418
60419   // modules/ui/issues_info.js
60420   function uiIssuesInfo(context) {
60421     var warningsItem = {
60422       id: "warnings",
60423       count: 0,
60424       iconID: "iD-icon-alert",
60425       descriptionID: "issues.warnings_and_errors"
60426     };
60427     var resolvedItem = {
60428       id: "resolved",
60429       count: 0,
60430       iconID: "iD-icon-apply",
60431       descriptionID: "issues.user_resolved_issues"
60432     };
60433     function update(selection2) {
60434       var shownItems = [];
60435       var liveIssues = context.validator().getIssues({
60436         what: corePreferences("validate-what") || "edited",
60437         where: corePreferences("validate-where") || "all"
60438       });
60439       if (liveIssues.length) {
60440         warningsItem.count = liveIssues.length;
60441         shownItems.push(warningsItem);
60442       }
60443       if (corePreferences("validate-what") === "all") {
60444         var resolvedIssues = context.validator().getResolvedIssues();
60445         if (resolvedIssues.length) {
60446           resolvedItem.count = resolvedIssues.length;
60447           shownItems.push(resolvedItem);
60448         }
60449       }
60450       var chips = selection2.selectAll(".chip").data(shownItems, function(d2) {
60451         return d2.id;
60452       });
60453       chips.exit().remove();
60454       var enter = chips.enter().append("a").attr("class", function(d2) {
60455         return "chip " + d2.id + "-count";
60456       }).attr("href", "#").each(function(d2) {
60457         var chipSelection = select_default2(this);
60458         var tooltipBehavior = uiTooltip().placement("top").title(() => _t.append(d2.descriptionID));
60459         chipSelection.call(tooltipBehavior).on("click", function(d3_event) {
60460           d3_event.preventDefault();
60461           tooltipBehavior.hide(select_default2(this));
60462           context.ui().togglePanes(context.container().select(".map-panes .issues-pane"));
60463         });
60464         chipSelection.call(svgIcon("#" + d2.iconID));
60465       });
60466       enter.append("span").attr("class", "count");
60467       enter.merge(chips).selectAll("span.count").text(function(d2) {
60468         return d2.count.toString();
60469       });
60470     }
60471     return function(selection2) {
60472       update(selection2);
60473       context.validator().on("validated.infobox", function() {
60474         update(selection2);
60475       });
60476     };
60477   }
60478
60479   // modules/renderer/background_source.js
60480   var import_lodash4 = __toESM(require_lodash());
60481
60482   // modules/util/IntervalTasksQueue.js
60483   var IntervalTasksQueue = class {
60484     /**
60485      * Interval in milliseconds inside which only 1 task can execute.
60486      * e.g. if interval is 200ms, and 5 async tasks are unqueued,
60487      * they will complete in ~1s if not cleared
60488      * @param {number} intervalInMs
60489      */
60490     constructor(intervalInMs) {
60491       this.intervalInMs = intervalInMs;
60492       this.pendingHandles = [];
60493       this.time = 0;
60494     }
60495     enqueue(task) {
60496       let taskTimeout = this.time;
60497       this.time += this.intervalInMs;
60498       this.pendingHandles.push(setTimeout(() => {
60499         this.time -= this.intervalInMs;
60500         task();
60501       }, taskTimeout));
60502     }
60503     clear() {
60504       this.pendingHandles.forEach((timeoutHandle) => {
60505         clearTimeout(timeoutHandle);
60506       });
60507       this.pendingHandles = [];
60508       this.time = 0;
60509     }
60510   };
60511
60512   // modules/renderer/background_source.js
60513   var isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
60514   window.matchMedia("\n        (-webkit-min-device-pixel-ratio: 2), /* Safari */\n        (min-resolution: 2dppx),             /* standard */\n        (min-resolution: 192dpi)             /* fallback */\n    ").addListener(function() {
60515     isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
60516   });
60517   function localeDateString(s2) {
60518     if (!s2) return null;
60519     var options2 = { day: "numeric", month: "short", year: "numeric" };
60520     var d2 = new Date(s2);
60521     if (isNaN(d2.getTime())) return null;
60522     return d2.toLocaleDateString(_mainLocalizer.localeCode(), options2);
60523   }
60524   function vintageRange(vintage) {
60525     var s2;
60526     if (vintage.start || vintage.end) {
60527       s2 = vintage.start || "?";
60528       if (vintage.start !== vintage.end) {
60529         s2 += " - " + (vintage.end || "?");
60530       }
60531     }
60532     return s2;
60533   }
60534   function rendererBackgroundSource(data) {
60535     var source = Object.assign({}, data);
60536     var _offset = [0, 0];
60537     var _name = source.name;
60538     var _description = source.description;
60539     var _best = !!source.best;
60540     var _template = source.encrypted ? utilAesDecrypt(source.template) : source.template;
60541     source.tileSize = data.tileSize || 256;
60542     source.zoomExtent = data.zoomExtent || [0, 22];
60543     source.overzoom = data.overzoom !== false;
60544     source.offset = function(val) {
60545       if (!arguments.length) return _offset;
60546       _offset = val;
60547       return source;
60548     };
60549     source.nudge = function(val, zoomlevel) {
60550       _offset[0] += val[0] / Math.pow(2, zoomlevel);
60551       _offset[1] += val[1] / Math.pow(2, zoomlevel);
60552       return source;
60553     };
60554     source.name = function() {
60555       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
60556       return _t("imagery." + id_safe + ".name", { default: (0, import_lodash4.escape)(_name) });
60557     };
60558     source.label = function() {
60559       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
60560       return _t.append("imagery." + id_safe + ".name", { default: (0, import_lodash4.escape)(_name) });
60561     };
60562     source.hasDescription = function() {
60563       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
60564       var descriptionText = _mainLocalizer.tInfo("imagery." + id_safe + ".description", { default: (0, import_lodash4.escape)(_description) }).text;
60565       return descriptionText !== "";
60566     };
60567     source.description = function() {
60568       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
60569       return _t.append("imagery." + id_safe + ".description", { default: (0, import_lodash4.escape)(_description) });
60570     };
60571     source.best = function() {
60572       return _best;
60573     };
60574     source.area = function() {
60575       if (!data.polygon) return Number.MAX_VALUE;
60576       var area = area_default({ type: "MultiPolygon", coordinates: [data.polygon] });
60577       return isNaN(area) ? 0 : area;
60578     };
60579     source.imageryUsed = function() {
60580       return _name || source.id;
60581     };
60582     source.template = function(val) {
60583       if (!arguments.length) return _template;
60584       if (source.id === "custom" || source.id === "Bing") {
60585         _template = val;
60586       }
60587       return source;
60588     };
60589     source.url = function(coord2) {
60590       var result = _template.replace(/#[\s\S]*/u, "");
60591       if (result === "") return result;
60592       if (!source.type || source.id === "custom") {
60593         if (/SERVICE=WMS|\{(proj|wkid|bbox)\}/.test(result)) {
60594           source.type = "wms";
60595           source.projection = "EPSG:3857";
60596         } else if (/\{(x|y)\}/.test(result)) {
60597           source.type = "tms";
60598         } else if (/\{u\}/.test(result)) {
60599           source.type = "bing";
60600         }
60601       }
60602       if (source.type === "wms") {
60603         var tileToProjectedCoords = function(x2, y2, z2) {
60604           var zoomSize = Math.pow(2, z2);
60605           var lon = x2 / zoomSize * Math.PI * 2 - Math.PI;
60606           var lat = Math.atan(Math.sinh(Math.PI * (1 - 2 * y2 / zoomSize)));
60607           switch (source.projection) {
60608             case "EPSG:4326":
60609               return {
60610                 x: lon * 180 / Math.PI,
60611                 y: lat * 180 / Math.PI
60612               };
60613             default:
60614               var mercCoords = mercatorRaw(lon, lat);
60615               return {
60616                 x: 2003750834e-2 / Math.PI * mercCoords[0],
60617                 y: 2003750834e-2 / Math.PI * mercCoords[1]
60618               };
60619           }
60620         };
60621         var tileSize = source.tileSize;
60622         var projection2 = source.projection;
60623         var minXmaxY = tileToProjectedCoords(coord2[0], coord2[1], coord2[2]);
60624         var maxXminY = tileToProjectedCoords(coord2[0] + 1, coord2[1] + 1, coord2[2]);
60625         result = result.replace(/\{(\w+)\}/g, function(token, key) {
60626           switch (key) {
60627             case "width":
60628             case "height":
60629               return tileSize;
60630             case "proj":
60631               return projection2;
60632             case "wkid":
60633               return projection2.replace(/^EPSG:/, "");
60634             case "bbox":
60635               if (projection2 === "EPSG:4326" && // The CRS parameter implies version 1.3 (prior versions use SRS)
60636               /VERSION=1.3|CRS={proj}/.test(source.template().toUpperCase())) {
60637                 return maxXminY.y + "," + minXmaxY.x + "," + minXmaxY.y + "," + maxXminY.x;
60638               } else {
60639                 return minXmaxY.x + "," + maxXminY.y + "," + maxXminY.x + "," + minXmaxY.y;
60640               }
60641             case "w":
60642               return minXmaxY.x;
60643             case "s":
60644               return maxXminY.y;
60645             case "n":
60646               return maxXminY.x;
60647             case "e":
60648               return minXmaxY.y;
60649             default:
60650               return token;
60651           }
60652         });
60653       } else if (source.type === "tms") {
60654         result = result.replace("{x}", coord2[0]).replace("{y}", coord2[1]).replace(/\{[t-]y\}/, Math.pow(2, coord2[2]) - coord2[1] - 1).replace(/\{z(oom)?\}/, coord2[2]).replace(/\{@2x\}|\{r\}/, isRetina ? "@2x" : "");
60655       } else if (source.type === "bing") {
60656         result = result.replace("{u}", function() {
60657           var u2 = "";
60658           for (var zoom = coord2[2]; zoom > 0; zoom--) {
60659             var b2 = 0;
60660             var mask = 1 << zoom - 1;
60661             if ((coord2[0] & mask) !== 0) b2++;
60662             if ((coord2[1] & mask) !== 0) b2 += 2;
60663             u2 += b2.toString();
60664           }
60665           return u2;
60666         });
60667       }
60668       result = result.replace(/\{switch:([^}]+)\}/, function(s2, r2) {
60669         var subdomains = r2.split(",");
60670         return subdomains[(coord2[0] + coord2[1]) % subdomains.length];
60671       });
60672       return result;
60673     };
60674     source.validZoom = function(z2) {
60675       return source.zoomExtent[0] <= z2 && (source.overzoom || source.zoomExtent[1] > z2);
60676     };
60677     source.isLocatorOverlay = function() {
60678       return source.id === "mapbox_locator_overlay";
60679     };
60680     source.isHidden = function() {
60681       return source.id === "DigitalGlobe-Premium-vintage" || source.id === "DigitalGlobe-Standard-vintage";
60682     };
60683     source.copyrightNotices = function() {
60684     };
60685     source.getMetadata = function(center, tileCoord, callback) {
60686       var vintage = {
60687         start: localeDateString(source.startDate),
60688         end: localeDateString(source.endDate)
60689       };
60690       vintage.range = vintageRange(vintage);
60691       var metadata = { vintage };
60692       callback(null, metadata);
60693     };
60694     return source;
60695   }
60696   rendererBackgroundSource.Bing = function(data, dispatch14) {
60697     data.template = "https://ecn.t{switch:0,1,2,3}.tiles.virtualearth.net/tiles/a{u}.jpeg?g=1&pr=odbl&n=z";
60698     var bing = rendererBackgroundSource(data);
60699     var key = utilAesDecrypt("5c875730b09c6b422433e807e1ff060b6536c791dbfffcffc4c6b18a1bdba1f14593d151adb50e19e1be1ab19aef813bf135d0f103475e5c724dec94389e45d0");
60700     const strictParam = "n";
60701     var url = "https://dev.virtualearth.net/REST/v1/Imagery/Metadata/AerialOSM?include=ImageryProviders&uriScheme=https&key=" + key;
60702     var cache = {};
60703     var inflight = {};
60704     var providers = [];
60705     var taskQueue = new IntervalTasksQueue(250);
60706     var metadataLastZoom = -1;
60707     json_default(url).then(function(json) {
60708       let imageryResource = json.resourceSets[0].resources[0];
60709       let template = imageryResource.imageUrl;
60710       let subDomains = imageryResource.imageUrlSubdomains;
60711       let subDomainNumbers = subDomains.map((subDomain) => {
60712         return subDomain.substring(1);
60713       }).join(",");
60714       template = template.replace("{subdomain}", "t{switch:".concat(subDomainNumbers, "}")).replace("{quadkey}", "{u}");
60715       if (!new URLSearchParams(template).has(strictParam)) {
60716         template += "&".concat(strictParam, "=z");
60717       }
60718       bing.template(template);
60719       providers = imageryResource.imageryProviders.map(function(provider) {
60720         return {
60721           attribution: provider.attribution,
60722           areas: provider.coverageAreas.map(function(area) {
60723             return {
60724               zoom: [area.zoomMin, area.zoomMax],
60725               extent: geoExtent([area.bbox[1], area.bbox[0]], [area.bbox[3], area.bbox[2]])
60726             };
60727           })
60728         };
60729       });
60730       dispatch14.call("change");
60731     }).catch(function() {
60732     });
60733     bing.copyrightNotices = function(zoom, extent) {
60734       zoom = Math.min(zoom, 21);
60735       return providers.filter(function(provider) {
60736         return provider.areas.some(function(area) {
60737           return extent.intersects(area.extent) && area.zoom[0] <= zoom && area.zoom[1] >= zoom;
60738         });
60739       }).map(function(provider) {
60740         return provider.attribution;
60741       }).join(", ");
60742     };
60743     bing.getMetadata = function(center, tileCoord, callback) {
60744       var tileID = tileCoord.slice(0, 3).join("/");
60745       var zoom = Math.min(tileCoord[2], 21);
60746       var centerPoint = center[1] + "," + center[0];
60747       var url2 = "https://dev.virtualearth.net/REST/v1/Imagery/BasicMetadata/AerialOSM/" + centerPoint + "?zl=" + zoom + "&key=" + key;
60748       if (inflight[tileID]) return;
60749       if (!cache[tileID]) {
60750         cache[tileID] = {};
60751       }
60752       if (cache[tileID] && cache[tileID].metadata) {
60753         return callback(null, cache[tileID].metadata);
60754       }
60755       inflight[tileID] = true;
60756       if (metadataLastZoom !== tileCoord[2]) {
60757         metadataLastZoom = tileCoord[2];
60758         taskQueue.clear();
60759       }
60760       taskQueue.enqueue(() => {
60761         json_default(url2).then(function(result) {
60762           delete inflight[tileID];
60763           if (!result) {
60764             throw new Error("Unknown Error");
60765           }
60766           var vintage = {
60767             start: localeDateString(result.resourceSets[0].resources[0].vintageStart),
60768             end: localeDateString(result.resourceSets[0].resources[0].vintageEnd)
60769           };
60770           vintage.range = vintageRange(vintage);
60771           var metadata = { vintage };
60772           cache[tileID].metadata = metadata;
60773           if (callback) callback(null, metadata);
60774         }).catch(function(err) {
60775           delete inflight[tileID];
60776           if (callback) callback(err.message);
60777         });
60778       });
60779     };
60780     bing.terms_url = "https://blog.openstreetmap.org/2010/11/30/microsoft-imagery-details";
60781     return bing;
60782   };
60783   rendererBackgroundSource.Esri = function(data) {
60784     if (data.template.match(/blankTile/) === null) {
60785       data.template = data.template + "?blankTile=false";
60786     }
60787     var esri = rendererBackgroundSource(data);
60788     var cache = {};
60789     var inflight = {};
60790     var _prevCenter;
60791     esri.fetchTilemap = function(center) {
60792       if (_prevCenter && geoSphericalDistance(center, _prevCenter) < 5e3) return;
60793       _prevCenter = center;
60794       var z2 = 20;
60795       var dummyUrl = esri.url([1, 2, 3]);
60796       var x2 = Math.floor((center[0] + 180) / 360 * Math.pow(2, z2));
60797       var y2 = Math.floor((1 - Math.log(Math.tan(center[1] * Math.PI / 180) + 1 / Math.cos(center[1] * Math.PI / 180)) / Math.PI) / 2 * Math.pow(2, z2));
60798       var tilemapUrl = dummyUrl.replace(/tile\/[0-9]+\/[0-9]+\/[0-9]+\?blankTile=false/, "tilemap") + "/" + z2 + "/" + y2 + "/" + x2 + "/8/8";
60799       json_default(tilemapUrl).then(function(tilemap) {
60800         if (!tilemap) {
60801           throw new Error("Unknown Error");
60802         }
60803         var hasTiles = true;
60804         for (var i3 = 0; i3 < tilemap.data.length; i3++) {
60805           if (!tilemap.data[i3]) {
60806             hasTiles = false;
60807             break;
60808           }
60809         }
60810         esri.zoomExtent[1] = hasTiles ? 22 : 19;
60811       }).catch(function() {
60812       });
60813     };
60814     esri.getMetadata = function(center, tileCoord, callback) {
60815       if (esri.id !== "EsriWorldImagery") {
60816         return callback(null, {});
60817       }
60818       var tileID = tileCoord.slice(0, 3).join("/");
60819       var zoom = Math.min(tileCoord[2], esri.zoomExtent[1]);
60820       var centerPoint = center[0] + "," + center[1];
60821       var unknown = _t("info_panels.background.unknown");
60822       var vintage = {};
60823       var metadata = {};
60824       if (inflight[tileID]) return;
60825       var url = "https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/4/query";
60826       url += "?returnGeometry=false&geometry=" + centerPoint + "&inSR=4326&geometryType=esriGeometryPoint&outFields=*&f=json";
60827       if (!cache[tileID]) {
60828         cache[tileID] = {};
60829       }
60830       if (cache[tileID] && cache[tileID].metadata) {
60831         return callback(null, cache[tileID].metadata);
60832       }
60833       inflight[tileID] = true;
60834       json_default(url).then(function(result) {
60835         delete inflight[tileID];
60836         result = result.features.map((f2) => f2.attributes).filter((a2) => a2.MinMapLevel <= zoom && a2.MaxMapLevel >= zoom)[0];
60837         if (!result) {
60838           throw new Error("Unknown Error");
60839         } else if (result.features && result.features.length < 1) {
60840           throw new Error("No Results");
60841         } else if (result.error && result.error.message) {
60842           throw new Error(result.error.message);
60843         }
60844         var captureDate = localeDateString(result.SRC_DATE2);
60845         vintage = {
60846           start: captureDate,
60847           end: captureDate,
60848           range: captureDate
60849         };
60850         metadata = {
60851           vintage,
60852           source: clean2(result.NICE_NAME),
60853           description: clean2(result.NICE_DESC),
60854           resolution: clean2(+Number(result.SRC_RES).toFixed(4)),
60855           accuracy: clean2(+Number(result.SRC_ACC).toFixed(4))
60856         };
60857         if (isFinite(metadata.resolution)) {
60858           metadata.resolution += " m";
60859         }
60860         if (isFinite(metadata.accuracy)) {
60861           metadata.accuracy += " m";
60862         }
60863         cache[tileID].metadata = metadata;
60864         if (callback) callback(null, metadata);
60865       }).catch(function(err) {
60866         delete inflight[tileID];
60867         if (callback) callback(err.message);
60868       });
60869       function clean2(val) {
60870         return String(val).trim() || unknown;
60871       }
60872     };
60873     return esri;
60874   };
60875   rendererBackgroundSource.None = function() {
60876     var source = rendererBackgroundSource({ id: "none", template: "" });
60877     source.name = function() {
60878       return _t("background.none");
60879     };
60880     source.label = function() {
60881       return _t.append("background.none");
60882     };
60883     source.imageryUsed = function() {
60884       return null;
60885     };
60886     source.area = function() {
60887       return -1;
60888     };
60889     return source;
60890   };
60891   rendererBackgroundSource.Custom = function(template) {
60892     var source = rendererBackgroundSource({ id: "custom", template });
60893     source.name = function() {
60894       return _t("background.custom");
60895     };
60896     source.label = function() {
60897       return _t.append("background.custom");
60898     };
60899     source.imageryUsed = function() {
60900       var cleaned = source.template();
60901       if (cleaned.indexOf("?") !== -1) {
60902         var parts = cleaned.split("?", 2);
60903         var qs = utilStringQs(parts[1]);
60904         ["access_token", "connectId", "token", "Signature"].forEach(function(param) {
60905           if (qs[param]) {
60906             qs[param] = "{apikey}";
60907           }
60908         });
60909         cleaned = parts[0] + "?" + utilQsString(qs, true);
60910       }
60911       cleaned = cleaned.replace(/token\/(\w+)/, "token/{apikey}").replace(/key=(\w+)/, "key={apikey}");
60912       return "Custom (" + cleaned + " )";
60913     };
60914     source.area = function() {
60915       return -2;
60916     };
60917     return source;
60918   };
60919
60920   // node_modules/@turf/helpers/dist/esm/index.js
60921   var earthRadius = 63710088e-1;
60922   var factors = {
60923     centimeters: earthRadius * 100,
60924     centimetres: earthRadius * 100,
60925     degrees: 360 / (2 * Math.PI),
60926     feet: earthRadius * 3.28084,
60927     inches: earthRadius * 39.37,
60928     kilometers: earthRadius / 1e3,
60929     kilometres: earthRadius / 1e3,
60930     meters: earthRadius,
60931     metres: earthRadius,
60932     miles: earthRadius / 1609.344,
60933     millimeters: earthRadius * 1e3,
60934     millimetres: earthRadius * 1e3,
60935     nauticalmiles: earthRadius / 1852,
60936     radians: 1,
60937     yards: earthRadius * 1.0936
60938   };
60939   function feature2(geom, properties, options2 = {}) {
60940     const feat = { type: "Feature" };
60941     if (options2.id === 0 || options2.id) {
60942       feat.id = options2.id;
60943     }
60944     if (options2.bbox) {
60945       feat.bbox = options2.bbox;
60946     }
60947     feat.properties = properties || {};
60948     feat.geometry = geom;
60949     return feat;
60950   }
60951   function polygon(coordinates, properties, options2 = {}) {
60952     for (const ring of coordinates) {
60953       if (ring.length < 4) {
60954         throw new Error(
60955           "Each LinearRing of a Polygon must have 4 or more Positions."
60956         );
60957       }
60958       if (ring[ring.length - 1].length !== ring[0].length) {
60959         throw new Error("First and last Position are not equivalent.");
60960       }
60961       for (let j2 = 0; j2 < ring[ring.length - 1].length; j2++) {
60962         if (ring[ring.length - 1][j2] !== ring[0][j2]) {
60963           throw new Error("First and last Position are not equivalent.");
60964         }
60965       }
60966     }
60967     const geom = {
60968       type: "Polygon",
60969       coordinates
60970     };
60971     return feature2(geom, properties, options2);
60972   }
60973   function lineString(coordinates, properties, options2 = {}) {
60974     if (coordinates.length < 2) {
60975       throw new Error("coordinates must be an array of two or more positions");
60976     }
60977     const geom = {
60978       type: "LineString",
60979       coordinates
60980     };
60981     return feature2(geom, properties, options2);
60982   }
60983   function multiLineString(coordinates, properties, options2 = {}) {
60984     const geom = {
60985       type: "MultiLineString",
60986       coordinates
60987     };
60988     return feature2(geom, properties, options2);
60989   }
60990   function multiPolygon(coordinates, properties, options2 = {}) {
60991     const geom = {
60992       type: "MultiPolygon",
60993       coordinates
60994     };
60995     return feature2(geom, properties, options2);
60996   }
60997
60998   // node_modules/@turf/invariant/dist/esm/index.js
60999   function getGeom(geojson) {
61000     if (geojson.type === "Feature") {
61001       return geojson.geometry;
61002     }
61003     return geojson;
61004   }
61005
61006   // node_modules/@turf/bbox-clip/dist/esm/index.js
61007   function lineclip(points, bbox2, result) {
61008     var len = points.length, codeA = bitCode(points[0], bbox2), part = [], i3, codeB, lastCode;
61009     let a2;
61010     let b2;
61011     if (!result)
61012       result = [];
61013     for (i3 = 1; i3 < len; i3++) {
61014       a2 = points[i3 - 1];
61015       b2 = points[i3];
61016       codeB = lastCode = bitCode(b2, bbox2);
61017       while (true) {
61018         if (!(codeA | codeB)) {
61019           part.push(a2);
61020           if (codeB !== lastCode) {
61021             part.push(b2);
61022             if (i3 < len - 1) {
61023               result.push(part);
61024               part = [];
61025             }
61026           } else if (i3 === len - 1) {
61027             part.push(b2);
61028           }
61029           break;
61030         } else if (codeA & codeB) {
61031           break;
61032         } else if (codeA) {
61033           a2 = intersect(a2, b2, codeA, bbox2);
61034           codeA = bitCode(a2, bbox2);
61035         } else {
61036           b2 = intersect(a2, b2, codeB, bbox2);
61037           codeB = bitCode(b2, bbox2);
61038         }
61039       }
61040       codeA = lastCode;
61041     }
61042     if (part.length)
61043       result.push(part);
61044     return result;
61045   }
61046   function polygonclip(points, bbox2) {
61047     var result, edge, prev, prevInside, i3, p2, inside;
61048     for (edge = 1; edge <= 8; edge *= 2) {
61049       result = [];
61050       prev = points[points.length - 1];
61051       prevInside = !(bitCode(prev, bbox2) & edge);
61052       for (i3 = 0; i3 < points.length; i3++) {
61053         p2 = points[i3];
61054         inside = !(bitCode(p2, bbox2) & edge);
61055         if (inside !== prevInside)
61056           result.push(intersect(prev, p2, edge, bbox2));
61057         if (inside)
61058           result.push(p2);
61059         prev = p2;
61060         prevInside = inside;
61061       }
61062       points = result;
61063       if (!points.length)
61064         break;
61065     }
61066     return result;
61067   }
61068   function intersect(a2, b2, edge, bbox2) {
61069     return edge & 8 ? [a2[0] + (b2[0] - a2[0]) * (bbox2[3] - a2[1]) / (b2[1] - a2[1]), bbox2[3]] : edge & 4 ? [a2[0] + (b2[0] - a2[0]) * (bbox2[1] - a2[1]) / (b2[1] - a2[1]), bbox2[1]] : edge & 2 ? [bbox2[2], a2[1] + (b2[1] - a2[1]) * (bbox2[2] - a2[0]) / (b2[0] - a2[0])] : edge & 1 ? [bbox2[0], a2[1] + (b2[1] - a2[1]) * (bbox2[0] - a2[0]) / (b2[0] - a2[0])] : null;
61070   }
61071   function bitCode(p2, bbox2) {
61072     var code = 0;
61073     if (p2[0] < bbox2[0])
61074       code |= 1;
61075     else if (p2[0] > bbox2[2])
61076       code |= 2;
61077     if (p2[1] < bbox2[1])
61078       code |= 4;
61079     else if (p2[1] > bbox2[3])
61080       code |= 8;
61081     return code;
61082   }
61083   function bboxClip(feature3, bbox2) {
61084     const geom = getGeom(feature3);
61085     const type2 = geom.type;
61086     const properties = feature3.type === "Feature" ? feature3.properties : {};
61087     let coords = geom.coordinates;
61088     switch (type2) {
61089       case "LineString":
61090       case "MultiLineString": {
61091         const lines = [];
61092         if (type2 === "LineString") {
61093           coords = [coords];
61094         }
61095         coords.forEach((line) => {
61096           lineclip(line, bbox2, lines);
61097         });
61098         if (lines.length === 1) {
61099           return lineString(lines[0], properties);
61100         }
61101         return multiLineString(lines, properties);
61102       }
61103       case "Polygon":
61104         return polygon(clipPolygon(coords, bbox2), properties);
61105       case "MultiPolygon":
61106         return multiPolygon(
61107           coords.map((poly) => {
61108             return clipPolygon(poly, bbox2);
61109           }),
61110           properties
61111         );
61112       default:
61113         throw new Error("geometry " + type2 + " not supported");
61114     }
61115   }
61116   function clipPolygon(rings, bbox2) {
61117     const outRings = [];
61118     for (const ring of rings) {
61119       const clipped = polygonclip(ring, bbox2);
61120       if (clipped.length > 0) {
61121         if (clipped[0][0] !== clipped[clipped.length - 1][0] || clipped[0][1] !== clipped[clipped.length - 1][1]) {
61122           clipped.push(clipped[0]);
61123         }
61124         if (clipped.length >= 4) {
61125           outRings.push(clipped);
61126         }
61127       }
61128     }
61129     return outRings;
61130   }
61131   var turf_bbox_clip_default = bboxClip;
61132
61133   // node_modules/@turf/meta/dist/esm/index.js
61134   function coordEach(geojson, callback, excludeWrapCoord) {
61135     if (geojson === null)
61136       return;
61137     var j2, k2, l2, geometry, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type2 = geojson.type, isFeatureCollection = type2 === "FeatureCollection", isFeature = type2 === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
61138     for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
61139       geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
61140       isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
61141       stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
61142       for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
61143         var multiFeatureIndex = 0;
61144         var geometryIndex = 0;
61145         geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
61146         if (geometry === null)
61147           continue;
61148         coords = geometry.coordinates;
61149         var geomType = geometry.type;
61150         wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
61151         switch (geomType) {
61152           case null:
61153             break;
61154           case "Point":
61155             if (callback(
61156               coords,
61157               coordIndex,
61158               featureIndex,
61159               multiFeatureIndex,
61160               geometryIndex
61161             ) === false)
61162               return false;
61163             coordIndex++;
61164             multiFeatureIndex++;
61165             break;
61166           case "LineString":
61167           case "MultiPoint":
61168             for (j2 = 0; j2 < coords.length; j2++) {
61169               if (callback(
61170                 coords[j2],
61171                 coordIndex,
61172                 featureIndex,
61173                 multiFeatureIndex,
61174                 geometryIndex
61175               ) === false)
61176                 return false;
61177               coordIndex++;
61178               if (geomType === "MultiPoint")
61179                 multiFeatureIndex++;
61180             }
61181             if (geomType === "LineString")
61182               multiFeatureIndex++;
61183             break;
61184           case "Polygon":
61185           case "MultiLineString":
61186             for (j2 = 0; j2 < coords.length; j2++) {
61187               for (k2 = 0; k2 < coords[j2].length - wrapShrink; k2++) {
61188                 if (callback(
61189                   coords[j2][k2],
61190                   coordIndex,
61191                   featureIndex,
61192                   multiFeatureIndex,
61193                   geometryIndex
61194                 ) === false)
61195                   return false;
61196                 coordIndex++;
61197               }
61198               if (geomType === "MultiLineString")
61199                 multiFeatureIndex++;
61200               if (geomType === "Polygon")
61201                 geometryIndex++;
61202             }
61203             if (geomType === "Polygon")
61204               multiFeatureIndex++;
61205             break;
61206           case "MultiPolygon":
61207             for (j2 = 0; j2 < coords.length; j2++) {
61208               geometryIndex = 0;
61209               for (k2 = 0; k2 < coords[j2].length; k2++) {
61210                 for (l2 = 0; l2 < coords[j2][k2].length - wrapShrink; l2++) {
61211                   if (callback(
61212                     coords[j2][k2][l2],
61213                     coordIndex,
61214                     featureIndex,
61215                     multiFeatureIndex,
61216                     geometryIndex
61217                   ) === false)
61218                     return false;
61219                   coordIndex++;
61220                 }
61221                 geometryIndex++;
61222               }
61223               multiFeatureIndex++;
61224             }
61225             break;
61226           case "GeometryCollection":
61227             for (j2 = 0; j2 < geometry.geometries.length; j2++)
61228               if (coordEach(geometry.geometries[j2], callback, excludeWrapCoord) === false)
61229                 return false;
61230             break;
61231           default:
61232             throw new Error("Unknown Geometry Type");
61233         }
61234       }
61235     }
61236   }
61237
61238   // node_modules/@turf/bbox/dist/esm/index.js
61239   function bbox(geojson, options2 = {}) {
61240     if (geojson.bbox != null && true !== options2.recompute) {
61241       return geojson.bbox;
61242     }
61243     const result = [Infinity, Infinity, -Infinity, -Infinity];
61244     coordEach(geojson, (coord2) => {
61245       if (result[0] > coord2[0]) {
61246         result[0] = coord2[0];
61247       }
61248       if (result[1] > coord2[1]) {
61249         result[1] = coord2[1];
61250       }
61251       if (result[2] < coord2[0]) {
61252         result[2] = coord2[0];
61253       }
61254       if (result[3] < coord2[1]) {
61255         result[3] = coord2[1];
61256       }
61257     });
61258     return result;
61259   }
61260   var turf_bbox_default = bbox;
61261
61262   // modules/renderer/background.js
61263   var import_which_polygon3 = __toESM(require_which_polygon());
61264
61265   // modules/renderer/tile_layer.js
61266   function rendererTileLayer(context) {
61267     var transformProp = utilPrefixCSSProperty("Transform");
61268     var tiler8 = utilTiler();
61269     var _tileSize = 256;
61270     var _projection;
61271     var _cache5 = {};
61272     var _tileOrigin;
61273     var _zoom;
61274     var _source;
61275     function tileSizeAtZoom(d2, z2) {
61276       var EPSILON = 2e-3;
61277       return _tileSize * Math.pow(2, z2 - d2[2]) / _tileSize + EPSILON;
61278     }
61279     function atZoom(t2, distance) {
61280       var power = Math.pow(2, distance);
61281       return [
61282         Math.floor(t2[0] * power),
61283         Math.floor(t2[1] * power),
61284         t2[2] + distance
61285       ];
61286     }
61287     function lookUp(d2) {
61288       for (var up = -1; up > -d2[2]; up--) {
61289         var tile = atZoom(d2, up);
61290         if (_cache5[_source.url(tile)] !== false) {
61291           return tile;
61292         }
61293       }
61294     }
61295     function uniqueBy(a2, n3) {
61296       var o2 = [];
61297       var seen = {};
61298       for (var i3 = 0; i3 < a2.length; i3++) {
61299         if (seen[a2[i3][n3]] === void 0) {
61300           o2.push(a2[i3]);
61301           seen[a2[i3][n3]] = true;
61302         }
61303       }
61304       return o2;
61305     }
61306     function addSource(d2) {
61307       d2.push(_source.url(d2));
61308       return d2;
61309     }
61310     function background(selection2) {
61311       _zoom = geoScaleToZoom(_projection.scale(), _tileSize);
61312       var pixelOffset;
61313       if (_source) {
61314         pixelOffset = [
61315           _source.offset()[0] * Math.pow(2, _zoom),
61316           _source.offset()[1] * Math.pow(2, _zoom)
61317         ];
61318       } else {
61319         pixelOffset = [0, 0];
61320       }
61321       var translate = [
61322         _projection.translate()[0] + pixelOffset[0],
61323         _projection.translate()[1] + pixelOffset[1]
61324       ];
61325       tiler8.scale(_projection.scale() * 2 * Math.PI).translate(translate);
61326       _tileOrigin = [
61327         _projection.scale() * Math.PI - translate[0],
61328         _projection.scale() * Math.PI - translate[1]
61329       ];
61330       render(selection2);
61331     }
61332     function render(selection2) {
61333       if (!_source) return;
61334       var requests = [];
61335       var showDebug = context.getDebug("tile") && !_source.overlay;
61336       if (_source.validZoom(_zoom)) {
61337         tiler8.skipNullIsland(!!_source.overlay);
61338         tiler8().forEach(function(d2) {
61339           addSource(d2);
61340           if (d2[3] === "") return;
61341           if (typeof d2[3] !== "string") return;
61342           requests.push(d2);
61343           if (_cache5[d2[3]] === false && lookUp(d2)) {
61344             requests.push(addSource(lookUp(d2)));
61345           }
61346         });
61347         requests = uniqueBy(requests, 3).filter(function(r2) {
61348           return _cache5[r2[3]] !== false;
61349         });
61350       }
61351       function load(d3_event, d2) {
61352         _cache5[d2[3]] = true;
61353         select_default2(this).on("error", null).on("load", null).classed("tile-loaded", true);
61354         render(selection2);
61355       }
61356       function error(d3_event, d2) {
61357         _cache5[d2[3]] = false;
61358         select_default2(this).on("error", null).on("load", null).remove();
61359         render(selection2);
61360       }
61361       function imageTransform(d2) {
61362         var ts = _tileSize * Math.pow(2, _zoom - d2[2]);
61363         var scale = tileSizeAtZoom(d2, _zoom);
61364         return "translate(" + (d2[0] * ts - _tileOrigin[0]) + "px," + (d2[1] * ts - _tileOrigin[1]) + "px) scale(" + scale + "," + scale + ")";
61365       }
61366       function tileCenter(d2) {
61367         var ts = _tileSize * Math.pow(2, _zoom - d2[2]);
61368         return [
61369           d2[0] * ts - _tileOrigin[0] + ts / 2,
61370           d2[1] * ts - _tileOrigin[1] + ts / 2
61371         ];
61372       }
61373       function debugTransform(d2) {
61374         var coord2 = tileCenter(d2);
61375         return "translate(" + coord2[0] + "px," + coord2[1] + "px)";
61376       }
61377       var dims = tiler8.size();
61378       var mapCenter = [dims[0] / 2, dims[1] / 2];
61379       var minDist = Math.max(dims[0], dims[1]);
61380       var nearCenter;
61381       requests.forEach(function(d2) {
61382         var c2 = tileCenter(d2);
61383         var dist = geoVecLength(c2, mapCenter);
61384         if (dist < minDist) {
61385           minDist = dist;
61386           nearCenter = d2;
61387         }
61388       });
61389       var image = selection2.selectAll("img").data(requests, function(d2) {
61390         return d2[3];
61391       });
61392       image.exit().style(transformProp, imageTransform).classed("tile-removing", true).classed("tile-center", false).each(function() {
61393         var tile = select_default2(this);
61394         window.setTimeout(function() {
61395           if (tile.classed("tile-removing")) {
61396             tile.remove();
61397           }
61398         }, 300);
61399       });
61400       image.enter().append("img").attr("class", "tile").attr("alt", "").attr("draggable", "false").style("width", _tileSize + "px").style("height", _tileSize + "px").attr("src", function(d2) {
61401         return d2[3];
61402       }).on("error", error).on("load", load).merge(image).style(transformProp, imageTransform).classed("tile-debug", showDebug).classed("tile-removing", false).classed("tile-center", function(d2) {
61403         return d2 === nearCenter;
61404       });
61405       var debug2 = selection2.selectAll(".tile-label-debug").data(showDebug ? requests : [], function(d2) {
61406         return d2[3];
61407       });
61408       debug2.exit().remove();
61409       if (showDebug) {
61410         var debugEnter = debug2.enter().append("div").attr("class", "tile-label-debug");
61411         debugEnter.append("div").attr("class", "tile-label-debug-coord");
61412         debugEnter.append("div").attr("class", "tile-label-debug-vintage");
61413         debug2 = debug2.merge(debugEnter);
61414         debug2.style(transformProp, debugTransform);
61415         debug2.selectAll(".tile-label-debug-coord").text(function(d2) {
61416           return d2[2] + " / " + d2[0] + " / " + d2[1];
61417         });
61418         debug2.selectAll(".tile-label-debug-vintage").each(function(d2) {
61419           var span = select_default2(this);
61420           var center = context.projection.invert(tileCenter(d2));
61421           _source.getMetadata(center, d2, function(err, result) {
61422             if (result && result.vintage && result.vintage.range) {
61423               span.text(result.vintage.range);
61424             } else {
61425               span.text("");
61426               span.call(_t.append("info_panels.background.vintage"));
61427               span.append("span").text(": ");
61428               span.call(_t.append("info_panels.background.unknown"));
61429             }
61430           });
61431         });
61432       }
61433     }
61434     background.projection = function(val) {
61435       if (!arguments.length) return _projection;
61436       _projection = val;
61437       return background;
61438     };
61439     background.dimensions = function(val) {
61440       if (!arguments.length) return tiler8.size();
61441       tiler8.size(val);
61442       return background;
61443     };
61444     background.source = function(val) {
61445       if (!arguments.length) return _source;
61446       _source = val;
61447       _tileSize = _source.tileSize;
61448       _cache5 = {};
61449       tiler8.tileSize(_source.tileSize).zoomExtent(_source.zoomExtent);
61450       return background;
61451     };
61452     return background;
61453   }
61454
61455   // modules/renderer/background.js
61456   var _imageryIndex = null;
61457   function rendererBackground(context) {
61458     const dispatch14 = dispatch_default("change");
61459     const baseLayer = rendererTileLayer(context).projection(context.projection);
61460     let _checkedBlocklists = [];
61461     let _isValid = true;
61462     let _overlayLayers = [];
61463     let _brightness = 1;
61464     let _contrast = 1;
61465     let _saturation = 1;
61466     let _sharpness = 1;
61467     function ensureImageryIndex() {
61468       return _mainFileFetcher.get("imagery").then((sources) => {
61469         if (_imageryIndex) return _imageryIndex;
61470         _imageryIndex = {
61471           imagery: sources,
61472           features: {}
61473         };
61474         const features = sources.map((source) => {
61475           if (!source.polygon) return null;
61476           const rings = source.polygon.map((ring) => [ring]);
61477           const feature3 = {
61478             type: "Feature",
61479             properties: { id: source.id },
61480             geometry: { type: "MultiPolygon", coordinates: rings }
61481           };
61482           _imageryIndex.features[source.id] = feature3;
61483           return feature3;
61484         }).filter(Boolean);
61485         _imageryIndex.query = (0, import_which_polygon3.default)({ type: "FeatureCollection", features });
61486         _imageryIndex.backgrounds = sources.map((source) => {
61487           if (source.type === "bing") {
61488             return rendererBackgroundSource.Bing(source, dispatch14);
61489           } else if (/^EsriWorldImagery/.test(source.id)) {
61490             return rendererBackgroundSource.Esri(source);
61491           } else {
61492             return rendererBackgroundSource(source);
61493           }
61494         });
61495         _imageryIndex.backgrounds.unshift(rendererBackgroundSource.None());
61496         let template = corePreferences("background-custom-template") || "";
61497         const custom = rendererBackgroundSource.Custom(template);
61498         _imageryIndex.backgrounds.unshift(custom);
61499         return _imageryIndex;
61500       });
61501     }
61502     function background(selection2) {
61503       const currSource = baseLayer.source();
61504       if (context.map().zoom() > 18) {
61505         if (currSource && /^EsriWorldImagery/.test(currSource.id)) {
61506           const center = context.map().center();
61507           currSource.fetchTilemap(center);
61508         }
61509       }
61510       const sources = background.sources(context.map().extent());
61511       const wasValid = _isValid;
61512       _isValid = !!sources.filter((d2) => d2 === currSource).length;
61513       if (wasValid !== _isValid) {
61514         background.updateImagery();
61515       }
61516       let baseFilter = "";
61517       if (_brightness !== 1) {
61518         baseFilter += " brightness(".concat(_brightness, ")");
61519       }
61520       if (_contrast !== 1) {
61521         baseFilter += " contrast(".concat(_contrast, ")");
61522       }
61523       if (_saturation !== 1) {
61524         baseFilter += " saturate(".concat(_saturation, ")");
61525       }
61526       if (_sharpness < 1) {
61527         const blur = number_default(0.5, 5)(1 - _sharpness);
61528         baseFilter += " blur(".concat(blur, "px)");
61529       }
61530       let base = selection2.selectAll(".layer-background").data([0]);
61531       base = base.enter().insert("div", ".layer-data").attr("class", "layer layer-background").merge(base);
61532       base.style("filter", baseFilter || null);
61533       let imagery = base.selectAll(".layer-imagery").data([0]);
61534       imagery.enter().append("div").attr("class", "layer layer-imagery").merge(imagery).call(baseLayer);
61535       let maskFilter = "";
61536       let mixBlendMode = "";
61537       if (_sharpness > 1) {
61538         mixBlendMode = "overlay";
61539         maskFilter = "saturate(0) blur(3px) invert(1)";
61540         let contrast = _sharpness - 1;
61541         maskFilter += " contrast(".concat(contrast, ")");
61542         let brightness = number_default(1, 0.85)(_sharpness - 1);
61543         maskFilter += " brightness(".concat(brightness, ")");
61544       }
61545       let mask = base.selectAll(".layer-unsharp-mask").data(_sharpness > 1 ? [0] : []);
61546       mask.exit().remove();
61547       mask.enter().append("div").attr("class", "layer layer-mask layer-unsharp-mask").merge(mask).call(baseLayer).style("filter", maskFilter || null).style("mix-blend-mode", mixBlendMode || null);
61548       let overlays = selection2.selectAll(".layer-overlay").data(_overlayLayers, (d2) => d2.source().name());
61549       overlays.exit().remove();
61550       overlays.enter().insert("div", ".layer-data").attr("class", "layer layer-overlay").merge(overlays).each((layer, i3, nodes) => select_default2(nodes[i3]).call(layer));
61551     }
61552     background.updateImagery = function() {
61553       let currSource = baseLayer.source();
61554       if (context.inIntro() || !currSource) return;
61555       let o2 = _overlayLayers.filter((d2) => !d2.source().isLocatorOverlay() && !d2.source().isHidden()).map((d2) => d2.source().id).join(",");
61556       const meters = geoOffsetToMeters(currSource.offset());
61557       const EPSILON = 0.01;
61558       const x2 = +meters[0].toFixed(2);
61559       const y2 = +meters[1].toFixed(2);
61560       let hash = utilStringQs(window.location.hash);
61561       let id2 = currSource.id;
61562       if (id2 === "custom") {
61563         id2 = "custom:".concat(currSource.template());
61564       }
61565       if (id2) {
61566         hash.background = id2;
61567       } else {
61568         delete hash.background;
61569       }
61570       if (o2) {
61571         hash.overlays = o2;
61572       } else {
61573         delete hash.overlays;
61574       }
61575       if (Math.abs(x2) > EPSILON || Math.abs(y2) > EPSILON) {
61576         hash.offset = "".concat(x2, ",").concat(y2);
61577       } else {
61578         delete hash.offset;
61579       }
61580       if (!window.mocha) {
61581         window.location.replace("#" + utilQsString(hash, true));
61582       }
61583       let imageryUsed = [];
61584       let photoOverlaysUsed = [];
61585       const currUsed = currSource.imageryUsed();
61586       if (currUsed && _isValid) {
61587         imageryUsed.push(currUsed);
61588       }
61589       _overlayLayers.filter((d2) => !d2.source().isLocatorOverlay() && !d2.source().isHidden()).forEach((d2) => imageryUsed.push(d2.source().imageryUsed()));
61590       const dataLayer = context.layers().layer("data");
61591       if (dataLayer && dataLayer.enabled() && dataLayer.hasData()) {
61592         imageryUsed.push(dataLayer.getSrc());
61593       }
61594       const photoOverlayLayers = {
61595         streetside: "Bing Streetside",
61596         mapillary: "Mapillary Images",
61597         "mapillary-map-features": "Mapillary Map Features",
61598         "mapillary-signs": "Mapillary Signs",
61599         kartaview: "KartaView Images",
61600         vegbilder: "Norwegian Road Administration Images",
61601         mapilio: "Mapilio Images",
61602         panoramax: "Panoramax Images"
61603       };
61604       for (let layerID in photoOverlayLayers) {
61605         const layer = context.layers().layer(layerID);
61606         if (layer && layer.enabled()) {
61607           photoOverlaysUsed.push(layerID);
61608           imageryUsed.push(photoOverlayLayers[layerID]);
61609         }
61610       }
61611       context.history().imageryUsed(imageryUsed);
61612       context.history().photoOverlaysUsed(photoOverlaysUsed);
61613     };
61614     background.sources = (extent, zoom, includeCurrent) => {
61615       if (!_imageryIndex) return [];
61616       let visible = {};
61617       (_imageryIndex.query.bbox(extent.rectangle(), true) || []).forEach((d2) => visible[d2.id] = true);
61618       const currSource = baseLayer.source();
61619       const osm = context.connection();
61620       const blocklists = osm && osm.imageryBlocklists() || [];
61621       const blocklistChanged = blocklists.length !== _checkedBlocklists.length || blocklists.some((regex, index) => String(regex) !== _checkedBlocklists[index]);
61622       if (blocklistChanged) {
61623         _imageryIndex.backgrounds.forEach((source) => {
61624           source.isBlocked = blocklists.some((regex) => regex.test(source.template()));
61625         });
61626         _checkedBlocklists = blocklists.map((regex) => String(regex));
61627       }
61628       return _imageryIndex.backgrounds.filter((source) => {
61629         if (includeCurrent && currSource === source) return true;
61630         if (source.isBlocked) return false;
61631         if (!source.polygon) return true;
61632         if (zoom && zoom < 6) return false;
61633         return visible[source.id];
61634       });
61635     };
61636     background.dimensions = (val) => {
61637       if (!val) return;
61638       baseLayer.dimensions(val);
61639       _overlayLayers.forEach((layer) => layer.dimensions(val));
61640     };
61641     background.baseLayerSource = function(d2) {
61642       if (!arguments.length) return baseLayer.source();
61643       const osm = context.connection();
61644       if (!osm) return background;
61645       const blocklists = osm.imageryBlocklists();
61646       const template = d2.template();
61647       let fail = false;
61648       let tested = 0;
61649       let regex;
61650       for (let i3 = 0; i3 < blocklists.length; i3++) {
61651         regex = blocklists[i3];
61652         fail = regex.test(template);
61653         tested++;
61654         if (fail) break;
61655       }
61656       if (!tested) {
61657         regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
61658         fail = regex.test(template);
61659       }
61660       baseLayer.source(!fail ? d2 : background.findSource("none"));
61661       dispatch14.call("change");
61662       background.updateImagery();
61663       return background;
61664     };
61665     background.findSource = (id2) => {
61666       if (!id2 || !_imageryIndex) return null;
61667       return _imageryIndex.backgrounds.find((d2) => d2.id && d2.id === id2);
61668     };
61669     background.bing = () => {
61670       background.baseLayerSource(background.findSource("Bing"));
61671     };
61672     background.showsLayer = (d2) => {
61673       const currSource = baseLayer.source();
61674       if (!d2 || !currSource) return false;
61675       return d2.id === currSource.id || _overlayLayers.some((layer) => d2.id === layer.source().id);
61676     };
61677     background.overlayLayerSources = () => {
61678       return _overlayLayers.map((layer) => layer.source());
61679     };
61680     background.toggleOverlayLayer = (d2) => {
61681       let layer;
61682       for (let i3 = 0; i3 < _overlayLayers.length; i3++) {
61683         layer = _overlayLayers[i3];
61684         if (layer.source() === d2) {
61685           _overlayLayers.splice(i3, 1);
61686           dispatch14.call("change");
61687           background.updateImagery();
61688           return;
61689         }
61690       }
61691       layer = rendererTileLayer(context).source(d2).projection(context.projection).dimensions(
61692         baseLayer.dimensions()
61693       );
61694       _overlayLayers.push(layer);
61695       dispatch14.call("change");
61696       background.updateImagery();
61697     };
61698     background.nudge = (d2, zoom) => {
61699       const currSource = baseLayer.source();
61700       if (currSource) {
61701         currSource.nudge(d2, zoom);
61702         dispatch14.call("change");
61703         background.updateImagery();
61704       }
61705       return background;
61706     };
61707     background.offset = function(d2) {
61708       const currSource = baseLayer.source();
61709       if (!arguments.length) {
61710         return currSource && currSource.offset() || [0, 0];
61711       }
61712       if (currSource) {
61713         currSource.offset(d2);
61714         dispatch14.call("change");
61715         background.updateImagery();
61716       }
61717       return background;
61718     };
61719     background.brightness = function(d2) {
61720       if (!arguments.length) return _brightness;
61721       _brightness = d2;
61722       if (context.mode()) dispatch14.call("change");
61723       return background;
61724     };
61725     background.contrast = function(d2) {
61726       if (!arguments.length) return _contrast;
61727       _contrast = d2;
61728       if (context.mode()) dispatch14.call("change");
61729       return background;
61730     };
61731     background.saturation = function(d2) {
61732       if (!arguments.length) return _saturation;
61733       _saturation = d2;
61734       if (context.mode()) dispatch14.call("change");
61735       return background;
61736     };
61737     background.sharpness = function(d2) {
61738       if (!arguments.length) return _sharpness;
61739       _sharpness = d2;
61740       if (context.mode()) dispatch14.call("change");
61741       return background;
61742     };
61743     let _loadPromise;
61744     background.ensureLoaded = () => {
61745       if (_loadPromise) return _loadPromise;
61746       return _loadPromise = ensureImageryIndex();
61747     };
61748     background.init = () => {
61749       const loadPromise = background.ensureLoaded();
61750       const hash = utilStringQs(window.location.hash);
61751       const requestedBackground = hash.background || hash.layer;
61752       const lastUsedBackground = corePreferences("background-last-used");
61753       return loadPromise.then((imageryIndex) => {
61754         const extent = context.map().extent();
61755         const validBackgrounds = background.sources(extent).filter((d2) => d2.id !== "none" && d2.id !== "custom");
61756         const first = validBackgrounds.length && validBackgrounds[0];
61757         const isLastUsedValid = !!validBackgrounds.find((d2) => d2.id && d2.id === lastUsedBackground);
61758         let best;
61759         if (!requestedBackground && extent) {
61760           const viewArea = extent.area();
61761           best = validBackgrounds.find((s2) => {
61762             if (!s2.best() || s2.overlay) return false;
61763             let bbox2 = turf_bbox_default(turf_bbox_clip_default(
61764               { type: "MultiPolygon", coordinates: [s2.polygon || [extent.polygon()]] },
61765               extent.rectangle()
61766             ));
61767             let area = geoExtent(bbox2.slice(0, 2), bbox2.slice(2, 4)).area();
61768             return area / viewArea > 0.5;
61769           });
61770         }
61771         if (requestedBackground && requestedBackground.indexOf("custom:") === 0) {
61772           const template = requestedBackground.replace(/^custom:/, "");
61773           const custom = background.findSource("custom");
61774           background.baseLayerSource(custom.template(template));
61775           corePreferences("background-custom-template", template);
61776         } else {
61777           background.baseLayerSource(
61778             background.findSource(requestedBackground) || best || isLastUsedValid && background.findSource(lastUsedBackground) || background.findSource("Bing") || first || background.findSource("none")
61779           );
61780         }
61781         const locator = imageryIndex.backgrounds.find((d2) => d2.overlay && d2.default);
61782         if (locator) {
61783           background.toggleOverlayLayer(locator);
61784         }
61785         const overlays = (hash.overlays || "").split(",");
61786         overlays.forEach((overlay) => {
61787           overlay = background.findSource(overlay);
61788           if (overlay) {
61789             background.toggleOverlayLayer(overlay);
61790           }
61791         });
61792         if (hash.gpx) {
61793           const gpx2 = context.layers().layer("data");
61794           if (gpx2) {
61795             gpx2.url(hash.gpx, ".gpx");
61796           }
61797         }
61798         if (hash.offset) {
61799           const offset = hash.offset.replace(/;/g, ",").split(",").map((n3) => !isNaN(n3) && n3);
61800           if (offset.length === 2) {
61801             background.offset(geoMetersToOffset(offset));
61802           }
61803         }
61804       }).catch((err) => {
61805         console.error(err);
61806       });
61807     };
61808     return utilRebind(background, dispatch14, "on");
61809   }
61810
61811   // modules/renderer/features.js
61812   function rendererFeatures(context) {
61813     var dispatch14 = dispatch_default("change", "redraw");
61814     var features = utilRebind({}, dispatch14, "on");
61815     var _deferred2 = /* @__PURE__ */ new Set();
61816     var traffic_roads = {
61817       "motorway": true,
61818       "motorway_link": true,
61819       "trunk": true,
61820       "trunk_link": true,
61821       "primary": true,
61822       "primary_link": true,
61823       "secondary": true,
61824       "secondary_link": true,
61825       "tertiary": true,
61826       "tertiary_link": true,
61827       "residential": true,
61828       "unclassified": true,
61829       "living_street": true,
61830       "busway": true
61831     };
61832     var service_roads = {
61833       "service": true,
61834       "road": true,
61835       "track": true
61836     };
61837     var paths = {
61838       "path": true,
61839       "footway": true,
61840       "cycleway": true,
61841       "bridleway": true,
61842       "steps": true,
61843       "ladder": true,
61844       "pedestrian": true
61845     };
61846     var _cullFactor = 1;
61847     var _cache5 = {};
61848     var _rules = {};
61849     var _stats = {};
61850     var _keys = [];
61851     var _hidden = [];
61852     var _forceVisible = {};
61853     function update() {
61854       if (!window.mocha) {
61855         var hash = utilStringQs(window.location.hash);
61856         var disabled = features.disabled();
61857         if (disabled.length) {
61858           hash.disable_features = disabled.join(",");
61859         } else {
61860           delete hash.disable_features;
61861         }
61862         window.location.replace("#" + utilQsString(hash, true));
61863         corePreferences("disabled-features", disabled.join(","));
61864       }
61865       _hidden = features.hidden();
61866       dispatch14.call("change");
61867       dispatch14.call("redraw");
61868     }
61869     function defineRule(k2, filter2, max3) {
61870       var isEnabled = true;
61871       _keys.push(k2);
61872       _rules[k2] = {
61873         filter: filter2,
61874         enabled: isEnabled,
61875         // whether the user wants it enabled..
61876         count: 0,
61877         currentMax: max3 || Infinity,
61878         defaultMax: max3 || Infinity,
61879         enable: function() {
61880           this.enabled = true;
61881           this.currentMax = this.defaultMax;
61882         },
61883         disable: function() {
61884           this.enabled = false;
61885           this.currentMax = 0;
61886         },
61887         hidden: function() {
61888           return this.count === 0 && !this.enabled || this.count > this.currentMax * _cullFactor;
61889         },
61890         autoHidden: function() {
61891           return this.hidden() && this.currentMax > 0;
61892         }
61893       };
61894     }
61895     defineRule("points", function isPoint(tags, geometry) {
61896       return geometry === "point";
61897     }, 200);
61898     defineRule("traffic_roads", function isTrafficRoad(tags) {
61899       return traffic_roads[tags.highway];
61900     });
61901     defineRule("service_roads", function isServiceRoad(tags) {
61902       return service_roads[tags.highway];
61903     });
61904     defineRule("paths", function isPath(tags) {
61905       return paths[tags.highway];
61906     });
61907     defineRule("buildings", function isBuilding(tags) {
61908       return !!tags.building && tags.building !== "no" || tags.parking === "multi-storey" || tags.parking === "sheds" || tags.parking === "carports" || tags.parking === "garage_boxes";
61909     }, 250);
61910     defineRule("building_parts", function isBuildingPart(tags) {
61911       return !!tags["building:part"];
61912     });
61913     defineRule("indoor", function isIndoor(tags) {
61914       return !!tags.indoor;
61915     });
61916     defineRule("landuse", function isLanduse(tags, geometry) {
61917       return geometry === "area" && (!!tags.landuse || !!tags.natural || !!tags.leisure || !!tags.amenity) && !_rules.buildings.filter(tags) && !_rules.building_parts.filter(tags) && !_rules.indoor.filter(tags) && !_rules.water.filter(tags) && !_rules.pistes.filter(tags);
61918     });
61919     defineRule("boundaries", function isBoundary(tags, geometry) {
61920       return (geometry === "line" && !!tags.boundary || geometry === "relation" && tags.type === "boundary") && !(traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway] || tags.waterway || tags.railway || tags.landuse || tags.natural || tags.building || tags.power);
61921     });
61922     defineRule("water", function isWater(tags) {
61923       return !!tags.waterway || tags.natural === "water" || tags.natural === "coastline" || tags.natural === "bay" || tags.landuse === "pond" || tags.landuse === "basin" || tags.landuse === "reservoir" || tags.landuse === "salt_pond";
61924     });
61925     defineRule("rail", function isRail(tags) {
61926       return (!!tags.railway || tags.landuse === "railway") && !(traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]);
61927     });
61928     defineRule("pistes", function isPiste(tags) {
61929       return tags["piste:type"];
61930     });
61931     defineRule("aerialways", function isAerialways(tags) {
61932       return !!(tags == null ? void 0 : tags.aerialway) && tags.aerialway !== "yes" && tags.aerialway !== "station";
61933     });
61934     defineRule("power", function isPower(tags) {
61935       return !!tags.power;
61936     });
61937     defineRule("past_future", function isPastFuture(tags) {
61938       if (traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]) {
61939         return false;
61940       }
61941       const keys2 = Object.keys(tags);
61942       for (let i3 = 0; i3 < keys2.length; i3++) {
61943         const key = keys2[i3];
61944         const s2 = key.split(":")[0];
61945         if (osmLifecyclePrefixes[s2] || osmLifecyclePrefixes[tags[key]]) return true;
61946       }
61947       return false;
61948     });
61949     defineRule("others", function isOther(tags, geometry) {
61950       return geometry === "line" || geometry === "area";
61951     });
61952     features.features = function() {
61953       return _rules;
61954     };
61955     features.keys = function() {
61956       return _keys;
61957     };
61958     features.enabled = function(k2) {
61959       if (!arguments.length) {
61960         return _keys.filter(function(k3) {
61961           return _rules[k3].enabled;
61962         });
61963       }
61964       return _rules[k2] && _rules[k2].enabled;
61965     };
61966     features.disabled = function(k2) {
61967       if (!arguments.length) {
61968         return _keys.filter(function(k3) {
61969           return !_rules[k3].enabled;
61970         });
61971       }
61972       return _rules[k2] && !_rules[k2].enabled;
61973     };
61974     features.hidden = function(k2) {
61975       var _a3;
61976       if (!arguments.length) {
61977         return _keys.filter(function(k3) {
61978           return _rules[k3].hidden();
61979         });
61980       }
61981       return (_a3 = _rules[k2]) == null ? void 0 : _a3.hidden();
61982     };
61983     features.autoHidden = function(k2) {
61984       if (!arguments.length) {
61985         return _keys.filter(function(k3) {
61986           return _rules[k3].autoHidden();
61987         });
61988       }
61989       return _rules[k2] && _rules[k2].autoHidden();
61990     };
61991     features.enable = function(k2) {
61992       if (_rules[k2] && !_rules[k2].enabled) {
61993         _rules[k2].enable();
61994         update();
61995       }
61996     };
61997     features.enableAll = function() {
61998       var didEnable = false;
61999       for (var k2 in _rules) {
62000         if (!_rules[k2].enabled) {
62001           didEnable = true;
62002           _rules[k2].enable();
62003         }
62004       }
62005       if (didEnable) update();
62006     };
62007     features.disable = function(k2) {
62008       if (_rules[k2] && _rules[k2].enabled) {
62009         _rules[k2].disable();
62010         update();
62011       }
62012     };
62013     features.disableAll = function() {
62014       var didDisable = false;
62015       for (var k2 in _rules) {
62016         if (_rules[k2].enabled) {
62017           didDisable = true;
62018           _rules[k2].disable();
62019         }
62020       }
62021       if (didDisable) update();
62022     };
62023     features.toggle = function(k2) {
62024       if (_rules[k2]) {
62025         (function(f2) {
62026           return f2.enabled ? f2.disable() : f2.enable();
62027         })(_rules[k2]);
62028         update();
62029       }
62030     };
62031     features.resetStats = function() {
62032       for (var i3 = 0; i3 < _keys.length; i3++) {
62033         _rules[_keys[i3]].count = 0;
62034       }
62035       dispatch14.call("change");
62036     };
62037     features.gatherStats = function(d2, resolver, dimensions) {
62038       var needsRedraw = false;
62039       var types = utilArrayGroupBy(d2, "type");
62040       var entities = [].concat(types.relation || [], types.way || [], types.node || []);
62041       var currHidden, geometry, matches, i3, j2;
62042       for (i3 = 0; i3 < _keys.length; i3++) {
62043         _rules[_keys[i3]].count = 0;
62044       }
62045       _cullFactor = dimensions[0] * dimensions[1] / 1e6;
62046       for (i3 = 0; i3 < entities.length; i3++) {
62047         geometry = entities[i3].geometry(resolver);
62048         matches = Object.keys(features.getMatches(entities[i3], resolver, geometry));
62049         for (j2 = 0; j2 < matches.length; j2++) {
62050           _rules[matches[j2]].count++;
62051         }
62052       }
62053       currHidden = features.hidden();
62054       if (currHidden !== _hidden) {
62055         _hidden = currHidden;
62056         needsRedraw = true;
62057         dispatch14.call("change");
62058       }
62059       return needsRedraw;
62060     };
62061     features.stats = function() {
62062       for (var i3 = 0; i3 < _keys.length; i3++) {
62063         _stats[_keys[i3]] = _rules[_keys[i3]].count;
62064       }
62065       return _stats;
62066     };
62067     features.clear = function(d2) {
62068       for (var i3 = 0; i3 < d2.length; i3++) {
62069         features.clearEntity(d2[i3]);
62070       }
62071     };
62072     features.clearEntity = function(entity) {
62073       delete _cache5[osmEntity.key(entity)];
62074     };
62075     features.reset = function() {
62076       Array.from(_deferred2).forEach(function(handle) {
62077         window.cancelIdleCallback(handle);
62078         _deferred2.delete(handle);
62079       });
62080       _cache5 = {};
62081     };
62082     function relationShouldBeChecked(relation) {
62083       return relation.tags.type === "boundary";
62084     }
62085     features.getMatches = function(entity, resolver, geometry) {
62086       if (geometry === "vertex" || geometry === "relation" && !relationShouldBeChecked(entity)) return {};
62087       var ent = osmEntity.key(entity);
62088       if (!_cache5[ent]) {
62089         _cache5[ent] = {};
62090       }
62091       if (!_cache5[ent].matches) {
62092         var matches = {};
62093         var hasMatch = false;
62094         for (var i3 = 0; i3 < _keys.length; i3++) {
62095           if (_keys[i3] === "others") {
62096             if (hasMatch) continue;
62097             if (entity.type === "way") {
62098               var parents = features.getParents(entity, resolver, geometry);
62099               if (parents.length === 1 && parents[0].isMultipolygon() || // 2b. or belongs only to boundary relations
62100               parents.length > 0 && parents.every(function(parent) {
62101                 return parent.tags.type === "boundary";
62102               })) {
62103                 var pkey = osmEntity.key(parents[0]);
62104                 if (_cache5[pkey] && _cache5[pkey].matches) {
62105                   matches = Object.assign({}, _cache5[pkey].matches);
62106                   continue;
62107                 }
62108               }
62109             }
62110           }
62111           if (_rules[_keys[i3]].filter(entity.tags, geometry)) {
62112             matches[_keys[i3]] = hasMatch = true;
62113           }
62114         }
62115         _cache5[ent].matches = matches;
62116       }
62117       return _cache5[ent].matches;
62118     };
62119     features.getParents = function(entity, resolver, geometry) {
62120       if (geometry === "point") return [];
62121       var ent = osmEntity.key(entity);
62122       if (!_cache5[ent]) {
62123         _cache5[ent] = {};
62124       }
62125       if (!_cache5[ent].parents) {
62126         var parents = [];
62127         if (geometry === "vertex") {
62128           parents = resolver.parentWays(entity);
62129         } else {
62130           parents = resolver.parentRelations(entity);
62131         }
62132         _cache5[ent].parents = parents;
62133       }
62134       return _cache5[ent].parents;
62135     };
62136     features.isHiddenPreset = function(preset, geometry) {
62137       if (!_hidden.length) return false;
62138       if (!preset.tags) return false;
62139       var test = preset.setTags({}, geometry);
62140       for (var key in _rules) {
62141         if (_rules[key].filter(test, geometry)) {
62142           if (_hidden.indexOf(key) !== -1) {
62143             return key;
62144           }
62145           return false;
62146         }
62147       }
62148       return false;
62149     };
62150     features.isHiddenFeature = function(entity, resolver, geometry) {
62151       if (!_hidden.length) return false;
62152       if (!entity.version) return false;
62153       if (_forceVisible[entity.id]) return false;
62154       var matches = Object.keys(features.getMatches(entity, resolver, geometry));
62155       return matches.length && matches.every(function(k2) {
62156         return features.hidden(k2);
62157       });
62158     };
62159     features.isHiddenChild = function(entity, resolver, geometry) {
62160       if (!_hidden.length) return false;
62161       if (!entity.version || geometry === "point") return false;
62162       if (_forceVisible[entity.id]) return false;
62163       var parents = features.getParents(entity, resolver, geometry);
62164       if (!parents.length) return false;
62165       for (var i3 = 0; i3 < parents.length; i3++) {
62166         if (!features.isHidden(parents[i3], resolver, parents[i3].geometry(resolver))) {
62167           return false;
62168         }
62169       }
62170       return true;
62171     };
62172     features.hasHiddenConnections = function(entity, resolver) {
62173       if (!_hidden.length) return false;
62174       var childNodes, connections;
62175       if (entity.type === "midpoint") {
62176         childNodes = [resolver.entity(entity.edge[0]), resolver.entity(entity.edge[1])];
62177         connections = [];
62178       } else {
62179         childNodes = entity.nodes ? resolver.childNodes(entity) : [];
62180         connections = features.getParents(entity, resolver, entity.geometry(resolver));
62181       }
62182       connections = childNodes.reduce(function(result, e3) {
62183         return resolver.isShared(e3) ? utilArrayUnion(result, resolver.parentWays(e3)) : result;
62184       }, connections);
62185       return connections.some(function(e3) {
62186         return features.isHidden(e3, resolver, e3.geometry(resolver));
62187       });
62188     };
62189     features.isHidden = function(entity, resolver, geometry) {
62190       if (!_hidden.length) return false;
62191       if (!entity.version) return false;
62192       var fn = geometry === "vertex" ? features.isHiddenChild : features.isHiddenFeature;
62193       return fn(entity, resolver, geometry);
62194     };
62195     features.filter = function(d2, resolver) {
62196       if (!_hidden.length) return d2;
62197       var result = [];
62198       for (var i3 = 0; i3 < d2.length; i3++) {
62199         var entity = d2[i3];
62200         if (!features.isHidden(entity, resolver, entity.geometry(resolver))) {
62201           result.push(entity);
62202         }
62203       }
62204       return result;
62205     };
62206     features.forceVisible = function(entityIDs) {
62207       if (!arguments.length) return Object.keys(_forceVisible);
62208       _forceVisible = {};
62209       for (var i3 = 0; i3 < entityIDs.length; i3++) {
62210         _forceVisible[entityIDs[i3]] = true;
62211         var entity = context.hasEntity(entityIDs[i3]);
62212         if (entity && entity.type === "relation") {
62213           for (var j2 in entity.members) {
62214             _forceVisible[entity.members[j2].id] = true;
62215           }
62216         }
62217       }
62218       return features;
62219     };
62220     features.init = function() {
62221       var storage = corePreferences("disabled-features");
62222       if (storage) {
62223         var storageDisabled = storage.replace(/;/g, ",").split(",");
62224         storageDisabled.forEach(features.disable);
62225       }
62226       var hash = utilStringQs(window.location.hash);
62227       if (hash.disable_features) {
62228         var hashDisabled = hash.disable_features.replace(/;/g, ",").split(",");
62229         hashDisabled.forEach(features.disable);
62230       }
62231     };
62232     context.history().on("merge.features", function(newEntities) {
62233       if (!newEntities) return;
62234       var handle = window.requestIdleCallback(function() {
62235         var graph = context.graph();
62236         var types = utilArrayGroupBy(newEntities, "type");
62237         var entities = [].concat(types.relation || [], types.way || [], types.node || []);
62238         for (var i3 = 0; i3 < entities.length; i3++) {
62239           var geometry = entities[i3].geometry(graph);
62240           features.getMatches(entities[i3], graph, geometry);
62241         }
62242       });
62243       _deferred2.add(handle);
62244     });
62245     return features;
62246   }
62247
62248   // modules/util/bind_once.js
62249   function utilBindOnce(target, type2, listener, capture) {
62250     var typeOnce = type2 + ".once";
62251     function one2() {
62252       target.on(typeOnce, null);
62253       listener.apply(this, arguments);
62254     }
62255     target.on(typeOnce, one2, capture);
62256     return this;
62257   }
62258
62259   // modules/util/zoom_pan.js
62260   function defaultFilter3(d3_event) {
62261     return !d3_event.ctrlKey && !d3_event.button;
62262   }
62263   function defaultExtent2() {
62264     var e3 = this;
62265     if (e3 instanceof SVGElement) {
62266       e3 = e3.ownerSVGElement || e3;
62267       if (e3.hasAttribute("viewBox")) {
62268         e3 = e3.viewBox.baseVal;
62269         return [[e3.x, e3.y], [e3.x + e3.width, e3.y + e3.height]];
62270       }
62271       return [[0, 0], [e3.width.baseVal.value, e3.height.baseVal.value]];
62272     }
62273     return [[0, 0], [e3.clientWidth, e3.clientHeight]];
62274   }
62275   function defaultWheelDelta2(d3_event) {
62276     return -d3_event.deltaY * (d3_event.deltaMode === 1 ? 0.05 : d3_event.deltaMode ? 1 : 2e-3);
62277   }
62278   function defaultConstrain2(transform2, extent, translateExtent) {
62279     var dx0 = transform2.invertX(extent[0][0]) - translateExtent[0][0], dx1 = transform2.invertX(extent[1][0]) - translateExtent[1][0], dy0 = transform2.invertY(extent[0][1]) - translateExtent[0][1], dy1 = transform2.invertY(extent[1][1]) - translateExtent[1][1];
62280     return transform2.translate(
62281       dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
62282       dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
62283     );
62284   }
62285   function utilZoomPan() {
62286     var filter2 = defaultFilter3, extent = defaultExtent2, constrain = defaultConstrain2, wheelDelta = defaultWheelDelta2, scaleExtent = [0, Infinity], translateExtent = [[-Infinity, -Infinity], [Infinity, Infinity]], interpolate = zoom_default, dispatch14 = dispatch_default("start", "zoom", "end"), _wheelDelay = 150, _transform = identity2, _activeGesture;
62287     function zoom(selection2) {
62288       selection2.on("pointerdown.zoom", pointerdown).on("wheel.zoom", wheeled).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
62289       select_default2(window).on("pointermove.zoompan", pointermove).on("pointerup.zoompan pointercancel.zoompan", pointerup);
62290     }
62291     zoom.transform = function(collection, transform2, point) {
62292       var selection2 = collection.selection ? collection.selection() : collection;
62293       if (collection !== selection2) {
62294         schedule(collection, transform2, point);
62295       } else {
62296         selection2.interrupt().each(function() {
62297           gesture(this, arguments).start(null).zoom(null, null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end(null);
62298         });
62299       }
62300     };
62301     zoom.scaleBy = function(selection2, k2, p2) {
62302       zoom.scaleTo(selection2, function() {
62303         var k0 = _transform.k, k1 = typeof k2 === "function" ? k2.apply(this, arguments) : k2;
62304         return k0 * k1;
62305       }, p2);
62306     };
62307     zoom.scaleTo = function(selection2, k2, p2) {
62308       zoom.transform(selection2, function() {
62309         var e3 = extent.apply(this, arguments), t0 = _transform, p02 = !p2 ? centroid(e3) : typeof p2 === "function" ? p2.apply(this, arguments) : p2, p1 = t0.invert(p02), k1 = typeof k2 === "function" ? k2.apply(this, arguments) : k2;
62310         return constrain(translate(scale(t0, k1), p02, p1), e3, translateExtent);
62311       }, p2);
62312     };
62313     zoom.translateBy = function(selection2, x2, y2) {
62314       zoom.transform(selection2, function() {
62315         return constrain(_transform.translate(
62316           typeof x2 === "function" ? x2.apply(this, arguments) : x2,
62317           typeof y2 === "function" ? y2.apply(this, arguments) : y2
62318         ), extent.apply(this, arguments), translateExtent);
62319       });
62320     };
62321     zoom.translateTo = function(selection2, x2, y2, p2) {
62322       zoom.transform(selection2, function() {
62323         var e3 = extent.apply(this, arguments), t2 = _transform, p02 = !p2 ? centroid(e3) : typeof p2 === "function" ? p2.apply(this, arguments) : p2;
62324         return constrain(identity2.translate(p02[0], p02[1]).scale(t2.k).translate(
62325           typeof x2 === "function" ? -x2.apply(this, arguments) : -x2,
62326           typeof y2 === "function" ? -y2.apply(this, arguments) : -y2
62327         ), e3, translateExtent);
62328       }, p2);
62329     };
62330     function scale(transform2, k2) {
62331       k2 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k2));
62332       return k2 === transform2.k ? transform2 : new Transform(k2, transform2.x, transform2.y);
62333     }
62334     function translate(transform2, p02, p1) {
62335       var x2 = p02[0] - p1[0] * transform2.k, y2 = p02[1] - p1[1] * transform2.k;
62336       return x2 === transform2.x && y2 === transform2.y ? transform2 : new Transform(transform2.k, x2, y2);
62337     }
62338     function centroid(extent2) {
62339       return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
62340     }
62341     function schedule(transition2, transform2, point) {
62342       transition2.on("start.zoom", function() {
62343         gesture(this, arguments).start(null);
62344       }).on("interrupt.zoom end.zoom", function() {
62345         gesture(this, arguments).end(null);
62346       }).tween("zoom", function() {
62347         var that = this, args = arguments, g3 = gesture(that, args), e3 = extent.apply(that, args), p2 = !point ? centroid(e3) : typeof point === "function" ? point.apply(that, args) : point, w2 = Math.max(e3[1][0] - e3[0][0], e3[1][1] - e3[0][1]), a2 = _transform, b2 = typeof transform2 === "function" ? transform2.apply(that, args) : transform2, i3 = interpolate(a2.invert(p2).concat(w2 / a2.k), b2.invert(p2).concat(w2 / b2.k));
62348         return function(t2) {
62349           if (t2 === 1) {
62350             t2 = b2;
62351           } else {
62352             var l2 = i3(t2);
62353             var k2 = w2 / l2[2];
62354             t2 = new Transform(k2, p2[0] - l2[0] * k2, p2[1] - l2[1] * k2);
62355           }
62356           g3.zoom(null, null, t2);
62357         };
62358       });
62359     }
62360     function gesture(that, args, clean2) {
62361       return !clean2 && _activeGesture || new Gesture(that, args);
62362     }
62363     function Gesture(that, args) {
62364       this.that = that;
62365       this.args = args;
62366       this.active = 0;
62367       this.extent = extent.apply(that, args);
62368     }
62369     Gesture.prototype = {
62370       start: function(d3_event) {
62371         if (++this.active === 1) {
62372           _activeGesture = this;
62373           dispatch14.call("start", this, d3_event);
62374         }
62375         return this;
62376       },
62377       zoom: function(d3_event, key, transform2) {
62378         if (this.mouse && key !== "mouse") this.mouse[1] = transform2.invert(this.mouse[0]);
62379         if (this.pointer0 && key !== "touch") this.pointer0[1] = transform2.invert(this.pointer0[0]);
62380         if (this.pointer1 && key !== "touch") this.pointer1[1] = transform2.invert(this.pointer1[0]);
62381         _transform = transform2;
62382         dispatch14.call("zoom", this, d3_event, key, transform2);
62383         return this;
62384       },
62385       end: function(d3_event) {
62386         if (--this.active === 0) {
62387           _activeGesture = null;
62388           dispatch14.call("end", this, d3_event);
62389         }
62390         return this;
62391       }
62392     };
62393     function wheeled(d3_event) {
62394       if (!filter2.apply(this, arguments)) return;
62395       var g3 = gesture(this, arguments), t2 = _transform, k2 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t2.k * Math.pow(2, wheelDelta.apply(this, arguments)))), p2 = utilFastMouse(this)(d3_event);
62396       if (g3.wheel) {
62397         if (g3.mouse[0][0] !== p2[0] || g3.mouse[0][1] !== p2[1]) {
62398           g3.mouse[1] = t2.invert(g3.mouse[0] = p2);
62399         }
62400         clearTimeout(g3.wheel);
62401       } else {
62402         g3.mouse = [p2, t2.invert(p2)];
62403         interrupt_default(this);
62404         g3.start(d3_event);
62405       }
62406       d3_event.preventDefault();
62407       d3_event.stopImmediatePropagation();
62408       g3.wheel = setTimeout(wheelidled, _wheelDelay);
62409       g3.zoom(d3_event, "mouse", constrain(translate(scale(t2, k2), g3.mouse[0], g3.mouse[1]), g3.extent, translateExtent));
62410       function wheelidled() {
62411         g3.wheel = null;
62412         g3.end(d3_event);
62413       }
62414     }
62415     var _downPointerIDs = /* @__PURE__ */ new Set();
62416     var _pointerLocGetter;
62417     function pointerdown(d3_event) {
62418       _downPointerIDs.add(d3_event.pointerId);
62419       if (!filter2.apply(this, arguments)) return;
62420       var g3 = gesture(this, arguments, _downPointerIDs.size === 1);
62421       var started;
62422       d3_event.stopImmediatePropagation();
62423       _pointerLocGetter = utilFastMouse(this);
62424       var loc = _pointerLocGetter(d3_event);
62425       var p2 = [loc, _transform.invert(loc), d3_event.pointerId];
62426       if (!g3.pointer0) {
62427         g3.pointer0 = p2;
62428         started = true;
62429       } else if (!g3.pointer1 && g3.pointer0[2] !== p2[2]) {
62430         g3.pointer1 = p2;
62431       }
62432       if (started) {
62433         interrupt_default(this);
62434         g3.start(d3_event);
62435       }
62436     }
62437     function pointermove(d3_event) {
62438       if (!_downPointerIDs.has(d3_event.pointerId)) return;
62439       if (!_activeGesture || !_pointerLocGetter) return;
62440       var g3 = gesture(this, arguments);
62441       var isPointer0 = g3.pointer0 && g3.pointer0[2] === d3_event.pointerId;
62442       var isPointer1 = !isPointer0 && g3.pointer1 && g3.pointer1[2] === d3_event.pointerId;
62443       if ((isPointer0 || isPointer1) && "buttons" in d3_event && !d3_event.buttons) {
62444         if (g3.pointer0) _downPointerIDs.delete(g3.pointer0[2]);
62445         if (g3.pointer1) _downPointerIDs.delete(g3.pointer1[2]);
62446         g3.end(d3_event);
62447         return;
62448       }
62449       d3_event.preventDefault();
62450       d3_event.stopImmediatePropagation();
62451       var loc = _pointerLocGetter(d3_event);
62452       var t2, p2, l2;
62453       if (isPointer0) g3.pointer0[0] = loc;
62454       else if (isPointer1) g3.pointer1[0] = loc;
62455       t2 = _transform;
62456       if (g3.pointer1) {
62457         var p02 = g3.pointer0[0], l0 = g3.pointer0[1], p1 = g3.pointer1[0], l1 = g3.pointer1[1], dp = (dp = p1[0] - p02[0]) * dp + (dp = p1[1] - p02[1]) * dp, dl = (dl = l1[0] - l0[0]) * dl + (dl = l1[1] - l0[1]) * dl;
62458         t2 = scale(t2, Math.sqrt(dp / dl));
62459         p2 = [(p02[0] + p1[0]) / 2, (p02[1] + p1[1]) / 2];
62460         l2 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
62461       } else if (g3.pointer0) {
62462         p2 = g3.pointer0[0];
62463         l2 = g3.pointer0[1];
62464       } else {
62465         return;
62466       }
62467       g3.zoom(d3_event, "touch", constrain(translate(t2, p2, l2), g3.extent, translateExtent));
62468     }
62469     function pointerup(d3_event) {
62470       if (!_downPointerIDs.has(d3_event.pointerId)) return;
62471       _downPointerIDs.delete(d3_event.pointerId);
62472       if (!_activeGesture) return;
62473       var g3 = gesture(this, arguments);
62474       d3_event.stopImmediatePropagation();
62475       if (g3.pointer0 && g3.pointer0[2] === d3_event.pointerId) delete g3.pointer0;
62476       else if (g3.pointer1 && g3.pointer1[2] === d3_event.pointerId) delete g3.pointer1;
62477       if (g3.pointer1 && !g3.pointer0) {
62478         g3.pointer0 = g3.pointer1;
62479         delete g3.pointer1;
62480       }
62481       if (g3.pointer0) {
62482         g3.pointer0[1] = _transform.invert(g3.pointer0[0]);
62483       } else {
62484         g3.end(d3_event);
62485       }
62486     }
62487     zoom.wheelDelta = function(_2) {
62488       return arguments.length ? (wheelDelta = utilFunctor(+_2), zoom) : wheelDelta;
62489     };
62490     zoom.filter = function(_2) {
62491       return arguments.length ? (filter2 = utilFunctor(!!_2), zoom) : filter2;
62492     };
62493     zoom.extent = function(_2) {
62494       return arguments.length ? (extent = utilFunctor([[+_2[0][0], +_2[0][1]], [+_2[1][0], +_2[1][1]]]), zoom) : extent;
62495     };
62496     zoom.scaleExtent = function(_2) {
62497       return arguments.length ? (scaleExtent[0] = +_2[0], scaleExtent[1] = +_2[1], zoom) : [scaleExtent[0], scaleExtent[1]];
62498     };
62499     zoom.translateExtent = function(_2) {
62500       return arguments.length ? (translateExtent[0][0] = +_2[0][0], translateExtent[1][0] = +_2[1][0], translateExtent[0][1] = +_2[0][1], translateExtent[1][1] = +_2[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];
62501     };
62502     zoom.constrain = function(_2) {
62503       return arguments.length ? (constrain = _2, zoom) : constrain;
62504     };
62505     zoom.interpolate = function(_2) {
62506       return arguments.length ? (interpolate = _2, zoom) : interpolate;
62507     };
62508     zoom._transform = function(_2) {
62509       return arguments.length ? (_transform = _2, zoom) : _transform;
62510     };
62511     return utilRebind(zoom, dispatch14, "on");
62512   }
62513
62514   // modules/util/double_up.js
62515   function utilDoubleUp() {
62516     var dispatch14 = dispatch_default("doubleUp");
62517     var _maxTimespan = 500;
62518     var _maxDistance = 20;
62519     var _pointer;
62520     function pointerIsValidFor(loc) {
62521       return (/* @__PURE__ */ new Date()).getTime() - _pointer.startTime <= _maxTimespan && // all pointer events must occur within a small distance of the first pointerdown
62522       geoVecLength(_pointer.startLoc, loc) <= _maxDistance;
62523     }
62524     function pointerdown(d3_event) {
62525       if (d3_event.ctrlKey || d3_event.button === 2) return;
62526       var loc = [d3_event.clientX, d3_event.clientY];
62527       if (_pointer && !pointerIsValidFor(loc)) {
62528         _pointer = void 0;
62529       }
62530       if (!_pointer) {
62531         _pointer = {
62532           startLoc: loc,
62533           startTime: (/* @__PURE__ */ new Date()).getTime(),
62534           upCount: 0,
62535           pointerId: d3_event.pointerId
62536         };
62537       } else {
62538         _pointer.pointerId = d3_event.pointerId;
62539       }
62540     }
62541     function pointerup(d3_event) {
62542       if (d3_event.ctrlKey || d3_event.button === 2) return;
62543       if (!_pointer || _pointer.pointerId !== d3_event.pointerId) return;
62544       _pointer.upCount += 1;
62545       if (_pointer.upCount === 2) {
62546         var loc = [d3_event.clientX, d3_event.clientY];
62547         if (pointerIsValidFor(loc)) {
62548           var locInThis = utilFastMouse(this)(d3_event);
62549           dispatch14.call("doubleUp", this, d3_event, locInThis);
62550         }
62551         _pointer = void 0;
62552       }
62553     }
62554     function doubleUp(selection2) {
62555       if ("PointerEvent" in window) {
62556         selection2.on("pointerdown.doubleUp", pointerdown).on("pointerup.doubleUp", pointerup);
62557       } else {
62558         selection2.on("dblclick.doubleUp", function(d3_event) {
62559           dispatch14.call("doubleUp", this, d3_event, utilFastMouse(this)(d3_event));
62560         });
62561       }
62562     }
62563     doubleUp.off = function(selection2) {
62564       selection2.on("pointerdown.doubleUp", null).on("pointerup.doubleUp", null).on("dblclick.doubleUp", null);
62565     };
62566     return utilRebind(doubleUp, dispatch14, "on");
62567   }
62568
62569   // modules/renderer/map.js
62570   var TILESIZE = 256;
62571   var minZoom2 = 2;
62572   var maxZoom = 24;
62573   var kMin = geoZoomToScale(minZoom2, TILESIZE);
62574   var kMax = geoZoomToScale(maxZoom, TILESIZE);
62575   function clamp2(num, min3, max3) {
62576     return Math.max(min3, Math.min(num, max3));
62577   }
62578   function rendererMap(context) {
62579     var dispatch14 = dispatch_default(
62580       "move",
62581       "drawn",
62582       "crossEditableZoom",
62583       "hitMinZoom",
62584       "changeHighlighting",
62585       "changeAreaFill"
62586     );
62587     var projection2 = context.projection;
62588     var curtainProjection = context.curtainProjection;
62589     var drawLayers;
62590     var drawPoints;
62591     var drawVertices;
62592     var drawLines;
62593     var drawAreas;
62594     var drawMidpoints;
62595     var drawLabels;
62596     var _selection = select_default2(null);
62597     var supersurface = select_default2(null);
62598     var wrapper = select_default2(null);
62599     var surface = select_default2(null);
62600     var _dimensions = [1, 1];
62601     var _dblClickZoomEnabled = true;
62602     var _redrawEnabled = true;
62603     var _gestureTransformStart;
62604     var _transformStart = projection2.transform();
62605     var _transformLast;
62606     var _isTransformed = false;
62607     var _minzoom = 0;
62608     var _getMouseCoords;
62609     var _lastPointerEvent;
62610     var _lastWithinEditableZoom;
62611     var _pointerDown = false;
62612     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
62613     var _zoomerPannerFunction = "PointerEvent" in window ? utilZoomPan : zoom_default2;
62614     var _zoomerPanner = _zoomerPannerFunction().scaleExtent([kMin, kMax]).interpolate(value_default).filter(zoomEventFilter).on("zoom.map", zoomPan2).on("start.map", function(d3_event) {
62615       _pointerDown = d3_event && (d3_event.type === "pointerdown" || d3_event.sourceEvent && d3_event.sourceEvent.type === "pointerdown");
62616     }).on("end.map", function() {
62617       _pointerDown = false;
62618     });
62619     var _doubleUpHandler = utilDoubleUp();
62620     var scheduleRedraw = throttle_default(redraw, 750);
62621     function cancelPendingRedraw() {
62622       scheduleRedraw.cancel();
62623     }
62624     function map2(selection2) {
62625       _selection = selection2;
62626       context.on("change.map", immediateRedraw);
62627       var osm = context.connection();
62628       if (osm) {
62629         osm.on("change.map", immediateRedraw);
62630       }
62631       function didUndoOrRedo(targetTransform) {
62632         var mode = context.mode().id;
62633         if (mode !== "browse" && mode !== "select") return;
62634         if (targetTransform) {
62635           map2.transformEase(targetTransform);
62636         }
62637       }
62638       context.history().on("merge.map", function() {
62639         scheduleRedraw();
62640       }).on("change.map", immediateRedraw).on("undone.map", function(stack, fromStack) {
62641         didUndoOrRedo(fromStack.transform);
62642       }).on("redone.map", function(stack) {
62643         didUndoOrRedo(stack.transform);
62644       });
62645       context.background().on("change.map", immediateRedraw);
62646       context.features().on("redraw.map", immediateRedraw);
62647       drawLayers.on("change.map", function() {
62648         context.background().updateImagery();
62649         immediateRedraw();
62650       });
62651       selection2.on("wheel.map mousewheel.map", function(d3_event) {
62652         d3_event.preventDefault();
62653       }).call(_zoomerPanner).call(_zoomerPanner.transform, projection2.transform()).on("dblclick.zoom", null);
62654       map2.supersurface = supersurface = selection2.append("div").attr("class", "supersurface").call(utilSetTransform, 0, 0);
62655       wrapper = supersurface.append("div").attr("class", "layer layer-data");
62656       map2.surface = surface = wrapper.call(drawLayers).selectAll(".surface");
62657       surface.call(drawLabels.observe).call(_doubleUpHandler).on(_pointerPrefix + "down.zoom", function(d3_event) {
62658         _lastPointerEvent = d3_event;
62659         if (d3_event.button === 2) {
62660           d3_event.stopPropagation();
62661         }
62662       }, true).on(_pointerPrefix + "up.zoom", function(d3_event) {
62663         _lastPointerEvent = d3_event;
62664         if (resetTransform()) {
62665           immediateRedraw();
62666         }
62667       }).on(_pointerPrefix + "move.map", function(d3_event) {
62668         _lastPointerEvent = d3_event;
62669       }).on(_pointerPrefix + "over.vertices", function(d3_event) {
62670         if (map2.editableDataEnabled() && !_isTransformed) {
62671           var hover = d3_event.target.__data__;
62672           surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
62673           dispatch14.call("drawn", this, { full: false });
62674         }
62675       }).on(_pointerPrefix + "out.vertices", function(d3_event) {
62676         if (map2.editableDataEnabled() && !_isTransformed) {
62677           var hover = d3_event.relatedTarget && d3_event.relatedTarget.__data__;
62678           surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
62679           dispatch14.call("drawn", this, { full: false });
62680         }
62681       });
62682       var detected = utilDetect();
62683       if ("GestureEvent" in window && // Listening for gesture events on iOS 13.4+ breaks double-tapping,
62684       // but we only need to do this on desktop Safari anyway. – #7694
62685       !detected.isMobileWebKit) {
62686         surface.on("gesturestart.surface", function(d3_event) {
62687           d3_event.preventDefault();
62688           _gestureTransformStart = projection2.transform();
62689         }).on("gesturechange.surface", gestureChange);
62690       }
62691       updateAreaFill();
62692       _doubleUpHandler.on("doubleUp.map", function(d3_event, p02) {
62693         if (!_dblClickZoomEnabled) return;
62694         if (typeof d3_event.target.__data__ === "object" && // or area fills
62695         !select_default2(d3_event.target).classed("fill")) return;
62696         var zoomOut2 = d3_event.shiftKey;
62697         var t2 = projection2.transform();
62698         var p1 = t2.invert(p02);
62699         t2 = t2.scale(zoomOut2 ? 0.5 : 2);
62700         t2.x = p02[0] - p1[0] * t2.k;
62701         t2.y = p02[1] - p1[1] * t2.k;
62702         map2.transformEase(t2);
62703       });
62704       context.on("enter.map", function() {
62705         if (!map2.editableDataEnabled(
62706           true
62707           /* skip zoom check */
62708         )) return;
62709         if (_isTransformed) return;
62710         var graph = context.graph();
62711         var selectedAndParents = {};
62712         context.selectedIDs().forEach(function(id2) {
62713           var entity = graph.hasEntity(id2);
62714           if (entity) {
62715             selectedAndParents[entity.id] = entity;
62716             if (entity.type === "node") {
62717               graph.parentWays(entity).forEach(function(parent) {
62718                 selectedAndParents[parent.id] = parent;
62719               });
62720             }
62721           }
62722         });
62723         var data = Object.values(selectedAndParents);
62724         var filter2 = function(d2) {
62725           return d2.id in selectedAndParents;
62726         };
62727         data = context.features().filter(data, graph);
62728         surface.call(drawVertices.drawSelected, graph, map2.extent()).call(drawLines, graph, data, filter2).call(drawAreas, graph, data, filter2).call(drawMidpoints, graph, data, filter2, map2.trimmedExtent());
62729         dispatch14.call("drawn", this, { full: false });
62730         scheduleRedraw();
62731       });
62732       map2.dimensions(utilGetDimensions(selection2));
62733     }
62734     function zoomEventFilter(d3_event) {
62735       if (d3_event.type === "mousedown") {
62736         var hasOrphan = false;
62737         var listeners = window.__on;
62738         for (var i3 = 0; i3 < listeners.length; i3++) {
62739           var listener = listeners[i3];
62740           if (listener.name === "zoom" && listener.type === "mouseup") {
62741             hasOrphan = true;
62742             break;
62743           }
62744         }
62745         if (hasOrphan) {
62746           var event = window.CustomEvent;
62747           if (event) {
62748             event = new event("mouseup");
62749           } else {
62750             event = window.document.createEvent("Event");
62751             event.initEvent("mouseup", false, false);
62752           }
62753           event.view = window;
62754           window.dispatchEvent(event);
62755         }
62756       }
62757       return d3_event.button !== 2;
62758     }
62759     function pxCenter() {
62760       return [_dimensions[0] / 2, _dimensions[1] / 2];
62761     }
62762     function drawEditable(difference2, extent) {
62763       var mode = context.mode();
62764       var graph = context.graph();
62765       var features = context.features();
62766       var all = context.history().intersects(map2.extent());
62767       var fullRedraw = false;
62768       var data;
62769       var set4;
62770       var filter2;
62771       var applyFeatureLayerFilters = true;
62772       if (map2.isInWideSelection()) {
62773         data = [];
62774         utilEntityAndDeepMemberIDs(mode.selectedIDs(), context.graph()).forEach(function(id2) {
62775           var entity = context.hasEntity(id2);
62776           if (entity) data.push(entity);
62777         });
62778         fullRedraw = true;
62779         filter2 = utilFunctor(true);
62780         applyFeatureLayerFilters = false;
62781       } else if (difference2) {
62782         var complete = difference2.complete(map2.extent());
62783         data = Object.values(complete).filter(Boolean);
62784         set4 = new Set(Object.keys(complete));
62785         filter2 = function(d2) {
62786           return set4.has(d2.id);
62787         };
62788         features.clear(data);
62789       } else {
62790         if (features.gatherStats(all, graph, _dimensions)) {
62791           extent = void 0;
62792         }
62793         if (extent) {
62794           data = context.history().intersects(map2.extent().intersection(extent));
62795           set4 = new Set(data.map(function(entity) {
62796             return entity.id;
62797           }));
62798           filter2 = function(d2) {
62799             return set4.has(d2.id);
62800           };
62801         } else {
62802           data = all;
62803           fullRedraw = true;
62804           filter2 = utilFunctor(true);
62805         }
62806       }
62807       if (applyFeatureLayerFilters) {
62808         data = features.filter(data, graph);
62809       } else {
62810         context.features().resetStats();
62811       }
62812       if (mode && mode.id === "select") {
62813         surface.call(drawVertices.drawSelected, graph, map2.extent());
62814       }
62815       surface.call(drawVertices, graph, data, filter2, map2.extent(), fullRedraw).call(drawLines, graph, data, filter2).call(drawAreas, graph, data, filter2).call(drawMidpoints, graph, data, filter2, map2.trimmedExtent()).call(drawLabels, graph, data, filter2, _dimensions, fullRedraw).call(drawPoints, graph, data, filter2);
62816       dispatch14.call("drawn", this, { full: true });
62817     }
62818     map2.init = function() {
62819       drawLayers = svgLayers(projection2, context);
62820       drawPoints = svgPoints(projection2, context);
62821       drawVertices = svgVertices(projection2, context);
62822       drawLines = svgLines(projection2, context);
62823       drawAreas = svgAreas(projection2, context);
62824       drawMidpoints = svgMidpoints(projection2, context);
62825       drawLabels = svgLabels(projection2, context);
62826     };
62827     function editOff() {
62828       context.features().resetStats();
62829       surface.selectAll(".layer-osm *").remove();
62830       surface.selectAll(".layer-touch:not(.markers) *").remove();
62831       var allowed = {
62832         "browse": true,
62833         "save": true,
62834         "select-note": true,
62835         "select-data": true,
62836         "select-error": true
62837       };
62838       var mode = context.mode();
62839       if (mode && !allowed[mode.id]) {
62840         context.enter(modeBrowse(context));
62841       }
62842       dispatch14.call("drawn", this, { full: true });
62843     }
62844     function gestureChange(d3_event) {
62845       var e3 = d3_event;
62846       e3.preventDefault();
62847       var props = {
62848         deltaMode: 0,
62849         // dummy values to ignore in zoomPan
62850         deltaY: 1,
62851         // dummy values to ignore in zoomPan
62852         clientX: e3.clientX,
62853         clientY: e3.clientY,
62854         screenX: e3.screenX,
62855         screenY: e3.screenY,
62856         x: e3.x,
62857         y: e3.y
62858       };
62859       var e22 = new WheelEvent("wheel", props);
62860       e22._scale = e3.scale;
62861       e22._rotation = e3.rotation;
62862       _selection.node().dispatchEvent(e22);
62863     }
62864     function zoomPan2(event, key, transform2) {
62865       var source = event && event.sourceEvent || event;
62866       var eventTransform = transform2 || event && event.transform;
62867       var x2 = eventTransform.x;
62868       var y2 = eventTransform.y;
62869       var k2 = eventTransform.k;
62870       if (source && source.type === "wheel") {
62871         if (_pointerDown) return;
62872         var detected = utilDetect();
62873         var dX = source.deltaX;
62874         var dY = source.deltaY;
62875         var x22 = x2;
62876         var y22 = y2;
62877         var k22 = k2;
62878         var t0, p02, p1;
62879         if (source.deltaMode === 1) {
62880           var lines = Math.abs(source.deltaY);
62881           var sign2 = source.deltaY > 0 ? 1 : -1;
62882           dY = sign2 * clamp2(
62883             Math.exp((lines - 1) * 0.75) * 4.000244140625,
62884             4.000244140625,
62885             // min
62886             350.000244140625
62887             // max
62888           );
62889           if (detected.os !== "mac") {
62890             dY *= 5;
62891           }
62892           t0 = _isTransformed ? _transformLast : _transformStart;
62893           p02 = _getMouseCoords(source);
62894           p1 = t0.invert(p02);
62895           k22 = t0.k * Math.pow(2, -dY / 500);
62896           k22 = clamp2(k22, kMin, kMax);
62897           x22 = p02[0] - p1[0] * k22;
62898           y22 = p02[1] - p1[1] * k22;
62899         } else if (source._scale) {
62900           t0 = _gestureTransformStart;
62901           p02 = _getMouseCoords(source);
62902           p1 = t0.invert(p02);
62903           k22 = t0.k * source._scale;
62904           k22 = clamp2(k22, kMin, kMax);
62905           x22 = p02[0] - p1[0] * k22;
62906           y22 = p02[1] - p1[1] * k22;
62907         } else if (source.ctrlKey && !isInteger(dY)) {
62908           dY *= 6;
62909           t0 = _isTransformed ? _transformLast : _transformStart;
62910           p02 = _getMouseCoords(source);
62911           p1 = t0.invert(p02);
62912           k22 = t0.k * Math.pow(2, -dY / 500);
62913           k22 = clamp2(k22, kMin, kMax);
62914           x22 = p02[0] - p1[0] * k22;
62915           y22 = p02[1] - p1[1] * k22;
62916         } else if ((source.altKey || source.shiftKey) && isInteger(dY)) {
62917           t0 = _isTransformed ? _transformLast : _transformStart;
62918           p02 = _getMouseCoords(source);
62919           p1 = t0.invert(p02);
62920           k22 = t0.k * Math.pow(2, -dY / 500);
62921           k22 = clamp2(k22, kMin, kMax);
62922           x22 = p02[0] - p1[0] * k22;
62923           y22 = p02[1] - p1[1] * k22;
62924         } else if (detected.os === "mac" && detected.browser !== "Firefox" && !source.ctrlKey && isInteger(dX) && isInteger(dY)) {
62925           p1 = projection2.translate();
62926           x22 = p1[0] - dX;
62927           y22 = p1[1] - dY;
62928           k22 = projection2.scale();
62929           k22 = clamp2(k22, kMin, kMax);
62930         }
62931         if (x22 !== x2 || y22 !== y2 || k22 !== k2) {
62932           x2 = x22;
62933           y2 = y22;
62934           k2 = k22;
62935           eventTransform = identity2.translate(x22, y22).scale(k22);
62936           if (_zoomerPanner._transform) {
62937             _zoomerPanner._transform(eventTransform);
62938           } else {
62939             _selection.node().__zoom = eventTransform;
62940           }
62941         }
62942       }
62943       if (_transformStart.x === x2 && _transformStart.y === y2 && _transformStart.k === k2) {
62944         return;
62945       }
62946       if (geoScaleToZoom(k2, TILESIZE) < _minzoom) {
62947         surface.interrupt();
62948         dispatch14.call("hitMinZoom", this, map2);
62949         setCenterZoom(map2.center(), context.minEditableZoom(), 0, true);
62950         scheduleRedraw();
62951         dispatch14.call("move", this, map2);
62952         return;
62953       }
62954       projection2.transform(eventTransform);
62955       var withinEditableZoom = map2.withinEditableZoom();
62956       if (_lastWithinEditableZoom !== withinEditableZoom) {
62957         if (_lastWithinEditableZoom !== void 0) {
62958           dispatch14.call("crossEditableZoom", this, withinEditableZoom);
62959         }
62960         _lastWithinEditableZoom = withinEditableZoom;
62961       }
62962       var scale = k2 / _transformStart.k;
62963       var tX = (x2 / scale - _transformStart.x) * scale;
62964       var tY = (y2 / scale - _transformStart.y) * scale;
62965       if (context.inIntro()) {
62966         curtainProjection.transform({
62967           x: x2 - tX,
62968           y: y2 - tY,
62969           k: k2
62970         });
62971       }
62972       if (source) {
62973         _lastPointerEvent = event;
62974       }
62975       _isTransformed = true;
62976       _transformLast = eventTransform;
62977       utilSetTransform(supersurface, tX, tY, scale);
62978       scheduleRedraw();
62979       dispatch14.call("move", this, map2);
62980       function isInteger(val) {
62981         return typeof val === "number" && isFinite(val) && Math.floor(val) === val;
62982       }
62983     }
62984     function resetTransform() {
62985       if (!_isTransformed) return false;
62986       utilSetTransform(supersurface, 0, 0);
62987       _isTransformed = false;
62988       if (context.inIntro()) {
62989         curtainProjection.transform(projection2.transform());
62990       }
62991       return true;
62992     }
62993     function redraw(difference2, extent) {
62994       if (surface.empty() || !_redrawEnabled) return;
62995       if (resetTransform()) {
62996         difference2 = extent = void 0;
62997       }
62998       var zoom = map2.zoom();
62999       var z2 = String(~~zoom);
63000       if (surface.attr("data-zoom") !== z2) {
63001         surface.attr("data-zoom", z2);
63002       }
63003       var lat = map2.center()[1];
63004       var lowzoom = linear3().domain([-60, 0, 60]).range([17, 18.5, 17]).clamp(true);
63005       surface.classed("low-zoom", zoom <= lowzoom(lat));
63006       if (!difference2) {
63007         supersurface.call(context.background());
63008         wrapper.call(drawLayers);
63009       }
63010       if (map2.editableDataEnabled() || map2.isInWideSelection()) {
63011         context.loadTiles(projection2);
63012         drawEditable(difference2, extent);
63013       } else {
63014         editOff();
63015       }
63016       _transformStart = projection2.transform();
63017       return map2;
63018     }
63019     var immediateRedraw = function(difference2, extent) {
63020       if (!difference2 && !extent) cancelPendingRedraw();
63021       redraw(difference2, extent);
63022     };
63023     map2.lastPointerEvent = function() {
63024       return _lastPointerEvent;
63025     };
63026     map2.mouse = function(d3_event) {
63027       var event = d3_event || _lastPointerEvent;
63028       if (event) {
63029         var s2;
63030         while (s2 = event.sourceEvent) {
63031           event = s2;
63032         }
63033         return _getMouseCoords(event);
63034       }
63035       return null;
63036     };
63037     map2.mouseCoordinates = function() {
63038       var coord2 = map2.mouse() || pxCenter();
63039       return projection2.invert(coord2);
63040     };
63041     map2.dblclickZoomEnable = function(val) {
63042       if (!arguments.length) return _dblClickZoomEnabled;
63043       _dblClickZoomEnabled = val;
63044       return map2;
63045     };
63046     map2.redrawEnable = function(val) {
63047       if (!arguments.length) return _redrawEnabled;
63048       _redrawEnabled = val;
63049       return map2;
63050     };
63051     map2.isTransformed = function() {
63052       return _isTransformed;
63053     };
63054     function setTransform(t2, duration, force) {
63055       var t3 = projection2.transform();
63056       if (!force && t2.k === t3.k && t2.x === t3.x && t2.y === t3.y) return false;
63057       if (duration) {
63058         _selection.transition().duration(duration).on("start", function() {
63059           map2.startEase();
63060         }).call(_zoomerPanner.transform, identity2.translate(t2.x, t2.y).scale(t2.k));
63061       } else {
63062         projection2.transform(t2);
63063         _transformStart = t2;
63064         _selection.call(_zoomerPanner.transform, _transformStart);
63065       }
63066       return true;
63067     }
63068     function setCenterZoom(loc2, z2, duration, force) {
63069       var c2 = map2.center();
63070       var z3 = map2.zoom();
63071       if (loc2[0] === c2[0] && loc2[1] === c2[1] && z2 === z3 && !force) return false;
63072       var proj = geoRawMercator().transform(projection2.transform());
63073       var k2 = clamp2(geoZoomToScale(z2, TILESIZE), kMin, kMax);
63074       proj.scale(k2);
63075       var t2 = proj.translate();
63076       var point = proj(loc2);
63077       var center = pxCenter();
63078       t2[0] += center[0] - point[0];
63079       t2[1] += center[1] - point[1];
63080       return setTransform(identity2.translate(t2[0], t2[1]).scale(k2), duration, force);
63081     }
63082     map2.pan = function(delta, duration) {
63083       var t2 = projection2.translate();
63084       var k2 = projection2.scale();
63085       t2[0] += delta[0];
63086       t2[1] += delta[1];
63087       if (duration) {
63088         _selection.transition().duration(duration).on("start", function() {
63089           map2.startEase();
63090         }).call(_zoomerPanner.transform, identity2.translate(t2[0], t2[1]).scale(k2));
63091       } else {
63092         projection2.translate(t2);
63093         _transformStart = projection2.transform();
63094         _selection.call(_zoomerPanner.transform, _transformStart);
63095         dispatch14.call("move", this, map2);
63096         immediateRedraw();
63097       }
63098       return map2;
63099     };
63100     map2.dimensions = function(val) {
63101       if (!arguments.length) return _dimensions;
63102       _dimensions = val;
63103       drawLayers.dimensions(_dimensions);
63104       context.background().dimensions(_dimensions);
63105       projection2.clipExtent([[0, 0], _dimensions]);
63106       _getMouseCoords = utilFastMouse(supersurface.node());
63107       scheduleRedraw();
63108       return map2;
63109     };
63110     function zoomIn(delta) {
63111       setCenterZoom(map2.center(), ~~map2.zoom() + delta, 250, true);
63112     }
63113     function zoomOut(delta) {
63114       setCenterZoom(map2.center(), ~~map2.zoom() - delta, 250, true);
63115     }
63116     map2.zoomIn = function() {
63117       zoomIn(1);
63118     };
63119     map2.zoomInFurther = function() {
63120       zoomIn(4);
63121     };
63122     map2.canZoomIn = function() {
63123       return map2.zoom() < maxZoom;
63124     };
63125     map2.zoomOut = function() {
63126       zoomOut(1);
63127     };
63128     map2.zoomOutFurther = function() {
63129       zoomOut(4);
63130     };
63131     map2.canZoomOut = function() {
63132       return map2.zoom() > minZoom2;
63133     };
63134     map2.center = function(loc2) {
63135       if (!arguments.length) {
63136         return projection2.invert(pxCenter());
63137       }
63138       if (setCenterZoom(loc2, map2.zoom())) {
63139         dispatch14.call("move", this, map2);
63140       }
63141       scheduleRedraw();
63142       return map2;
63143     };
63144     map2.unobscuredCenterZoomEase = function(loc, zoom) {
63145       var offset = map2.unobscuredOffsetPx();
63146       var proj = geoRawMercator().transform(projection2.transform());
63147       proj.scale(geoZoomToScale(zoom, TILESIZE));
63148       var locPx = proj(loc);
63149       var offsetLocPx = [locPx[0] + offset[0], locPx[1] + offset[1]];
63150       var offsetLoc = proj.invert(offsetLocPx);
63151       map2.centerZoomEase(offsetLoc, zoom);
63152     };
63153     map2.unobscuredOffsetPx = function() {
63154       var openPane = context.container().select(".map-panes .map-pane.shown");
63155       if (!openPane.empty()) {
63156         return [openPane.node().offsetWidth / 2, 0];
63157       }
63158       return [0, 0];
63159     };
63160     map2.zoom = function(z2) {
63161       if (!arguments.length) {
63162         return Math.max(geoScaleToZoom(projection2.scale(), TILESIZE), 0);
63163       }
63164       if (z2 < _minzoom) {
63165         surface.interrupt();
63166         dispatch14.call("hitMinZoom", this, map2);
63167         z2 = context.minEditableZoom();
63168       }
63169       if (setCenterZoom(map2.center(), z2)) {
63170         dispatch14.call("move", this, map2);
63171       }
63172       scheduleRedraw();
63173       return map2;
63174     };
63175     map2.centerZoom = function(loc2, z2) {
63176       if (setCenterZoom(loc2, z2)) {
63177         dispatch14.call("move", this, map2);
63178       }
63179       scheduleRedraw();
63180       return map2;
63181     };
63182     map2.zoomTo = function(entities) {
63183       if (!isArray_default(entities)) {
63184         entities = [entities];
63185       }
63186       if (entities.length === 0) return map2;
63187       var extent = entities.map((entity) => entity.extent(context.graph())).reduce((a2, b2) => a2.extend(b2));
63188       if (!isFinite(extent.area())) return map2;
63189       var z2 = clamp2(map2.trimmedExtentZoom(extent), 0, 20);
63190       return map2.centerZoom(extent.center(), z2);
63191     };
63192     map2.centerEase = function(loc2, duration) {
63193       duration = duration || 250;
63194       setCenterZoom(loc2, map2.zoom(), duration);
63195       return map2;
63196     };
63197     map2.zoomEase = function(z2, duration) {
63198       duration = duration || 250;
63199       setCenterZoom(map2.center(), z2, duration, false);
63200       return map2;
63201     };
63202     map2.centerZoomEase = function(loc2, z2, duration) {
63203       duration = duration || 250;
63204       setCenterZoom(loc2, z2, duration, false);
63205       return map2;
63206     };
63207     map2.transformEase = function(t2, duration) {
63208       duration = duration || 250;
63209       setTransform(
63210         t2,
63211         duration,
63212         false
63213         /* don't force */
63214       );
63215       return map2;
63216     };
63217     map2.zoomToEase = function(obj, duration) {
63218       var extent;
63219       if (Array.isArray(obj)) {
63220         obj.forEach(function(entity) {
63221           var entityExtent = entity.extent(context.graph());
63222           if (!extent) {
63223             extent = entityExtent;
63224           } else {
63225             extent = extent.extend(entityExtent);
63226           }
63227         });
63228       } else {
63229         extent = obj.extent(context.graph());
63230       }
63231       if (!isFinite(extent.area())) return map2;
63232       var z2 = clamp2(map2.trimmedExtentZoom(extent), 0, 20);
63233       return map2.centerZoomEase(extent.center(), z2, duration);
63234     };
63235     map2.startEase = function() {
63236       utilBindOnce(surface, _pointerPrefix + "down.ease", function() {
63237         map2.cancelEase();
63238       });
63239       return map2;
63240     };
63241     map2.cancelEase = function() {
63242       _selection.interrupt();
63243       return map2;
63244     };
63245     map2.extent = function(val) {
63246       if (!arguments.length) {
63247         return new geoExtent(
63248           projection2.invert([0, _dimensions[1]]),
63249           projection2.invert([_dimensions[0], 0])
63250         );
63251       } else {
63252         var extent = geoExtent(val);
63253         map2.centerZoom(extent.center(), map2.extentZoom(extent));
63254       }
63255     };
63256     map2.trimmedExtent = function(val) {
63257       if (!arguments.length) {
63258         var headerY = 71;
63259         var footerY = 30;
63260         var pad2 = 10;
63261         return new geoExtent(
63262           projection2.invert([pad2, _dimensions[1] - footerY - pad2]),
63263           projection2.invert([_dimensions[0] - pad2, headerY + pad2])
63264         );
63265       } else {
63266         var extent = geoExtent(val);
63267         map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
63268       }
63269     };
63270     function calcExtentZoom(extent, dim) {
63271       var tl = projection2([extent[0][0], extent[1][1]]);
63272       var br2 = projection2([extent[1][0], extent[0][1]]);
63273       var hFactor = (br2[0] - tl[0]) / dim[0];
63274       var vFactor = (br2[1] - tl[1]) / dim[1];
63275       var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
63276       var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
63277       var newZoom = map2.zoom() - Math.max(hZoomDiff, vZoomDiff);
63278       return newZoom;
63279     }
63280     map2.extentZoom = function(val) {
63281       return calcExtentZoom(geoExtent(val), _dimensions);
63282     };
63283     map2.trimmedExtentZoom = function(val) {
63284       var trimY = 120;
63285       var trimX = 40;
63286       var trimmed = [_dimensions[0] - trimX, _dimensions[1] - trimY];
63287       return calcExtentZoom(geoExtent(val), trimmed);
63288     };
63289     map2.withinEditableZoom = function() {
63290       return map2.zoom() >= context.minEditableZoom();
63291     };
63292     map2.isInWideSelection = function() {
63293       return !map2.withinEditableZoom() && context.selectedIDs().length;
63294     };
63295     map2.editableDataEnabled = function(skipZoomCheck) {
63296       var layer = context.layers().layer("osm");
63297       if (!layer || !layer.enabled()) return false;
63298       return skipZoomCheck || map2.withinEditableZoom();
63299     };
63300     map2.notesEditable = function() {
63301       var layer = context.layers().layer("notes");
63302       if (!layer || !layer.enabled()) return false;
63303       return map2.withinEditableZoom();
63304     };
63305     map2.minzoom = function(val) {
63306       if (!arguments.length) return _minzoom;
63307       _minzoom = val;
63308       return map2;
63309     };
63310     map2.toggleHighlightEdited = function() {
63311       surface.classed("highlight-edited", !surface.classed("highlight-edited"));
63312       map2.pan([0, 0]);
63313       dispatch14.call("changeHighlighting", this);
63314     };
63315     map2.areaFillOptions = ["wireframe", "partial", "full"];
63316     map2.activeAreaFill = function(val) {
63317       if (!arguments.length) return corePreferences("area-fill") || "partial";
63318       corePreferences("area-fill", val);
63319       if (val !== "wireframe") {
63320         corePreferences("area-fill-toggle", val);
63321       }
63322       updateAreaFill();
63323       map2.pan([0, 0]);
63324       dispatch14.call("changeAreaFill", this);
63325       return map2;
63326     };
63327     map2.toggleWireframe = function() {
63328       var activeFill = map2.activeAreaFill();
63329       if (activeFill === "wireframe") {
63330         activeFill = corePreferences("area-fill-toggle") || "partial";
63331       } else {
63332         activeFill = "wireframe";
63333       }
63334       map2.activeAreaFill(activeFill);
63335     };
63336     function updateAreaFill() {
63337       var activeFill = map2.activeAreaFill();
63338       map2.areaFillOptions.forEach(function(opt) {
63339         surface.classed("fill-" + opt, Boolean(opt === activeFill));
63340       });
63341     }
63342     map2.layers = () => drawLayers;
63343     map2.doubleUpHandler = function() {
63344       return _doubleUpHandler;
63345     };
63346     return utilRebind(map2, dispatch14, "on");
63347   }
63348
63349   // modules/renderer/photos.js
63350   function rendererPhotos(context) {
63351     var dispatch14 = dispatch_default("change");
63352     var _layerIDs = ["streetside", "mapillary", "mapillary-map-features", "mapillary-signs", "kartaview", "mapilio", "vegbilder", "panoramax"];
63353     var _allPhotoTypes = ["flat", "panoramic"];
63354     var _shownPhotoTypes = _allPhotoTypes.slice();
63355     var _dateFilters = ["fromDate", "toDate"];
63356     var _fromDate;
63357     var _toDate;
63358     var _usernames;
63359     function photos() {
63360     }
63361     function updateStorage() {
63362       if (window.mocha) return;
63363       var hash = utilStringQs(window.location.hash);
63364       var enabled = context.layers().all().filter(function(d2) {
63365         return _layerIDs.indexOf(d2.id) !== -1 && d2.layer && d2.layer.supported() && d2.layer.enabled();
63366       }).map(function(d2) {
63367         return d2.id;
63368       });
63369       if (enabled.length) {
63370         hash.photo_overlay = enabled.join(",");
63371       } else {
63372         delete hash.photo_overlay;
63373       }
63374       window.location.replace("#" + utilQsString(hash, true));
63375     }
63376     photos.overlayLayerIDs = function() {
63377       return _layerIDs;
63378     };
63379     photos.allPhotoTypes = function() {
63380       return _allPhotoTypes;
63381     };
63382     photos.dateFilters = function() {
63383       return _dateFilters;
63384     };
63385     photos.dateFilterValue = function(val) {
63386       return val === _dateFilters[0] ? _fromDate : _toDate;
63387     };
63388     photos.setDateFilter = function(type2, val, updateUrl) {
63389       var date = val && new Date(val);
63390       if (date && !isNaN(date)) {
63391         val = date.toISOString().slice(0, 10);
63392       } else {
63393         val = null;
63394       }
63395       if (type2 === _dateFilters[0]) {
63396         _fromDate = val;
63397         if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
63398           _toDate = _fromDate;
63399         }
63400       }
63401       if (type2 === _dateFilters[1]) {
63402         _toDate = val;
63403         if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
63404           _fromDate = _toDate;
63405         }
63406       }
63407       dispatch14.call("change", this);
63408       if (updateUrl) {
63409         var rangeString;
63410         if (_fromDate || _toDate) {
63411           rangeString = (_fromDate || "") + "_" + (_toDate || "");
63412         }
63413         setUrlFilterValue("photo_dates", rangeString);
63414       }
63415     };
63416     photos.setUsernameFilter = function(val, updateUrl) {
63417       if (val && typeof val === "string") val = val.replace(/;/g, ",").split(",");
63418       if (val) {
63419         val = val.map((d2) => d2.trim()).filter(Boolean);
63420         if (!val.length) {
63421           val = null;
63422         }
63423       }
63424       _usernames = val;
63425       dispatch14.call("change", this);
63426       if (updateUrl) {
63427         var hashString;
63428         if (_usernames) {
63429           hashString = _usernames.join(",");
63430         }
63431         setUrlFilterValue("photo_username", hashString);
63432       }
63433     };
63434     function setUrlFilterValue(property, val) {
63435       if (!window.mocha) {
63436         var hash = utilStringQs(window.location.hash);
63437         if (val) {
63438           if (hash[property] === val) return;
63439           hash[property] = val;
63440         } else {
63441           if (!(property in hash)) return;
63442           delete hash[property];
63443         }
63444         window.location.replace("#" + utilQsString(hash, true));
63445       }
63446     }
63447     function showsLayer(id2) {
63448       var layer = context.layers().layer(id2);
63449       return layer && layer.supported() && layer.enabled();
63450     }
63451     photos.shouldFilterByDate = function() {
63452       return showsLayer("mapillary") || showsLayer("kartaview") || showsLayer("streetside") || showsLayer("vegbilder") || showsLayer("panoramax");
63453     };
63454     photos.shouldFilterByPhotoType = function() {
63455       return showsLayer("mapillary") || showsLayer("streetside") && showsLayer("kartaview") || showsLayer("vegbilder") || showsLayer("panoramax");
63456     };
63457     photos.shouldFilterByUsername = function() {
63458       return !showsLayer("mapillary") && showsLayer("kartaview") && !showsLayer("streetside") || showsLayer("panoramax");
63459     };
63460     photos.showsPhotoType = function(val) {
63461       if (!photos.shouldFilterByPhotoType()) return true;
63462       return _shownPhotoTypes.indexOf(val) !== -1;
63463     };
63464     photos.showsFlat = function() {
63465       return photos.showsPhotoType("flat");
63466     };
63467     photos.showsPanoramic = function() {
63468       return photos.showsPhotoType("panoramic");
63469     };
63470     photos.fromDate = function() {
63471       return _fromDate;
63472     };
63473     photos.toDate = function() {
63474       return _toDate;
63475     };
63476     photos.togglePhotoType = function(val) {
63477       var index = _shownPhotoTypes.indexOf(val);
63478       if (index !== -1) {
63479         _shownPhotoTypes.splice(index, 1);
63480       } else {
63481         _shownPhotoTypes.push(val);
63482       }
63483       dispatch14.call("change", this);
63484       return photos;
63485     };
63486     photos.usernames = function() {
63487       return _usernames;
63488     };
63489     photos.init = function() {
63490       var hash = utilStringQs(window.location.hash);
63491       if (hash.photo_dates) {
63492         var parts = /^(.*)[–_](.*)$/g.exec(hash.photo_dates.trim());
63493         this.setDateFilter("fromDate", parts && parts.length >= 2 && parts[1], false);
63494         this.setDateFilter("toDate", parts && parts.length >= 3 && parts[2], false);
63495       }
63496       if (hash.photo_username) {
63497         this.setUsernameFilter(hash.photo_username, false);
63498       }
63499       if (hash.photo_overlay) {
63500         var hashOverlayIDs = hash.photo_overlay.replace(/;/g, ",").split(",");
63501         hashOverlayIDs.forEach(function(id2) {
63502           if (id2 === "openstreetcam") id2 = "kartaview";
63503           var layer2 = _layerIDs.indexOf(id2) !== -1 && context.layers().layer(id2);
63504           if (layer2 && !layer2.enabled()) layer2.enabled(true);
63505         });
63506       }
63507       if (hash.photo) {
63508         var photoIds = hash.photo.replace(/;/g, ",").split(",");
63509         var photoId = photoIds.length && photoIds[0].trim();
63510         var results = /(.*)\/(.*)/g.exec(photoId);
63511         if (results && results.length >= 3) {
63512           var serviceId = results[1];
63513           if (serviceId === "openstreetcam") serviceId = "kartaview";
63514           var photoKey = results[2];
63515           var service = services[serviceId];
63516           if (service && service.ensureViewerLoaded) {
63517             var layer = _layerIDs.indexOf(serviceId) !== -1 && context.layers().layer(serviceId);
63518             if (layer && !layer.enabled()) layer.enabled(true);
63519             var baselineTime = Date.now();
63520             service.on("loadedImages.rendererPhotos", function() {
63521               if (Date.now() - baselineTime > 45e3) {
63522                 service.on("loadedImages.rendererPhotos", null);
63523                 return;
63524               }
63525               if (!service.cachedImage(photoKey)) return;
63526               service.on("loadedImages.rendererPhotos", null);
63527               service.ensureViewerLoaded(context).then(function() {
63528                 service.selectImage(context, photoKey).showViewer(context);
63529               });
63530             });
63531           }
63532         }
63533       }
63534       context.layers().on("change.rendererPhotos", updateStorage);
63535     };
63536     return utilRebind(photos, dispatch14, "on");
63537   }
63538
63539   // modules/ui/map_in_map.js
63540   function uiMapInMap(context) {
63541     function mapInMap(selection2) {
63542       var backgroundLayer = rendererTileLayer(context);
63543       var overlayLayers = {};
63544       var projection2 = geoRawMercator();
63545       var dataLayer = svgData(projection2, context).showLabels(false);
63546       var debugLayer = svgDebug(projection2, context);
63547       var zoom = zoom_default2().scaleExtent([geoZoomToScale(0.5), geoZoomToScale(24)]).on("start", zoomStarted).on("zoom", zoomed).on("end", zoomEnded);
63548       var wrap2 = select_default2(null);
63549       var tiles = select_default2(null);
63550       var viewport = select_default2(null);
63551       var _isTransformed = false;
63552       var _isHidden = true;
63553       var _skipEvents = false;
63554       var _gesture = null;
63555       var _zDiff = 6;
63556       var _dMini;
63557       var _cMini;
63558       var _tStart;
63559       var _tCurr;
63560       var _timeoutID;
63561       function zoomStarted() {
63562         if (_skipEvents) return;
63563         _tStart = _tCurr = projection2.transform();
63564         _gesture = null;
63565       }
63566       function zoomed(d3_event) {
63567         if (_skipEvents) return;
63568         var x2 = d3_event.transform.x;
63569         var y2 = d3_event.transform.y;
63570         var k2 = d3_event.transform.k;
63571         var isZooming = k2 !== _tStart.k;
63572         var isPanning = x2 !== _tStart.x || y2 !== _tStart.y;
63573         if (!isZooming && !isPanning) {
63574           return;
63575         }
63576         if (!_gesture) {
63577           _gesture = isZooming ? "zoom" : "pan";
63578         }
63579         var tMini = projection2.transform();
63580         var tX, tY, scale;
63581         if (_gesture === "zoom") {
63582           scale = k2 / tMini.k;
63583           tX = (_cMini[0] / scale - _cMini[0]) * scale;
63584           tY = (_cMini[1] / scale - _cMini[1]) * scale;
63585         } else {
63586           k2 = tMini.k;
63587           scale = 1;
63588           tX = x2 - tMini.x;
63589           tY = y2 - tMini.y;
63590         }
63591         utilSetTransform(tiles, tX, tY, scale);
63592         utilSetTransform(viewport, 0, 0, scale);
63593         _isTransformed = true;
63594         _tCurr = identity2.translate(x2, y2).scale(k2);
63595         var zMain = geoScaleToZoom(context.projection.scale());
63596         var zMini = geoScaleToZoom(k2);
63597         _zDiff = zMain - zMini;
63598         queueRedraw();
63599       }
63600       function zoomEnded() {
63601         if (_skipEvents) return;
63602         if (_gesture !== "pan") return;
63603         updateProjection();
63604         _gesture = null;
63605         context.map().center(projection2.invert(_cMini));
63606       }
63607       function updateProjection() {
63608         var loc = context.map().center();
63609         var tMain = context.projection.transform();
63610         var zMain = geoScaleToZoom(tMain.k);
63611         var zMini = Math.max(zMain - _zDiff, 0.5);
63612         var kMini = geoZoomToScale(zMini);
63613         projection2.translate([tMain.x, tMain.y]).scale(kMini);
63614         var point = projection2(loc);
63615         var mouse = _gesture === "pan" ? geoVecSubtract([_tCurr.x, _tCurr.y], [_tStart.x, _tStart.y]) : [0, 0];
63616         var xMini = _cMini[0] - point[0] + tMain.x + mouse[0];
63617         var yMini = _cMini[1] - point[1] + tMain.y + mouse[1];
63618         projection2.translate([xMini, yMini]).clipExtent([[0, 0], _dMini]);
63619         _tCurr = projection2.transform();
63620         if (_isTransformed) {
63621           utilSetTransform(tiles, 0, 0);
63622           utilSetTransform(viewport, 0, 0);
63623           _isTransformed = false;
63624         }
63625         zoom.scaleExtent([geoZoomToScale(0.5), geoZoomToScale(zMain - 3)]);
63626         _skipEvents = true;
63627         wrap2.call(zoom.transform, _tCurr);
63628         _skipEvents = false;
63629       }
63630       function redraw() {
63631         clearTimeout(_timeoutID);
63632         if (_isHidden) return;
63633         updateProjection();
63634         var zMini = geoScaleToZoom(projection2.scale());
63635         tiles = wrap2.selectAll(".map-in-map-tiles").data([0]);
63636         tiles = tiles.enter().append("div").attr("class", "map-in-map-tiles").merge(tiles);
63637         backgroundLayer.source(context.background().baseLayerSource()).projection(projection2).dimensions(_dMini);
63638         var background = tiles.selectAll(".map-in-map-background").data([0]);
63639         background.enter().append("div").attr("class", "map-in-map-background").merge(background).call(backgroundLayer);
63640         var overlaySources = context.background().overlayLayerSources();
63641         var activeOverlayLayers = [];
63642         for (var i3 = 0; i3 < overlaySources.length; i3++) {
63643           if (overlaySources[i3].validZoom(zMini)) {
63644             if (!overlayLayers[i3]) overlayLayers[i3] = rendererTileLayer(context);
63645             activeOverlayLayers.push(overlayLayers[i3].source(overlaySources[i3]).projection(projection2).dimensions(_dMini));
63646           }
63647         }
63648         var overlay = tiles.selectAll(".map-in-map-overlay").data([0]);
63649         overlay = overlay.enter().append("div").attr("class", "map-in-map-overlay").merge(overlay);
63650         var overlays = overlay.selectAll("div").data(activeOverlayLayers, function(d2) {
63651           return d2.source().name();
63652         });
63653         overlays.exit().remove();
63654         overlays = overlays.enter().append("div").merge(overlays).each(function(layer) {
63655           select_default2(this).call(layer);
63656         });
63657         var dataLayers = tiles.selectAll(".map-in-map-data").data([0]);
63658         dataLayers.exit().remove();
63659         dataLayers = dataLayers.enter().append("svg").attr("class", "map-in-map-data").merge(dataLayers).call(dataLayer).call(debugLayer);
63660         if (_gesture !== "pan") {
63661           var getPath = path_default(projection2);
63662           var bbox2 = { type: "Polygon", coordinates: [context.map().extent().polygon()] };
63663           viewport = wrap2.selectAll(".map-in-map-viewport").data([0]);
63664           viewport = viewport.enter().append("svg").attr("class", "map-in-map-viewport").merge(viewport);
63665           var path = viewport.selectAll(".map-in-map-bbox").data([bbox2]);
63666           path.enter().append("path").attr("class", "map-in-map-bbox").merge(path).attr("d", getPath).classed("thick", function(d2) {
63667             return getPath.area(d2) < 30;
63668           });
63669         }
63670       }
63671       function queueRedraw() {
63672         clearTimeout(_timeoutID);
63673         _timeoutID = setTimeout(function() {
63674           redraw();
63675         }, 750);
63676       }
63677       function toggle(d3_event) {
63678         if (d3_event) d3_event.preventDefault();
63679         _isHidden = !_isHidden;
63680         context.container().select(".minimap-toggle-item").classed("active", !_isHidden).select("input").property("checked", !_isHidden);
63681         if (_isHidden) {
63682           wrap2.style("display", "block").style("opacity", "1").transition().duration(200).style("opacity", "0").on("end", function() {
63683             selection2.selectAll(".map-in-map").style("display", "none");
63684           });
63685         } else {
63686           wrap2.style("display", "block").style("opacity", "0").transition().duration(200).style("opacity", "1").on("end", function() {
63687             redraw();
63688           });
63689         }
63690       }
63691       uiMapInMap.toggle = toggle;
63692       wrap2 = selection2.selectAll(".map-in-map").data([0]);
63693       wrap2 = wrap2.enter().append("div").attr("class", "map-in-map").style("display", _isHidden ? "none" : "block").call(zoom).on("dblclick.zoom", null).merge(wrap2);
63694       _dMini = [200, 150];
63695       _cMini = geoVecScale(_dMini, 0.5);
63696       context.map().on("drawn.map-in-map", function(drawn) {
63697         if (drawn.full === true) {
63698           redraw();
63699         }
63700       });
63701       redraw();
63702       context.keybinding().on(_t("background.minimap.key"), toggle);
63703     }
63704     return mapInMap;
63705   }
63706
63707   // modules/ui/notice.js
63708   function uiNotice(context) {
63709     return function(selection2) {
63710       var div = selection2.append("div").attr("class", "notice");
63711       var button = div.append("button").attr("class", "zoom-to notice fillD").on("click", function() {
63712         context.map().zoomEase(context.minEditableZoom());
63713       }).on("wheel", function(d3_event) {
63714         var e22 = new WheelEvent(d3_event.type, d3_event);
63715         context.surface().node().dispatchEvent(e22);
63716       });
63717       button.call(svgIcon("#iD-icon-plus", "pre-text")).append("span").attr("class", "label").call(_t.append("zoom_in_edit"));
63718       function disableTooHigh() {
63719         var canEdit = context.map().zoom() >= context.minEditableZoom();
63720         div.style("display", canEdit ? "none" : "block");
63721       }
63722       context.map().on("move.notice", debounce_default(disableTooHigh, 500));
63723       disableTooHigh();
63724     };
63725   }
63726
63727   // modules/ui/photoviewer.js
63728   function uiPhotoviewer(context) {
63729     var dispatch14 = dispatch_default("resize");
63730     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
63731     function photoviewer(selection2) {
63732       selection2.append("button").attr("class", "thumb-hide").attr("title", _t("icons.close")).on("click", function() {
63733         if (services.streetside) {
63734           services.streetside.hideViewer(context);
63735         }
63736         if (services.mapillary) {
63737           services.mapillary.hideViewer(context);
63738         }
63739         if (services.kartaview) {
63740           services.kartaview.hideViewer(context);
63741         }
63742         if (services.mapilio) {
63743           services.mapilio.hideViewer(context);
63744         }
63745         if (services.panoramax) {
63746           services.panoramax.hideViewer(context);
63747         }
63748         if (services.vegbilder) {
63749           services.vegbilder.hideViewer(context);
63750         }
63751       }).append("div").call(svgIcon("#iD-icon-close"));
63752       function preventDefault(d3_event) {
63753         d3_event.preventDefault();
63754       }
63755       selection2.append("button").attr("class", "resize-handle-xy").on("touchstart touchdown touchend", preventDefault).on(
63756         _pointerPrefix + "down",
63757         buildResizeListener(selection2, "resize", dispatch14, { resizeOnX: true, resizeOnY: true })
63758       );
63759       selection2.append("button").attr("class", "resize-handle-x").on("touchstart touchdown touchend", preventDefault).on(
63760         _pointerPrefix + "down",
63761         buildResizeListener(selection2, "resize", dispatch14, { resizeOnX: true })
63762       );
63763       selection2.append("button").attr("class", "resize-handle-y").on("touchstart touchdown touchend", preventDefault).on(
63764         _pointerPrefix + "down",
63765         buildResizeListener(selection2, "resize", dispatch14, { resizeOnY: true })
63766       );
63767       context.features().on("change.setPhotoFromViewer", function() {
63768         setPhotoFromViewerButton();
63769       });
63770       context.history().on("change.setPhotoFromViewer", function() {
63771         setPhotoFromViewerButton();
63772       });
63773       function setPhotoFromViewerButton() {
63774         if (services.mapillary.isViewerOpen()) {
63775           let setMapillaryPhotoId = function() {
63776             const service = services.mapillary;
63777             const image = service.getActiveImage();
63778             const action = (graph) => context.selectedIDs().reduce((graph2, entityID) => {
63779               const tags = graph2.entity(entityID).tags;
63780               const action2 = actionChangeTags(entityID, { ...tags, mapillary: image.id });
63781               return action2(graph2);
63782             }, graph);
63783             const annotation = _t("operations.change_tags.annotation");
63784             context.perform(action, annotation);
63785           };
63786           if (context.mode().id !== "select" || !(layerStatus("mapillary") && getServiceId() === "mapillary")) {
63787             buttonRemove();
63788           } else {
63789             if (selection2.select(".set-photo-from-viewer").empty()) {
63790               const button = buttonCreate();
63791               button.on("click", function(e3) {
63792                 e3.preventDefault();
63793                 e3.stopPropagation();
63794                 setMapillaryPhotoId();
63795                 buttonDisable("already_set");
63796               });
63797             }
63798             buttonShowHide();
63799           }
63800         }
63801         function layerStatus(which) {
63802           const layers = context.layers();
63803           const layer = layers.layer(which);
63804           return layer.enabled();
63805         }
63806         function getServiceId() {
63807           const hash = utilStringQs(window.location.hash);
63808           let serviceId;
63809           if (hash.photo) {
63810             let result = hash.photo.split("/");
63811             serviceId = result[0];
63812           }
63813           return serviceId;
63814         }
63815         function buttonCreate() {
63816           const button = selection2.selectAll(".set-photo-from-viewer").data([0]);
63817           const buttonEnter = button.enter().append("button").attr("class", "set-photo-from-viewer").call(svgIcon("#iD-icon-plus")).call(
63818             uiTooltip().title(() => _t.append("inspector.set_photo_from_viewer")).placement("right")
63819           );
63820           buttonEnter.select(".tooltip").classed("dark", true).style("width", "300px");
63821           return buttonEnter;
63822         }
63823         function buttonRemove() {
63824           const button = selection2.selectAll(".set-photo-from-viewer").data([0]);
63825           button.remove();
63826         }
63827         function buttonShowHide() {
63828           const activeImage = services.mapillary.getActiveImage();
63829           const graph = context.graph();
63830           const entities = context.selectedIDs().map((id2) => graph.entity(id2));
63831           if (entities.map((entity) => entity.tags.mapillary).every((value) => value === (activeImage == null ? void 0 : activeImage.id))) {
63832             buttonDisable("already_set");
63833           } else if (activeImage && entities.map((entity) => entity.extent().center()).every((loc) => geoSphericalDistance(loc, activeImage.loc) > 100)) {
63834             buttonDisable("too_far");
63835           } else {
63836             buttonDisable(false);
63837           }
63838         }
63839         function buttonDisable(reason) {
63840           const disabled = reason !== false;
63841           const button = selection2.selectAll(".set-photo-from-viewer").data([0]);
63842           button.attr("disabled", disabled ? "true" : null);
63843           button.classed("disabled", disabled);
63844           button.call(uiTooltip().destroyAny);
63845           if (disabled) {
63846             button.call(
63847               uiTooltip().title(() => _t.append("inspector.set_photo_from_viewer.disable.".concat(reason))).placement("right")
63848             );
63849           } else {
63850             button.call(
63851               uiTooltip().title(() => _t.append("inspector.set_photo_from_viewer.enable")).placement("right")
63852             );
63853           }
63854           button.select(".tooltip").classed("dark", true).style("width", "300px");
63855         }
63856       }
63857       function buildResizeListener(target, eventName, dispatch15, options2) {
63858         var resizeOnX = !!options2.resizeOnX;
63859         var resizeOnY = !!options2.resizeOnY;
63860         var minHeight = options2.minHeight || 240;
63861         var minWidth = options2.minWidth || 320;
63862         var pointerId;
63863         var startX;
63864         var startY;
63865         var startWidth;
63866         var startHeight;
63867         function startResize(d3_event) {
63868           if (pointerId !== (d3_event.pointerId || "mouse")) return;
63869           d3_event.preventDefault();
63870           d3_event.stopPropagation();
63871           var mapSize = context.map().dimensions();
63872           if (resizeOnX) {
63873             var maxWidth = mapSize[0];
63874             var newWidth = clamp3(startWidth + d3_event.clientX - startX, minWidth, maxWidth);
63875             target.style("width", newWidth + "px");
63876           }
63877           if (resizeOnY) {
63878             var maxHeight = mapSize[1] - 90;
63879             var newHeight = clamp3(startHeight + startY - d3_event.clientY, minHeight, maxHeight);
63880             target.style("height", newHeight + "px");
63881           }
63882           dispatch15.call(eventName, target, subtractPadding(utilGetDimensions(target, true), target));
63883         }
63884         function clamp3(num, min3, max3) {
63885           return Math.max(min3, Math.min(num, max3));
63886         }
63887         function stopResize(d3_event) {
63888           if (pointerId !== (d3_event.pointerId || "mouse")) return;
63889           d3_event.preventDefault();
63890           d3_event.stopPropagation();
63891           select_default2(window).on("." + eventName, null);
63892         }
63893         return function initResize(d3_event) {
63894           d3_event.preventDefault();
63895           d3_event.stopPropagation();
63896           pointerId = d3_event.pointerId || "mouse";
63897           startX = d3_event.clientX;
63898           startY = d3_event.clientY;
63899           var targetRect = target.node().getBoundingClientRect();
63900           startWidth = targetRect.width;
63901           startHeight = targetRect.height;
63902           select_default2(window).on(_pointerPrefix + "move." + eventName, startResize, false).on(_pointerPrefix + "up." + eventName, stopResize, false);
63903           if (_pointerPrefix === "pointer") {
63904             select_default2(window).on("pointercancel." + eventName, stopResize, false);
63905           }
63906         };
63907       }
63908     }
63909     photoviewer.onMapResize = function() {
63910       var photoviewer2 = context.container().select(".photoviewer");
63911       var content = context.container().select(".main-content");
63912       var mapDimensions = utilGetDimensions(content, true);
63913       var photoDimensions = utilGetDimensions(photoviewer2, true);
63914       if (photoDimensions[0] > mapDimensions[0] || photoDimensions[1] > mapDimensions[1] - 90) {
63915         var setPhotoDimensions = [
63916           Math.min(photoDimensions[0], mapDimensions[0]),
63917           Math.min(photoDimensions[1], mapDimensions[1] - 90)
63918         ];
63919         photoviewer2.style("width", setPhotoDimensions[0] + "px").style("height", setPhotoDimensions[1] + "px");
63920         dispatch14.call("resize", photoviewer2, subtractPadding(setPhotoDimensions, photoviewer2));
63921       }
63922     };
63923     function subtractPadding(dimensions, selection2) {
63924       return [
63925         dimensions[0] - parseFloat(selection2.style("padding-left")) - parseFloat(selection2.style("padding-right")),
63926         dimensions[1] - parseFloat(selection2.style("padding-top")) - parseFloat(selection2.style("padding-bottom"))
63927       ];
63928     }
63929     return utilRebind(photoviewer, dispatch14, "on");
63930   }
63931
63932   // modules/ui/restore.js
63933   function uiRestore(context) {
63934     return function(selection2) {
63935       if (!context.history().hasRestorableChanges()) return;
63936       let modalSelection = uiModal(selection2, true);
63937       modalSelection.select(".modal").attr("class", "modal fillL");
63938       let introModal = modalSelection.select(".content");
63939       introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("restore.heading"));
63940       introModal.append("div").attr("class", "modal-section").append("p").call(_t.append("restore.description"));
63941       let buttonWrap = introModal.append("div").attr("class", "modal-actions");
63942       let restore = buttonWrap.append("button").attr("class", "restore").on("click", () => {
63943         context.history().restore();
63944         modalSelection.remove();
63945       });
63946       restore.append("svg").attr("class", "logo logo-restore").append("use").attr("xlink:href", "#iD-logo-restore");
63947       restore.append("div").call(_t.append("restore.restore"));
63948       let reset = buttonWrap.append("button").attr("class", "reset").on("click", () => {
63949         context.history().clearSaved();
63950         modalSelection.remove();
63951       });
63952       reset.append("svg").attr("class", "logo logo-reset").append("use").attr("xlink:href", "#iD-logo-reset");
63953       reset.append("div").call(_t.append("restore.reset"));
63954       restore.node().focus();
63955     };
63956   }
63957
63958   // modules/ui/scale.js
63959   function uiScale(context) {
63960     var projection2 = context.projection, isImperial = !_mainLocalizer.usesMetric(), maxLength = 180, tickHeight = 8;
63961     function scaleDefs(loc1, loc2) {
63962       var lat = (loc2[1] + loc1[1]) / 2, conversion = isImperial ? 3.28084 : 1, dist = geoLonToMeters(loc2[0] - loc1[0], lat) * conversion, scale = { dist: 0, px: 0, text: "" }, buckets, i3, val, dLon;
63963       if (isImperial) {
63964         buckets = [528e4, 528e3, 52800, 5280, 500, 50, 5, 1];
63965       } else {
63966         buckets = [5e6, 5e5, 5e4, 5e3, 500, 50, 5, 1];
63967       }
63968       for (i3 = 0; i3 < buckets.length; i3++) {
63969         val = buckets[i3];
63970         if (dist >= val) {
63971           scale.dist = Math.floor(dist / val) * val;
63972           break;
63973         } else {
63974           scale.dist = +dist.toFixed(2);
63975         }
63976       }
63977       dLon = geoMetersToLon(scale.dist / conversion, lat);
63978       scale.px = Math.round(projection2([loc1[0] + dLon, loc1[1]])[0]);
63979       scale.text = displayLength(scale.dist / conversion, isImperial);
63980       return scale;
63981     }
63982     function update(selection2) {
63983       var dims = context.map().dimensions(), loc1 = projection2.invert([0, dims[1]]), loc2 = projection2.invert([maxLength, dims[1]]), scale = scaleDefs(loc1, loc2);
63984       selection2.select(".scale-path").attr("d", "M0.5,0.5v" + tickHeight + "h" + scale.px + "v-" + tickHeight);
63985       selection2.select(".scale-text").style(_mainLocalizer.textDirection() === "ltr" ? "left" : "right", scale.px + 16 + "px").text(scale.text);
63986     }
63987     return function(selection2) {
63988       function switchUnits() {
63989         isImperial = !isImperial;
63990         selection2.call(update);
63991       }
63992       var scalegroup = selection2.append("svg").attr("class", "scale").on("click", switchUnits).append("g").attr("transform", "translate(10,11)");
63993       scalegroup.append("path").attr("class", "scale-path");
63994       selection2.append("div").attr("class", "scale-text");
63995       selection2.call(update);
63996       context.map().on("move.scale", function() {
63997         update(selection2);
63998       });
63999     };
64000   }
64001
64002   // modules/ui/shortcuts.js
64003   function uiShortcuts(context) {
64004     var detected = utilDetect();
64005     var _activeTab = 0;
64006     var _modalSelection;
64007     var _selection = select_default2(null);
64008     var _dataShortcuts;
64009     function shortcutsModal(_modalSelection2) {
64010       _modalSelection2.select(".modal").classed("modal-shortcuts", true);
64011       var content = _modalSelection2.select(".content");
64012       content.append("div").attr("class", "modal-section header").append("h2").call(_t.append("shortcuts.title"));
64013       _mainFileFetcher.get("shortcuts").then(function(data) {
64014         _dataShortcuts = data;
64015         content.call(render);
64016       }).catch(function() {
64017       });
64018     }
64019     function render(selection2) {
64020       if (!_dataShortcuts) return;
64021       var wrapper = selection2.selectAll(".wrapper").data([0]);
64022       var wrapperEnter = wrapper.enter().append("div").attr("class", "wrapper modal-section");
64023       var tabsBar = wrapperEnter.append("div").attr("class", "tabs-bar");
64024       var shortcutsList = wrapperEnter.append("div").attr("class", "shortcuts-list");
64025       wrapper = wrapper.merge(wrapperEnter);
64026       var tabs = tabsBar.selectAll(".tab").data(_dataShortcuts);
64027       var tabsEnter = tabs.enter().append("a").attr("class", "tab").attr("href", "#").on("click", function(d3_event, d2) {
64028         d3_event.preventDefault();
64029         var i3 = _dataShortcuts.indexOf(d2);
64030         _activeTab = i3;
64031         render(selection2);
64032       });
64033       tabsEnter.append("span").html(function(d2) {
64034         return _t.html(d2.text);
64035       });
64036       wrapper.selectAll(".tab").classed("active", function(d2, i3) {
64037         return i3 === _activeTab;
64038       });
64039       var shortcuts = shortcutsList.selectAll(".shortcut-tab").data(_dataShortcuts);
64040       var shortcutsEnter = shortcuts.enter().append("div").attr("class", function(d2) {
64041         return "shortcut-tab shortcut-tab-" + d2.tab;
64042       });
64043       var columnsEnter = shortcutsEnter.selectAll(".shortcut-column").data(function(d2) {
64044         return d2.columns;
64045       }).enter().append("table").attr("class", "shortcut-column");
64046       var rowsEnter = columnsEnter.selectAll(".shortcut-row").data(function(d2) {
64047         return d2.rows;
64048       }).enter().append("tr").attr("class", "shortcut-row");
64049       var sectionRows = rowsEnter.filter(function(d2) {
64050         return !d2.shortcuts;
64051       });
64052       sectionRows.append("td");
64053       sectionRows.append("td").attr("class", "shortcut-section").append("h3").html(function(d2) {
64054         return _t.html(d2.text);
64055       });
64056       var shortcutRows = rowsEnter.filter(function(d2) {
64057         return d2.shortcuts;
64058       });
64059       var shortcutKeys = shortcutRows.append("td").attr("class", "shortcut-keys");
64060       var modifierKeys = shortcutKeys.filter(function(d2) {
64061         return d2.modifiers;
64062       });
64063       modifierKeys.selectAll("kbd.modifier").data(function(d2) {
64064         if (detected.os === "win" && d2.text === "shortcuts.editing.commands.redo") {
64065           return ["\u2318"];
64066         } else if (detected.os !== "mac" && d2.text === "shortcuts.browsing.display_options.fullscreen") {
64067           return [];
64068         } else {
64069           return d2.modifiers;
64070         }
64071       }).enter().each(function() {
64072         var selection3 = select_default2(this);
64073         selection3.append("kbd").attr("class", "modifier").text(function(d2) {
64074           return uiCmd.display(d2);
64075         });
64076         selection3.append("span").text("+");
64077       });
64078       shortcutKeys.selectAll("kbd.shortcut").data(function(d2) {
64079         var arr = d2.shortcuts;
64080         if (detected.os === "win" && d2.text === "shortcuts.editing.commands.redo") {
64081           arr = ["Y"];
64082         } else if (detected.os !== "mac" && d2.text === "shortcuts.browsing.display_options.fullscreen") {
64083           arr = ["F11"];
64084         }
64085         arr = arr.map(function(s2) {
64086           return uiCmd.display(s2.indexOf(".") !== -1 ? _t(s2) : s2);
64087         });
64088         return utilArrayUniq(arr).map(function(s2) {
64089           return {
64090             shortcut: s2,
64091             separator: d2.separator,
64092             suffix: d2.suffix
64093           };
64094         });
64095       }).enter().each(function(d2, i3, nodes) {
64096         var selection3 = select_default2(this);
64097         var click = d2.shortcut.toLowerCase().match(/(.*).click/);
64098         if (click && click[1]) {
64099           selection3.call(svgIcon("#iD-walkthrough-mouse-" + click[1], "operation"));
64100         } else if (d2.shortcut.toLowerCase() === "long-press") {
64101           selection3.call(svgIcon("#iD-walkthrough-longpress", "longpress operation"));
64102         } else if (d2.shortcut.toLowerCase() === "tap") {
64103           selection3.call(svgIcon("#iD-walkthrough-tap", "tap operation"));
64104         } else {
64105           selection3.append("kbd").attr("class", "shortcut").text(function(d4) {
64106             return d4.shortcut;
64107           });
64108         }
64109         if (i3 < nodes.length - 1) {
64110           selection3.append("span").html(d2.separator || "\xA0" + _t.html("shortcuts.or") + "\xA0");
64111         } else if (i3 === nodes.length - 1 && d2.suffix) {
64112           selection3.append("span").text(d2.suffix);
64113         }
64114       });
64115       shortcutKeys.filter(function(d2) {
64116         return d2.gesture;
64117       }).each(function() {
64118         var selection3 = select_default2(this);
64119         selection3.append("span").text("+");
64120         selection3.append("span").attr("class", "gesture").html(function(d2) {
64121           return _t.html(d2.gesture);
64122         });
64123       });
64124       shortcutRows.append("td").attr("class", "shortcut-desc").html(function(d2) {
64125         return d2.text ? _t.html(d2.text) : "\xA0";
64126       });
64127       wrapper.selectAll(".shortcut-tab").style("display", function(d2, i3) {
64128         return i3 === _activeTab ? "flex" : "none";
64129       });
64130     }
64131     return function(selection2, show) {
64132       _selection = selection2;
64133       if (show) {
64134         _modalSelection = uiModal(selection2);
64135         _modalSelection.call(shortcutsModal);
64136       } else {
64137         context.keybinding().on([_t("shortcuts.toggle.key"), "?"], function() {
64138           if (context.container().selectAll(".modal-shortcuts").size()) {
64139             if (_modalSelection) {
64140               _modalSelection.close();
64141               _modalSelection = null;
64142             }
64143           } else {
64144             _modalSelection = uiModal(_selection);
64145             _modalSelection.call(shortcutsModal);
64146           }
64147         });
64148       }
64149     };
64150   }
64151
64152   // modules/ui/data_header.js
64153   function uiDataHeader() {
64154     var _datum;
64155     function dataHeader(selection2) {
64156       var header = selection2.selectAll(".data-header").data(
64157         _datum ? [_datum] : [],
64158         function(d2) {
64159           return d2.__featurehash__;
64160         }
64161       );
64162       header.exit().remove();
64163       var headerEnter = header.enter().append("div").attr("class", "data-header");
64164       var iconEnter = headerEnter.append("div").attr("class", "data-header-icon");
64165       iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-data", "note-fill"));
64166       headerEnter.append("div").attr("class", "data-header-label").call(_t.append("map_data.layers.custom.title"));
64167     }
64168     dataHeader.datum = function(val) {
64169       if (!arguments.length) return _datum;
64170       _datum = val;
64171       return this;
64172     };
64173     return dataHeader;
64174   }
64175
64176   // modules/ui/disclosure.js
64177   function uiDisclosure(context, key, expandedDefault) {
64178     var dispatch14 = dispatch_default("toggled");
64179     var _expanded;
64180     var _label = utilFunctor("");
64181     var _updatePreference = true;
64182     var _content = function() {
64183     };
64184     var disclosure = function(selection2) {
64185       if (_expanded === void 0 || _expanded === null) {
64186         var preference = corePreferences("disclosure." + key + ".expanded");
64187         _expanded = preference === null ? !!expandedDefault : preference === "true";
64188       }
64189       var hideToggle = selection2.selectAll(".hide-toggle-" + key).data([0]);
64190       var hideToggleEnter = hideToggle.enter().append("h3").append("a").attr("role", "button").attr("href", "#").attr("class", "hide-toggle hide-toggle-" + key).call(svgIcon("", "pre-text", "hide-toggle-icon"));
64191       hideToggleEnter.append("span").attr("class", "hide-toggle-text");
64192       hideToggle = hideToggleEnter.merge(hideToggle);
64193       hideToggle.on("click", toggle).attr("title", _t("icons.".concat(_expanded ? "collapse" : "expand"))).attr("aria-expanded", _expanded).classed("expanded", _expanded);
64194       const label = _label();
64195       const labelSelection = hideToggle.selectAll(".hide-toggle-text");
64196       if (typeof label !== "function") {
64197         labelSelection.text(_label());
64198       } else {
64199         labelSelection.text("").call(label);
64200       }
64201       hideToggle.selectAll(".hide-toggle-icon").attr(
64202         "xlink:href",
64203         _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward"
64204       );
64205       var wrap2 = selection2.selectAll(".disclosure-wrap").data([0]);
64206       wrap2 = wrap2.enter().append("div").attr("class", "disclosure-wrap disclosure-wrap-" + key).merge(wrap2).classed("hide", !_expanded);
64207       if (_expanded) {
64208         wrap2.call(_content);
64209       }
64210       function toggle(d3_event) {
64211         d3_event.preventDefault();
64212         _expanded = !_expanded;
64213         if (_updatePreference) {
64214           corePreferences("disclosure." + key + ".expanded", _expanded);
64215         }
64216         hideToggle.classed("expanded", _expanded).attr("aria-expanded", _expanded).attr("title", _t("icons.".concat(_expanded ? "collapse" : "expand")));
64217         hideToggle.selectAll(".hide-toggle-icon").attr(
64218           "xlink:href",
64219           _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward"
64220         );
64221         wrap2.call(uiToggle(_expanded));
64222         if (_expanded) {
64223           wrap2.call(_content);
64224         }
64225         dispatch14.call("toggled", this, _expanded);
64226       }
64227     };
64228     disclosure.label = function(val) {
64229       if (!arguments.length) return _label;
64230       _label = utilFunctor(val);
64231       return disclosure;
64232     };
64233     disclosure.expanded = function(val) {
64234       if (!arguments.length) return _expanded;
64235       _expanded = val;
64236       return disclosure;
64237     };
64238     disclosure.updatePreference = function(val) {
64239       if (!arguments.length) return _updatePreference;
64240       _updatePreference = val;
64241       return disclosure;
64242     };
64243     disclosure.content = function(val) {
64244       if (!arguments.length) return _content;
64245       _content = val;
64246       return disclosure;
64247     };
64248     return utilRebind(disclosure, dispatch14, "on");
64249   }
64250
64251   // modules/ui/section.js
64252   function uiSection(id2, context) {
64253     var _classes = utilFunctor("");
64254     var _shouldDisplay;
64255     var _content;
64256     var _disclosure;
64257     var _label;
64258     var _expandedByDefault = utilFunctor(true);
64259     var _disclosureContent;
64260     var _disclosureExpanded;
64261     var _containerSelection = select_default2(null);
64262     var section = {
64263       id: id2
64264     };
64265     section.classes = function(val) {
64266       if (!arguments.length) return _classes;
64267       _classes = utilFunctor(val);
64268       return section;
64269     };
64270     section.label = function(val) {
64271       if (!arguments.length) return _label;
64272       _label = utilFunctor(val);
64273       return section;
64274     };
64275     section.expandedByDefault = function(val) {
64276       if (!arguments.length) return _expandedByDefault;
64277       _expandedByDefault = utilFunctor(val);
64278       return section;
64279     };
64280     section.shouldDisplay = function(val) {
64281       if (!arguments.length) return _shouldDisplay;
64282       _shouldDisplay = utilFunctor(val);
64283       return section;
64284     };
64285     section.content = function(val) {
64286       if (!arguments.length) return _content;
64287       _content = val;
64288       return section;
64289     };
64290     section.disclosureContent = function(val) {
64291       if (!arguments.length) return _disclosureContent;
64292       _disclosureContent = val;
64293       return section;
64294     };
64295     section.disclosureExpanded = function(val) {
64296       if (!arguments.length) return _disclosureExpanded;
64297       _disclosureExpanded = val;
64298       return section;
64299     };
64300     section.render = function(selection2) {
64301       _containerSelection = selection2.selectAll(".section-" + id2).data([0]);
64302       var sectionEnter = _containerSelection.enter().append("div").attr("class", "section section-" + id2 + " " + (_classes && _classes() || ""));
64303       _containerSelection = sectionEnter.merge(_containerSelection);
64304       _containerSelection.call(renderContent);
64305     };
64306     section.reRender = function() {
64307       _containerSelection.call(renderContent);
64308     };
64309     section.selection = function() {
64310       return _containerSelection;
64311     };
64312     section.disclosure = function() {
64313       return _disclosure;
64314     };
64315     function renderContent(selection2) {
64316       if (_shouldDisplay) {
64317         var shouldDisplay = _shouldDisplay();
64318         selection2.classed("hide", !shouldDisplay);
64319         if (!shouldDisplay) {
64320           selection2.html("");
64321           return;
64322         }
64323       }
64324       if (_disclosureContent) {
64325         if (!_disclosure) {
64326           _disclosure = uiDisclosure(context, id2.replace(/-/g, "_"), _expandedByDefault()).label(_label || "").content(_disclosureContent);
64327         }
64328         if (_disclosureExpanded !== void 0) {
64329           _disclosure.expanded(_disclosureExpanded);
64330           _disclosureExpanded = void 0;
64331         }
64332         selection2.call(_disclosure);
64333         return;
64334       }
64335       if (_content) {
64336         selection2.call(_content);
64337       }
64338     }
64339     return section;
64340   }
64341
64342   // modules/ui/tag_reference.js
64343   function uiTagReference(what) {
64344     var wikibase = what.qid ? services.wikidata : services.osmWikibase;
64345     var tagReference = {};
64346     var _button = select_default2(null);
64347     var _body = select_default2(null);
64348     var _loaded;
64349     var _showing;
64350     function load() {
64351       if (!wikibase) return;
64352       _button.classed("tag-reference-loading", true);
64353       wikibase.getDocs(what, gotDocs);
64354     }
64355     function gotDocs(err, docs) {
64356       _body.html("");
64357       if (!docs || !docs.title) {
64358         _body.append("p").attr("class", "tag-reference-description").call(_t.append("inspector.no_documentation_key"));
64359         done();
64360         return;
64361       }
64362       if (docs.imageURL) {
64363         _body.append("img").attr("class", "tag-reference-wiki-image").attr("alt", docs.description).attr("src", docs.imageURL).on("load", function() {
64364           done();
64365         }).on("error", function() {
64366           select_default2(this).remove();
64367           done();
64368         });
64369       } else {
64370         done();
64371       }
64372       var tagReferenceDescription = _body.append("p").attr("class", "tag-reference-description").append("span");
64373       if (docs.description) {
64374         tagReferenceDescription = tagReferenceDescription.attr("class", "localized-text").attr("lang", docs.descriptionLocaleCode || "und").text(docs.description);
64375       } else {
64376         tagReferenceDescription = tagReferenceDescription.call(_t.append("inspector.no_documentation_key"));
64377       }
64378       tagReferenceDescription.append("a").attr("class", "tag-reference-edit").attr("target", "_blank").attr("title", _t("inspector.edit_reference")).attr("href", docs.editURL).call(svgIcon("#iD-icon-edit", "inline"));
64379       if (docs.wiki) {
64380         _body.append("a").attr("class", "tag-reference-link").attr("target", "_blank").attr("href", docs.wiki.url).call(svgIcon("#iD-icon-out-link", "inline")).append("span").call(_t.append(docs.wiki.text));
64381       }
64382       if (what.key === "comment") {
64383         _body.append("a").attr("class", "tag-reference-comment-link").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).attr("href", _t("commit.about_changeset_comments_link")).append("span").call(_t.append("commit.about_changeset_comments"));
64384       }
64385     }
64386     function done() {
64387       _loaded = true;
64388       _button.classed("tag-reference-loading", false);
64389       _body.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1");
64390       _showing = true;
64391       _button.selectAll("svg.icon use").each(function() {
64392         var iconUse = select_default2(this);
64393         if (iconUse.attr("href") === "#iD-icon-info") {
64394           iconUse.attr("href", "#iD-icon-info-filled");
64395         }
64396       });
64397     }
64398     function hide() {
64399       _body.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
64400         _body.classed("expanded", false);
64401       });
64402       _showing = false;
64403       _button.selectAll("svg.icon use").each(function() {
64404         var iconUse = select_default2(this);
64405         if (iconUse.attr("href") === "#iD-icon-info-filled") {
64406           iconUse.attr("href", "#iD-icon-info");
64407         }
64408       });
64409     }
64410     tagReference.button = function(selection2, klass, iconName) {
64411       _button = selection2.selectAll(".tag-reference-button").data([0]);
64412       _button = _button.enter().append("button").attr("class", "tag-reference-button " + (klass || "")).attr("title", _t("icons.information")).call(svgIcon("#iD-icon-" + (iconName || "inspect"))).merge(_button);
64413       _button.on("click", function(d3_event) {
64414         d3_event.stopPropagation();
64415         d3_event.preventDefault();
64416         this.blur();
64417         if (_showing) {
64418           hide();
64419         } else if (_loaded) {
64420           done();
64421         } else {
64422           load();
64423         }
64424       });
64425     };
64426     tagReference.body = function(selection2) {
64427       var itemID = what.qid || what.key + "-" + (what.value || "");
64428       _body = selection2.selectAll(".tag-reference-body").data([itemID], function(d2) {
64429         return d2;
64430       });
64431       _body.exit().remove();
64432       _body = _body.enter().append("div").attr("class", "tag-reference-body").style("max-height", "0").style("opacity", "0").merge(_body);
64433       if (_showing === false) {
64434         hide();
64435       }
64436     };
64437     tagReference.showing = function(val) {
64438       if (!arguments.length) return _showing;
64439       _showing = val;
64440       return tagReference;
64441     };
64442     return tagReference;
64443   }
64444
64445   // modules/ui/sections/raw_tag_editor.js
64446   function uiSectionRawTagEditor(id2, context) {
64447     var section = uiSection(id2, context).classes("raw-tag-editor").label(function() {
64448       var count = Object.keys(_tags).filter(function(d2) {
64449         return d2;
64450       }).length;
64451       return _t.append("inspector.title_count", { title: _t("inspector.tags"), count });
64452     }).expandedByDefault(false).disclosureContent(renderDisclosureContent);
64453     var taginfo = services.taginfo;
64454     var dispatch14 = dispatch_default("change");
64455     var availableViews = [
64456       { id: "list", icon: "#fas-th-list" },
64457       { id: "text", icon: "#fas-i-cursor" }
64458     ];
64459     let _discardTags = {};
64460     _mainFileFetcher.get("discarded").then((d2) => {
64461       _discardTags = d2;
64462     }).catch(() => {
64463     });
64464     var _tagView = corePreferences("raw-tag-editor-view") || "list";
64465     var _readOnlyTags = [];
64466     var _orderedKeys = [];
64467     var _showBlank = false;
64468     var _pendingChange = null;
64469     var _state;
64470     var _presets;
64471     var _tags;
64472     var _entityIDs;
64473     var _didInteract = false;
64474     function interacted() {
64475       _didInteract = true;
64476     }
64477     function renderDisclosureContent(wrap2) {
64478       _orderedKeys = _orderedKeys.filter(function(key) {
64479         return _tags[key] !== void 0;
64480       });
64481       var all = Object.keys(_tags).sort();
64482       var missingKeys = utilArrayDifference(all, _orderedKeys);
64483       for (var i3 in missingKeys) {
64484         _orderedKeys.push(missingKeys[i3]);
64485       }
64486       var rowData = _orderedKeys.map(function(key, i4) {
64487         return { index: i4, key, value: _tags[key] };
64488       });
64489       if (!rowData.length || _showBlank) {
64490         _showBlank = false;
64491         rowData.push({ index: rowData.length, key: "", value: "" });
64492       }
64493       var options2 = wrap2.selectAll(".raw-tag-options").data([0]);
64494       options2.exit().remove();
64495       var optionsEnter = options2.enter().insert("div", ":first-child").attr("class", "raw-tag-options").attr("role", "tablist");
64496       var optionEnter = optionsEnter.selectAll(".raw-tag-option").data(availableViews, function(d2) {
64497         return d2.id;
64498       }).enter();
64499       optionEnter.append("button").attr("class", function(d2) {
64500         return "raw-tag-option raw-tag-option-" + d2.id + (_tagView === d2.id ? " selected" : "");
64501       }).attr("aria-selected", function(d2) {
64502         return _tagView === d2.id;
64503       }).attr("role", "tab").attr("title", function(d2) {
64504         return _t("icons." + d2.id);
64505       }).on("click", function(d3_event, d2) {
64506         _tagView = d2.id;
64507         corePreferences("raw-tag-editor-view", d2.id);
64508         wrap2.selectAll(".raw-tag-option").classed("selected", function(datum2) {
64509           return datum2 === d2;
64510         }).attr("aria-selected", function(datum2) {
64511           return datum2 === d2;
64512         });
64513         wrap2.selectAll(".tag-text").classed("hide", d2.id !== "text").each(setTextareaHeight);
64514         wrap2.selectAll(".tag-list, .add-row").classed("hide", d2.id !== "list");
64515       }).each(function(d2) {
64516         select_default2(this).call(svgIcon(d2.icon));
64517       });
64518       var textData = rowsToText(rowData);
64519       var textarea = wrap2.selectAll(".tag-text").data([0]);
64520       textarea = textarea.enter().append("textarea").attr("class", "tag-text" + (_tagView !== "text" ? " hide" : "")).call(utilNoAuto).attr("placeholder", _t("inspector.key_value")).attr("spellcheck", "false").merge(textarea);
64521       textarea.call(utilGetSetValue, textData).each(setTextareaHeight).on("input", setTextareaHeight).on("focus", interacted).on("blur", textChanged).on("change", textChanged);
64522       var list2 = wrap2.selectAll(".tag-list").data([0]);
64523       list2 = list2.enter().append("ul").attr("class", "tag-list" + (_tagView !== "list" ? " hide" : "")).merge(list2);
64524       var addRowEnter = wrap2.selectAll(".add-row").data([0]).enter().append("div").attr("class", "add-row" + (_tagView !== "list" ? " hide" : ""));
64525       addRowEnter.append("button").attr("class", "add-tag").attr("aria-label", _t("inspector.add_to_tag")).call(svgIcon("#iD-icon-plus", "light")).call(uiTooltip().title(() => _t.append("inspector.add_to_tag")).placement(_mainLocalizer.textDirection() === "ltr" ? "right" : "left")).on("click", addTag);
64526       addRowEnter.append("div").attr("class", "space-value");
64527       addRowEnter.append("div").attr("class", "space-buttons");
64528       var items = list2.selectAll(".tag-row").data(rowData, function(d2) {
64529         return d2.key;
64530       });
64531       items.exit().each(unbind).remove();
64532       var itemsEnter = items.enter().append("li").attr("class", "tag-row").classed("readonly", isReadOnly);
64533       var innerWrap = itemsEnter.append("div").attr("class", "inner-wrap");
64534       innerWrap.append("div").attr("class", "key-wrap").append("input").property("type", "text").attr("class", "key").call(utilNoAuto).on("focus", interacted).on("blur", keyChange).on("change", keyChange);
64535       innerWrap.append("div").attr("class", "value-wrap").append("input").property("type", "text").attr("class", "value").call(utilNoAuto).on("focus", interacted).on("blur", valueChange).on("change", valueChange).on("keydown.push-more", pushMore);
64536       innerWrap.append("button").attr("class", "form-field-button remove").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
64537       items = items.merge(itemsEnter).sort(function(a2, b2) {
64538         return a2.index - b2.index;
64539       });
64540       items.each(function(d2) {
64541         var row = select_default2(this);
64542         var key = row.select("input.key");
64543         var value = row.select("input.value");
64544         if (_entityIDs && taginfo && _state !== "hover") {
64545           bindTypeahead(key, value);
64546         }
64547         var referenceOptions = { key: d2.key };
64548         if (typeof d2.value === "string") {
64549           referenceOptions.value = d2.value;
64550         }
64551         var reference = uiTagReference(referenceOptions, context);
64552         if (_state === "hover") {
64553           reference.showing(false);
64554         }
64555         row.select(".inner-wrap").call(reference.button);
64556         row.call(reference.body);
64557         row.select("button.remove");
64558       });
64559       items.selectAll("input.key").attr("title", function(d2) {
64560         return d2.key;
64561       }).call(utilGetSetValue, function(d2) {
64562         return d2.key;
64563       }).attr("readonly", function(d2) {
64564         return isReadOnly(d2) || null;
64565       });
64566       items.selectAll("input.value").attr("title", function(d2) {
64567         return Array.isArray(d2.value) ? d2.value.filter(Boolean).join("\n") : d2.value;
64568       }).classed("mixed", function(d2) {
64569         return Array.isArray(d2.value);
64570       }).attr("placeholder", function(d2) {
64571         return typeof d2.value === "string" ? null : _t("inspector.multiple_values");
64572       }).call(utilGetSetValue, function(d2) {
64573         return typeof d2.value === "string" ? d2.value : "";
64574       }).attr("readonly", function(d2) {
64575         return isReadOnly(d2) || null;
64576       });
64577       items.selectAll("button.remove").on(
64578         ("PointerEvent" in window ? "pointer" : "mouse") + "down",
64579         // 'click' fires too late - #5878
64580         (d3_event, d2) => {
64581           if (d3_event.button !== 0) return;
64582           removeTag(d3_event, d2);
64583         }
64584       );
64585     }
64586     function isReadOnly(d2) {
64587       for (var i3 = 0; i3 < _readOnlyTags.length; i3++) {
64588         if (d2.key.match(_readOnlyTags[i3]) !== null) {
64589           return true;
64590         }
64591       }
64592       return false;
64593     }
64594     function setTextareaHeight() {
64595       if (_tagView !== "text") return;
64596       var selection2 = select_default2(this);
64597       var matches = selection2.node().value.match(/\n/g);
64598       var lineCount = 2 + Number(matches && matches.length);
64599       var lineHeight = 20;
64600       selection2.style("height", lineCount * lineHeight + "px");
64601     }
64602     function stringify3(s2) {
64603       const stringified = JSON.stringify(s2).slice(1, -1);
64604       if (stringified !== s2) {
64605         return '"'.concat(stringified, '"');
64606       } else {
64607         return s2;
64608       }
64609     }
64610     function unstringify(s2) {
64611       const isQuoted = s2.length > 1 && s2.charAt(0) === '"' && s2.charAt(s2.length - 1) === '"';
64612       if (isQuoted) {
64613         try {
64614           return JSON.parse(s2);
64615         } catch {
64616           return s2;
64617         }
64618       } else {
64619         return s2;
64620       }
64621     }
64622     function rowsToText(rows) {
64623       var str = rows.filter(function(row) {
64624         return row.key && row.key.trim() !== "";
64625       }).map(function(row) {
64626         var rawVal = row.value;
64627         if (typeof rawVal !== "string") rawVal = "*";
64628         var val = rawVal ? stringify3(rawVal) : "";
64629         return stringify3(row.key) + "=" + val;
64630       }).join("\n");
64631       if (_state !== "hover" && str.length) {
64632         return str + "\n";
64633       }
64634       return str;
64635     }
64636     function textChanged() {
64637       var newText = this.value.trim();
64638       var newTags = {};
64639       newText.split("\n").forEach(function(row) {
64640         var m2 = row.match(/^\s*([^=]+)=(.*)$/);
64641         if (m2 !== null) {
64642           var k2 = context.cleanTagKey(unstringify(m2[1].trim()));
64643           var v2 = context.cleanTagValue(unstringify(m2[2].trim()));
64644           newTags[k2] = v2;
64645         }
64646       });
64647       var tagDiff = utilTagDiff(_tags, newTags);
64648       if (!tagDiff.length) return;
64649       _pendingChange = _pendingChange || {};
64650       tagDiff.forEach(function(change) {
64651         if (isReadOnly({ key: change.key })) return;
64652         if (change.newVal === "*" && typeof change.oldVal !== "string") return;
64653         if (change.type === "-") {
64654           _pendingChange[change.key] = void 0;
64655         } else if (change.type === "+") {
64656           _pendingChange[change.key] = change.newVal || "";
64657         }
64658       });
64659       if (Object.keys(_pendingChange).length === 0) {
64660         _pendingChange = null;
64661         return;
64662       }
64663       scheduleChange();
64664     }
64665     function pushMore(d3_event) {
64666       if (d3_event.keyCode === 9 && !d3_event.shiftKey && section.selection().selectAll(".tag-list li:last-child input.value").node() === this && utilGetSetValue(select_default2(this))) {
64667         addTag();
64668       }
64669     }
64670     function bindTypeahead(key, value) {
64671       if (isReadOnly(key.datum())) return;
64672       if (Array.isArray(value.datum().value)) {
64673         value.call(uiCombobox(context, "tag-value").minItems(1).fetcher(function(value2, callback) {
64674           var keyString = utilGetSetValue(key);
64675           if (!_tags[keyString]) return;
64676           var data = _tags[keyString].map(function(tagValue) {
64677             if (!tagValue) {
64678               return {
64679                 value: " ",
64680                 title: _t("inspector.empty"),
64681                 display: (selection2) => selection2.text("").classed("virtual-option", true).call(_t.append("inspector.empty"))
64682               };
64683             }
64684             return {
64685               value: tagValue,
64686               title: tagValue
64687             };
64688           });
64689           callback(data);
64690         }));
64691         return;
64692       }
64693       var geometry = context.graph().geometry(_entityIDs[0]);
64694       key.call(uiCombobox(context, "tag-key").fetcher(function(value2, callback) {
64695         taginfo.keys({
64696           debounce: true,
64697           geometry,
64698           query: value2
64699         }, function(err, data) {
64700           if (!err) {
64701             const filtered = data.filter((d2) => _tags[d2.value] === void 0).filter((d2) => !(d2.value in _discardTags)).filter((d2) => !/_\d$/.test(d2)).filter((d2) => d2.value.toLowerCase().includes(value2.toLowerCase()));
64702             callback(sort(value2, filtered));
64703           }
64704         });
64705       }));
64706       value.call(uiCombobox(context, "tag-value").fetcher(function(value2, callback) {
64707         taginfo.values({
64708           debounce: true,
64709           key: utilGetSetValue(key),
64710           geometry,
64711           query: value2
64712         }, function(err, data) {
64713           if (!err) {
64714             const filtered = data.filter((d2) => d2.value.toLowerCase().includes(value2.toLowerCase()));
64715             callback(sort(value2, filtered));
64716           }
64717         });
64718       }).caseSensitive(allowUpperCaseTagValues.test(utilGetSetValue(key))));
64719       function sort(value2, data) {
64720         var sameletter = [];
64721         var other = [];
64722         for (var i3 = 0; i3 < data.length; i3++) {
64723           if (data[i3].value.substring(0, value2.length) === value2) {
64724             sameletter.push(data[i3]);
64725           } else {
64726             other.push(data[i3]);
64727           }
64728         }
64729         return sameletter.concat(other);
64730       }
64731     }
64732     function unbind() {
64733       var row = select_default2(this);
64734       row.selectAll("input.key").call(uiCombobox.off, context);
64735       row.selectAll("input.value").call(uiCombobox.off, context);
64736     }
64737     function keyChange(d3_event, d2) {
64738       if (select_default2(this).attr("readonly")) return;
64739       var kOld = d2.key;
64740       if (_pendingChange && _pendingChange.hasOwnProperty(kOld) && _pendingChange[kOld] === void 0) return;
64741       var kNew = context.cleanTagKey(this.value.trim());
64742       if (isReadOnly({ key: kNew })) {
64743         this.value = kOld;
64744         return;
64745       }
64746       if (kNew && kNew !== kOld && _tags[kNew] !== void 0) {
64747         this.value = kOld;
64748         section.selection().selectAll(".tag-list input.value").each(function(d4) {
64749           if (d4.key === kNew) {
64750             var input = select_default2(this).node();
64751             input.focus();
64752             input.select();
64753           }
64754         });
64755         return;
64756       }
64757       _pendingChange = _pendingChange || {};
64758       if (kOld) {
64759         if (kOld === kNew) return;
64760         _pendingChange[kNew] = _pendingChange[kOld] || { oldKey: kOld };
64761         _pendingChange[kOld] = void 0;
64762       } else {
64763         let row = this.parentNode.parentNode;
64764         let inputVal = select_default2(row).selectAll("input.value");
64765         let vNew = context.cleanTagValue(utilGetSetValue(inputVal));
64766         _pendingChange[kNew] = vNew;
64767         utilGetSetValue(inputVal, vNew);
64768       }
64769       var existingKeyIndex = _orderedKeys.indexOf(kOld);
64770       if (existingKeyIndex !== -1) _orderedKeys[existingKeyIndex] = kNew;
64771       d2.key = kNew;
64772       this.value = kNew;
64773       scheduleChange();
64774     }
64775     function valueChange(d3_event, d2) {
64776       if (isReadOnly(d2)) return;
64777       if (typeof d2.value !== "string" && !this.value) return;
64778       if (_pendingChange && _pendingChange.hasOwnProperty(d2.key) && _pendingChange[d2.key] === void 0) return;
64779       _pendingChange = _pendingChange || {};
64780       _pendingChange[d2.key] = context.cleanTagValue(this.value);
64781       scheduleChange();
64782     }
64783     function removeTag(d3_event, d2) {
64784       if (isReadOnly(d2)) return;
64785       if (d2.key === "") {
64786         _showBlank = false;
64787         section.reRender();
64788       } else {
64789         _orderedKeys = _orderedKeys.filter(function(key) {
64790           return key !== d2.key;
64791         });
64792         _pendingChange = _pendingChange || {};
64793         _pendingChange[d2.key] = void 0;
64794         scheduleChange();
64795       }
64796     }
64797     function addTag() {
64798       window.setTimeout(function() {
64799         _showBlank = true;
64800         section.reRender();
64801         section.selection().selectAll(".tag-list li:last-child input.key").node().focus();
64802       }, 20);
64803     }
64804     function scheduleChange() {
64805       var entityIDs = _entityIDs;
64806       window.setTimeout(function() {
64807         if (!_pendingChange) return;
64808         dispatch14.call("change", this, entityIDs, _pendingChange);
64809         _pendingChange = null;
64810       }, 10);
64811     }
64812     section.state = function(val) {
64813       if (!arguments.length) return _state;
64814       if (_state !== val) {
64815         _orderedKeys = [];
64816         _state = val;
64817       }
64818       return section;
64819     };
64820     section.presets = function(val) {
64821       if (!arguments.length) return _presets;
64822       _presets = val;
64823       if (_presets && _presets.length && _presets[0].isFallback()) {
64824         section.disclosureExpanded(true);
64825       } else if (!_didInteract) {
64826         section.disclosureExpanded(null);
64827       }
64828       return section;
64829     };
64830     section.tags = function(val) {
64831       if (!arguments.length) return _tags;
64832       _tags = val;
64833       return section;
64834     };
64835     section.entityIDs = function(val) {
64836       if (!arguments.length) return _entityIDs;
64837       if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
64838         _entityIDs = val;
64839         _orderedKeys = [];
64840       }
64841       return section;
64842     };
64843     section.readOnlyTags = function(val) {
64844       if (!arguments.length) return _readOnlyTags;
64845       _readOnlyTags = val;
64846       return section;
64847     };
64848     return utilRebind(section, dispatch14, "on");
64849   }
64850
64851   // modules/ui/data_editor.js
64852   function uiDataEditor(context) {
64853     var dataHeader = uiDataHeader();
64854     var rawTagEditor = uiSectionRawTagEditor("custom-data-tag-editor", context).expandedByDefault(true).readOnlyTags([/./]);
64855     var _datum;
64856     function dataEditor(selection2) {
64857       var header = selection2.selectAll(".header").data([0]);
64858       var headerEnter = header.enter().append("div").attr("class", "header fillL");
64859       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
64860         context.enter(modeBrowse(context));
64861       }).call(svgIcon("#iD-icon-close"));
64862       headerEnter.append("h2").call(_t.append("map_data.title"));
64863       var body = selection2.selectAll(".body").data([0]);
64864       body = body.enter().append("div").attr("class", "body").merge(body);
64865       var editor = body.selectAll(".data-editor").data([0]);
64866       editor.enter().append("div").attr("class", "modal-section data-editor").merge(editor).call(dataHeader.datum(_datum));
64867       var rte = body.selectAll(".raw-tag-editor").data([0]);
64868       rte.enter().append("div").attr("class", "raw-tag-editor data-editor").merge(rte).call(
64869         rawTagEditor.tags(_datum && _datum.properties || {}).state("hover").render
64870       ).selectAll("textarea.tag-text").attr("readonly", true).classed("readonly", true);
64871     }
64872     dataEditor.datum = function(val) {
64873       if (!arguments.length) return _datum;
64874       _datum = val;
64875       return this;
64876     };
64877     return dataEditor;
64878   }
64879
64880   // modules/ui/feature_list.js
64881   var sexagesimal = __toESM(require_sexagesimal());
64882   function uiFeatureList(context) {
64883     var _geocodeResults;
64884     function featureList(selection2) {
64885       var header = selection2.append("div").attr("class", "header fillL");
64886       header.append("h2").call(_t.append("inspector.feature_list"));
64887       var searchWrap = selection2.append("div").attr("class", "search-header");
64888       searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
64889       var search = searchWrap.append("input").attr("placeholder", _t("inspector.search")).attr("type", "search").call(utilNoAuto).on("keypress", keypress).on("keydown", keydown).on("input", inputevent);
64890       var listWrap = selection2.append("div").attr("class", "inspector-body");
64891       var list2 = listWrap.append("div").attr("class", "feature-list");
64892       context.on("exit.feature-list", clearSearch);
64893       context.map().on("drawn.feature-list", mapDrawn);
64894       context.keybinding().on(uiCmd("\u2318F"), focusSearch);
64895       function focusSearch(d3_event) {
64896         var mode = context.mode() && context.mode().id;
64897         if (mode !== "browse") return;
64898         d3_event.preventDefault();
64899         search.node().focus();
64900       }
64901       function keydown(d3_event) {
64902         if (d3_event.keyCode === 27) {
64903           search.node().blur();
64904         }
64905       }
64906       function keypress(d3_event) {
64907         var q2 = search.property("value"), items = list2.selectAll(".feature-list-item");
64908         if (d3_event.keyCode === 13 && // ↩ Return
64909         q2.length && items.size()) {
64910           click(d3_event, items.datum());
64911         }
64912       }
64913       function inputevent() {
64914         _geocodeResults = void 0;
64915         drawList();
64916       }
64917       function clearSearch() {
64918         search.property("value", "");
64919         drawList();
64920       }
64921       function mapDrawn(e3) {
64922         if (e3.full) {
64923           drawList();
64924         }
64925       }
64926       function features() {
64927         var result = [];
64928         var graph = context.graph();
64929         var visibleCenter = context.map().extent().center();
64930         var q2 = search.property("value").toLowerCase();
64931         if (!q2) return result;
64932         var locationMatch = sexagesimal.pair(q2.toUpperCase()) || dmsMatcher(q2);
64933         if (locationMatch) {
64934           var loc = [Number(locationMatch[0]), Number(locationMatch[1])];
64935           result.push({
64936             id: -1,
64937             geometry: "point",
64938             type: _t("inspector.location"),
64939             name: dmsCoordinatePair([loc[1], loc[0]]),
64940             location: loc
64941           });
64942         }
64943         var idMatch = !locationMatch && q2.match(/(?:^|\W)(node|way|relation|note|[nwr])\W{0,2}0*([1-9]\d*)(?:\W|$)/i);
64944         if (idMatch) {
64945           var elemType = idMatch[1] === "note" ? idMatch[1] : idMatch[1].charAt(0);
64946           var elemId = idMatch[2];
64947           result.push({
64948             id: elemType + elemId,
64949             geometry: elemType === "n" ? "point" : elemType === "w" ? "line" : elemType === "note" ? "note" : "relation",
64950             type: elemType === "n" ? _t("inspector.node") : elemType === "w" ? _t("inspector.way") : elemType === "note" ? _t("note.note") : _t("inspector.relation"),
64951             name: elemId
64952           });
64953         }
64954         var allEntities = graph.entities;
64955         var localResults = [];
64956         for (var id2 in allEntities) {
64957           var entity = allEntities[id2];
64958           if (!entity) continue;
64959           var name = utilDisplayName(entity) || "";
64960           if (name.toLowerCase().indexOf(q2) < 0) continue;
64961           var matched = _mainPresetIndex.match(entity, graph);
64962           var type2 = matched && matched.name() || utilDisplayType(entity.id);
64963           var extent = entity.extent(graph);
64964           var distance = extent ? geoSphericalDistance(visibleCenter, extent.center()) : 0;
64965           localResults.push({
64966             id: entity.id,
64967             entity,
64968             geometry: entity.geometry(graph),
64969             type: type2,
64970             name,
64971             distance
64972           });
64973           if (localResults.length > 100) break;
64974         }
64975         localResults = localResults.sort(function byDistance(a2, b2) {
64976           return a2.distance - b2.distance;
64977         });
64978         result = result.concat(localResults);
64979         (_geocodeResults || []).forEach(function(d2) {
64980           if (d2.osm_type && d2.osm_id) {
64981             var id3 = osmEntity.id.fromOSM(d2.osm_type, d2.osm_id);
64982             var tags = {};
64983             tags[d2.class] = d2.type;
64984             var attrs = { id: id3, type: d2.osm_type, tags };
64985             if (d2.osm_type === "way") {
64986               attrs.nodes = ["a", "a"];
64987             }
64988             var tempEntity = osmEntity(attrs);
64989             var tempGraph = coreGraph([tempEntity]);
64990             var matched2 = _mainPresetIndex.match(tempEntity, tempGraph);
64991             var type3 = matched2 && matched2.name() || utilDisplayType(id3);
64992             result.push({
64993               id: tempEntity.id,
64994               geometry: tempEntity.geometry(tempGraph),
64995               type: type3,
64996               name: d2.display_name,
64997               extent: new geoExtent(
64998                 [Number(d2.boundingbox[3]), Number(d2.boundingbox[0])],
64999                 [Number(d2.boundingbox[2]), Number(d2.boundingbox[1])]
65000               )
65001             });
65002           }
65003         });
65004         if (q2.match(/^[0-9]+$/)) {
65005           result.push({
65006             id: "n" + q2,
65007             geometry: "point",
65008             type: _t("inspector.node"),
65009             name: q2
65010           });
65011           result.push({
65012             id: "w" + q2,
65013             geometry: "line",
65014             type: _t("inspector.way"),
65015             name: q2
65016           });
65017           result.push({
65018             id: "r" + q2,
65019             geometry: "relation",
65020             type: _t("inspector.relation"),
65021             name: q2
65022           });
65023           result.push({
65024             id: "note" + q2,
65025             geometry: "note",
65026             type: _t("note.note"),
65027             name: q2
65028           });
65029         }
65030         return result;
65031       }
65032       function drawList() {
65033         var value = search.property("value");
65034         var results = features();
65035         list2.classed("filtered", value.length);
65036         var resultsIndicator = list2.selectAll(".no-results-item").data([0]).enter().append("button").property("disabled", true).attr("class", "no-results-item").call(svgIcon("#iD-icon-alert", "pre-text"));
65037         resultsIndicator.append("span").attr("class", "entity-name");
65038         list2.selectAll(".no-results-item .entity-name").html("").call(_t.append("geocoder.no_results_worldwide"));
65039         if (services.geocoder) {
65040           list2.selectAll(".geocode-item").data([0]).enter().append("button").attr("class", "geocode-item secondary-action").on("click", geocoderSearch).append("div").attr("class", "label").append("span").attr("class", "entity-name").call(_t.append("geocoder.search"));
65041         }
65042         list2.selectAll(".no-results-item").style("display", value.length && !results.length ? "block" : "none");
65043         list2.selectAll(".geocode-item").style("display", value && _geocodeResults === void 0 ? "block" : "none");
65044         list2.selectAll(".feature-list-item").data([-1]).remove();
65045         var items = list2.selectAll(".feature-list-item").data(results, function(d2) {
65046           return d2.id;
65047         });
65048         var enter = items.enter().insert("button", ".geocode-item").attr("class", "feature-list-item").on("mouseover", mouseover).on("mouseout", mouseout).on("click", click);
65049         var label = enter.append("div").attr("class", "label");
65050         label.each(function(d2) {
65051           select_default2(this).call(svgIcon("#iD-icon-" + d2.geometry, "pre-text"));
65052         });
65053         label.append("span").attr("class", "entity-type").text(function(d2) {
65054           return d2.type;
65055         });
65056         label.append("span").attr("class", "entity-name").classed("has-colour", (d2) => d2.entity && d2.entity.type === "relation" && d2.entity.tags.colour && isColourValid(d2.entity.tags.colour)).style("border-color", (d2) => d2.entity && d2.entity.type === "relation" && d2.entity.tags.colour).text(function(d2) {
65057           return d2.name;
65058         });
65059         enter.style("opacity", 0).transition().style("opacity", 1);
65060         items.order();
65061         items.exit().remove();
65062       }
65063       function mouseover(d3_event, d2) {
65064         if (d2.id === -1) return;
65065         utilHighlightEntities([d2.id], true, context);
65066       }
65067       function mouseout(d3_event, d2) {
65068         if (d2.id === -1) return;
65069         utilHighlightEntities([d2.id], false, context);
65070       }
65071       function click(d3_event, d2) {
65072         d3_event.preventDefault();
65073         if (d2.location) {
65074           context.map().centerZoomEase([d2.location[1], d2.location[0]], 19);
65075         } else if (d2.entity) {
65076           utilHighlightEntities([d2.id], false, context);
65077           context.enter(modeSelect(context, [d2.entity.id]));
65078           context.map().zoomToEase(d2.entity);
65079         } else if (d2.geometry === "note") {
65080           const noteId = d2.id.replace(/\D/g, "");
65081           context.zoomToNote(noteId);
65082         } else {
65083           context.zoomToEntity(d2.id);
65084         }
65085       }
65086       function geocoderSearch() {
65087         services.geocoder.search(search.property("value"), function(err, resp) {
65088           _geocodeResults = resp || [];
65089           drawList();
65090         });
65091       }
65092     }
65093     return featureList;
65094   }
65095
65096   // modules/ui/entity_editor.js
65097   var import_fast_deep_equal9 = __toESM(require_fast_deep_equal());
65098
65099   // modules/ui/sections/entity_issues.js
65100   function uiSectionEntityIssues(context) {
65101     var preference = corePreferences("entity-issues.reference.expanded");
65102     var _expanded = preference === null ? true : preference === "true";
65103     var _entityIDs = [];
65104     var _issues = [];
65105     var _activeIssueID;
65106     var section = uiSection("entity-issues", context).shouldDisplay(function() {
65107       return _issues.length > 0;
65108     }).label(function() {
65109       return _t.append("inspector.title_count", { title: _t("issues.list_title"), count: _issues.length });
65110     }).disclosureContent(renderDisclosureContent);
65111     context.validator().on("validated.entity_issues", function() {
65112       reloadIssues();
65113       section.reRender();
65114     }).on("focusedIssue.entity_issues", function(issue) {
65115       makeActiveIssue(issue.id);
65116     });
65117     function reloadIssues() {
65118       _issues = context.validator().getSharedEntityIssues(_entityIDs, { includeDisabledRules: true });
65119     }
65120     function makeActiveIssue(issueID) {
65121       _activeIssueID = issueID;
65122       section.selection().selectAll(".issue-container").classed("active", function(d2) {
65123         return d2.id === _activeIssueID;
65124       });
65125     }
65126     function renderDisclosureContent(selection2) {
65127       selection2.classed("grouped-items-area", true);
65128       _activeIssueID = _issues.length > 0 ? _issues[0].id : null;
65129       var containers = selection2.selectAll(".issue-container").data(_issues, function(d2) {
65130         return d2.key;
65131       });
65132       containers.exit().remove();
65133       var containersEnter = containers.enter().append("div").attr("class", "issue-container");
65134       var itemsEnter = containersEnter.append("div").attr("class", function(d2) {
65135         return "issue severity-" + d2.severity;
65136       }).on("mouseover.highlight", function(d3_event, d2) {
65137         var ids = d2.entityIds.filter(function(e3) {
65138           return _entityIDs.indexOf(e3) === -1;
65139         });
65140         utilHighlightEntities(ids, true, context);
65141       }).on("mouseout.highlight", function(d3_event, d2) {
65142         var ids = d2.entityIds.filter(function(e3) {
65143           return _entityIDs.indexOf(e3) === -1;
65144         });
65145         utilHighlightEntities(ids, false, context);
65146       });
65147       var labelsEnter = itemsEnter.append("div").attr("class", "issue-label");
65148       var textEnter = labelsEnter.append("button").attr("class", "issue-text").on("click", function(d3_event, d2) {
65149         makeActiveIssue(d2.id);
65150         var extent = d2.extent(context.graph());
65151         if (extent) {
65152           var setZoom = Math.max(context.map().zoom(), 19);
65153           context.map().unobscuredCenterZoomEase(extent.center(), setZoom);
65154         }
65155       });
65156       textEnter.each(function(d2) {
65157         var iconName = "#iD-icon-" + (d2.severity === "warning" ? "alert" : "error");
65158         select_default2(this).call(svgIcon(iconName, "issue-icon"));
65159       });
65160       textEnter.append("span").attr("class", "issue-message");
65161       var infoButton = labelsEnter.append("button").attr("class", "issue-info-button").attr("title", _t("icons.information")).call(svgIcon("#iD-icon-inspect"));
65162       infoButton.on("click", function(d3_event) {
65163         d3_event.stopPropagation();
65164         d3_event.preventDefault();
65165         this.blur();
65166         var container = select_default2(this.parentNode.parentNode.parentNode);
65167         var info = container.selectAll(".issue-info");
65168         var isExpanded = info.classed("expanded");
65169         _expanded = !isExpanded;
65170         corePreferences("entity-issues.reference.expanded", _expanded);
65171         if (isExpanded) {
65172           info.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
65173             info.classed("expanded", false);
65174           });
65175         } else {
65176           info.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1").on("end", function() {
65177             info.style("max-height", null);
65178           });
65179         }
65180       });
65181       itemsEnter.append("ul").attr("class", "issue-fix-list");
65182       containersEnter.append("div").attr("class", "issue-info" + (_expanded ? " expanded" : "")).style("max-height", _expanded ? null : "0").style("opacity", _expanded ? "1" : "0").each(function(d2) {
65183         if (typeof d2.reference === "function") {
65184           select_default2(this).call(d2.reference);
65185         } else {
65186           select_default2(this).call(_t.append("inspector.no_documentation_key"));
65187         }
65188       });
65189       containers = containers.merge(containersEnter).classed("active", function(d2) {
65190         return d2.id === _activeIssueID;
65191       });
65192       containers.selectAll(".issue-message").text("").each(function(d2) {
65193         return d2.message(context)(select_default2(this));
65194       });
65195       var fixLists = containers.selectAll(".issue-fix-list");
65196       var fixes = fixLists.selectAll(".issue-fix-item").data(function(d2) {
65197         return d2.fixes ? d2.fixes(context) : [];
65198       }, function(fix) {
65199         return fix.id;
65200       });
65201       fixes.exit().remove();
65202       var fixesEnter = fixes.enter().append("li").attr("class", "issue-fix-item");
65203       var buttons = fixesEnter.append("button").on("click", function(d3_event, d2) {
65204         if (select_default2(this).attr("disabled") || !d2.onClick) return;
65205         if (d2.issue.dateLastRanFix && /* @__PURE__ */ new Date() - d2.issue.dateLastRanFix < 1e3) return;
65206         d2.issue.dateLastRanFix = /* @__PURE__ */ new Date();
65207         utilHighlightEntities(d2.issue.entityIds.concat(d2.entityIds), false, context);
65208         new Promise(function(resolve, reject) {
65209           d2.onClick(context, resolve, reject);
65210           if (d2.onClick.length <= 1) {
65211             resolve();
65212           }
65213         }).then(function() {
65214           context.validator().validate();
65215         });
65216       }).on("mouseover.highlight", function(d3_event, d2) {
65217         utilHighlightEntities(d2.entityIds, true, context);
65218       }).on("mouseout.highlight", function(d3_event, d2) {
65219         utilHighlightEntities(d2.entityIds, false, context);
65220       });
65221       buttons.each(function(d2) {
65222         var iconName = d2.icon || "iD-icon-wrench";
65223         if (iconName.startsWith("maki")) {
65224           iconName += "-15";
65225         }
65226         select_default2(this).call(svgIcon("#" + iconName, "fix-icon"));
65227       });
65228       buttons.append("span").attr("class", "fix-message").each(function(d2) {
65229         return d2.title(select_default2(this));
65230       });
65231       fixesEnter.merge(fixes).selectAll("button").classed("actionable", function(d2) {
65232         return d2.onClick;
65233       }).attr("disabled", function(d2) {
65234         return d2.onClick ? null : "true";
65235       }).attr("title", function(d2) {
65236         if (d2.disabledReason) {
65237           return d2.disabledReason;
65238         }
65239         return null;
65240       });
65241     }
65242     section.entityIDs = function(val) {
65243       if (!arguments.length) return _entityIDs;
65244       if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
65245         _entityIDs = val;
65246         _activeIssueID = null;
65247         reloadIssues();
65248       }
65249       return section;
65250     };
65251     return section;
65252   }
65253
65254   // modules/ui/preset_icon.js
65255   function uiPresetIcon() {
65256     let _preset;
65257     let _geometry;
65258     function presetIcon(selection2) {
65259       selection2.each(render);
65260     }
65261     function getIcon(p2, geom) {
65262       if (p2.isFallback && p2.isFallback()) return geom === "vertex" ? "" : "iD-icon-" + p2.id;
65263       if (p2.icon) return p2.icon;
65264       if (geom === "line") return "iD-other-line";
65265       if (geom === "vertex") return "temaki-vertex";
65266       return "maki-marker-stroked";
65267     }
65268     function renderPointBorder(container, drawPoint) {
65269       let pointBorder = container.selectAll(".preset-icon-point-border").data(drawPoint ? [0] : []);
65270       pointBorder.exit().remove();
65271       let pointBorderEnter = pointBorder.enter();
65272       const w2 = 40;
65273       const h2 = 40;
65274       pointBorderEnter.append("svg").attr("class", "preset-icon-fill preset-icon-point-border").attr("width", w2).attr("height", h2).attr("viewBox", "0 0 ".concat(w2, " ").concat(h2)).append("path").attr("transform", "translate(11.5, 8)").attr("d", "M 17,8 C 17,13 11,21 8.5,23.5 C 6,21 0,13 0,8 C 0,4 4,-0.5 8.5,-0.5 C 13,-0.5 17,4 17,8 z");
65275       pointBorder = pointBorderEnter.merge(pointBorder);
65276     }
65277     function renderCategoryBorder(container, category) {
65278       let categoryBorder = container.selectAll(".preset-icon-category-border").data(category ? [0] : []);
65279       categoryBorder.exit().remove();
65280       let categoryBorderEnter = categoryBorder.enter();
65281       const d2 = 60;
65282       let svgEnter = categoryBorderEnter.append("svg").attr("class", "preset-icon-fill preset-icon-category-border").attr("width", d2).attr("height", d2).attr("viewBox", "0 0 ".concat(d2, " ").concat(d2));
65283       svgEnter.append("path").attr("class", "area").attr("d", "M9.5,7.5 L25.5,7.5 L28.5,12.5 L49.5,12.5 C51.709139,12.5 53.5,14.290861 53.5,16.5 L53.5,43.5 C53.5,45.709139 51.709139,47.5 49.5,47.5 L10.5,47.5 C8.290861,47.5 6.5,45.709139 6.5,43.5 L6.5,12.5 L9.5,7.5 Z");
65284       categoryBorder = categoryBorderEnter.merge(categoryBorder);
65285       if (category) {
65286         categoryBorder.selectAll("path").attr("class", "area ".concat(category.id));
65287       }
65288     }
65289     function renderCircleFill(container, drawVertex) {
65290       let vertexFill = container.selectAll(".preset-icon-fill-vertex").data(drawVertex ? [0] : []);
65291       vertexFill.exit().remove();
65292       let vertexFillEnter = vertexFill.enter();
65293       const w2 = 60;
65294       const h2 = 60;
65295       const d2 = 40;
65296       vertexFillEnter.append("svg").attr("class", "preset-icon-fill preset-icon-fill-vertex").attr("width", w2).attr("height", h2).attr("viewBox", "0 0 ".concat(w2, " ").concat(h2)).append("circle").attr("cx", w2 / 2).attr("cy", h2 / 2).attr("r", d2 / 2);
65297       vertexFill = vertexFillEnter.merge(vertexFill);
65298     }
65299     function renderSquareFill(container, drawArea, tagClasses) {
65300       let fill = container.selectAll(".preset-icon-fill-area").data(drawArea ? [0] : []);
65301       fill.exit().remove();
65302       let fillEnter = fill.enter();
65303       const d2 = 60;
65304       const w2 = d2;
65305       const h2 = d2;
65306       const l2 = d2 * 2 / 3;
65307       const c1 = (w2 - l2) / 2;
65308       const c2 = c1 + l2;
65309       fillEnter = fillEnter.append("svg").attr("class", "preset-icon-fill preset-icon-fill-area").attr("width", w2).attr("height", h2).attr("viewBox", "0 0 ".concat(w2, " ").concat(h2));
65310       ["fill", "stroke"].forEach((klass) => {
65311         fillEnter.append("path").attr("d", "M".concat(c1, " ").concat(c1, " L").concat(c1, " ").concat(c2, " L").concat(c2, " ").concat(c2, " L").concat(c2, " ").concat(c1, " Z")).attr("class", "area ".concat(klass));
65312       });
65313       const rVertex = 2.5;
65314       [[c1, c1], [c1, c2], [c2, c2], [c2, c1]].forEach((point) => {
65315         fillEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", rVertex);
65316       });
65317       const rMidpoint = 1.25;
65318       [[c1, w2 / 2], [c2, w2 / 2], [h2 / 2, c1], [h2 / 2, c2]].forEach((point) => {
65319         fillEnter.append("circle").attr("class", "midpoint").attr("cx", point[0]).attr("cy", point[1]).attr("r", rMidpoint);
65320       });
65321       fill = fillEnter.merge(fill);
65322       fill.selectAll("path.stroke").attr("class", "area stroke ".concat(tagClasses));
65323       fill.selectAll("path.fill").attr("class", "area fill ".concat(tagClasses));
65324     }
65325     function renderLine(container, drawLine, tagClasses) {
65326       let line = container.selectAll(".preset-icon-line").data(drawLine ? [0] : []);
65327       line.exit().remove();
65328       let lineEnter = line.enter();
65329       const d2 = 60;
65330       const w2 = d2;
65331       const h2 = d2;
65332       const y2 = Math.round(d2 * 0.72);
65333       const l2 = Math.round(d2 * 0.6);
65334       const r2 = 2.5;
65335       const x12 = (w2 - l2) / 2;
65336       const x2 = x12 + l2;
65337       lineEnter = lineEnter.append("svg").attr("class", "preset-icon-line").attr("width", w2).attr("height", h2).attr("viewBox", "0 0 ".concat(w2, " ").concat(h2));
65338       ["casing", "stroke"].forEach((klass) => {
65339         lineEnter.append("path").attr("d", "M".concat(x12, " ").concat(y2, " L").concat(x2, " ").concat(y2)).attr("class", "line ".concat(klass));
65340       });
65341       [[x12 - 1, y2], [x2 + 1, y2]].forEach((point) => {
65342         lineEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", r2);
65343       });
65344       line = lineEnter.merge(line);
65345       line.selectAll("path.stroke").attr("class", "line stroke ".concat(tagClasses));
65346       line.selectAll("path.casing").attr("class", "line casing ".concat(tagClasses));
65347     }
65348     function renderRoute(container, drawRoute, p2) {
65349       let route = container.selectAll(".preset-icon-route").data(drawRoute ? [0] : []);
65350       route.exit().remove();
65351       let routeEnter = route.enter();
65352       const d2 = 60;
65353       const w2 = d2;
65354       const h2 = d2;
65355       const y12 = Math.round(d2 * 0.8);
65356       const y2 = Math.round(d2 * 0.68);
65357       const l2 = Math.round(d2 * 0.6);
65358       const r2 = 2;
65359       const x12 = (w2 - l2) / 2;
65360       const x2 = x12 + l2 / 3;
65361       const x3 = x2 + l2 / 3;
65362       const x4 = x3 + l2 / 3;
65363       routeEnter = routeEnter.append("svg").attr("class", "preset-icon-route").attr("width", w2).attr("height", h2).attr("viewBox", "0 0 ".concat(w2, " ").concat(h2));
65364       ["casing", "stroke"].forEach((klass) => {
65365         routeEnter.append("path").attr("d", "M".concat(x12, " ").concat(y12, " L").concat(x2, " ").concat(y2)).attr("class", "segment0 line ".concat(klass));
65366         routeEnter.append("path").attr("d", "M".concat(x2, " ").concat(y2, " L").concat(x3, " ").concat(y12)).attr("class", "segment1 line ".concat(klass));
65367         routeEnter.append("path").attr("d", "M".concat(x3, " ").concat(y12, " L").concat(x4, " ").concat(y2)).attr("class", "segment2 line ".concat(klass));
65368       });
65369       [[x12, y12], [x2, y2], [x3, y12], [x4, y2]].forEach((point) => {
65370         routeEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", r2);
65371       });
65372       route = routeEnter.merge(route);
65373       if (drawRoute) {
65374         let routeType = p2.tags.type === "waterway" ? "waterway" : p2.tags.route;
65375         const segmentPresetIDs = routeSegments[routeType];
65376         for (let i3 in segmentPresetIDs) {
65377           const segmentPreset = _mainPresetIndex.item(segmentPresetIDs[i3]);
65378           const segmentTagClasses = svgTagClasses().getClassesString(segmentPreset.tags, "");
65379           route.selectAll("path.stroke.segment".concat(i3)).attr("class", "segment".concat(i3, " line stroke ").concat(segmentTagClasses));
65380           route.selectAll("path.casing.segment".concat(i3)).attr("class", "segment".concat(i3, " line casing ").concat(segmentTagClasses));
65381         }
65382       }
65383     }
65384     function renderSvgIcon(container, picon, geom, isFramed, category, tagClasses) {
65385       const isMaki = picon && /^maki-/.test(picon);
65386       const isTemaki = picon && /^temaki-/.test(picon);
65387       const isFa = picon && /^fa[srb]-/.test(picon);
65388       const isR\u00F6ntgen = picon && /^roentgen-/.test(picon);
65389       const isiDIcon = picon && !(isMaki || isTemaki || isFa || isR\u00F6ntgen);
65390       let icon2 = container.selectAll(".preset-icon").data(picon ? [0] : []);
65391       icon2.exit().remove();
65392       icon2 = icon2.enter().append("div").attr("class", "preset-icon").call(svgIcon("")).merge(icon2);
65393       icon2.attr("class", "preset-icon " + (geom ? geom + "-geom" : "")).classed("category", category).classed("framed", isFramed).classed("preset-icon-iD", isiDIcon);
65394       icon2.selectAll("svg").attr("class", "icon " + picon + " " + (!isiDIcon && geom !== "line" ? "" : tagClasses));
65395       icon2.selectAll("use").attr("href", "#" + picon);
65396     }
65397     function renderImageIcon(container, imageURL) {
65398       let imageIcon = container.selectAll("img.image-icon").data(imageURL ? [0] : []);
65399       imageIcon.exit().remove();
65400       imageIcon = imageIcon.enter().append("img").attr("class", "image-icon").on("load", () => container.classed("showing-img", true)).on("error", () => container.classed("showing-img", false)).merge(imageIcon);
65401       imageIcon.attr("src", imageURL);
65402     }
65403     const routeSegments = {
65404       bicycle: ["highway/cycleway", "highway/cycleway", "highway/cycleway"],
65405       bus: ["highway/unclassified", "highway/secondary", "highway/primary"],
65406       trolleybus: ["highway/unclassified", "highway/secondary", "highway/primary"],
65407       detour: ["highway/tertiary", "highway/residential", "highway/unclassified"],
65408       ferry: ["route/ferry", "route/ferry", "route/ferry"],
65409       foot: ["highway/footway", "highway/footway", "highway/footway"],
65410       hiking: ["highway/path", "highway/path", "highway/path"],
65411       horse: ["highway/bridleway", "highway/bridleway", "highway/bridleway"],
65412       light_rail: ["railway/light_rail", "railway/light_rail", "railway/light_rail"],
65413       monorail: ["railway/monorail", "railway/monorail", "railway/monorail"],
65414       mtb: ["highway/path", "highway/track", "highway/bridleway"],
65415       pipeline: ["man_made/pipeline", "man_made/pipeline", "man_made/pipeline"],
65416       piste: ["piste/downhill", "piste/hike", "piste/nordic"],
65417       power: ["power/line", "power/line", "power/line"],
65418       road: ["highway/secondary", "highway/primary", "highway/trunk"],
65419       subway: ["railway/subway", "railway/subway", "railway/subway"],
65420       train: ["railway/rail", "railway/rail", "railway/rail"],
65421       tram: ["railway/tram", "railway/tram", "railway/tram"],
65422       railway: ["railway/rail", "railway/rail", "railway/rail"],
65423       waterway: ["waterway/stream", "waterway/stream", "waterway/stream"]
65424     };
65425     function render() {
65426       let p2 = _preset.apply(this, arguments);
65427       let geom = _geometry ? _geometry.apply(this, arguments) : null;
65428       if (geom === "relation" && p2.tags && (p2.tags.type === "route" && p2.tags.route && routeSegments[p2.tags.route] || p2.tags.type === "waterway")) {
65429         geom = "route";
65430       }
65431       const showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
65432       const isFallback = p2.isFallback && p2.isFallback();
65433       const imageURL = showThirdPartyIcons === "true" && p2.imageURL;
65434       const picon = getIcon(p2, geom);
65435       const isCategory = !p2.setTags;
65436       const drawPoint = false;
65437       const drawVertex = picon !== null && geom === "vertex";
65438       const drawLine = picon && geom === "line" && !isFallback && !isCategory;
65439       const drawArea = picon && geom === "area" && !isFallback && !isCategory;
65440       const drawRoute = picon && geom === "route";
65441       const isFramed = drawVertex || drawArea || drawLine || drawRoute || isCategory;
65442       let tags = !isCategory ? p2.setTags({}, geom) : {};
65443       for (let k2 in tags) {
65444         if (tags[k2] === "*") {
65445           tags[k2] = "yes";
65446         }
65447       }
65448       let tagClasses = svgTagClasses().getClassesString(tags, "");
65449       let selection2 = select_default2(this);
65450       let container = selection2.selectAll(".preset-icon-container").data([0]);
65451       container = container.enter().append("div").attr("class", "preset-icon-container").merge(container);
65452       container.classed("showing-img", !!imageURL).classed("fallback", isFallback);
65453       renderCategoryBorder(container, isCategory && p2);
65454       renderPointBorder(container, drawPoint);
65455       renderCircleFill(container, drawVertex);
65456       renderSquareFill(container, drawArea, tagClasses);
65457       renderLine(container, drawLine, tagClasses);
65458       renderRoute(container, drawRoute, p2);
65459       renderSvgIcon(container, picon, geom, isFramed, isCategory, tagClasses);
65460       renderImageIcon(container, imageURL);
65461     }
65462     presetIcon.preset = function(val) {
65463       if (!arguments.length) return _preset;
65464       _preset = utilFunctor(val);
65465       return presetIcon;
65466     };
65467     presetIcon.geometry = function(val) {
65468       if (!arguments.length) return _geometry;
65469       _geometry = utilFunctor(val);
65470       return presetIcon;
65471     };
65472     return presetIcon;
65473   }
65474
65475   // modules/ui/sections/feature_type.js
65476   function uiSectionFeatureType(context) {
65477     var dispatch14 = dispatch_default("choose");
65478     var _entityIDs = [];
65479     var _presets = [];
65480     var _tagReference;
65481     var section = uiSection("feature-type", context).label(() => _t.append("inspector.feature_type")).disclosureContent(renderDisclosureContent);
65482     function renderDisclosureContent(selection2) {
65483       selection2.classed("preset-list-item", true);
65484       selection2.classed("mixed-types", _presets.length > 1);
65485       var presetButtonWrap = selection2.selectAll(".preset-list-button-wrap").data([0]).enter().append("div").attr("class", "preset-list-button-wrap");
65486       var presetButton = presetButtonWrap.append("button").attr("class", "preset-list-button preset-reset").call(
65487         uiTooltip().title(() => _t.append("inspector.back_tooltip")).placement("bottom")
65488       );
65489       presetButton.append("div").attr("class", "preset-icon-container");
65490       presetButton.append("div").attr("class", "label").append("div").attr("class", "label-inner");
65491       presetButtonWrap.append("div").attr("class", "accessory-buttons");
65492       var tagReferenceBodyWrap = selection2.selectAll(".tag-reference-body-wrap").data([0]);
65493       tagReferenceBodyWrap = tagReferenceBodyWrap.enter().append("div").attr("class", "tag-reference-body-wrap").merge(tagReferenceBodyWrap);
65494       if (_tagReference) {
65495         selection2.selectAll(".preset-list-button-wrap .accessory-buttons").style("display", _presets.length === 1 ? null : "none").call(_tagReference.button);
65496         tagReferenceBodyWrap.style("display", _presets.length === 1 ? null : "none").call(_tagReference.body);
65497       }
65498       selection2.selectAll(".preset-reset").on("click", function() {
65499         dispatch14.call("choose", this, _presets);
65500       }).on("pointerdown pointerup mousedown mouseup", function(d3_event) {
65501         d3_event.preventDefault();
65502         d3_event.stopPropagation();
65503       });
65504       var geometries = entityGeometries();
65505       selection2.select(".preset-list-item button").call(
65506         uiPresetIcon().geometry(_presets.length === 1 ? geometries.length === 1 && geometries[0] : null).preset(_presets.length === 1 ? _presets[0] : _mainPresetIndex.item("point"))
65507       );
65508       var names = _presets.length === 1 ? [
65509         _presets[0].nameLabel(),
65510         _presets[0].subtitleLabel()
65511       ].filter(Boolean) : [_t.append("inspector.multiple_types")];
65512       var label = selection2.select(".label-inner");
65513       var nameparts = label.selectAll(".namepart").data(names, (d2) => d2.stringId);
65514       nameparts.exit().remove();
65515       nameparts.enter().append("div").attr("class", "namepart").text("").each(function(d2) {
65516         d2(select_default2(this));
65517       });
65518     }
65519     section.entityIDs = function(val) {
65520       if (!arguments.length) return _entityIDs;
65521       _entityIDs = val;
65522       return section;
65523     };
65524     section.presets = function(val) {
65525       if (!arguments.length) return _presets;
65526       if (!utilArrayIdentical(val, _presets)) {
65527         _presets = val;
65528         if (_presets.length === 1) {
65529           _tagReference = uiTagReference(_presets[0].reference(), context).showing(false);
65530         }
65531       }
65532       return section;
65533     };
65534     function entityGeometries() {
65535       var counts = {};
65536       for (var i3 in _entityIDs) {
65537         var geometry = context.graph().geometry(_entityIDs[i3]);
65538         if (!counts[geometry]) counts[geometry] = 0;
65539         counts[geometry] += 1;
65540       }
65541       return Object.keys(counts).sort(function(geom1, geom2) {
65542         return counts[geom2] - counts[geom1];
65543       });
65544     }
65545     return utilRebind(section, dispatch14, "on");
65546   }
65547
65548   // modules/ui/form_fields.js
65549   function uiFormFields(context) {
65550     var moreCombo = uiCombobox(context, "more-fields").minItems(1);
65551     var _fieldsArr = [];
65552     var _lastPlaceholder = "";
65553     var _state = "";
65554     var _klass = "";
65555     function formFields(selection2) {
65556       var allowedFields = _fieldsArr.filter(function(field) {
65557         return field.isAllowed();
65558       });
65559       var shown = allowedFields.filter(function(field) {
65560         return field.isShown();
65561       });
65562       var notShown = allowedFields.filter(function(field) {
65563         return !field.isShown();
65564       }).sort(function(a2, b2) {
65565         return a2.universal === b2.universal ? 0 : a2.universal ? 1 : -1;
65566       });
65567       var container = selection2.selectAll(".form-fields-container").data([0]);
65568       container = container.enter().append("div").attr("class", "form-fields-container " + (_klass || "")).merge(container);
65569       var fields = container.selectAll(".wrap-form-field").data(shown, function(d2) {
65570         return d2.id + (d2.entityIDs ? d2.entityIDs.join() : "");
65571       });
65572       fields.exit().remove();
65573       var enter = fields.enter().append("div").attr("class", function(d2) {
65574         return "wrap-form-field wrap-form-field-" + d2.safeid;
65575       });
65576       fields = fields.merge(enter);
65577       fields.order().each(function(d2) {
65578         select_default2(this).call(d2.render);
65579       });
65580       var titles = [];
65581       var moreFields = notShown.map(function(field) {
65582         var title = field.title();
65583         titles.push(title);
65584         var terms = field.terms();
65585         if (field.key) terms.push(field.key);
65586         if (field.keys) terms = terms.concat(field.keys);
65587         return {
65588           display: field.label(),
65589           value: title,
65590           title,
65591           field,
65592           terms
65593         };
65594       });
65595       var placeholder = titles.slice(0, 3).join(", ") + (titles.length > 3 ? "\u2026" : "");
65596       var more = selection2.selectAll(".more-fields").data(_state === "hover" || moreFields.length === 0 ? [] : [0]);
65597       more.exit().remove();
65598       var moreEnter = more.enter().append("div").attr("class", "more-fields").append("label");
65599       moreEnter.append("span").call(_t.append("inspector.add_fields"));
65600       more = moreEnter.merge(more);
65601       var input = more.selectAll(".value").data([0]);
65602       input.exit().remove();
65603       input = input.enter().append("input").attr("class", "value").attr("type", "text").attr("placeholder", placeholder).call(utilNoAuto).merge(input);
65604       input.call(utilGetSetValue, "").call(
65605         moreCombo.data(moreFields).on("accept", function(d2) {
65606           if (!d2) return;
65607           var field = d2.field;
65608           field.show();
65609           selection2.call(formFields);
65610           field.focus();
65611         })
65612       );
65613       if (_lastPlaceholder !== placeholder) {
65614         input.attr("placeholder", placeholder);
65615         _lastPlaceholder = placeholder;
65616       }
65617     }
65618     formFields.fieldsArr = function(val) {
65619       if (!arguments.length) return _fieldsArr;
65620       _fieldsArr = val || [];
65621       return formFields;
65622     };
65623     formFields.state = function(val) {
65624       if (!arguments.length) return _state;
65625       _state = val;
65626       return formFields;
65627     };
65628     formFields.klass = function(val) {
65629       if (!arguments.length) return _klass;
65630       _klass = val;
65631       return formFields;
65632     };
65633     return formFields;
65634   }
65635
65636   // modules/ui/sections/preset_fields.js
65637   function uiSectionPresetFields(context) {
65638     var section = uiSection("preset-fields", context).label(() => _t.append("inspector.fields")).disclosureContent(renderDisclosureContent);
65639     var dispatch14 = dispatch_default("change", "revert");
65640     var formFields = uiFormFields(context);
65641     var _state;
65642     var _fieldsArr;
65643     var _presets = [];
65644     var _tags;
65645     var _entityIDs;
65646     function renderDisclosureContent(selection2) {
65647       if (!_fieldsArr) {
65648         var graph = context.graph();
65649         var geometries = Object.keys(_entityIDs.reduce(function(geoms, entityID) {
65650           geoms[graph.entity(entityID).geometry(graph)] = true;
65651           return geoms;
65652         }, {}));
65653         const loc = _entityIDs.reduce(function(extent, entityID) {
65654           var entity = context.graph().entity(entityID);
65655           return extent.extend(entity.extent(context.graph()));
65656         }, geoExtent()).center();
65657         var presetsManager = _mainPresetIndex;
65658         var allFields = [];
65659         var allMoreFields = [];
65660         var sharedTotalFields;
65661         _presets.forEach(function(preset) {
65662           var fields = preset.fields(loc);
65663           var moreFields = preset.moreFields(loc);
65664           allFields = utilArrayUnion(allFields, fields);
65665           allMoreFields = utilArrayUnion(allMoreFields, moreFields);
65666           if (!sharedTotalFields) {
65667             sharedTotalFields = utilArrayUnion(fields, moreFields);
65668           } else {
65669             sharedTotalFields = sharedTotalFields.filter(function(field) {
65670               return fields.indexOf(field) !== -1 || moreFields.indexOf(field) !== -1;
65671             });
65672           }
65673         });
65674         var sharedFields = allFields.filter(function(field) {
65675           return sharedTotalFields.indexOf(field) !== -1;
65676         });
65677         var sharedMoreFields = allMoreFields.filter(function(field) {
65678           return sharedTotalFields.indexOf(field) !== -1;
65679         });
65680         _fieldsArr = [];
65681         sharedFields.forEach(function(field) {
65682           if (field.matchAllGeometry(geometries)) {
65683             _fieldsArr.push(
65684               uiField(context, field, _entityIDs)
65685             );
65686           }
65687         });
65688         var singularEntity = _entityIDs.length === 1 && graph.hasEntity(_entityIDs[0]);
65689         if (singularEntity && singularEntity.isHighwayIntersection(graph) && presetsManager.field("restrictions")) {
65690           _fieldsArr.push(
65691             uiField(context, presetsManager.field("restrictions"), _entityIDs)
65692           );
65693         }
65694         var additionalFields = utilArrayUnion(sharedMoreFields, presetsManager.universal());
65695         additionalFields.sort(function(field1, field2) {
65696           return field1.title().localeCompare(field2.title(), _mainLocalizer.localeCode());
65697         });
65698         additionalFields.forEach(function(field) {
65699           if (sharedFields.indexOf(field) === -1 && field.matchAllGeometry(geometries)) {
65700             _fieldsArr.push(
65701               uiField(context, field, _entityIDs, { show: false })
65702             );
65703           }
65704         });
65705         _fieldsArr.forEach(function(field) {
65706           field.on("change", function(t2, onInput) {
65707             dispatch14.call("change", field, _entityIDs, t2, onInput);
65708           }).on("revert", function(keys2) {
65709             dispatch14.call("revert", field, keys2);
65710           });
65711         });
65712       }
65713       _fieldsArr.forEach(function(field) {
65714         field.state(_state).tags(_tags);
65715       });
65716       selection2.call(
65717         formFields.fieldsArr(_fieldsArr).state(_state).klass("grouped-items-area")
65718       );
65719     }
65720     section.presets = function(val) {
65721       if (!arguments.length) return _presets;
65722       if (!_presets || !val || !utilArrayIdentical(_presets, val)) {
65723         _presets = val;
65724         _fieldsArr = null;
65725       }
65726       return section;
65727     };
65728     section.state = function(val) {
65729       if (!arguments.length) return _state;
65730       _state = val;
65731       return section;
65732     };
65733     section.tags = function(val) {
65734       if (!arguments.length) return _tags;
65735       _tags = val;
65736       return section;
65737     };
65738     section.entityIDs = function(val) {
65739       if (!arguments.length) return _entityIDs;
65740       if (!val || !_entityIDs || !utilArrayIdentical(_entityIDs, val)) {
65741         _entityIDs = val;
65742         _fieldsArr = null;
65743       }
65744       return section;
65745     };
65746     return utilRebind(section, dispatch14, "on");
65747   }
65748
65749   // modules/ui/sections/raw_member_editor.js
65750   function uiSectionRawMemberEditor(context) {
65751     var section = uiSection("raw-member-editor", context).shouldDisplay(function() {
65752       if (!_entityIDs || _entityIDs.length !== 1) return false;
65753       var entity = context.hasEntity(_entityIDs[0]);
65754       return entity && entity.type === "relation";
65755     }).label(function() {
65756       var entity = context.hasEntity(_entityIDs[0]);
65757       if (!entity) return "";
65758       var gt2 = entity.members.length > _maxMembers ? ">" : "";
65759       var count = gt2 + entity.members.slice(0, _maxMembers).length;
65760       return _t.append("inspector.title_count", { title: _t("inspector.members"), count });
65761     }).disclosureContent(renderDisclosureContent);
65762     var taginfo = services.taginfo;
65763     var _entityIDs;
65764     var _maxMembers = 1e3;
65765     function downloadMember(d3_event, d2) {
65766       d3_event.preventDefault();
65767       select_default2(this).classed("loading", true);
65768       context.loadEntity(d2.id, function() {
65769         section.reRender();
65770       });
65771     }
65772     function zoomToMember(d3_event, d2) {
65773       d3_event.preventDefault();
65774       var entity = context.entity(d2.id);
65775       context.map().zoomToEase(entity);
65776       utilHighlightEntities([d2.id], true, context);
65777     }
65778     function selectMember(d3_event, d2) {
65779       d3_event.preventDefault();
65780       utilHighlightEntities([d2.id], false, context);
65781       var entity = context.entity(d2.id);
65782       var mapExtent = context.map().extent();
65783       if (!entity.intersects(mapExtent, context.graph())) {
65784         context.map().zoomToEase(entity);
65785       }
65786       context.enter(modeSelect(context, [d2.id]));
65787     }
65788     function changeRole(d3_event, d2) {
65789       var oldRole = d2.role;
65790       var newRole = context.cleanRelationRole(select_default2(this).property("value"));
65791       if (oldRole !== newRole) {
65792         var member = { id: d2.id, type: d2.type, role: newRole };
65793         context.perform(
65794           actionChangeMember(d2.relation.id, member, d2.index),
65795           _t("operations.change_role.annotation", {
65796             n: 1
65797           })
65798         );
65799         context.validator().validate();
65800       }
65801     }
65802     function deleteMember(d3_event, d2) {
65803       utilHighlightEntities([d2.id], false, context);
65804       context.perform(
65805         actionDeleteMember(d2.relation.id, d2.index),
65806         _t("operations.delete_member.annotation", {
65807           n: 1
65808         })
65809       );
65810       if (!context.hasEntity(d2.relation.id)) {
65811         context.enter(modeBrowse(context));
65812       } else {
65813         context.validator().validate();
65814       }
65815     }
65816     function renderDisclosureContent(selection2) {
65817       var entityID = _entityIDs[0];
65818       var memberships = [];
65819       var entity = context.entity(entityID);
65820       entity.members.slice(0, _maxMembers).forEach(function(member, index) {
65821         memberships.push({
65822           index,
65823           id: member.id,
65824           type: member.type,
65825           role: member.role,
65826           relation: entity,
65827           member: context.hasEntity(member.id),
65828           domId: utilUniqueDomId(entityID + "-member-" + index)
65829         });
65830       });
65831       var list2 = selection2.selectAll(".member-list").data([0]);
65832       list2 = list2.enter().append("ul").attr("class", "member-list").merge(list2);
65833       var items = list2.selectAll("li").data(memberships, function(d2) {
65834         return osmEntity.key(d2.relation) + "," + d2.index + "," + (d2.member ? osmEntity.key(d2.member) : "incomplete");
65835       });
65836       items.exit().each(unbind).remove();
65837       var itemsEnter = items.enter().append("li").attr("class", "member-row form-field").classed("member-incomplete", function(d2) {
65838         return !d2.member;
65839       });
65840       itemsEnter.each(function(d2) {
65841         var item = select_default2(this);
65842         var label = item.append("label").attr("class", "field-label").attr("for", d2.domId);
65843         if (d2.member) {
65844           item.on("mouseover", function() {
65845             utilHighlightEntities([d2.id], true, context);
65846           }).on("mouseout", function() {
65847             utilHighlightEntities([d2.id], false, context);
65848           });
65849           var labelLink = label.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectMember);
65850           labelLink.append("span").attr("class", "member-entity-type").text(function(d4) {
65851             var matched = _mainPresetIndex.match(d4.member, context.graph());
65852             return matched && matched.name() || utilDisplayType(d4.member.id);
65853           });
65854           labelLink.append("span").attr("class", "member-entity-name").classed("has-colour", (d4) => d4.member.type === "relation" && d4.member.tags.colour && isColourValid(d4.member.tags.colour)).style("border-color", (d4) => d4.member.type === "relation" && d4.member.tags.colour).text(function(d4) {
65855             return utilDisplayName(d4.member);
65856           });
65857           label.append("button").attr("title", _t("icons.remove")).attr("class", "remove member-delete").call(svgIcon("#iD-operation-delete"));
65858           label.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToMember);
65859         } else {
65860           var labelText = label.append("span").attr("class", "label-text");
65861           labelText.append("span").attr("class", "member-entity-type").call(_t.append("inspector." + d2.type, { id: d2.id }));
65862           labelText.append("span").attr("class", "member-entity-name").call(_t.append("inspector.incomplete", { id: d2.id }));
65863           label.append("button").attr("class", "member-download").attr("title", _t("icons.download")).call(svgIcon("#iD-icon-load")).on("click", downloadMember);
65864         }
65865       });
65866       var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
65867       wrapEnter.append("input").attr("class", "member-role").attr("id", function(d2) {
65868         return d2.domId;
65869       }).property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
65870       if (taginfo) {
65871         wrapEnter.each(bindTypeahead);
65872       }
65873       items = items.merge(itemsEnter).order();
65874       items.select("input.member-role").property("value", function(d2) {
65875         return d2.role;
65876       }).on("blur", changeRole).on("change", changeRole);
65877       items.select("button.member-delete").on("click", deleteMember);
65878       var dragOrigin, targetIndex;
65879       items.call(
65880         drag_default().on("start", function(d3_event) {
65881           dragOrigin = {
65882             x: d3_event.x,
65883             y: d3_event.y
65884           };
65885           targetIndex = null;
65886         }).on("drag", function(d3_event) {
65887           var x2 = d3_event.x - dragOrigin.x, y2 = d3_event.y - dragOrigin.y;
65888           if (!select_default2(this).classed("dragging") && // don't display drag until dragging beyond a distance threshold
65889           Math.sqrt(Math.pow(x2, 2) + Math.pow(y2, 2)) <= 5) return;
65890           var index = items.nodes().indexOf(this);
65891           select_default2(this).classed("dragging", true);
65892           targetIndex = null;
65893           selection2.selectAll("li.member-row").style("transform", function(d2, index2) {
65894             var node = select_default2(this).node();
65895             if (index === index2) {
65896               return "translate(" + x2 + "px, " + y2 + "px)";
65897             } else if (index2 > index && d3_event.y > node.offsetTop) {
65898               if (targetIndex === null || index2 > targetIndex) {
65899                 targetIndex = index2;
65900               }
65901               return "translateY(-100%)";
65902             } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
65903               if (targetIndex === null || index2 < targetIndex) {
65904                 targetIndex = index2;
65905               }
65906               return "translateY(100%)";
65907             }
65908             return null;
65909           });
65910         }).on("end", function(d3_event, d2) {
65911           if (!select_default2(this).classed("dragging")) return;
65912           var index = items.nodes().indexOf(this);
65913           select_default2(this).classed("dragging", false);
65914           selection2.selectAll("li.member-row").style("transform", null);
65915           if (targetIndex !== null) {
65916             context.perform(
65917               actionMoveMember(d2.relation.id, index, targetIndex),
65918               _t("operations.reorder_members.annotation")
65919             );
65920             context.validator().validate();
65921           }
65922         })
65923       );
65924       function bindTypeahead(d2) {
65925         var row = select_default2(this);
65926         var role = row.selectAll("input.member-role");
65927         var origValue = role.property("value");
65928         function sort(value, data) {
65929           var sameletter = [];
65930           var other = [];
65931           for (var i3 = 0; i3 < data.length; i3++) {
65932             if (data[i3].value.substring(0, value.length) === value) {
65933               sameletter.push(data[i3]);
65934             } else {
65935               other.push(data[i3]);
65936             }
65937           }
65938           return sameletter.concat(other);
65939         }
65940         role.call(
65941           uiCombobox(context, "member-role").fetcher(function(role2, callback) {
65942             var geometry;
65943             if (d2.member) {
65944               geometry = context.graph().geometry(d2.member.id);
65945             } else if (d2.type === "relation") {
65946               geometry = "relation";
65947             } else if (d2.type === "way") {
65948               geometry = "line";
65949             } else {
65950               geometry = "point";
65951             }
65952             var rtype = entity.tags.type;
65953             taginfo.roles({
65954               debounce: true,
65955               rtype: rtype || "",
65956               geometry,
65957               query: role2
65958             }, function(err, data) {
65959               if (!err) callback(sort(role2, data));
65960             });
65961           }).on("cancel", function() {
65962             role.property("value", origValue);
65963           })
65964         );
65965       }
65966       function unbind() {
65967         var row = select_default2(this);
65968         row.selectAll("input.member-role").call(uiCombobox.off, context);
65969       }
65970     }
65971     section.entityIDs = function(val) {
65972       if (!arguments.length) return _entityIDs;
65973       _entityIDs = val;
65974       return section;
65975     };
65976     return section;
65977   }
65978
65979   // modules/actions/delete_members.js
65980   function actionDeleteMembers(relationId, memberIndexes) {
65981     return function(graph) {
65982       memberIndexes.sort((a2, b2) => b2 - a2);
65983       for (var i3 in memberIndexes) {
65984         graph = actionDeleteMember(relationId, memberIndexes[i3])(graph);
65985       }
65986       return graph;
65987     };
65988   }
65989
65990   // modules/ui/sections/raw_membership_editor.js
65991   function uiSectionRawMembershipEditor(context) {
65992     var section = uiSection("raw-membership-editor", context).shouldDisplay(function() {
65993       return _entityIDs && _entityIDs.length;
65994     }).label(function() {
65995       var parents = getSharedParentRelations();
65996       var gt2 = parents.length > _maxMemberships ? ">" : "";
65997       var count = gt2 + parents.slice(0, _maxMemberships).length;
65998       return _t.append("inspector.title_count", { title: _t("inspector.relations"), count });
65999     }).disclosureContent(renderDisclosureContent);
66000     var taginfo = services.taginfo;
66001     var nearbyCombo = uiCombobox(context, "parent-relation").minItems(1).fetcher(fetchNearbyRelations).itemsMouseEnter(function(d3_event, d2) {
66002       if (d2.relation) utilHighlightEntities([d2.relation.id], true, context);
66003     }).itemsMouseLeave(function(d3_event, d2) {
66004       if (d2.relation) utilHighlightEntities([d2.relation.id], false, context);
66005     });
66006     var _inChange = false;
66007     var _entityIDs = [];
66008     var _showBlank;
66009     var _maxMemberships = 1e3;
66010     function getSharedParentRelations() {
66011       var parents = [];
66012       for (var i3 = 0; i3 < _entityIDs.length; i3++) {
66013         var entity = context.graph().hasEntity(_entityIDs[i3]);
66014         if (!entity) continue;
66015         if (i3 === 0) {
66016           parents = context.graph().parentRelations(entity);
66017         } else {
66018           parents = utilArrayIntersection(parents, context.graph().parentRelations(entity));
66019         }
66020         if (!parents.length) break;
66021       }
66022       return parents;
66023     }
66024     function getMemberships() {
66025       var memberships = [];
66026       var relations = getSharedParentRelations().slice(0, _maxMemberships);
66027       var isMultiselect = _entityIDs.length > 1;
66028       var i3, relation, membership, index, member, indexedMember;
66029       for (i3 = 0; i3 < relations.length; i3++) {
66030         relation = relations[i3];
66031         membership = {
66032           relation,
66033           members: [],
66034           hash: osmEntity.key(relation)
66035         };
66036         for (index = 0; index < relation.members.length; index++) {
66037           member = relation.members[index];
66038           if (_entityIDs.indexOf(member.id) !== -1) {
66039             indexedMember = Object.assign({}, member, { index });
66040             membership.members.push(indexedMember);
66041             membership.hash += "," + index.toString();
66042             if (!isMultiselect) {
66043               memberships.push(membership);
66044               membership = {
66045                 relation,
66046                 members: [],
66047                 hash: osmEntity.key(relation)
66048               };
66049             }
66050           }
66051         }
66052         if (membership.members.length) memberships.push(membership);
66053       }
66054       memberships.forEach(function(membership2) {
66055         membership2.domId = utilUniqueDomId("membership-" + membership2.relation.id);
66056         var roles = [];
66057         membership2.members.forEach(function(member2) {
66058           if (roles.indexOf(member2.role) === -1) roles.push(member2.role);
66059         });
66060         membership2.role = roles.length === 1 ? roles[0] : roles;
66061       });
66062       return memberships;
66063     }
66064     function selectRelation(d3_event, d2) {
66065       d3_event.preventDefault();
66066       utilHighlightEntities([d2.relation.id], false, context);
66067       context.enter(modeSelect(context, [d2.relation.id]));
66068     }
66069     function zoomToRelation(d3_event, d2) {
66070       d3_event.preventDefault();
66071       var entity = context.entity(d2.relation.id);
66072       context.map().zoomToEase(entity);
66073       utilHighlightEntities([d2.relation.id], true, context);
66074     }
66075     function changeRole(d3_event, d2) {
66076       if (d2 === 0) return;
66077       if (_inChange) return;
66078       var newRole = context.cleanRelationRole(select_default2(this).property("value"));
66079       if (!newRole.trim() && typeof d2.role !== "string") return;
66080       var membersToUpdate = d2.members.filter(function(member) {
66081         return member.role !== newRole;
66082       });
66083       if (membersToUpdate.length) {
66084         _inChange = true;
66085         context.perform(
66086           function actionChangeMemberRoles(graph) {
66087             membersToUpdate.forEach(function(member) {
66088               var newMember = Object.assign({}, member, { role: newRole });
66089               delete newMember.index;
66090               graph = actionChangeMember(d2.relation.id, newMember, member.index)(graph);
66091             });
66092             return graph;
66093           },
66094           _t("operations.change_role.annotation", {
66095             n: membersToUpdate.length
66096           })
66097         );
66098         context.validator().validate();
66099       }
66100       _inChange = false;
66101     }
66102     function addMembership(d2, role) {
66103       this.blur();
66104       _showBlank = false;
66105       function actionAddMembers(relationId, ids, role2) {
66106         return function(graph) {
66107           for (var i3 in ids) {
66108             var member = { id: ids[i3], type: graph.entity(ids[i3]).type, role: role2 };
66109             graph = actionAddMember(relationId, member)(graph);
66110           }
66111           return graph;
66112         };
66113       }
66114       if (d2.relation) {
66115         context.perform(
66116           actionAddMembers(d2.relation.id, _entityIDs, role),
66117           _t("operations.add_member.annotation", {
66118             n: _entityIDs.length
66119           })
66120         );
66121         context.validator().validate();
66122       } else {
66123         var relation = osmRelation();
66124         context.perform(
66125           actionAddEntity(relation),
66126           actionAddMembers(relation.id, _entityIDs, role),
66127           _t("operations.add.annotation.relation")
66128         );
66129         context.enter(modeSelect(context, [relation.id]).newFeature(true));
66130       }
66131     }
66132     function downloadMembers(d3_event, d2) {
66133       d3_event.preventDefault();
66134       const button = select_default2(this);
66135       button.classed("loading", true);
66136       context.loadEntity(d2.relation.id, function() {
66137         section.reRender();
66138       });
66139     }
66140     function deleteMembership(d3_event, d2) {
66141       this.blur();
66142       if (d2 === 0) return;
66143       utilHighlightEntities([d2.relation.id], false, context);
66144       var indexes = d2.members.map(function(member) {
66145         return member.index;
66146       });
66147       context.perform(
66148         actionDeleteMembers(d2.relation.id, indexes),
66149         _t("operations.delete_member.annotation", {
66150           n: _entityIDs.length
66151         })
66152       );
66153       context.validator().validate();
66154     }
66155     function fetchNearbyRelations(q2, callback) {
66156       var newRelation = {
66157         relation: null,
66158         value: _t("inspector.new_relation"),
66159         display: _t.append("inspector.new_relation")
66160       };
66161       var entityID = _entityIDs[0];
66162       var result = [];
66163       var graph = context.graph();
66164       function baseDisplayValue(entity) {
66165         var matched = _mainPresetIndex.match(entity, graph);
66166         var presetName = matched && matched.name() || _t("inspector.relation");
66167         var entityName = utilDisplayName(entity) || "";
66168         return presetName + " " + entityName;
66169       }
66170       function baseDisplayLabel(entity) {
66171         var matched = _mainPresetIndex.match(entity, graph);
66172         var presetName = matched && matched.name() || _t("inspector.relation");
66173         var entityName = utilDisplayName(entity) || "";
66174         return (selection2) => {
66175           selection2.append("b").text(presetName + " ");
66176           selection2.append("span").classed("has-colour", entity.tags.colour && isColourValid(entity.tags.colour)).style("border-color", entity.tags.colour).text(entityName);
66177         };
66178       }
66179       var explicitRelation = q2 && context.hasEntity(q2.toLowerCase());
66180       if (explicitRelation && explicitRelation.type === "relation" && explicitRelation.id !== entityID) {
66181         result.push({
66182           relation: explicitRelation,
66183           value: baseDisplayValue(explicitRelation) + " " + explicitRelation.id,
66184           display: baseDisplayLabel(explicitRelation)
66185         });
66186       } else {
66187         context.history().intersects(context.map().extent()).forEach(function(entity) {
66188           if (entity.type !== "relation" || entity.id === entityID) return;
66189           var value = baseDisplayValue(entity);
66190           if (q2 && (value + " " + entity.id).toLowerCase().indexOf(q2.toLowerCase()) === -1) return;
66191           result.push({
66192             relation: entity,
66193             value,
66194             display: baseDisplayLabel(entity)
66195           });
66196         });
66197         result.sort(function(a2, b2) {
66198           return osmRelation.creationOrder(a2.relation, b2.relation);
66199         });
66200         var dupeGroups = Object.values(utilArrayGroupBy(result, "value")).filter(function(v2) {
66201           return v2.length > 1;
66202         });
66203         dupeGroups.forEach(function(group) {
66204           group.forEach(function(obj) {
66205             obj.value += " " + obj.relation.id;
66206           });
66207         });
66208       }
66209       result.forEach(function(obj) {
66210         obj.title = obj.value;
66211       });
66212       result.unshift(newRelation);
66213       callback(result);
66214     }
66215     function renderDisclosureContent(selection2) {
66216       var memberships = getMemberships();
66217       var list2 = selection2.selectAll(".member-list").data([0]);
66218       list2 = list2.enter().append("ul").attr("class", "member-list").merge(list2);
66219       var items = list2.selectAll("li.member-row-normal").data(memberships, function(d2) {
66220         return d2.hash;
66221       });
66222       items.exit().each(unbind).remove();
66223       var itemsEnter = items.enter().append("li").attr("class", "member-row member-row-normal form-field");
66224       itemsEnter.on("mouseover", function(d3_event, d2) {
66225         utilHighlightEntities([d2.relation.id], true, context);
66226       }).on("mouseout", function(d3_event, d2) {
66227         utilHighlightEntities([d2.relation.id], false, context);
66228       });
66229       var labelEnter = itemsEnter.append("label").attr("class", "field-label").attr("for", function(d2) {
66230         return d2.domId;
66231       });
66232       var labelLink = labelEnter.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectRelation);
66233       labelLink.append("span").attr("class", "member-entity-type").text(function(d2) {
66234         var matched = _mainPresetIndex.match(d2.relation, context.graph());
66235         return matched && matched.name() || _t.html("inspector.relation");
66236       });
66237       labelLink.append("span").attr("class", "member-entity-name").classed("has-colour", (d2) => d2.relation.tags.colour && isColourValid(d2.relation.tags.colour)).style("border-color", (d2) => d2.relation.tags.colour).text(function(d2) {
66238         return utilDisplayName(d2.relation);
66239       });
66240       labelEnter.append("button").attr("class", "members-download").attr("title", _t("icons.download")).call(svgIcon("#iD-icon-load")).on("click", downloadMembers);
66241       labelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", deleteMembership);
66242       labelEnter.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToRelation);
66243       items = items.merge(itemsEnter);
66244       items.selectAll("button.members-download").classed("hide", (d2) => {
66245         const graph = context.graph();
66246         return d2.relation.members.every((m2) => graph.hasEntity(m2.id));
66247       });
66248       var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
66249       wrapEnter.append("input").attr("class", "member-role").attr("id", function(d2) {
66250         return d2.domId;
66251       }).property("type", "text").property("value", function(d2) {
66252         return typeof d2.role === "string" ? d2.role : "";
66253       }).attr("title", function(d2) {
66254         return Array.isArray(d2.role) ? d2.role.filter(Boolean).join("\n") : d2.role;
66255       }).attr("placeholder", function(d2) {
66256         return Array.isArray(d2.role) ? _t("inspector.multiple_roles") : _t("inspector.role");
66257       }).classed("mixed", function(d2) {
66258         return Array.isArray(d2.role);
66259       }).call(utilNoAuto).on("blur", changeRole).on("change", changeRole);
66260       if (taginfo) {
66261         wrapEnter.each(bindTypeahead);
66262       }
66263       var newMembership = list2.selectAll(".member-row-new").data(_showBlank ? [0] : []);
66264       newMembership.exit().remove();
66265       var newMembershipEnter = newMembership.enter().append("li").attr("class", "member-row member-row-new form-field");
66266       var newLabelEnter = newMembershipEnter.append("label").attr("class", "field-label");
66267       newLabelEnter.append("input").attr("placeholder", _t("inspector.choose_relation")).attr("type", "text").attr("class", "member-entity-input").call(utilNoAuto);
66268       newLabelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", function() {
66269         list2.selectAll(".member-row-new").remove();
66270       });
66271       var newWrapEnter = newMembershipEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
66272       newWrapEnter.append("input").attr("class", "member-role").property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
66273       newMembership = newMembership.merge(newMembershipEnter);
66274       newMembership.selectAll(".member-entity-input").on("blur", cancelEntity).call(
66275         nearbyCombo.on("accept", acceptEntity).on("cancel", cancelEntity)
66276       );
66277       var addRow = selection2.selectAll(".add-row").data([0]);
66278       var addRowEnter = addRow.enter().append("div").attr("class", "add-row");
66279       var addRelationButton = addRowEnter.append("button").attr("class", "add-relation").attr("aria-label", _t("inspector.add_to_relation"));
66280       addRelationButton.call(svgIcon("#iD-icon-plus", "light"));
66281       addRelationButton.call(uiTooltip().title(() => _t.append("inspector.add_to_relation")).placement(_mainLocalizer.textDirection() === "ltr" ? "right" : "left"));
66282       addRowEnter.append("div").attr("class", "space-value");
66283       addRowEnter.append("div").attr("class", "space-buttons");
66284       addRow = addRow.merge(addRowEnter);
66285       addRow.select(".add-relation").on("click", function() {
66286         _showBlank = true;
66287         section.reRender();
66288         list2.selectAll(".member-entity-input").node().focus();
66289       });
66290       function acceptEntity(d2) {
66291         if (!d2) {
66292           cancelEntity();
66293           return;
66294         }
66295         if (d2.relation) utilHighlightEntities([d2.relation.id], false, context);
66296         var role = context.cleanRelationRole(list2.selectAll(".member-row-new .member-role").property("value"));
66297         addMembership(d2, role);
66298       }
66299       function cancelEntity() {
66300         var input = newMembership.selectAll(".member-entity-input");
66301         input.property("value", "");
66302         context.surface().selectAll(".highlighted").classed("highlighted", false);
66303       }
66304       function bindTypeahead(d2) {
66305         var row = select_default2(this);
66306         var role = row.selectAll("input.member-role");
66307         var origValue = role.property("value");
66308         function sort(value, data) {
66309           var sameletter = [];
66310           var other = [];
66311           for (var i3 = 0; i3 < data.length; i3++) {
66312             if (data[i3].value.substring(0, value.length) === value) {
66313               sameletter.push(data[i3]);
66314             } else {
66315               other.push(data[i3]);
66316             }
66317           }
66318           return sameletter.concat(other);
66319         }
66320         role.call(
66321           uiCombobox(context, "member-role").fetcher(function(role2, callback) {
66322             var rtype = d2.relation.tags.type;
66323             taginfo.roles({
66324               debounce: true,
66325               rtype: rtype || "",
66326               geometry: context.graph().geometry(_entityIDs[0]),
66327               query: role2
66328             }, function(err, data) {
66329               if (!err) callback(sort(role2, data));
66330             });
66331           }).on("cancel", function() {
66332             role.property("value", origValue);
66333           })
66334         );
66335       }
66336       function unbind() {
66337         var row = select_default2(this);
66338         row.selectAll("input.member-role").call(uiCombobox.off, context);
66339       }
66340     }
66341     section.entityIDs = function(val) {
66342       if (!arguments.length) return _entityIDs;
66343       _entityIDs = val;
66344       _showBlank = false;
66345       return section;
66346     };
66347     return section;
66348   }
66349
66350   // modules/ui/sections/selection_list.js
66351   function uiSectionSelectionList(context) {
66352     var _selectedIDs = [];
66353     var section = uiSection("selected-features", context).shouldDisplay(function() {
66354       return _selectedIDs.length > 1;
66355     }).label(function() {
66356       return _t.append("inspector.title_count", { title: _t("inspector.features"), count: _selectedIDs.length });
66357     }).disclosureContent(renderDisclosureContent);
66358     context.history().on("change.selectionList", function(difference2) {
66359       if (difference2) {
66360         section.reRender();
66361       }
66362     });
66363     section.entityIDs = function(val) {
66364       if (!arguments.length) return _selectedIDs;
66365       _selectedIDs = val;
66366       return section;
66367     };
66368     function selectEntity(d3_event, entity) {
66369       context.enter(modeSelect(context, [entity.id]));
66370     }
66371     function deselectEntity(d3_event, entity) {
66372       var selectedIDs = _selectedIDs.slice();
66373       var index = selectedIDs.indexOf(entity.id);
66374       if (index > -1) {
66375         selectedIDs.splice(index, 1);
66376         context.enter(modeSelect(context, selectedIDs));
66377       }
66378     }
66379     function renderDisclosureContent(selection2) {
66380       var list2 = selection2.selectAll(".feature-list").data([0]);
66381       list2 = list2.enter().append("ul").attr("class", "feature-list").merge(list2);
66382       var entities = _selectedIDs.map(function(id2) {
66383         return context.hasEntity(id2);
66384       }).filter(Boolean);
66385       var items = list2.selectAll(".feature-list-item").data(entities, osmEntity.key);
66386       items.exit().remove();
66387       var enter = items.enter().append("li").attr("class", "feature-list-item").each(function(d2) {
66388         select_default2(this).on("mouseover", function() {
66389           utilHighlightEntities([d2.id], true, context);
66390         }).on("mouseout", function() {
66391           utilHighlightEntities([d2.id], false, context);
66392         });
66393       });
66394       var label = enter.append("button").attr("class", "label").on("click", selectEntity);
66395       label.append("span").attr("class", "entity-geom-icon").call(svgIcon("", "pre-text"));
66396       label.append("span").attr("class", "entity-type");
66397       label.append("span").attr("class", "entity-name");
66398       enter.append("button").attr("class", "close").attr("title", _t("icons.deselect")).on("click", deselectEntity).call(svgIcon("#iD-icon-close"));
66399       items = items.merge(enter);
66400       items.selectAll(".entity-geom-icon use").attr("href", function() {
66401         var entity = this.parentNode.parentNode.__data__;
66402         return "#iD-icon-" + entity.geometry(context.graph());
66403       });
66404       items.selectAll(".entity-type").text(function(entity) {
66405         return _mainPresetIndex.match(entity, context.graph()).name();
66406       });
66407       items.selectAll(".entity-name").text(function(d2) {
66408         var entity = context.entity(d2.id);
66409         return utilDisplayName(entity);
66410       });
66411     }
66412     return section;
66413   }
66414
66415   // modules/ui/entity_editor.js
66416   function uiEntityEditor(context) {
66417     var dispatch14 = dispatch_default("choose");
66418     var _state = "select";
66419     var _coalesceChanges = false;
66420     var _modified = false;
66421     var _base;
66422     var _entityIDs;
66423     var _activePresets = [];
66424     var _newFeature;
66425     var _sections;
66426     function entityEditor(selection2) {
66427       var combinedTags = utilCombinedTags(_entityIDs, context.graph());
66428       var header = selection2.selectAll(".header").data([0]);
66429       var headerEnter = header.enter().append("div").attr("class", "header fillL");
66430       var direction = _mainLocalizer.textDirection() === "rtl" ? "forward" : "backward";
66431       headerEnter.append("button").attr("class", "preset-reset preset-choose").attr("title", _t("inspector.back_tooltip")).call(svgIcon("#iD-icon-".concat(direction)));
66432       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
66433         context.enter(modeBrowse(context));
66434       }).call(svgIcon(_modified ? "#iD-icon-apply" : "#iD-icon-close"));
66435       headerEnter.append("h2");
66436       header = header.merge(headerEnter);
66437       header.selectAll("h2").text("").call(_entityIDs.length === 1 ? _t.append("inspector.edit") : _t.append("inspector.edit_features"));
66438       header.selectAll(".preset-reset").on("click", function() {
66439         dispatch14.call("choose", this, _activePresets);
66440       });
66441       var body = selection2.selectAll(".inspector-body").data([0]);
66442       var bodyEnter = body.enter().append("div").attr("class", "entity-editor inspector-body sep-top");
66443       body = body.merge(bodyEnter);
66444       if (!_sections) {
66445         _sections = [
66446           uiSectionSelectionList(context),
66447           uiSectionFeatureType(context).on("choose", function(presets) {
66448             dispatch14.call("choose", this, presets);
66449           }),
66450           uiSectionEntityIssues(context),
66451           uiSectionPresetFields(context).on("change", changeTags).on("revert", revertTags),
66452           uiSectionRawTagEditor("raw-tag-editor", context).on("change", changeTags),
66453           uiSectionRawMemberEditor(context),
66454           uiSectionRawMembershipEditor(context)
66455         ];
66456       }
66457       _sections.forEach(function(section) {
66458         if (section.entityIDs) {
66459           section.entityIDs(_entityIDs);
66460         }
66461         if (section.presets) {
66462           section.presets(_activePresets);
66463         }
66464         if (section.tags) {
66465           section.tags(combinedTags);
66466         }
66467         if (section.state) {
66468           section.state(_state);
66469         }
66470         body.call(section.render);
66471       });
66472       context.history().on("change.entity-editor", historyChanged);
66473       function historyChanged(difference2) {
66474         if (selection2.selectAll(".entity-editor").empty()) return;
66475         if (_state === "hide") return;
66476         var significant = !difference2 || difference2.didChange.properties || difference2.didChange.addition || difference2.didChange.deletion;
66477         if (!significant) return;
66478         _entityIDs = _entityIDs.filter(context.hasEntity);
66479         if (!_entityIDs.length) return;
66480         var priorActivePreset = _activePresets.length === 1 && _activePresets[0];
66481         loadActivePresets();
66482         var graph = context.graph();
66483         entityEditor.modified(_base !== graph);
66484         entityEditor(selection2);
66485         if (priorActivePreset && _activePresets.length === 1 && priorActivePreset !== _activePresets[0]) {
66486           context.container().selectAll(".entity-editor button.preset-reset .label").style("background-color", "#fff").transition().duration(750).style("background-color", null);
66487         }
66488       }
66489     }
66490     function changeTags(entityIDs, changed, onInput) {
66491       var actions = [];
66492       for (var i3 in entityIDs) {
66493         var entityID = entityIDs[i3];
66494         var entity = context.entity(entityID);
66495         var tags = Object.assign({}, entity.tags);
66496         if (typeof changed === "function") {
66497           tags = changed(tags);
66498         } else {
66499           for (var k2 in changed) {
66500             if (!k2) continue;
66501             var v2 = changed[k2];
66502             if (typeof v2 === "object") {
66503               tags[k2] = tags[v2.oldKey];
66504             } else if (v2 !== void 0 || tags.hasOwnProperty(k2)) {
66505               tags[k2] = v2;
66506             }
66507           }
66508         }
66509         if (!onInput) {
66510           tags = utilCleanTags(tags);
66511         }
66512         if (!(0, import_fast_deep_equal9.default)(entity.tags, tags)) {
66513           actions.push(actionChangeTags(entityID, tags));
66514         }
66515       }
66516       if (actions.length) {
66517         var combinedAction = function(graph) {
66518           actions.forEach(function(action) {
66519             graph = action(graph);
66520           });
66521           return graph;
66522         };
66523         var annotation = _t("operations.change_tags.annotation");
66524         if (_coalesceChanges) {
66525           context.overwrite(combinedAction, annotation);
66526         } else {
66527           context.perform(combinedAction, annotation);
66528           _coalesceChanges = !!onInput;
66529         }
66530       }
66531       if (!onInput) {
66532         context.validator().validate();
66533       }
66534     }
66535     function revertTags(keys2) {
66536       var actions = [];
66537       for (var i3 in _entityIDs) {
66538         var entityID = _entityIDs[i3];
66539         var original = context.graph().base().entities[entityID];
66540         var changed = {};
66541         for (var j2 in keys2) {
66542           var key = keys2[j2];
66543           changed[key] = original ? original.tags[key] : void 0;
66544         }
66545         var entity = context.entity(entityID);
66546         var tags = Object.assign({}, entity.tags);
66547         for (var k2 in changed) {
66548           if (!k2) continue;
66549           var v2 = changed[k2];
66550           if (v2 !== void 0 || tags.hasOwnProperty(k2)) {
66551             tags[k2] = v2;
66552           }
66553         }
66554         tags = utilCleanTags(tags);
66555         if (!(0, import_fast_deep_equal9.default)(entity.tags, tags)) {
66556           actions.push(actionChangeTags(entityID, tags));
66557         }
66558       }
66559       if (actions.length) {
66560         var combinedAction = function(graph) {
66561           actions.forEach(function(action) {
66562             graph = action(graph);
66563           });
66564           return graph;
66565         };
66566         var annotation = _t("operations.change_tags.annotation");
66567         if (_coalesceChanges) {
66568           context.overwrite(combinedAction, annotation);
66569         } else {
66570           context.perform(combinedAction, annotation);
66571           _coalesceChanges = false;
66572         }
66573       }
66574       context.validator().validate();
66575     }
66576     entityEditor.modified = function(val) {
66577       if (!arguments.length) return _modified;
66578       _modified = val;
66579       return entityEditor;
66580     };
66581     entityEditor.state = function(val) {
66582       if (!arguments.length) return _state;
66583       _state = val;
66584       return entityEditor;
66585     };
66586     entityEditor.entityIDs = function(val) {
66587       if (!arguments.length) return _entityIDs;
66588       _base = context.graph();
66589       _coalesceChanges = false;
66590       if (val && _entityIDs && utilArrayIdentical(_entityIDs, val)) return entityEditor;
66591       _entityIDs = val;
66592       loadActivePresets(true);
66593       return entityEditor.modified(false);
66594     };
66595     entityEditor.newFeature = function(val) {
66596       if (!arguments.length) return _newFeature;
66597       _newFeature = val;
66598       return entityEditor;
66599     };
66600     function loadActivePresets(isForNewSelection) {
66601       var graph = context.graph();
66602       var counts = {};
66603       for (var i3 in _entityIDs) {
66604         var entity = graph.hasEntity(_entityIDs[i3]);
66605         if (!entity) return;
66606         var match = _mainPresetIndex.match(entity, graph);
66607         if (!counts[match.id]) counts[match.id] = 0;
66608         counts[match.id] += 1;
66609       }
66610       var matches = Object.keys(counts).sort(function(p1, p2) {
66611         return counts[p2] - counts[p1];
66612       }).map(function(pID) {
66613         return _mainPresetIndex.item(pID);
66614       });
66615       if (!isForNewSelection) {
66616         var weakPreset = _activePresets.length === 1 && !_activePresets[0].isFallback() && Object.keys(_activePresets[0].addTags || {}).length === 0;
66617         if (weakPreset && matches.length === 1 && matches[0].isFallback()) return;
66618       }
66619       entityEditor.presets(matches);
66620     }
66621     entityEditor.presets = function(val) {
66622       if (!arguments.length) return _activePresets;
66623       if (!utilArrayIdentical(val, _activePresets)) {
66624         _activePresets = val;
66625       }
66626       return entityEditor;
66627     };
66628     return utilRebind(entityEditor, dispatch14, "on");
66629   }
66630
66631   // modules/ui/preset_list.js
66632   function uiPresetList(context) {
66633     var dispatch14 = dispatch_default("cancel", "choose");
66634     var _entityIDs;
66635     var _currLoc;
66636     var _currentPresets;
66637     var _autofocus = false;
66638     function presetList(selection2) {
66639       if (!_entityIDs) return;
66640       var presets = _mainPresetIndex.matchAllGeometry(entityGeometries());
66641       selection2.html("");
66642       var messagewrap = selection2.append("div").attr("class", "header fillL");
66643       var message = messagewrap.append("h2").call(_t.append("inspector.choose"));
66644       var direction = _mainLocalizer.textDirection() === "rtl" ? "backward" : "forward";
66645       messagewrap.append("button").attr("class", "preset-choose").attr("title", _entityIDs.length === 1 ? _t("inspector.edit") : _t("inspector.edit_features")).on("click", function() {
66646         dispatch14.call("cancel", this);
66647       }).call(svgIcon("#iD-icon-".concat(direction)));
66648       function initialKeydown(d3_event) {
66649         if (search.property("value").length === 0 && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
66650           d3_event.preventDefault();
66651           d3_event.stopPropagation();
66652           operationDelete(context, _entityIDs)();
66653         } else if (search.property("value").length === 0 && (d3_event.ctrlKey || d3_event.metaKey) && d3_event.keyCode === utilKeybinding.keyCodes.z) {
66654           d3_event.preventDefault();
66655           d3_event.stopPropagation();
66656           context.undo();
66657         } else if (!d3_event.ctrlKey && !d3_event.metaKey) {
66658           select_default2(this).on("keydown", keydown);
66659           keydown.call(this, d3_event);
66660         }
66661       }
66662       function keydown(d3_event) {
66663         if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"] && // if insertion point is at the end of the string
66664         search.node().selectionStart === search.property("value").length) {
66665           d3_event.preventDefault();
66666           d3_event.stopPropagation();
66667           var buttons = list2.selectAll(".preset-list-button");
66668           if (!buttons.empty()) buttons.nodes()[0].focus();
66669         }
66670       }
66671       function keypress(d3_event) {
66672         var value = search.property("value");
66673         if (d3_event.keyCode === 13 && // ↩ Return
66674         value.length) {
66675           list2.selectAll(".preset-list-item:first-child").each(function(d2) {
66676             d2.choose.call(this);
66677           });
66678         }
66679       }
66680       function inputevent() {
66681         var value = search.property("value");
66682         list2.classed("filtered", value.length);
66683         var results, messageText;
66684         if (value.length) {
66685           results = presets.search(value, entityGeometries()[0], _currLoc);
66686           messageText = _t.html("inspector.results", {
66687             n: results.collection.length,
66688             search: value
66689           });
66690         } else {
66691           var entityPresets2 = _entityIDs.map((entityID) => _mainPresetIndex.match(context.graph().entity(entityID), context.graph()));
66692           results = _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets2);
66693           messageText = _t.html("inspector.choose");
66694         }
66695         list2.call(drawList, results);
66696         message.html(messageText);
66697       }
66698       var searchWrap = selection2.append("div").attr("class", "search-header");
66699       searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
66700       var search = searchWrap.append("input").attr("class", "preset-search-input").attr("placeholder", _t("inspector.search")).attr("type", "search").call(utilNoAuto).on("keydown", initialKeydown).on("keypress", keypress).on("input", debounce_default(inputevent));
66701       if (_autofocus) {
66702         search.node().focus();
66703         setTimeout(function() {
66704           search.node().focus();
66705         }, 0);
66706       }
66707       var listWrap = selection2.append("div").attr("class", "inspector-body");
66708       var entityPresets = _entityIDs.map((entityID) => _mainPresetIndex.match(context.graph().entity(entityID), context.graph()));
66709       var list2 = listWrap.append("div").attr("class", "preset-list").call(drawList, _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets));
66710       context.features().on("change.preset-list", updateForFeatureHiddenState);
66711     }
66712     function drawList(list2, presets) {
66713       presets = presets.matchAllGeometry(entityGeometries());
66714       var collection = presets.collection.reduce(function(collection2, preset) {
66715         if (!preset) return collection2;
66716         if (preset.members) {
66717           if (preset.members.collection.filter(function(preset2) {
66718             return preset2.addable();
66719           }).length > 1) {
66720             collection2.push(CategoryItem(preset));
66721           }
66722         } else if (preset.addable()) {
66723           collection2.push(PresetItem(preset));
66724         }
66725         return collection2;
66726       }, []);
66727       var items = list2.selectAll(".preset-list-item").data(collection, function(d2) {
66728         return d2.preset.id;
66729       });
66730       items.order();
66731       items.exit().remove();
66732       items.enter().append("div").attr("class", function(item) {
66733         return "preset-list-item preset-" + item.preset.id.replace("/", "-");
66734       }).classed("current", function(item) {
66735         return _currentPresets.indexOf(item.preset) !== -1;
66736       }).each(function(item) {
66737         select_default2(this).call(item);
66738       }).style("opacity", 0).transition().style("opacity", 1);
66739       updateForFeatureHiddenState();
66740     }
66741     function itemKeydown(d3_event) {
66742       var item = select_default2(this.closest(".preset-list-item"));
66743       var parentItem = select_default2(item.node().parentNode.closest(".preset-list-item"));
66744       if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"]) {
66745         d3_event.preventDefault();
66746         d3_event.stopPropagation();
66747         var nextItem = select_default2(item.node().nextElementSibling);
66748         if (nextItem.empty()) {
66749           if (!parentItem.empty()) {
66750             nextItem = select_default2(parentItem.node().nextElementSibling);
66751           }
66752         } else if (select_default2(this).classed("expanded")) {
66753           nextItem = item.select(".subgrid .preset-list-item:first-child");
66754         }
66755         if (!nextItem.empty()) {
66756           nextItem.select(".preset-list-button").node().focus();
66757         }
66758       } else if (d3_event.keyCode === utilKeybinding.keyCodes["\u2191"]) {
66759         d3_event.preventDefault();
66760         d3_event.stopPropagation();
66761         var previousItem = select_default2(item.node().previousElementSibling);
66762         if (previousItem.empty()) {
66763           if (!parentItem.empty()) {
66764             previousItem = parentItem;
66765           }
66766         } else if (previousItem.select(".preset-list-button").classed("expanded")) {
66767           previousItem = previousItem.select(".subgrid .preset-list-item:last-child");
66768         }
66769         if (!previousItem.empty()) {
66770           previousItem.select(".preset-list-button").node().focus();
66771         } else {
66772           var search = select_default2(this.closest(".preset-list-pane")).select(".preset-search-input");
66773           search.node().focus();
66774         }
66775       } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
66776         d3_event.preventDefault();
66777         d3_event.stopPropagation();
66778         if (!parentItem.empty()) {
66779           parentItem.select(".preset-list-button").node().focus();
66780         }
66781       } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
66782         d3_event.preventDefault();
66783         d3_event.stopPropagation();
66784         item.datum().choose.call(select_default2(this).node());
66785       }
66786     }
66787     function CategoryItem(preset) {
66788       var box, sublist, shown = false;
66789       function item(selection2) {
66790         var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap category");
66791         function click() {
66792           var isExpanded = select_default2(this).classed("expanded");
66793           var iconName = isExpanded ? _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward" : "#iD-icon-down";
66794           select_default2(this).classed("expanded", !isExpanded).attr("title", !isExpanded ? _t("icons.collapse") : _t("icons.expand"));
66795           select_default2(this).selectAll("div.label-inner svg.icon use").attr("href", iconName);
66796           item.choose();
66797         }
66798         var geometries = entityGeometries();
66799         var button = wrap2.append("button").attr("class", "preset-list-button").attr("title", _t("icons.expand")).classed("expanded", false).call(uiPresetIcon().geometry(geometries.length === 1 && geometries[0]).preset(preset)).on("click", click).on("keydown", function(d3_event) {
66800           if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
66801             d3_event.preventDefault();
66802             d3_event.stopPropagation();
66803             if (!select_default2(this).classed("expanded")) {
66804               click.call(this, d3_event);
66805             }
66806           } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
66807             d3_event.preventDefault();
66808             d3_event.stopPropagation();
66809             if (select_default2(this).classed("expanded")) {
66810               click.call(this, d3_event);
66811             }
66812           } else {
66813             itemKeydown.call(this, d3_event);
66814           }
66815         });
66816         var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
66817         label.append("div").attr("class", "namepart").call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward", "inline")).append("span").call(preset.nameLabel()).append("span").text("\u2026");
66818         box = selection2.append("div").attr("class", "subgrid").style("max-height", "0px").style("opacity", 0);
66819         box.append("div").attr("class", "arrow");
66820         sublist = box.append("div").attr("class", "preset-list fillL3");
66821       }
66822       item.choose = function() {
66823         if (!box || !sublist) return;
66824         if (shown) {
66825           shown = false;
66826           box.transition().duration(200).style("opacity", "0").style("max-height", "0px").style("padding-bottom", "0px");
66827         } else {
66828           shown = true;
66829           var members = preset.members.matchAllGeometry(entityGeometries());
66830           sublist.call(drawList, members);
66831           box.transition().duration(200).style("opacity", "1").style("max-height", 200 + members.collection.length * 190 + "px").style("padding-bottom", "10px");
66832         }
66833       };
66834       item.preset = preset;
66835       return item;
66836     }
66837     function PresetItem(preset) {
66838       function item(selection2) {
66839         var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap");
66840         var geometries = entityGeometries();
66841         var button = wrap2.append("button").attr("class", "preset-list-button").call(uiPresetIcon().geometry(geometries.length === 1 && geometries[0]).preset(preset)).on("click", item.choose).on("keydown", itemKeydown);
66842         var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
66843         var nameparts = [
66844           preset.nameLabel(),
66845           preset.subtitleLabel()
66846         ].filter(Boolean);
66847         label.selectAll(".namepart").data(nameparts, (d2) => d2.stringId).enter().append("div").attr("class", "namepart").text("").each(function(d2) {
66848           d2(select_default2(this));
66849         });
66850         wrap2.call(item.reference.button);
66851         selection2.call(item.reference.body);
66852       }
66853       item.choose = function() {
66854         if (select_default2(this).classed("disabled")) return;
66855         if (!context.inIntro()) {
66856           _mainPresetIndex.setMostRecent(preset, entityGeometries()[0]);
66857         }
66858         context.perform(
66859           function(graph) {
66860             for (var i3 in _entityIDs) {
66861               var entityID = _entityIDs[i3];
66862               var oldPreset = _mainPresetIndex.match(graph.entity(entityID), graph);
66863               graph = actionChangePreset(entityID, oldPreset, preset)(graph);
66864             }
66865             return graph;
66866           },
66867           _t("operations.change_tags.annotation")
66868         );
66869         context.validator().validate();
66870         dispatch14.call("choose", this, preset);
66871       };
66872       item.help = function(d3_event) {
66873         d3_event.stopPropagation();
66874         item.reference.toggle();
66875       };
66876       item.preset = preset;
66877       item.reference = uiTagReference(preset.reference(), context);
66878       return item;
66879     }
66880     function updateForFeatureHiddenState() {
66881       if (!_entityIDs.every(context.hasEntity)) return;
66882       var geometries = entityGeometries();
66883       var button = context.container().selectAll(".preset-list .preset-list-button");
66884       button.call(uiTooltip().destroyAny);
66885       button.each(function(item, index) {
66886         var hiddenPresetFeaturesId;
66887         for (var i3 in geometries) {
66888           hiddenPresetFeaturesId = context.features().isHiddenPreset(item.preset, geometries[i3]);
66889           if (hiddenPresetFeaturesId) break;
66890         }
66891         var isHiddenPreset = !context.inIntro() && !!hiddenPresetFeaturesId && (_currentPresets.length !== 1 || item.preset !== _currentPresets[0]);
66892         select_default2(this).classed("disabled", isHiddenPreset);
66893         if (isHiddenPreset) {
66894           var isAutoHidden = context.features().autoHidden(hiddenPresetFeaturesId);
66895           select_default2(this).call(
66896             uiTooltip().title(() => _t.append("inspector.hidden_preset." + (isAutoHidden ? "zoom" : "manual"), {
66897               features: _t("feature." + hiddenPresetFeaturesId + ".description")
66898             })).placement(index < 2 ? "bottom" : "top")
66899           );
66900         }
66901       });
66902     }
66903     presetList.autofocus = function(val) {
66904       if (!arguments.length) return _autofocus;
66905       _autofocus = val;
66906       return presetList;
66907     };
66908     presetList.entityIDs = function(val) {
66909       if (!arguments.length) return _entityIDs;
66910       _entityIDs = val;
66911       _currLoc = null;
66912       if (_entityIDs && _entityIDs.length) {
66913         const extent = _entityIDs.reduce(function(extent2, entityID) {
66914           var entity = context.graph().entity(entityID);
66915           return extent2.extend(entity.extent(context.graph()));
66916         }, geoExtent());
66917         _currLoc = extent.center();
66918         var presets = _entityIDs.map(function(entityID) {
66919           return _mainPresetIndex.match(context.entity(entityID), context.graph());
66920         });
66921         presetList.presets(presets);
66922       }
66923       return presetList;
66924     };
66925     presetList.presets = function(val) {
66926       if (!arguments.length) return _currentPresets;
66927       _currentPresets = val;
66928       return presetList;
66929     };
66930     function entityGeometries() {
66931       var counts = {};
66932       for (var i3 in _entityIDs) {
66933         var entityID = _entityIDs[i3];
66934         var entity = context.entity(entityID);
66935         var geometry = entity.geometry(context.graph());
66936         if (geometry === "vertex" && entity.isOnAddressLine(context.graph())) {
66937           geometry = "point";
66938         }
66939         if (!counts[geometry]) counts[geometry] = 0;
66940         counts[geometry] += 1;
66941       }
66942       return Object.keys(counts).sort(function(geom1, geom2) {
66943         return counts[geom2] - counts[geom1];
66944       });
66945     }
66946     return utilRebind(presetList, dispatch14, "on");
66947   }
66948
66949   // modules/ui/inspector.js
66950   function uiInspector(context) {
66951     var presetList = uiPresetList(context);
66952     var entityEditor = uiEntityEditor(context);
66953     var wrap2 = select_default2(null), presetPane = select_default2(null), editorPane = select_default2(null);
66954     var _state = "select";
66955     var _entityIDs;
66956     var _newFeature = false;
66957     function inspector(selection2) {
66958       presetList.entityIDs(_entityIDs).autofocus(_newFeature).on("choose", inspector.setPreset).on("cancel", function() {
66959         inspector.setPreset();
66960       });
66961       entityEditor.state(_state).entityIDs(_entityIDs).on("choose", inspector.showList);
66962       wrap2 = selection2.selectAll(".panewrap").data([0]);
66963       var enter = wrap2.enter().append("div").attr("class", "panewrap");
66964       enter.append("div").attr("class", "preset-list-pane pane");
66965       enter.append("div").attr("class", "entity-editor-pane pane");
66966       wrap2 = wrap2.merge(enter);
66967       presetPane = wrap2.selectAll(".preset-list-pane");
66968       editorPane = wrap2.selectAll(".entity-editor-pane");
66969       function shouldDefaultToPresetList() {
66970         if (_state !== "select") return false;
66971         if (_entityIDs.length !== 1) return false;
66972         var entityID = _entityIDs[0];
66973         var entity = context.hasEntity(entityID);
66974         if (!entity) return false;
66975         if (entity.hasNonGeometryTags()) return false;
66976         if (_newFeature) return true;
66977         if (entity.geometry(context.graph()) !== "vertex") return false;
66978         if (context.graph().parentRelations(entity).length) return false;
66979         if (context.validator().getEntityIssues(entityID).length) return false;
66980         if (entity.isHighwayIntersection(context.graph())) return false;
66981         return true;
66982       }
66983       if (shouldDefaultToPresetList()) {
66984         wrap2.style("right", "-100%");
66985         editorPane.classed("hide", true);
66986         presetPane.classed("hide", false).call(presetList);
66987       } else {
66988         wrap2.style("right", "0%");
66989         presetPane.classed("hide", true);
66990         editorPane.classed("hide", false).call(entityEditor);
66991       }
66992       var footer = selection2.selectAll(".footer").data([0]);
66993       footer = footer.enter().append("div").attr("class", "footer").merge(footer);
66994       footer.call(
66995         uiViewOnOSM(context).what(context.hasEntity(_entityIDs.length === 1 && _entityIDs[0]))
66996       );
66997     }
66998     inspector.showList = function(presets) {
66999       presetPane.classed("hide", false);
67000       wrap2.transition().styleTween("right", function() {
67001         return value_default("0%", "-100%");
67002       }).on("end", function() {
67003         editorPane.classed("hide", true);
67004       });
67005       if (presets) {
67006         presetList.presets(presets);
67007       }
67008       presetPane.call(presetList.autofocus(true));
67009     };
67010     inspector.setPreset = function(preset) {
67011       if (preset && preset.id === "type/multipolygon") {
67012         presetPane.call(presetList.autofocus(true));
67013       } else {
67014         editorPane.classed("hide", false);
67015         wrap2.transition().styleTween("right", function() {
67016           return value_default("-100%", "0%");
67017         }).on("end", function() {
67018           presetPane.classed("hide", true);
67019         });
67020         if (preset) {
67021           entityEditor.presets([preset]);
67022         }
67023         editorPane.call(entityEditor);
67024       }
67025     };
67026     inspector.state = function(val) {
67027       if (!arguments.length) return _state;
67028       _state = val;
67029       entityEditor.state(_state);
67030       context.container().selectAll(".field-help-body").remove();
67031       return inspector;
67032     };
67033     inspector.entityIDs = function(val) {
67034       if (!arguments.length) return _entityIDs;
67035       _entityIDs = val;
67036       return inspector;
67037     };
67038     inspector.newFeature = function(val) {
67039       if (!arguments.length) return _newFeature;
67040       _newFeature = val;
67041       return inspector;
67042     };
67043     return inspector;
67044   }
67045
67046   // modules/ui/keepRight_details.js
67047   function uiKeepRightDetails(context) {
67048     let _qaItem;
67049     function issueDetail(d2) {
67050       const { itemType, parentIssueType } = d2;
67051       const unknown = { html: _t.html("inspector.unknown") };
67052       let replacements = d2.replacements || {};
67053       replacements.default = unknown;
67054       if (_mainLocalizer.hasTextForStringId("QA.keepRight.errorTypes.".concat(itemType, ".title"))) {
67055         return _t.html("QA.keepRight.errorTypes.".concat(itemType, ".description"), replacements);
67056       } else {
67057         return _t.html("QA.keepRight.errorTypes.".concat(parentIssueType, ".description"), replacements);
67058       }
67059     }
67060     function keepRightDetails(selection2) {
67061       const details = selection2.selectAll(".error-details").data(
67062         _qaItem ? [_qaItem] : [],
67063         (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
67064       );
67065       details.exit().remove();
67066       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
67067       const descriptionEnter = detailsEnter.append("div").attr("class", "qa-details-subsection");
67068       descriptionEnter.append("h4").call(_t.append("QA.keepRight.detail_description"));
67069       descriptionEnter.append("div").attr("class", "qa-details-description-text").html(issueDetail);
67070       let relatedEntities = [];
67071       descriptionEnter.selectAll(".error_entity_link, .error_object_link").attr("href", "#").each(function() {
67072         const link3 = select_default2(this);
67073         const isObjectLink = link3.classed("error_object_link");
67074         const entityID = isObjectLink ? utilEntityRoot(_qaItem.objectType) + _qaItem.objectId : this.textContent;
67075         const entity = context.hasEntity(entityID);
67076         relatedEntities.push(entityID);
67077         link3.on("mouseenter", () => {
67078           utilHighlightEntities([entityID], true, context);
67079         }).on("mouseleave", () => {
67080           utilHighlightEntities([entityID], false, context);
67081         }).on("click", (d3_event) => {
67082           d3_event.preventDefault();
67083           utilHighlightEntities([entityID], false, context);
67084           const osmlayer = context.layers().layer("osm");
67085           if (!osmlayer.enabled()) {
67086             osmlayer.enabled(true);
67087           }
67088           context.map().centerZoomEase(_qaItem.loc, 20);
67089           if (entity) {
67090             context.enter(modeSelect(context, [entityID]));
67091           } else {
67092             context.loadEntity(entityID, (err, result) => {
67093               if (err) return;
67094               const entity2 = result.data.find((e3) => e3.id === entityID);
67095               if (entity2) context.enter(modeSelect(context, [entityID]));
67096             });
67097           }
67098         });
67099         if (entity) {
67100           let name = utilDisplayName(entity);
67101           if (!name && !isObjectLink) {
67102             const preset = _mainPresetIndex.match(entity, context.graph());
67103             name = preset && !preset.isFallback() && preset.name();
67104           }
67105           if (name) {
67106             this.innerText = name;
67107           }
67108         }
67109       });
67110       context.features().forceVisible(relatedEntities);
67111       context.map().pan([0, 0]);
67112     }
67113     keepRightDetails.issue = function(val) {
67114       if (!arguments.length) return _qaItem;
67115       _qaItem = val;
67116       return keepRightDetails;
67117     };
67118     return keepRightDetails;
67119   }
67120
67121   // modules/ui/keepRight_header.js
67122   function uiKeepRightHeader() {
67123     let _qaItem;
67124     function issueTitle(d2) {
67125       const { itemType, parentIssueType } = d2;
67126       const unknown = _t.html("inspector.unknown");
67127       let replacements = d2.replacements || {};
67128       replacements.default = { html: unknown };
67129       if (_mainLocalizer.hasTextForStringId("QA.keepRight.errorTypes.".concat(itemType, ".title"))) {
67130         return _t.html("QA.keepRight.errorTypes.".concat(itemType, ".title"), replacements);
67131       } else {
67132         return _t.html("QA.keepRight.errorTypes.".concat(parentIssueType, ".title"), replacements);
67133       }
67134     }
67135     function keepRightHeader(selection2) {
67136       const header = selection2.selectAll(".qa-header").data(
67137         _qaItem ? [_qaItem] : [],
67138         (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
67139       );
67140       header.exit().remove();
67141       const headerEnter = header.enter().append("div").attr("class", "qa-header");
67142       const iconEnter = headerEnter.append("div").attr("class", "qa-header-icon").classed("new", (d2) => d2.id < 0);
67143       iconEnter.append("div").attr("class", (d2) => "preset-icon-28 qaItem ".concat(d2.service, " itemId-").concat(d2.id, " itemType-").concat(d2.parentIssueType)).call(svgIcon("#iD-icon-bolt", "qaItem-fill"));
67144       headerEnter.append("div").attr("class", "qa-header-label").html(issueTitle);
67145     }
67146     keepRightHeader.issue = function(val) {
67147       if (!arguments.length) return _qaItem;
67148       _qaItem = val;
67149       return keepRightHeader;
67150     };
67151     return keepRightHeader;
67152   }
67153
67154   // modules/ui/view_on_keepRight.js
67155   function uiViewOnKeepRight() {
67156     let _qaItem;
67157     function viewOnKeepRight(selection2) {
67158       let url;
67159       if (services.keepRight && _qaItem instanceof QAItem) {
67160         url = services.keepRight.issueURL(_qaItem);
67161       }
67162       const link3 = selection2.selectAll(".view-on-keepRight").data(url ? [url] : []);
67163       link3.exit().remove();
67164       const linkEnter = link3.enter().append("a").attr("class", "view-on-keepRight").attr("target", "_blank").attr("rel", "noopener").attr("href", (d2) => d2).call(svgIcon("#iD-icon-out-link", "inline"));
67165       linkEnter.append("span").call(_t.append("inspector.view_on_keepRight"));
67166     }
67167     viewOnKeepRight.what = function(val) {
67168       if (!arguments.length) return _qaItem;
67169       _qaItem = val;
67170       return viewOnKeepRight;
67171     };
67172     return viewOnKeepRight;
67173   }
67174
67175   // modules/ui/keepRight_editor.js
67176   function uiKeepRightEditor(context) {
67177     const dispatch14 = dispatch_default("change");
67178     const qaDetails = uiKeepRightDetails(context);
67179     const qaHeader = uiKeepRightHeader(context);
67180     let _qaItem;
67181     function keepRightEditor(selection2) {
67182       const headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
67183       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
67184       headerEnter.append("h2").call(_t.append("QA.keepRight.title"));
67185       let body = selection2.selectAll(".body").data([0]);
67186       body = body.enter().append("div").attr("class", "body").merge(body);
67187       const editor = body.selectAll(".qa-editor").data([0]);
67188       editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(keepRightSaveSection);
67189       const footer = selection2.selectAll(".footer").data([0]);
67190       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnKeepRight(context).what(_qaItem));
67191     }
67192     function keepRightSaveSection(selection2) {
67193       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
67194       const isShown = _qaItem && (isSelected || _qaItem.newComment || _qaItem.comment);
67195       let saveSection = selection2.selectAll(".qa-save").data(
67196         isShown ? [_qaItem] : [],
67197         (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
67198       );
67199       saveSection.exit().remove();
67200       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
67201       saveSectionEnter.append("h4").attr("class", ".qa-save-header").call(_t.append("QA.keepRight.comment"));
67202       saveSectionEnter.append("textarea").attr("class", "new-comment-input").attr("placeholder", _t("QA.keepRight.comment_placeholder")).attr("maxlength", 1e3).property("value", (d2) => d2.newComment || d2.comment).call(utilNoAuto).on("input", changeInput).on("blur", changeInput);
67203       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
67204       function changeInput() {
67205         const input = select_default2(this);
67206         let val = input.property("value").trim();
67207         if (val === _qaItem.comment) {
67208           val = void 0;
67209         }
67210         _qaItem = _qaItem.update({ newComment: val });
67211         const qaService = services.keepRight;
67212         if (qaService) {
67213           qaService.replaceItem(_qaItem);
67214         }
67215         saveSection.call(qaSaveButtons);
67216       }
67217     }
67218     function qaSaveButtons(selection2) {
67219       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
67220       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d2) => d2.status + d2.id);
67221       buttonSection.exit().remove();
67222       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
67223       buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("QA.keepRight.save_comment"));
67224       buttonEnter.append("button").attr("class", "button close-button action");
67225       buttonEnter.append("button").attr("class", "button ignore-button action");
67226       buttonSection = buttonSection.merge(buttonEnter);
67227       buttonSection.select(".comment-button").attr("disabled", (d2) => d2.newComment ? null : true).on("click.comment", function(d3_event, d2) {
67228         this.blur();
67229         const qaService = services.keepRight;
67230         if (qaService) {
67231           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
67232         }
67233       });
67234       buttonSection.select(".close-button").html((d2) => {
67235         const andComment = d2.newComment ? "_comment" : "";
67236         return _t.html("QA.keepRight.close".concat(andComment));
67237       }).on("click.close", function(d3_event, d2) {
67238         this.blur();
67239         const qaService = services.keepRight;
67240         if (qaService) {
67241           d2.newStatus = "ignore_t";
67242           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
67243         }
67244       });
67245       buttonSection.select(".ignore-button").html((d2) => {
67246         const andComment = d2.newComment ? "_comment" : "";
67247         return _t.html("QA.keepRight.ignore".concat(andComment));
67248       }).on("click.ignore", function(d3_event, d2) {
67249         this.blur();
67250         const qaService = services.keepRight;
67251         if (qaService) {
67252           d2.newStatus = "ignore";
67253           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
67254         }
67255       });
67256     }
67257     keepRightEditor.error = function(val) {
67258       if (!arguments.length) return _qaItem;
67259       _qaItem = val;
67260       return keepRightEditor;
67261     };
67262     return utilRebind(keepRightEditor, dispatch14, "on");
67263   }
67264
67265   // modules/ui/osmose_details.js
67266   function uiOsmoseDetails(context) {
67267     let _qaItem;
67268     function issueString(d2, type2) {
67269       if (!d2) return "";
67270       const s2 = services.osmose.getStrings(d2.itemType);
67271       return type2 in s2 ? s2[type2] : "";
67272     }
67273     function osmoseDetails(selection2) {
67274       const details = selection2.selectAll(".error-details").data(
67275         _qaItem ? [_qaItem] : [],
67276         (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
67277       );
67278       details.exit().remove();
67279       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
67280       if (issueString(_qaItem, "detail")) {
67281         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
67282         div.append("h4").call(_t.append("QA.keepRight.detail_description"));
67283         div.append("p").attr("class", "qa-details-description-text").html((d2) => issueString(d2, "detail")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
67284       }
67285       const detailsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
67286       const elemsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
67287       if (issueString(_qaItem, "fix")) {
67288         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
67289         div.append("h4").call(_t.append("QA.osmose.fix_title"));
67290         div.append("p").html((d2) => issueString(d2, "fix")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
67291       }
67292       if (issueString(_qaItem, "trap")) {
67293         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
67294         div.append("h4").call(_t.append("QA.osmose.trap_title"));
67295         div.append("p").html((d2) => issueString(d2, "trap")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
67296       }
67297       const thisItem = _qaItem;
67298       services.osmose.loadIssueDetail(_qaItem).then((d2) => {
67299         if (!d2.elems || d2.elems.length === 0) return;
67300         if (context.selectedErrorID() !== thisItem.id && context.container().selectAll(".qaItem.osmose.hover.itemId-".concat(thisItem.id)).empty()) return;
67301         if (d2.detail) {
67302           detailsDiv.append("h4").call(_t.append("QA.osmose.detail_title"));
67303           detailsDiv.append("p").html((d4) => d4.detail).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
67304         }
67305         elemsDiv.append("h4").call(_t.append("QA.osmose.elems_title"));
67306         elemsDiv.append("ul").selectAll("li").data(d2.elems).enter().append("li").append("a").attr("href", "#").attr("class", "error_entity_link").text((d4) => d4).each(function() {
67307           const link3 = select_default2(this);
67308           const entityID = this.textContent;
67309           const entity = context.hasEntity(entityID);
67310           link3.on("mouseenter", () => {
67311             utilHighlightEntities([entityID], true, context);
67312           }).on("mouseleave", () => {
67313             utilHighlightEntities([entityID], false, context);
67314           }).on("click", (d3_event) => {
67315             d3_event.preventDefault();
67316             utilHighlightEntities([entityID], false, context);
67317             const osmlayer = context.layers().layer("osm");
67318             if (!osmlayer.enabled()) {
67319               osmlayer.enabled(true);
67320             }
67321             context.map().centerZoom(d2.loc, 20);
67322             if (entity) {
67323               context.enter(modeSelect(context, [entityID]));
67324             } else {
67325               context.loadEntity(entityID, (err, result) => {
67326                 if (err) return;
67327                 const entity2 = result.data.find((e3) => e3.id === entityID);
67328                 if (entity2) context.enter(modeSelect(context, [entityID]));
67329               });
67330             }
67331           });
67332           if (entity) {
67333             let name = utilDisplayName(entity);
67334             if (!name) {
67335               const preset = _mainPresetIndex.match(entity, context.graph());
67336               name = preset && !preset.isFallback() && preset.name();
67337             }
67338             if (name) {
67339               this.innerText = name;
67340             }
67341           }
67342         });
67343         context.features().forceVisible(d2.elems);
67344         context.map().pan([0, 0]);
67345       }).catch((err) => {
67346         console.log(err);
67347       });
67348     }
67349     osmoseDetails.issue = function(val) {
67350       if (!arguments.length) return _qaItem;
67351       _qaItem = val;
67352       return osmoseDetails;
67353     };
67354     return osmoseDetails;
67355   }
67356
67357   // modules/ui/osmose_header.js
67358   function uiOsmoseHeader() {
67359     let _qaItem;
67360     function issueTitle(d2) {
67361       const unknown = _t("inspector.unknown");
67362       if (!d2) return unknown;
67363       const s2 = services.osmose.getStrings(d2.itemType);
67364       return "title" in s2 ? s2.title : unknown;
67365     }
67366     function osmoseHeader(selection2) {
67367       const header = selection2.selectAll(".qa-header").data(
67368         _qaItem ? [_qaItem] : [],
67369         (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
67370       );
67371       header.exit().remove();
67372       const headerEnter = header.enter().append("div").attr("class", "qa-header");
67373       const svgEnter = headerEnter.append("div").attr("class", "qa-header-icon").classed("new", (d2) => d2.id < 0).append("svg").attr("width", "20px").attr("height", "30px").attr("viewbox", "0 0 20 30").attr("class", (d2) => "preset-icon-28 qaItem ".concat(d2.service, " itemId-").concat(d2.id, " itemType-").concat(d2.itemType));
67374       svgEnter.append("polygon").attr("fill", (d2) => services.osmose.getColor(d2.item)).attr("class", "qaItem-fill").attr("points", "16,3 4,3 1,6 1,17 4,20 7,20 10,27 13,20 16,20 19,17.033 19,6");
67375       svgEnter.append("use").attr("class", "icon-annotation").attr("width", "12px").attr("height", "12px").attr("transform", "translate(4, 5.5)").attr("xlink:href", (d2) => d2.icon ? "#" + d2.icon : "");
67376       headerEnter.append("div").attr("class", "qa-header-label").text(issueTitle);
67377     }
67378     osmoseHeader.issue = function(val) {
67379       if (!arguments.length) return _qaItem;
67380       _qaItem = val;
67381       return osmoseHeader;
67382     };
67383     return osmoseHeader;
67384   }
67385
67386   // modules/ui/view_on_osmose.js
67387   function uiViewOnOsmose() {
67388     let _qaItem;
67389     function viewOnOsmose(selection2) {
67390       let url;
67391       if (services.osmose && _qaItem instanceof QAItem) {
67392         url = services.osmose.itemURL(_qaItem);
67393       }
67394       const link3 = selection2.selectAll(".view-on-osmose").data(url ? [url] : []);
67395       link3.exit().remove();
67396       const linkEnter = link3.enter().append("a").attr("class", "view-on-osmose").attr("target", "_blank").attr("rel", "noopener").attr("href", (d2) => d2).call(svgIcon("#iD-icon-out-link", "inline"));
67397       linkEnter.append("span").call(_t.append("inspector.view_on_osmose"));
67398     }
67399     viewOnOsmose.what = function(val) {
67400       if (!arguments.length) return _qaItem;
67401       _qaItem = val;
67402       return viewOnOsmose;
67403     };
67404     return viewOnOsmose;
67405   }
67406
67407   // modules/ui/osmose_editor.js
67408   function uiOsmoseEditor(context) {
67409     const dispatch14 = dispatch_default("change");
67410     const qaDetails = uiOsmoseDetails(context);
67411     const qaHeader = uiOsmoseHeader(context);
67412     let _qaItem;
67413     function osmoseEditor(selection2) {
67414       const header = selection2.selectAll(".header").data([0]);
67415       const headerEnter = header.enter().append("div").attr("class", "header fillL");
67416       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
67417       headerEnter.append("h2").call(_t.append("QA.osmose.title"));
67418       let body = selection2.selectAll(".body").data([0]);
67419       body = body.enter().append("div").attr("class", "body").merge(body);
67420       let editor = body.selectAll(".qa-editor").data([0]);
67421       editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(osmoseSaveSection);
67422       const footer = selection2.selectAll(".footer").data([0]);
67423       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOsmose(context).what(_qaItem));
67424     }
67425     function osmoseSaveSection(selection2) {
67426       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
67427       const isShown = _qaItem && isSelected;
67428       let saveSection = selection2.selectAll(".qa-save").data(
67429         isShown ? [_qaItem] : [],
67430         (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
67431       );
67432       saveSection.exit().remove();
67433       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
67434       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
67435     }
67436     function qaSaveButtons(selection2) {
67437       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
67438       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d2) => d2.status + d2.id);
67439       buttonSection.exit().remove();
67440       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
67441       buttonEnter.append("button").attr("class", "button close-button action");
67442       buttonEnter.append("button").attr("class", "button ignore-button action");
67443       buttonSection = buttonSection.merge(buttonEnter);
67444       buttonSection.select(".close-button").call(_t.append("QA.keepRight.close")).on("click.close", function(d3_event, d2) {
67445         this.blur();
67446         const qaService = services.osmose;
67447         if (qaService) {
67448           d2.newStatus = "done";
67449           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
67450         }
67451       });
67452       buttonSection.select(".ignore-button").call(_t.append("QA.keepRight.ignore")).on("click.ignore", function(d3_event, d2) {
67453         this.blur();
67454         const qaService = services.osmose;
67455         if (qaService) {
67456           d2.newStatus = "false";
67457           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
67458         }
67459       });
67460     }
67461     osmoseEditor.error = function(val) {
67462       if (!arguments.length) return _qaItem;
67463       _qaItem = val;
67464       return osmoseEditor;
67465     };
67466     return utilRebind(osmoseEditor, dispatch14, "on");
67467   }
67468
67469   // modules/ui/sidebar.js
67470   function uiSidebar(context) {
67471     var inspector = uiInspector(context);
67472     var dataEditor = uiDataEditor(context);
67473     var noteEditor = uiNoteEditor(context);
67474     var keepRightEditor = uiKeepRightEditor(context);
67475     var osmoseEditor = uiOsmoseEditor(context);
67476     var _current;
67477     var _wasData = false;
67478     var _wasNote = false;
67479     var _wasQaItem = false;
67480     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
67481     function sidebar(selection2) {
67482       var container = context.container();
67483       var minWidth = 240;
67484       var sidebarWidth;
67485       var containerWidth;
67486       var dragOffset;
67487       selection2.style("min-width", minWidth + "px").style("max-width", "400px").style("width", "33.3333%");
67488       var resizer = selection2.append("div").attr("class", "sidebar-resizer").on(_pointerPrefix + "down.sidebar-resizer", pointerdown);
67489       var downPointerId, lastClientX, containerLocGetter;
67490       function pointerdown(d3_event) {
67491         if (downPointerId) return;
67492         if ("button" in d3_event && d3_event.button !== 0) return;
67493         downPointerId = d3_event.pointerId || "mouse";
67494         lastClientX = d3_event.clientX;
67495         containerLocGetter = utilFastMouse(container.node());
67496         dragOffset = utilFastMouse(resizer.node())(d3_event)[0] - 1;
67497         sidebarWidth = selection2.node().getBoundingClientRect().width;
67498         containerWidth = container.node().getBoundingClientRect().width;
67499         var widthPct = sidebarWidth / containerWidth * 100;
67500         selection2.style("width", widthPct + "%").style("max-width", "85%");
67501         resizer.classed("dragging", true);
67502         select_default2(window).on("touchmove.sidebar-resizer", function(d3_event2) {
67503           d3_event2.preventDefault();
67504         }, { passive: false }).on(_pointerPrefix + "move.sidebar-resizer", pointermove).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", pointerup);
67505       }
67506       function pointermove(d3_event) {
67507         if (downPointerId !== (d3_event.pointerId || "mouse")) return;
67508         d3_event.preventDefault();
67509         var dx = d3_event.clientX - lastClientX;
67510         lastClientX = d3_event.clientX;
67511         var isRTL = _mainLocalizer.textDirection() === "rtl";
67512         var scaleX = isRTL ? 0 : 1;
67513         var xMarginProperty = isRTL ? "margin-right" : "margin-left";
67514         var x2 = containerLocGetter(d3_event)[0] - dragOffset;
67515         sidebarWidth = isRTL ? containerWidth - x2 : x2;
67516         var isCollapsed = selection2.classed("collapsed");
67517         var shouldCollapse = sidebarWidth < minWidth;
67518         selection2.classed("collapsed", shouldCollapse);
67519         if (shouldCollapse) {
67520           if (!isCollapsed) {
67521             selection2.style(xMarginProperty, "-400px").style("width", "400px");
67522             context.ui().onResize([(sidebarWidth - dx) * scaleX, 0]);
67523           }
67524         } else {
67525           var widthPct = sidebarWidth / containerWidth * 100;
67526           selection2.style(xMarginProperty, null).style("width", widthPct + "%");
67527           if (isCollapsed) {
67528             context.ui().onResize([-sidebarWidth * scaleX, 0]);
67529           } else {
67530             context.ui().onResize([-dx * scaleX, 0]);
67531           }
67532         }
67533       }
67534       function pointerup(d3_event) {
67535         if (downPointerId !== (d3_event.pointerId || "mouse")) return;
67536         downPointerId = null;
67537         resizer.classed("dragging", false);
67538         select_default2(window).on("touchmove.sidebar-resizer", null).on(_pointerPrefix + "move.sidebar-resizer", null).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", null);
67539       }
67540       var featureListWrap = selection2.append("div").attr("class", "feature-list-pane").call(uiFeatureList(context));
67541       var inspectorWrap = selection2.append("div").attr("class", "inspector-hidden inspector-wrap");
67542       var hoverModeSelect = function(targets) {
67543         context.container().selectAll(".feature-list-item button").classed("hover", false);
67544         if (context.selectedIDs().length > 1 && targets && targets.length) {
67545           var elements = context.container().selectAll(".feature-list-item button").filter(function(node) {
67546             return targets.indexOf(node) !== -1;
67547           });
67548           if (!elements.empty()) {
67549             elements.classed("hover", true);
67550           }
67551         }
67552       };
67553       sidebar.hoverModeSelect = throttle_default(hoverModeSelect, 200);
67554       function hover(targets) {
67555         var datum2 = targets && targets.length && targets[0];
67556         if (datum2 && datum2.__featurehash__) {
67557           _wasData = true;
67558           sidebar.show(dataEditor.datum(datum2));
67559           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
67560         } else if (datum2 instanceof osmNote) {
67561           if (context.mode().id === "drag-note") return;
67562           _wasNote = true;
67563           var osm = services.osm;
67564           if (osm) {
67565             datum2 = osm.getNote(datum2.id);
67566           }
67567           sidebar.show(noteEditor.note(datum2));
67568           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
67569         } else if (datum2 instanceof QAItem) {
67570           _wasQaItem = true;
67571           var errService = services[datum2.service];
67572           if (errService) {
67573             datum2 = errService.getError(datum2.id);
67574           }
67575           var errEditor;
67576           if (datum2.service === "keepRight") {
67577             errEditor = keepRightEditor;
67578           } else {
67579             errEditor = osmoseEditor;
67580           }
67581           context.container().selectAll(".qaItem." + datum2.service).classed("hover", function(d2) {
67582             return d2.id === datum2.id;
67583           });
67584           sidebar.show(errEditor.error(datum2));
67585           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
67586         } else if (!_current && datum2 instanceof osmEntity) {
67587           featureListWrap.classed("inspector-hidden", true);
67588           inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", true);
67589           if (!inspector.entityIDs() || !utilArrayIdentical(inspector.entityIDs(), [datum2.id]) || inspector.state() !== "hover") {
67590             inspector.state("hover").entityIDs([datum2.id]).newFeature(false);
67591             inspectorWrap.call(inspector);
67592           }
67593         } else if (!_current) {
67594           featureListWrap.classed("inspector-hidden", false);
67595           inspectorWrap.classed("inspector-hidden", true);
67596           inspector.state("hide");
67597         } else if (_wasData || _wasNote || _wasQaItem) {
67598           _wasNote = false;
67599           _wasData = false;
67600           _wasQaItem = false;
67601           context.container().selectAll(".note").classed("hover", false);
67602           context.container().selectAll(".qaItem").classed("hover", false);
67603           sidebar.hide();
67604         }
67605       }
67606       sidebar.hover = throttle_default(hover, 200);
67607       sidebar.intersects = function(extent) {
67608         var rect = selection2.node().getBoundingClientRect();
67609         return extent.intersects([
67610           context.projection.invert([0, rect.height]),
67611           context.projection.invert([rect.width, 0])
67612         ]);
67613       };
67614       sidebar.select = function(ids, newFeature) {
67615         sidebar.hide();
67616         if (ids && ids.length) {
67617           var entity = ids.length === 1 && context.entity(ids[0]);
67618           if (entity && newFeature && selection2.classed("collapsed")) {
67619             var extent = entity.extent(context.graph());
67620             sidebar.expand(sidebar.intersects(extent));
67621           }
67622           featureListWrap.classed("inspector-hidden", true);
67623           inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", false);
67624           inspector.state("select").entityIDs(ids).newFeature(newFeature);
67625           inspectorWrap.call(inspector);
67626         } else {
67627           inspector.state("hide");
67628         }
67629       };
67630       sidebar.showPresetList = function() {
67631         inspector.showList();
67632       };
67633       sidebar.show = function(component, element) {
67634         featureListWrap.classed("inspector-hidden", true);
67635         inspectorWrap.classed("inspector-hidden", true);
67636         if (_current) _current.remove();
67637         _current = selection2.append("div").attr("class", "sidebar-component").call(component, element);
67638       };
67639       sidebar.hide = function() {
67640         featureListWrap.classed("inspector-hidden", false);
67641         inspectorWrap.classed("inspector-hidden", true);
67642         if (_current) _current.remove();
67643         _current = null;
67644       };
67645       sidebar.expand = function(moveMap) {
67646         if (selection2.classed("collapsed")) {
67647           sidebar.toggle(moveMap);
67648         }
67649       };
67650       sidebar.collapse = function(moveMap) {
67651         if (!selection2.classed("collapsed")) {
67652           sidebar.toggle(moveMap);
67653         }
67654       };
67655       sidebar.toggle = function(moveMap) {
67656         if (context.inIntro()) return;
67657         var isCollapsed = selection2.classed("collapsed");
67658         var isCollapsing = !isCollapsed;
67659         var isRTL = _mainLocalizer.textDirection() === "rtl";
67660         var scaleX = isRTL ? 0 : 1;
67661         var xMarginProperty = isRTL ? "margin-right" : "margin-left";
67662         sidebarWidth = selection2.node().getBoundingClientRect().width;
67663         selection2.style("width", sidebarWidth + "px");
67664         var startMargin, endMargin, lastMargin;
67665         if (isCollapsing) {
67666           startMargin = lastMargin = 0;
67667           endMargin = -sidebarWidth;
67668         } else {
67669           startMargin = lastMargin = -sidebarWidth;
67670           endMargin = 0;
67671         }
67672         if (!isCollapsing) {
67673           selection2.classed("collapsed", isCollapsing);
67674         }
67675         selection2.transition().style(xMarginProperty, endMargin + "px").tween("panner", function() {
67676           var i3 = number_default(startMargin, endMargin);
67677           return function(t2) {
67678             var dx = lastMargin - Math.round(i3(t2));
67679             lastMargin = lastMargin - dx;
67680             context.ui().onResize(moveMap ? void 0 : [dx * scaleX, 0]);
67681           };
67682         }).on("end", function() {
67683           if (isCollapsing) {
67684             selection2.classed("collapsed", isCollapsing);
67685           }
67686           if (!isCollapsing) {
67687             var containerWidth2 = container.node().getBoundingClientRect().width;
67688             var widthPct = sidebarWidth / containerWidth2 * 100;
67689             selection2.style(xMarginProperty, null).style("width", widthPct + "%");
67690           }
67691         });
67692       };
67693       resizer.on("dblclick", function(d3_event) {
67694         d3_event.preventDefault();
67695         if (d3_event.sourceEvent) {
67696           d3_event.sourceEvent.preventDefault();
67697         }
67698         sidebar.toggle();
67699       });
67700       context.map().on("crossEditableZoom.sidebar", function(within) {
67701         if (!within && !selection2.select(".inspector-hover").empty()) {
67702           hover([]);
67703         }
67704       });
67705     }
67706     sidebar.showPresetList = function() {
67707     };
67708     sidebar.hover = function() {
67709     };
67710     sidebar.hover.cancel = function() {
67711     };
67712     sidebar.intersects = function() {
67713     };
67714     sidebar.select = function() {
67715     };
67716     sidebar.show = function() {
67717     };
67718     sidebar.hide = function() {
67719     };
67720     sidebar.expand = function() {
67721     };
67722     sidebar.collapse = function() {
67723     };
67724     sidebar.toggle = function() {
67725     };
67726     return sidebar;
67727   }
67728
67729   // modules/ui/source_switch.js
67730   function uiSourceSwitch(context) {
67731     var keys2;
67732     function click(d3_event) {
67733       d3_event.preventDefault();
67734       var osm = context.connection();
67735       if (!osm) return;
67736       if (context.inIntro()) return;
67737       if (context.history().hasChanges() && !window.confirm(_t("source_switch.lose_changes"))) return;
67738       var isLive = select_default2(this).classed("live");
67739       isLive = !isLive;
67740       context.enter(modeBrowse(context));
67741       context.history().clearSaved();
67742       context.flush();
67743       select_default2(this).html(isLive ? _t.html("source_switch.live") : _t.html("source_switch.dev")).classed("live", isLive).classed("chip", isLive);
67744       osm.switch(isLive ? keys2[0] : keys2[1]);
67745     }
67746     var sourceSwitch = function(selection2) {
67747       selection2.append("a").attr("href", "#").call(_t.append("source_switch.live")).attr("class", "live chip").on("click", click);
67748     };
67749     sourceSwitch.keys = function(_2) {
67750       if (!arguments.length) return keys2;
67751       keys2 = _2;
67752       return sourceSwitch;
67753     };
67754     return sourceSwitch;
67755   }
67756
67757   // modules/ui/spinner.js
67758   function uiSpinner(context) {
67759     var osm = context.connection();
67760     return function(selection2) {
67761       var img = selection2.append("img").attr("src", context.imagePath("loader-black.gif")).style("opacity", 0);
67762       if (osm) {
67763         osm.on("loading.spinner", function() {
67764           img.transition().style("opacity", 1);
67765         }).on("loaded.spinner", function() {
67766           img.transition().style("opacity", 0);
67767         });
67768       }
67769     };
67770   }
67771
67772   // modules/ui/sections/privacy.js
67773   function uiSectionPrivacy(context) {
67774     let section = uiSection("preferences-third-party", context).label(() => _t.append("preferences.privacy.title")).disclosureContent(renderDisclosureContent);
67775     function renderDisclosureContent(selection2) {
67776       selection2.selectAll(".privacy-options-list").data([0]).enter().append("ul").attr("class", "layer-list privacy-options-list");
67777       let thirdPartyIconsEnter = selection2.select(".privacy-options-list").selectAll(".privacy-third-party-icons-item").data([corePreferences("preferences.privacy.thirdpartyicons") || "true"]).enter().append("li").attr("class", "privacy-third-party-icons-item").append("label").call(
67778         uiTooltip().title(() => _t.append("preferences.privacy.third_party_icons.tooltip")).placement("bottom")
67779       );
67780       thirdPartyIconsEnter.append("input").attr("type", "checkbox").on("change", (d3_event, d2) => {
67781         d3_event.preventDefault();
67782         corePreferences("preferences.privacy.thirdpartyicons", d2 === "true" ? "false" : "true");
67783       });
67784       thirdPartyIconsEnter.append("span").call(_t.append("preferences.privacy.third_party_icons.description"));
67785       selection2.selectAll(".privacy-third-party-icons-item").classed("active", (d2) => d2 === "true").select("input").property("checked", (d2) => d2 === "true");
67786       selection2.selectAll(".privacy-link").data([0]).enter().append("div").attr("class", "privacy-link").append("a").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).attr("href", "https://github.com/openstreetmap/iD/blob/release/PRIVACY.md").append("span").call(_t.append("preferences.privacy.privacy_link"));
67787     }
67788     corePreferences.onChange("preferences.privacy.thirdpartyicons", section.reRender);
67789     return section;
67790   }
67791
67792   // modules/ui/splash.js
67793   function uiSplash(context) {
67794     return (selection2) => {
67795       if (context.history().hasRestorableChanges()) return;
67796       let updateMessage = "";
67797       const sawPrivacyVersion = corePreferences("sawPrivacyVersion");
67798       let showSplash = !corePreferences("sawSplash");
67799       if (sawPrivacyVersion !== context.privacyVersion) {
67800         updateMessage = _t("splash.privacy_update");
67801         showSplash = true;
67802       }
67803       if (!showSplash) return;
67804       corePreferences("sawSplash", true);
67805       corePreferences("sawPrivacyVersion", context.privacyVersion);
67806       _mainFileFetcher.get("intro_graph");
67807       let modalSelection = uiModal(selection2);
67808       modalSelection.select(".modal").attr("class", "modal-splash modal");
67809       let introModal = modalSelection.select(".content").append("div").attr("class", "fillL");
67810       introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("splash.welcome"));
67811       let modalSection = introModal.append("div").attr("class", "modal-section");
67812       modalSection.append("p").html(_t.html("splash.text", {
67813         version: context.version,
67814         website: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/develop/CHANGELOG.md#whats-new">' + _t.html("splash.changelog") + "</a>" },
67815         github: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/issues">github.com</a>' }
67816       }));
67817       modalSection.append("p").html(_t.html("splash.privacy", {
67818         updateMessage,
67819         privacyLink: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/release/PRIVACY.md">' + _t("splash.privacy_policy") + "</a>" }
67820       }));
67821       uiSectionPrivacy(context).label(() => _t.append("splash.privacy_settings")).render(modalSection);
67822       let buttonWrap = introModal.append("div").attr("class", "modal-actions");
67823       let walkthrough = buttonWrap.append("button").attr("class", "walkthrough").on("click", () => {
67824         context.container().call(uiIntro(context));
67825         modalSelection.close();
67826       });
67827       walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
67828       walkthrough.append("div").call(_t.append("splash.walkthrough"));
67829       let startEditing = buttonWrap.append("button").attr("class", "start-editing").on("click", modalSelection.close);
67830       startEditing.append("svg").attr("class", "logo logo-features").append("use").attr("xlink:href", "#iD-logo-features");
67831       startEditing.append("div").call(_t.append("splash.start"));
67832       modalSelection.select("button.close").attr("class", "hide");
67833     };
67834   }
67835
67836   // modules/ui/status.js
67837   function uiStatus(context) {
67838     var osm = context.connection();
67839     return function(selection2) {
67840       if (!osm) return;
67841       function update(err, apiStatus) {
67842         selection2.html("");
67843         if (err) {
67844           if (apiStatus === "connectionSwitched") {
67845             return;
67846           } else if (apiStatus === "rateLimited") {
67847             selection2.call(_t.append("osm_api_status.message.rateLimit")).append("a").attr("href", "#").attr("class", "api-status-login").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).append("span").call(_t.append("login")).on("click.login", function(d3_event) {
67848               d3_event.preventDefault();
67849               osm.authenticate();
67850             });
67851           } else {
67852             var throttledRetry = throttle_default(function() {
67853               context.loadTiles(context.projection);
67854               osm.reloadApiStatus();
67855             }, 2e3);
67856             selection2.call(_t.append("osm_api_status.message.error", { suffix: " " })).append("a").attr("href", "#").call(_t.append("osm_api_status.retry")).on("click.retry", function(d3_event) {
67857               d3_event.preventDefault();
67858               throttledRetry();
67859             });
67860           }
67861         } else if (apiStatus === "readonly") {
67862           selection2.call(_t.append("osm_api_status.message.readonly"));
67863         } else if (apiStatus === "offline") {
67864           selection2.call(_t.append("osm_api_status.message.offline"));
67865         }
67866         selection2.attr("class", "api-status " + (err ? "error" : apiStatus));
67867       }
67868       osm.on("apiStatusChange.uiStatus", update);
67869       context.history().on("storage_error", () => {
67870         selection2.selectAll("span.local-storage-full").remove();
67871         selection2.append("span").attr("class", "local-storage-full").call(_t.append("osm_api_status.message.local_storage_full"));
67872         selection2.classed("error", true);
67873       });
67874       window.setInterval(function() {
67875         osm.reloadApiStatus();
67876       }, 9e4);
67877       osm.reloadApiStatus();
67878     };
67879   }
67880
67881   // modules/ui/tools/modes.js
67882   function uiToolDrawModes(context) {
67883     var tool = {
67884       id: "old_modes",
67885       label: _t.append("toolbar.add_feature")
67886     };
67887     var modes = [
67888       modeAddPoint(context, {
67889         title: _t.append("modes.add_point.title"),
67890         button: "point",
67891         description: _t.append("modes.add_point.description"),
67892         preset: _mainPresetIndex.item("point"),
67893         key: "1"
67894       }),
67895       modeAddLine(context, {
67896         title: _t.append("modes.add_line.title"),
67897         button: "line",
67898         description: _t.append("modes.add_line.description"),
67899         preset: _mainPresetIndex.item("line"),
67900         key: "2"
67901       }),
67902       modeAddArea(context, {
67903         title: _t.append("modes.add_area.title"),
67904         button: "area",
67905         description: _t.append("modes.add_area.description"),
67906         preset: _mainPresetIndex.item("area"),
67907         key: "3"
67908       })
67909     ];
67910     function enabled(_mode) {
67911       return osmEditable();
67912     }
67913     function osmEditable() {
67914       return context.editable();
67915     }
67916     modes.forEach(function(mode) {
67917       context.keybinding().on(mode.key, function() {
67918         if (!enabled(mode)) return;
67919         if (mode.id === context.mode().id) {
67920           context.enter(modeBrowse(context));
67921         } else {
67922           context.enter(mode);
67923         }
67924       });
67925     });
67926     tool.render = function(selection2) {
67927       var wrap2 = selection2.append("div").attr("class", "joined").style("display", "flex");
67928       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
67929       context.map().on("move.modes", debouncedUpdate).on("drawn.modes", debouncedUpdate);
67930       context.on("enter.modes", update);
67931       update();
67932       function update() {
67933         var buttons = wrap2.selectAll("button.add-button").data(modes, function(d2) {
67934           return d2.id;
67935         });
67936         buttons.exit().remove();
67937         var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
67938           return d2.id + " add-button bar-button";
67939         }).on("click.mode-buttons", function(d3_event, d2) {
67940           if (!enabled(d2)) return;
67941           var currMode = context.mode().id;
67942           if (/^draw/.test(currMode)) return;
67943           if (d2.id === currMode) {
67944             context.enter(modeBrowse(context));
67945           } else {
67946             context.enter(d2);
67947           }
67948         }).call(
67949           uiTooltip().placement("bottom").title(function(d2) {
67950             return d2.description;
67951           }).keys(function(d2) {
67952             return [d2.key];
67953           }).scrollContainer(context.container().select(".top-toolbar"))
67954         );
67955         buttonsEnter.each(function(d2) {
67956           select_default2(this).call(svgIcon("#iD-icon-" + d2.button));
67957         });
67958         buttonsEnter.append("span").attr("class", "label").text("").each(function(mode) {
67959           mode.title(select_default2(this));
67960         });
67961         if (buttons.enter().size() || buttons.exit().size()) {
67962           context.ui().checkOverflow(".top-toolbar", true);
67963         }
67964         buttons = buttons.merge(buttonsEnter).attr("aria-disabled", function(d2) {
67965           return !enabled(d2);
67966         }).classed("disabled", function(d2) {
67967           return !enabled(d2);
67968         }).attr("aria-pressed", function(d2) {
67969           return context.mode() && context.mode().button === d2.button;
67970         }).classed("active", function(d2) {
67971           return context.mode() && context.mode().button === d2.button;
67972         });
67973       }
67974     };
67975     return tool;
67976   }
67977
67978   // modules/ui/tools/notes.js
67979   function uiToolNotes(context) {
67980     var tool = {
67981       id: "notes",
67982       label: _t.append("modes.add_note.label")
67983     };
67984     var mode = modeAddNote(context);
67985     function enabled() {
67986       return notesEnabled() && notesEditable();
67987     }
67988     function notesEnabled() {
67989       var noteLayer = context.layers().layer("notes");
67990       return noteLayer && noteLayer.enabled();
67991     }
67992     function notesEditable() {
67993       var mode2 = context.mode();
67994       return context.map().notesEditable() && mode2 && mode2.id !== "save";
67995     }
67996     context.keybinding().on(mode.key, function() {
67997       if (!enabled()) return;
67998       if (mode.id === context.mode().id) {
67999         context.enter(modeBrowse(context));
68000       } else {
68001         context.enter(mode);
68002       }
68003     });
68004     tool.render = function(selection2) {
68005       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
68006       context.map().on("move.notes", debouncedUpdate).on("drawn.notes", debouncedUpdate);
68007       context.on("enter.notes", update);
68008       update();
68009       function update() {
68010         var showNotes = notesEnabled();
68011         var data = showNotes ? [mode] : [];
68012         var buttons = selection2.selectAll("button.add-button").data(data, function(d2) {
68013           return d2.id;
68014         });
68015         buttons.exit().remove();
68016         var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
68017           return d2.id + " add-button bar-button";
68018         }).on("click.notes", function(d3_event, d2) {
68019           if (!enabled()) return;
68020           var currMode = context.mode().id;
68021           if (/^draw/.test(currMode)) return;
68022           if (d2.id === currMode) {
68023             context.enter(modeBrowse(context));
68024           } else {
68025             context.enter(d2);
68026           }
68027         }).call(
68028           uiTooltip().placement("bottom").title(function(d2) {
68029             return d2.description;
68030           }).keys(function(d2) {
68031             return [d2.key];
68032           }).scrollContainer(context.container().select(".top-toolbar"))
68033         );
68034         buttonsEnter.each(function(d2) {
68035           select_default2(this).call(svgIcon(d2.icon || "#iD-icon-" + d2.button));
68036         });
68037         if (buttons.enter().size() || buttons.exit().size()) {
68038           context.ui().checkOverflow(".top-toolbar", true);
68039         }
68040         buttons = buttons.merge(buttonsEnter).classed("disabled", function() {
68041           return !enabled();
68042         }).attr("aria-disabled", function() {
68043           return !enabled();
68044         }).classed("active", function(d2) {
68045           return context.mode() && context.mode().button === d2.button;
68046         }).attr("aria-pressed", function(d2) {
68047           return context.mode() && context.mode().button === d2.button;
68048         });
68049       }
68050     };
68051     tool.uninstall = function() {
68052       context.on("enter.editor.notes", null).on("exit.editor.notes", null).on("enter.notes", null);
68053       context.map().on("move.notes", null).on("drawn.notes", null);
68054     };
68055     return tool;
68056   }
68057
68058   // modules/ui/tools/save.js
68059   function uiToolSave(context) {
68060     var tool = {
68061       id: "save",
68062       label: _t.append("save.title")
68063     };
68064     var button = null;
68065     var tooltipBehavior = null;
68066     var history = context.history();
68067     var key = uiCmd("\u2318S");
68068     var _numChanges = 0;
68069     function isSaving() {
68070       var mode = context.mode();
68071       return mode && mode.id === "save";
68072     }
68073     function isDisabled() {
68074       return _numChanges === 0 || isSaving();
68075     }
68076     function save(d3_event) {
68077       d3_event.preventDefault();
68078       if (!context.inIntro() && !isSaving() && history.hasChanges()) {
68079         context.enter(modeSave(context));
68080       }
68081     }
68082     function bgColor(numChanges) {
68083       var step;
68084       if (numChanges === 0) {
68085         return null;
68086       } else if (numChanges <= 50) {
68087         step = numChanges / 50;
68088         return rgb_default("#fff", "#ff8")(step);
68089       } else {
68090         step = Math.min((numChanges - 50) / 50, 1);
68091         return rgb_default("#ff8", "#f88")(step);
68092       }
68093     }
68094     function updateCount() {
68095       var val = history.difference().summary().length;
68096       if (val === _numChanges) return;
68097       _numChanges = val;
68098       if (tooltipBehavior) {
68099         tooltipBehavior.title(() => _t.append(_numChanges > 0 ? "save.help" : "save.no_changes")).keys([key]);
68100       }
68101       if (button) {
68102         button.classed("disabled", isDisabled()).style("background", bgColor(_numChanges));
68103         button.select("span.count").text(_numChanges);
68104       }
68105     }
68106     tool.render = function(selection2) {
68107       tooltipBehavior = uiTooltip().placement("bottom").title(() => _t.append("save.no_changes")).keys([key]).scrollContainer(context.container().select(".top-toolbar"));
68108       var lastPointerUpType;
68109       button = selection2.append("button").attr("class", "save disabled bar-button").on("pointerup", function(d3_event) {
68110         lastPointerUpType = d3_event.pointerType;
68111       }).on("click", function(d3_event) {
68112         save(d3_event);
68113         if (_numChanges === 0 && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
68114           context.ui().flash.duration(2e3).iconName("#iD-icon-save").iconClass("disabled").label(_t.append("save.no_changes"))();
68115         }
68116         lastPointerUpType = null;
68117       }).call(tooltipBehavior);
68118       button.call(svgIcon("#iD-icon-save"));
68119       button.append("span").attr("class", "count").attr("aria-hidden", "true").text("0");
68120       updateCount();
68121       context.keybinding().on(key, save, true);
68122       context.history().on("change.save", updateCount);
68123       context.on("enter.save", function() {
68124         if (button) {
68125           button.classed("disabled", isDisabled());
68126           if (isSaving()) {
68127             button.call(tooltipBehavior.hide);
68128           }
68129         }
68130       });
68131     };
68132     tool.uninstall = function() {
68133       context.keybinding().off(key, true);
68134       context.history().on("change.save", null);
68135       context.on("enter.save", null);
68136       button = null;
68137       tooltipBehavior = null;
68138     };
68139     return tool;
68140   }
68141
68142   // modules/ui/tools/sidebar_toggle.js
68143   function uiToolSidebarToggle(context) {
68144     var tool = {
68145       id: "sidebar_toggle",
68146       label: _t.append("toolbar.inspect")
68147     };
68148     tool.render = function(selection2) {
68149       selection2.append("button").attr("class", "bar-button").attr("aria-label", _t("sidebar.tooltip")).on("click", function() {
68150         context.ui().sidebar.toggle();
68151       }).call(
68152         uiTooltip().placement("bottom").title(() => _t.append("sidebar.tooltip")).keys([_t("sidebar.key")]).scrollContainer(context.container().select(".top-toolbar"))
68153       ).call(svgIcon("#iD-icon-sidebar-" + (_mainLocalizer.textDirection() === "rtl" ? "right" : "left")));
68154     };
68155     return tool;
68156   }
68157
68158   // modules/ui/tools/undo_redo.js
68159   function uiToolUndoRedo(context) {
68160     var tool = {
68161       id: "undo_redo",
68162       label: _t.append("toolbar.undo_redo")
68163     };
68164     var commands = [{
68165       id: "undo",
68166       cmd: uiCmd("\u2318Z"),
68167       action: function() {
68168         context.undo();
68169       },
68170       annotation: function() {
68171         return context.history().undoAnnotation();
68172       },
68173       icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")
68174     }, {
68175       id: "redo",
68176       cmd: uiCmd("\u2318\u21E7Z"),
68177       action: function() {
68178         context.redo();
68179       },
68180       annotation: function() {
68181         return context.history().redoAnnotation();
68182       },
68183       icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "undo" : "redo")
68184     }];
68185     function editable() {
68186       return context.mode() && context.mode().id !== "save" && context.map().editableDataEnabled(
68187         true
68188         /* ignore min zoom */
68189       );
68190     }
68191     tool.render = function(selection2) {
68192       var tooltipBehavior = uiTooltip().placement("bottom").title(function(d2) {
68193         return d2.annotation() ? _t.append(d2.id + ".tooltip", { action: d2.annotation() }) : _t.append(d2.id + ".nothing");
68194       }).keys(function(d2) {
68195         return [d2.cmd];
68196       }).scrollContainer(context.container().select(".top-toolbar"));
68197       var lastPointerUpType;
68198       var buttons = selection2.selectAll("button").data(commands).enter().append("button").attr("class", function(d2) {
68199         return "disabled " + d2.id + "-button bar-button";
68200       }).on("pointerup", function(d3_event) {
68201         lastPointerUpType = d3_event.pointerType;
68202       }).on("click", function(d3_event, d2) {
68203         d3_event.preventDefault();
68204         var annotation = d2.annotation();
68205         if (editable() && annotation) {
68206           d2.action();
68207         }
68208         if (editable() && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
68209           var label = annotation ? _t.append(d2.id + ".tooltip", { action: annotation }) : _t.append(d2.id + ".nothing");
68210           context.ui().flash.duration(2e3).iconName("#" + d2.icon).iconClass(annotation ? "" : "disabled").label(label)();
68211         }
68212         lastPointerUpType = null;
68213       }).call(tooltipBehavior);
68214       buttons.each(function(d2) {
68215         select_default2(this).call(svgIcon("#" + d2.icon));
68216       });
68217       context.keybinding().on(commands[0].cmd, function(d3_event) {
68218         d3_event.preventDefault();
68219         if (editable()) commands[0].action();
68220       }).on(commands[1].cmd, function(d3_event) {
68221         d3_event.preventDefault();
68222         if (editable()) commands[1].action();
68223       });
68224       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
68225       context.map().on("move.undo_redo", debouncedUpdate).on("drawn.undo_redo", debouncedUpdate);
68226       context.history().on("change.undo_redo", function(difference2) {
68227         if (difference2) update();
68228       });
68229       context.on("enter.undo_redo", update);
68230       function update() {
68231         buttons.classed("disabled", function(d2) {
68232           return !editable() || !d2.annotation();
68233         }).each(function() {
68234           var selection3 = select_default2(this);
68235           if (!selection3.select(".tooltip.in").empty()) {
68236             selection3.call(tooltipBehavior.updateContent);
68237           }
68238         });
68239       }
68240     };
68241     tool.uninstall = function() {
68242       context.keybinding().off(commands[0].cmd).off(commands[1].cmd);
68243       context.map().on("move.undo_redo", null).on("drawn.undo_redo", null);
68244       context.history().on("change.undo_redo", null);
68245       context.on("enter.undo_redo", null);
68246     };
68247     return tool;
68248   }
68249
68250   // modules/ui/top_toolbar.js
68251   function uiTopToolbar(context) {
68252     var sidebarToggle = uiToolSidebarToggle(context), modes = uiToolDrawModes(context), notes = uiToolNotes(context), undoRedo = uiToolUndoRedo(context), save = uiToolSave(context);
68253     function notesEnabled() {
68254       var noteLayer = context.layers().layer("notes");
68255       return noteLayer && noteLayer.enabled();
68256     }
68257     function topToolbar(bar) {
68258       bar.on("wheel.topToolbar", function(d3_event) {
68259         if (!d3_event.deltaX) {
68260           bar.node().scrollLeft += d3_event.deltaY;
68261         }
68262       });
68263       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
68264       context.layers().on("change.topToolbar", debouncedUpdate);
68265       update();
68266       function update() {
68267         var tools = [
68268           sidebarToggle,
68269           "spacer",
68270           modes
68271         ];
68272         tools.push("spacer");
68273         if (notesEnabled()) {
68274           tools = tools.concat([notes, "spacer"]);
68275         }
68276         tools = tools.concat([undoRedo, save]);
68277         var toolbarItems = bar.selectAll(".toolbar-item").data(tools, function(d2) {
68278           return d2.id || d2;
68279         });
68280         toolbarItems.exit().each(function(d2) {
68281           if (d2.uninstall) {
68282             d2.uninstall();
68283           }
68284         }).remove();
68285         var itemsEnter = toolbarItems.enter().append("div").attr("class", function(d2) {
68286           var classes = "toolbar-item " + (d2.id || d2).replace("_", "-");
68287           if (d2.klass) classes += " " + d2.klass;
68288           return classes;
68289         });
68290         var actionableItems = itemsEnter.filter(function(d2) {
68291           return d2 !== "spacer";
68292         });
68293         actionableItems.append("div").attr("class", "item-content").each(function(d2) {
68294           select_default2(this).call(d2.render, bar);
68295         });
68296         actionableItems.append("div").attr("class", "item-label").each(function(d2) {
68297           d2.label(select_default2(this));
68298         });
68299       }
68300     }
68301     return topToolbar;
68302   }
68303
68304   // modules/ui/version.js
68305   var sawVersion = null;
68306   var isNewVersion = false;
68307   var isNewUser = false;
68308   function uiVersion(context) {
68309     var currVersion = context.version;
68310     var matchedVersion = currVersion.match(/\d+\.\d+\.\d+.*/);
68311     if (sawVersion === null && matchedVersion !== null) {
68312       if (corePreferences("sawVersion")) {
68313         isNewUser = false;
68314         isNewVersion = corePreferences("sawVersion") !== currVersion && currVersion.indexOf("-") === -1;
68315       } else {
68316         isNewUser = true;
68317         isNewVersion = true;
68318       }
68319       corePreferences("sawVersion", currVersion);
68320       sawVersion = currVersion;
68321     }
68322     return function(selection2) {
68323       selection2.append("a").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD").text(currVersion);
68324       if (isNewVersion && !isNewUser) {
68325         selection2.append("a").attr("class", "badge").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD/blob/release/CHANGELOG.md#whats-new").call(svgIcon("#maki-gift")).call(
68326           uiTooltip().title(() => _t.append("version.whats_new", { version: currVersion })).placement("top").scrollContainer(context.container().select(".main-footer-wrap"))
68327         );
68328       }
68329     };
68330   }
68331
68332   // modules/ui/zoom.js
68333   function uiZoom(context) {
68334     var zooms = [{
68335       id: "zoom-in",
68336       icon: "iD-icon-plus",
68337       title: _t.append("zoom.in"),
68338       action: zoomIn,
68339       disabled: function() {
68340         return !context.map().canZoomIn();
68341       },
68342       disabledTitle: _t.append("zoom.disabled.in"),
68343       key: "+"
68344     }, {
68345       id: "zoom-out",
68346       icon: "iD-icon-minus",
68347       title: _t.append("zoom.out"),
68348       action: zoomOut,
68349       disabled: function() {
68350         return !context.map().canZoomOut();
68351       },
68352       disabledTitle: _t.append("zoom.disabled.out"),
68353       key: "-"
68354     }];
68355     function zoomIn(d3_event) {
68356       if (d3_event.shiftKey) return;
68357       d3_event.preventDefault();
68358       context.map().zoomIn();
68359     }
68360     function zoomOut(d3_event) {
68361       if (d3_event.shiftKey) return;
68362       d3_event.preventDefault();
68363       context.map().zoomOut();
68364     }
68365     function zoomInFurther(d3_event) {
68366       if (d3_event.shiftKey) return;
68367       d3_event.preventDefault();
68368       context.map().zoomInFurther();
68369     }
68370     function zoomOutFurther(d3_event) {
68371       if (d3_event.shiftKey) return;
68372       d3_event.preventDefault();
68373       context.map().zoomOutFurther();
68374     }
68375     return function(selection2) {
68376       var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function(d2) {
68377         if (d2.disabled()) {
68378           return d2.disabledTitle;
68379         }
68380         return d2.title;
68381       }).keys(function(d2) {
68382         return [d2.key];
68383       });
68384       var lastPointerUpType;
68385       var buttons = selection2.selectAll("button").data(zooms).enter().append("button").attr("class", function(d2) {
68386         return d2.id;
68387       }).on("pointerup.editor", function(d3_event) {
68388         lastPointerUpType = d3_event.pointerType;
68389       }).on("click.editor", function(d3_event, d2) {
68390         if (!d2.disabled()) {
68391           d2.action(d3_event);
68392         } else if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
68393           context.ui().flash.duration(2e3).iconName("#" + d2.icon).iconClass("disabled").label(d2.disabledTitle)();
68394         }
68395         lastPointerUpType = null;
68396       }).call(tooltipBehavior);
68397       buttons.each(function(d2) {
68398         select_default2(this).call(svgIcon("#" + d2.icon, "light"));
68399       });
68400       utilKeybinding.plusKeys.forEach(function(key) {
68401         context.keybinding().on([key], zoomIn);
68402         context.keybinding().on([uiCmd("\u2325" + key)], zoomInFurther);
68403       });
68404       utilKeybinding.minusKeys.forEach(function(key) {
68405         context.keybinding().on([key], zoomOut);
68406         context.keybinding().on([uiCmd("\u2325" + key)], zoomOutFurther);
68407       });
68408       function updateButtonStates() {
68409         buttons.classed("disabled", function(d2) {
68410           return d2.disabled();
68411         }).each(function() {
68412           var selection3 = select_default2(this);
68413           if (!selection3.select(".tooltip.in").empty()) {
68414             selection3.call(tooltipBehavior.updateContent);
68415           }
68416         });
68417       }
68418       updateButtonStates();
68419       context.map().on("move.uiZoom", updateButtonStates);
68420     };
68421   }
68422
68423   // modules/ui/zoom_to_selection.js
68424   function uiZoomToSelection(context) {
68425     function isDisabled() {
68426       var mode = context.mode();
68427       return !mode || !mode.zoomToSelected;
68428     }
68429     var _lastPointerUpType;
68430     function pointerup(d3_event) {
68431       _lastPointerUpType = d3_event.pointerType;
68432     }
68433     function click(d3_event) {
68434       d3_event.preventDefault();
68435       if (isDisabled()) {
68436         if (_lastPointerUpType === "touch" || _lastPointerUpType === "pen") {
68437           context.ui().flash.duration(2e3).iconName("#iD-icon-framed-dot").iconClass("disabled").label(_t.append("inspector.zoom_to.no_selection"))();
68438         }
68439       } else {
68440         var mode = context.mode();
68441         if (mode && mode.zoomToSelected) {
68442           mode.zoomToSelected();
68443         }
68444       }
68445       _lastPointerUpType = null;
68446     }
68447     return function(selection2) {
68448       var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function() {
68449         if (isDisabled()) {
68450           return _t.append("inspector.zoom_to.no_selection");
68451         }
68452         return _t.append("inspector.zoom_to.title");
68453       }).keys([_t("inspector.zoom_to.key")]);
68454       var button = selection2.append("button").on("pointerup", pointerup).on("click", click).call(svgIcon("#iD-icon-framed-dot", "light")).call(tooltipBehavior);
68455       function setEnabledState() {
68456         button.classed("disabled", isDisabled());
68457         if (!button.select(".tooltip.in").empty()) {
68458           button.call(tooltipBehavior.updateContent);
68459         }
68460       }
68461       context.on("enter.uiZoomToSelection", setEnabledState);
68462       setEnabledState();
68463     };
68464   }
68465
68466   // modules/ui/pane.js
68467   function uiPane(id2, context) {
68468     var _key;
68469     var _label = "";
68470     var _description = "";
68471     var _iconName = "";
68472     var _sections;
68473     var _paneSelection = select_default2(null);
68474     var _paneTooltip;
68475     var pane = {
68476       id: id2
68477     };
68478     pane.label = function(val) {
68479       if (!arguments.length) return _label;
68480       _label = val;
68481       return pane;
68482     };
68483     pane.key = function(val) {
68484       if (!arguments.length) return _key;
68485       _key = val;
68486       return pane;
68487     };
68488     pane.description = function(val) {
68489       if (!arguments.length) return _description;
68490       _description = val;
68491       return pane;
68492     };
68493     pane.iconName = function(val) {
68494       if (!arguments.length) return _iconName;
68495       _iconName = val;
68496       return pane;
68497     };
68498     pane.sections = function(val) {
68499       if (!arguments.length) return _sections;
68500       _sections = val;
68501       return pane;
68502     };
68503     pane.selection = function() {
68504       return _paneSelection;
68505     };
68506     function hidePane() {
68507       context.ui().togglePanes();
68508     }
68509     pane.togglePane = function(d3_event) {
68510       if (d3_event) d3_event.preventDefault();
68511       _paneTooltip.hide();
68512       context.ui().togglePanes(!_paneSelection.classed("shown") ? _paneSelection : void 0);
68513     };
68514     pane.renderToggleButton = function(selection2) {
68515       if (!_paneTooltip) {
68516         _paneTooltip = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(() => _description).keys([_key]);
68517       }
68518       selection2.append("button").on("click", pane.togglePane).call(svgIcon("#" + _iconName, "light")).call(_paneTooltip);
68519     };
68520     pane.renderContent = function(selection2) {
68521       if (_sections) {
68522         _sections.forEach(function(section) {
68523           selection2.call(section.render);
68524         });
68525       }
68526     };
68527     pane.renderPane = function(selection2) {
68528       _paneSelection = selection2.append("div").attr("class", "fillL map-pane hide " + id2 + "-pane").attr("pane", id2);
68529       var heading2 = _paneSelection.append("div").attr("class", "pane-heading");
68530       heading2.append("h2").text("").call(_label);
68531       heading2.append("button").attr("title", _t("icons.close")).on("click", hidePane).call(svgIcon("#iD-icon-close"));
68532       _paneSelection.append("div").attr("class", "pane-content").call(pane.renderContent);
68533       if (_key) {
68534         context.keybinding().on(_key, pane.togglePane);
68535       }
68536     };
68537     return pane;
68538   }
68539
68540   // modules/ui/sections/background_display_options.js
68541   function uiSectionBackgroundDisplayOptions(context) {
68542     var section = uiSection("background-display-options", context).label(() => _t.append("background.display_options")).disclosureContent(renderDisclosureContent);
68543     var _storedOpacity = corePreferences("background-opacity");
68544     var _minVal = 0;
68545     var _maxVal = 3;
68546     var _sliders = ["brightness", "contrast", "saturation", "sharpness"];
68547     var _options = {
68548       brightness: _storedOpacity !== null ? +_storedOpacity : 1,
68549       contrast: 1,
68550       saturation: 1,
68551       sharpness: 1
68552     };
68553     function clamp3(x2, min3, max3) {
68554       return Math.max(min3, Math.min(x2, max3));
68555     }
68556     function updateValue(d2, val) {
68557       val = clamp3(val, _minVal, _maxVal);
68558       _options[d2] = val;
68559       context.background()[d2](val);
68560       if (d2 === "brightness") {
68561         corePreferences("background-opacity", val);
68562       }
68563       section.reRender();
68564     }
68565     function renderDisclosureContent(selection2) {
68566       var container = selection2.selectAll(".display-options-container").data([0]);
68567       var containerEnter = container.enter().append("div").attr("class", "display-options-container controls-list");
68568       var slidersEnter = containerEnter.selectAll(".display-control").data(_sliders).enter().append("label").attr("class", function(d2) {
68569         return "display-control display-control-" + d2;
68570       });
68571       slidersEnter.html(function(d2) {
68572         return _t.html("background." + d2);
68573       }).append("span").attr("class", function(d2) {
68574         return "display-option-value display-option-value-" + d2;
68575       });
68576       var sildersControlEnter = slidersEnter.append("div").attr("class", "control-wrap");
68577       sildersControlEnter.append("input").attr("class", function(d2) {
68578         return "display-option-input display-option-input-" + d2;
68579       }).attr("type", "range").attr("min", _minVal).attr("max", _maxVal).attr("step", "0.05").on("input", function(d3_event, d2) {
68580         var val = select_default2(this).property("value");
68581         if (!val && d3_event && d3_event.target) {
68582           val = d3_event.target.value;
68583         }
68584         updateValue(d2, val);
68585       });
68586       sildersControlEnter.append("button").attr("title", function(d2) {
68587         return "".concat(_t("background.reset"), " ").concat(_t("background." + d2));
68588       }).attr("class", function(d2) {
68589         return "display-option-reset display-option-reset-" + d2;
68590       }).on("click", function(d3_event, d2) {
68591         if (d3_event.button !== 0) return;
68592         updateValue(d2, 1);
68593       }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
68594       containerEnter.append("a").attr("class", "display-option-resetlink").attr("role", "button").attr("href", "#").call(_t.append("background.reset_all")).on("click", function(d3_event) {
68595         d3_event.preventDefault();
68596         for (var i3 = 0; i3 < _sliders.length; i3++) {
68597           updateValue(_sliders[i3], 1);
68598         }
68599       });
68600       container = containerEnter.merge(container);
68601       container.selectAll(".display-option-input").property("value", function(d2) {
68602         return _options[d2];
68603       });
68604       container.selectAll(".display-option-value").text(function(d2) {
68605         return Math.floor(_options[d2] * 100) + "%";
68606       });
68607       container.selectAll(".display-option-reset").classed("disabled", function(d2) {
68608         return _options[d2] === 1;
68609       });
68610       if (containerEnter.size() && _options.brightness !== 1) {
68611         context.background().brightness(_options.brightness);
68612       }
68613     }
68614     return section;
68615   }
68616
68617   // modules/ui/settings/custom_background.js
68618   function uiSettingsCustomBackground() {
68619     var dispatch14 = dispatch_default("change");
68620     function render(selection2) {
68621       var _origSettings = {
68622         template: corePreferences("background-custom-template")
68623       };
68624       var _currSettings = {
68625         template: corePreferences("background-custom-template")
68626       };
68627       var example = "https://tile.openstreetmap.org/{zoom}/{x}/{y}.png";
68628       var modal = uiConfirm(selection2).okButton();
68629       modal.classed("settings-modal settings-custom-background", true);
68630       modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_background.header"));
68631       var textSection = modal.select(".modal-section.message-text");
68632       var instructions = "".concat(_t.html("settings.custom_background.instructions.info"), "\n") + "\n" + "#### ".concat(_t.html("settings.custom_background.instructions.wms.tokens_label"), "\n") + "* ".concat(_t.html("settings.custom_background.instructions.wms.tokens.proj"), "\n") + "* ".concat(_t.html("settings.custom_background.instructions.wms.tokens.wkid"), "\n") + "* ".concat(_t.html("settings.custom_background.instructions.wms.tokens.dimensions"), "\n") + "* ".concat(_t.html("settings.custom_background.instructions.wms.tokens.bbox"), "\n") + "\n" + "#### ".concat(_t.html("settings.custom_background.instructions.tms.tokens_label"), "\n") + "* ".concat(_t.html("settings.custom_background.instructions.tms.tokens.xyz"), "\n") + "* ".concat(_t.html("settings.custom_background.instructions.tms.tokens.flipped_y"), "\n") + "* ".concat(_t.html("settings.custom_background.instructions.tms.tokens.switch"), "\n") + "* ".concat(_t.html("settings.custom_background.instructions.tms.tokens.quadtile"), "\n") + "* ".concat(_t.html("settings.custom_background.instructions.tms.tokens.scale_factor"), "\n") + "\n" + "#### ".concat(_t.html("settings.custom_background.instructions.example"), "\n") + "`".concat(example, "`");
68633       textSection.append("div").attr("class", "instructions-template").html(marked(instructions));
68634       textSection.append("textarea").attr("class", "field-template").attr("placeholder", _t("settings.custom_background.template.placeholder")).call(utilNoAuto).property("value", _currSettings.template);
68635       var buttonSection = modal.select(".modal-section.buttons");
68636       buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
68637       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
68638       buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
68639       function isSaveDisabled() {
68640         return null;
68641       }
68642       function clickCancel() {
68643         textSection.select(".field-template").property("value", _origSettings.template);
68644         corePreferences("background-custom-template", _origSettings.template);
68645         this.blur();
68646         modal.close();
68647       }
68648       function clickSave() {
68649         _currSettings.template = textSection.select(".field-template").property("value");
68650         corePreferences("background-custom-template", _currSettings.template);
68651         this.blur();
68652         modal.close();
68653         dispatch14.call("change", this, _currSettings);
68654       }
68655     }
68656     return utilRebind(render, dispatch14, "on");
68657   }
68658
68659   // modules/ui/sections/background_list.js
68660   function uiSectionBackgroundList(context) {
68661     var _backgroundList = select_default2(null);
68662     var _customSource = context.background().findSource("custom");
68663     var _settingsCustomBackground = uiSettingsCustomBackground(context).on("change", customChanged);
68664     var section = uiSection("background-list", context).label(() => _t.append("background.backgrounds")).disclosureContent(renderDisclosureContent);
68665     function previousBackgroundID() {
68666       return corePreferences("background-last-used-toggle");
68667     }
68668     function renderDisclosureContent(selection2) {
68669       var container = selection2.selectAll(".layer-background-list").data([0]);
68670       _backgroundList = container.enter().append("ul").attr("class", "layer-list layer-background-list").attr("dir", "auto").merge(container);
68671       var bgExtrasListEnter = selection2.selectAll(".bg-extras-list").data([0]).enter().append("ul").attr("class", "layer-list bg-extras-list");
68672       var minimapLabelEnter = bgExtrasListEnter.append("li").attr("class", "minimap-toggle-item").append("label").call(
68673         uiTooltip().title(() => _t.append("background.minimap.tooltip")).keys([_t("background.minimap.key")]).placement("top")
68674       );
68675       minimapLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
68676         d3_event.preventDefault();
68677         uiMapInMap.toggle();
68678       });
68679       minimapLabelEnter.append("span").call(_t.append("background.minimap.description"));
68680       var panelLabelEnter = bgExtrasListEnter.append("li").attr("class", "background-panel-toggle-item").append("label").call(
68681         uiTooltip().title(() => _t.append("background.panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.background.key"))]).placement("top")
68682       );
68683       panelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
68684         d3_event.preventDefault();
68685         context.ui().info.toggle("background");
68686       });
68687       panelLabelEnter.append("span").call(_t.append("background.panel.description"));
68688       var locPanelLabelEnter = bgExtrasListEnter.append("li").attr("class", "location-panel-toggle-item").append("label").call(
68689         uiTooltip().title(() => _t.append("background.location_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.location.key"))]).placement("top")
68690       );
68691       locPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
68692         d3_event.preventDefault();
68693         context.ui().info.toggle("location");
68694       });
68695       locPanelLabelEnter.append("span").call(_t.append("background.location_panel.description"));
68696       selection2.selectAll(".imagery-faq").data([0]).enter().append("div").attr("class", "imagery-faq").append("a").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).attr("href", "https://github.com/openstreetmap/iD/blob/develop/FAQ.md#how-can-i-report-an-issue-with-background-imagery").append("span").call(_t.append("background.imagery_problem_faq"));
68697       _backgroundList.call(drawListItems, "radio", function(d3_event, d2) {
68698         chooseBackground(d2);
68699       }, function(d2) {
68700         return !d2.isHidden() && !d2.overlay;
68701       });
68702     }
68703     function setTooltips(selection2) {
68704       selection2.each(function(d2, i3, nodes) {
68705         var item = select_default2(this).select("label");
68706         var span = item.select("span");
68707         var placement = i3 < nodes.length / 2 ? "bottom" : "top";
68708         var hasDescription = d2.hasDescription();
68709         var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
68710         item.call(uiTooltip().destroyAny);
68711         if (d2.id === previousBackgroundID()) {
68712           item.call(
68713             uiTooltip().placement(placement).title(() => _t.append("background.switch")).keys([uiCmd("\u2318" + _t("background.key"))])
68714           );
68715         } else if (hasDescription || isOverflowing) {
68716           item.call(
68717             uiTooltip().placement(placement).title(() => hasDescription ? d2.description() : d2.label())
68718           );
68719         }
68720       });
68721     }
68722     function drawListItems(layerList, type2, change, filter2) {
68723       var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2).sort(function(a2, b2) {
68724         return a2.best() && !b2.best() ? -1 : b2.best() && !a2.best() ? 1 : descending(a2.area(), b2.area()) || ascending(a2.name(), b2.name()) || 0;
68725       });
68726       var layerLinks = layerList.selectAll("li").data(sources, function(d2, i3) {
68727         return d2.id + "---" + i3;
68728       });
68729       layerLinks.exit().remove();
68730       var enter = layerLinks.enter().append("li").classed("layer-custom", function(d2) {
68731         return d2.id === "custom";
68732       }).classed("best", function(d2) {
68733         return d2.best();
68734       });
68735       var label = enter.append("label");
68736       label.append("input").attr("type", type2).attr("name", "background-layer").attr("value", function(d2) {
68737         return d2.id;
68738       }).on("change", change);
68739       label.append("span").each(function(d2) {
68740         d2.label()(select_default2(this));
68741       });
68742       enter.filter(function(d2) {
68743         return d2.id === "custom";
68744       }).append("button").attr("class", "layer-browse").call(
68745         uiTooltip().title(() => _t.append("settings.custom_background.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
68746       ).on("click", function(d3_event) {
68747         d3_event.preventDefault();
68748         editCustom();
68749       }).call(svgIcon("#iD-icon-more"));
68750       enter.filter(function(d2) {
68751         return d2.best();
68752       }).append("div").attr("class", "best").call(
68753         uiTooltip().title(() => _t.append("background.best_imagery")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
68754       ).append("span").text("\u2605");
68755       layerList.call(updateLayerSelections);
68756     }
68757     function updateLayerSelections(selection2) {
68758       function active(d2) {
68759         return context.background().showsLayer(d2);
68760       }
68761       selection2.selectAll("li").classed("active", active).classed("switch", function(d2) {
68762         return d2.id === previousBackgroundID();
68763       }).call(setTooltips).selectAll("input").property("checked", active);
68764     }
68765     function chooseBackground(d2) {
68766       if (d2.id === "custom" && !d2.template()) {
68767         return editCustom();
68768       }
68769       var previousBackground = context.background().baseLayerSource();
68770       corePreferences("background-last-used-toggle", previousBackground.id);
68771       corePreferences("background-last-used", d2.id);
68772       context.background().baseLayerSource(d2);
68773     }
68774     function customChanged(d2) {
68775       if (d2 && d2.template) {
68776         _customSource.template(d2.template);
68777         chooseBackground(_customSource);
68778       } else {
68779         _customSource.template("");
68780         chooseBackground(context.background().findSource("none"));
68781       }
68782     }
68783     function editCustom() {
68784       context.container().call(_settingsCustomBackground);
68785     }
68786     context.background().on("change.background_list", function() {
68787       _backgroundList.call(updateLayerSelections);
68788     });
68789     context.map().on(
68790       "move.background_list",
68791       debounce_default(function() {
68792         window.requestIdleCallback(section.reRender);
68793       }, 1e3)
68794     );
68795     return section;
68796   }
68797
68798   // modules/ui/sections/background_offset.js
68799   function uiSectionBackgroundOffset(context) {
68800     var section = uiSection("background-offset", context).label(() => _t.append("background.fix_misalignment")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
68801     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
68802     var _directions = [
68803       ["top", [0, -0.5]],
68804       ["left", [-0.5, 0]],
68805       ["right", [0.5, 0]],
68806       ["bottom", [0, 0.5]]
68807     ];
68808     function updateValue() {
68809       var meters = geoOffsetToMeters(context.background().offset());
68810       var x2 = +meters[0].toFixed(2);
68811       var y2 = +meters[1].toFixed(2);
68812       context.container().selectAll(".nudge-inner-rect").select("input").classed("error", false).property("value", x2 + ", " + y2);
68813       context.container().selectAll(".nudge-reset").classed("disabled", function() {
68814         return x2 === 0 && y2 === 0;
68815       });
68816     }
68817     function resetOffset() {
68818       context.background().offset([0, 0]);
68819       updateValue();
68820     }
68821     function nudge(d2) {
68822       context.background().nudge(d2, context.map().zoom());
68823       updateValue();
68824     }
68825     function inputOffset() {
68826       var input = select_default2(this);
68827       var d2 = input.node().value;
68828       if (d2 === "") return resetOffset();
68829       d2 = d2.replace(/;/g, ",").split(",").map(function(n3) {
68830         return !isNaN(n3) && n3;
68831       });
68832       if (d2.length !== 2 || !d2[0] || !d2[1]) {
68833         input.classed("error", true);
68834         return;
68835       }
68836       context.background().offset(geoMetersToOffset(d2));
68837       updateValue();
68838     }
68839     function dragOffset(d3_event) {
68840       if (d3_event.button !== 0) return;
68841       var origin = [d3_event.clientX, d3_event.clientY];
68842       var pointerId = d3_event.pointerId || "mouse";
68843       context.container().append("div").attr("class", "nudge-surface");
68844       select_default2(window).on(_pointerPrefix + "move.drag-bg-offset", pointermove).on(_pointerPrefix + "up.drag-bg-offset", pointerup);
68845       if (_pointerPrefix === "pointer") {
68846         select_default2(window).on("pointercancel.drag-bg-offset", pointerup);
68847       }
68848       function pointermove(d3_event2) {
68849         if (pointerId !== (d3_event2.pointerId || "mouse")) return;
68850         var latest = [d3_event2.clientX, d3_event2.clientY];
68851         var d2 = [
68852           -(origin[0] - latest[0]) / 4,
68853           -(origin[1] - latest[1]) / 4
68854         ];
68855         origin = latest;
68856         nudge(d2);
68857       }
68858       function pointerup(d3_event2) {
68859         if (pointerId !== (d3_event2.pointerId || "mouse")) return;
68860         if (d3_event2.button !== 0) return;
68861         context.container().selectAll(".nudge-surface").remove();
68862         select_default2(window).on(".drag-bg-offset", null);
68863       }
68864     }
68865     function renderDisclosureContent(selection2) {
68866       var container = selection2.selectAll(".nudge-container").data([0]);
68867       var containerEnter = container.enter().append("div").attr("class", "nudge-container");
68868       containerEnter.append("div").attr("class", "nudge-instructions").call(_t.append("background.offset"));
68869       var nudgeWrapEnter = containerEnter.append("div").attr("class", "nudge-controls-wrap");
68870       var nudgeEnter = nudgeWrapEnter.append("div").attr("class", "nudge-outer-rect").on(_pointerPrefix + "down", dragOffset);
68871       nudgeEnter.append("div").attr("class", "nudge-inner-rect").append("input").attr("type", "text").attr("aria-label", _t("background.offset_label")).on("change", inputOffset);
68872       nudgeWrapEnter.append("div").selectAll("button").data(_directions).enter().append("button").attr("title", function(d2) {
68873         return _t("background.nudge.".concat(d2[0]));
68874       }).attr("class", function(d2) {
68875         return d2[0] + " nudge";
68876       }).on("click", function(d3_event, d2) {
68877         nudge(d2[1]);
68878       });
68879       nudgeWrapEnter.append("button").attr("title", _t("background.reset")).attr("class", "nudge-reset disabled").on("click", function(d3_event) {
68880         d3_event.preventDefault();
68881         resetOffset();
68882       }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
68883       updateValue();
68884     }
68885     context.background().on("change.backgroundOffset-update", updateValue);
68886     return section;
68887   }
68888
68889   // modules/ui/sections/overlay_list.js
68890   function uiSectionOverlayList(context) {
68891     var section = uiSection("overlay-list", context).label(() => _t.append("background.overlays")).disclosureContent(renderDisclosureContent);
68892     var _overlayList = select_default2(null);
68893     function setTooltips(selection2) {
68894       selection2.each(function(d2, i3, nodes) {
68895         var item = select_default2(this).select("label");
68896         var span = item.select("span");
68897         var placement = i3 < nodes.length / 2 ? "bottom" : "top";
68898         var description = d2.description();
68899         var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
68900         item.call(uiTooltip().destroyAny);
68901         if (description || isOverflowing) {
68902           item.call(
68903             uiTooltip().placement(placement).title(() => description || d2.name())
68904           );
68905         }
68906       });
68907     }
68908     function updateLayerSelections(selection2) {
68909       function active(d2) {
68910         return context.background().showsLayer(d2);
68911       }
68912       selection2.selectAll("li").classed("active", active).call(setTooltips).selectAll("input").property("checked", active);
68913     }
68914     function chooseOverlay(d3_event, d2) {
68915       d3_event.preventDefault();
68916       context.background().toggleOverlayLayer(d2);
68917       _overlayList.call(updateLayerSelections);
68918       document.activeElement.blur();
68919     }
68920     function drawListItems(layerList, type2, change, filter2) {
68921       var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2);
68922       var layerLinks = layerList.selectAll("li").data(sources, function(d2) {
68923         return d2.name();
68924       });
68925       layerLinks.exit().remove();
68926       var enter = layerLinks.enter().append("li");
68927       var label = enter.append("label");
68928       label.append("input").attr("type", type2).attr("name", "layers").on("change", change);
68929       label.append("span").each(function(d2) {
68930         d2.label()(select_default2(this));
68931       });
68932       layerList.selectAll("li").sort(sortSources);
68933       layerList.call(updateLayerSelections);
68934       function sortSources(a2, b2) {
68935         return a2.best() && !b2.best() ? -1 : b2.best() && !a2.best() ? 1 : descending(a2.area(), b2.area()) || ascending(a2.name(), b2.name()) || 0;
68936       }
68937     }
68938     function renderDisclosureContent(selection2) {
68939       var container = selection2.selectAll(".layer-overlay-list").data([0]);
68940       _overlayList = container.enter().append("ul").attr("class", "layer-list layer-overlay-list").attr("dir", "auto").merge(container);
68941       _overlayList.call(drawListItems, "checkbox", chooseOverlay, function(d2) {
68942         return !d2.isHidden() && d2.overlay;
68943       });
68944     }
68945     context.map().on(
68946       "move.overlay_list",
68947       debounce_default(function() {
68948         window.requestIdleCallback(section.reRender);
68949       }, 1e3)
68950     );
68951     return section;
68952   }
68953
68954   // modules/ui/panes/background.js
68955   function uiPaneBackground(context) {
68956     var backgroundPane = uiPane("background", context).key(_t("background.key")).label(_t.append("background.title")).description(_t.append("background.description")).iconName("iD-icon-layers").sections([
68957       uiSectionBackgroundList(context),
68958       uiSectionOverlayList(context),
68959       uiSectionBackgroundDisplayOptions(context),
68960       uiSectionBackgroundOffset(context)
68961     ]);
68962     return backgroundPane;
68963   }
68964
68965   // modules/ui/panes/help.js
68966   function uiPaneHelp(context) {
68967     var docKeys = [
68968       ["help", [
68969         "welcome",
68970         "open_data_h",
68971         "open_data",
68972         "before_start_h",
68973         "before_start",
68974         "open_source_h",
68975         "open_source",
68976         "open_source_attribution",
68977         "open_source_help"
68978       ]],
68979       ["overview", [
68980         "navigation_h",
68981         "navigation_drag",
68982         "navigation_zoom",
68983         "features_h",
68984         "features",
68985         "nodes_ways"
68986       ]],
68987       ["editing", [
68988         "select_h",
68989         "select_left_click",
68990         "select_right_click",
68991         "select_space",
68992         "multiselect_h",
68993         "multiselect",
68994         "multiselect_shift_click",
68995         "multiselect_lasso",
68996         "undo_redo_h",
68997         "undo_redo",
68998         "save_h",
68999         "save",
69000         "save_validation",
69001         "upload_h",
69002         "upload",
69003         "backups_h",
69004         "backups",
69005         "keyboard_h",
69006         "keyboard"
69007       ]],
69008       ["feature_editor", [
69009         "intro",
69010         "definitions",
69011         "type_h",
69012         "type",
69013         "type_picker",
69014         "fields_h",
69015         "fields_all_fields",
69016         "fields_example",
69017         "fields_add_field",
69018         "tags_h",
69019         "tags_all_tags",
69020         "tags_resources"
69021       ]],
69022       ["points", [
69023         "intro",
69024         "add_point_h",
69025         "add_point",
69026         "add_point_finish",
69027         "move_point_h",
69028         "move_point",
69029         "delete_point_h",
69030         "delete_point",
69031         "delete_point_command"
69032       ]],
69033       ["lines", [
69034         "intro",
69035         "add_line_h",
69036         "add_line",
69037         "add_line_draw",
69038         "add_line_continue",
69039         "add_line_finish",
69040         "modify_line_h",
69041         "modify_line_dragnode",
69042         "modify_line_addnode",
69043         "connect_line_h",
69044         "connect_line",
69045         "connect_line_display",
69046         "connect_line_drag",
69047         "connect_line_tag",
69048         "disconnect_line_h",
69049         "disconnect_line_command",
69050         "move_line_h",
69051         "move_line_command",
69052         "move_line_connected",
69053         "delete_line_h",
69054         "delete_line",
69055         "delete_line_command"
69056       ]],
69057       ["areas", [
69058         "intro",
69059         "point_or_area_h",
69060         "point_or_area",
69061         "add_area_h",
69062         "add_area_command",
69063         "add_area_draw",
69064         "add_area_continue",
69065         "add_area_finish",
69066         "square_area_h",
69067         "square_area_command",
69068         "modify_area_h",
69069         "modify_area_dragnode",
69070         "modify_area_addnode",
69071         "delete_area_h",
69072         "delete_area",
69073         "delete_area_command"
69074       ]],
69075       ["relations", [
69076         "intro",
69077         "edit_relation_h",
69078         "edit_relation",
69079         "edit_relation_add",
69080         "edit_relation_delete",
69081         "maintain_relation_h",
69082         "maintain_relation",
69083         "relation_types_h",
69084         "multipolygon_h",
69085         "multipolygon",
69086         "multipolygon_create",
69087         "multipolygon_merge",
69088         "turn_restriction_h",
69089         "turn_restriction",
69090         "turn_restriction_field",
69091         "turn_restriction_editing",
69092         "route_h",
69093         "route",
69094         "route_add",
69095         "boundary_h",
69096         "boundary",
69097         "boundary_add"
69098       ]],
69099       ["operations", [
69100         "intro",
69101         "intro_2",
69102         "straighten",
69103         "orthogonalize",
69104         "circularize",
69105         "move",
69106         "rotate",
69107         "reflect",
69108         "continue",
69109         "reverse",
69110         "disconnect",
69111         "split",
69112         "extract",
69113         "merge",
69114         "delete",
69115         "downgrade",
69116         "copy_paste"
69117       ]],
69118       ["notes", [
69119         "intro",
69120         "add_note_h",
69121         "add_note",
69122         "place_note",
69123         "move_note",
69124         "update_note_h",
69125         "update_note",
69126         "save_note_h",
69127         "save_note"
69128       ]],
69129       ["imagery", [
69130         "intro",
69131         "sources_h",
69132         "choosing",
69133         "sources",
69134         "offsets_h",
69135         "offset",
69136         "offset_change"
69137       ]],
69138       ["streetlevel", [
69139         "intro",
69140         "using_h",
69141         "using",
69142         "photos",
69143         "viewer"
69144       ]],
69145       ["gps", [
69146         "intro",
69147         "survey",
69148         "using_h",
69149         "using",
69150         "tracing",
69151         "upload"
69152       ]],
69153       ["qa", [
69154         "intro",
69155         "tools_h",
69156         "tools",
69157         "issues_h",
69158         "issues"
69159       ]]
69160     ];
69161     var headings = {
69162       "help.help.open_data_h": 3,
69163       "help.help.before_start_h": 3,
69164       "help.help.open_source_h": 3,
69165       "help.overview.navigation_h": 3,
69166       "help.overview.features_h": 3,
69167       "help.editing.select_h": 3,
69168       "help.editing.multiselect_h": 3,
69169       "help.editing.undo_redo_h": 3,
69170       "help.editing.save_h": 3,
69171       "help.editing.upload_h": 3,
69172       "help.editing.backups_h": 3,
69173       "help.editing.keyboard_h": 3,
69174       "help.feature_editor.type_h": 3,
69175       "help.feature_editor.fields_h": 3,
69176       "help.feature_editor.tags_h": 3,
69177       "help.points.add_point_h": 3,
69178       "help.points.move_point_h": 3,
69179       "help.points.delete_point_h": 3,
69180       "help.lines.add_line_h": 3,
69181       "help.lines.modify_line_h": 3,
69182       "help.lines.connect_line_h": 3,
69183       "help.lines.disconnect_line_h": 3,
69184       "help.lines.move_line_h": 3,
69185       "help.lines.delete_line_h": 3,
69186       "help.areas.point_or_area_h": 3,
69187       "help.areas.add_area_h": 3,
69188       "help.areas.square_area_h": 3,
69189       "help.areas.modify_area_h": 3,
69190       "help.areas.delete_area_h": 3,
69191       "help.relations.edit_relation_h": 3,
69192       "help.relations.maintain_relation_h": 3,
69193       "help.relations.relation_types_h": 2,
69194       "help.relations.multipolygon_h": 3,
69195       "help.relations.turn_restriction_h": 3,
69196       "help.relations.route_h": 3,
69197       "help.relations.boundary_h": 3,
69198       "help.notes.add_note_h": 3,
69199       "help.notes.update_note_h": 3,
69200       "help.notes.save_note_h": 3,
69201       "help.imagery.sources_h": 3,
69202       "help.imagery.offsets_h": 3,
69203       "help.streetlevel.using_h": 3,
69204       "help.gps.using_h": 3,
69205       "help.qa.tools_h": 3,
69206       "help.qa.issues_h": 3
69207     };
69208     var docs = docKeys.map(function(key) {
69209       var helpkey = "help." + key[0];
69210       var helpPaneReplacements = { version: context.version };
69211       var text = key[1].reduce(function(all, part) {
69212         var subkey = helpkey + "." + part;
69213         var depth = headings[subkey];
69214         var hhh = depth ? Array(depth + 1).join("#") + " " : "";
69215         return all + hhh + helpHtml(subkey, helpPaneReplacements) + "\n\n";
69216       }, "");
69217       return {
69218         title: _t.html(helpkey + ".title"),
69219         content: marked(text.trim()).replace(/<code>/g, "<kbd>").replace(/<\/code>/g, "</kbd>")
69220       };
69221     });
69222     var helpPane = uiPane("help", context).key(_t("help.key")).label(_t.append("help.title")).description(_t.append("help.title")).iconName("iD-icon-help");
69223     helpPane.renderContent = function(content) {
69224       function clickHelp(d2, i3) {
69225         var rtl = _mainLocalizer.textDirection() === "rtl";
69226         content.property("scrollTop", 0);
69227         helpPane.selection().select(".pane-heading h2").html(d2.title);
69228         body.html(d2.content);
69229         body.selectAll("a").attr("target", "_blank");
69230         menuItems.classed("selected", function(m2) {
69231           return m2.title === d2.title;
69232         });
69233         nav.html("");
69234         if (rtl) {
69235           nav.call(drawNext).call(drawPrevious);
69236         } else {
69237           nav.call(drawPrevious).call(drawNext);
69238         }
69239         function drawNext(selection2) {
69240           if (i3 < docs.length - 1) {
69241             var nextLink = selection2.append("a").attr("href", "#").attr("class", "next").on("click", function(d3_event) {
69242               d3_event.preventDefault();
69243               clickHelp(docs[i3 + 1], i3 + 1);
69244             });
69245             nextLink.append("span").html(docs[i3 + 1].title).call(svgIcon(rtl ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
69246           }
69247         }
69248         function drawPrevious(selection2) {
69249           if (i3 > 0) {
69250             var prevLink = selection2.append("a").attr("href", "#").attr("class", "previous").on("click", function(d3_event) {
69251               d3_event.preventDefault();
69252               clickHelp(docs[i3 - 1], i3 - 1);
69253             });
69254             prevLink.call(svgIcon(rtl ? "#iD-icon-forward" : "#iD-icon-backward", "inline")).append("span").html(docs[i3 - 1].title);
69255           }
69256         }
69257       }
69258       function clickWalkthrough(d3_event) {
69259         d3_event.preventDefault();
69260         if (context.inIntro()) return;
69261         context.container().call(uiIntro(context));
69262         context.ui().togglePanes();
69263       }
69264       function clickShortcuts(d3_event) {
69265         d3_event.preventDefault();
69266         context.container().call(context.ui().shortcuts, true);
69267       }
69268       var toc = content.append("ul").attr("class", "toc");
69269       var menuItems = toc.selectAll("li").data(docs).enter().append("li").append("a").attr("role", "button").attr("href", "#").html(function(d2) {
69270         return d2.title;
69271       }).on("click", function(d3_event, d2) {
69272         d3_event.preventDefault();
69273         clickHelp(d2, docs.indexOf(d2));
69274       });
69275       var shortcuts = toc.append("li").attr("class", "shortcuts").call(
69276         uiTooltip().title(() => _t.append("shortcuts.tooltip")).keys(["?"]).placement("top")
69277       ).append("a").attr("href", "#").on("click", clickShortcuts);
69278       shortcuts.append("div").call(_t.append("shortcuts.title"));
69279       var walkthrough = toc.append("li").attr("class", "walkthrough").append("a").attr("href", "#").on("click", clickWalkthrough);
69280       walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
69281       walkthrough.append("div").call(_t.append("splash.walkthrough"));
69282       var helpContent = content.append("div").attr("class", "left-content");
69283       var body = helpContent.append("div").attr("class", "body");
69284       var nav = helpContent.append("div").attr("class", "nav");
69285       clickHelp(docs[0], 0);
69286     };
69287     return helpPane;
69288   }
69289
69290   // modules/ui/sections/validation_issues.js
69291   function uiSectionValidationIssues(id2, severity, context) {
69292     var _issues = [];
69293     var section = uiSection(id2, context).label(function() {
69294       if (!_issues) return "";
69295       var issueCountText = _issues.length > 1e3 ? "1000+" : String(_issues.length);
69296       return _t.append("inspector.title_count", { title: _t("issues." + severity + "s.list_title"), count: issueCountText });
69297     }).disclosureContent(renderDisclosureContent).shouldDisplay(function() {
69298       return _issues && _issues.length;
69299     });
69300     function getOptions() {
69301       return {
69302         what: corePreferences("validate-what") || "edited",
69303         where: corePreferences("validate-where") || "all"
69304       };
69305     }
69306     function reloadIssues() {
69307       _issues = context.validator().getIssuesBySeverity(getOptions())[severity];
69308     }
69309     function renderDisclosureContent(selection2) {
69310       var center = context.map().center();
69311       var graph = context.graph();
69312       var issues = _issues.map(function withDistance(issue) {
69313         var extent = issue.extent(graph);
69314         var dist = extent ? geoSphericalDistance(center, extent.center()) : 0;
69315         return Object.assign(issue, { dist });
69316       }).sort(function byDistance(a2, b2) {
69317         return a2.dist - b2.dist;
69318       });
69319       issues = issues.slice(0, 1e3);
69320       selection2.call(drawIssuesList, issues);
69321     }
69322     function drawIssuesList(selection2, issues) {
69323       var list2 = selection2.selectAll(".issues-list").data([0]);
69324       list2 = list2.enter().append("ul").attr("class", "layer-list issues-list " + severity + "s-list").merge(list2);
69325       var items = list2.selectAll("li").data(issues, function(d2) {
69326         return d2.key;
69327       });
69328       items.exit().remove();
69329       var itemsEnter = items.enter().append("li").attr("class", function(d2) {
69330         return "issue severity-" + d2.severity;
69331       });
69332       var labelsEnter = itemsEnter.append("button").attr("class", "issue-label").on("click", function(d3_event, d2) {
69333         context.validator().focusIssue(d2);
69334       }).on("mouseover", function(d3_event, d2) {
69335         utilHighlightEntities(d2.entityIds, true, context);
69336       }).on("mouseout", function(d3_event, d2) {
69337         utilHighlightEntities(d2.entityIds, false, context);
69338       });
69339       var textEnter = labelsEnter.append("span").attr("class", "issue-text");
69340       textEnter.append("span").attr("class", "issue-icon").each(function(d2) {
69341         var iconName = "#iD-icon-" + (d2.severity === "warning" ? "alert" : "error");
69342         select_default2(this).call(svgIcon(iconName));
69343       });
69344       textEnter.append("span").attr("class", "issue-message");
69345       items = items.merge(itemsEnter).order();
69346       items.selectAll(".issue-message").text("").each(function(d2) {
69347         return d2.message(context)(select_default2(this));
69348       });
69349     }
69350     context.validator().on("validated.uiSectionValidationIssues" + id2, function() {
69351       window.requestIdleCallback(function() {
69352         reloadIssues();
69353         section.reRender();
69354       });
69355     });
69356     context.map().on(
69357       "move.uiSectionValidationIssues" + id2,
69358       debounce_default(function() {
69359         window.requestIdleCallback(function() {
69360           if (getOptions().where === "visible") {
69361             reloadIssues();
69362           }
69363           section.reRender();
69364         });
69365       }, 1e3)
69366     );
69367     return section;
69368   }
69369
69370   // modules/ui/sections/validation_options.js
69371   function uiSectionValidationOptions(context) {
69372     var section = uiSection("issues-options", context).content(renderContent);
69373     function renderContent(selection2) {
69374       var container = selection2.selectAll(".issues-options-container").data([0]);
69375       container = container.enter().append("div").attr("class", "issues-options-container").merge(container);
69376       var data = [
69377         { key: "what", values: ["edited", "all"] },
69378         { key: "where", values: ["visible", "all"] }
69379       ];
69380       var options2 = container.selectAll(".issues-option").data(data, function(d2) {
69381         return d2.key;
69382       });
69383       var optionsEnter = options2.enter().append("div").attr("class", function(d2) {
69384         return "issues-option issues-option-" + d2.key;
69385       });
69386       optionsEnter.append("div").attr("class", "issues-option-title").html(function(d2) {
69387         return _t.html("issues.options." + d2.key + ".title");
69388       });
69389       var valuesEnter = optionsEnter.selectAll("label").data(function(d2) {
69390         return d2.values.map(function(val) {
69391           return { value: val, key: d2.key };
69392         });
69393       }).enter().append("label");
69394       valuesEnter.append("input").attr("type", "radio").attr("name", function(d2) {
69395         return "issues-option-" + d2.key;
69396       }).attr("value", function(d2) {
69397         return d2.value;
69398       }).property("checked", function(d2) {
69399         return getOptions()[d2.key] === d2.value;
69400       }).on("change", function(d3_event, d2) {
69401         updateOptionValue(d3_event, d2.key, d2.value);
69402       });
69403       valuesEnter.append("span").html(function(d2) {
69404         return _t.html("issues.options." + d2.key + "." + d2.value);
69405       });
69406     }
69407     function getOptions() {
69408       return {
69409         what: corePreferences("validate-what") || "edited",
69410         // 'all', 'edited'
69411         where: corePreferences("validate-where") || "all"
69412         // 'all', 'visible'
69413       };
69414     }
69415     function updateOptionValue(d3_event, d2, val) {
69416       if (!val && d3_event && d3_event.target) {
69417         val = d3_event.target.value;
69418       }
69419       corePreferences("validate-" + d2, val);
69420       context.validator().validate();
69421     }
69422     return section;
69423   }
69424
69425   // modules/ui/sections/validation_rules.js
69426   function uiSectionValidationRules(context) {
69427     var MINSQUARE = 0;
69428     var MAXSQUARE = 20;
69429     var DEFAULTSQUARE = 5;
69430     var section = uiSection("issues-rules", context).disclosureContent(renderDisclosureContent).label(() => _t.append("issues.rules.title"));
69431     var _ruleKeys = context.validator().getRuleKeys().filter(function(key) {
69432       return key !== "maprules";
69433     }).sort(function(key1, key2) {
69434       return _t("issues." + key1 + ".title") < _t("issues." + key2 + ".title") ? -1 : 1;
69435     });
69436     function renderDisclosureContent(selection2) {
69437       var container = selection2.selectAll(".issues-rulelist-container").data([0]);
69438       var containerEnter = container.enter().append("div").attr("class", "issues-rulelist-container");
69439       containerEnter.append("ul").attr("class", "layer-list issue-rules-list");
69440       var ruleLinks = containerEnter.append("div").attr("class", "issue-rules-links section-footer");
69441       ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
69442         d3_event.preventDefault();
69443         context.validator().disableRules(_ruleKeys);
69444       });
69445       ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
69446         d3_event.preventDefault();
69447         context.validator().disableRules([]);
69448       });
69449       container = container.merge(containerEnter);
69450       container.selectAll(".issue-rules-list").call(drawListItems, _ruleKeys, "checkbox", "rule", toggleRule, isRuleEnabled);
69451     }
69452     function drawListItems(selection2, data, type2, name, change, active) {
69453       var items = selection2.selectAll("li").data(data);
69454       items.exit().remove();
69455       var enter = items.enter().append("li");
69456       if (name === "rule") {
69457         enter.call(
69458           uiTooltip().title(function(d2) {
69459             return _t.append("issues." + d2 + ".tip");
69460           }).placement("top")
69461         );
69462       }
69463       var label = enter.append("label");
69464       label.append("input").attr("type", type2).attr("name", name).on("change", change);
69465       label.append("span").html(function(d2) {
69466         var params = {};
69467         if (d2 === "unsquare_way") {
69468           params.val = { html: '<span class="square-degrees"></span>' };
69469         }
69470         return _t.html("issues." + d2 + ".title", params);
69471       });
69472       items = items.merge(enter);
69473       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
69474       var degStr = corePreferences("validate-square-degrees");
69475       if (degStr === null) {
69476         degStr = DEFAULTSQUARE.toString();
69477       }
69478       var span = items.selectAll(".square-degrees");
69479       var input = span.selectAll(".square-degrees-input").data([0]);
69480       input.enter().append("input").attr("type", "number").attr("min", MINSQUARE.toString()).attr("max", MAXSQUARE.toString()).attr("step", "0.5").attr("class", "square-degrees-input").call(utilNoAuto).on("click", function(d3_event) {
69481         d3_event.preventDefault();
69482         d3_event.stopPropagation();
69483         this.select();
69484       }).on("keyup", function(d3_event) {
69485         if (d3_event.keyCode === 13) {
69486           this.blur();
69487           this.select();
69488         }
69489       }).on("blur", changeSquare).merge(input).property("value", degStr);
69490     }
69491     function changeSquare() {
69492       var input = select_default2(this);
69493       var degStr = utilGetSetValue(input).trim();
69494       var degNum = Number(degStr);
69495       if (!isFinite(degNum)) {
69496         degNum = DEFAULTSQUARE;
69497       } else if (degNum > MAXSQUARE) {
69498         degNum = MAXSQUARE;
69499       } else if (degNum < MINSQUARE) {
69500         degNum = MINSQUARE;
69501       }
69502       degNum = Math.round(degNum * 10) / 10;
69503       degStr = degNum.toString();
69504       input.property("value", degStr);
69505       corePreferences("validate-square-degrees", degStr);
69506       context.validator().revalidateUnsquare();
69507     }
69508     function isRuleEnabled(d2) {
69509       return context.validator().isRuleEnabled(d2);
69510     }
69511     function toggleRule(d3_event, d2) {
69512       context.validator().toggleRule(d2);
69513     }
69514     context.validator().on("validated.uiSectionValidationRules", function() {
69515       window.requestIdleCallback(section.reRender);
69516     });
69517     return section;
69518   }
69519
69520   // modules/ui/sections/validation_status.js
69521   function uiSectionValidationStatus(context) {
69522     var section = uiSection("issues-status", context).content(renderContent).shouldDisplay(function() {
69523       var issues = context.validator().getIssues(getOptions());
69524       return issues.length === 0;
69525     });
69526     function getOptions() {
69527       return {
69528         what: corePreferences("validate-what") || "edited",
69529         where: corePreferences("validate-where") || "all"
69530       };
69531     }
69532     function renderContent(selection2) {
69533       var box = selection2.selectAll(".box").data([0]);
69534       var boxEnter = box.enter().append("div").attr("class", "box");
69535       boxEnter.append("div").call(svgIcon("#iD-icon-apply", "pre-text"));
69536       var noIssuesMessage = boxEnter.append("span");
69537       noIssuesMessage.append("strong").attr("class", "message");
69538       noIssuesMessage.append("br");
69539       noIssuesMessage.append("span").attr("class", "details");
69540       renderIgnoredIssuesReset(selection2);
69541       setNoIssuesText(selection2);
69542     }
69543     function renderIgnoredIssuesReset(selection2) {
69544       var ignoredIssues = context.validator().getIssues({ what: "all", where: "all", includeDisabledRules: true, includeIgnored: "only" });
69545       var resetIgnored = selection2.selectAll(".reset-ignored").data(ignoredIssues.length ? [0] : []);
69546       resetIgnored.exit().remove();
69547       var resetIgnoredEnter = resetIgnored.enter().append("div").attr("class", "reset-ignored section-footer");
69548       resetIgnoredEnter.append("a").attr("href", "#");
69549       resetIgnored = resetIgnored.merge(resetIgnoredEnter);
69550       resetIgnored.select("a").html(_t.html("inspector.title_count", { title: { html: _t.html("issues.reset_ignored") }, count: ignoredIssues.length }));
69551       resetIgnored.on("click", function(d3_event) {
69552         d3_event.preventDefault();
69553         context.validator().resetIgnoredIssues();
69554       });
69555     }
69556     function setNoIssuesText(selection2) {
69557       var opts = getOptions();
69558       function checkForHiddenIssues(cases) {
69559         for (var type2 in cases) {
69560           var hiddenOpts = cases[type2];
69561           var hiddenIssues = context.validator().getIssues(hiddenOpts);
69562           if (hiddenIssues.length) {
69563             selection2.select(".box .details").html("").call(_t.append(
69564               "issues.no_issues.hidden_issues." + type2,
69565               { count: hiddenIssues.length.toString() }
69566             ));
69567             return;
69568           }
69569         }
69570         selection2.select(".box .details").html("").call(_t.append("issues.no_issues.hidden_issues.none"));
69571       }
69572       var messageType;
69573       if (opts.what === "edited" && opts.where === "visible") {
69574         messageType = "edits_in_view";
69575         checkForHiddenIssues({
69576           elsewhere: { what: "edited", where: "all" },
69577           everything_else: { what: "all", where: "visible" },
69578           disabled_rules: { what: "edited", where: "visible", includeDisabledRules: "only" },
69579           everything_else_elsewhere: { what: "all", where: "all" },
69580           disabled_rules_elsewhere: { what: "edited", where: "all", includeDisabledRules: "only" },
69581           ignored_issues: { what: "edited", where: "visible", includeIgnored: "only" },
69582           ignored_issues_elsewhere: { what: "edited", where: "all", includeIgnored: "only" }
69583         });
69584       } else if (opts.what === "edited" && opts.where === "all") {
69585         messageType = "edits";
69586         checkForHiddenIssues({
69587           everything_else: { what: "all", where: "all" },
69588           disabled_rules: { what: "edited", where: "all", includeDisabledRules: "only" },
69589           ignored_issues: { what: "edited", where: "all", includeIgnored: "only" }
69590         });
69591       } else if (opts.what === "all" && opts.where === "visible") {
69592         messageType = "everything_in_view";
69593         checkForHiddenIssues({
69594           elsewhere: { what: "all", where: "all" },
69595           disabled_rules: { what: "all", where: "visible", includeDisabledRules: "only" },
69596           disabled_rules_elsewhere: { what: "all", where: "all", includeDisabledRules: "only" },
69597           ignored_issues: { what: "all", where: "visible", includeIgnored: "only" },
69598           ignored_issues_elsewhere: { what: "all", where: "all", includeIgnored: "only" }
69599         });
69600       } else if (opts.what === "all" && opts.where === "all") {
69601         messageType = "everything";
69602         checkForHiddenIssues({
69603           disabled_rules: { what: "all", where: "all", includeDisabledRules: "only" },
69604           ignored_issues: { what: "all", where: "all", includeIgnored: "only" }
69605         });
69606       }
69607       if (opts.what === "edited" && context.history().difference().summary().length === 0) {
69608         messageType = "no_edits";
69609       }
69610       selection2.select(".box .message").html("").call(_t.append("issues.no_issues.message." + messageType));
69611     }
69612     context.validator().on("validated.uiSectionValidationStatus", function() {
69613       window.requestIdleCallback(section.reRender);
69614     });
69615     context.map().on(
69616       "move.uiSectionValidationStatus",
69617       debounce_default(function() {
69618         window.requestIdleCallback(section.reRender);
69619       }, 1e3)
69620     );
69621     return section;
69622   }
69623
69624   // modules/ui/panes/issues.js
69625   function uiPaneIssues(context) {
69626     var issuesPane = uiPane("issues", context).key(_t("issues.key")).label(_t.append("issues.title")).description(_t.append("issues.title")).iconName("iD-icon-alert").sections([
69627       uiSectionValidationOptions(context),
69628       uiSectionValidationStatus(context),
69629       uiSectionValidationIssues("issues-errors", "error", context),
69630       uiSectionValidationIssues("issues-warnings", "warning", context),
69631       uiSectionValidationRules(context)
69632     ]);
69633     return issuesPane;
69634   }
69635
69636   // modules/ui/settings/custom_data.js
69637   function uiSettingsCustomData(context) {
69638     var dispatch14 = dispatch_default("change");
69639     function render(selection2) {
69640       var dataLayer = context.layers().layer("data");
69641       var _origSettings = {
69642         fileList: dataLayer && dataLayer.fileList() || null,
69643         url: corePreferences("settings-custom-data-url")
69644       };
69645       var _currSettings = {
69646         fileList: dataLayer && dataLayer.fileList() || null
69647         // url: prefs('settings-custom-data-url')
69648       };
69649       var modal = uiConfirm(selection2).okButton();
69650       modal.classed("settings-modal settings-custom-data", true);
69651       modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_data.header"));
69652       var textSection = modal.select(".modal-section.message-text");
69653       textSection.append("pre").attr("class", "instructions-file").call(_t.append("settings.custom_data.file.instructions"));
69654       textSection.append("input").attr("class", "field-file").attr("type", "file").attr("accept", ".gpx,.kml,.geojson,.json,application/gpx+xml,application/vnd.google-earth.kml+xml,application/geo+json,application/json").property("files", _currSettings.fileList).on("change", function(d3_event) {
69655         var files = d3_event.target.files;
69656         if (files && files.length) {
69657           _currSettings.url = "";
69658           textSection.select(".field-url").property("value", "");
69659           _currSettings.fileList = files;
69660         } else {
69661           _currSettings.fileList = null;
69662         }
69663       });
69664       textSection.append("h4").call(_t.append("settings.custom_data.or"));
69665       textSection.append("pre").attr("class", "instructions-url").call(_t.append("settings.custom_data.url.instructions"));
69666       textSection.append("textarea").attr("class", "field-url").attr("placeholder", _t("settings.custom_data.url.placeholder")).call(utilNoAuto).property("value", _currSettings.url);
69667       var buttonSection = modal.select(".modal-section.buttons");
69668       buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
69669       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
69670       buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
69671       function isSaveDisabled() {
69672         return null;
69673       }
69674       function clickCancel() {
69675         textSection.select(".field-url").property("value", _origSettings.url);
69676         corePreferences("settings-custom-data-url", _origSettings.url);
69677         this.blur();
69678         modal.close();
69679       }
69680       function clickSave() {
69681         _currSettings.url = textSection.select(".field-url").property("value").trim();
69682         if (_currSettings.url) {
69683           _currSettings.fileList = null;
69684         }
69685         if (_currSettings.fileList) {
69686           _currSettings.url = "";
69687         }
69688         corePreferences("settings-custom-data-url", _currSettings.url);
69689         this.blur();
69690         modal.close();
69691         dispatch14.call("change", this, _currSettings);
69692       }
69693     }
69694     return utilRebind(render, dispatch14, "on");
69695   }
69696
69697   // modules/ui/sections/data_layers.js
69698   function uiSectionDataLayers(context) {
69699     var settingsCustomData = uiSettingsCustomData(context).on("change", customChanged);
69700     var layers = context.layers();
69701     var section = uiSection("data-layers", context).label(() => _t.append("map_data.data_layers")).disclosureContent(renderDisclosureContent);
69702     function renderDisclosureContent(selection2) {
69703       var container = selection2.selectAll(".data-layer-container").data([0]);
69704       container.enter().append("div").attr("class", "data-layer-container").merge(container).call(drawOsmItems).call(drawQAItems).call(drawCustomDataItems).call(drawVectorItems).call(drawPanelItems);
69705     }
69706     function showsLayer(which) {
69707       var layer = layers.layer(which);
69708       if (layer) {
69709         return layer.enabled();
69710       }
69711       return false;
69712     }
69713     function setLayer(which, enabled) {
69714       var mode = context.mode();
69715       if (mode && /^draw/.test(mode.id)) return;
69716       var layer = layers.layer(which);
69717       if (layer) {
69718         layer.enabled(enabled);
69719         if (!enabled && (which === "osm" || which === "notes")) {
69720           context.enter(modeBrowse(context));
69721         }
69722       }
69723     }
69724     function toggleLayer(which) {
69725       setLayer(which, !showsLayer(which));
69726     }
69727     function drawOsmItems(selection2) {
69728       var osmKeys = ["osm", "notes"];
69729       var osmLayers = layers.all().filter(function(obj) {
69730         return osmKeys.indexOf(obj.id) !== -1;
69731       });
69732       var ul = selection2.selectAll(".layer-list-osm").data([0]);
69733       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-osm").merge(ul);
69734       var li = ul.selectAll(".list-item").data(osmLayers);
69735       li.exit().remove();
69736       var liEnter = li.enter().append("li").attr("class", function(d2) {
69737         return "list-item list-item-" + d2.id;
69738       });
69739       var labelEnter = liEnter.append("label").each(function(d2) {
69740         if (d2.id === "osm") {
69741           select_default2(this).call(
69742             uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).keys([uiCmd("\u2325" + _t("area_fill.wireframe.key"))]).placement("bottom")
69743           );
69744         } else {
69745           select_default2(this).call(
69746             uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).placement("bottom")
69747           );
69748         }
69749       });
69750       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
69751         toggleLayer(d2.id);
69752       });
69753       labelEnter.append("span").html(function(d2) {
69754         return _t.html("map_data.layers." + d2.id + ".title");
69755       });
69756       li.merge(liEnter).classed("active", function(d2) {
69757         return d2.layer.enabled();
69758       }).selectAll("input").property("checked", function(d2) {
69759         return d2.layer.enabled();
69760       });
69761     }
69762     function drawQAItems(selection2) {
69763       var qaKeys = ["keepRight", "osmose"];
69764       var qaLayers = layers.all().filter(function(obj) {
69765         return qaKeys.indexOf(obj.id) !== -1;
69766       });
69767       var ul = selection2.selectAll(".layer-list-qa").data([0]);
69768       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-qa").merge(ul);
69769       var li = ul.selectAll(".list-item").data(qaLayers);
69770       li.exit().remove();
69771       var liEnter = li.enter().append("li").attr("class", function(d2) {
69772         return "list-item list-item-" + d2.id;
69773       });
69774       var labelEnter = liEnter.append("label").each(function(d2) {
69775         select_default2(this).call(
69776           uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).placement("bottom")
69777         );
69778       });
69779       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
69780         toggleLayer(d2.id);
69781       });
69782       labelEnter.append("span").each(function(d2) {
69783         _t.append("map_data.layers." + d2.id + ".title")(select_default2(this));
69784       });
69785       li.merge(liEnter).classed("active", function(d2) {
69786         return d2.layer.enabled();
69787       }).selectAll("input").property("checked", function(d2) {
69788         return d2.layer.enabled();
69789       });
69790     }
69791     function drawVectorItems(selection2) {
69792       var dataLayer = layers.layer("data");
69793       var vtData = [
69794         {
69795           name: "Detroit Neighborhoods/Parks",
69796           src: "neighborhoods-parks",
69797           tooltip: "Neighborhood boundaries and parks as compiled by City of Detroit in concert with community groups.",
69798           template: "https://{switch:a,b,c,d}.tiles.mapbox.com/v4/jonahadkins.cjksmur6x34562qp9iv1u3ksf-54hev,jonahadkins.cjksmqxdx33jj2wp90xd9x2md-4e5y2/{z}/{x}/{y}.vector.pbf?access_token=pk.eyJ1Ijoiam9uYWhhZGtpbnMiLCJhIjoiRlVVVkx3VSJ9.9sdVEK_B_VkEXPjssU5MqA"
69799         },
69800         {
69801           name: "Detroit Composite POIs",
69802           src: "composite-poi",
69803           tooltip: "Fire Inspections, Business Licenses, and other public location data collated from the City of Detroit.",
69804           template: "https://{switch:a,b,c,d}.tiles.mapbox.com/v4/jonahadkins.cjksmm6a02sli31myxhsr7zf3-2sw8h/{z}/{x}/{y}.vector.pbf?access_token=pk.eyJ1Ijoiam9uYWhhZGtpbnMiLCJhIjoiRlVVVkx3VSJ9.9sdVEK_B_VkEXPjssU5MqA"
69805         },
69806         {
69807           name: "Detroit All-The-Places POIs",
69808           src: "alltheplaces-poi",
69809           tooltip: "Public domain business location data created by web scrapers.",
69810           template: "https://{switch:a,b,c,d}.tiles.mapbox.com/v4/jonahadkins.cjksmswgk340g2vo06p1w9w0j-8fjjc/{z}/{x}/{y}.vector.pbf?access_token=pk.eyJ1Ijoiam9uYWhhZGtpbnMiLCJhIjoiRlVVVkx3VSJ9.9sdVEK_B_VkEXPjssU5MqA"
69811         }
69812       ];
69813       var detroit = geoExtent([-83.5, 42.1], [-82.8, 42.5]);
69814       var showVectorItems = context.map().zoom() > 9 && detroit.contains(context.map().center());
69815       var container = selection2.selectAll(".vectortile-container").data(showVectorItems ? [0] : []);
69816       container.exit().remove();
69817       var containerEnter = container.enter().append("div").attr("class", "vectortile-container");
69818       containerEnter.append("h4").attr("class", "vectortile-header").text("Detroit Vector Tiles (Beta)");
69819       containerEnter.append("ul").attr("class", "layer-list layer-list-vectortile");
69820       containerEnter.append("div").attr("class", "vectortile-footer").append("a").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).attr("href", "https://github.com/osmus/detroit-mapping-challenge").append("span").text("About these layers");
69821       container = container.merge(containerEnter);
69822       var ul = container.selectAll(".layer-list-vectortile");
69823       var li = ul.selectAll(".list-item").data(vtData);
69824       li.exit().remove();
69825       var liEnter = li.enter().append("li").attr("class", function(d2) {
69826         return "list-item list-item-" + d2.src;
69827       });
69828       var labelEnter = liEnter.append("label").each(function(d2) {
69829         select_default2(this).call(
69830           uiTooltip().title(d2.tooltip).placement("top")
69831         );
69832       });
69833       labelEnter.append("input").attr("type", "radio").attr("name", "vectortile").on("change", selectVTLayer);
69834       labelEnter.append("span").text(function(d2) {
69835         return d2.name;
69836       });
69837       li.merge(liEnter).classed("active", isVTLayerSelected).selectAll("input").property("checked", isVTLayerSelected);
69838       function isVTLayerSelected(d2) {
69839         return dataLayer && dataLayer.template() === d2.template;
69840       }
69841       function selectVTLayer(d3_event, d2) {
69842         corePreferences("settings-custom-data-url", d2.template);
69843         if (dataLayer) {
69844           dataLayer.template(d2.template, d2.src);
69845           dataLayer.enabled(true);
69846         }
69847       }
69848     }
69849     function drawCustomDataItems(selection2) {
69850       var dataLayer = layers.layer("data");
69851       var hasData = dataLayer && dataLayer.hasData();
69852       var showsData = hasData && dataLayer.enabled();
69853       var ul = selection2.selectAll(".layer-list-data").data(dataLayer ? [0] : []);
69854       ul.exit().remove();
69855       var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-data");
69856       var liEnter = ulEnter.append("li").attr("class", "list-item-data");
69857       var labelEnter = liEnter.append("label").call(
69858         uiTooltip().title(() => _t.append("map_data.layers.custom.tooltip")).placement("top")
69859       );
69860       labelEnter.append("input").attr("type", "checkbox").on("change", function() {
69861         toggleLayer("data");
69862       });
69863       labelEnter.append("span").call(_t.append("map_data.layers.custom.title"));
69864       liEnter.append("button").attr("class", "open-data-options").call(
69865         uiTooltip().title(() => _t.append("settings.custom_data.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
69866       ).on("click", function(d3_event) {
69867         d3_event.preventDefault();
69868         editCustom();
69869       }).call(svgIcon("#iD-icon-more"));
69870       liEnter.append("button").attr("class", "zoom-to-data").call(
69871         uiTooltip().title(() => _t.append("map_data.layers.custom.zoom")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
69872       ).on("click", function(d3_event) {
69873         if (select_default2(this).classed("disabled")) return;
69874         d3_event.preventDefault();
69875         d3_event.stopPropagation();
69876         dataLayer.fitZoom();
69877       }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
69878       ul = ul.merge(ulEnter);
69879       ul.selectAll(".list-item-data").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
69880       ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
69881     }
69882     function editCustom() {
69883       context.container().call(settingsCustomData);
69884     }
69885     function customChanged(d2) {
69886       var dataLayer = layers.layer("data");
69887       if (d2 && d2.url) {
69888         dataLayer.url(d2.url);
69889       } else if (d2 && d2.fileList) {
69890         dataLayer.fileList(d2.fileList);
69891       }
69892     }
69893     function drawPanelItems(selection2) {
69894       var panelsListEnter = selection2.selectAll(".md-extras-list").data([0]).enter().append("ul").attr("class", "layer-list md-extras-list");
69895       var historyPanelLabelEnter = panelsListEnter.append("li").attr("class", "history-panel-toggle-item").append("label").call(
69896         uiTooltip().title(() => _t.append("map_data.history_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.history.key"))]).placement("top")
69897       );
69898       historyPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
69899         d3_event.preventDefault();
69900         context.ui().info.toggle("history");
69901       });
69902       historyPanelLabelEnter.append("span").call(_t.append("map_data.history_panel.title"));
69903       var measurementPanelLabelEnter = panelsListEnter.append("li").attr("class", "measurement-panel-toggle-item").append("label").call(
69904         uiTooltip().title(() => _t.append("map_data.measurement_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.measurement.key"))]).placement("top")
69905       );
69906       measurementPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
69907         d3_event.preventDefault();
69908         context.ui().info.toggle("measurement");
69909       });
69910       measurementPanelLabelEnter.append("span").call(_t.append("map_data.measurement_panel.title"));
69911     }
69912     context.layers().on("change.uiSectionDataLayers", section.reRender);
69913     context.map().on(
69914       "move.uiSectionDataLayers",
69915       debounce_default(function() {
69916         window.requestIdleCallback(section.reRender);
69917       }, 1e3)
69918     );
69919     return section;
69920   }
69921
69922   // modules/ui/sections/map_features.js
69923   function uiSectionMapFeatures(context) {
69924     var _features = context.features().keys();
69925     var section = uiSection("map-features", context).label(() => _t.append("map_data.map_features")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
69926     function renderDisclosureContent(selection2) {
69927       var container = selection2.selectAll(".layer-feature-list-container").data([0]);
69928       var containerEnter = container.enter().append("div").attr("class", "layer-feature-list-container");
69929       containerEnter.append("ul").attr("class", "layer-list layer-feature-list");
69930       var footer = containerEnter.append("div").attr("class", "feature-list-links section-footer");
69931       footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
69932         d3_event.preventDefault();
69933         context.features().disableAll();
69934       });
69935       footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
69936         d3_event.preventDefault();
69937         context.features().enableAll();
69938       });
69939       container = container.merge(containerEnter);
69940       container.selectAll(".layer-feature-list").call(drawListItems, _features, "checkbox", "feature", clickFeature, showsFeature);
69941     }
69942     function drawListItems(selection2, data, type2, name, change, active) {
69943       var items = selection2.selectAll("li").data(data);
69944       items.exit().remove();
69945       var enter = items.enter().append("li").call(
69946         uiTooltip().title(function(d2) {
69947           var tip = _t.append(name + "." + d2 + ".tooltip");
69948           if (autoHiddenFeature(d2)) {
69949             var msg = showsLayer("osm") ? _t.append("map_data.autohidden") : _t.append("map_data.osmhidden");
69950             return (selection3) => {
69951               selection3.call(tip);
69952               selection3.append("div").call(msg);
69953             };
69954           }
69955           return tip;
69956         }).placement("top")
69957       );
69958       var label = enter.append("label");
69959       label.append("input").attr("type", type2).attr("name", name).on("change", change);
69960       label.append("span").html(function(d2) {
69961         return _t.html(name + "." + d2 + ".description");
69962       });
69963       items = items.merge(enter);
69964       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", autoHiddenFeature);
69965     }
69966     function autoHiddenFeature(d2) {
69967       return context.features().autoHidden(d2);
69968     }
69969     function showsFeature(d2) {
69970       return context.features().enabled(d2);
69971     }
69972     function clickFeature(d3_event, d2) {
69973       context.features().toggle(d2);
69974     }
69975     function showsLayer(id2) {
69976       var layer = context.layers().layer(id2);
69977       return layer && layer.enabled();
69978     }
69979     context.features().on("change.map_features", section.reRender);
69980     return section;
69981   }
69982
69983   // modules/ui/sections/map_style_options.js
69984   function uiSectionMapStyleOptions(context) {
69985     var section = uiSection("fill-area", context).label(() => _t.append("map_data.style_options")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
69986     function renderDisclosureContent(selection2) {
69987       var container = selection2.selectAll(".layer-fill-list").data([0]);
69988       container.enter().append("ul").attr("class", "layer-list layer-fill-list").merge(container).call(drawListItems, context.map().areaFillOptions, "radio", "area_fill", setFill, isActiveFill);
69989       var container2 = selection2.selectAll(".layer-visual-diff-list").data([0]);
69990       container2.enter().append("ul").attr("class", "layer-list layer-visual-diff-list").merge(container2).call(drawListItems, ["highlight_edits"], "checkbox", "visual_diff", toggleHighlightEdited, function() {
69991         return context.surface().classed("highlight-edited");
69992       });
69993     }
69994     function drawListItems(selection2, data, type2, name, change, active) {
69995       var items = selection2.selectAll("li").data(data);
69996       items.exit().remove();
69997       var enter = items.enter().append("li").call(
69998         uiTooltip().title(function(d2) {
69999           return _t.append(name + "." + d2 + ".tooltip");
70000         }).keys(function(d2) {
70001           var key = d2 === "wireframe" ? _t("area_fill.wireframe.key") : null;
70002           if (d2 === "highlight_edits") key = _t("map_data.highlight_edits.key");
70003           return key ? [key] : null;
70004         }).placement("top")
70005       );
70006       var label = enter.append("label");
70007       label.append("input").attr("type", type2).attr("name", name).on("change", change);
70008       label.append("span").html(function(d2) {
70009         return _t.html(name + "." + d2 + ".description");
70010       });
70011       items = items.merge(enter);
70012       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
70013     }
70014     function isActiveFill(d2) {
70015       return context.map().activeAreaFill() === d2;
70016     }
70017     function toggleHighlightEdited(d3_event) {
70018       d3_event.preventDefault();
70019       context.map().toggleHighlightEdited();
70020     }
70021     function setFill(d3_event, d2) {
70022       context.map().activeAreaFill(d2);
70023     }
70024     context.map().on("changeHighlighting.ui_style, changeAreaFill.ui_style", section.reRender);
70025     return section;
70026   }
70027
70028   // modules/ui/settings/local_photos.js
70029   function uiSettingsLocalPhotos(context) {
70030     var dispatch14 = dispatch_default("change");
70031     var photoLayer = context.layers().layer("local-photos");
70032     var modal;
70033     function render(selection2) {
70034       modal = uiConfirm(selection2).okButton();
70035       modal.classed("settings-modal settings-local-photos", true);
70036       modal.select(".modal-section.header").append("h3").call(_t.append("local_photos.header"));
70037       modal.select(".modal-section.message-text").append("div").classed("local-photos", true);
70038       var instructionsSection = modal.select(".modal-section.message-text .local-photos").append("div").classed("instructions", true);
70039       instructionsSection.append("p").classed("instructions-local-photos", true).call(_t.append("local_photos.file.instructions"));
70040       instructionsSection.append("input").classed("field-file", true).attr("type", "file").attr("multiple", "multiple").attr("accept", ".jpg,.jpeg,.png,image/png,image/jpeg").style("visibility", "hidden").attr("id", "local-photo-files").on("change", function(d3_event) {
70041         var files = d3_event.target.files;
70042         if (files && files.length) {
70043           photoList.select("ul").append("li").classed("placeholder", true).append("div");
70044           dispatch14.call("change", this, files);
70045         }
70046         d3_event.target.value = null;
70047       });
70048       instructionsSection.append("label").attr("for", "local-photo-files").classed("button", true).call(_t.append("local_photos.file.label"));
70049       const photoList = modal.select(".modal-section.message-text .local-photos").append("div").append("div").classed("list-local-photos", true);
70050       photoList.append("ul");
70051       updatePhotoList(photoList.select("ul"));
70052       context.layers().on("change", () => updatePhotoList(photoList.select("ul")));
70053     }
70054     function updatePhotoList(container) {
70055       var _a3;
70056       function locationUnavailable(d2) {
70057         return !(isArray_default(d2.loc) && isNumber_default(d2.loc[0]) && isNumber_default(d2.loc[1]));
70058       }
70059       container.selectAll("li.placeholder").remove();
70060       let selection2 = container.selectAll("li").data((_a3 = photoLayer.getPhotos()) != null ? _a3 : [], (d2) => d2.id);
70061       selection2.exit().remove();
70062       const selectionEnter = selection2.enter().append("li");
70063       selectionEnter.append("span").classed("filename", true);
70064       selectionEnter.append("button").classed("form-field-button zoom-to-data", true).attr("title", _t("local_photos.zoom_single")).call(svgIcon("#iD-icon-framed-dot"));
70065       selectionEnter.append("button").classed("form-field-button no-geolocation", true).call(svgIcon("#iD-icon-alert")).call(
70066         uiTooltip().title(() => _t.append("local_photos.no_geolocation.tooltip")).placement("left")
70067       );
70068       selectionEnter.append("button").classed("form-field-button remove", true).attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
70069       selection2 = selection2.merge(selectionEnter);
70070       selection2.classed("invalid", locationUnavailable);
70071       selection2.select("span.filename").text((d2) => d2.name).attr("title", (d2) => d2.name);
70072       selection2.select("span.filename").on("click", (d3_event, d2) => {
70073         photoLayer.openPhoto(d3_event, d2, false);
70074       });
70075       selection2.select("button.zoom-to-data").on("click", (d3_event, d2) => {
70076         photoLayer.openPhoto(d3_event, d2, true);
70077       });
70078       selection2.select("button.remove").on("click", (d3_event, d2) => {
70079         photoLayer.removePhoto(d2.id);
70080         updatePhotoList(container);
70081       });
70082     }
70083     return utilRebind(render, dispatch14, "on");
70084   }
70085
70086   // modules/ui/sections/photo_overlays.js
70087   function uiSectionPhotoOverlays(context) {
70088     var settingsLocalPhotos = uiSettingsLocalPhotos(context).on("change", localPhotosChanged);
70089     var layers = context.layers();
70090     var section = uiSection("photo-overlays", context).label(() => _t.append("photo_overlays.title")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
70091     function renderDisclosureContent(selection2) {
70092       var container = selection2.selectAll(".photo-overlay-container").data([0]);
70093       container.enter().append("div").attr("class", "photo-overlay-container").merge(container).call(drawPhotoItems).call(drawPhotoTypeItems).call(drawDateFilter).call(drawUsernameFilter).call(drawLocalPhotos);
70094     }
70095     function drawPhotoItems(selection2) {
70096       var photoKeys = context.photos().overlayLayerIDs();
70097       var photoLayers = layers.all().filter(function(obj) {
70098         return photoKeys.indexOf(obj.id) !== -1;
70099       });
70100       var data = photoLayers.filter(function(obj) {
70101         if (!obj.layer.supported()) return false;
70102         if (layerEnabled(obj)) return true;
70103         if (typeof obj.layer.validHere === "function") {
70104           return obj.layer.validHere(context.map().extent(), context.map().zoom());
70105         }
70106         return true;
70107       });
70108       function layerSupported(d2) {
70109         return d2.layer && d2.layer.supported();
70110       }
70111       function layerEnabled(d2) {
70112         return layerSupported(d2) && d2.layer.enabled();
70113       }
70114       function layerRendered(d2) {
70115         var _a3, _b3, _c;
70116         return (_c = (_b3 = (_a3 = d2.layer).rendered) == null ? void 0 : _b3.call(_a3, context.map().zoom())) != null ? _c : true;
70117       }
70118       var ul = selection2.selectAll(".layer-list-photos").data([0]);
70119       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photos").merge(ul);
70120       var li = ul.selectAll(".list-item-photos").data(data, (d2) => d2.id);
70121       li.exit().remove();
70122       var liEnter = li.enter().append("li").attr("class", function(d2) {
70123         var classes = "list-item-photos list-item-" + d2.id;
70124         if (d2.id === "mapillary-signs" || d2.id === "mapillary-map-features") {
70125           classes += " indented";
70126         }
70127         return classes;
70128       });
70129       var labelEnter = liEnter.append("label").each(function(d2) {
70130         var titleID;
70131         if (d2.id === "mapillary-signs") titleID = "mapillary.signs.tooltip";
70132         else if (d2.id === "mapillary") titleID = "mapillary_images.tooltip";
70133         else if (d2.id === "kartaview") titleID = "kartaview_images.tooltip";
70134         else titleID = d2.id.replace(/-/g, "_") + ".tooltip";
70135         select_default2(this).call(
70136           uiTooltip().title(() => {
70137             if (!layerRendered(d2)) {
70138               return _t.append("street_side.minzoom_tooltip");
70139             } else {
70140               return _t.append(titleID);
70141             }
70142           }).placement("top")
70143         );
70144       });
70145       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
70146         toggleLayer(d2.id);
70147       });
70148       labelEnter.append("span").html(function(d2) {
70149         var id2 = d2.id;
70150         if (id2 === "mapillary-signs") id2 = "photo_overlays.traffic_signs";
70151         return _t.html(id2.replace(/-/g, "_") + ".title");
70152       });
70153       li.merge(liEnter).classed("active", layerEnabled).selectAll("input").property("disabled", (d2) => !layerRendered(d2)).property("checked", layerEnabled);
70154     }
70155     function drawPhotoTypeItems(selection2) {
70156       var data = context.photos().allPhotoTypes();
70157       function typeEnabled(d2) {
70158         return context.photos().showsPhotoType(d2);
70159       }
70160       var ul = selection2.selectAll(".layer-list-photo-types").data([0]);
70161       ul.exit().remove();
70162       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photo-types").merge(ul);
70163       var li = ul.selectAll(".list-item-photo-types").data(context.photos().shouldFilterByPhotoType() ? data : []);
70164       li.exit().remove();
70165       var liEnter = li.enter().append("li").attr("class", function(d2) {
70166         return "list-item-photo-types list-item-" + d2;
70167       });
70168       var labelEnter = liEnter.append("label").each(function(d2) {
70169         select_default2(this).call(
70170           uiTooltip().title(() => _t.append("photo_overlays.photo_type." + d2 + ".tooltip")).placement("top")
70171         );
70172       });
70173       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
70174         context.photos().togglePhotoType(d2);
70175       });
70176       labelEnter.append("span").html(function(d2) {
70177         return _t.html("photo_overlays.photo_type." + d2 + ".title");
70178       });
70179       li.merge(liEnter).classed("active", typeEnabled).selectAll("input").property("checked", typeEnabled);
70180     }
70181     function drawDateFilter(selection2) {
70182       var data = context.photos().dateFilters();
70183       function filterEnabled(d2) {
70184         return context.photos().dateFilterValue(d2);
70185       }
70186       var ul = selection2.selectAll(".layer-list-date-filter").data([0]);
70187       ul.exit().remove();
70188       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-date-filter").merge(ul);
70189       var li = ul.selectAll(".list-item-date-filter").data(context.photos().shouldFilterByDate() ? data : []);
70190       li.exit().remove();
70191       var liEnter = li.enter().append("li").attr("class", "list-item-date-filter");
70192       var labelEnter = liEnter.append("label").each(function(d2) {
70193         select_default2(this).call(
70194           uiTooltip().title(() => _t.append("photo_overlays.date_filter." + d2 + ".tooltip")).placement("top")
70195         );
70196       });
70197       labelEnter.append("span").each(function(d2) {
70198         _t.append("photo_overlays.date_filter." + d2 + ".title")(select_default2(this));
70199       });
70200       labelEnter.append("input").attr("type", "date").attr("class", "list-item-input").attr("placeholder", _t("units.year_month_day")).call(utilNoAuto).each(function(d2) {
70201         utilGetSetValue(select_default2(this), context.photos().dateFilterValue(d2) || "");
70202       }).on("change", function(d3_event, d2) {
70203         var value = utilGetSetValue(select_default2(this)).trim();
70204         context.photos().setDateFilter(d2, value, true);
70205         li.selectAll("input").each(function(d4) {
70206           utilGetSetValue(select_default2(this), context.photos().dateFilterValue(d4) || "");
70207         });
70208       });
70209       li = li.merge(liEnter).classed("active", filterEnabled);
70210     }
70211     function drawUsernameFilter(selection2) {
70212       function filterEnabled() {
70213         return context.photos().usernames();
70214       }
70215       var ul = selection2.selectAll(".layer-list-username-filter").data([0]);
70216       ul.exit().remove();
70217       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-username-filter").merge(ul);
70218       var li = ul.selectAll(".list-item-username-filter").data(context.photos().shouldFilterByUsername() ? ["username-filter"] : []);
70219       li.exit().remove();
70220       var liEnter = li.enter().append("li").attr("class", "list-item-username-filter");
70221       var labelEnter = liEnter.append("label").each(function() {
70222         select_default2(this).call(
70223           uiTooltip().title(() => _t.append("photo_overlays.username_filter.tooltip")).placement("top")
70224         );
70225       });
70226       labelEnter.append("span").call(_t.append("photo_overlays.username_filter.title"));
70227       labelEnter.append("input").attr("type", "text").attr("class", "list-item-input").call(utilNoAuto).property("value", usernameValue).on("change", function() {
70228         var value = select_default2(this).property("value");
70229         context.photos().setUsernameFilter(value, true);
70230         select_default2(this).property("value", usernameValue);
70231       });
70232       li.merge(liEnter).classed("active", filterEnabled);
70233       function usernameValue() {
70234         var usernames = context.photos().usernames();
70235         if (usernames) return usernames.join("; ");
70236         return usernames;
70237       }
70238     }
70239     function toggleLayer(which) {
70240       setLayer(which, !showsLayer(which));
70241     }
70242     function showsLayer(which) {
70243       var layer = layers.layer(which);
70244       if (layer) {
70245         return layer.enabled();
70246       }
70247       return false;
70248     }
70249     function setLayer(which, enabled) {
70250       var layer = layers.layer(which);
70251       if (layer) {
70252         layer.enabled(enabled);
70253       }
70254     }
70255     function drawLocalPhotos(selection2) {
70256       var photoLayer = layers.layer("local-photos");
70257       var hasData = photoLayer && photoLayer.hasData();
70258       var showsData = hasData && photoLayer.enabled();
70259       var ul = selection2.selectAll(".layer-list-local-photos").data(photoLayer ? [0] : []);
70260       ul.exit().remove();
70261       var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-local-photos");
70262       var localPhotosEnter = ulEnter.append("li").attr("class", "list-item-local-photos");
70263       var localPhotosLabelEnter = localPhotosEnter.append("label").call(uiTooltip().title(() => _t.append("local_photos.tooltip")));
70264       localPhotosLabelEnter.append("input").attr("type", "checkbox").on("change", function() {
70265         toggleLayer("local-photos");
70266       });
70267       localPhotosLabelEnter.call(_t.append("local_photos.header"));
70268       localPhotosEnter.append("button").attr("class", "open-data-options").call(
70269         uiTooltip().title(() => _t.append("local_photos.tooltip_edit")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
70270       ).on("click", function(d3_event) {
70271         d3_event.preventDefault();
70272         editLocalPhotos();
70273       }).call(svgIcon("#iD-icon-more"));
70274       localPhotosEnter.append("button").attr("class", "zoom-to-data").call(
70275         uiTooltip().title(() => _t.append("local_photos.zoom")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
70276       ).on("click", function(d3_event) {
70277         if (select_default2(this).classed("disabled")) return;
70278         d3_event.preventDefault();
70279         d3_event.stopPropagation();
70280         photoLayer.fitZoom();
70281       }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
70282       ul = ul.merge(ulEnter);
70283       ul.selectAll(".list-item-local-photos").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
70284       ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
70285     }
70286     function editLocalPhotos() {
70287       context.container().call(settingsLocalPhotos);
70288     }
70289     function localPhotosChanged(d2) {
70290       var localPhotosLayer = layers.layer("local-photos");
70291       localPhotosLayer.fileList(d2);
70292     }
70293     context.layers().on("change.uiSectionPhotoOverlays", section.reRender);
70294     context.photos().on("change.uiSectionPhotoOverlays", section.reRender);
70295     context.map().on(
70296       "move.photo_overlays",
70297       debounce_default(function() {
70298         window.requestIdleCallback(section.reRender);
70299       }, 1e3)
70300     );
70301     return section;
70302   }
70303
70304   // modules/ui/panes/map_data.js
70305   function uiPaneMapData(context) {
70306     var mapDataPane = uiPane("map-data", context).key(_t("map_data.key")).label(_t.append("map_data.title")).description(_t.append("map_data.description")).iconName("iD-icon-data").sections([
70307       uiSectionDataLayers(context),
70308       uiSectionPhotoOverlays(context),
70309       uiSectionMapStyleOptions(context),
70310       uiSectionMapFeatures(context)
70311     ]);
70312     return mapDataPane;
70313   }
70314
70315   // modules/ui/panes/preferences.js
70316   function uiPanePreferences(context) {
70317     let preferencesPane = uiPane("preferences", context).key(_t("preferences.key")).label(_t.append("preferences.title")).description(_t.append("preferences.description")).iconName("fas-user-cog").sections([
70318       uiSectionPrivacy(context)
70319     ]);
70320     return preferencesPane;
70321   }
70322
70323   // modules/ui/init.js
70324   function uiInit(context) {
70325     var _initCounter = 0;
70326     var _needWidth = {};
70327     var _lastPointerType;
70328     function render(container) {
70329       container.on("click.ui", function(d3_event) {
70330         if (d3_event.button !== 0) return;
70331         if (!d3_event.composedPath) return;
70332         var isOkayTarget = d3_event.composedPath().some(function(node) {
70333           return node.nodeType === 1 && // clicking <input> focuses it and/or changes a value
70334           (node.nodeName === "INPUT" || // clicking <label> affects its <input> by default
70335           node.nodeName === "LABEL" || // clicking <a> opens a hyperlink by default
70336           node.nodeName === "A");
70337         });
70338         if (isOkayTarget) return;
70339         d3_event.preventDefault();
70340       });
70341       var detected = utilDetect();
70342       if ("GestureEvent" in window && // Listening for gesture events on iOS 13.4+ breaks double-tapping,
70343       // but we only need to do this on desktop Safari anyway. – #7694
70344       !detected.isMobileWebKit) {
70345         container.on("gesturestart.ui gesturechange.ui gestureend.ui", function(d3_event) {
70346           d3_event.preventDefault();
70347         });
70348       }
70349       if ("PointerEvent" in window) {
70350         select_default2(window).on("pointerdown.ui pointerup.ui", function(d3_event) {
70351           var pointerType = d3_event.pointerType || "mouse";
70352           if (_lastPointerType !== pointerType) {
70353             _lastPointerType = pointerType;
70354             container.attr("pointer", pointerType);
70355           }
70356         }, true);
70357       } else {
70358         _lastPointerType = "mouse";
70359         container.attr("pointer", "mouse");
70360       }
70361       container.attr("lang", _mainLocalizer.localeCode()).attr("dir", _mainLocalizer.textDirection());
70362       container.call(uiFullScreen(context));
70363       var map2 = context.map();
70364       map2.redrawEnable(false);
70365       map2.on("hitMinZoom.ui", function() {
70366         ui.flash.iconName("#iD-icon-no").label(_t.append("cannot_zoom"))();
70367       });
70368       container.append("svg").attr("id", "ideditor-defs").call(ui.svgDefs);
70369       container.append("div").attr("class", "sidebar").call(ui.sidebar);
70370       var content = container.append("div").attr("class", "main-content active");
70371       content.append("div").attr("class", "top-toolbar-wrap").append("div").attr("class", "top-toolbar fillD").call(uiTopToolbar(context));
70372       content.append("div").attr("class", "main-map").attr("dir", "ltr").call(map2);
70373       var overMap = content.append("div").attr("class", "over-map");
70374       overMap.append("div").attr("class", "select-trap").text("t");
70375       overMap.call(uiMapInMap(context)).call(uiNotice(context));
70376       overMap.append("div").attr("class", "spinner").call(uiSpinner(context));
70377       var controlsWrap = overMap.append("div").attr("class", "map-controls-wrap");
70378       var controls = controlsWrap.append("div").attr("class", "map-controls");
70379       controls.append("div").attr("class", "map-control zoombuttons").call(uiZoom(context));
70380       controls.append("div").attr("class", "map-control zoom-to-selection-control").call(uiZoomToSelection(context));
70381       controls.append("div").attr("class", "map-control geolocate-control").call(uiGeolocate(context));
70382       controlsWrap.on("wheel.mapControls", function(d3_event) {
70383         if (!d3_event.deltaX) {
70384           controlsWrap.node().scrollTop += d3_event.deltaY;
70385         }
70386       });
70387       var panes = overMap.append("div").attr("class", "map-panes");
70388       var uiPanes = [
70389         uiPaneBackground(context),
70390         uiPaneMapData(context),
70391         uiPaneIssues(context),
70392         uiPanePreferences(context),
70393         uiPaneHelp(context)
70394       ];
70395       uiPanes.forEach(function(pane) {
70396         controls.append("div").attr("class", "map-control map-pane-control " + pane.id + "-control").call(pane.renderToggleButton);
70397         panes.call(pane.renderPane);
70398       });
70399       ui.info = uiInfo(context);
70400       overMap.call(ui.info);
70401       overMap.append("div").attr("class", "photoviewer").classed("al", true).classed("hide", true).call(ui.photoviewer);
70402       overMap.append("div").attr("class", "attribution-wrap").attr("dir", "ltr").call(uiAttribution(context));
70403       var about = content.append("div").attr("class", "map-footer");
70404       about.append("div").attr("class", "api-status").call(uiStatus(context));
70405       var footer = about.append("div").attr("class", "map-footer-bar fillD");
70406       footer.append("div").attr("class", "flash-wrap footer-hide");
70407       var footerWrap = footer.append("div").attr("class", "main-footer-wrap footer-show");
70408       footerWrap.append("div").attr("class", "scale-block").call(uiScale(context));
70409       var aboutList = footerWrap.append("div").attr("class", "info-block").append("ul").attr("class", "map-footer-list");
70410       aboutList.append("li").attr("class", "user-list").call(uiContributors(context));
70411       var apiConnections = context.connection().apiConnections();
70412       if (apiConnections && apiConnections.length > 1) {
70413         aboutList.append("li").attr("class", "source-switch").call(
70414           uiSourceSwitch(context).keys(apiConnections)
70415         );
70416       }
70417       aboutList.append("li").attr("class", "issues-info").call(uiIssuesInfo(context));
70418       aboutList.append("li").attr("class", "feature-warning").call(uiFeatureInfo(context));
70419       var issueLinks = aboutList.append("li");
70420       issueLinks.append("a").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD/issues").attr("aria-label", _t("report_a_bug")).call(svgIcon("#iD-icon-bug", "light")).call(uiTooltip().title(() => _t.append("report_a_bug")).placement("top"));
70421       issueLinks.append("a").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD/blob/develop/CONTRIBUTING.md#translating").attr("aria-label", _t("help_translate")).call(svgIcon("#iD-icon-translate", "light")).call(uiTooltip().title(() => _t.append("help_translate")).placement("top"));
70422       aboutList.append("li").attr("class", "version").call(uiVersion(context));
70423       if (!context.embed()) {
70424         aboutList.call(uiAccount(context));
70425       }
70426       ui.onResize();
70427       map2.redrawEnable(true);
70428       ui.hash = behaviorHash(context);
70429       ui.hash();
70430       if (!ui.hash.hadLocation) {
70431         map2.centerZoom([0, 0], 2);
70432       }
70433       window.onbeforeunload = function() {
70434         return context.save();
70435       };
70436       window.onunload = function() {
70437         context.history().unlock();
70438       };
70439       select_default2(window).on("resize.editor", function() {
70440         ui.onResize();
70441       });
70442       var panPixels = 80;
70443       context.keybinding().on("\u232B", function(d3_event) {
70444         d3_event.preventDefault();
70445       }).on([_t("sidebar.key"), "`", "\xB2", "@"], ui.sidebar.toggle).on("\u2190", pan([panPixels, 0])).on("\u2191", pan([0, panPixels])).on("\u2192", pan([-panPixels, 0])).on("\u2193", pan([0, -panPixels])).on(uiCmd("\u2325\u2190"), pan([map2.dimensions()[0], 0])).on(uiCmd("\u2325\u2191"), pan([0, map2.dimensions()[1]])).on(uiCmd("\u2325\u2192"), pan([-map2.dimensions()[0], 0])).on(uiCmd("\u2325\u2193"), pan([0, -map2.dimensions()[1]])).on(uiCmd("\u2318" + _t("background.key")), function quickSwitch(d3_event) {
70446         if (d3_event) {
70447           d3_event.stopImmediatePropagation();
70448           d3_event.preventDefault();
70449         }
70450         var previousBackground = context.background().findSource(corePreferences("background-last-used-toggle"));
70451         if (previousBackground) {
70452           var currentBackground = context.background().baseLayerSource();
70453           corePreferences("background-last-used-toggle", currentBackground.id);
70454           corePreferences("background-last-used", previousBackground.id);
70455           context.background().baseLayerSource(previousBackground);
70456         }
70457       }).on(_t("area_fill.wireframe.key"), function toggleWireframe(d3_event) {
70458         d3_event.preventDefault();
70459         d3_event.stopPropagation();
70460         context.map().toggleWireframe();
70461       }).on(uiCmd("\u2325" + _t("area_fill.wireframe.key")), function toggleOsmData(d3_event) {
70462         d3_event.preventDefault();
70463         d3_event.stopPropagation();
70464         var mode = context.mode();
70465         if (mode && /^draw/.test(mode.id)) return;
70466         var layer = context.layers().layer("osm");
70467         if (layer) {
70468           layer.enabled(!layer.enabled());
70469           if (!layer.enabled()) {
70470             context.enter(modeBrowse(context));
70471           }
70472         }
70473       }).on(_t("map_data.highlight_edits.key"), function toggleHighlightEdited(d3_event) {
70474         d3_event.preventDefault();
70475         context.map().toggleHighlightEdited();
70476       });
70477       context.on("enter.editor", function(entered) {
70478         container.classed("mode-" + entered.id, true);
70479       }).on("exit.editor", function(exited) {
70480         container.classed("mode-" + exited.id, false);
70481       });
70482       context.enter(modeBrowse(context));
70483       if (!_initCounter++) {
70484         if (!ui.hash.startWalkthrough) {
70485           context.container().call(uiSplash(context)).call(uiRestore(context));
70486         }
70487         context.container().call(ui.shortcuts);
70488       }
70489       var osm = context.connection();
70490       var auth = uiLoading(context).message(_t.html("loading_auth")).blocking(true);
70491       if (osm && auth) {
70492         osm.on("authLoading.ui", function() {
70493           context.container().call(auth);
70494         }).on("authDone.ui", function() {
70495           auth.close();
70496         });
70497       }
70498       _initCounter++;
70499       if (ui.hash.startWalkthrough) {
70500         ui.hash.startWalkthrough = false;
70501         context.container().call(uiIntro(context));
70502       }
70503       function pan(d2) {
70504         return function(d3_event) {
70505           if (d3_event.shiftKey) return;
70506           if (context.container().select(".combobox").size()) return;
70507           d3_event.preventDefault();
70508           context.map().pan(d2, 100);
70509         };
70510       }
70511     }
70512     let ui = {};
70513     let _loadPromise;
70514     ui.ensureLoaded = () => {
70515       if (_loadPromise) return _loadPromise;
70516       return _loadPromise = Promise.all([
70517         // must have strings and presets before loading the UI
70518         _mainLocalizer.ensureLoaded(),
70519         _mainPresetIndex.ensureLoaded()
70520       ]).then(() => {
70521         if (!context.container().empty()) render(context.container());
70522       }).catch((err) => console.error(err));
70523     };
70524     ui.restart = function() {
70525       context.keybinding().clear();
70526       _loadPromise = null;
70527       context.container().selectAll("*").remove();
70528       ui.ensureLoaded();
70529     };
70530     ui.lastPointerType = function() {
70531       return _lastPointerType;
70532     };
70533     ui.svgDefs = svgDefs(context);
70534     ui.flash = uiFlash(context);
70535     ui.sidebar = uiSidebar(context);
70536     ui.photoviewer = uiPhotoviewer(context);
70537     ui.shortcuts = uiShortcuts(context);
70538     ui.onResize = function(withPan) {
70539       var map2 = context.map();
70540       var mapDimensions = utilGetDimensions(context.container().select(".main-content"), true);
70541       utilGetDimensions(context.container().select(".sidebar"), true);
70542       if (withPan !== void 0) {
70543         map2.redrawEnable(false);
70544         map2.pan(withPan);
70545         map2.redrawEnable(true);
70546       }
70547       map2.dimensions(mapDimensions);
70548       ui.photoviewer.onMapResize();
70549       ui.checkOverflow(".top-toolbar");
70550       ui.checkOverflow(".map-footer-bar");
70551       var resizeWindowEvent = document.createEvent("Event");
70552       resizeWindowEvent.initEvent("resizeWindow", true, true);
70553       document.dispatchEvent(resizeWindowEvent);
70554     };
70555     ui.checkOverflow = function(selector, reset) {
70556       if (reset) {
70557         delete _needWidth[selector];
70558       }
70559       var selection2 = context.container().select(selector);
70560       if (selection2.empty()) return;
70561       var scrollWidth = selection2.property("scrollWidth");
70562       var clientWidth = selection2.property("clientWidth");
70563       var needed = _needWidth[selector] || scrollWidth;
70564       if (scrollWidth > clientWidth) {
70565         selection2.classed("narrow", true);
70566         if (!_needWidth[selector]) {
70567           _needWidth[selector] = scrollWidth;
70568         }
70569       } else if (scrollWidth >= needed) {
70570         selection2.classed("narrow", false);
70571       }
70572     };
70573     ui.togglePanes = function(showPane) {
70574       var hidePanes = context.container().selectAll(".map-pane.shown");
70575       var side = _mainLocalizer.textDirection() === "ltr" ? "right" : "left";
70576       hidePanes.classed("shown", false).classed("hide", true);
70577       context.container().selectAll(".map-pane-control button").classed("active", false);
70578       if (showPane) {
70579         hidePanes.classed("shown", false).classed("hide", true).style(side, "-500px");
70580         context.container().selectAll("." + showPane.attr("pane") + "-control button").classed("active", true);
70581         showPane.classed("shown", true).classed("hide", false);
70582         if (hidePanes.empty()) {
70583           showPane.style(side, "-500px").transition().duration(200).style(side, "0px");
70584         } else {
70585           showPane.style(side, "0px");
70586         }
70587       } else {
70588         hidePanes.classed("shown", true).classed("hide", false).style(side, "0px").transition().duration(200).style(side, "-500px").on("end", function() {
70589           select_default2(this).classed("shown", false).classed("hide", true);
70590         });
70591       }
70592     };
70593     var _editMenu = uiEditMenu(context);
70594     ui.editMenu = function() {
70595       return _editMenu;
70596     };
70597     ui.showEditMenu = function(anchorPoint, triggerType, operations) {
70598       ui.closeEditMenu();
70599       if (!operations && context.mode().operations) operations = context.mode().operations();
70600       if (!operations || !operations.length) return;
70601       if (!context.map().editableDataEnabled()) return;
70602       var surfaceNode = context.surface().node();
70603       if (surfaceNode.focus) {
70604         surfaceNode.focus();
70605       }
70606       operations.forEach(function(operation2) {
70607         if (operation2.point) operation2.point(anchorPoint);
70608       });
70609       _editMenu.anchorLoc(anchorPoint).triggerType(triggerType).operations(operations);
70610       context.map().supersurface.call(_editMenu);
70611     };
70612     ui.closeEditMenu = function() {
70613       context.map().supersurface.select(".edit-menu").remove();
70614     };
70615     var _saveLoading = select_default2(null);
70616     context.uploader().on("saveStarted.ui", function() {
70617       _saveLoading = uiLoading(context).message(_t.html("save.uploading")).blocking(true);
70618       context.container().call(_saveLoading);
70619     }).on("saveEnded.ui", function() {
70620       _saveLoading.close();
70621       _saveLoading = select_default2(null);
70622     });
70623     marked.use({
70624       mangle: false,
70625       headerIds: false
70626     });
70627     return ui;
70628   }
70629
70630   // modules/ui/commit_warnings.js
70631   function uiCommitWarnings(context) {
70632     function commitWarnings(selection2) {
70633       var issuesBySeverity = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeDisabledRules: true });
70634       for (var severity in issuesBySeverity) {
70635         var issues = issuesBySeverity[severity];
70636         if (severity !== "error") {
70637           issues = issues.filter(function(issue) {
70638             return issue.type !== "help_request";
70639           });
70640         }
70641         var section = severity + "-section";
70642         var issueItem = severity + "-item";
70643         var container = selection2.selectAll("." + section).data(issues.length ? [0] : []);
70644         container.exit().remove();
70645         var containerEnter = container.enter().append("div").attr("class", "modal-section " + section + " fillL2");
70646         containerEnter.append("h3").call(severity === "warning" ? _t.append("commit.warnings") : _t.append("commit.errors"));
70647         containerEnter.append("ul").attr("class", "changeset-list");
70648         container = containerEnter.merge(container);
70649         var items = container.select("ul").selectAll("li").data(issues, function(d2) {
70650           return d2.key;
70651         });
70652         items.exit().remove();
70653         var itemsEnter = items.enter().append("li").attr("class", issueItem);
70654         var buttons = itemsEnter.append("button").on("mouseover", function(d3_event, d2) {
70655           if (d2.entityIds) {
70656             context.surface().selectAll(
70657               utilEntityOrMemberSelector(
70658                 d2.entityIds,
70659                 context.graph()
70660               )
70661             ).classed("hover", true);
70662           }
70663         }).on("mouseout", function() {
70664           context.surface().selectAll(".hover").classed("hover", false);
70665         }).on("click", function(d3_event, d2) {
70666           context.validator().focusIssue(d2);
70667         });
70668         buttons.call(svgIcon("#iD-icon-alert", "pre-text"));
70669         buttons.append("strong").attr("class", "issue-message");
70670         buttons.filter(function(d2) {
70671           return d2.tooltip;
70672         }).call(
70673           uiTooltip().title(function(d2) {
70674             return d2.tooltip;
70675           }).placement("top")
70676         );
70677         items = itemsEnter.merge(items);
70678         items.selectAll(".issue-message").text("").each(function(d2) {
70679           return d2.message(context)(select_default2(this));
70680         });
70681       }
70682     }
70683     return commitWarnings;
70684   }
70685
70686   // modules/ui/lasso.js
70687   function uiLasso(context) {
70688     var group, polygon2;
70689     lasso.coordinates = [];
70690     function lasso(selection2) {
70691       context.container().classed("lasso", true);
70692       group = selection2.append("g").attr("class", "lasso hide");
70693       polygon2 = group.append("path").attr("class", "lasso-path");
70694       group.call(uiToggle(true));
70695     }
70696     function draw() {
70697       if (polygon2) {
70698         polygon2.data([lasso.coordinates]).attr("d", function(d2) {
70699           return "M" + d2.join(" L") + " Z";
70700         });
70701       }
70702     }
70703     lasso.extent = function() {
70704       return lasso.coordinates.reduce(function(extent, point) {
70705         return extent.extend(geoExtent(point));
70706       }, geoExtent());
70707     };
70708     lasso.p = function(_2) {
70709       if (!arguments.length) return lasso;
70710       lasso.coordinates.push(_2);
70711       draw();
70712       return lasso;
70713     };
70714     lasso.close = function() {
70715       if (group) {
70716         group.call(uiToggle(false, function() {
70717           select_default2(this).remove();
70718         }));
70719       }
70720       context.container().classed("lasso", false);
70721     };
70722     return lasso;
70723   }
70724
70725   // node_modules/osm-community-index/lib/simplify.js
70726   var import_diacritics2 = __toESM(require_diacritics(), 1);
70727   function simplify(str) {
70728     if (typeof str !== "string") return "";
70729     return import_diacritics2.default.remove(
70730       str.replace(/&/g, "and").replace(/(İ|i̇)/ig, "i").replace(/[\s\-=_!"#%'*{},.\/:;?\(\)\[\]@\\$\^*+<>«»~`’\u00a1\u00a7\u00b6\u00b7\u00bf\u037e\u0387\u055a-\u055f\u0589\u05c0\u05c3\u05c6\u05f3\u05f4\u0609\u060a\u060c\u060d\u061b\u061e\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0830-\u083e\u085e\u0964\u0965\u0970\u0af0\u0df4\u0e4f\u0e5a\u0e5b\u0f04-\u0f12\u0f14\u0f85\u0fd0-\u0fd4\u0fd9\u0fda\u104a-\u104f\u10fb\u1360-\u1368\u166d\u166e\u16eb-\u16ed\u1735\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u1805\u1807-\u180a\u1944\u1945\u1a1e\u1a1f\u1aa0-\u1aa6\u1aa8-\u1aad\u1b5a-\u1b60\u1bfc-\u1bff\u1c3b-\u1c3f\u1c7e\u1c7f\u1cc0-\u1cc7\u1cd3\u2000-\u206f\u2cf9-\u2cfc\u2cfe\u2cff\u2d70\u2e00-\u2e7f\u3001-\u3003\u303d\u30fb\ua4fe\ua4ff\ua60d-\ua60f\ua673\ua67e\ua6f2-\ua6f7\ua874-\ua877\ua8ce\ua8cf\ua8f8-\ua8fa\ua92e\ua92f\ua95f\ua9c1-\ua9cd\ua9de\ua9df\uaa5c-\uaa5f\uaade\uaadf\uaaf0\uaaf1\uabeb\ufe10-\ufe16\ufe19\ufe30\ufe45\ufe46\ufe49-\ufe4c\ufe50-\ufe52\ufe54-\ufe57\ufe5f-\ufe61\ufe68\ufe6a\ufe6b\ufeff\uff01-\uff03\uff05-\uff07\uff0a\uff0c\uff0e\uff0f\uff1a\uff1b\uff1f\uff20\uff3c\uff61\uff64\uff65]+/g, "").toLowerCase()
70731     );
70732   }
70733
70734   // node_modules/osm-community-index/lib/resolve_strings.js
70735   function resolveStrings(item, defaults, localizerFn) {
70736     let itemStrings = Object.assign({}, item.strings);
70737     let defaultStrings = Object.assign({}, defaults[item.type]);
70738     const anyToken = new RegExp(/(\{\w+\})/, "gi");
70739     if (localizerFn) {
70740       if (itemStrings.community) {
70741         const communityID = simplify(itemStrings.community);
70742         itemStrings.community = localizerFn("_communities.".concat(communityID));
70743       }
70744       ["name", "description", "extendedDescription"].forEach((prop) => {
70745         if (defaultStrings[prop]) defaultStrings[prop] = localizerFn("_defaults.".concat(item.type, ".").concat(prop));
70746         if (itemStrings[prop]) itemStrings[prop] = localizerFn("".concat(item.id, ".").concat(prop));
70747       });
70748     }
70749     let replacements = {
70750       account: item.account,
70751       community: itemStrings.community,
70752       signupUrl: itemStrings.signupUrl,
70753       url: itemStrings.url
70754     };
70755     if (!replacements.signupUrl) {
70756       replacements.signupUrl = resolve(itemStrings.signupUrl || defaultStrings.signupUrl);
70757     }
70758     if (!replacements.url) {
70759       replacements.url = resolve(itemStrings.url || defaultStrings.url);
70760     }
70761     let resolved = {
70762       name: resolve(itemStrings.name || defaultStrings.name),
70763       url: resolve(itemStrings.url || defaultStrings.url),
70764       signupUrl: resolve(itemStrings.signupUrl || defaultStrings.signupUrl),
70765       description: resolve(itemStrings.description || defaultStrings.description),
70766       extendedDescription: resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription)
70767     };
70768     resolved.nameHTML = linkify(resolved.url, resolved.name);
70769     resolved.urlHTML = linkify(resolved.url);
70770     resolved.signupUrlHTML = linkify(resolved.signupUrl);
70771     resolved.descriptionHTML = resolve(itemStrings.description || defaultStrings.description, true);
70772     resolved.extendedDescriptionHTML = resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription, true);
70773     return resolved;
70774     function resolve(s2, addLinks) {
70775       if (!s2) return void 0;
70776       let result = s2;
70777       for (let key in replacements) {
70778         const token = "{".concat(key, "}");
70779         const regex = new RegExp(token, "g");
70780         if (regex.test(result)) {
70781           let replacement = replacements[key];
70782           if (!replacement) {
70783             throw new Error("Cannot resolve token: ".concat(token));
70784           } else {
70785             if (addLinks && (key === "signupUrl" || key === "url")) {
70786               replacement = linkify(replacement);
70787             }
70788             result = result.replace(regex, replacement);
70789           }
70790         }
70791       }
70792       const leftovers = result.match(anyToken);
70793       if (leftovers) {
70794         throw new Error("Cannot resolve tokens: ".concat(leftovers));
70795       }
70796       if (addLinks && item.type === "reddit") {
70797         result = result.replace(/(\/r\/\w+\/*)/i, (match) => linkify(resolved.url, match));
70798       }
70799       return result;
70800     }
70801     function linkify(url, text) {
70802       if (!url) return void 0;
70803       text = text || url;
70804       return '<a target="_blank" href="'.concat(url, '">').concat(text, "</a>");
70805     }
70806   }
70807
70808   // modules/ui/success.js
70809   var _oci = null;
70810   function uiSuccess(context) {
70811     const MAXEVENTS = 2;
70812     const dispatch14 = dispatch_default("cancel");
70813     let _changeset2;
70814     let _location;
70815     ensureOSMCommunityIndex();
70816     function ensureOSMCommunityIndex() {
70817       const data = _mainFileFetcher;
70818       return Promise.all([
70819         data.get("oci_features"),
70820         data.get("oci_resources"),
70821         data.get("oci_defaults")
70822       ]).then((vals) => {
70823         if (_oci) return _oci;
70824         if (vals[0] && Array.isArray(vals[0].features)) {
70825           _sharedLocationManager.mergeCustomGeoJSON(vals[0]);
70826         }
70827         let ociResources = Object.values(vals[1].resources);
70828         if (ociResources.length) {
70829           return _sharedLocationManager.mergeLocationSets(ociResources).then(() => {
70830             _oci = {
70831               resources: ociResources,
70832               defaults: vals[2].defaults
70833             };
70834             return _oci;
70835           });
70836         } else {
70837           _oci = {
70838             resources: [],
70839             // no resources?
70840             defaults: vals[2].defaults
70841           };
70842           return _oci;
70843         }
70844       });
70845     }
70846     function parseEventDate(when) {
70847       if (!when) return;
70848       let raw = when.trim();
70849       if (!raw) return;
70850       if (!/Z$/.test(raw)) {
70851         raw += "Z";
70852       }
70853       const parsed = new Date(raw);
70854       return new Date(parsed.toUTCString().slice(0, 25));
70855     }
70856     function success(selection2) {
70857       let header = selection2.append("div").attr("class", "header fillL");
70858       header.append("h2").call(_t.append("success.just_edited"));
70859       header.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => dispatch14.call("cancel")).call(svgIcon("#iD-icon-close"));
70860       let body = selection2.append("div").attr("class", "body save-success fillL");
70861       let summary = body.append("div").attr("class", "save-summary");
70862       summary.append("h3").call(_t.append("success.thank_you" + (_location ? "_location" : ""), { where: _location }));
70863       summary.append("p").call(_t.append("success.help_html")).append("a").attr("class", "link-out").attr("target", "_blank").attr("href", _t("success.help_link_url")).call(svgIcon("#iD-icon-out-link", "inline")).append("span").call(_t.append("success.help_link_text"));
70864       let osm = context.connection();
70865       if (!osm) return;
70866       let changesetURL = osm.changesetURL(_changeset2.id);
70867       let table = summary.append("table").attr("class", "summary-table");
70868       let row = table.append("tr").attr("class", "summary-row");
70869       row.append("td").attr("class", "cell-icon summary-icon").append("a").attr("target", "_blank").attr("href", changesetURL).append("svg").attr("class", "logo-small").append("use").attr("xlink:href", "#iD-logo-osm");
70870       let summaryDetail = row.append("td").attr("class", "cell-detail summary-detail");
70871       summaryDetail.append("a").attr("class", "cell-detail summary-view-on-osm").attr("target", "_blank").attr("href", changesetURL).call(_t.append("success.view_on_osm"));
70872       summaryDetail.append("div").html(_t.html("success.changeset_id", {
70873         changeset_id: { html: '<a href="'.concat(changesetURL, '" target="_blank">').concat(_changeset2.id, "</a>") }
70874       }));
70875       if (showDonationMessage !== false) {
70876         const donationUrl = "https://supporting.openstreetmap.org/";
70877         let supporting = body.append("div").attr("class", "save-supporting");
70878         supporting.append("h3").call(_t.append("success.supporting.title"));
70879         supporting.append("p").call(_t.append("success.supporting.details"));
70880         table = supporting.append("table").attr("class", "supporting-table");
70881         row = table.append("tr").attr("class", "supporting-row");
70882         row.append("td").attr("class", "cell-icon supporting-icon").append("a").attr("target", "_blank").attr("href", donationUrl).append("svg").attr("class", "logo-small").append("use").attr("xlink:href", "#iD-donation");
70883         let supportingDetail = row.append("td").attr("class", "cell-detail supporting-detail");
70884         supportingDetail.append("a").attr("class", "cell-detail support-the-map").attr("target", "_blank").attr("href", donationUrl).call(_t.append("success.supporting.donation.title"));
70885         supportingDetail.append("div").call(_t.append("success.supporting.donation.details"));
70886       }
70887       ensureOSMCommunityIndex().then((oci) => {
70888         const loc = context.map().center();
70889         const validHere = _sharedLocationManager.locationSetsAt(loc);
70890         let communities = [];
70891         oci.resources.forEach((resource) => {
70892           let area = validHere[resource.locationSetID];
70893           if (!area) return;
70894           const localizer = (stringID) => _t.html("community.".concat(stringID));
70895           resource.resolved = resolveStrings(resource, oci.defaults, localizer);
70896           communities.push({
70897             area,
70898             order: resource.order || 0,
70899             resource
70900           });
70901         });
70902         communities.sort((a2, b2) => a2.area - b2.area || b2.order - a2.order);
70903         body.call(showCommunityLinks, communities.map((c2) => c2.resource));
70904       });
70905     }
70906     function showCommunityLinks(selection2, resources) {
70907       let communityLinks = selection2.append("div").attr("class", "save-communityLinks");
70908       communityLinks.append("h3").call(_t.append("success.like_osm"));
70909       let table = communityLinks.append("table").attr("class", "community-table");
70910       let row = table.selectAll(".community-row").data(resources);
70911       let rowEnter = row.enter().append("tr").attr("class", "community-row");
70912       rowEnter.append("td").attr("class", "cell-icon community-icon").append("a").attr("target", "_blank").attr("href", (d2) => d2.resolved.url).append("svg").attr("class", "logo-small").append("use").attr("xlink:href", (d2) => "#community-".concat(d2.type));
70913       let communityDetail = rowEnter.append("td").attr("class", "cell-detail community-detail");
70914       communityDetail.each(showCommunityDetails);
70915       communityLinks.append("div").attr("class", "community-missing").call(_t.append("success.missing")).append("a").attr("class", "link-out").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).attr("href", "https://github.com/osmlab/osm-community-index/issues").append("span").call(_t.append("success.tell_us"));
70916     }
70917     function showCommunityDetails(d2) {
70918       let selection2 = select_default2(this);
70919       let communityID = d2.id;
70920       selection2.append("div").attr("class", "community-name").html(d2.resolved.nameHTML);
70921       selection2.append("div").attr("class", "community-description").html(d2.resolved.descriptionHTML);
70922       if (d2.resolved.extendedDescriptionHTML || d2.languageCodes && d2.languageCodes.length) {
70923         selection2.append("div").call(
70924           uiDisclosure(context, "community-more-".concat(d2.id), false).expanded(false).updatePreference(false).label(() => _t.append("success.more")).content(showMore)
70925         );
70926       }
70927       let nextEvents = (d2.events || []).map((event) => {
70928         event.date = parseEventDate(event.when);
70929         return event;
70930       }).filter((event) => {
70931         const t2 = event.date.getTime();
70932         const now3 = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0);
70933         return !isNaN(t2) && t2 >= now3;
70934       }).sort((a2, b2) => {
70935         return a2.date < b2.date ? -1 : a2.date > b2.date ? 1 : 0;
70936       }).slice(0, MAXEVENTS);
70937       if (nextEvents.length) {
70938         selection2.append("div").call(
70939           uiDisclosure(context, "community-events-".concat(d2.id), false).expanded(false).updatePreference(false).label(_t.html("success.events")).content(showNextEvents)
70940         ).select(".hide-toggle").append("span").attr("class", "badge-text").text(nextEvents.length);
70941       }
70942       function showMore(selection3) {
70943         let more = selection3.selectAll(".community-more").data([0]);
70944         let moreEnter = more.enter().append("div").attr("class", "community-more");
70945         if (d2.resolved.extendedDescriptionHTML) {
70946           moreEnter.append("div").attr("class", "community-extended-description").html(d2.resolved.extendedDescriptionHTML);
70947         }
70948         if (d2.languageCodes && d2.languageCodes.length) {
70949           const languageList = d2.languageCodes.map((code) => _mainLocalizer.languageName(code)).join(", ");
70950           moreEnter.append("div").attr("class", "community-languages").call(_t.append("success.languages", { languages: languageList }));
70951         }
70952       }
70953       function showNextEvents(selection3) {
70954         let events = selection3.append("div").attr("class", "community-events");
70955         let item = events.selectAll(".community-event").data(nextEvents);
70956         let itemEnter = item.enter().append("div").attr("class", "community-event");
70957         itemEnter.append("div").attr("class", "community-event-name").append("a").attr("target", "_blank").attr("href", (d4) => d4.url).text((d4) => {
70958           let name = d4.name;
70959           if (d4.i18n && d4.id) {
70960             name = _t("community.".concat(communityID, ".events.").concat(d4.id, ".name"), { default: name });
70961           }
70962           return name;
70963         });
70964         itemEnter.append("div").attr("class", "community-event-when").text((d4) => {
70965           let options2 = { weekday: "short", day: "numeric", month: "short", year: "numeric" };
70966           if (d4.date.getHours() || d4.date.getMinutes()) {
70967             options2.hour = "numeric";
70968             options2.minute = "numeric";
70969           }
70970           return d4.date.toLocaleString(_mainLocalizer.localeCode(), options2);
70971         });
70972         itemEnter.append("div").attr("class", "community-event-where").text((d4) => {
70973           let where = d4.where;
70974           if (d4.i18n && d4.id) {
70975             where = _t("community.".concat(communityID, ".events.").concat(d4.id, ".where"), { default: where });
70976           }
70977           return where;
70978         });
70979         itemEnter.append("div").attr("class", "community-event-description").text((d4) => {
70980           let description = d4.description;
70981           if (d4.i18n && d4.id) {
70982             description = _t("community.".concat(communityID, ".events.").concat(d4.id, ".description"), { default: description });
70983           }
70984           return description;
70985         });
70986       }
70987     }
70988     success.changeset = function(val) {
70989       if (!arguments.length) return _changeset2;
70990       _changeset2 = val;
70991       return success;
70992     };
70993     success.location = function(val) {
70994       if (!arguments.length) return _location;
70995       _location = val;
70996       return success;
70997     };
70998     return utilRebind(success, dispatch14, "on");
70999   }
71000
71001   // modules/ui/fields/input.js
71002   var likelyRawNumberFormat = /^-?(0\.\d*|\d*\.\d{0,2}(\d{4,})?|\d{4,}\.\d{3})$/;
71003   function uiFieldText(field, context) {
71004     var dispatch14 = dispatch_default("change");
71005     var input = select_default2(null);
71006     var outlinkButton = select_default2(null);
71007     var wrap2 = select_default2(null);
71008     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
71009     var _entityIDs = [];
71010     var _tags;
71011     var _phoneFormats = {};
71012     const isDirectionField = field.key.split(":").some((keyPart) => keyPart === "direction");
71013     const formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
71014     const parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
71015     const countDecimalPlaces = _mainLocalizer.decimalPlaceCounter(_mainLocalizer.languageCode());
71016     if (field.type === "tel") {
71017       _mainFileFetcher.get("phone_formats").then(function(d2) {
71018         _phoneFormats = d2;
71019         updatePhonePlaceholder();
71020       }).catch(function() {
71021       });
71022     }
71023     function calcLocked() {
71024       var isLocked = (field.id === "brand" || field.id === "network" || field.id === "operator" || field.id === "flag") && _entityIDs.length && _entityIDs.some(function(entityID) {
71025         var entity = context.graph().hasEntity(entityID);
71026         if (!entity) return false;
71027         if (entity.tags.wikidata) return true;
71028         var preset = _mainPresetIndex.match(entity, context.graph());
71029         var isSuggestion = preset && preset.suggestion;
71030         var which = field.id;
71031         return isSuggestion && !!entity.tags[which] && !!entity.tags[which + ":wikidata"];
71032       });
71033       field.locked(isLocked);
71034     }
71035     function i3(selection2) {
71036       calcLocked();
71037       var isLocked = field.locked();
71038       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
71039       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
71040       input = wrap2.selectAll("input").data([0]);
71041       input = input.enter().append("input").attr("type", field.type === "identifier" ? "text" : field.type).attr("id", field.domId).classed(field.type, true).call(utilNoAuto).merge(input);
71042       input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
71043       wrap2.call(_lengthIndicator);
71044       if (field.type === "tel") {
71045         updatePhonePlaceholder();
71046       } else if (field.type === "number") {
71047         var rtl = _mainLocalizer.textDirection() === "rtl";
71048         input.attr("type", "text");
71049         var inc = field.increment;
71050         var buttons = wrap2.selectAll(".increment, .decrement").data(rtl ? [inc, -inc] : [-inc, inc]);
71051         buttons.enter().append("button").attr("class", function(d2) {
71052           var which = d2 > 0 ? "increment" : "decrement";
71053           return "form-field-button " + which;
71054         }).attr("title", function(d2) {
71055           var which = d2 > 0 ? "increment" : "decrement";
71056           return _t("inspector.".concat(which));
71057         }).merge(buttons).on("click", function(d3_event, d2) {
71058           d3_event.preventDefault();
71059           var isMixed = Array.isArray(_tags[field.key]);
71060           if (isMixed) return;
71061           var raw_vals = input.node().value || "0";
71062           var vals = raw_vals.split(";");
71063           vals = vals.map(function(v2) {
71064             v2 = v2.trim();
71065             const isRawNumber = likelyRawNumberFormat.test(v2);
71066             var num = isRawNumber ? parseFloat(v2) : parseLocaleFloat(v2);
71067             if (isDirectionField) {
71068               const compassDir = cardinal[v2.toLowerCase()];
71069               if (compassDir !== void 0) {
71070                 num = compassDir;
71071               }
71072             }
71073             if (!isFinite(num)) return v2;
71074             num = parseFloat(num);
71075             if (!isFinite(num)) return v2;
71076             num += d2;
71077             if (isDirectionField) {
71078               num = (num % 360 + 360) % 360;
71079             }
71080             return formatFloat(clamped(num), isRawNumber ? v2.includes(".") ? v2.split(".")[1].length : 0 : countDecimalPlaces(v2));
71081           });
71082           input.node().value = vals.join(";");
71083           change()();
71084         });
71085       } else if (field.type === "identifier" && field.urlFormat && field.pattern) {
71086         input.attr("type", "text");
71087         outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
71088         outlinkButton = outlinkButton.enter().append("button").call(svgIcon("#iD-icon-out-link")).attr("class", "form-field-button foreign-id-permalink").attr("title", function() {
71089           var domainResults = /^https?:\/\/(.{1,}?)\//.exec(field.urlFormat);
71090           if (domainResults.length >= 2 && domainResults[1]) {
71091             var domain = domainResults[1];
71092             return _t("icons.view_on", { domain });
71093           }
71094           return "";
71095         }).merge(outlinkButton);
71096         outlinkButton.on("click", function(d3_event) {
71097           d3_event.preventDefault();
71098           var value = validIdentifierValueForLink();
71099           if (value) {
71100             var url = field.urlFormat.replace(/{value}/, encodeURIComponent(value));
71101             window.open(url, "_blank");
71102           }
71103         }).classed("disabled", () => !validIdentifierValueForLink()).merge(outlinkButton);
71104       } else if (field.type === "url") {
71105         input.attr("type", "text");
71106         outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
71107         outlinkButton.enter().append("button").call(svgIcon("#iD-icon-out-link")).attr("class", "form-field-button foreign-id-permalink").attr("title", () => _t("icons.visit_website")).on("click", function(d3_event) {
71108           d3_event.preventDefault();
71109           const value = validIdentifierValueForLink();
71110           if (value) window.open(value, "_blank");
71111         }).merge(outlinkButton);
71112       } else if (field.type === "colour") {
71113         input.attr("type", "text");
71114         updateColourPreview();
71115       } else if (field.type === "date") {
71116         input.attr("type", "text");
71117         updateDateField();
71118       }
71119     }
71120     function updateColourPreview() {
71121       wrap2.selectAll(".colour-preview").remove();
71122       const colour = utilGetSetValue(input);
71123       if (!isColourValid(colour) && colour !== "") {
71124         wrap2.selectAll("input.colour-selector").remove();
71125         wrap2.selectAll(".form-field-button").remove();
71126         return;
71127       }
71128       var colourSelector = wrap2.selectAll(".colour-selector").data([0]);
71129       colourSelector.enter().append("input").attr("type", "color").attr("class", "colour-selector").on("input", debounce_default(function(d3_event) {
71130         d3_event.preventDefault();
71131         var colour2 = this.value;
71132         if (!isColourValid(colour2)) return;
71133         utilGetSetValue(input, this.value);
71134         change()();
71135         updateColourPreview();
71136       }, 100));
71137       wrap2.selectAll("input.colour-selector").attr("value", colour);
71138       var chooserButton = wrap2.selectAll(".colour-preview").data([colour]);
71139       chooserButton = chooserButton.enter().append("div").attr("class", "form-field-button colour-preview").append("div").style("background-color", (d2) => d2).attr("class", "colour-box");
71140       if (colour === "") {
71141         chooserButton = chooserButton.call(svgIcon("#iD-icon-edit"));
71142       }
71143       chooserButton.on("click", () => wrap2.select(".colour-selector").node().showPicker());
71144     }
71145     function updateDateField() {
71146       function isDateValid(date2) {
71147         return date2.match(/^[0-9]{4}(-[0-9]{2}(-[0-9]{2})?)?$/);
71148       }
71149       const date = utilGetSetValue(input);
71150       const now3 = /* @__PURE__ */ new Date();
71151       const today = new Date(now3.getTime() - now3.getTimezoneOffset() * 6e4).toISOString().split("T")[0];
71152       if ((field.key === "check_date" || field.key === "survey:date") && date !== today) {
71153         wrap2.selectAll(".date-set-today").data([0]).enter().append("button").attr("class", "form-field-button date-set-today").call(svgIcon("#fas-rotate")).call(uiTooltip().title(() => _t.append("inspector.set_today"))).on("click", () => {
71154           utilGetSetValue(input, today);
71155           change()();
71156           updateDateField();
71157         });
71158       } else {
71159         wrap2.selectAll(".date-set-today").remove();
71160       }
71161       if (!isDateValid(date) && date !== "") {
71162         wrap2.selectAll("input.date-selector").remove();
71163         wrap2.selectAll(".date-calendar").remove();
71164         return;
71165       }
71166       if (utilDetect().browser !== "Safari") {
71167         var dateSelector = wrap2.selectAll(".date-selector").data([0]);
71168         dateSelector.enter().append("input").attr("type", "date").attr("class", "date-selector").on("input", debounce_default(function(d3_event) {
71169           d3_event.preventDefault();
71170           var date2 = this.value;
71171           if (!isDateValid(date2)) return;
71172           utilGetSetValue(input, this.value);
71173           change()();
71174           updateDateField();
71175         }, 100));
71176         wrap2.selectAll("input.date-selector").attr("value", date);
71177         var calendarButton = wrap2.selectAll(".date-calendar").data([date]);
71178         calendarButton = calendarButton.enter().append("button").attr("class", "form-field-button date-calendar").call(svgIcon("#fas-calendar-days"));
71179         calendarButton.on("click", () => wrap2.select(".date-selector").node().showPicker());
71180       }
71181     }
71182     function updatePhonePlaceholder() {
71183       if (input.empty() || !Object.keys(_phoneFormats).length) return;
71184       var extent = combinedEntityExtent();
71185       var countryCode = extent && iso1A2Code(extent.center());
71186       var format2 = countryCode && _phoneFormats[countryCode.toLowerCase()];
71187       if (format2) input.attr("placeholder", format2);
71188     }
71189     function validIdentifierValueForLink() {
71190       var _a3;
71191       const value = utilGetSetValue(input).trim();
71192       if (field.type === "url" && value) {
71193         try {
71194           return new URL(value).href;
71195         } catch {
71196           return null;
71197         }
71198       }
71199       if (field.type === "identifier" && field.pattern) {
71200         return value && ((_a3 = value.match(new RegExp(field.pattern))) == null ? void 0 : _a3[0]);
71201       }
71202       return null;
71203     }
71204     function clamped(num) {
71205       if (field.minValue !== void 0) {
71206         num = Math.max(num, field.minValue);
71207       }
71208       if (field.maxValue !== void 0) {
71209         num = Math.min(num, field.maxValue);
71210       }
71211       return num;
71212     }
71213     function getVals(tags) {
71214       if (field.keys) {
71215         const multiSelection = context.selectedIDs();
71216         tags = multiSelection.length > 1 ? context.selectedIDs().map((id2) => context.graph().entity(id2)).map((entity) => entity.tags) : [tags];
71217         return tags.map((tags2) => new Set(field.keys.reduce((acc, key) => acc.concat(tags2[key]), []).filter(Boolean))).map((vals) => vals.size === 0 ? /* @__PURE__ */ new Set([void 0]) : vals).reduce((a2, b2) => /* @__PURE__ */ new Set([...a2, ...b2]));
71218       } else {
71219         return new Set([].concat(tags[field.key]));
71220       }
71221     }
71222     function change(onInput) {
71223       return function() {
71224         var t2 = {};
71225         var val = utilGetSetValue(input);
71226         if (!onInput) val = context.cleanTagValue(val);
71227         if (!val && getVals(_tags).size > 1) return;
71228         var displayVal = val;
71229         if (field.type === "number" && val) {
71230           var numbers2 = val.split(";");
71231           numbers2 = numbers2.map(function(v2) {
71232             if (likelyRawNumberFormat.test(v2)) {
71233               return v2;
71234             }
71235             var num = parseLocaleFloat(v2);
71236             const fractionDigits = countDecimalPlaces(v2);
71237             return isFinite(num) ? clamped(num).toFixed(fractionDigits) : v2;
71238           });
71239           val = numbers2.join(";");
71240         }
71241         if (!onInput) utilGetSetValue(input, displayVal);
71242         t2[field.key] = val || void 0;
71243         if (field.keys) {
71244           dispatch14.call("change", this, (tags) => {
71245             if (field.keys.some((key) => tags[key])) {
71246               field.keys.filter((key) => tags[key]).forEach((key) => {
71247                 tags[key] = val || void 0;
71248               });
71249             } else {
71250               tags[field.key] = val || void 0;
71251             }
71252             return tags;
71253           }, onInput);
71254         } else {
71255           dispatch14.call("change", this, t2, onInput);
71256         }
71257       };
71258     }
71259     i3.entityIDs = function(val) {
71260       if (!arguments.length) return _entityIDs;
71261       _entityIDs = val;
71262       return i3;
71263     };
71264     i3.tags = function(tags) {
71265       var _a3;
71266       _tags = tags;
71267       const vals = getVals(tags);
71268       const isMixed = vals.size > 1;
71269       var val = vals.size === 1 ? (_a3 = [...vals][0]) != null ? _a3 : "" : "";
71270       var shouldUpdate;
71271       if (field.type === "number" && val) {
71272         var numbers2 = val.split(";");
71273         var oriNumbers = utilGetSetValue(input).split(";");
71274         if (numbers2.length !== oriNumbers.length) shouldUpdate = true;
71275         numbers2 = numbers2.map(function(v2) {
71276           v2 = v2.trim();
71277           var num = Number(v2);
71278           if (!isFinite(num) || v2 === "") return v2;
71279           const fractionDigits = v2.includes(".") ? v2.split(".")[1].length : 0;
71280           return formatFloat(num, fractionDigits);
71281         });
71282         val = numbers2.join(";");
71283         shouldUpdate = (inputValue, setValue) => {
71284           const inputNums = inputValue.split(";").map(
71285             (setVal) => likelyRawNumberFormat.test(setVal) ? parseFloat(setVal) : parseLocaleFloat(setVal)
71286           );
71287           const setNums = setValue.split(";").map(parseLocaleFloat);
71288           return !isEqual_default(inputNums, setNums);
71289         };
71290       }
71291       utilGetSetValue(input, val, shouldUpdate).attr("title", isMixed ? [...vals].join("\n") : void 0).attr("placeholder", isMixed ? _t("inspector.multiple_values") : field.placeholder() || _t("inspector.unknown")).classed("mixed", isMixed);
71292       if (field.type === "number") {
71293         const buttons = wrap2.selectAll(".increment, .decrement");
71294         if (isMixed) {
71295           buttons.attr("disabled", "disabled").classed("disabled", true);
71296         } else {
71297           var raw_vals = tags[field.key] || "0";
71298           const canIncDec = raw_vals.split(";").some((val2) => isFinite(Number(val2)) || isDirectionField && cardinal[val2.trim().toLowerCase()]);
71299           buttons.attr("disabled", canIncDec ? null : "disabled").classed("disabled", !canIncDec);
71300         }
71301       }
71302       if (field.type === "tel") updatePhonePlaceholder();
71303       if (field.type === "colour") updateColourPreview();
71304       if (field.type === "date") updateDateField();
71305       if (outlinkButton && !outlinkButton.empty()) {
71306         var disabled = !validIdentifierValueForLink();
71307         outlinkButton.classed("disabled", disabled);
71308       }
71309       if (!isMixed) {
71310         _lengthIndicator.update(tags[field.key]);
71311       }
71312     };
71313     i3.focus = function() {
71314       var node = input.node();
71315       if (node) node.focus();
71316     };
71317     function combinedEntityExtent() {
71318       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
71319     }
71320     return utilRebind(i3, dispatch14, "on");
71321   }
71322
71323   // modules/ui/fields/access.js
71324   function uiFieldAccess(field, context) {
71325     var dispatch14 = dispatch_default("change");
71326     var items = select_default2(null);
71327     var _tags;
71328     function access(selection2) {
71329       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
71330       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
71331       var list2 = wrap2.selectAll("ul").data([0]);
71332       list2 = list2.enter().append("ul").attr("class", "rows").merge(list2);
71333       items = list2.selectAll("li").data(field.keys);
71334       var enter = items.enter().append("li").attr("class", function(d2) {
71335         return "labeled-input preset-access-" + d2;
71336       });
71337       enter.append("div").attr("class", "label preset-label-access").attr("for", function(d2) {
71338         return "preset-input-access-" + d2;
71339       }).html(function(d2) {
71340         return field.t.html("types." + d2);
71341       });
71342       enter.append("div").attr("class", "preset-input-access-wrap").append("input").attr("type", "text").attr("class", function(d2) {
71343         return "preset-input-access preset-input-access-" + d2;
71344       }).call(utilNoAuto).each(function(d2) {
71345         select_default2(this).call(
71346           uiCombobox(context, "access-" + d2).data(access.options(d2))
71347         );
71348       });
71349       items = items.merge(enter);
71350       wrap2.selectAll(".preset-input-access").on("change", change).on("blur", change);
71351     }
71352     function change(d3_event, d2) {
71353       var tag2 = {};
71354       var value = context.cleanTagValue(utilGetSetValue(select_default2(this)));
71355       if (!value && typeof _tags[d2] !== "string") return;
71356       tag2[d2] = value || void 0;
71357       dispatch14.call("change", this, tag2);
71358     }
71359     access.options = function(type2) {
71360       var options2 = [
71361         "yes",
71362         "no",
71363         "designated",
71364         "permissive",
71365         "destination",
71366         "customers",
71367         "private",
71368         "permit",
71369         "unknown"
71370       ];
71371       if (type2 === "access") {
71372         options2 = options2.filter((v2) => v2 !== "yes" && v2 !== "designated");
71373       }
71374       if (type2 === "bicycle") {
71375         options2.splice(options2.length - 4, 0, "dismount");
71376       }
71377       var stringsField = field.resolveReference("stringsCrossReference");
71378       return options2.map(function(option) {
71379         return {
71380           title: stringsField.t("options." + option + ".description"),
71381           value: option
71382         };
71383       });
71384     };
71385     const placeholdersByTag = {
71386       highway: {
71387         footway: {
71388           foot: "designated",
71389           motor_vehicle: "no"
71390         },
71391         steps: {
71392           foot: "yes",
71393           motor_vehicle: "no",
71394           bicycle: "no",
71395           horse: "no"
71396         },
71397         ladder: {
71398           foot: "yes",
71399           motor_vehicle: "no",
71400           bicycle: "no",
71401           horse: "no"
71402         },
71403         pedestrian: {
71404           foot: "yes",
71405           motor_vehicle: "no"
71406         },
71407         cycleway: {
71408           motor_vehicle: "no",
71409           bicycle: "designated"
71410         },
71411         bridleway: {
71412           motor_vehicle: "no",
71413           horse: "designated"
71414         },
71415         path: {
71416           foot: "yes",
71417           motor_vehicle: "no",
71418           bicycle: "yes",
71419           horse: "yes"
71420         },
71421         motorway: {
71422           foot: "no",
71423           motor_vehicle: "yes",
71424           bicycle: "no",
71425           horse: "no"
71426         },
71427         trunk: {
71428           motor_vehicle: "yes"
71429         },
71430         primary: {
71431           foot: "yes",
71432           motor_vehicle: "yes",
71433           bicycle: "yes",
71434           horse: "yes"
71435         },
71436         secondary: {
71437           foot: "yes",
71438           motor_vehicle: "yes",
71439           bicycle: "yes",
71440           horse: "yes"
71441         },
71442         tertiary: {
71443           foot: "yes",
71444           motor_vehicle: "yes",
71445           bicycle: "yes",
71446           horse: "yes"
71447         },
71448         residential: {
71449           foot: "yes",
71450           motor_vehicle: "yes",
71451           bicycle: "yes",
71452           horse: "yes"
71453         },
71454         unclassified: {
71455           foot: "yes",
71456           motor_vehicle: "yes",
71457           bicycle: "yes",
71458           horse: "yes"
71459         },
71460         service: {
71461           foot: "yes",
71462           motor_vehicle: "yes",
71463           bicycle: "yes",
71464           horse: "yes"
71465         },
71466         motorway_link: {
71467           foot: "no",
71468           motor_vehicle: "yes",
71469           bicycle: "no",
71470           horse: "no"
71471         },
71472         trunk_link: {
71473           motor_vehicle: "yes"
71474         },
71475         primary_link: {
71476           foot: "yes",
71477           motor_vehicle: "yes",
71478           bicycle: "yes",
71479           horse: "yes"
71480         },
71481         secondary_link: {
71482           foot: "yes",
71483           motor_vehicle: "yes",
71484           bicycle: "yes",
71485           horse: "yes"
71486         },
71487         tertiary_link: {
71488           foot: "yes",
71489           motor_vehicle: "yes",
71490           bicycle: "yes",
71491           horse: "yes"
71492         },
71493         construction: {
71494           access: "no"
71495         },
71496         busway: {
71497           access: "no",
71498           bus: "designated",
71499           emergency: "yes"
71500         }
71501       },
71502       barrier: {
71503         bollard: {
71504           access: "no",
71505           bicycle: "yes",
71506           foot: "yes"
71507         },
71508         bus_trap: {
71509           motor_vehicle: "no",
71510           psv: "yes",
71511           foot: "yes",
71512           bicycle: "yes"
71513         },
71514         city_wall: {
71515           access: "no"
71516         },
71517         coupure: {
71518           access: "yes"
71519         },
71520         cycle_barrier: {
71521           motor_vehicle: "no"
71522         },
71523         ditch: {
71524           access: "no"
71525         },
71526         entrance: {
71527           access: "yes"
71528         },
71529         fence: {
71530           access: "no"
71531         },
71532         hedge: {
71533           access: "no"
71534         },
71535         jersey_barrier: {
71536           access: "no"
71537         },
71538         motorcycle_barrier: {
71539           motor_vehicle: "no"
71540         },
71541         rail_guard: {
71542           access: "no"
71543         }
71544       }
71545     };
71546     access.tags = function(tags) {
71547       _tags = tags;
71548       utilGetSetValue(items.selectAll(".preset-input-access"), function(d2) {
71549         return typeof tags[d2] === "string" ? tags[d2] : "";
71550       }).classed("mixed", function(d2) {
71551         return tags[d2] && Array.isArray(tags[d2]);
71552       }).attr("title", function(d2) {
71553         return tags[d2] && Array.isArray(tags[d2]) && tags[d2].filter(Boolean).join("\n");
71554       }).attr("placeholder", function(d2) {
71555         if (tags[d2] && Array.isArray(tags[d2])) {
71556           return _t("inspector.multiple_values");
71557         }
71558         if (d2 === "bicycle" || d2 === "motor_vehicle") {
71559           if (tags.vehicle && typeof tags.vehicle === "string") {
71560             return tags.vehicle;
71561           }
71562         }
71563         if (tags.access && typeof tags.access === "string") {
71564           return tags.access;
71565         }
71566         function getPlaceholdersByTag(key, placeholdersByKey) {
71567           if (typeof tags[key] === "string") {
71568             if (placeholdersByKey[tags[key]] && placeholdersByKey[tags[key]][d2]) {
71569               return placeholdersByKey[tags[key]][d2];
71570             }
71571           } else {
71572             var impliedAccesses = tags[key].filter(Boolean).map(function(val) {
71573               return placeholdersByKey[val] && placeholdersByKey[val][d2];
71574             }).filter(Boolean);
71575             if (impliedAccesses.length === tags[key].length && new Set(impliedAccesses).size === 1) {
71576               return impliedAccesses[0];
71577             }
71578           }
71579         }
71580         for (const key in placeholdersByTag) {
71581           if (tags[key]) {
71582             const impliedAccess = getPlaceholdersByTag(key, placeholdersByTag[key]);
71583             if (impliedAccess) {
71584               return impliedAccess;
71585             }
71586           }
71587         }
71588         if (d2 === "access" && !tags.barrier) {
71589           return "yes";
71590         }
71591         return field.placeholder();
71592       });
71593     };
71594     access.focus = function() {
71595       items.selectAll(".preset-input-access").node().focus();
71596     };
71597     return utilRebind(access, dispatch14, "on");
71598   }
71599
71600   // modules/ui/fields/address.js
71601   function uiFieldAddress(field, context) {
71602     var dispatch14 = dispatch_default("change");
71603     var _selection = select_default2(null);
71604     var _wrap = select_default2(null);
71605     var addrField = _mainPresetIndex.field("address");
71606     var _entityIDs = [];
71607     var _tags;
71608     var _countryCode;
71609     var _addressFormats = [{
71610       format: [
71611         ["housenumber", "street"],
71612         ["city", "postcode"]
71613       ]
71614     }];
71615     _mainFileFetcher.get("address_formats").then(function(d2) {
71616       _addressFormats = d2;
71617       if (!_selection.empty()) {
71618         _selection.call(address);
71619       }
71620     }).catch(function() {
71621     });
71622     function getNear(isAddressable, type2, searchRadius, resultProp) {
71623       var extent = combinedEntityExtent();
71624       var l2 = extent.center();
71625       var box = geoExtent(l2).padByMeters(searchRadius);
71626       var features = context.history().intersects(box).filter(isAddressable).map((d2) => {
71627         let dist = geoSphericalDistance(d2.extent(context.graph()).center(), l2);
71628         if (d2.geometry(context.graph()) === "line") {
71629           var loc = context.projection([
71630             (extent[0][0] + extent[1][0]) / 2,
71631             (extent[0][1] + extent[1][1]) / 2
71632           ]);
71633           var choice = geoChooseEdge(context.graph().childNodes(d2), loc, context.projection);
71634           dist = geoSphericalDistance(choice.loc, l2);
71635         }
71636         const value = resultProp && d2.tags[resultProp] ? d2.tags[resultProp] : d2.tags.name;
71637         let title = value;
71638         if (type2 === "street") {
71639           title = "".concat(addrField.t("placeholders.street"), ": ").concat(title);
71640         } else if (type2 === "place") {
71641           title = "".concat(addrField.t("placeholders.place"), ": ").concat(title);
71642         }
71643         return {
71644           title,
71645           value,
71646           dist,
71647           type: type2,
71648           klass: "address-".concat(type2)
71649         };
71650       }).sort(function(a2, b2) {
71651         return a2.dist - b2.dist;
71652       });
71653       return utilArrayUniqBy(features, "value");
71654     }
71655     function getNearStreets() {
71656       function isAddressable(d2) {
71657         return d2.tags.highway && d2.tags.name && d2.type === "way";
71658       }
71659       return getNear(isAddressable, "street", 200);
71660     }
71661     function getNearPlaces() {
71662       function isAddressable(d2) {
71663         if (d2.tags.name) {
71664           if (d2.tags.place) return true;
71665           if (d2.tags.boundary === "administrative" && d2.tags.admin_level > 8) return true;
71666         }
71667         return false;
71668       }
71669       return getNear(isAddressable, "place", 200);
71670     }
71671     function getNearCities() {
71672       function isAddressable(d2) {
71673         if (d2.tags.name) {
71674           if (d2.tags.boundary === "administrative" && d2.tags.admin_level === "8") return true;
71675           if (d2.tags.border_type === "city") return true;
71676           if (d2.tags.place === "city" || d2.tags.place === "town" || d2.tags.place === "village") return true;
71677         }
71678         if (d2.tags["".concat(field.key, ":city")]) return true;
71679         return false;
71680       }
71681       return getNear(isAddressable, "city", 200, "".concat(field.key, ":city"));
71682     }
71683     function getNearPostcodes() {
71684       return [...new Set([].concat(getNearValues("postcode")).concat(getNear((d2) => d2.tags.postal_code, "postcode", 200, "postal_code")))];
71685     }
71686     function getNearValues(key) {
71687       const tagKey = "".concat(field.key, ":").concat(key);
71688       function hasTag(d2) {
71689         return _entityIDs.indexOf(d2.id) === -1 && d2.tags[tagKey];
71690       }
71691       return getNear(hasTag, key, 200, tagKey);
71692     }
71693     function updateForCountryCode() {
71694       if (!_countryCode) return;
71695       var addressFormat;
71696       for (var i3 = 0; i3 < _addressFormats.length; i3++) {
71697         var format2 = _addressFormats[i3];
71698         if (!format2.countryCodes) {
71699           addressFormat = format2;
71700         } else if (format2.countryCodes.indexOf(_countryCode) !== -1) {
71701           addressFormat = format2;
71702           break;
71703         }
71704       }
71705       var dropdowns = addressFormat.dropdowns || [
71706         "city",
71707         "county",
71708         "country",
71709         "district",
71710         "hamlet",
71711         "neighbourhood",
71712         "place",
71713         "postcode",
71714         "province",
71715         "quarter",
71716         "state",
71717         "street",
71718         "street+place",
71719         "subdistrict",
71720         "suburb"
71721       ];
71722       var widths = addressFormat.widths || {
71723         housenumber: 1 / 5,
71724         unit: 1 / 5,
71725         street: 1 / 2,
71726         place: 1 / 2,
71727         city: 2 / 3,
71728         state: 1 / 4,
71729         postcode: 1 / 3
71730       };
71731       function row(r2) {
71732         var total = r2.reduce(function(sum, key) {
71733           return sum + (widths[key] || 0.5);
71734         }, 0);
71735         return r2.map(function(key) {
71736           return {
71737             id: key,
71738             width: (widths[key] || 0.5) / total
71739           };
71740         });
71741       }
71742       var rows = _wrap.selectAll(".addr-row").data(addressFormat.format, function(d2) {
71743         return d2.toString();
71744       });
71745       rows.exit().remove();
71746       rows.enter().append("div").attr("class", "addr-row").selectAll("input").data(row).enter().append("input").property("type", "text").call(updatePlaceholder).attr("class", function(d2) {
71747         return "addr-" + d2.id;
71748       }).call(utilNoAuto).each(addDropdown).style("width", function(d2) {
71749         return d2.width * 100 + "%";
71750       });
71751       function addDropdown(d2) {
71752         if (dropdowns.indexOf(d2.id) === -1) return;
71753         var nearValues;
71754         switch (d2.id) {
71755           case "street":
71756             nearValues = getNearStreets;
71757             break;
71758           case "place":
71759             nearValues = getNearPlaces;
71760             break;
71761           case "street+place":
71762             nearValues = () => [].concat(getNearStreets()).concat(getNearPlaces());
71763             d2.isAutoStreetPlace = true;
71764             d2.id = _tags["".concat(field.key, ":place")] ? "place" : "street";
71765             break;
71766           case "city":
71767             nearValues = getNearCities;
71768             break;
71769           case "postcode":
71770             nearValues = getNearPostcodes;
71771             break;
71772           default:
71773             nearValues = getNearValues;
71774         }
71775         select_default2(this).call(
71776           uiCombobox(context, "address-".concat(d2.isAutoStreetPlace ? "street-place" : d2.id)).minItems(1).caseSensitive(true).fetcher(function(typedValue, callback) {
71777             typedValue = typedValue.toLowerCase();
71778             callback(nearValues(d2.id).filter((v2) => v2.value.toLowerCase().indexOf(typedValue) !== -1));
71779           }).on("accept", function(selected) {
71780             if (d2.isAutoStreetPlace) {
71781               d2.id = selected ? selected.type : "street";
71782               utilTriggerEvent(select_default2(this), "change");
71783             }
71784           })
71785         );
71786       }
71787       _wrap.selectAll("input").on("blur", change()).on("change", change());
71788       _wrap.selectAll("input:not(.combobox-input)").on("input", change(true));
71789       if (_tags) updateTags(_tags);
71790     }
71791     function address(selection2) {
71792       _selection = selection2;
71793       _wrap = selection2.selectAll(".form-field-input-wrap").data([0]);
71794       _wrap = _wrap.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(_wrap);
71795       var extent = combinedEntityExtent();
71796       if (extent) {
71797         var countryCode;
71798         if (context.inIntro()) {
71799           countryCode = _t("intro.graph.countrycode");
71800         } else {
71801           var center = extent.center();
71802           countryCode = iso1A2Code(center);
71803         }
71804         if (countryCode) {
71805           _countryCode = countryCode.toLowerCase();
71806           updateForCountryCode();
71807         }
71808       }
71809     }
71810     function change(onInput) {
71811       return function() {
71812         var tags = {};
71813         _wrap.selectAll("input").each(function(subfield) {
71814           var key = field.key + ":" + subfield.id;
71815           var value = this.value;
71816           if (!onInput) value = context.cleanTagValue(value);
71817           if (Array.isArray(_tags[key]) && !value) return;
71818           if (subfield.isAutoStreetPlace) {
71819             if (subfield.id === "street") {
71820               tags["".concat(field.key, ":place")] = void 0;
71821             } else if (subfield.id === "place") {
71822               tags["".concat(field.key, ":street")] = void 0;
71823             }
71824           }
71825           tags[key] = value || void 0;
71826         });
71827         Object.keys(tags).filter((k2) => tags[k2]).forEach((k2) => _tags[k2] = tags[k2]);
71828         dispatch14.call("change", this, tags, onInput);
71829       };
71830     }
71831     function updatePlaceholder(inputSelection) {
71832       return inputSelection.attr("placeholder", function(subfield) {
71833         if (_tags && Array.isArray(_tags[field.key + ":" + subfield.id])) {
71834           return _t("inspector.multiple_values");
71835         }
71836         if (subfield.isAutoStreetPlace) {
71837           return "".concat(getLocalPlaceholder("street"), " / ").concat(getLocalPlaceholder("place"));
71838         }
71839         return getLocalPlaceholder(subfield.id);
71840       });
71841     }
71842     function getLocalPlaceholder(key) {
71843       if (_countryCode) {
71844         var localkey = key + "!" + _countryCode;
71845         var tkey = addrField.hasTextForStringId("placeholders." + localkey) ? localkey : key;
71846         return addrField.t("placeholders." + tkey);
71847       }
71848     }
71849     function updateTags(tags) {
71850       utilGetSetValue(_wrap.selectAll("input"), (subfield) => {
71851         var val;
71852         if (subfield.isAutoStreetPlace) {
71853           const streetKey = "".concat(field.key, ":street");
71854           const placeKey = "".concat(field.key, ":place");
71855           if (tags[streetKey] !== void 0 || tags[placeKey] === void 0) {
71856             val = tags[streetKey];
71857             subfield.id = "street";
71858           } else {
71859             val = tags[placeKey];
71860             subfield.id = "place";
71861           }
71862         } else {
71863           val = tags["".concat(field.key, ":").concat(subfield.id)];
71864         }
71865         return typeof val === "string" ? val : "";
71866       }).attr("title", function(subfield) {
71867         var val = tags[field.key + ":" + subfield.id];
71868         return val && Array.isArray(val) ? val.filter(Boolean).join("\n") : void 0;
71869       }).classed("mixed", function(subfield) {
71870         return Array.isArray(tags[field.key + ":" + subfield.id]);
71871       }).call(updatePlaceholder);
71872     }
71873     function combinedEntityExtent() {
71874       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
71875     }
71876     address.entityIDs = function(val) {
71877       if (!arguments.length) return _entityIDs;
71878       _entityIDs = val;
71879       return address;
71880     };
71881     address.tags = function(tags) {
71882       _tags = tags;
71883       updateTags(tags);
71884     };
71885     address.focus = function() {
71886       var node = _wrap.selectAll("input").node();
71887       if (node) node.focus();
71888     };
71889     return utilRebind(address, dispatch14, "on");
71890   }
71891
71892   // modules/ui/fields/directional_combo.js
71893   function uiFieldDirectionalCombo(field, context) {
71894     var dispatch14 = dispatch_default("change");
71895     var items = select_default2(null);
71896     var wrap2 = select_default2(null);
71897     var _tags;
71898     var _combos = {};
71899     if (field.type === "cycleway") {
71900       field = {
71901         ...field,
71902         key: field.keys[0],
71903         keys: field.keys.slice(1)
71904       };
71905     }
71906     function directionalCombo(selection2) {
71907       function stripcolon(s2) {
71908         return s2.replace(":", "");
71909       }
71910       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
71911       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
71912       var div = wrap2.selectAll("ul").data([0]);
71913       div = div.enter().append("ul").attr("class", "rows rows-table").merge(div);
71914       items = div.selectAll("li").data(field.keys);
71915       var enter = items.enter().append("li").attr("class", function(d2) {
71916         return "labeled-input preset-directionalcombo-" + stripcolon(d2);
71917       });
71918       enter.append("div").attr("class", "label preset-label-directionalcombo").attr("for", function(d2) {
71919         return "preset-input-directionalcombo-" + stripcolon(d2);
71920       }).html(function(d2) {
71921         return field.t.html("types." + d2);
71922       });
71923       enter.append("div").attr("class", "preset-input-directionalcombo-wrap form-field-input-wrap").each(function(key) {
71924         const subField = {
71925           ...field,
71926           type: "combo",
71927           key
71928         };
71929         const combo = uiFieldCombo(subField, context);
71930         combo.on("change", (t2) => change(key, t2[key]));
71931         _combos[key] = combo;
71932         select_default2(this).call(combo);
71933       });
71934       items = items.merge(enter);
71935       wrap2.selectAll(".preset-input-directionalcombo").on("change", change).on("blur", change);
71936     }
71937     function change(key, newValue) {
71938       const commonKey = field.key;
71939       const otherKey = key === field.keys[0] ? field.keys[1] : field.keys[0];
71940       dispatch14.call("change", this, (tags) => {
71941         const otherValue = tags[otherKey] || tags[commonKey];
71942         if (newValue === otherValue) {
71943           tags[commonKey] = newValue;
71944           delete tags[key];
71945           delete tags[otherKey];
71946         } else {
71947           tags[key] = newValue;
71948           delete tags[commonKey];
71949           tags[otherKey] = otherValue;
71950         }
71951         return tags;
71952       });
71953     }
71954     directionalCombo.tags = function(tags) {
71955       _tags = tags;
71956       const commonKey = field.key;
71957       for (let key in _combos) {
71958         const uniqueValues = [...new Set([].concat(_tags[commonKey]).concat(_tags[key]).filter(Boolean))];
71959         _combos[key].tags({ [key]: uniqueValues.length > 1 ? uniqueValues : uniqueValues[0] });
71960       }
71961     };
71962     directionalCombo.focus = function() {
71963       var node = wrap2.selectAll("input").node();
71964       if (node) node.focus();
71965     };
71966     return utilRebind(directionalCombo, dispatch14, "on");
71967   }
71968
71969   // modules/ui/fields/lanes.js
71970   function uiFieldLanes(field, context) {
71971     var dispatch14 = dispatch_default("change");
71972     var LANE_WIDTH = 40;
71973     var LANE_HEIGHT = 200;
71974     var _entityIDs = [];
71975     function lanes(selection2) {
71976       var lanesData = context.entity(_entityIDs[0]).lanes();
71977       if (!context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode) {
71978         selection2.call(lanes.off);
71979         return;
71980       }
71981       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
71982       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
71983       var surface = wrap2.selectAll(".surface").data([0]);
71984       var d2 = utilGetDimensions(wrap2);
71985       var freeSpace = d2[0] - lanesData.lanes.length * LANE_WIDTH * 1.5 + LANE_WIDTH * 0.5;
71986       surface = surface.enter().append("svg").attr("width", d2[0]).attr("height", 300).attr("class", "surface").merge(surface);
71987       var lanesSelection = surface.selectAll(".lanes").data([0]);
71988       lanesSelection = lanesSelection.enter().append("g").attr("class", "lanes").merge(lanesSelection);
71989       lanesSelection.attr("transform", function() {
71990         return "translate(" + freeSpace / 2 + ", 0)";
71991       });
71992       var lane = lanesSelection.selectAll(".lane").data(lanesData.lanes);
71993       lane.exit().remove();
71994       var enter = lane.enter().append("g").attr("class", "lane");
71995       enter.append("g").append("rect").attr("y", 50).attr("width", LANE_WIDTH).attr("height", LANE_HEIGHT);
71996       enter.append("g").attr("class", "forward").append("text").attr("y", 40).attr("x", 14).text("\u25B2");
71997       enter.append("g").attr("class", "bothways").append("text").attr("y", 40).attr("x", 14).text("\u25B2\u25BC");
71998       enter.append("g").attr("class", "backward").append("text").attr("y", 40).attr("x", 14).text("\u25BC");
71999       lane = lane.merge(enter);
72000       lane.attr("transform", function(d4) {
72001         return "translate(" + LANE_WIDTH * d4.index * 1.5 + ", 0)";
72002       });
72003       lane.select(".forward").style("visibility", function(d4) {
72004         return d4.direction === "forward" ? "visible" : "hidden";
72005       });
72006       lane.select(".bothways").style("visibility", function(d4) {
72007         return d4.direction === "bothways" ? "visible" : "hidden";
72008       });
72009       lane.select(".backward").style("visibility", function(d4) {
72010         return d4.direction === "backward" ? "visible" : "hidden";
72011       });
72012     }
72013     lanes.entityIDs = function(val) {
72014       _entityIDs = val;
72015     };
72016     lanes.tags = function() {
72017     };
72018     lanes.focus = function() {
72019     };
72020     lanes.off = function() {
72021     };
72022     return utilRebind(lanes, dispatch14, "on");
72023   }
72024   uiFieldLanes.supportsMultiselection = false;
72025
72026   // modules/ui/fields/localized.js
72027   var _languagesArray = [];
72028   var LANGUAGE_SUFFIX_REGEX = /^(.*):([a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-[A-Z]{2})?)$/;
72029   function uiFieldLocalized(field, context) {
72030     var dispatch14 = dispatch_default("change", "input");
72031     var wikipedia = services.wikipedia;
72032     var input = select_default2(null);
72033     var localizedInputs = select_default2(null);
72034     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
72035     var _countryCode;
72036     var _tags;
72037     _mainFileFetcher.get("languages").then(loadLanguagesArray).catch(function() {
72038     });
72039     var _territoryLanguages = {};
72040     _mainFileFetcher.get("territory_languages").then(function(d2) {
72041       _territoryLanguages = d2;
72042     }).catch(function() {
72043     });
72044     var langCombo = uiCombobox(context, "localized-lang").fetcher(fetchLanguages).minItems(0);
72045     var _selection = select_default2(null);
72046     var _multilingual = [];
72047     var _buttonTip = uiTooltip().title(() => _t.append("translate.translate")).placement("left");
72048     var _wikiTitles;
72049     var _entityIDs = [];
72050     function loadLanguagesArray(dataLanguages) {
72051       if (_languagesArray.length !== 0) return;
72052       var replacements = {
72053         sr: "sr-Cyrl",
72054         // in OSM, `sr` implies Cyrillic
72055         "sr-Cyrl": false
72056         // `sr-Cyrl` isn't used in OSM
72057       };
72058       for (var code in dataLanguages) {
72059         if (replacements[code] === false) continue;
72060         var metaCode = code;
72061         if (replacements[code]) metaCode = replacements[code];
72062         _languagesArray.push({
72063           localName: _mainLocalizer.languageName(metaCode, { localOnly: true }),
72064           nativeName: dataLanguages[metaCode].nativeName,
72065           code,
72066           label: _mainLocalizer.languageName(metaCode)
72067         });
72068       }
72069     }
72070     function calcLocked() {
72071       var isLocked = field.id === "name" && _entityIDs.length && _entityIDs.some(function(entityID) {
72072         var entity = context.graph().hasEntity(entityID);
72073         if (!entity) return false;
72074         if (entity.tags.wikidata) return true;
72075         if (entity.tags["name:etymology:wikidata"]) return true;
72076         var preset = _mainPresetIndex.match(entity, context.graph());
72077         if (preset) {
72078           var isSuggestion = preset.suggestion;
72079           var fields = preset.fields(entity.extent(context.graph()).center());
72080           var showsBrandField = fields.some(function(d2) {
72081             return d2.id === "brand";
72082           });
72083           var showsOperatorField = fields.some(function(d2) {
72084             return d2.id === "operator";
72085           });
72086           var setsName = preset.addTags.name;
72087           var setsBrandWikidata = preset.addTags["brand:wikidata"];
72088           var setsOperatorWikidata = preset.addTags["operator:wikidata"];
72089           return isSuggestion && setsName && (setsBrandWikidata && !showsBrandField || setsOperatorWikidata && !showsOperatorField);
72090         }
72091         return false;
72092       });
72093       field.locked(isLocked);
72094     }
72095     function calcMultilingual(tags) {
72096       var existingLangsOrdered = _multilingual.map(function(item2) {
72097         return item2.lang;
72098       });
72099       var existingLangs = new Set(existingLangsOrdered.filter(Boolean));
72100       for (var k2 in tags) {
72101         var m2 = k2.match(LANGUAGE_SUFFIX_REGEX);
72102         if (m2 && m2[1] === field.key && m2[2]) {
72103           var item = { lang: m2[2], value: tags[k2] };
72104           if (existingLangs.has(item.lang)) {
72105             _multilingual[existingLangsOrdered.indexOf(item.lang)].value = item.value;
72106             existingLangs.delete(item.lang);
72107           } else {
72108             _multilingual.push(item);
72109           }
72110         }
72111       }
72112       _multilingual.forEach(function(item2) {
72113         if (item2.lang && existingLangs.has(item2.lang)) {
72114           item2.value = "";
72115         }
72116       });
72117     }
72118     function localized(selection2) {
72119       _selection = selection2;
72120       calcLocked();
72121       var isLocked = field.locked();
72122       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
72123       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
72124       input = wrap2.selectAll(".localized-main").data([0]);
72125       input = input.enter().append("input").attr("type", "text").attr("id", field.domId).attr("class", "localized-main").call(utilNoAuto).merge(input);
72126       input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
72127       wrap2.call(_lengthIndicator);
72128       var translateButton = wrap2.selectAll(".localized-add").data([0]);
72129       translateButton = translateButton.enter().append("button").attr("class", "localized-add form-field-button").attr("aria-label", _t("icons.plus")).call(svgIcon("#iD-icon-plus")).merge(translateButton);
72130       translateButton.classed("disabled", !!isLocked).call(isLocked ? _buttonTip.destroy : _buttonTip).on("click", addNew);
72131       if (_tags && !_multilingual.length) {
72132         calcMultilingual(_tags);
72133       }
72134       localizedInputs = selection2.selectAll(".localized-multilingual").data([0]);
72135       localizedInputs = localizedInputs.enter().append("div").attr("class", "localized-multilingual").merge(localizedInputs);
72136       localizedInputs.call(renderMultilingual);
72137       localizedInputs.selectAll("button, input").classed("disabled", !!isLocked).attr("readonly", isLocked || null);
72138       selection2.selectAll(".combobox-caret").classed("nope", true);
72139       function addNew(d3_event) {
72140         d3_event.preventDefault();
72141         if (field.locked()) return;
72142         var defaultLang = _mainLocalizer.languageCode().toLowerCase();
72143         var langExists = _multilingual.find(function(datum2) {
72144           return datum2.lang === defaultLang;
72145         });
72146         var isLangEn = defaultLang.indexOf("en") > -1;
72147         if (isLangEn || langExists) {
72148           defaultLang = "";
72149           langExists = _multilingual.find(function(datum2) {
72150             return datum2.lang === defaultLang;
72151           });
72152         }
72153         if (!langExists) {
72154           _multilingual.unshift({ lang: defaultLang, value: "" });
72155           localizedInputs.call(renderMultilingual);
72156         }
72157       }
72158       function change(onInput) {
72159         return function(d3_event) {
72160           if (field.locked()) {
72161             d3_event.preventDefault();
72162             return;
72163           }
72164           var val = utilGetSetValue(select_default2(this));
72165           if (!onInput) val = context.cleanTagValue(val);
72166           if (!val && Array.isArray(_tags[field.key])) return;
72167           var t2 = {};
72168           t2[field.key] = val || void 0;
72169           dispatch14.call("change", this, t2, onInput);
72170         };
72171       }
72172     }
72173     function key(lang) {
72174       return field.key + ":" + lang;
72175     }
72176     function changeLang(d3_event, d2) {
72177       var tags = {};
72178       var lang = utilGetSetValue(select_default2(this)).toLowerCase();
72179       var language = _languagesArray.find(function(d4) {
72180         return d4.label.toLowerCase() === lang || d4.localName && d4.localName.toLowerCase() === lang || d4.nativeName && d4.nativeName.toLowerCase() === lang;
72181       });
72182       if (language) lang = language.code;
72183       if (d2.lang && d2.lang !== lang) {
72184         tags[key(d2.lang)] = void 0;
72185       }
72186       var newKey = lang && context.cleanTagKey(key(lang));
72187       var value = utilGetSetValue(select_default2(this.parentNode).selectAll(".localized-value"));
72188       if (newKey && value) {
72189         tags[newKey] = value;
72190       } else if (newKey && _wikiTitles && _wikiTitles[d2.lang]) {
72191         tags[newKey] = _wikiTitles[d2.lang];
72192       }
72193       d2.lang = lang;
72194       dispatch14.call("change", this, tags);
72195     }
72196     function changeValue(d3_event, d2) {
72197       if (!d2.lang) return;
72198       var value = context.cleanTagValue(utilGetSetValue(select_default2(this))) || void 0;
72199       if (!value && Array.isArray(d2.value)) return;
72200       var t2 = {};
72201       t2[key(d2.lang)] = value;
72202       d2.value = value;
72203       dispatch14.call("change", this, t2);
72204     }
72205     function fetchLanguages(value, cb) {
72206       var v2 = value.toLowerCase();
72207       var langCodes = [_mainLocalizer.localeCode(), _mainLocalizer.languageCode()];
72208       if (_countryCode && _territoryLanguages[_countryCode]) {
72209         langCodes = langCodes.concat(_territoryLanguages[_countryCode]);
72210       }
72211       var langItems = [];
72212       langCodes.forEach(function(code) {
72213         var langItem = _languagesArray.find(function(item) {
72214           return item.code === code;
72215         });
72216         if (langItem) langItems.push(langItem);
72217       });
72218       langItems = utilArrayUniq(langItems.concat(_languagesArray));
72219       cb(langItems.filter(function(d2) {
72220         return d2.label.toLowerCase().indexOf(v2) >= 0 || d2.localName && d2.localName.toLowerCase().indexOf(v2) >= 0 || d2.nativeName && d2.nativeName.toLowerCase().indexOf(v2) >= 0 || d2.code.toLowerCase().indexOf(v2) >= 0;
72221       }).map(function(d2) {
72222         return { value: d2.label };
72223       }));
72224     }
72225     function renderMultilingual(selection2) {
72226       var entries = selection2.selectAll("div.entry").data(_multilingual, function(d2) {
72227         return d2.lang;
72228       });
72229       entries.exit().style("top", "0").style("max-height", "240px").transition().duration(200).style("opacity", "0").style("max-height", "0px").remove();
72230       var entriesEnter = entries.enter().append("div").attr("class", "entry").each(function(_2, index) {
72231         var wrap2 = select_default2(this);
72232         var domId = utilUniqueDomId(index);
72233         var label = wrap2.append("label").attr("class", "field-label").attr("for", domId);
72234         var text = label.append("span").attr("class", "label-text");
72235         text.append("span").attr("class", "label-textvalue").call(_t.append("translate.localized_translation_label"));
72236         text.append("span").attr("class", "label-textannotation");
72237         label.append("button").attr("class", "remove-icon-multilingual").attr("title", _t("icons.remove")).on("click", function(d3_event, d2) {
72238           if (field.locked()) return;
72239           d3_event.preventDefault();
72240           _multilingual.splice(_multilingual.indexOf(d2), 1);
72241           var langKey = d2.lang && key(d2.lang);
72242           if (langKey && langKey in _tags) {
72243             delete _tags[langKey];
72244             var t2 = {};
72245             t2[langKey] = void 0;
72246             dispatch14.call("change", this, t2);
72247             return;
72248           }
72249           renderMultilingual(selection2);
72250         }).call(svgIcon("#iD-operation-delete"));
72251         wrap2.append("input").attr("class", "localized-lang").attr("id", domId).attr("type", "text").attr("placeholder", _t("translate.localized_translation_language")).on("blur", changeLang).on("change", changeLang).call(langCombo);
72252         wrap2.append("input").attr("type", "text").attr("class", "localized-value").on("blur", changeValue).on("change", changeValue);
72253       });
72254       entriesEnter.style("margin-top", "0px").style("max-height", "0px").style("opacity", "0").transition().duration(200).style("margin-top", "10px").style("max-height", "240px").style("opacity", "1").on("end", function() {
72255         select_default2(this).style("max-height", "").style("overflow", "visible");
72256       });
72257       entries = entries.merge(entriesEnter);
72258       entries.order();
72259       entries.classed("present", true);
72260       utilGetSetValue(entries.select(".localized-lang"), function(d2) {
72261         var langItem = _languagesArray.find(function(item) {
72262           return item.code === d2.lang;
72263         });
72264         if (langItem) return langItem.label;
72265         return d2.lang;
72266       });
72267       utilGetSetValue(entries.select(".localized-value"), function(d2) {
72268         return typeof d2.value === "string" ? d2.value : "";
72269       }).attr("title", function(d2) {
72270         return Array.isArray(d2.value) ? d2.value.filter(Boolean).join("\n") : null;
72271       }).attr("placeholder", function(d2) {
72272         return Array.isArray(d2.value) ? _t("inspector.multiple_values") : _t("translate.localized_translation_name");
72273       }).classed("mixed", function(d2) {
72274         return Array.isArray(d2.value);
72275       });
72276     }
72277     localized.tags = function(tags) {
72278       _tags = tags;
72279       if (typeof tags.wikipedia === "string" && !_wikiTitles) {
72280         _wikiTitles = {};
72281         var wm = tags.wikipedia.match(/([^:]+):(.+)/);
72282         if (wm && wm[0] && wm[1]) {
72283           wikipedia.translations(wm[1], wm[2], function(err, d2) {
72284             if (err || !d2) return;
72285             _wikiTitles = d2;
72286           });
72287         }
72288       }
72289       var isMixed = Array.isArray(tags[field.key]);
72290       utilGetSetValue(input, typeof tags[field.key] === "string" ? tags[field.key] : "").attr("title", isMixed ? tags[field.key].filter(Boolean).join("\n") : void 0).attr("placeholder", isMixed ? _t("inspector.multiple_values") : field.placeholder()).classed("mixed", isMixed);
72291       calcMultilingual(tags);
72292       _selection.call(localized);
72293       if (!isMixed) {
72294         _lengthIndicator.update(tags[field.key]);
72295       }
72296     };
72297     localized.focus = function() {
72298       input.node().focus();
72299     };
72300     localized.entityIDs = function(val) {
72301       if (!arguments.length) return _entityIDs;
72302       _entityIDs = val;
72303       _multilingual = [];
72304       loadCountryCode();
72305       return localized;
72306     };
72307     function loadCountryCode() {
72308       var extent = combinedEntityExtent();
72309       var countryCode = extent && iso1A2Code(extent.center());
72310       _countryCode = countryCode && countryCode.toLowerCase();
72311     }
72312     function combinedEntityExtent() {
72313       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
72314     }
72315     return utilRebind(localized, dispatch14, "on");
72316   }
72317
72318   // modules/ui/fields/roadheight.js
72319   function uiFieldRoadheight(field, context) {
72320     var dispatch14 = dispatch_default("change");
72321     var primaryUnitInput = select_default2(null);
72322     var primaryInput = select_default2(null);
72323     var secondaryInput = select_default2(null);
72324     var secondaryUnitInput = select_default2(null);
72325     var _entityIDs = [];
72326     var _tags;
72327     var _isImperial;
72328     var formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
72329     var parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
72330     var primaryUnits = [
72331       {
72332         value: "m",
72333         title: _t("inspector.roadheight.meter")
72334       },
72335       {
72336         value: "ft",
72337         title: _t("inspector.roadheight.foot")
72338       }
72339     ];
72340     var unitCombo = uiCombobox(context, "roadheight-unit").data(primaryUnits);
72341     function roadheight(selection2) {
72342       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
72343       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
72344       primaryInput = wrap2.selectAll("input.roadheight-number").data([0]);
72345       primaryInput = primaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-number").attr("id", field.domId).call(utilNoAuto).merge(primaryInput);
72346       primaryInput.on("change", change).on("blur", change);
72347       var loc = combinedEntityExtent().center();
72348       _isImperial = roadHeightUnit(loc) === "ft";
72349       primaryUnitInput = wrap2.selectAll("input.roadheight-unit").data([0]);
72350       primaryUnitInput = primaryUnitInput.enter().append("input").attr("type", "text").attr("class", "roadheight-unit").call(unitCombo).merge(primaryUnitInput);
72351       primaryUnitInput.on("blur", changeUnits).on("change", changeUnits);
72352       secondaryInput = wrap2.selectAll("input.roadheight-secondary-number").data([0]);
72353       secondaryInput = secondaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-secondary-number").call(utilNoAuto).merge(secondaryInput);
72354       secondaryInput.on("change", change).on("blur", change);
72355       secondaryUnitInput = wrap2.selectAll("input.roadheight-secondary-unit").data([0]);
72356       secondaryUnitInput = secondaryUnitInput.enter().append("input").attr("type", "text").call(utilNoAuto).classed("disabled", true).classed("roadheight-secondary-unit", true).attr("readonly", "readonly").merge(secondaryUnitInput);
72357       function changeUnits() {
72358         var primaryUnit = utilGetSetValue(primaryUnitInput);
72359         if (primaryUnit === "m") {
72360           _isImperial = false;
72361         } else if (primaryUnit === "ft") {
72362           _isImperial = true;
72363         }
72364         utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
72365         setUnitSuggestions();
72366         change();
72367       }
72368     }
72369     function setUnitSuggestions() {
72370       utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
72371     }
72372     function change() {
72373       var tag2 = {};
72374       var primaryValue = utilGetSetValue(primaryInput).trim();
72375       var secondaryValue = utilGetSetValue(secondaryInput).trim();
72376       if (!primaryValue && !secondaryValue && Array.isArray(_tags[field.key])) return;
72377       if (!primaryValue && !secondaryValue) {
72378         tag2[field.key] = void 0;
72379       } else {
72380         var rawPrimaryValue = likelyRawNumberFormat.test(primaryValue) ? parseFloat(primaryValue) : parseLocaleFloat(primaryValue);
72381         if (isNaN(rawPrimaryValue)) rawPrimaryValue = primaryValue;
72382         var rawSecondaryValue = likelyRawNumberFormat.test(secondaryValue) ? parseFloat(secondaryValue) : parseLocaleFloat(secondaryValue);
72383         if (isNaN(rawSecondaryValue)) rawSecondaryValue = secondaryValue;
72384         if (isNaN(rawPrimaryValue) || isNaN(rawSecondaryValue) || !_isImperial) {
72385           tag2[field.key] = context.cleanTagValue(rawPrimaryValue);
72386         } else {
72387           if (rawPrimaryValue !== "") {
72388             rawPrimaryValue = rawPrimaryValue + "'";
72389           }
72390           if (rawSecondaryValue !== "") {
72391             rawSecondaryValue = rawSecondaryValue + '"';
72392           }
72393           tag2[field.key] = context.cleanTagValue(rawPrimaryValue + rawSecondaryValue);
72394         }
72395       }
72396       dispatch14.call("change", this, tag2);
72397     }
72398     roadheight.tags = function(tags) {
72399       _tags = tags;
72400       var primaryValue = tags[field.key];
72401       var secondaryValue;
72402       var isMixed = Array.isArray(primaryValue);
72403       if (!isMixed) {
72404         if (primaryValue && (primaryValue.indexOf("'") >= 0 || primaryValue.indexOf('"') >= 0)) {
72405           secondaryValue = primaryValue.match(/(-?[\d.]+)"/);
72406           if (secondaryValue !== null) {
72407             secondaryValue = formatFloat(parseFloat(secondaryValue[1]));
72408           }
72409           primaryValue = primaryValue.match(/(-?[\d.]+)'/);
72410           if (primaryValue !== null) {
72411             primaryValue = formatFloat(parseFloat(primaryValue[1]));
72412           }
72413           _isImperial = true;
72414         } else if (primaryValue) {
72415           var rawValue = primaryValue;
72416           primaryValue = parseFloat(rawValue);
72417           if (isNaN(primaryValue)) {
72418             primaryValue = rawValue;
72419           } else {
72420             primaryValue = formatFloat(primaryValue);
72421           }
72422           _isImperial = false;
72423         }
72424       }
72425       setUnitSuggestions();
72426       var inchesPlaceholder = formatFloat(0);
72427       utilGetSetValue(primaryInput, typeof primaryValue === "string" ? primaryValue : "").attr("title", isMixed ? primaryValue.filter(Boolean).join("\n") : null).attr("placeholder", isMixed ? _t("inspector.multiple_values") : _t("inspector.unknown")).classed("mixed", isMixed);
72428       utilGetSetValue(secondaryInput, typeof secondaryValue === "string" ? secondaryValue : "").attr("placeholder", isMixed ? _t("inspector.multiple_values") : _isImperial ? inchesPlaceholder : null).classed("mixed", isMixed).classed("disabled", !_isImperial).attr("readonly", _isImperial ? null : "readonly");
72429       secondaryUnitInput.attr("value", _isImperial ? _t("inspector.roadheight.inch") : null);
72430     };
72431     roadheight.focus = function() {
72432       primaryInput.node().focus();
72433     };
72434     roadheight.entityIDs = function(val) {
72435       _entityIDs = val;
72436     };
72437     function combinedEntityExtent() {
72438       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
72439     }
72440     return utilRebind(roadheight, dispatch14, "on");
72441   }
72442
72443   // modules/ui/fields/roadspeed.js
72444   function uiFieldRoadspeed(field, context) {
72445     var dispatch14 = dispatch_default("change");
72446     var unitInput = select_default2(null);
72447     var input = select_default2(null);
72448     var _entityIDs = [];
72449     var _tags;
72450     var _isImperial;
72451     var formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
72452     var parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
72453     var speedCombo = uiCombobox(context, "roadspeed");
72454     var unitCombo = uiCombobox(context, "roadspeed-unit").data(["km/h", "mph"].map(comboValues));
72455     var metricValues = [20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120];
72456     var imperialValues = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80];
72457     function roadspeed(selection2) {
72458       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
72459       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
72460       input = wrap2.selectAll("input.roadspeed-number").data([0]);
72461       input = input.enter().append("input").attr("type", "text").attr("class", "roadspeed-number").attr("id", field.domId).call(utilNoAuto).call(speedCombo).merge(input);
72462       input.on("change", change).on("blur", change);
72463       var loc = combinedEntityExtent().center();
72464       _isImperial = roadSpeedUnit(loc) === "mph";
72465       unitInput = wrap2.selectAll("input.roadspeed-unit").data([0]);
72466       unitInput = unitInput.enter().append("input").attr("type", "text").attr("class", "roadspeed-unit").attr("aria-label", _t("inspector.speed_unit")).call(unitCombo).merge(unitInput);
72467       unitInput.on("blur", changeUnits).on("change", changeUnits);
72468       function changeUnits() {
72469         var unit2 = utilGetSetValue(unitInput);
72470         if (unit2 === "km/h") {
72471           _isImperial = false;
72472         } else if (unit2 === "mph") {
72473           _isImperial = true;
72474         }
72475         utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
72476         setUnitSuggestions();
72477         change();
72478       }
72479     }
72480     function setUnitSuggestions() {
72481       speedCombo.data((_isImperial ? imperialValues : metricValues).map(comboValues));
72482       utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
72483     }
72484     function comboValues(d2) {
72485       return {
72486         value: formatFloat(d2),
72487         title: formatFloat(d2)
72488       };
72489     }
72490     function change() {
72491       var tag2 = {};
72492       var value = utilGetSetValue(input).trim();
72493       if (!value && Array.isArray(_tags[field.key])) return;
72494       if (!value) {
72495         tag2[field.key] = void 0;
72496       } else {
72497         var rawValue = likelyRawNumberFormat.test(value) ? parseFloat(value) : parseLocaleFloat(value);
72498         if (isNaN(rawValue)) rawValue = value;
72499         if (isNaN(rawValue) || !_isImperial) {
72500           tag2[field.key] = context.cleanTagValue(rawValue);
72501         } else {
72502           tag2[field.key] = context.cleanTagValue(rawValue + " mph");
72503         }
72504       }
72505       dispatch14.call("change", this, tag2);
72506     }
72507     roadspeed.tags = function(tags) {
72508       _tags = tags;
72509       var rawValue = tags[field.key];
72510       var value = rawValue;
72511       var isMixed = Array.isArray(value);
72512       if (!isMixed) {
72513         if (rawValue && rawValue.indexOf("mph") >= 0) {
72514           _isImperial = true;
72515         } else if (rawValue) {
72516           _isImperial = false;
72517         }
72518         value = parseInt(value, 10);
72519         if (isNaN(value)) {
72520           value = rawValue;
72521         } else {
72522           value = formatFloat(value);
72523         }
72524       }
72525       setUnitSuggestions();
72526       utilGetSetValue(input, typeof value === "string" ? value : "").attr("title", isMixed ? value.filter(Boolean).join("\n") : null).attr("placeholder", isMixed ? _t("inspector.multiple_values") : field.placeholder()).classed("mixed", isMixed);
72527     };
72528     roadspeed.focus = function() {
72529       input.node().focus();
72530     };
72531     roadspeed.entityIDs = function(val) {
72532       _entityIDs = val;
72533     };
72534     function combinedEntityExtent() {
72535       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
72536     }
72537     return utilRebind(roadspeed, dispatch14, "on");
72538   }
72539
72540   // modules/ui/fields/radio.js
72541   function uiFieldRadio(field, context) {
72542     var dispatch14 = dispatch_default("change");
72543     var placeholder = select_default2(null);
72544     var wrap2 = select_default2(null);
72545     var labels = select_default2(null);
72546     var radios = select_default2(null);
72547     var radioData = (field.options || field.keys).slice();
72548     var typeField;
72549     var layerField;
72550     var _oldType = {};
72551     var _entityIDs = [];
72552     function selectedKey() {
72553       var node = wrap2.selectAll(".form-field-input-radio label.active input");
72554       return !node.empty() && node.datum();
72555     }
72556     function radio(selection2) {
72557       selection2.classed("preset-radio", true);
72558       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
72559       var enter = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-radio");
72560       enter.append("span").attr("class", "placeholder");
72561       wrap2 = wrap2.merge(enter);
72562       placeholder = wrap2.selectAll(".placeholder");
72563       labels = wrap2.selectAll("label").data(radioData);
72564       enter = labels.enter().append("label");
72565       var stringsField = field.resolveReference("stringsCrossReference");
72566       enter.append("input").attr("type", "radio").attr("name", field.id).attr("value", function(d2) {
72567         return stringsField.t("options." + d2, { "default": d2 });
72568       }).attr("checked", false);
72569       enter.append("span").each(function(d2) {
72570         stringsField.t.append("options." + d2, { "default": d2 })(select_default2(this));
72571       });
72572       labels = labels.merge(enter);
72573       radios = labels.selectAll("input").on("change", changeRadio);
72574     }
72575     function structureExtras(selection2, tags) {
72576       var selected = selectedKey() || tags.layer !== void 0;
72577       var type2 = _mainPresetIndex.field(selected);
72578       var layer = _mainPresetIndex.field("layer");
72579       var showLayer = selected === "bridge" || selected === "tunnel" || tags.layer !== void 0;
72580       var extrasWrap = selection2.selectAll(".structure-extras-wrap").data(selected ? [0] : []);
72581       extrasWrap.exit().remove();
72582       extrasWrap = extrasWrap.enter().append("div").attr("class", "structure-extras-wrap").merge(extrasWrap);
72583       var list2 = extrasWrap.selectAll("ul").data([0]);
72584       list2 = list2.enter().append("ul").attr("class", "rows").merge(list2);
72585       if (type2) {
72586         if (!typeField || typeField.id !== selected) {
72587           typeField = uiField(context, type2, _entityIDs, { wrap: false }).on("change", changeType);
72588         }
72589         typeField.tags(tags);
72590       } else {
72591         typeField = null;
72592       }
72593       var typeItem = list2.selectAll(".structure-type-item").data(typeField ? [typeField] : [], function(d2) {
72594         return d2.id;
72595       });
72596       typeItem.exit().remove();
72597       var typeEnter = typeItem.enter().insert("li", ":first-child").attr("class", "labeled-input structure-type-item");
72598       typeEnter.append("div").attr("class", "label structure-label-type").attr("for", "preset-input-" + selected).call(_t.append("inspector.radio.structure.type"));
72599       typeEnter.append("div").attr("class", "structure-input-type-wrap");
72600       typeItem = typeItem.merge(typeEnter);
72601       if (typeField) {
72602         typeItem.selectAll(".structure-input-type-wrap").call(typeField.render);
72603       }
72604       if (layer && showLayer) {
72605         if (!layerField) {
72606           layerField = uiField(context, layer, _entityIDs, { wrap: false }).on("change", changeLayer);
72607         }
72608         layerField.tags(tags);
72609         field.keys = utilArrayUnion(field.keys, ["layer"]);
72610       } else {
72611         layerField = null;
72612         field.keys = field.keys.filter(function(k2) {
72613           return k2 !== "layer";
72614         });
72615       }
72616       var layerItem = list2.selectAll(".structure-layer-item").data(layerField ? [layerField] : []);
72617       layerItem.exit().remove();
72618       var layerEnter = layerItem.enter().append("li").attr("class", "labeled-input structure-layer-item");
72619       layerEnter.append("div").attr("class", "label structure-label-layer").attr("for", "preset-input-layer").call(_t.append("inspector.radio.structure.layer"));
72620       layerEnter.append("div").attr("class", "structure-input-layer-wrap");
72621       layerItem = layerItem.merge(layerEnter);
72622       if (layerField) {
72623         layerItem.selectAll(".structure-input-layer-wrap").call(layerField.render);
72624       }
72625     }
72626     function changeType(t2, onInput) {
72627       var key = selectedKey();
72628       if (!key) return;
72629       var val = t2[key];
72630       if (val !== "no") {
72631         _oldType[key] = val;
72632       }
72633       if (field.type === "structureRadio") {
72634         if (val === "no" || key !== "bridge" && key !== "tunnel" || key === "tunnel" && val === "building_passage") {
72635           t2.layer = void 0;
72636         }
72637         if (t2.layer === void 0) {
72638           if (key === "bridge" && val !== "no") {
72639             t2.layer = "1";
72640           }
72641           if (key === "tunnel" && val !== "no" && val !== "building_passage") {
72642             t2.layer = "-1";
72643           }
72644         }
72645       }
72646       dispatch14.call("change", this, t2, onInput);
72647     }
72648     function changeLayer(t2, onInput) {
72649       if (t2.layer === "0") {
72650         t2.layer = void 0;
72651       }
72652       dispatch14.call("change", this, t2, onInput);
72653     }
72654     function changeRadio() {
72655       var t2 = {};
72656       var activeKey;
72657       if (field.key) {
72658         t2[field.key] = void 0;
72659       }
72660       radios.each(function(d2) {
72661         var active = select_default2(this).property("checked");
72662         if (active) activeKey = d2;
72663         if (field.key) {
72664           if (active) t2[field.key] = d2;
72665         } else {
72666           var val = _oldType[activeKey] || "yes";
72667           t2[d2] = active ? val : void 0;
72668         }
72669       });
72670       if (field.type === "structureRadio") {
72671         if (activeKey === "bridge") {
72672           t2.layer = "1";
72673         } else if (activeKey === "tunnel" && t2.tunnel !== "building_passage") {
72674           t2.layer = "-1";
72675         } else {
72676           t2.layer = void 0;
72677         }
72678       }
72679       dispatch14.call("change", this, t2);
72680     }
72681     radio.tags = function(tags) {
72682       function isOptionChecked(d2) {
72683         if (field.key) {
72684           return tags[field.key] === d2;
72685         }
72686         return !!(typeof tags[d2] === "string" && tags[d2].toLowerCase() !== "no");
72687       }
72688       function isMixed(d2) {
72689         if (field.key) {
72690           return Array.isArray(tags[field.key]) && tags[field.key].includes(d2);
72691         }
72692         return Array.isArray(tags[d2]);
72693       }
72694       radios.property("checked", function(d2) {
72695         return isOptionChecked(d2) && (field.key || field.options.filter(isOptionChecked).length === 1);
72696       });
72697       labels.classed("active", function(d2) {
72698         if (field.key) {
72699           return Array.isArray(tags[field.key]) && tags[field.key].includes(d2) || tags[field.key] === d2;
72700         }
72701         return Array.isArray(tags[d2]) && tags[d2].some((v2) => typeof v2 === "string" && v2.toLowerCase() !== "no") || !!(typeof tags[d2] === "string" && tags[d2].toLowerCase() !== "no");
72702       }).classed("mixed", isMixed).attr("title", function(d2) {
72703         return isMixed(d2) ? _t("inspector.unshared_value_tooltip") : null;
72704       });
72705       var selection2 = radios.filter(function() {
72706         return this.checked;
72707       });
72708       if (selection2.empty()) {
72709         placeholder.text("");
72710         placeholder.call(_t.append("inspector.none"));
72711       } else {
72712         placeholder.text(selection2.attr("value"));
72713         _oldType[selection2.datum()] = tags[selection2.datum()];
72714       }
72715       if (field.type === "structureRadio") {
72716         if (!!tags.waterway && !_oldType.tunnel) {
72717           _oldType.tunnel = "culvert";
72718         }
72719         wrap2.call(structureExtras, tags);
72720       }
72721     };
72722     radio.focus = function() {
72723       radios.node().focus();
72724     };
72725     radio.entityIDs = function(val) {
72726       if (!arguments.length) return _entityIDs;
72727       _entityIDs = val;
72728       _oldType = {};
72729       return radio;
72730     };
72731     radio.isAllowed = function() {
72732       return _entityIDs.length === 1;
72733     };
72734     return utilRebind(radio, dispatch14, "on");
72735   }
72736
72737   // modules/ui/fields/restrictions.js
72738   function uiFieldRestrictions(field, context) {
72739     var dispatch14 = dispatch_default("change");
72740     var breathe = behaviorBreathe(context);
72741     corePreferences("turn-restriction-via-way", null);
72742     var storedViaWay = corePreferences("turn-restriction-via-way0");
72743     var storedDistance = corePreferences("turn-restriction-distance");
72744     var _maxViaWay = storedViaWay !== null ? +storedViaWay : 0;
72745     var _maxDistance = storedDistance ? +storedDistance : 30;
72746     var _initialized3 = false;
72747     var _parent = select_default2(null);
72748     var _container = select_default2(null);
72749     var _oldTurns;
72750     var _graph;
72751     var _vertexID;
72752     var _intersection;
72753     var _fromWayID;
72754     var _lastXPos;
72755     function restrictions(selection2) {
72756       _parent = selection2;
72757       if (_vertexID && (context.graph() !== _graph || !_intersection)) {
72758         _graph = context.graph();
72759         _intersection = osmIntersection(_graph, _vertexID, _maxDistance);
72760       }
72761       var isOK = _intersection && _intersection.vertices.length && // has vertices
72762       _intersection.vertices.filter(function(vertex) {
72763         return vertex.id === _vertexID;
72764       }).length && _intersection.ways.length > 2;
72765       select_default2(selection2.node().parentNode).classed("hide", !isOK);
72766       if (!isOK || !context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode || !selection2.node().parentNode.parentNode) {
72767         selection2.call(restrictions.off);
72768         return;
72769       }
72770       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
72771       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
72772       var container = wrap2.selectAll(".restriction-container").data([0]);
72773       var containerEnter = container.enter().append("div").attr("class", "restriction-container");
72774       containerEnter.append("div").attr("class", "restriction-help");
72775       _container = containerEnter.merge(container).call(renderViewer);
72776       var controls = wrap2.selectAll(".restriction-controls").data([0]);
72777       controls.enter().append("div").attr("class", "restriction-controls-container").append("div").attr("class", "restriction-controls").merge(controls).call(renderControls);
72778     }
72779     function renderControls(selection2) {
72780       var distControl = selection2.selectAll(".restriction-distance").data([0]);
72781       distControl.exit().remove();
72782       var distControlEnter = distControl.enter().append("div").attr("class", "restriction-control restriction-distance");
72783       distControlEnter.append("span").attr("class", "restriction-control-label restriction-distance-label").call(_t.append("restriction.controls.distance", { suffix: ":" }));
72784       distControlEnter.append("input").attr("class", "restriction-distance-input").attr("type", "range").attr("min", "20").attr("max", "50").attr("step", "5");
72785       distControlEnter.append("span").attr("class", "restriction-distance-text");
72786       selection2.selectAll(".restriction-distance-input").property("value", _maxDistance).on("input", function() {
72787         var val = select_default2(this).property("value");
72788         _maxDistance = +val;
72789         _intersection = null;
72790         _container.selectAll(".layer-osm .layer-turns *").remove();
72791         corePreferences("turn-restriction-distance", _maxDistance);
72792         _parent.call(restrictions);
72793       });
72794       selection2.selectAll(".restriction-distance-text").call(displayMaxDistance(_maxDistance));
72795       var viaControl = selection2.selectAll(".restriction-via-way").data([0]);
72796       viaControl.exit().remove();
72797       var viaControlEnter = viaControl.enter().append("div").attr("class", "restriction-control restriction-via-way");
72798       viaControlEnter.append("span").attr("class", "restriction-control-label restriction-via-way-label").call(_t.append("restriction.controls.via", { suffix: ":" }));
72799       viaControlEnter.append("input").attr("class", "restriction-via-way-input").attr("type", "range").attr("min", "0").attr("max", "2").attr("step", "1");
72800       viaControlEnter.append("span").attr("class", "restriction-via-way-text");
72801       selection2.selectAll(".restriction-via-way-input").property("value", _maxViaWay).on("input", function() {
72802         var val = select_default2(this).property("value");
72803         _maxViaWay = +val;
72804         _container.selectAll(".layer-osm .layer-turns *").remove();
72805         corePreferences("turn-restriction-via-way0", _maxViaWay);
72806         _parent.call(restrictions);
72807       });
72808       selection2.selectAll(".restriction-via-way-text").call(displayMaxVia(_maxViaWay));
72809     }
72810     function renderViewer(selection2) {
72811       if (!_intersection) return;
72812       var vgraph = _intersection.graph;
72813       var filter2 = utilFunctor(true);
72814       var projection2 = geoRawMercator();
72815       var sdims = utilGetDimensions(context.container().select(".sidebar"));
72816       var d2 = [sdims[0] - 50, 370];
72817       var c2 = geoVecScale(d2, 0.5);
72818       var z2 = 22;
72819       projection2.scale(geoZoomToScale(z2));
72820       var extent = geoExtent();
72821       for (var i3 = 0; i3 < _intersection.vertices.length; i3++) {
72822         extent._extend(_intersection.vertices[i3].extent());
72823       }
72824       var padTop = 35;
72825       if (_intersection.vertices.length > 1) {
72826         var hPadding = Math.min(160, Math.max(110, d2[0] * 0.4));
72827         var vPadding = 160;
72828         var tl = projection2([extent[0][0], extent[1][1]]);
72829         var br2 = projection2([extent[1][0], extent[0][1]]);
72830         var hFactor = (br2[0] - tl[0]) / (d2[0] - hPadding);
72831         var vFactor = (br2[1] - tl[1]) / (d2[1] - vPadding - padTop);
72832         var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
72833         var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
72834         z2 = z2 - Math.max(hZoomDiff, vZoomDiff);
72835         projection2.scale(geoZoomToScale(z2));
72836       }
72837       var extentCenter = projection2(extent.center());
72838       extentCenter[1] = extentCenter[1] - padTop / 2;
72839       projection2.translate(geoVecSubtract(c2, extentCenter)).clipExtent([[0, 0], d2]);
72840       var drawLayers = svgLayers(projection2, context).only(["osm", "touch"]).dimensions(d2);
72841       var drawVertices = svgVertices(projection2, context);
72842       var drawLines = svgLines(projection2, context);
72843       var drawTurns = svgTurns(projection2, context);
72844       var firstTime = selection2.selectAll(".surface").empty();
72845       selection2.call(drawLayers);
72846       var surface = selection2.selectAll(".surface").classed("tr", true);
72847       if (firstTime) {
72848         _initialized3 = true;
72849         surface.call(breathe);
72850       }
72851       if (_fromWayID && !vgraph.hasEntity(_fromWayID)) {
72852         _fromWayID = null;
72853         _oldTurns = null;
72854       }
72855       surface.call(utilSetDimensions, d2).call(drawVertices, vgraph, _intersection.vertices, filter2, extent, z2).call(drawLines, vgraph, _intersection.ways, filter2).call(drawTurns, vgraph, _intersection.turns(_fromWayID, _maxViaWay));
72856       surface.on("click.restrictions", click).on("mouseover.restrictions", mouseover);
72857       surface.selectAll(".selected").classed("selected", false);
72858       surface.selectAll(".related").classed("related", false);
72859       var way;
72860       if (_fromWayID) {
72861         way = vgraph.entity(_fromWayID);
72862         surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
72863       }
72864       document.addEventListener("resizeWindow", function() {
72865         utilSetDimensions(_container, null);
72866         redraw(1);
72867       }, false);
72868       updateHints(null);
72869       function click(d3_event) {
72870         surface.call(breathe.off).call(breathe);
72871         var datum2 = d3_event.target.__data__;
72872         var entity = datum2 && datum2.properties && datum2.properties.entity;
72873         if (entity) {
72874           datum2 = entity;
72875         }
72876         if (datum2 instanceof osmWay && (datum2.__from || datum2.__via)) {
72877           _fromWayID = datum2.id;
72878           _oldTurns = null;
72879           redraw();
72880         } else if (datum2 instanceof osmTurn) {
72881           var actions, extraActions, turns, i4;
72882           var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
72883           if (datum2.restrictionID && !datum2.direct) {
72884             return;
72885           } else if (datum2.restrictionID && !datum2.only) {
72886             var seen = {};
72887             var datumOnly = JSON.parse(JSON.stringify(datum2));
72888             datumOnly.only = true;
72889             restrictionType = restrictionType.replace(/^no/, "only");
72890             turns = _intersection.turns(_fromWayID, 2);
72891             extraActions = [];
72892             _oldTurns = [];
72893             for (i4 = 0; i4 < turns.length; i4++) {
72894               var turn = turns[i4];
72895               if (seen[turn.restrictionID]) continue;
72896               if (turn.direct && turn.path[1] === datum2.path[1]) {
72897                 seen[turns[i4].restrictionID] = true;
72898                 turn.restrictionType = osmInferRestriction(vgraph, turn, projection2);
72899                 _oldTurns.push(turn);
72900                 extraActions.push(actionUnrestrictTurn(turn));
72901               }
72902             }
72903             actions = _intersection.actions.concat(extraActions, [
72904               actionRestrictTurn(datumOnly, restrictionType),
72905               _t("operations.restriction.annotation.create")
72906             ]);
72907           } else if (datum2.restrictionID) {
72908             turns = _oldTurns || [];
72909             extraActions = [];
72910             for (i4 = 0; i4 < turns.length; i4++) {
72911               if (turns[i4].key !== datum2.key) {
72912                 extraActions.push(actionRestrictTurn(turns[i4], turns[i4].restrictionType));
72913               }
72914             }
72915             _oldTurns = null;
72916             actions = _intersection.actions.concat(extraActions, [
72917               actionUnrestrictTurn(datum2),
72918               _t("operations.restriction.annotation.delete")
72919             ]);
72920           } else {
72921             actions = _intersection.actions.concat([
72922               actionRestrictTurn(datum2, restrictionType),
72923               _t("operations.restriction.annotation.create")
72924             ]);
72925           }
72926           context.perform.apply(context, actions);
72927           var s2 = surface.selectAll("." + datum2.key);
72928           datum2 = s2.empty() ? null : s2.datum();
72929           updateHints(datum2);
72930         } else {
72931           _fromWayID = null;
72932           _oldTurns = null;
72933           redraw();
72934         }
72935       }
72936       function mouseover(d3_event) {
72937         var datum2 = d3_event.target.__data__;
72938         updateHints(datum2);
72939       }
72940       _lastXPos = _lastXPos || sdims[0];
72941       function redraw(minChange) {
72942         var xPos = -1;
72943         if (minChange) {
72944           xPos = utilGetDimensions(context.container().select(".sidebar"))[0];
72945         }
72946         if (!minChange || minChange && Math.abs(xPos - _lastXPos) >= minChange) {
72947           if (context.hasEntity(_vertexID)) {
72948             _lastXPos = xPos;
72949             _container.call(renderViewer);
72950           }
72951         }
72952       }
72953       function highlightPathsFrom(wayID) {
72954         surface.selectAll(".related").classed("related", false).classed("allow", false).classed("restrict", false).classed("only", false);
72955         surface.selectAll("." + wayID).classed("related", true);
72956         if (wayID) {
72957           var turns = _intersection.turns(wayID, _maxViaWay);
72958           for (var i4 = 0; i4 < turns.length; i4++) {
72959             var turn = turns[i4];
72960             var ids = [turn.to.way];
72961             var klass = turn.no ? "restrict" : turn.only ? "only" : "allow";
72962             if (turn.only || turns.length === 1) {
72963               if (turn.via.ways) {
72964                 ids = ids.concat(turn.via.ways);
72965               }
72966             } else if (turn.to.way === wayID) {
72967               continue;
72968             }
72969             surface.selectAll(utilEntitySelector(ids)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
72970           }
72971         }
72972       }
72973       function updateHints(datum2) {
72974         var help = _container.selectAll(".restriction-help").html("");
72975         var placeholders = {};
72976         ["from", "via", "to"].forEach(function(k2) {
72977           placeholders[k2] = { html: '<span class="qualifier">' + _t("restriction.help." + k2) + "</span>" };
72978         });
72979         var entity = datum2 && datum2.properties && datum2.properties.entity;
72980         if (entity) {
72981           datum2 = entity;
72982         }
72983         if (_fromWayID) {
72984           way = vgraph.entity(_fromWayID);
72985           surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
72986         }
72987         if (datum2 instanceof osmWay && datum2.__from) {
72988           way = datum2;
72989           highlightPathsFrom(_fromWayID ? null : way.id);
72990           surface.selectAll("." + way.id).classed("related", true);
72991           var clickSelect = !_fromWayID || _fromWayID !== way.id;
72992           help.append("div").html(_t.html("restriction.help." + (clickSelect ? "select_from_name" : "from_name"), {
72993             from: placeholders.from,
72994             fromName: displayName(way.id, vgraph)
72995           }));
72996         } else if (datum2 instanceof osmTurn) {
72997           var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
72998           var turnType = restrictionType.replace(/^(only|no)\_/, "");
72999           var indirect = datum2.direct === false ? _t.html("restriction.help.indirect") : "";
73000           var klass, turnText, nextText;
73001           if (datum2.no) {
73002             klass = "restrict";
73003             turnText = _t.html("restriction.help.turn.no_" + turnType, { indirect: { html: indirect } });
73004             nextText = _t.html("restriction.help.turn.only_" + turnType, { indirect: "" });
73005           } else if (datum2.only) {
73006             klass = "only";
73007             turnText = _t.html("restriction.help.turn.only_" + turnType, { indirect: { html: indirect } });
73008             nextText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: "" });
73009           } else {
73010             klass = "allow";
73011             turnText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: { html: indirect } });
73012             nextText = _t.html("restriction.help.turn.no_" + turnType, { indirect: "" });
73013           }
73014           help.append("div").attr("class", "qualifier " + klass).html(turnText);
73015           help.append("div").html(_t.html("restriction.help.from_name_to_name", {
73016             from: placeholders.from,
73017             fromName: displayName(datum2.from.way, vgraph),
73018             to: placeholders.to,
73019             toName: displayName(datum2.to.way, vgraph)
73020           }));
73021           if (datum2.via.ways && datum2.via.ways.length) {
73022             var names = [];
73023             for (var i4 = 0; i4 < datum2.via.ways.length; i4++) {
73024               var prev = names[names.length - 1];
73025               var curr = displayName(datum2.via.ways[i4], vgraph);
73026               if (!prev || curr !== prev) {
73027                 names.push(curr);
73028               }
73029             }
73030             help.append("div").html(_t.html("restriction.help.via_names", {
73031               via: placeholders.via,
73032               viaNames: names.join(", ")
73033             }));
73034           }
73035           if (!indirect) {
73036             help.append("div").html(_t.html("restriction.help.toggle", { turn: { html: nextText.trim() } }));
73037           }
73038           highlightPathsFrom(null);
73039           var alongIDs = datum2.path.slice();
73040           surface.selectAll(utilEntitySelector(alongIDs)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
73041         } else {
73042           highlightPathsFrom(null);
73043           if (_fromWayID) {
73044             help.append("div").html(_t.html("restriction.help.from_name", {
73045               from: placeholders.from,
73046               fromName: displayName(_fromWayID, vgraph)
73047             }));
73048           } else {
73049             help.append("div").html(_t.html("restriction.help.select_from", {
73050               from: placeholders.from
73051             }));
73052           }
73053         }
73054       }
73055     }
73056     function displayMaxDistance(maxDist) {
73057       return (selection2) => {
73058         var isImperial = !_mainLocalizer.usesMetric();
73059         var opts;
73060         if (isImperial) {
73061           var distToFeet = {
73062             // imprecise conversion for prettier display
73063             20: 70,
73064             25: 85,
73065             30: 100,
73066             35: 115,
73067             40: 130,
73068             45: 145,
73069             50: 160
73070           }[maxDist];
73071           opts = { distance: _t("units.feet", { quantity: distToFeet }) };
73072         } else {
73073           opts = { distance: _t("units.meters", { quantity: maxDist }) };
73074         }
73075         return selection2.html("").call(_t.append("restriction.controls.distance_up_to", opts));
73076       };
73077     }
73078     function displayMaxVia(maxVia) {
73079       return (selection2) => {
73080         selection2 = selection2.html("");
73081         return maxVia === 0 ? selection2.call(_t.append("restriction.controls.via_node_only")) : maxVia === 1 ? selection2.call(_t.append("restriction.controls.via_up_to_one")) : selection2.call(_t.append("restriction.controls.via_up_to_two"));
73082       };
73083     }
73084     function displayName(entityID, graph) {
73085       var entity = graph.entity(entityID);
73086       var name = utilDisplayName(entity) || "";
73087       var matched = _mainPresetIndex.match(entity, graph);
73088       var type2 = matched && matched.name() || utilDisplayType(entity.id);
73089       return name || type2;
73090     }
73091     restrictions.entityIDs = function(val) {
73092       _intersection = null;
73093       _fromWayID = null;
73094       _oldTurns = null;
73095       _vertexID = val[0];
73096     };
73097     restrictions.tags = function() {
73098     };
73099     restrictions.focus = function() {
73100     };
73101     restrictions.off = function(selection2) {
73102       if (!_initialized3) return;
73103       selection2.selectAll(".surface").call(breathe.off).on("click.restrictions", null).on("mouseover.restrictions", null);
73104       select_default2(window).on("resize.restrictions", null);
73105     };
73106     return utilRebind(restrictions, dispatch14, "on");
73107   }
73108   uiFieldRestrictions.supportsMultiselection = false;
73109
73110   // modules/ui/fields/textarea.js
73111   function uiFieldTextarea(field, context) {
73112     var dispatch14 = dispatch_default("change");
73113     var input = select_default2(null);
73114     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue()).silent(field.usage === "changeset" && field.key === "comment");
73115     var _tags;
73116     function textarea(selection2) {
73117       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
73118       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).style("position", "relative").merge(wrap2);
73119       input = wrap2.selectAll("textarea").data([0]);
73120       input = input.enter().append("textarea").attr("id", field.domId).call(utilNoAuto).on("input", change(true)).on("blur", change()).on("change", change()).merge(input);
73121       wrap2.call(_lengthIndicator);
73122       function change(onInput) {
73123         return function() {
73124           var val = utilGetSetValue(input);
73125           if (!onInput) val = context.cleanTagValue(val);
73126           if (!val && Array.isArray(_tags[field.key])) return;
73127           var t2 = {};
73128           t2[field.key] = val || void 0;
73129           dispatch14.call("change", this, t2, onInput);
73130         };
73131       }
73132     }
73133     textarea.tags = function(tags) {
73134       _tags = tags;
73135       var isMixed = Array.isArray(tags[field.key]);
73136       utilGetSetValue(input, !isMixed && tags[field.key] ? tags[field.key] : "").attr("title", isMixed ? tags[field.key].filter(Boolean).join("\n") : void 0).attr("placeholder", isMixed ? _t("inspector.multiple_values") : field.placeholder() || _t("inspector.unknown")).classed("mixed", isMixed);
73137       if (!isMixed) {
73138         _lengthIndicator.update(tags[field.key]);
73139       }
73140     };
73141     textarea.focus = function() {
73142       input.node().focus();
73143     };
73144     return utilRebind(textarea, dispatch14, "on");
73145   }
73146
73147   // modules/ui/fields/wikidata.js
73148   function uiFieldWikidata(field, context) {
73149     var wikidata = services.wikidata;
73150     var dispatch14 = dispatch_default("change");
73151     var _selection = select_default2(null);
73152     var _searchInput = select_default2(null);
73153     var _qid = null;
73154     var _wikidataEntity = null;
73155     var _wikiURL = "";
73156     var _entityIDs = [];
73157     var _wikipediaKey = field.keys && field.keys.find(function(key) {
73158       return key.includes("wikipedia");
73159     });
73160     var _hintKey = field.key === "wikidata" ? "name" : field.key.split(":")[0];
73161     var combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(true).minItems(1);
73162     function wiki(selection2) {
73163       _selection = selection2;
73164       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
73165       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
73166       var list2 = wrap2.selectAll("ul").data([0]);
73167       list2 = list2.enter().append("ul").attr("class", "rows").merge(list2);
73168       var searchRow = list2.selectAll("li.wikidata-search").data([0]);
73169       var searchRowEnter = searchRow.enter().append("li").attr("class", "wikidata-search");
73170       searchRowEnter.append("input").attr("type", "text").attr("id", field.domId).style("flex", "1").call(utilNoAuto).on("focus", function() {
73171         var node = select_default2(this).node();
73172         node.setSelectionRange(0, node.value.length);
73173       }).on("blur", function() {
73174         setLabelForEntity();
73175       }).call(combobox.fetcher(fetchWikidataItems));
73176       combobox.on("accept", function(d2) {
73177         if (d2) {
73178           _qid = d2.id;
73179           change();
73180         }
73181       }).on("cancel", function() {
73182         setLabelForEntity();
73183       });
73184       searchRowEnter.append("button").attr("class", "form-field-button wiki-link").attr("title", _t("icons.view_on", { domain: "wikidata.org" })).call(svgIcon("#iD-icon-out-link")).on("click", function(d3_event) {
73185         d3_event.preventDefault();
73186         if (_wikiURL) window.open(_wikiURL, "_blank");
73187       });
73188       searchRow = searchRow.merge(searchRowEnter);
73189       _searchInput = searchRow.select("input");
73190       var wikidataProperties = ["description", "identifier"];
73191       var items = list2.selectAll("li.labeled-input").data(wikidataProperties);
73192       var enter = items.enter().append("li").attr("class", function(d2) {
73193         return "labeled-input preset-wikidata-" + d2;
73194       });
73195       enter.append("div").attr("class", "label").html(function(d2) {
73196         return _t.html("wikidata." + d2);
73197       });
73198       enter.append("input").attr("type", "text").call(utilNoAuto).classed("disabled", "true").attr("readonly", "true");
73199       enter.append("button").attr("class", "form-field-button").attr("title", _t("icons.copy")).call(svgIcon("#iD-operation-copy")).on("click", function(d3_event) {
73200         d3_event.preventDefault();
73201         select_default2(this.parentNode).select("input").node().select();
73202         document.execCommand("copy");
73203       });
73204     }
73205     function fetchWikidataItems(q2, callback) {
73206       if (!q2 && _hintKey) {
73207         for (var i3 in _entityIDs) {
73208           var entity = context.hasEntity(_entityIDs[i3]);
73209           if (entity.tags[_hintKey]) {
73210             q2 = entity.tags[_hintKey];
73211             break;
73212           }
73213         }
73214       }
73215       wikidata.itemsForSearchQuery(q2, function(err, data) {
73216         if (err) {
73217           if (err !== "No query") console.error(err);
73218           return;
73219         }
73220         var result = data.map(function(item) {
73221           return {
73222             id: item.id,
73223             value: item.display.label.value + " (" + item.id + ")",
73224             display: (selection2) => selection2.append("span").attr("class", "localized-text").attr("lang", item.display.label.language).text(item.display.label.value),
73225             title: item.display.description && item.display.description.value,
73226             terms: item.aliases
73227           };
73228         });
73229         if (callback) callback(result);
73230       });
73231     }
73232     function change() {
73233       var syncTags = {};
73234       syncTags[field.key] = _qid;
73235       dispatch14.call("change", this, syncTags);
73236       var initGraph = context.graph();
73237       var initEntityIDs = _entityIDs;
73238       wikidata.entityByQID(_qid, function(err, entity) {
73239         if (err) return;
73240         if (context.graph() !== initGraph) return;
73241         if (!entity.sitelinks) return;
73242         var langs = wikidata.languagesToQuery();
73243         ["labels", "descriptions"].forEach(function(key) {
73244           if (!entity[key]) return;
73245           var valueLangs = Object.keys(entity[key]);
73246           if (valueLangs.length === 0) return;
73247           var valueLang = valueLangs[0];
73248           if (langs.indexOf(valueLang) === -1) {
73249             langs.push(valueLang);
73250           }
73251         });
73252         var newWikipediaValue;
73253         if (_wikipediaKey) {
73254           var foundPreferred;
73255           for (var i3 in langs) {
73256             var lang = langs[i3];
73257             var siteID = lang.replace("-", "_") + "wiki";
73258             if (entity.sitelinks[siteID]) {
73259               foundPreferred = true;
73260               newWikipediaValue = lang + ":" + entity.sitelinks[siteID].title;
73261               break;
73262             }
73263           }
73264           if (!foundPreferred) {
73265             var wikiSiteKeys = Object.keys(entity.sitelinks).filter(function(site) {
73266               return site.endsWith("wiki");
73267             });
73268             if (wikiSiteKeys.length === 0) {
73269               newWikipediaValue = null;
73270             } else {
73271               var wikiLang = wikiSiteKeys[0].slice(0, -4).replace("_", "-");
73272               var wikiTitle = entity.sitelinks[wikiSiteKeys[0]].title;
73273               newWikipediaValue = wikiLang + ":" + wikiTitle;
73274             }
73275           }
73276         }
73277         if (newWikipediaValue) {
73278           newWikipediaValue = context.cleanTagValue(newWikipediaValue);
73279         }
73280         if (typeof newWikipediaValue === "undefined") return;
73281         var actions = initEntityIDs.map(function(entityID) {
73282           var entity2 = context.hasEntity(entityID);
73283           if (!entity2) return null;
73284           var currTags = Object.assign({}, entity2.tags);
73285           if (newWikipediaValue === null) {
73286             if (!currTags[_wikipediaKey]) return null;
73287             delete currTags[_wikipediaKey];
73288           } else {
73289             currTags[_wikipediaKey] = newWikipediaValue;
73290           }
73291           return actionChangeTags(entityID, currTags);
73292         }).filter(Boolean);
73293         if (!actions.length) return;
73294         context.overwrite(
73295           function actionUpdateWikipediaTags(graph) {
73296             actions.forEach(function(action) {
73297               graph = action(graph);
73298             });
73299             return graph;
73300           },
73301           context.history().undoAnnotation()
73302         );
73303       });
73304     }
73305     function setLabelForEntity() {
73306       var label = "";
73307       if (_wikidataEntity) {
73308         label = entityPropertyForDisplay(_wikidataEntity, "labels");
73309         if (label.length === 0) {
73310           label = _wikidataEntity.id.toString();
73311         }
73312       }
73313       utilGetSetValue(_searchInput, label);
73314     }
73315     wiki.tags = function(tags) {
73316       var isMixed = Array.isArray(tags[field.key]);
73317       _searchInput.attr("title", isMixed ? tags[field.key].filter(Boolean).join("\n") : null).attr("placeholder", isMixed ? _t("inspector.multiple_values") : "").classed("mixed", isMixed);
73318       _qid = typeof tags[field.key] === "string" && tags[field.key] || "";
73319       if (!/^Q[0-9]*$/.test(_qid)) {
73320         unrecognized();
73321         return;
73322       }
73323       _wikiURL = "https://wikidata.org/wiki/" + _qid;
73324       wikidata.entityByQID(_qid, function(err, entity) {
73325         if (err) {
73326           unrecognized();
73327           return;
73328         }
73329         _wikidataEntity = entity;
73330         setLabelForEntity();
73331         var description = entityPropertyForDisplay(entity, "descriptions");
73332         _selection.select("button.wiki-link").classed("disabled", false);
73333         _selection.select(".preset-wikidata-description").style("display", function() {
73334           return description.length > 0 ? "flex" : "none";
73335         }).select("input").attr("value", description);
73336         _selection.select(".preset-wikidata-identifier").style("display", function() {
73337           return entity.id ? "flex" : "none";
73338         }).select("input").attr("value", entity.id);
73339       });
73340       function unrecognized() {
73341         _wikidataEntity = null;
73342         setLabelForEntity();
73343         _selection.select(".preset-wikidata-description").style("display", "none");
73344         _selection.select(".preset-wikidata-identifier").style("display", "none");
73345         _selection.select("button.wiki-link").classed("disabled", true);
73346         if (_qid && _qid !== "") {
73347           _wikiURL = "https://wikidata.org/wiki/Special:Search?search=" + _qid;
73348         } else {
73349           _wikiURL = "";
73350         }
73351       }
73352     };
73353     function entityPropertyForDisplay(wikidataEntity, propKey) {
73354       if (!wikidataEntity[propKey]) return "";
73355       var propObj = wikidataEntity[propKey];
73356       var langKeys = Object.keys(propObj);
73357       if (langKeys.length === 0) return "";
73358       var langs = wikidata.languagesToQuery();
73359       for (var i3 in langs) {
73360         var lang = langs[i3];
73361         var valueObj = propObj[lang];
73362         if (valueObj && valueObj.value && valueObj.value.length > 0) return valueObj.value;
73363       }
73364       return propObj[langKeys[0]].value;
73365     }
73366     wiki.entityIDs = function(val) {
73367       if (!arguments.length) return _entityIDs;
73368       _entityIDs = val;
73369       return wiki;
73370     };
73371     wiki.focus = function() {
73372       _searchInput.node().focus();
73373     };
73374     return utilRebind(wiki, dispatch14, "on");
73375   }
73376
73377   // modules/ui/fields/wikipedia.js
73378   function uiFieldWikipedia(field, context) {
73379     const scheme = "https://";
73380     const domain = "wikipedia.org";
73381     const dispatch14 = dispatch_default("change");
73382     const wikipedia = services.wikipedia;
73383     const wikidata = services.wikidata;
73384     let _langInput = select_default2(null);
73385     let _titleInput = select_default2(null);
73386     let _wikiURL = "";
73387     let _entityIDs;
73388     let _tags;
73389     let _dataWikipedia = [];
73390     _mainFileFetcher.get("wmf_sitematrix").then((d2) => {
73391       _dataWikipedia = d2;
73392       if (_tags) updateForTags(_tags);
73393     }).catch(() => {
73394     });
73395     const langCombo = uiCombobox(context, "wikipedia-lang").fetcher((value, callback) => {
73396       const v2 = value.toLowerCase();
73397       callback(
73398         _dataWikipedia.filter((d2) => {
73399           return d2[0].toLowerCase().indexOf(v2) >= 0 || d2[1].toLowerCase().indexOf(v2) >= 0 || d2[2].toLowerCase().indexOf(v2) >= 0;
73400         }).map((d2) => ({ value: d2[1] }))
73401       );
73402     });
73403     const titleCombo = uiCombobox(context, "wikipedia-title").fetcher((value, callback) => {
73404       if (!value) {
73405         value = "";
73406         for (let i3 in _entityIDs) {
73407           let entity = context.hasEntity(_entityIDs[i3]);
73408           if (entity.tags.name) {
73409             value = entity.tags.name;
73410             break;
73411           }
73412         }
73413       }
73414       const searchfn = value.length > 7 ? wikipedia.search : wikipedia.suggestions;
73415       searchfn(language()[2], value, (query, data) => {
73416         callback(data.map((d2) => ({ value: d2 })));
73417       });
73418     });
73419     function wiki(selection2) {
73420       let wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
73421       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-".concat(field.type)).merge(wrap2);
73422       let langContainer = wrap2.selectAll(".wiki-lang-container").data([0]);
73423       langContainer = langContainer.enter().append("div").attr("class", "wiki-lang-container").merge(langContainer);
73424       _langInput = langContainer.selectAll("input.wiki-lang").data([0]);
73425       _langInput = _langInput.enter().append("input").attr("type", "text").attr("class", "wiki-lang").attr("placeholder", _t("translate.localized_translation_language")).call(utilNoAuto).call(langCombo).merge(_langInput);
73426       _langInput.on("blur", changeLang).on("change", changeLang);
73427       let titleContainer = wrap2.selectAll(".wiki-title-container").data([0]);
73428       titleContainer = titleContainer.enter().append("div").attr("class", "wiki-title-container").merge(titleContainer);
73429       _titleInput = titleContainer.selectAll("input.wiki-title").data([0]);
73430       _titleInput = _titleInput.enter().append("input").attr("type", "text").attr("class", "wiki-title").attr("id", field.domId).call(utilNoAuto).call(titleCombo).merge(_titleInput);
73431       _titleInput.on("blur", function() {
73432         change(true);
73433       }).on("change", function() {
73434         change(false);
73435       });
73436       let link3 = titleContainer.selectAll(".wiki-link").data([0]);
73437       link3 = link3.enter().append("button").attr("class", "form-field-button wiki-link").attr("title", _t("icons.view_on", { domain })).call(svgIcon("#iD-icon-out-link")).merge(link3);
73438       link3.on("click", (d3_event) => {
73439         d3_event.preventDefault();
73440         if (_wikiURL) window.open(_wikiURL, "_blank");
73441       });
73442     }
73443     function defaultLanguageInfo(skipEnglishFallback) {
73444       const langCode = _mainLocalizer.languageCode().toLowerCase();
73445       for (let i3 in _dataWikipedia) {
73446         let d2 = _dataWikipedia[i3];
73447         if (d2[2] === langCode) return d2;
73448       }
73449       return skipEnglishFallback ? ["", "", ""] : ["English", "English", "en"];
73450     }
73451     function language(skipEnglishFallback) {
73452       const value = utilGetSetValue(_langInput).toLowerCase();
73453       for (let i3 in _dataWikipedia) {
73454         let d2 = _dataWikipedia[i3];
73455         if (d2[0].toLowerCase() === value || d2[1].toLowerCase() === value || d2[2] === value) return d2;
73456       }
73457       return defaultLanguageInfo(skipEnglishFallback);
73458     }
73459     function changeLang() {
73460       utilGetSetValue(_langInput, language()[1]);
73461       change(true);
73462     }
73463     function change(skipWikidata) {
73464       let value = utilGetSetValue(_titleInput);
73465       const m2 = value.match(/https?:\/\/([-a-z]+)\.wikipedia\.org\/(?:wiki|\1-[-a-z]+)\/([^#]+)(?:#(.+))?/);
73466       const langInfo = m2 && _dataWikipedia.find((d2) => m2[1] === d2[2]);
73467       let syncTags = {};
73468       if (langInfo) {
73469         const nativeLangName = langInfo[1];
73470         value = decodeURIComponent(m2[2]).replace(/_/g, " ");
73471         if (m2[3]) {
73472           let anchor;
73473           anchor = decodeURIComponent(m2[3]);
73474           value += "#" + anchor.replace(/_/g, " ");
73475         }
73476         value = value.slice(0, 1).toUpperCase() + value.slice(1);
73477         utilGetSetValue(_langInput, nativeLangName);
73478         utilGetSetValue(_titleInput, value);
73479       }
73480       if (value) {
73481         syncTags.wikipedia = context.cleanTagValue(language()[2] + ":" + value);
73482       } else {
73483         syncTags.wikipedia = void 0;
73484       }
73485       dispatch14.call("change", this, syncTags);
73486       if (skipWikidata || !value || !language()[2]) return;
73487       const initGraph = context.graph();
73488       const initEntityIDs = _entityIDs;
73489       wikidata.itemsByTitle(language()[2], value, (err, data) => {
73490         if (err || !data || !Object.keys(data).length) return;
73491         if (context.graph() !== initGraph) return;
73492         const qids = Object.keys(data);
73493         const value2 = qids && qids.find((id2) => id2.match(/^Q\d+$/));
73494         let actions = initEntityIDs.map((entityID) => {
73495           let entity = context.entity(entityID).tags;
73496           let currTags = Object.assign({}, entity);
73497           if (currTags.wikidata !== value2) {
73498             currTags.wikidata = value2;
73499             return actionChangeTags(entityID, currTags);
73500           }
73501           return null;
73502         }).filter(Boolean);
73503         if (!actions.length) return;
73504         context.overwrite(
73505           function actionUpdateWikidataTags(graph) {
73506             actions.forEach(function(action) {
73507               graph = action(graph);
73508             });
73509             return graph;
73510           },
73511           context.history().undoAnnotation()
73512         );
73513       });
73514     }
73515     wiki.tags = (tags) => {
73516       _tags = tags;
73517       updateForTags(tags);
73518     };
73519     function updateForTags(tags) {
73520       const value = typeof tags[field.key] === "string" ? tags[field.key] : "";
73521       const m2 = value.match(/([^:]+):([^#]+)(?:#(.+))?/);
73522       const tagLang = m2 && m2[1];
73523       const tagArticleTitle = m2 && m2[2];
73524       let anchor = m2 && m2[3];
73525       const tagLangInfo = tagLang && _dataWikipedia.find((d2) => tagLang === d2[2]);
73526       if (tagLangInfo) {
73527         const nativeLangName = tagLangInfo[1];
73528         utilGetSetValue(_langInput, nativeLangName);
73529         utilGetSetValue(_titleInput, tagArticleTitle + (anchor ? "#" + anchor : ""));
73530         _wikiURL = "".concat(scheme).concat(tagLang, ".").concat(domain, "/wiki/").concat(wiki.encodePath(tagArticleTitle, anchor));
73531       } else {
73532         utilGetSetValue(_titleInput, value);
73533         if (value && value !== "") {
73534           utilGetSetValue(_langInput, "");
73535           const defaultLangInfo = defaultLanguageInfo();
73536           _wikiURL = "".concat(scheme).concat(defaultLangInfo[2], ".").concat(domain, "/w/index.php?fulltext=1&search=").concat(value);
73537         } else {
73538           const shownOrDefaultLangInfo = language(
73539             true
73540             /* skipEnglishFallback */
73541           );
73542           utilGetSetValue(_langInput, shownOrDefaultLangInfo[1]);
73543           _wikiURL = "";
73544         }
73545       }
73546     }
73547     wiki.encodePath = (tagArticleTitle, anchor) => {
73548       const underscoredTitle = tagArticleTitle.replace(/ /g, "_");
73549       const uriEncodedUnderscoredTitle = encodeURIComponent(underscoredTitle);
73550       const uriEncodedAnchorFragment = wiki.encodeURIAnchorFragment(anchor);
73551       return "".concat(uriEncodedUnderscoredTitle).concat(uriEncodedAnchorFragment);
73552     };
73553     wiki.encodeURIAnchorFragment = (anchor) => {
73554       if (!anchor) return "";
73555       const underscoredAnchor = anchor.replace(/ /g, "_");
73556       return "#" + encodeURIComponent(underscoredAnchor);
73557     };
73558     wiki.entityIDs = (val) => {
73559       if (!arguments.length) return _entityIDs;
73560       _entityIDs = val;
73561       return wiki;
73562     };
73563     wiki.focus = () => {
73564       _titleInput.node().focus();
73565     };
73566     return utilRebind(wiki, dispatch14, "on");
73567   }
73568   uiFieldWikipedia.supportsMultiselection = false;
73569
73570   // modules/ui/fields/index.js
73571   var uiFields = {
73572     access: uiFieldAccess,
73573     address: uiFieldAddress,
73574     check: uiFieldCheck,
73575     colour: uiFieldText,
73576     combo: uiFieldCombo,
73577     cycleway: uiFieldDirectionalCombo,
73578     date: uiFieldText,
73579     defaultCheck: uiFieldCheck,
73580     directionalCombo: uiFieldDirectionalCombo,
73581     email: uiFieldText,
73582     identifier: uiFieldText,
73583     lanes: uiFieldLanes,
73584     localized: uiFieldLocalized,
73585     roadheight: uiFieldRoadheight,
73586     roadspeed: uiFieldRoadspeed,
73587     manyCombo: uiFieldCombo,
73588     multiCombo: uiFieldCombo,
73589     networkCombo: uiFieldCombo,
73590     number: uiFieldText,
73591     onewayCheck: uiFieldCheck,
73592     radio: uiFieldRadio,
73593     restrictions: uiFieldRestrictions,
73594     semiCombo: uiFieldCombo,
73595     structureRadio: uiFieldRadio,
73596     tel: uiFieldText,
73597     text: uiFieldText,
73598     textarea: uiFieldTextarea,
73599     typeCombo: uiFieldCombo,
73600     url: uiFieldText,
73601     wikidata: uiFieldWikidata,
73602     wikipedia: uiFieldWikipedia
73603   };
73604
73605   // modules/ui/field.js
73606   function uiField(context, presetField2, entityIDs, options2) {
73607     options2 = Object.assign({
73608       show: true,
73609       wrap: true,
73610       remove: true,
73611       revert: true,
73612       info: true
73613     }, options2);
73614     var dispatch14 = dispatch_default("change", "revert");
73615     var field = Object.assign({}, presetField2);
73616     field.domId = utilUniqueDomId("form-field-" + field.safeid);
73617     var _show = options2.show;
73618     var _state = "";
73619     var _tags = {};
73620     var _entityExtent;
73621     if (entityIDs && entityIDs.length) {
73622       _entityExtent = entityIDs.reduce(function(extent, entityID) {
73623         var entity = context.graph().entity(entityID);
73624         return extent.extend(entity.extent(context.graph()));
73625       }, geoExtent());
73626     }
73627     var _locked = false;
73628     var _lockedTip = uiTooltip().title(() => _t.append("inspector.lock.suggestion", { label: field.title })).placement("bottom");
73629     if (_show && !field.impl) {
73630       createField();
73631     }
73632     function createField() {
73633       field.impl = uiFields[field.type](field, context).on("change", function(t2, onInput) {
73634         dispatch14.call("change", field, t2, onInput);
73635       });
73636       if (entityIDs) {
73637         field.entityIDs = entityIDs;
73638         if (field.impl.entityIDs) {
73639           field.impl.entityIDs(entityIDs);
73640         }
73641       }
73642     }
73643     function allKeys() {
73644       let keys2 = field.keys || [field.key];
73645       if (field.type === "directionalCombo" && field.key) {
73646         keys2 = keys2.concat(field.key);
73647       }
73648       return keys2;
73649     }
73650     function isModified() {
73651       if (!entityIDs || !entityIDs.length) return false;
73652       return entityIDs.some(function(entityID) {
73653         var original = context.graph().base().entities[entityID];
73654         var latest = context.graph().entity(entityID);
73655         return allKeys().some(function(key) {
73656           return original ? latest.tags[key] !== original.tags[key] : latest.tags[key];
73657         });
73658       });
73659     }
73660     function tagsContainFieldKey() {
73661       return allKeys().some(function(key) {
73662         if (field.type === "multiCombo") {
73663           for (var tagKey in _tags) {
73664             if (tagKey.indexOf(key) === 0) {
73665               return true;
73666             }
73667           }
73668           return false;
73669         }
73670         if (field.type === "localized") {
73671           for (let tagKey2 in _tags) {
73672             let match = tagKey2.match(LANGUAGE_SUFFIX_REGEX);
73673             if (match && match[1] === field.key && match[2]) {
73674               return true;
73675             }
73676           }
73677         }
73678         return _tags[key] !== void 0;
73679       });
73680     }
73681     function revert(d3_event, d2) {
73682       d3_event.stopPropagation();
73683       d3_event.preventDefault();
73684       if (!entityIDs || _locked) return;
73685       dispatch14.call("revert", d2, allKeys());
73686     }
73687     function remove2(d3_event, d2) {
73688       d3_event.stopPropagation();
73689       d3_event.preventDefault();
73690       if (_locked) return;
73691       var t2 = {};
73692       allKeys().forEach(function(key) {
73693         t2[key] = void 0;
73694       });
73695       dispatch14.call("change", d2, t2);
73696     }
73697     field.render = function(selection2) {
73698       var container = selection2.selectAll(".form-field").data([field]);
73699       var enter = container.enter().append("div").attr("class", function(d2) {
73700         return "form-field form-field-" + d2.safeid;
73701       }).classed("nowrap", !options2.wrap);
73702       if (options2.wrap) {
73703         var labelEnter = enter.append("label").attr("class", "field-label").attr("for", function(d2) {
73704           return d2.domId;
73705         });
73706         var textEnter = labelEnter.append("span").attr("class", "label-text");
73707         textEnter.append("span").attr("class", "label-textvalue").each(function(d2) {
73708           d2.label()(select_default2(this));
73709         });
73710         textEnter.append("span").attr("class", "label-textannotation");
73711         if (options2.remove) {
73712           labelEnter.append("button").attr("class", "remove-icon").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
73713         }
73714         if (options2.revert) {
73715           labelEnter.append("button").attr("class", "modified-icon").attr("title", _t("icons.undo")).call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo"));
73716         }
73717       }
73718       container = container.merge(enter);
73719       container.select(".field-label > .remove-icon").on("click", remove2);
73720       container.select(".field-label > .modified-icon").on("click", revert);
73721       container.each(function(d2) {
73722         var selection3 = select_default2(this);
73723         if (!d2.impl) {
73724           createField();
73725         }
73726         var reference, help;
73727         if (options2.wrap && field.type === "restrictions") {
73728           help = uiFieldHelp(context, "restrictions");
73729         }
73730         if (options2.wrap && options2.info) {
73731           var referenceKey = d2.key || "";
73732           if (d2.type === "multiCombo") {
73733             referenceKey = referenceKey.replace(/:$/, "");
73734           }
73735           var referenceOptions = d2.reference || {
73736             key: referenceKey,
73737             value: _tags[referenceKey]
73738           };
73739           reference = uiTagReference(referenceOptions, context);
73740           if (_state === "hover") {
73741             reference.showing(false);
73742           }
73743         }
73744         selection3.call(d2.impl);
73745         if (help) {
73746           selection3.call(help.body).select(".field-label").call(help.button);
73747         }
73748         if (reference) {
73749           selection3.call(reference.body).select(".field-label").call(reference.button);
73750         }
73751         d2.impl.tags(_tags);
73752       });
73753       container.classed("locked", _locked).classed("modified", isModified()).classed("present", tagsContainFieldKey());
73754       var annotation = container.selectAll(".field-label .label-textannotation");
73755       var icon2 = annotation.selectAll(".icon").data(_locked ? [0] : []);
73756       icon2.exit().remove();
73757       icon2.enter().append("svg").attr("class", "icon").append("use").attr("xlink:href", "#fas-lock");
73758       container.call(_locked ? _lockedTip : _lockedTip.destroy);
73759     };
73760     field.state = function(val) {
73761       if (!arguments.length) return _state;
73762       _state = val;
73763       return field;
73764     };
73765     field.tags = function(val) {
73766       if (!arguments.length) return _tags;
73767       _tags = val;
73768       if (tagsContainFieldKey() && !_show) {
73769         _show = true;
73770         if (!field.impl) {
73771           createField();
73772         }
73773       }
73774       return field;
73775     };
73776     field.locked = function(val) {
73777       if (!arguments.length) return _locked;
73778       _locked = val;
73779       return field;
73780     };
73781     field.show = function() {
73782       _show = true;
73783       if (!field.impl) {
73784         createField();
73785       }
73786       if (field.default && field.key && _tags[field.key] !== field.default) {
73787         var t2 = {};
73788         t2[field.key] = field.default;
73789         dispatch14.call("change", this, t2);
73790       }
73791     };
73792     field.isShown = function() {
73793       return _show;
73794     };
73795     field.isAllowed = function() {
73796       if (entityIDs && entityIDs.length > 1 && uiFields[field.type].supportsMultiselection === false) return false;
73797       if (field.geometry && !entityIDs.every(function(entityID) {
73798         return field.matchGeometry(context.graph().geometry(entityID));
73799       })) return false;
73800       if (entityIDs && _entityExtent && field.locationSetID) {
73801         var validHere = _sharedLocationManager.locationSetsAt(_entityExtent.center());
73802         if (!validHere[field.locationSetID]) return false;
73803       }
73804       var prerequisiteTag = field.prerequisiteTag;
73805       if (entityIDs && !tagsContainFieldKey() && // ignore tagging prerequisites if a value is already present
73806       prerequisiteTag) {
73807         if (!entityIDs.every(function(entityID) {
73808           var entity = context.graph().entity(entityID);
73809           if (prerequisiteTag.key) {
73810             var value = entity.tags[prerequisiteTag.key];
73811             if (!value) return false;
73812             if (prerequisiteTag.valueNot) {
73813               return prerequisiteTag.valueNot !== value;
73814             }
73815             if (prerequisiteTag.value) {
73816               return prerequisiteTag.value === value;
73817             }
73818           } else if (prerequisiteTag.keyNot) {
73819             if (entity.tags[prerequisiteTag.keyNot]) return false;
73820           }
73821           return true;
73822         })) return false;
73823       }
73824       return true;
73825     };
73826     field.focus = function() {
73827       if (field.impl) {
73828         field.impl.focus();
73829       }
73830     };
73831     return utilRebind(field, dispatch14, "on");
73832   }
73833
73834   // modules/ui/changeset_editor.js
73835   function uiChangesetEditor(context) {
73836     var dispatch14 = dispatch_default("change");
73837     var formFields = uiFormFields(context);
73838     var commentCombo = uiCombobox(context, "comment").caseSensitive(true);
73839     var _fieldsArr;
73840     var _tags;
73841     var _changesetID;
73842     function changesetEditor(selection2) {
73843       render(selection2);
73844     }
73845     function render(selection2) {
73846       var initial = false;
73847       if (!_fieldsArr) {
73848         initial = true;
73849         var presets = _mainPresetIndex;
73850         _fieldsArr = [
73851           uiField(context, presets.field("comment"), null, { show: true, revert: false }),
73852           uiField(context, presets.field("source"), null, { show: true, revert: false }),
73853           uiField(context, presets.field("hashtags"), null, { show: false, revert: false })
73854         ];
73855         _fieldsArr.forEach(function(field) {
73856           field.on("change", function(t2, onInput) {
73857             dispatch14.call("change", field, void 0, t2, onInput);
73858           });
73859         });
73860       }
73861       _fieldsArr.forEach(function(field) {
73862         field.tags(_tags);
73863       });
73864       selection2.call(formFields.fieldsArr(_fieldsArr));
73865       if (initial) {
73866         var commentField = selection2.select(".form-field-comment textarea");
73867         var commentNode = commentField.node();
73868         if (commentNode) {
73869           commentNode.focus();
73870           commentNode.select();
73871         }
73872         utilTriggerEvent(commentField, "blur");
73873         var osm = context.connection();
73874         if (osm) {
73875           osm.userChangesets(function(err, changesets) {
73876             if (err) return;
73877             var comments = changesets.map(function(changeset) {
73878               var comment = changeset.tags.comment;
73879               return comment ? { title: comment, value: comment } : null;
73880             }).filter(Boolean);
73881             commentField.call(
73882               commentCombo.data(utilArrayUniqBy(comments, "title"))
73883             );
73884           });
73885         }
73886       }
73887       const warnings = [];
73888       if (_tags.comment.match(/google/i)) {
73889         warnings.push({
73890           id: 'contains "google"',
73891           msg: _t.append("commit.google_warning"),
73892           link: _t("commit.google_warning_link")
73893         });
73894       }
73895       const maxChars = context.maxCharsForTagValue();
73896       const strLen = utilUnicodeCharsCount(utilCleanOsmString(_tags.comment, Number.POSITIVE_INFINITY));
73897       if (strLen > maxChars || false) {
73898         warnings.push({
73899           id: "message too long",
73900           msg: _t.append("commit.changeset_comment_length_warning", { maxChars })
73901         });
73902       }
73903       var commentWarning = selection2.select(".form-field-comment").selectAll(".comment-warning").data(warnings, (d2) => d2.id);
73904       commentWarning.exit().transition().duration(200).style("opacity", 0).remove();
73905       var commentEnter = commentWarning.enter().insert("div", ".comment-warning").attr("class", "comment-warning field-warning").style("opacity", 0);
73906       commentEnter.call(svgIcon("#iD-icon-alert", "inline")).append("span");
73907       commentEnter.transition().duration(200).style("opacity", 1);
73908       commentWarning.merge(commentEnter).selectAll("div > span").text("").each(function(d2) {
73909         let selection3 = select_default2(this);
73910         if (d2.link) {
73911           selection3 = selection3.append("a").attr("target", "_blank").attr("href", d2.link);
73912         }
73913         selection3.call(d2.msg);
73914       });
73915     }
73916     changesetEditor.tags = function(_2) {
73917       if (!arguments.length) return _tags;
73918       _tags = _2;
73919       return changesetEditor;
73920     };
73921     changesetEditor.changesetID = function(_2) {
73922       if (!arguments.length) return _changesetID;
73923       if (_changesetID === _2) return changesetEditor;
73924       _changesetID = _2;
73925       _fieldsArr = null;
73926       return changesetEditor;
73927     };
73928     return utilRebind(changesetEditor, dispatch14, "on");
73929   }
73930
73931   // modules/ui/sections/changes.js
73932   function uiSectionChanges(context) {
73933     var _discardTags = {};
73934     _mainFileFetcher.get("discarded").then(function(d2) {
73935       _discardTags = d2;
73936     }).catch(function() {
73937     });
73938     var section = uiSection("changes-list", context).label(function() {
73939       var history = context.history();
73940       var summary = history.difference().summary();
73941       return _t.append("inspector.title_count", { title: _t("commit.changes"), count: summary.length });
73942     }).disclosureContent(renderDisclosureContent);
73943     function renderDisclosureContent(selection2) {
73944       var history = context.history();
73945       var summary = history.difference().summary();
73946       var container = selection2.selectAll(".commit-section").data([0]);
73947       var containerEnter = container.enter().append("div").attr("class", "commit-section");
73948       containerEnter.append("ul").attr("class", "changeset-list");
73949       container = containerEnter.merge(container);
73950       var items = container.select("ul").selectAll("li").data(summary);
73951       var itemsEnter = items.enter().append("li").attr("class", "change-item");
73952       var buttons = itemsEnter.append("button").on("mouseover", mouseover).on("mouseout", mouseout).on("click", click);
73953       buttons.each(function(d2) {
73954         select_default2(this).call(svgIcon("#iD-icon-" + d2.entity.geometry(d2.graph), "pre-text " + d2.changeType));
73955       });
73956       buttons.append("span").attr("class", "change-type").html(function(d2) {
73957         return _t.html("commit." + d2.changeType) + " ";
73958       });
73959       buttons.append("strong").attr("class", "entity-type").text(function(d2) {
73960         var matched = _mainPresetIndex.match(d2.entity, d2.graph);
73961         return matched && matched.name() || utilDisplayType(d2.entity.id);
73962       });
73963       buttons.append("span").attr("class", "entity-name").text(function(d2) {
73964         var name = utilDisplayName(d2.entity) || "", string = "";
73965         if (name !== "") {
73966           string += ":";
73967         }
73968         return string += " " + name;
73969       });
73970       items = itemsEnter.merge(items);
73971       var changeset = new osmChangeset().update({ id: void 0 });
73972       var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
73973       delete changeset.id;
73974       var data = JXON.stringify(changeset.osmChangeJXON(changes));
73975       var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
73976       var fileName = "changes.osc";
73977       var linkEnter = container.selectAll(".download-changes").data([0]).enter().append("a").attr("class", "download-changes");
73978       linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
73979       linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("commit.download_changes"));
73980       function mouseover(d2) {
73981         if (d2.entity) {
73982           context.surface().selectAll(
73983             utilEntityOrMemberSelector([d2.entity.id], context.graph())
73984           ).classed("hover", true);
73985         }
73986       }
73987       function mouseout() {
73988         context.surface().selectAll(".hover").classed("hover", false);
73989       }
73990       function click(d3_event, change) {
73991         if (change.changeType !== "deleted") {
73992           var entity = change.entity;
73993           context.map().zoomToEase(entity);
73994           context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
73995         }
73996       }
73997     }
73998     return section;
73999   }
74000
74001   // modules/ui/commit.js
74002   var readOnlyTags = [
74003     /^changesets_count$/,
74004     /^created_by$/,
74005     /^ideditor:/,
74006     /^imagery_used$/,
74007     /^host$/,
74008     /^locale$/,
74009     /^warnings:/,
74010     /^resolved:/,
74011     /^closed:note$/,
74012     /^closed:keepright$/,
74013     /^closed:osmose:/
74014   ];
74015   var hashtagRegex = /(#[^\u2000-\u206F\u2E00-\u2E7F\s\\'!"#$%()*,.\/:;<=>?@\[\]^`{|}~]+)/g;
74016   function uiCommit(context) {
74017     var dispatch14 = dispatch_default("cancel");
74018     var _userDetails2;
74019     var _selection;
74020     var changesetEditor = uiChangesetEditor(context).on("change", changeTags);
74021     var rawTagEditor = uiSectionRawTagEditor("changeset-tag-editor", context).on("change", changeTags).readOnlyTags(readOnlyTags);
74022     var commitChanges = uiSectionChanges(context);
74023     var commitWarnings = uiCommitWarnings(context);
74024     function commit(selection2) {
74025       _selection = selection2;
74026       if (!context.changeset) initChangeset();
74027       loadDerivedChangesetTags();
74028       selection2.call(render);
74029     }
74030     function initChangeset() {
74031       var commentDate = +corePreferences("commentDate") || 0;
74032       var currDate = Date.now();
74033       var cutoff = 2 * 86400 * 1e3;
74034       if (commentDate > currDate || currDate - commentDate > cutoff) {
74035         corePreferences("comment", null);
74036         corePreferences("hashtags", null);
74037         corePreferences("source", null);
74038       }
74039       if (context.defaultChangesetComment()) {
74040         corePreferences("comment", context.defaultChangesetComment());
74041         corePreferences("commentDate", Date.now());
74042       }
74043       if (context.defaultChangesetSource()) {
74044         corePreferences("source", context.defaultChangesetSource());
74045         corePreferences("commentDate", Date.now());
74046       }
74047       if (context.defaultChangesetHashtags()) {
74048         corePreferences("hashtags", context.defaultChangesetHashtags());
74049         corePreferences("commentDate", Date.now());
74050       }
74051       var detected = utilDetect();
74052       var tags = {
74053         comment: corePreferences("comment") || "",
74054         created_by: context.cleanTagValue("iD " + context.version),
74055         host: context.cleanTagValue(detected.host),
74056         locale: context.cleanTagValue(_mainLocalizer.localeCode())
74057       };
74058       findHashtags(tags, true);
74059       var hashtags = corePreferences("hashtags");
74060       if (hashtags) {
74061         tags.hashtags = hashtags;
74062       }
74063       var source = corePreferences("source");
74064       if (source) {
74065         tags.source = source;
74066       }
74067       var photoOverlaysUsed = context.history().photoOverlaysUsed();
74068       if (photoOverlaysUsed.length) {
74069         var sources = (tags.source || "").split(";");
74070         if (sources.indexOf("streetlevel imagery") === -1) {
74071           sources.push("streetlevel imagery");
74072         }
74073         photoOverlaysUsed.forEach(function(photoOverlay) {
74074           if (sources.indexOf(photoOverlay) === -1) {
74075             sources.push(photoOverlay);
74076           }
74077         });
74078         tags.source = context.cleanTagValue(sources.join(";"));
74079       }
74080       context.changeset = new osmChangeset({ tags });
74081     }
74082     function loadDerivedChangesetTags() {
74083       var osm = context.connection();
74084       if (!osm) return;
74085       var tags = Object.assign({}, context.changeset.tags);
74086       var imageryUsed = context.cleanTagValue(context.history().imageryUsed().join(";"));
74087       tags.imagery_used = imageryUsed || "None";
74088       var osmClosed = osm.getClosedIDs();
74089       var itemType;
74090       if (osmClosed.length) {
74091         tags["closed:note"] = context.cleanTagValue(osmClosed.join(";"));
74092       }
74093       if (services.keepRight) {
74094         var krClosed = services.keepRight.getClosedIDs();
74095         if (krClosed.length) {
74096           tags["closed:keepright"] = context.cleanTagValue(krClosed.join(";"));
74097         }
74098       }
74099       if (services.osmose) {
74100         var osmoseClosed = services.osmose.getClosedCounts();
74101         for (itemType in osmoseClosed) {
74102           tags["closed:osmose:" + itemType] = context.cleanTagValue(osmoseClosed[itemType].toString());
74103         }
74104       }
74105       for (var key in tags) {
74106         if (key.match(/(^warnings:)|(^resolved:)/)) {
74107           delete tags[key];
74108         }
74109       }
74110       function addIssueCounts(issues, prefix) {
74111         var issuesByType = utilArrayGroupBy(issues, "type");
74112         for (var issueType in issuesByType) {
74113           var issuesOfType = issuesByType[issueType];
74114           if (issuesOfType[0].subtype) {
74115             var issuesBySubtype = utilArrayGroupBy(issuesOfType, "subtype");
74116             for (var issueSubtype in issuesBySubtype) {
74117               var issuesOfSubtype = issuesBySubtype[issueSubtype];
74118               tags[prefix + ":" + issueType + ":" + issueSubtype] = context.cleanTagValue(issuesOfSubtype.length.toString());
74119             }
74120           } else {
74121             tags[prefix + ":" + issueType] = context.cleanTagValue(issuesOfType.length.toString());
74122           }
74123         }
74124       }
74125       var warnings = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeIgnored: true, includeDisabledRules: true }).warning.filter(function(issue) {
74126         return issue.type !== "help_request";
74127       });
74128       addIssueCounts(warnings, "warnings");
74129       var resolvedIssues = context.validator().getResolvedIssues();
74130       addIssueCounts(resolvedIssues, "resolved");
74131       context.changeset = context.changeset.update({ tags });
74132     }
74133     function render(selection2) {
74134       var osm = context.connection();
74135       if (!osm) return;
74136       var header = selection2.selectAll(".header").data([0]);
74137       var headerTitle = header.enter().append("div").attr("class", "header fillL");
74138       headerTitle.append("div").append("h2").call(_t.append("commit.title"));
74139       headerTitle.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
74140         dispatch14.call("cancel", this);
74141       }).call(svgIcon("#iD-icon-close"));
74142       var body = selection2.selectAll(".body").data([0]);
74143       body = body.enter().append("div").attr("class", "body").merge(body);
74144       var changesetSection = body.selectAll(".changeset-editor").data([0]);
74145       changesetSection = changesetSection.enter().append("div").attr("class", "modal-section changeset-editor").merge(changesetSection);
74146       changesetSection.call(
74147         changesetEditor.changesetID(context.changeset.id).tags(context.changeset.tags)
74148       );
74149       body.call(commitWarnings);
74150       var saveSection = body.selectAll(".save-section").data([0]);
74151       saveSection = saveSection.enter().append("div").attr("class", "modal-section save-section fillL").merge(saveSection);
74152       var prose = saveSection.selectAll(".commit-info").data([0]);
74153       if (prose.enter().size()) {
74154         _userDetails2 = null;
74155       }
74156       prose = prose.enter().append("p").attr("class", "commit-info").call(_t.append("commit.upload_explanation")).merge(prose);
74157       osm.userDetails(function(err, user) {
74158         if (err) return;
74159         if (_userDetails2 === user) return;
74160         _userDetails2 = user;
74161         var userLink = select_default2(document.createElement("div"));
74162         if (user.image_url) {
74163           userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
74164         }
74165         userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
74166         prose.html(_t.html("commit.upload_explanation_with_user", { user: { html: userLink.html() } }));
74167       });
74168       var requestReview = saveSection.selectAll(".request-review").data([0]);
74169       var requestReviewEnter = requestReview.enter().append("div").attr("class", "request-review");
74170       var requestReviewDomId = utilUniqueDomId("commit-input-request-review");
74171       var labelEnter = requestReviewEnter.append("label").attr("for", requestReviewDomId);
74172       if (!labelEnter.empty()) {
74173         labelEnter.call(uiTooltip().title(() => _t.append("commit.request_review_info")).placement("top"));
74174       }
74175       labelEnter.append("input").attr("type", "checkbox").attr("id", requestReviewDomId);
74176       labelEnter.append("span").call(_t.append("commit.request_review"));
74177       requestReview = requestReview.merge(requestReviewEnter);
74178       var requestReviewInput = requestReview.selectAll("input").property("checked", isReviewRequested(context.changeset.tags)).on("change", toggleRequestReview);
74179       var buttonSection = saveSection.selectAll(".buttons").data([0]);
74180       var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons fillL");
74181       buttonEnter.append("button").attr("class", "secondary-action button cancel-button").append("span").attr("class", "label").call(_t.append("commit.cancel"));
74182       var uploadButton = buttonEnter.append("button").attr("class", "action button save-button");
74183       uploadButton.append("span").attr("class", "label").call(_t.append("commit.save"));
74184       var uploadBlockerTooltipText = getUploadBlockerMessage();
74185       buttonSection = buttonSection.merge(buttonEnter);
74186       buttonSection.selectAll(".cancel-button").on("click.cancel", function() {
74187         dispatch14.call("cancel", this);
74188       });
74189       buttonSection.selectAll(".save-button").classed("disabled", uploadBlockerTooltipText !== null).on("click.save", function() {
74190         if (!select_default2(this).classed("disabled")) {
74191           this.blur();
74192           for (var key in context.changeset.tags) {
74193             if (!key) delete context.changeset.tags[key];
74194           }
74195           context.uploader().save(context.changeset);
74196         }
74197       });
74198       uiTooltip().destroyAny(buttonSection.selectAll(".save-button"));
74199       if (uploadBlockerTooltipText) {
74200         buttonSection.selectAll(".save-button").call(uiTooltip().title(() => uploadBlockerTooltipText).placement("top"));
74201       }
74202       var tagSection = body.selectAll(".tag-section.raw-tag-editor").data([0]);
74203       tagSection = tagSection.enter().append("div").attr("class", "modal-section tag-section raw-tag-editor").merge(tagSection);
74204       tagSection.call(
74205         rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render
74206       );
74207       var changesSection = body.selectAll(".commit-changes-section").data([0]);
74208       changesSection = changesSection.enter().append("div").attr("class", "modal-section commit-changes-section").merge(changesSection);
74209       changesSection.call(commitChanges.render);
74210       function toggleRequestReview() {
74211         var rr = requestReviewInput.property("checked");
74212         updateChangeset({ review_requested: rr ? "yes" : void 0 });
74213         tagSection.call(
74214           rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render
74215         );
74216       }
74217     }
74218     function getUploadBlockerMessage() {
74219       var errors = context.validator().getIssuesBySeverity({ what: "edited", where: "all" }).error;
74220       if (errors.length) {
74221         return _t.append("commit.outstanding_errors_message", { count: errors.length });
74222       } else {
74223         var hasChangesetComment = context.changeset && context.changeset.tags.comment && context.changeset.tags.comment.trim().length;
74224         if (!hasChangesetComment) {
74225           return _t.append("commit.comment_needed_message");
74226         }
74227       }
74228       return null;
74229     }
74230     function changeTags(_2, changed, onInput) {
74231       if (changed.hasOwnProperty("comment")) {
74232         if (changed.comment === void 0) {
74233           changed.comment = "";
74234         }
74235         if (!onInput) {
74236           corePreferences("comment", changed.comment);
74237           corePreferences("commentDate", Date.now());
74238         }
74239       }
74240       if (changed.hasOwnProperty("source")) {
74241         if (changed.source === void 0) {
74242           corePreferences("source", null);
74243         } else if (!onInput) {
74244           corePreferences("source", changed.source);
74245           corePreferences("commentDate", Date.now());
74246         }
74247       }
74248       updateChangeset(changed, onInput);
74249       if (_selection) {
74250         _selection.call(render);
74251       }
74252     }
74253     function findHashtags(tags, commentOnly) {
74254       var detectedHashtags = commentHashtags();
74255       if (detectedHashtags.length) {
74256         corePreferences("hashtags", null);
74257       }
74258       if (!detectedHashtags.length || !commentOnly) {
74259         detectedHashtags = detectedHashtags.concat(hashtagHashtags());
74260       }
74261       var allLowerCase = /* @__PURE__ */ new Set();
74262       return detectedHashtags.filter(function(hashtag) {
74263         var lowerCase = hashtag.toLowerCase();
74264         if (!allLowerCase.has(lowerCase)) {
74265           allLowerCase.add(lowerCase);
74266           return true;
74267         }
74268         return false;
74269       });
74270       function commentHashtags() {
74271         var matches = (tags.comment || "").replace(/http\S*/g, "").match(hashtagRegex);
74272         return matches || [];
74273       }
74274       function hashtagHashtags() {
74275         var matches = (tags.hashtags || "").split(/[,;\s]+/).map(function(s2) {
74276           if (s2[0] !== "#") {
74277             s2 = "#" + s2;
74278           }
74279           var matched = s2.match(hashtagRegex);
74280           return matched && matched[0];
74281         }).filter(Boolean);
74282         return matches || [];
74283       }
74284     }
74285     function isReviewRequested(tags) {
74286       var rr = tags.review_requested;
74287       if (rr === void 0) return false;
74288       rr = rr.trim().toLowerCase();
74289       return !(rr === "" || rr === "no");
74290     }
74291     function updateChangeset(changed, onInput) {
74292       var tags = Object.assign({}, context.changeset.tags);
74293       Object.keys(changed).forEach(function(k2) {
74294         var v2 = changed[k2];
74295         k2 = context.cleanTagKey(k2);
74296         if (readOnlyTags.indexOf(k2) !== -1) return;
74297         if (v2 === void 0) {
74298           delete tags[k2];
74299         } else if (onInput) {
74300           tags[k2] = v2;
74301         } else {
74302           tags[k2] = context.cleanTagValue(v2);
74303         }
74304       });
74305       if (!onInput) {
74306         var commentOnly = changed.hasOwnProperty("comment") && changed.comment !== "";
74307         var arr = findHashtags(tags, commentOnly);
74308         if (arr.length) {
74309           tags.hashtags = context.cleanTagValue(arr.join(";"));
74310           corePreferences("hashtags", tags.hashtags);
74311         } else {
74312           delete tags.hashtags;
74313           corePreferences("hashtags", null);
74314         }
74315       }
74316       if (_userDetails2 && _userDetails2.changesets_count !== void 0) {
74317         var changesetsCount = parseInt(_userDetails2.changesets_count, 10) + 1;
74318         tags.changesets_count = String(changesetsCount);
74319         if (changesetsCount <= 100) {
74320           var s2;
74321           s2 = corePreferences("walkthrough_completed");
74322           if (s2) {
74323             tags["ideditor:walkthrough_completed"] = s2;
74324           }
74325           s2 = corePreferences("walkthrough_progress");
74326           if (s2) {
74327             tags["ideditor:walkthrough_progress"] = s2;
74328           }
74329           s2 = corePreferences("walkthrough_started");
74330           if (s2) {
74331             tags["ideditor:walkthrough_started"] = s2;
74332           }
74333         }
74334       } else {
74335         delete tags.changesets_count;
74336       }
74337       if (!(0, import_fast_deep_equal10.default)(context.changeset.tags, tags)) {
74338         context.changeset = context.changeset.update({ tags });
74339       }
74340     }
74341     commit.reset = function() {
74342       context.changeset = null;
74343     };
74344     return utilRebind(commit, dispatch14, "on");
74345   }
74346
74347   // modules/modes/save.js
74348   function modeSave(context) {
74349     var mode = { id: "save" };
74350     var keybinding = utilKeybinding("modeSave");
74351     var commit = uiCommit(context).on("cancel", cancel);
74352     var _conflictsUi;
74353     var _location;
74354     var _success;
74355     var uploader = context.uploader().on("saveStarted.modeSave", function() {
74356       keybindingOff();
74357     }).on("willAttemptUpload.modeSave", prepareForSuccess).on("progressChanged.modeSave", showProgress).on("resultNoChanges.modeSave", function() {
74358       cancel();
74359     }).on("resultErrors.modeSave", showErrors).on("resultConflicts.modeSave", showConflicts).on("resultSuccess.modeSave", showSuccess);
74360     function cancel() {
74361       context.enter(modeBrowse(context));
74362     }
74363     function showProgress(num, total) {
74364       var modal = context.container().select(".loading-modal .modal-section");
74365       var progress = modal.selectAll(".progress").data([0]);
74366       progress.enter().append("div").attr("class", "progress").merge(progress).text(_t("save.conflict_progress", { num, total }));
74367     }
74368     function showConflicts(changeset, conflicts, origChanges) {
74369       var selection2 = context.container().select(".sidebar").append("div").attr("class", "sidebar-component");
74370       context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
74371       _conflictsUi = uiConflicts(context).conflictList(conflicts).origChanges(origChanges).on("cancel", function() {
74372         context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
74373         selection2.remove();
74374         keybindingOn();
74375         uploader.cancelConflictResolution();
74376       }).on("save", function() {
74377         context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
74378         selection2.remove();
74379         uploader.processResolvedConflicts(changeset);
74380       });
74381       selection2.call(_conflictsUi);
74382     }
74383     function showErrors(errors) {
74384       keybindingOn();
74385       var selection2 = uiConfirm(context.container());
74386       selection2.select(".modal-section.header").append("h3").text(_t("save.error"));
74387       addErrors(selection2, errors);
74388       selection2.okButton();
74389     }
74390     function addErrors(selection2, data) {
74391       var message = selection2.select(".modal-section.message-text");
74392       var items = message.selectAll(".error-container").data(data);
74393       var enter = items.enter().append("div").attr("class", "error-container");
74394       enter.append("a").attr("class", "error-description").attr("href", "#").classed("hide-toggle", true).text(function(d2) {
74395         return d2.msg || _t("save.unknown_error_details");
74396       }).on("click", function(d3_event) {
74397         d3_event.preventDefault();
74398         var error = select_default2(this);
74399         var detail = select_default2(this.nextElementSibling);
74400         var exp2 = error.classed("expanded");
74401         detail.style("display", exp2 ? "none" : "block");
74402         error.classed("expanded", !exp2);
74403       });
74404       var details = enter.append("div").attr("class", "error-detail-container").style("display", "none");
74405       details.append("ul").attr("class", "error-detail-list").selectAll("li").data(function(d2) {
74406         return d2.details || [];
74407       }).enter().append("li").attr("class", "error-detail-item").text(function(d2) {
74408         return d2;
74409       });
74410       items.exit().remove();
74411     }
74412     function showSuccess(changeset) {
74413       commit.reset();
74414       var ui = _success.changeset(changeset).location(_location).on("cancel", function() {
74415         context.ui().sidebar.hide();
74416       });
74417       context.enter(modeBrowse(context).sidebar(ui));
74418     }
74419     function keybindingOn() {
74420       select_default2(document).call(keybinding.on("\u238B", cancel, true));
74421     }
74422     function keybindingOff() {
74423       select_default2(document).call(keybinding.unbind);
74424     }
74425     function prepareForSuccess() {
74426       _success = uiSuccess(context);
74427       _location = null;
74428       if (!services.geocoder) return;
74429       services.geocoder.reverse(context.map().center(), function(err, result) {
74430         if (err || !result || !result.address) return;
74431         var addr = result.address;
74432         var place = addr && (addr.town || addr.city || addr.county) || "";
74433         var region = addr && (addr.state || addr.country) || "";
74434         var separator = place && region ? _t("success.thank_you_where.separator") : "";
74435         _location = _t(
74436           "success.thank_you_where.format",
74437           { place, separator, region }
74438         );
74439       });
74440     }
74441     mode.selectedIDs = function() {
74442       return _conflictsUi ? _conflictsUi.shownEntityIds() : [];
74443     };
74444     mode.enter = function() {
74445       context.ui().sidebar.expand();
74446       function done() {
74447         context.ui().sidebar.show(commit);
74448       }
74449       keybindingOn();
74450       context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
74451       var osm = context.connection();
74452       if (!osm) {
74453         cancel();
74454         return;
74455       }
74456       if (osm.authenticated()) {
74457         done();
74458       } else {
74459         osm.authenticate(function(err) {
74460           if (err) {
74461             cancel();
74462           } else {
74463             done();
74464           }
74465         });
74466       }
74467     };
74468     mode.exit = function() {
74469       keybindingOff();
74470       context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
74471       context.ui().sidebar.hide();
74472     };
74473     return mode;
74474   }
74475
74476   // modules/modes/select_error.js
74477   function modeSelectError(context, selectedErrorID, selectedErrorService) {
74478     var mode = {
74479       id: "select-error",
74480       button: "browse"
74481     };
74482     var keybinding = utilKeybinding("select-error");
74483     var errorService = services[selectedErrorService];
74484     var errorEditor;
74485     switch (selectedErrorService) {
74486       case "keepRight":
74487         errorEditor = uiKeepRightEditor(context).on("change", function() {
74488           context.map().pan([0, 0]);
74489           var error = checkSelectedID();
74490           if (!error) return;
74491           context.ui().sidebar.show(errorEditor.error(error));
74492         });
74493         break;
74494       case "osmose":
74495         errorEditor = uiOsmoseEditor(context).on("change", function() {
74496           context.map().pan([0, 0]);
74497           var error = checkSelectedID();
74498           if (!error) return;
74499           context.ui().sidebar.show(errorEditor.error(error));
74500         });
74501         break;
74502     }
74503     var behaviors = [
74504       behaviorBreathe(context),
74505       behaviorHover(context),
74506       behaviorSelect(context),
74507       behaviorLasso(context),
74508       modeDragNode(context).behavior,
74509       modeDragNote(context).behavior
74510     ];
74511     function checkSelectedID() {
74512       if (!errorService) return;
74513       var error = errorService.getError(selectedErrorID);
74514       if (!error) {
74515         context.enter(modeBrowse(context));
74516       }
74517       return error;
74518     }
74519     mode.zoomToSelected = function() {
74520       if (!errorService) return;
74521       var error = errorService.getError(selectedErrorID);
74522       if (error) {
74523         context.map().centerZoomEase(error.loc, 20);
74524       }
74525     };
74526     mode.enter = function() {
74527       var error = checkSelectedID();
74528       if (!error) return;
74529       behaviors.forEach(context.install);
74530       keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
74531       select_default2(document).call(keybinding);
74532       selectError();
74533       var sidebar = context.ui().sidebar;
74534       sidebar.show(errorEditor.error(error));
74535       context.map().on("drawn.select-error", selectError);
74536       function selectError(d3_event, drawn) {
74537         if (!checkSelectedID()) return;
74538         var selection2 = context.surface().selectAll(".itemId-" + selectedErrorID + "." + selectedErrorService);
74539         if (selection2.empty()) {
74540           var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
74541           if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
74542             context.enter(modeBrowse(context));
74543           }
74544         } else {
74545           selection2.classed("selected", true);
74546           context.selectedErrorID(selectedErrorID);
74547         }
74548       }
74549       function esc() {
74550         if (context.container().select(".combobox").size()) return;
74551         context.enter(modeBrowse(context));
74552       }
74553     };
74554     mode.exit = function() {
74555       behaviors.forEach(context.uninstall);
74556       select_default2(document).call(keybinding.unbind);
74557       context.surface().selectAll(".qaItem.selected").classed("selected hover", false);
74558       context.map().on("drawn.select-error", null);
74559       context.ui().sidebar.hide();
74560       context.selectedErrorID(null);
74561       context.features().forceVisible([]);
74562     };
74563     return mode;
74564   }
74565
74566   // modules/core/context.js
74567   function coreContext() {
74568     const dispatch14 = dispatch_default("enter", "exit", "change");
74569     let context = utilRebind({}, dispatch14, "on");
74570     let _deferred2 = /* @__PURE__ */ new Set();
74571     context.version = package_default.version;
74572     context.privacyVersion = "20201202";
74573     context.initialHashParams = window.location.hash ? utilStringQs(window.location.hash) : {};
74574     context.changeset = null;
74575     let _defaultChangesetComment = context.initialHashParams.comment;
74576     let _defaultChangesetSource = context.initialHashParams.source;
74577     let _defaultChangesetHashtags = context.initialHashParams.hashtags;
74578     context.defaultChangesetComment = function(val) {
74579       if (!arguments.length) return _defaultChangesetComment;
74580       _defaultChangesetComment = val;
74581       return context;
74582     };
74583     context.defaultChangesetSource = function(val) {
74584       if (!arguments.length) return _defaultChangesetSource;
74585       _defaultChangesetSource = val;
74586       return context;
74587     };
74588     context.defaultChangesetHashtags = function(val) {
74589       if (!arguments.length) return _defaultChangesetHashtags;
74590       _defaultChangesetHashtags = val;
74591       return context;
74592     };
74593     let _setsDocumentTitle = true;
74594     context.setsDocumentTitle = function(val) {
74595       if (!arguments.length) return _setsDocumentTitle;
74596       _setsDocumentTitle = val;
74597       return context;
74598     };
74599     let _documentTitleBase = document.title;
74600     context.documentTitleBase = function(val) {
74601       if (!arguments.length) return _documentTitleBase;
74602       _documentTitleBase = val;
74603       return context;
74604     };
74605     let _ui;
74606     context.ui = () => _ui;
74607     context.lastPointerType = () => _ui.lastPointerType();
74608     let _keybinding = utilKeybinding("context");
74609     context.keybinding = () => _keybinding;
74610     select_default2(document).call(_keybinding);
74611     let _connection = services.osm;
74612     let _history;
74613     let _validator;
74614     let _uploader;
74615     context.connection = () => _connection;
74616     context.history = () => _history;
74617     context.validator = () => _validator;
74618     context.uploader = () => _uploader;
74619     context.preauth = (options2) => {
74620       if (_connection) {
74621         _connection.switch(options2);
74622       }
74623       return context;
74624     };
74625     context.locale = function(locale2) {
74626       if (!arguments.length) return _mainLocalizer.localeCode();
74627       _mainLocalizer.preferredLocaleCodes(locale2);
74628       return context;
74629     };
74630     function afterLoad(cid, callback) {
74631       return (err, result) => {
74632         if (err) {
74633           if (err.status === 400 || err.status === 401 || err.status === 403) {
74634             if (_connection) {
74635               _connection.logout();
74636             }
74637           }
74638           if (typeof callback === "function") {
74639             callback(err);
74640           }
74641           return;
74642         } else if (_connection && _connection.getConnectionId() !== cid) {
74643           if (typeof callback === "function") {
74644             callback({ message: "Connection Switched", status: -1 });
74645           }
74646           return;
74647         } else {
74648           _history.merge(result.data, result.extent);
74649           if (typeof callback === "function") {
74650             callback(err, result);
74651           }
74652           return;
74653         }
74654       };
74655     }
74656     context.loadTiles = (projection2, callback) => {
74657       const handle = window.requestIdleCallback(() => {
74658         _deferred2.delete(handle);
74659         if (_connection && context.editableDataEnabled()) {
74660           const cid = _connection.getConnectionId();
74661           _connection.loadTiles(projection2, afterLoad(cid, callback));
74662         }
74663       });
74664       _deferred2.add(handle);
74665     };
74666     context.loadTileAtLoc = (loc, callback) => {
74667       const handle = window.requestIdleCallback(() => {
74668         _deferred2.delete(handle);
74669         if (_connection && context.editableDataEnabled()) {
74670           const cid = _connection.getConnectionId();
74671           _connection.loadTileAtLoc(loc, afterLoad(cid, callback));
74672         }
74673       });
74674       _deferred2.add(handle);
74675     };
74676     context.loadEntity = (entityID, callback) => {
74677       if (_connection) {
74678         const cid = _connection.getConnectionId();
74679         _connection.loadEntity(entityID, afterLoad(cid, callback));
74680         _connection.loadEntityRelations(entityID, afterLoad(cid, callback));
74681       }
74682     };
74683     context.loadNote = (entityID, callback) => {
74684       if (_connection) {
74685         const cid = _connection.getConnectionId();
74686         _connection.loadEntityNote(entityID, afterLoad(cid, callback));
74687       }
74688     };
74689     context.zoomToEntity = (entityID, zoomTo) => {
74690       context.zoomToEntities([entityID], zoomTo);
74691     };
74692     context.zoomToEntities = (entityIDs, zoomTo) => {
74693       let loadedEntities = [];
74694       const throttledZoomTo = throttle_default(() => _map.zoomTo(loadedEntities), 500);
74695       entityIDs.forEach((entityID) => context.loadEntity(entityID, (err, result) => {
74696         if (err) return;
74697         const entity = result.data.find((e3) => e3.id === entityID);
74698         if (!entity) return;
74699         loadedEntities.push(entity);
74700         if (zoomTo !== false) {
74701           throttledZoomTo();
74702         }
74703       }));
74704       _map.on("drawn.zoomToEntity", () => {
74705         if (!entityIDs.every((entityID) => context.hasEntity(entityID))) return;
74706         _map.on("drawn.zoomToEntity", null);
74707         context.on("enter.zoomToEntity", null);
74708         context.enter(modeSelect(context, entityIDs));
74709       });
74710       context.on("enter.zoomToEntity", () => {
74711         if (_mode.id !== "browse") {
74712           _map.on("drawn.zoomToEntity", null);
74713           context.on("enter.zoomToEntity", null);
74714         }
74715       });
74716     };
74717     context.zoomToNote = (noteId, zoomTo) => {
74718       context.loadNote(noteId, (err, result) => {
74719         if (err) return;
74720         const entity = result.data.find((e3) => e3.id === noteId);
74721         if (entity) {
74722           const note = services.osm.getNote(noteId);
74723           if (zoomTo !== false) {
74724             context.map().centerZoom(note.loc, 15);
74725           }
74726           const noteLayer = context.layers().layer("notes");
74727           noteLayer.enabled(true);
74728           context.enter(modeSelectNote(context, noteId));
74729         }
74730       });
74731     };
74732     let _minEditableZoom = 16;
74733     context.minEditableZoom = function(val) {
74734       if (!arguments.length) return _minEditableZoom;
74735       _minEditableZoom = val;
74736       if (_connection) {
74737         _connection.tileZoom(val);
74738       }
74739       return context;
74740     };
74741     context.maxCharsForTagKey = () => 255;
74742     context.maxCharsForTagValue = () => 255;
74743     context.maxCharsForRelationRole = () => 255;
74744     context.cleanTagKey = (val) => utilCleanOsmString(val, context.maxCharsForTagKey());
74745     context.cleanTagValue = (val) => utilCleanOsmString(val, context.maxCharsForTagValue());
74746     context.cleanRelationRole = (val) => utilCleanOsmString(val, context.maxCharsForRelationRole());
74747     let _inIntro = false;
74748     context.inIntro = function(val) {
74749       if (!arguments.length) return _inIntro;
74750       _inIntro = val;
74751       return context;
74752     };
74753     context.save = () => {
74754       if (_inIntro || context.container().select(".modal").size()) return;
74755       let canSave;
74756       if (_mode && _mode.id === "save") {
74757         canSave = false;
74758         if (services.osm && services.osm.isChangesetInflight()) {
74759           _history.clearSaved();
74760           return;
74761         }
74762       } else {
74763         canSave = context.selectedIDs().every((id2) => {
74764           const entity = context.hasEntity(id2);
74765           return entity && !entity.isDegenerate();
74766         });
74767       }
74768       if (canSave) {
74769         _history.save();
74770       }
74771       if (_history.hasChanges()) {
74772         return _t("save.unsaved_changes");
74773       }
74774     };
74775     context.debouncedSave = debounce_default(context.save, 350);
74776     function withDebouncedSave(fn) {
74777       return function() {
74778         const result = fn.apply(_history, arguments);
74779         context.debouncedSave();
74780         return result;
74781       };
74782     }
74783     context.hasEntity = (id2) => _history.graph().hasEntity(id2);
74784     context.entity = (id2) => _history.graph().entity(id2);
74785     let _mode;
74786     context.mode = () => _mode;
74787     context.enter = (newMode) => {
74788       if (_mode) {
74789         _mode.exit();
74790         dispatch14.call("exit", this, _mode);
74791       }
74792       _mode = newMode;
74793       _mode.enter();
74794       dispatch14.call("enter", this, _mode);
74795     };
74796     context.selectedIDs = () => _mode && _mode.selectedIDs && _mode.selectedIDs() || [];
74797     context.activeID = () => _mode && _mode.activeID && _mode.activeID();
74798     let _selectedNoteID;
74799     context.selectedNoteID = function(noteID) {
74800       if (!arguments.length) return _selectedNoteID;
74801       _selectedNoteID = noteID;
74802       return context;
74803     };
74804     let _selectedErrorID;
74805     context.selectedErrorID = function(errorID) {
74806       if (!arguments.length) return _selectedErrorID;
74807       _selectedErrorID = errorID;
74808       return context;
74809     };
74810     context.install = (behavior) => context.surface().call(behavior);
74811     context.uninstall = (behavior) => context.surface().call(behavior.off);
74812     let _copyGraph;
74813     context.copyGraph = () => _copyGraph;
74814     let _copyIDs = [];
74815     context.copyIDs = function(val) {
74816       if (!arguments.length) return _copyIDs;
74817       _copyIDs = val;
74818       _copyGraph = _history.graph();
74819       return context;
74820     };
74821     let _copyLonLat;
74822     context.copyLonLat = function(val) {
74823       if (!arguments.length) return _copyLonLat;
74824       _copyLonLat = val;
74825       return context;
74826     };
74827     let _background;
74828     context.background = () => _background;
74829     let _features;
74830     context.features = () => _features;
74831     context.hasHiddenConnections = (id2) => {
74832       const graph = _history.graph();
74833       const entity = graph.entity(id2);
74834       return _features.hasHiddenConnections(entity, graph);
74835     };
74836     let _photos;
74837     context.photos = () => _photos;
74838     let _map;
74839     context.map = () => _map;
74840     context.layers = () => _map.layers();
74841     context.surface = () => _map.surface;
74842     context.editableDataEnabled = () => _map.editableDataEnabled();
74843     context.surfaceRect = () => _map.surface.node().getBoundingClientRect();
74844     context.editable = () => {
74845       const mode = context.mode();
74846       if (!mode || mode.id === "save") return false;
74847       return _map.editableDataEnabled();
74848     };
74849     let _debugFlags = {
74850       tile: false,
74851       // tile boundaries
74852       collision: false,
74853       // label collision bounding boxes
74854       imagery: false,
74855       // imagery bounding polygons
74856       target: false,
74857       // touch targets
74858       downloaded: false
74859       // downloaded data from osm
74860     };
74861     context.debugFlags = () => _debugFlags;
74862     context.getDebug = (flag) => flag && _debugFlags[flag];
74863     context.setDebug = function(flag, val) {
74864       if (arguments.length === 1) val = true;
74865       _debugFlags[flag] = val;
74866       dispatch14.call("change");
74867       return context;
74868     };
74869     let _container = select_default2(null);
74870     context.container = function(val) {
74871       if (!arguments.length) return _container;
74872       _container = val;
74873       _container.classed("ideditor", true);
74874       return context;
74875     };
74876     context.containerNode = function(val) {
74877       if (!arguments.length) return context.container().node();
74878       context.container(select_default2(val));
74879       return context;
74880     };
74881     let _embed;
74882     context.embed = function(val) {
74883       if (!arguments.length) return _embed;
74884       _embed = val;
74885       return context;
74886     };
74887     let _assetPath = "";
74888     context.assetPath = function(val) {
74889       if (!arguments.length) return _assetPath;
74890       _assetPath = val;
74891       _mainFileFetcher.assetPath(val);
74892       return context;
74893     };
74894     let _assetMap = {};
74895     context.assetMap = function(val) {
74896       if (!arguments.length) return _assetMap;
74897       _assetMap = val;
74898       _mainFileFetcher.assetMap(val);
74899       return context;
74900     };
74901     context.asset = (val) => {
74902       if (/^http(s)?:\/\//i.test(val)) return val;
74903       const filename = _assetPath + val;
74904       return _assetMap[filename] || filename;
74905     };
74906     context.imagePath = (val) => context.asset("img/".concat(val));
74907     context.reset = context.flush = () => {
74908       context.debouncedSave.cancel();
74909       Array.from(_deferred2).forEach((handle) => {
74910         window.cancelIdleCallback(handle);
74911         _deferred2.delete(handle);
74912       });
74913       Object.values(services).forEach((service) => {
74914         if (service && typeof service.reset === "function") {
74915           service.reset(context);
74916         }
74917       });
74918       context.changeset = null;
74919       _validator.reset();
74920       _features.reset();
74921       _history.reset();
74922       _uploader.reset();
74923       context.container().select(".inspector-wrap *").remove();
74924       return context;
74925     };
74926     context.projection = geoRawMercator();
74927     context.curtainProjection = geoRawMercator();
74928     context.init = () => {
74929       instantiateInternal();
74930       initializeDependents();
74931       return context;
74932       function instantiateInternal() {
74933         _history = coreHistory(context);
74934         context.graph = _history.graph;
74935         context.pauseChangeDispatch = _history.pauseChangeDispatch;
74936         context.resumeChangeDispatch = _history.resumeChangeDispatch;
74937         context.perform = withDebouncedSave(_history.perform);
74938         context.replace = withDebouncedSave(_history.replace);
74939         context.pop = withDebouncedSave(_history.pop);
74940         context.overwrite = withDebouncedSave(_history.overwrite);
74941         context.undo = withDebouncedSave(_history.undo);
74942         context.redo = withDebouncedSave(_history.redo);
74943         _validator = coreValidator(context);
74944         _uploader = coreUploader(context);
74945         _background = rendererBackground(context);
74946         _features = rendererFeatures(context);
74947         _map = rendererMap(context);
74948         _photos = rendererPhotos(context);
74949         _ui = uiInit(context);
74950       }
74951       function initializeDependents() {
74952         if (context.initialHashParams.presets) {
74953           _mainPresetIndex.addablePresetIDs(new Set(context.initialHashParams.presets.split(",")));
74954         }
74955         if (context.initialHashParams.locale) {
74956           _mainLocalizer.preferredLocaleCodes(context.initialHashParams.locale);
74957         }
74958         _mainLocalizer.ensureLoaded();
74959         _mainPresetIndex.ensureLoaded();
74960         _background.ensureLoaded();
74961         Object.values(services).forEach((service) => {
74962           if (service && typeof service.init === "function") {
74963             service.init();
74964           }
74965         });
74966         _map.init();
74967         _validator.init();
74968         _features.init();
74969         if (services.maprules && context.initialHashParams.maprules) {
74970           json_default(context.initialHashParams.maprules).then((mapcss) => {
74971             services.maprules.init();
74972             mapcss.forEach((mapcssSelector) => services.maprules.addRule(mapcssSelector));
74973           }).catch(() => {
74974           });
74975         }
74976         if (!context.container().empty()) {
74977           _ui.ensureLoaded().then(() => {
74978             _background.init();
74979             _photos.init();
74980           });
74981         }
74982       }
74983     };
74984     return context;
74985   }
74986
74987   // modules/services/nominatim.js
74988   var apibase = nominatimApiUrl;
74989   var _inflight = {};
74990   var _nominatimCache;
74991   var nominatim_default = {
74992     init: function() {
74993       _inflight = {};
74994       _nominatimCache = new RBush();
74995     },
74996     reset: function() {
74997       Object.values(_inflight).forEach(function(controller) {
74998         controller.abort();
74999       });
75000       _inflight = {};
75001       _nominatimCache = new RBush();
75002     },
75003     countryCode: function(location, callback) {
75004       this.reverse(location, function(err, result) {
75005         if (err) {
75006           return callback(err);
75007         } else if (result.address) {
75008           return callback(null, result.address.country_code);
75009         } else {
75010           return callback("Unable to geocode", null);
75011         }
75012       });
75013     },
75014     reverse: function(loc, callback) {
75015       var cached = _nominatimCache.search(
75016         { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] }
75017       );
75018       if (cached.length > 0) {
75019         if (callback) callback(null, cached[0].data);
75020         return;
75021       }
75022       var params = { zoom: 13, format: "json", addressdetails: 1, lat: loc[1], lon: loc[0] };
75023       var url = apibase + "reverse?" + utilQsString(params);
75024       if (_inflight[url]) return;
75025       var controller = new AbortController();
75026       _inflight[url] = controller;
75027       json_default(url, {
75028         signal: controller.signal,
75029         headers: {
75030           "Accept-Language": _mainLocalizer.localeCodes().join(",")
75031         }
75032       }).then(function(result) {
75033         delete _inflight[url];
75034         if (result && result.error) {
75035           throw new Error(result.error);
75036         }
75037         var extent = geoExtent(loc).padByMeters(200);
75038         _nominatimCache.insert(Object.assign(extent.bbox(), { data: result }));
75039         if (callback) callback(null, result);
75040       }).catch(function(err) {
75041         delete _inflight[url];
75042         if (err.name === "AbortError") return;
75043         if (callback) callback(err.message);
75044       });
75045     },
75046     search: function(val, callback) {
75047       const params = {
75048         q: val,
75049         limit: 10,
75050         format: "json"
75051       };
75052       var url = apibase + "search?" + utilQsString(params);
75053       if (_inflight[url]) return;
75054       var controller = new AbortController();
75055       _inflight[url] = controller;
75056       json_default(url, {
75057         signal: controller.signal,
75058         headers: {
75059           "Accept-Language": _mainLocalizer.localeCodes().join(",")
75060         }
75061       }).then(function(result) {
75062         delete _inflight[url];
75063         if (result && result.error) {
75064           throw new Error(result.error);
75065         }
75066         if (callback) callback(null, result);
75067       }).catch(function(err) {
75068         delete _inflight[url];
75069         if (err.name === "AbortError") return;
75070         if (callback) callback(err.message);
75071       });
75072     }
75073   };
75074
75075   // node_modules/name-suggestion-index/lib/matcher.js
75076   var import_which_polygon4 = __toESM(require_which_polygon(), 1);
75077
75078   // node_modules/name-suggestion-index/lib/simplify.js
75079   var import_diacritics3 = __toESM(require_diacritics(), 1);
75080   function simplify2(str) {
75081     if (typeof str !== "string") return "";
75082     return import_diacritics3.default.remove(
75083       str.replace(/&/g, "and").replace(/İ/ig, "i").replace(/[\s\-=_!"#%'*{},.\/:;?\(\)\[\]@\\$\^*+<>«»~`’\u00a1\u00a7\u00b6\u00b7\u00bf\u037e\u0387\u055a-\u055f\u0589\u05c0\u05c3\u05c6\u05f3\u05f4\u0609\u060a\u060c\u060d\u061b\u061e\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0830-\u083e\u085e\u0964\u0965\u0970\u0af0\u0df4\u0e4f\u0e5a\u0e5b\u0f04-\u0f12\u0f14\u0f85\u0fd0-\u0fd4\u0fd9\u0fda\u104a-\u104f\u10fb\u1360-\u1368\u166d\u166e\u16eb-\u16ed\u1735\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u1805\u1807-\u180a\u1944\u1945\u1a1e\u1a1f\u1aa0-\u1aa6\u1aa8-\u1aad\u1b5a-\u1b60\u1bfc-\u1bff\u1c3b-\u1c3f\u1c7e\u1c7f\u1cc0-\u1cc7\u1cd3\u2000-\u206f\u2cf9-\u2cfc\u2cfe\u2cff\u2d70\u2e00-\u2e7f\u3001-\u3003\u303d\u30fb\ua4fe\ua4ff\ua60d-\ua60f\ua673\ua67e\ua6f2-\ua6f7\ua874-\ua877\ua8ce\ua8cf\ua8f8-\ua8fa\ua92e\ua92f\ua95f\ua9c1-\ua9cd\ua9de\ua9df\uaa5c-\uaa5f\uaade\uaadf\uaaf0\uaaf1\uabeb\ufe10-\ufe16\ufe19\ufe30\ufe45\ufe46\ufe49-\ufe4c\ufe50-\ufe52\ufe54-\ufe57\ufe5f-\ufe61\ufe68\ufe6a\ufe6b\ufeff\uff01-\uff03\uff05-\uff07\uff0a\uff0c\uff0e\uff0f\uff1a\uff1b\uff1f\uff20\uff3c\uff61\uff64\uff65]+/g, "").toLowerCase()
75084     );
75085   }
75086
75087   // node_modules/name-suggestion-index/config/matchGroups.json
75088   var matchGroups_default = {
75089     matchGroups: {
75090       adult_gaming_centre: [
75091         "amenity/casino",
75092         "amenity/gambling",
75093         "leisure/adult_gaming_centre"
75094       ],
75095       beauty: [
75096         "shop/beauty",
75097         "shop/hairdresser_supply"
75098       ],
75099       bed: [
75100         "shop/bed",
75101         "shop/furniture"
75102       ],
75103       beverages: [
75104         "shop/alcohol",
75105         "shop/beer",
75106         "shop/beverages",
75107         "shop/kiosk",
75108         "shop/wine"
75109       ],
75110       camping: [
75111         "tourism/camp_site",
75112         "tourism/caravan_site"
75113       ],
75114       car_parts: [
75115         "shop/car_parts",
75116         "shop/car_repair",
75117         "shop/tires",
75118         "shop/tyres"
75119       ],
75120       clinic: [
75121         "amenity/clinic",
75122         "amenity/doctors",
75123         "healthcare/clinic",
75124         "healthcare/laboratory",
75125         "healthcare/physiotherapist",
75126         "healthcare/sample_collection",
75127         "healthcare/dialysis"
75128       ],
75129       convenience: [
75130         "shop/beauty",
75131         "shop/chemist",
75132         "shop/convenience",
75133         "shop/cosmetics",
75134         "shop/grocery",
75135         "shop/kiosk",
75136         "shop/newsagent",
75137         "shop/perfumery"
75138       ],
75139       coworking: [
75140         "amenity/coworking_space",
75141         "office/coworking",
75142         "office/coworking_space"
75143       ],
75144       dentist: [
75145         "amenity/dentist",
75146         "amenity/doctors",
75147         "healthcare/dentist"
75148       ],
75149       electronics: [
75150         "office/telecommunication",
75151         "shop/computer",
75152         "shop/electronics",
75153         "shop/hifi",
75154         "shop/kiosk",
75155         "shop/mobile",
75156         "shop/mobile_phone",
75157         "shop/telecommunication"
75158       ],
75159       fabric: [
75160         "shop/fabric",
75161         "shop/haberdashery",
75162         "shop/sewing"
75163       ],
75164       fashion: [
75165         "shop/accessories",
75166         "shop/bag",
75167         "shop/boutique",
75168         "shop/clothes",
75169         "shop/department_store",
75170         "shop/fashion",
75171         "shop/fashion_accessories",
75172         "shop/sports",
75173         "shop/shoes"
75174       ],
75175       financial: [
75176         "amenity/bank",
75177         "office/accountant",
75178         "office/financial",
75179         "office/financial_advisor",
75180         "office/tax_advisor",
75181         "shop/tax"
75182       ],
75183       fitness: [
75184         "leisure/fitness_centre",
75185         "leisure/fitness_center",
75186         "leisure/sports_centre",
75187         "leisure/sports_center"
75188       ],
75189       food: [
75190         "amenity/bar",
75191         "amenity/cafe",
75192         "amenity/fast_food",
75193         "amenity/ice_cream",
75194         "amenity/pub",
75195         "amenity/restaurant",
75196         "shop/bakery",
75197         "shop/candy",
75198         "shop/chocolate",
75199         "shop/coffee",
75200         "shop/confectionary",
75201         "shop/confectionery",
75202         "shop/food",
75203         "shop/kiosk",
75204         "shop/ice_cream",
75205         "shop/pastry",
75206         "shop/tea"
75207       ],
75208       fuel: [
75209         "amenity/fuel",
75210         "shop/gas",
75211         "shop/convenience;gas",
75212         "shop/gas;convenience"
75213       ],
75214       gift: [
75215         "shop/gift",
75216         "shop/card",
75217         "shop/cards",
75218         "shop/kiosk",
75219         "shop/stationery"
75220       ],
75221       hardware: [
75222         "shop/bathroom_furnishing",
75223         "shop/carpet",
75224         "shop/diy",
75225         "shop/doityourself",
75226         "shop/doors",
75227         "shop/electrical",
75228         "shop/flooring",
75229         "shop/hardware",
75230         "shop/hardware_store",
75231         "shop/power_tools",
75232         "shop/tool_hire",
75233         "shop/tools",
75234         "shop/trade"
75235       ],
75236       health_food: [
75237         "shop/health",
75238         "shop/health_food",
75239         "shop/herbalist",
75240         "shop/nutrition_supplements"
75241       ],
75242       hobby: [
75243         "shop/electronics",
75244         "shop/hobby",
75245         "shop/books",
75246         "shop/games",
75247         "shop/collector",
75248         "shop/toys",
75249         "shop/model",
75250         "shop/video_games",
75251         "shop/anime"
75252       ],
75253       hospital: [
75254         "amenity/doctors",
75255         "amenity/hospital",
75256         "healthcare/hospital"
75257       ],
75258       houseware: [
75259         "shop/houseware",
75260         "shop/interior_decoration"
75261       ],
75262       lifeboat_station: [
75263         "amenity/lifeboat_station",
75264         "emergency/lifeboat_station",
75265         "emergency/marine_rescue"
75266       ],
75267       lodging: [
75268         "tourism/hotel",
75269         "tourism/motel"
75270       ],
75271       money_transfer: [
75272         "amenity/money_transfer",
75273         "shop/money_transfer"
75274       ],
75275       office_supplies: [
75276         "shop/office_supplies",
75277         "shop/stationary",
75278         "shop/stationery"
75279       ],
75280       outdoor: [
75281         "shop/clothes",
75282         "shop/outdoor",
75283         "shop/sports"
75284       ],
75285       parcel_locker: [
75286         "amenity/parcel_locker",
75287         "amenity/vending_machine"
75288       ],
75289       pharmacy: [
75290         "amenity/doctors",
75291         "amenity/pharmacy",
75292         "healthcare/pharmacy"
75293       ],
75294       playground: [
75295         "amenity/theme_park",
75296         "leisure/amusement_arcade",
75297         "leisure/playground"
75298       ],
75299       rental: [
75300         "amenity/bicycle_rental",
75301         "amenity/boat_rental",
75302         "amenity/car_rental",
75303         "amenity/truck_rental",
75304         "amenity/vehicle_rental",
75305         "shop/kiosk",
75306         "shop/rental"
75307       ],
75308       school: [
75309         "amenity/childcare",
75310         "amenity/college",
75311         "amenity/kindergarten",
75312         "amenity/language_school",
75313         "amenity/prep_school",
75314         "amenity/school",
75315         "amenity/university"
75316       ],
75317       storage: [
75318         "shop/storage_units",
75319         "shop/storage_rental"
75320       ],
75321       substation: [
75322         "power/station",
75323         "power/substation",
75324         "power/sub_station"
75325       ],
75326       supermarket: [
75327         "shop/food",
75328         "shop/frozen_food",
75329         "shop/greengrocer",
75330         "shop/grocery",
75331         "shop/supermarket",
75332         "shop/wholesale"
75333       ],
75334       variety_store: [
75335         "shop/variety_store",
75336         "shop/discount",
75337         "shop/convenience"
75338       ],
75339       vending: [
75340         "amenity/vending_machine",
75341         "shop/kiosk",
75342         "shop/vending_machine"
75343       ],
75344       weight_loss: [
75345         "amenity/clinic",
75346         "amenity/doctors",
75347         "amenity/weight_clinic",
75348         "healthcare/counselling",
75349         "leisure/fitness_centre",
75350         "office/therapist",
75351         "shop/beauty",
75352         "shop/diet",
75353         "shop/food",
75354         "shop/health_food",
75355         "shop/herbalist",
75356         "shop/nutrition",
75357         "shop/nutrition_supplements",
75358         "shop/weight_loss"
75359       ],
75360       wholesale: [
75361         "shop/wholesale",
75362         "shop/supermarket",
75363         "shop/department_store"
75364       ]
75365     }
75366   };
75367
75368   // node_modules/name-suggestion-index/config/genericWords.json
75369   var genericWords_default = {
75370     genericWords: [
75371       "^(barn|bazaa?r|bench|bou?tique|building|casa|church)$",
75372       "^(baseball|basketball|football|soccer|softball|tennis(halle)?)\\s?(field|court)?$",
75373       "^(club|green|out|ware)\\s?house$",
75374       "^(driveway|el \xE1rbol|fountain|generic|golf|government|graveyard)$",
75375       "^(fixme|n\\s?\\/?\\s?a|name|no\\s?name|none|null|temporary|test|unknown)$",
75376       "^(hofladen|librairie|magazine?|maison)$",
75377       "^(mobile home|skate)?\\s?park$",
75378       "^(obuwie|pond|pool|sale|shops?|sklep|stores?)$",
75379       "^\\?+$",
75380       "^private$",
75381       "^tattoo( studio)?$",
75382       "^windmill$",
75383       "^\u0446\u0435\u0440\u043A\u043E\u0432\u043D\u0430\u044F( \u043B\u0430\u0432\u043A\u0430)?$"
75384     ]
75385   };
75386
75387   // node_modules/name-suggestion-index/config/trees.json
75388   var trees_default = {
75389     trees: {
75390       brands: {
75391         emoji: "\u{1F354}",
75392         mainTag: "brand:wikidata",
75393         sourceTags: ["brand", "name"],
75394         nameTags: {
75395           primary: "^(name|name:\\w+)$",
75396           alternate: "^(brand|brand:\\w+|operator|operator:\\w+|\\w+_name|\\w+_name:\\w+)$"
75397         }
75398       },
75399       flags: {
75400         emoji: "\u{1F6A9}",
75401         mainTag: "flag:wikidata",
75402         nameTags: {
75403           primary: "^(flag:name|flag:name:\\w+)$",
75404           alternate: "^(country|country:\\w+|flag|flag:\\w+|subject|subject:\\w+)$"
75405         }
75406       },
75407       operators: {
75408         emoji: "\u{1F4BC}",
75409         mainTag: "operator:wikidata",
75410         sourceTags: ["operator"],
75411         nameTags: {
75412           primary: "^(name|name:\\w+|operator|operator:\\w+)$",
75413           alternate: "^(brand|brand:\\w+|\\w+_name|\\w+_name:\\w+)$"
75414         }
75415       },
75416       transit: {
75417         emoji: "\u{1F687}",
75418         mainTag: "network:wikidata",
75419         sourceTags: ["network"],
75420         nameTags: {
75421           primary: "^network$",
75422           alternate: "^(operator|operator:\\w+|network:\\w+|\\w+_name|\\w+_name:\\w+)$"
75423         }
75424       }
75425     }
75426   };
75427
75428   // node_modules/name-suggestion-index/lib/matcher.js
75429   var matchGroups = matchGroups_default.matchGroups;
75430   var trees = trees_default.trees;
75431   var Matcher = class {
75432     //
75433     // `constructor`
75434     // initialize the genericWords regexes
75435     constructor() {
75436       this.matchIndex = void 0;
75437       this.genericWords = /* @__PURE__ */ new Map();
75438       (genericWords_default.genericWords || []).forEach((s2) => this.genericWords.set(s2, new RegExp(s2, "i")));
75439       this.itemLocation = void 0;
75440       this.locationSets = void 0;
75441       this.locationIndex = void 0;
75442       this.warnings = [];
75443     }
75444     //
75445     // `buildMatchIndex()`
75446     // Call this to prepare the matcher for use
75447     //
75448     // `data` needs to be an Object indexed on a 'tree/key/value' path.
75449     // (e.g. cache filled by `fileTree.read` or data found in `dist/nsi.json`)
75450     // {
75451     //    'brands/amenity/bank': { properties: {}, items: [ {}, {}, … ] },
75452     //    'brands/amenity/bar':  { properties: {}, items: [ {}, {}, … ] },
75453     //    …
75454     // }
75455     //
75456     buildMatchIndex(data) {
75457       const that = this;
75458       if (that.matchIndex) return;
75459       that.matchIndex = /* @__PURE__ */ new Map();
75460       const seenTree = /* @__PURE__ */ new Map();
75461       Object.keys(data).forEach((tkv) => {
75462         const category = data[tkv];
75463         const parts = tkv.split("/", 3);
75464         const t2 = parts[0];
75465         const k2 = parts[1];
75466         const v2 = parts[2];
75467         const thiskv = "".concat(k2, "/").concat(v2);
75468         const tree = trees[t2];
75469         let branch = that.matchIndex.get(thiskv);
75470         if (!branch) {
75471           branch = {
75472             primary: /* @__PURE__ */ new Map(),
75473             alternate: /* @__PURE__ */ new Map(),
75474             excludeGeneric: /* @__PURE__ */ new Map(),
75475             excludeNamed: /* @__PURE__ */ new Map()
75476           };
75477           that.matchIndex.set(thiskv, branch);
75478         }
75479         const properties = category.properties || {};
75480         const exclude = properties.exclude || {};
75481         (exclude.generic || []).forEach((s2) => branch.excludeGeneric.set(s2, new RegExp(s2, "i")));
75482         (exclude.named || []).forEach((s2) => branch.excludeNamed.set(s2, new RegExp(s2, "i")));
75483         const excludeRegexes = [...branch.excludeGeneric.values(), ...branch.excludeNamed.values()];
75484         let items = category.items;
75485         if (!Array.isArray(items) || !items.length) return;
75486         const primaryName = new RegExp(tree.nameTags.primary, "i");
75487         const alternateName = new RegExp(tree.nameTags.alternate, "i");
75488         const notName = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
75489         const skipGenericKV = skipGenericKVMatches(t2, k2, v2);
75490         const genericKV = /* @__PURE__ */ new Set(["".concat(k2, "/yes"), "building/yes"]);
75491         const matchGroupKV = /* @__PURE__ */ new Set();
75492         Object.values(matchGroups).forEach((matchGroup) => {
75493           const inGroup = matchGroup.some((otherkv) => otherkv === thiskv);
75494           if (!inGroup) return;
75495           matchGroup.forEach((otherkv) => {
75496             if (otherkv === thiskv) return;
75497             matchGroupKV.add(otherkv);
75498             const otherk = otherkv.split("/", 2)[0];
75499             genericKV.add("".concat(otherk, "/yes"));
75500           });
75501         });
75502         items.forEach((item) => {
75503           if (!item.id) return;
75504           if (Array.isArray(item.matchTags) && item.matchTags.length) {
75505             item.matchTags = item.matchTags.filter((matchTag) => !matchGroupKV.has(matchTag) && !genericKV.has(matchTag));
75506             if (!item.matchTags.length) delete item.matchTags;
75507           }
75508           let kvTags = ["".concat(thiskv)].concat(item.matchTags || []);
75509           if (!skipGenericKV) {
75510             kvTags = kvTags.concat(Array.from(genericKV));
75511           }
75512           Object.keys(item.tags).forEach((osmkey) => {
75513             if (notName.test(osmkey)) return;
75514             const osmvalue = item.tags[osmkey];
75515             if (!osmvalue || excludeRegexes.some((regex) => regex.test(osmvalue))) return;
75516             if (primaryName.test(osmkey)) {
75517               kvTags.forEach((kv) => insertName("primary", t2, kv, simplify2(osmvalue), item.id));
75518             } else if (alternateName.test(osmkey)) {
75519               kvTags.forEach((kv) => insertName("alternate", t2, kv, simplify2(osmvalue), item.id));
75520             }
75521           });
75522           let keepMatchNames = /* @__PURE__ */ new Set();
75523           (item.matchNames || []).forEach((matchName) => {
75524             const nsimple = simplify2(matchName);
75525             kvTags.forEach((kv) => {
75526               const branch2 = that.matchIndex.get(kv);
75527               const primaryLeaf = branch2 && branch2.primary.get(nsimple);
75528               const alternateLeaf = branch2 && branch2.alternate.get(nsimple);
75529               const inPrimary = primaryLeaf && primaryLeaf.has(item.id);
75530               const inAlternate = alternateLeaf && alternateLeaf.has(item.id);
75531               if (!inPrimary && !inAlternate) {
75532                 insertName("alternate", t2, kv, nsimple, item.id);
75533                 keepMatchNames.add(matchName);
75534               }
75535             });
75536           });
75537           if (keepMatchNames.size) {
75538             item.matchNames = Array.from(keepMatchNames);
75539           } else {
75540             delete item.matchNames;
75541           }
75542         });
75543       });
75544       function insertName(which, t2, kv, nsimple, itemID) {
75545         if (!nsimple) {
75546           that.warnings.push("Warning: skipping empty ".concat(which, " name for item ").concat(t2, "/").concat(kv, ": ").concat(itemID));
75547           return;
75548         }
75549         let branch = that.matchIndex.get(kv);
75550         if (!branch) {
75551           branch = {
75552             primary: /* @__PURE__ */ new Map(),
75553             alternate: /* @__PURE__ */ new Map(),
75554             excludeGeneric: /* @__PURE__ */ new Map(),
75555             excludeNamed: /* @__PURE__ */ new Map()
75556           };
75557           that.matchIndex.set(kv, branch);
75558         }
75559         let leaf = branch[which].get(nsimple);
75560         if (!leaf) {
75561           leaf = /* @__PURE__ */ new Set();
75562           branch[which].set(nsimple, leaf);
75563         }
75564         leaf.add(itemID);
75565         if (!/yes$/.test(kv)) {
75566           const kvnsimple = "".concat(kv, "/").concat(nsimple);
75567           const existing = seenTree.get(kvnsimple);
75568           if (existing && existing !== t2) {
75569             const items = Array.from(leaf);
75570             that.warnings.push('Duplicate cache key "'.concat(kvnsimple, '" in trees "').concat(t2, '" and "').concat(existing, '", check items: ').concat(items));
75571             return;
75572           }
75573           seenTree.set(kvnsimple, t2);
75574         }
75575       }
75576       function skipGenericKVMatches(t2, k2, v2) {
75577         return t2 === "flags" || t2 === "transit" || k2 === "landuse" || v2 === "atm" || v2 === "bicycle_parking" || v2 === "car_sharing" || v2 === "caravan_site" || v2 === "charging_station" || v2 === "dog_park" || v2 === "parking" || v2 === "phone" || v2 === "playground" || v2 === "post_box" || v2 === "public_bookcase" || v2 === "recycling" || v2 === "vending_machine";
75578       }
75579     }
75580     //
75581     // `buildLocationIndex()`
75582     // Call this to prepare a which-polygon location index.
75583     // This *resolves* all the locationSets into GeoJSON, which takes some time.
75584     // You can skip this step if you don't care about matching within a location.
75585     //
75586     // `data` needs to be an Object indexed on a 'tree/key/value' path.
75587     // (e.g. cache filled by `fileTree.read` or data found in `dist/nsi.json`)
75588     // {
75589     //    'brands/amenity/bank': { properties: {}, items: [ {}, {}, … ] },
75590     //    'brands/amenity/bar':  { properties: {}, items: [ {}, {}, … ] },
75591     //    …
75592     // }
75593     //
75594     buildLocationIndex(data, loco) {
75595       const that = this;
75596       if (that.locationIndex) return;
75597       that.itemLocation = /* @__PURE__ */ new Map();
75598       that.locationSets = /* @__PURE__ */ new Map();
75599       Object.keys(data).forEach((tkv) => {
75600         const items = data[tkv].items;
75601         if (!Array.isArray(items) || !items.length) return;
75602         items.forEach((item) => {
75603           if (that.itemLocation.has(item.id)) return;
75604           let resolved;
75605           try {
75606             resolved = loco.resolveLocationSet(item.locationSet);
75607           } catch (err) {
75608             console.warn("buildLocationIndex: ".concat(err.message));
75609           }
75610           if (!resolved || !resolved.id) return;
75611           that.itemLocation.set(item.id, resolved.id);
75612           if (that.locationSets.has(resolved.id)) return;
75613           let feature3 = _cloneDeep2(resolved.feature);
75614           feature3.id = resolved.id;
75615           feature3.properties.id = resolved.id;
75616           if (!feature3.geometry.coordinates.length || !feature3.properties.area) {
75617             console.warn("buildLocationIndex: locationSet ".concat(resolved.id, " for ").concat(item.id, " resolves to an empty feature:"));
75618             console.warn(JSON.stringify(feature3));
75619             return;
75620           }
75621           that.locationSets.set(resolved.id, feature3);
75622         });
75623       });
75624       that.locationIndex = (0, import_which_polygon4.default)({ type: "FeatureCollection", features: [...that.locationSets.values()] });
75625       function _cloneDeep2(obj) {
75626         return JSON.parse(JSON.stringify(obj));
75627       }
75628     }
75629     //
75630     // `match()`
75631     // Pass parts and return an Array of matches.
75632     // `k` - key
75633     // `v` - value
75634     // `n` - namelike
75635     // `loc` - optional - [lon,lat] location to search
75636     //
75637     // 1. If the [k,v,n] tuple matches a canonical item…
75638     // Return an Array of match results.
75639     // Each result will include the area in km² that the item is valid.
75640     //
75641     // Order of results:
75642     // Primary ordering will be on the "match" column:
75643     //   "primary" - where the query matches the `name` tag, followed by
75644     //   "alternate" - where the query matches an alternate name tag (e.g. short_name, brand, operator, etc)
75645     // Secondary ordering will be on the "area" column:
75646     //   "area descending" if no location was provided, (worldwide before local)
75647     //   "area ascending" if location was provided (local before worldwide)
75648     //
75649     // [
75650     //   { match: 'primary',   itemID: String,  area: Number,  kv: String,  nsimple: String },
75651     //   { match: 'primary',   itemID: String,  area: Number,  kv: String,  nsimple: String },
75652     //   { match: 'alternate', itemID: String,  area: Number,  kv: String,  nsimple: String },
75653     //   { match: 'alternate', itemID: String,  area: Number,  kv: String,  nsimple: String },
75654     //   …
75655     // ]
75656     //
75657     // -or-
75658     //
75659     // 2. If the [k,v,n] tuple matches an exclude pattern…
75660     // Return an Array with a single exclude result, either
75661     //
75662     // [ { match: 'excludeGeneric', pattern: String,  kv: String } ]  // "generic" e.g. "Food Court"
75663     //   or
75664     // [ { match: 'excludeNamed', pattern: String,  kv: String } ]    // "named", e.g. "Kebabai"
75665     //
75666     // About results
75667     //   "generic" - a generic word that is probably not really a name.
75668     //     For these, iD should warn the user "Hey don't put 'food court' in the name tag".
75669     //   "named" - a real name like "Kebabai" that is just common, but not a brand.
75670     //     For these, iD should just let it be. We don't include these in NSI, but we don't want to nag users about it either.
75671     //
75672     // -or-
75673     //
75674     // 3. If the [k,v,n] tuple matches nothing of any kind, return `null`
75675     //
75676     //
75677     match(k2, v2, n3, loc) {
75678       const that = this;
75679       if (!that.matchIndex) {
75680         throw new Error("match:  matchIndex not built.");
75681       }
75682       let matchLocations;
75683       if (Array.isArray(loc) && that.locationIndex) {
75684         matchLocations = that.locationIndex([loc[0], loc[1], loc[0], loc[1]], true);
75685       }
75686       const nsimple = simplify2(n3);
75687       let seen = /* @__PURE__ */ new Set();
75688       let results = [];
75689       gatherResults("primary");
75690       gatherResults("alternate");
75691       if (results.length) return results;
75692       gatherResults("exclude");
75693       return results.length ? results : null;
75694       function gatherResults(which) {
75695         const kv = "".concat(k2, "/").concat(v2);
75696         let didMatch = tryMatch(which, kv);
75697         if (didMatch) return;
75698         for (let mg in matchGroups) {
75699           const matchGroup = matchGroups[mg];
75700           const inGroup = matchGroup.some((otherkv) => otherkv === kv);
75701           if (!inGroup) continue;
75702           for (let i3 = 0; i3 < matchGroup.length; i3++) {
75703             const otherkv = matchGroup[i3];
75704             if (otherkv === kv) continue;
75705             didMatch = tryMatch(which, otherkv);
75706             if (didMatch) return;
75707           }
75708         }
75709         if (which === "exclude") {
75710           const regex = [...that.genericWords.values()].find((regex2) => regex2.test(n3));
75711           if (regex) {
75712             results.push({ match: "excludeGeneric", pattern: String(regex) });
75713             return;
75714           }
75715         }
75716       }
75717       function tryMatch(which, kv) {
75718         const branch = that.matchIndex.get(kv);
75719         if (!branch) return;
75720         if (which === "exclude") {
75721           let regex = [...branch.excludeNamed.values()].find((regex2) => regex2.test(n3));
75722           if (regex) {
75723             results.push({ match: "excludeNamed", pattern: String(regex), kv });
75724             return;
75725           }
75726           regex = [...branch.excludeGeneric.values()].find((regex2) => regex2.test(n3));
75727           if (regex) {
75728             results.push({ match: "excludeGeneric", pattern: String(regex), kv });
75729             return;
75730           }
75731           return;
75732         }
75733         const leaf = branch[which].get(nsimple);
75734         if (!leaf || !leaf.size) return;
75735         let hits = Array.from(leaf).map((itemID) => {
75736           let area = Infinity;
75737           if (that.itemLocation && that.locationSets) {
75738             const location = that.locationSets.get(that.itemLocation.get(itemID));
75739             area = location && location.properties.area || Infinity;
75740           }
75741           return { match: which, itemID, area, kv, nsimple };
75742         });
75743         let sortFn = byAreaDescending;
75744         if (matchLocations) {
75745           hits = hits.filter(isValidLocation);
75746           sortFn = byAreaAscending;
75747         }
75748         if (!hits.length) return;
75749         hits.sort(sortFn).forEach((hit) => {
75750           if (seen.has(hit.itemID)) return;
75751           seen.add(hit.itemID);
75752           results.push(hit);
75753         });
75754         return true;
75755         function isValidLocation(hit) {
75756           if (!that.itemLocation) return true;
75757           return matchLocations.find((props) => props.id === that.itemLocation.get(hit.itemID));
75758         }
75759         function byAreaAscending(hitA, hitB) {
75760           return hitA.area - hitB.area;
75761         }
75762         function byAreaDescending(hitA, hitB) {
75763           return hitB.area - hitA.area;
75764         }
75765       }
75766     }
75767     //
75768     // `getWarnings()`
75769     // Return any warnings discovered when buiding the index.
75770     // (currently this does nothing)
75771     //
75772     getWarnings() {
75773       return this.warnings;
75774     }
75775   };
75776
75777   // modules/services/nsi.js
75778   var import_vparse2 = __toESM(require_vparse());
75779   var _nsiStatus = "loading";
75780   var _nsi = {};
75781   var buildingPreset = {
75782     "building/commercial": true,
75783     "building/government": true,
75784     "building/hotel": true,
75785     "building/retail": true,
75786     "building/office": true,
75787     "building/supermarket": true,
75788     "building/yes": true
75789   };
75790   var notNames = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
75791   var notBranches = /(coop|express|wireless|factory|outlet)/i;
75792   function setNsiSources() {
75793     const nsiVersion = package_default.dependencies["name-suggestion-index"] || package_default.devDependencies["name-suggestion-index"];
75794     const v2 = (0, import_vparse2.default)(nsiVersion);
75795     const vMinor = "".concat(v2.major, ".").concat(v2.minor);
75796     const cdn = nsiCdnUrl.replace("{version}", vMinor);
75797     const sources = {
75798       "nsi_data": cdn + "dist/nsi.min.json",
75799       "nsi_dissolved": cdn + "dist/dissolved.min.json",
75800       "nsi_features": cdn + "dist/featureCollection.min.json",
75801       "nsi_generics": cdn + "dist/genericWords.min.json",
75802       "nsi_presets": cdn + "dist/presets/nsi-id-presets.min.json",
75803       "nsi_replacements": cdn + "dist/replacements.min.json",
75804       "nsi_trees": cdn + "dist/trees.min.json"
75805     };
75806     let fileMap = _mainFileFetcher.fileMap();
75807     for (const k2 in sources) {
75808       if (!fileMap[k2]) fileMap[k2] = sources[k2];
75809     }
75810   }
75811   function loadNsiPresets() {
75812     return Promise.all([
75813       _mainFileFetcher.get("nsi_presets"),
75814       _mainFileFetcher.get("nsi_features")
75815     ]).then((vals) => {
75816       Object.values(vals[0].presets).forEach((preset) => preset.suggestion = true);
75817       Object.values(vals[0].presets).forEach((preset) => {
75818         if (preset.tags["brand:wikidata"]) {
75819           preset.removeTags = { "brand:wikipedia": "*", ...preset.removeTags || preset.addTags || preset.tags };
75820         }
75821         if (preset.tags["operator:wikidata"]) {
75822           preset.removeTags = { "operator:wikipedia": "*", ...preset.removeTags || preset.addTags || preset.tags };
75823         }
75824         if (preset.tags["network:wikidata"]) {
75825           preset.removeTags = { "network:wikipedia": "*", ...preset.removeTags || preset.addTags || preset.tags };
75826         }
75827       });
75828       _mainPresetIndex.merge({
75829         presets: vals[0].presets,
75830         featureCollection: vals[1]
75831       });
75832     });
75833   }
75834   function loadNsiData() {
75835     return Promise.all([
75836       _mainFileFetcher.get("nsi_data"),
75837       _mainFileFetcher.get("nsi_dissolved"),
75838       _mainFileFetcher.get("nsi_replacements"),
75839       _mainFileFetcher.get("nsi_trees")
75840     ]).then((vals) => {
75841       _nsi = {
75842         data: vals[0].nsi,
75843         // the raw name-suggestion-index data
75844         dissolved: vals[1].dissolved,
75845         // list of dissolved items
75846         replacements: vals[2].replacements,
75847         // trivial old->new qid replacements
75848         trees: vals[3].trees,
75849         // metadata about trees, main tags
75850         kvt: /* @__PURE__ */ new Map(),
75851         // Map (k -> Map (v -> t) )
75852         qids: /* @__PURE__ */ new Map(),
75853         // Map (wd/wp tag values -> qids)
75854         ids: /* @__PURE__ */ new Map()
75855         // Map (id -> NSI item)
75856       };
75857       const matcher = _nsi.matcher = new Matcher();
75858       matcher.buildMatchIndex(_nsi.data);
75859       matcher.itemLocation = /* @__PURE__ */ new Map();
75860       matcher.locationSets = /* @__PURE__ */ new Map();
75861       Object.keys(_nsi.data).forEach((tkv) => {
75862         const items = _nsi.data[tkv].items;
75863         if (!Array.isArray(items) || !items.length) return;
75864         items.forEach((item) => {
75865           if (matcher.itemLocation.has(item.id)) return;
75866           const locationSetID = _sharedLocationManager.locationSetID(item.locationSet);
75867           matcher.itemLocation.set(item.id, locationSetID);
75868           if (matcher.locationSets.has(locationSetID)) return;
75869           const fakeFeature = { id: locationSetID, properties: { id: locationSetID, area: 1 } };
75870           matcher.locationSets.set(locationSetID, fakeFeature);
75871         });
75872       });
75873       matcher.locationIndex = (bbox2) => {
75874         const validHere = _sharedLocationManager.locationSetsAt([bbox2[0], bbox2[1]]);
75875         const results = [];
75876         for (const [locationSetID, area] of Object.entries(validHere)) {
75877           const fakeFeature = matcher.locationSets.get(locationSetID);
75878           if (fakeFeature) {
75879             fakeFeature.properties.area = area;
75880             results.push(fakeFeature);
75881           }
75882         }
75883         return results;
75884       };
75885       Object.keys(_nsi.data).forEach((tkv) => {
75886         const category = _nsi.data[tkv];
75887         const parts = tkv.split("/", 3);
75888         const t2 = parts[0];
75889         const k2 = parts[1];
75890         const v2 = parts[2];
75891         let vmap = _nsi.kvt.get(k2);
75892         if (!vmap) {
75893           vmap = /* @__PURE__ */ new Map();
75894           _nsi.kvt.set(k2, vmap);
75895         }
75896         vmap.set(v2, t2);
75897         const tree = _nsi.trees[t2];
75898         const mainTag = tree.mainTag;
75899         const items = category.items || [];
75900         items.forEach((item) => {
75901           item.tkv = tkv;
75902           item.mainTag = mainTag;
75903           _nsi.ids.set(item.id, item);
75904           const wd = item.tags[mainTag];
75905           const wp = item.tags[mainTag.replace("wikidata", "wikipedia")];
75906           if (wd) _nsi.qids.set(wd, wd);
75907           if (wp && wd) _nsi.qids.set(wp, wd);
75908         });
75909       });
75910     });
75911   }
75912   function gatherKVs(tags) {
75913     let primary = /* @__PURE__ */ new Set();
75914     let alternate = /* @__PURE__ */ new Set();
75915     Object.keys(tags).forEach((osmkey) => {
75916       const osmvalue = tags[osmkey];
75917       if (!osmvalue) return;
75918       if (osmkey === "route_master") osmkey = "route";
75919       const vmap = _nsi.kvt.get(osmkey);
75920       if (!vmap) return;
75921       if (vmap.get(osmvalue)) {
75922         primary.add("".concat(osmkey, "/").concat(osmvalue));
75923       } else if (osmvalue === "yes") {
75924         alternate.add("".concat(osmkey, "/").concat(osmvalue));
75925       }
75926     });
75927     const preset = _mainPresetIndex.matchTags(tags, "area");
75928     if (buildingPreset[preset.id]) {
75929       alternate.add("building/yes");
75930     }
75931     return { primary, alternate };
75932   }
75933   function identifyTree(tags) {
75934     let unknown;
75935     let t2;
75936     Object.keys(tags).forEach((osmkey) => {
75937       if (t2) return;
75938       const osmvalue = tags[osmkey];
75939       if (!osmvalue) return;
75940       if (osmkey === "route_master") osmkey = "route";
75941       const vmap = _nsi.kvt.get(osmkey);
75942       if (!vmap) return;
75943       if (osmvalue === "yes") {
75944         unknown = "unknown";
75945       } else {
75946         t2 = vmap.get(osmvalue);
75947       }
75948     });
75949     return t2 || unknown || null;
75950   }
75951   function gatherNames(tags) {
75952     const empty2 = { primary: /* @__PURE__ */ new Set(), alternate: /* @__PURE__ */ new Set() };
75953     let primary = /* @__PURE__ */ new Set();
75954     let alternate = /* @__PURE__ */ new Set();
75955     let foundSemi = false;
75956     let testNameFragments = false;
75957     let patterns2;
75958     let t2 = identifyTree(tags);
75959     if (!t2) return empty2;
75960     if (t2 === "transit") {
75961       patterns2 = {
75962         primary: /^network$/i,
75963         alternate: /^(operator|operator:\w+|network:\w+|\w+_name|\w+_name:\w+)$/i
75964       };
75965     } else if (t2 === "flags") {
75966       patterns2 = {
75967         primary: /^(flag:name|flag:name:\w+)$/i,
75968         alternate: /^(flag|flag:\w+|subject|subject:\w+)$/i
75969         // note: no `country`, we special-case it below
75970       };
75971     } else if (t2 === "brands") {
75972       testNameFragments = true;
75973       patterns2 = {
75974         primary: /^(name|name:\w+)$/i,
75975         alternate: /^(brand|brand:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
75976       };
75977     } else if (t2 === "operators") {
75978       testNameFragments = true;
75979       patterns2 = {
75980         primary: /^(name|name:\w+|operator|operator:\w+)$/i,
75981         alternate: /^(brand|brand:\w+|\w+_name|\w+_name:\w+)/i
75982       };
75983     } else {
75984       testNameFragments = true;
75985       patterns2 = {
75986         primary: /^(name|name:\w+)$/i,
75987         alternate: /^(brand|brand:\w+|network|network:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
75988       };
75989     }
75990     if (tags.name && testNameFragments) {
75991       const nameParts = tags.name.split(/[\s\-\/,.]/);
75992       for (let split = nameParts.length; split > 0; split--) {
75993         const name = nameParts.slice(0, split).join(" ");
75994         primary.add(name);
75995       }
75996     }
75997     Object.keys(tags).forEach((osmkey) => {
75998       const osmvalue = tags[osmkey];
75999       if (!osmvalue) return;
76000       if (isNamelike(osmkey, "primary")) {
76001         if (/;/.test(osmvalue)) {
76002           foundSemi = true;
76003         } else {
76004           primary.add(osmvalue);
76005           alternate.delete(osmvalue);
76006         }
76007       } else if (!primary.has(osmvalue) && isNamelike(osmkey, "alternate")) {
76008         if (/;/.test(osmvalue)) {
76009           foundSemi = true;
76010         } else {
76011           alternate.add(osmvalue);
76012         }
76013       }
76014     });
76015     if (tags.man_made === "flagpole" && !primary.size && !alternate.size && !!tags.country) {
76016       const osmvalue = tags.country;
76017       if (/;/.test(osmvalue)) {
76018         foundSemi = true;
76019       } else {
76020         alternate.add(osmvalue);
76021       }
76022     }
76023     if (foundSemi) {
76024       return empty2;
76025     } else {
76026       return { primary, alternate };
76027     }
76028     function isNamelike(osmkey, which) {
76029       if (osmkey === "old_name") return false;
76030       return patterns2[which].test(osmkey) && !notNames.test(osmkey);
76031     }
76032   }
76033   function gatherTuples(tryKVs, tryNames) {
76034     let tuples = [];
76035     ["primary", "alternate"].forEach((whichName) => {
76036       const arr = Array.from(tryNames[whichName]).sort((a2, b2) => b2.length - a2.length);
76037       arr.forEach((n3) => {
76038         ["primary", "alternate"].forEach((whichKV) => {
76039           tryKVs[whichKV].forEach((kv) => {
76040             const parts = kv.split("/", 2);
76041             const k2 = parts[0];
76042             const v2 = parts[1];
76043             tuples.push({ k: k2, v: v2, n: n3 });
76044           });
76045         });
76046       });
76047     });
76048     return tuples;
76049   }
76050   function _upgradeTags(tags, loc) {
76051     let newTags = Object.assign({}, tags);
76052     let changed = false;
76053     Object.keys(newTags).forEach((osmkey) => {
76054       const matchTag = osmkey.match(/^(\w+:)?wikidata$/);
76055       if (matchTag) {
76056         const prefix = matchTag[1] || "";
76057         const wd = newTags[osmkey];
76058         const replace = _nsi.replacements[wd];
76059         if (replace && replace.wikidata !== void 0) {
76060           changed = true;
76061           if (replace.wikidata) {
76062             newTags[osmkey] = replace.wikidata;
76063           } else {
76064             delete newTags[osmkey];
76065           }
76066         }
76067         if (replace && replace.wikipedia !== void 0) {
76068           changed = true;
76069           const wpkey = "".concat(prefix, "wikipedia");
76070           if (replace.wikipedia) {
76071             newTags[wpkey] = replace.wikipedia;
76072           } else {
76073             delete newTags[wpkey];
76074           }
76075         }
76076       }
76077     });
76078     const isRouteMaster = tags.type === "route_master";
76079     const tryKVs = gatherKVs(tags);
76080     if (!tryKVs.primary.size && !tryKVs.alternate.size) {
76081       return changed ? { newTags, matched: null } : null;
76082     }
76083     const tryNames = gatherNames(tags);
76084     const foundQID = _nsi.qids.get(tags.wikidata) || _nsi.qids.get(tags.wikipedia);
76085     if (foundQID) tryNames.primary.add(foundQID);
76086     if (!tryNames.primary.size && !tryNames.alternate.size) {
76087       return changed ? { newTags, matched: null } : null;
76088     }
76089     const tuples = gatherTuples(tryKVs, tryNames);
76090     for (let i3 = 0; i3 < tuples.length; i3++) {
76091       const tuple = tuples[i3];
76092       const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n, loc);
76093       if (!hits || !hits.length) continue;
76094       if (hits[0].match !== "primary" && hits[0].match !== "alternate") break;
76095       let itemID, item;
76096       for (let j2 = 0; j2 < hits.length; j2++) {
76097         const hit = hits[j2];
76098         itemID = hit.itemID;
76099         if (_nsi.dissolved[itemID]) continue;
76100         item = _nsi.ids.get(itemID);
76101         if (!item) continue;
76102         const mainTag = item.mainTag;
76103         const itemQID = item.tags[mainTag];
76104         const notQID = newTags["not:".concat(mainTag)];
76105         if (
76106           // Exceptions, skip this hit
76107           !itemQID || itemQID === notQID || // No `*:wikidata` or matched a `not:*:wikidata`
76108           newTags.office && !item.tags.office
76109         ) {
76110           item = null;
76111           continue;
76112         } else {
76113           break;
76114         }
76115       }
76116       if (!item) continue;
76117       item = JSON.parse(JSON.stringify(item));
76118       const tkv = item.tkv;
76119       const parts = tkv.split("/", 3);
76120       const k2 = parts[1];
76121       const v2 = parts[2];
76122       const category = _nsi.data[tkv];
76123       const properties = category.properties || {};
76124       let preserveTags = item.preserveTags || properties.preserveTags || [];
76125       ["building", "emergency", "internet_access", "takeaway"].forEach((osmkey) => {
76126         if (k2 !== osmkey) preserveTags.push("^".concat(osmkey, "$"));
76127       });
76128       const regexes = preserveTags.map((s2) => new RegExp(s2, "i"));
76129       let keepTags = {};
76130       Object.keys(newTags).forEach((osmkey) => {
76131         if (regexes.some((regex) => regex.test(osmkey))) {
76132           keepTags[osmkey] = newTags[osmkey];
76133         }
76134       });
76135       _nsi.kvt.forEach((vmap, k3) => {
76136         if (newTags[k3] === "yes") delete newTags[k3];
76137       });
76138       if (foundQID) {
76139         delete newTags.wikipedia;
76140         delete newTags.wikidata;
76141       }
76142       Object.assign(newTags, item.tags, keepTags);
76143       if (isRouteMaster) {
76144         newTags.route_master = newTags.route;
76145         delete newTags.route;
76146       }
76147       const origName = tags.name;
76148       const newName = newTags.name;
76149       if (newName && origName && newName !== origName && !newTags.branch) {
76150         const newNames = gatherNames(newTags);
76151         const newSet = /* @__PURE__ */ new Set([...newNames.primary, ...newNames.alternate]);
76152         const isMoved = newSet.has(origName);
76153         if (!isMoved) {
76154           const nameParts = origName.split(/[\s\-\/,.]/);
76155           for (let split = nameParts.length; split > 0; split--) {
76156             const name = nameParts.slice(0, split).join(" ");
76157             const branch = nameParts.slice(split).join(" ");
76158             const nameHits = _nsi.matcher.match(k2, v2, name, loc);
76159             if (!nameHits || !nameHits.length) continue;
76160             if (nameHits.some((hit) => hit.itemID === itemID)) {
76161               if (branch) {
76162                 if (notBranches.test(branch)) {
76163                   newTags.name = origName;
76164                 } else {
76165                   const branchHits = _nsi.matcher.match(k2, v2, branch, loc);
76166                   if (branchHits && branchHits.length) {
76167                     if (branchHits[0].match === "primary" || branchHits[0].match === "alternate") {
76168                       return null;
76169                     }
76170                   } else {
76171                     newTags.branch = branch;
76172                   }
76173                 }
76174               }
76175               break;
76176             }
76177           }
76178         }
76179       }
76180       return { newTags, matched: item };
76181     }
76182     return changed ? { newTags, matched: null } : null;
76183   }
76184   function _isGenericName(tags) {
76185     const n3 = tags.name;
76186     if (!n3) return false;
76187     const tryNames = { primary: /* @__PURE__ */ new Set([n3]), alternate: /* @__PURE__ */ new Set() };
76188     const tryKVs = gatherKVs(tags);
76189     if (!tryKVs.primary.size && !tryKVs.alternate.size) return false;
76190     const tuples = gatherTuples(tryKVs, tryNames);
76191     for (let i3 = 0; i3 < tuples.length; i3++) {
76192       const tuple = tuples[i3];
76193       const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n);
76194       if (hits && hits.length && hits[0].match === "excludeGeneric") return true;
76195     }
76196     return false;
76197   }
76198   var nsi_default = {
76199     // `init()`
76200     // On init, start preparing the name-suggestion-index
76201     //
76202     init: () => {
76203       setNsiSources();
76204       _mainPresetIndex.ensureLoaded().then(() => loadNsiPresets()).then(() => loadNsiData()).then(() => _nsiStatus = "ok").catch(() => _nsiStatus = "failed");
76205     },
76206     // `reset()`
76207     // Reset is called when user saves data to OSM (does nothing here)
76208     //
76209     reset: () => {
76210     },
76211     // `status()`
76212     // To let other code know how it's going...
76213     //
76214     // Returns
76215     //   `String`: 'loading', 'ok', 'failed'
76216     //
76217     status: () => _nsiStatus,
76218     // `isGenericName()`
76219     // Is the `name` tag generic?
76220     //
76221     // Arguments
76222     //   `tags`: `Object` containing the feature's OSM tags
76223     // Returns
76224     //   `true` if it is generic, `false` if not
76225     //
76226     isGenericName: (tags) => _isGenericName(tags),
76227     // `upgradeTags()`
76228     // Suggest tag upgrades.
76229     // This function will not modify the input tags, it makes a copy.
76230     //
76231     // Arguments
76232     //   `tags`: `Object` containing the feature's OSM tags
76233     //   `loc`: Location where this feature exists, as a [lon, lat]
76234     // Returns
76235     //   `Object` containing the result, or `null` if no changes needed:
76236     //   {
76237     //     'newTags': `Object` - The tags the the feature should have
76238     //     'matched': `Object` - The matched item
76239     //   }
76240     //
76241     upgradeTags: (tags, loc) => _upgradeTags(tags, loc),
76242     // `cache()`
76243     // Direct access to the NSI cache, useful for testing or breaking things
76244     //
76245     // Returns
76246     //   `Object`: the internal NSI cache
76247     //
76248     cache: () => _nsi
76249   };
76250
76251   // modules/services/kartaview.js
76252   var apibase2 = "https://kartaview.org";
76253   var maxResults = 1e3;
76254   var tileZoom = 14;
76255   var tiler3 = utilTiler().zoomExtent([tileZoom, tileZoom]).skipNullIsland(true);
76256   var dispatch6 = dispatch_default("loadedImages");
76257   var imgZoom2 = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
76258   var _oscCache;
76259   var _oscSelectedImage;
76260   var _loadViewerPromise2;
76261   function abortRequest3(controller) {
76262     controller.abort();
76263   }
76264   function maxPageAtZoom(z2) {
76265     if (z2 < 15) return 2;
76266     if (z2 === 15) return 5;
76267     if (z2 === 16) return 10;
76268     if (z2 === 17) return 20;
76269     if (z2 === 18) return 40;
76270     if (z2 > 18) return 80;
76271   }
76272   function loadTiles2(which, url, projection2) {
76273     var currZoom = Math.floor(geoScaleToZoom(projection2.scale()));
76274     var tiles = tiler3.getTiles(projection2);
76275     var cache = _oscCache[which];
76276     Object.keys(cache.inflight).forEach(function(k2) {
76277       var wanted = tiles.find(function(tile) {
76278         return k2.indexOf(tile.id + ",") === 0;
76279       });
76280       if (!wanted) {
76281         abortRequest3(cache.inflight[k2]);
76282         delete cache.inflight[k2];
76283       }
76284     });
76285     tiles.forEach(function(tile) {
76286       loadNextTilePage(which, currZoom, url, tile);
76287     });
76288   }
76289   function loadNextTilePage(which, currZoom, url, tile) {
76290     var cache = _oscCache[which];
76291     var bbox2 = tile.extent.bbox();
76292     var maxPages = maxPageAtZoom(currZoom);
76293     var nextPage = cache.nextPage[tile.id] || 1;
76294     var params = utilQsString({
76295       ipp: maxResults,
76296       page: nextPage,
76297       // client_id: clientId,
76298       bbTopLeft: [bbox2.maxY, bbox2.minX].join(","),
76299       bbBottomRight: [bbox2.minY, bbox2.maxX].join(",")
76300     }, true);
76301     if (nextPage > maxPages) return;
76302     var id2 = tile.id + "," + String(nextPage);
76303     if (cache.loaded[id2] || cache.inflight[id2]) return;
76304     var controller = new AbortController();
76305     cache.inflight[id2] = controller;
76306     var options2 = {
76307       method: "POST",
76308       signal: controller.signal,
76309       body: params,
76310       headers: { "Content-Type": "application/x-www-form-urlencoded" }
76311     };
76312     json_default(url, options2).then(function(data) {
76313       cache.loaded[id2] = true;
76314       delete cache.inflight[id2];
76315       if (!data || !data.currentPageItems || !data.currentPageItems.length) {
76316         throw new Error("No Data");
76317       }
76318       var features = data.currentPageItems.map(function(item) {
76319         var loc = [+item.lng, +item.lat];
76320         var d2;
76321         if (which === "images") {
76322           d2 = {
76323             loc,
76324             key: item.id,
76325             ca: +item.heading,
76326             captured_at: item.shot_date || item.date_added,
76327             captured_by: item.username,
76328             imagePath: item.lth_name,
76329             sequence_id: item.sequence_id,
76330             sequence_index: +item.sequence_index
76331           };
76332           var seq = _oscCache.sequences[d2.sequence_id];
76333           if (!seq) {
76334             seq = { rotation: 0, images: [] };
76335             _oscCache.sequences[d2.sequence_id] = seq;
76336           }
76337           seq.images[d2.sequence_index] = d2;
76338           _oscCache.images.forImageKey[d2.key] = d2;
76339         }
76340         return {
76341           minX: loc[0],
76342           minY: loc[1],
76343           maxX: loc[0],
76344           maxY: loc[1],
76345           data: d2
76346         };
76347       });
76348       cache.rtree.load(features);
76349       if (data.currentPageItems.length === maxResults) {
76350         cache.nextPage[tile.id] = nextPage + 1;
76351         loadNextTilePage(which, currZoom, url, tile);
76352       } else {
76353         cache.nextPage[tile.id] = Infinity;
76354       }
76355       if (which === "images") {
76356         dispatch6.call("loadedImages");
76357       }
76358     }).catch(function() {
76359       cache.loaded[id2] = true;
76360       delete cache.inflight[id2];
76361     });
76362   }
76363   function partitionViewport2(projection2) {
76364     var z2 = geoScaleToZoom(projection2.scale());
76365     var z22 = Math.ceil(z2 * 2) / 2 + 2.5;
76366     var tiler8 = utilTiler().zoomExtent([z22, z22]);
76367     return tiler8.getTiles(projection2).map(function(tile) {
76368       return tile.extent;
76369     });
76370   }
76371   function searchLimited2(limit, projection2, rtree) {
76372     limit = limit || 5;
76373     return partitionViewport2(projection2).reduce(function(result, extent) {
76374       var found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
76375         return d2.data;
76376       });
76377       return found.length ? result.concat(found) : result;
76378     }, []);
76379   }
76380   var kartaview_default = {
76381     init: function() {
76382       if (!_oscCache) {
76383         this.reset();
76384       }
76385       this.event = utilRebind(this, dispatch6, "on");
76386     },
76387     reset: function() {
76388       if (_oscCache) {
76389         Object.values(_oscCache.images.inflight).forEach(abortRequest3);
76390       }
76391       _oscCache = {
76392         images: { inflight: {}, loaded: {}, nextPage: {}, rtree: new RBush(), forImageKey: {} },
76393         sequences: {}
76394       };
76395       _oscSelectedImage = null;
76396     },
76397     images: function(projection2) {
76398       var limit = 5;
76399       return searchLimited2(limit, projection2, _oscCache.images.rtree);
76400     },
76401     sequences: function(projection2) {
76402       var viewport = projection2.clipExtent();
76403       var min3 = [viewport[0][0], viewport[1][1]];
76404       var max3 = [viewport[1][0], viewport[0][1]];
76405       var bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
76406       var sequenceKeys = {};
76407       _oscCache.images.rtree.search(bbox2).forEach(function(d2) {
76408         sequenceKeys[d2.data.sequence_id] = true;
76409       });
76410       var lineStrings = [];
76411       Object.keys(sequenceKeys).forEach(function(sequenceKey) {
76412         var seq = _oscCache.sequences[sequenceKey];
76413         var images = seq && seq.images;
76414         if (images) {
76415           lineStrings.push({
76416             type: "LineString",
76417             coordinates: images.map(function(d2) {
76418               return d2.loc;
76419             }).filter(Boolean),
76420             properties: {
76421               captured_at: images[0] ? images[0].captured_at : null,
76422               captured_by: images[0] ? images[0].captured_by : null,
76423               key: sequenceKey
76424             }
76425           });
76426         }
76427       });
76428       return lineStrings;
76429     },
76430     cachedImage: function(imageKey) {
76431       return _oscCache.images.forImageKey[imageKey];
76432     },
76433     loadImages: function(projection2) {
76434       var url = apibase2 + "/1.0/list/nearby-photos/";
76435       loadTiles2("images", url, projection2);
76436     },
76437     ensureViewerLoaded: function(context) {
76438       if (_loadViewerPromise2) return _loadViewerPromise2;
76439       var wrap2 = context.container().select(".photoviewer").selectAll(".kartaview-wrapper").data([0]);
76440       var that = this;
76441       var wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper kartaview-wrapper").classed("hide", true).call(imgZoom2.on("zoom", zoomPan2)).on("dblclick.zoom", null);
76442       wrapEnter.append("div").attr("class", "photo-attribution fillD");
76443       var controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
76444       controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
76445       controlsEnter.append("button").on("click.rotate-ccw", rotate(-90)).text("\u293F");
76446       controlsEnter.append("button").on("click.rotate-cw", rotate(90)).text("\u293E");
76447       controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
76448       wrapEnter.append("div").attr("class", "kartaview-image-wrap");
76449       context.ui().photoviewer.on("resize.kartaview", function(dimensions) {
76450         imgZoom2.extent([[0, 0], dimensions]).translateExtent([[0, 0], dimensions]);
76451       });
76452       function zoomPan2(d3_event) {
76453         var t2 = d3_event.transform;
76454         context.container().select(".photoviewer .kartaview-image-wrap").call(utilSetTransform, t2.x, t2.y, t2.k);
76455       }
76456       function rotate(deg) {
76457         return function() {
76458           if (!_oscSelectedImage) return;
76459           var sequenceKey = _oscSelectedImage.sequence_id;
76460           var sequence = _oscCache.sequences[sequenceKey];
76461           if (!sequence) return;
76462           var r2 = sequence.rotation || 0;
76463           r2 += deg;
76464           if (r2 > 180) r2 -= 360;
76465           if (r2 < -180) r2 += 360;
76466           sequence.rotation = r2;
76467           var wrap3 = context.container().select(".photoviewer .kartaview-wrapper");
76468           wrap3.transition().duration(100).call(imgZoom2.transform, identity2);
76469           wrap3.selectAll(".kartaview-image").transition().duration(100).style("transform", "rotate(" + r2 + "deg)");
76470         };
76471       }
76472       function step(stepBy) {
76473         return function() {
76474           if (!_oscSelectedImage) return;
76475           var sequenceKey = _oscSelectedImage.sequence_id;
76476           var sequence = _oscCache.sequences[sequenceKey];
76477           if (!sequence) return;
76478           var nextIndex = _oscSelectedImage.sequence_index + stepBy;
76479           var nextImage = sequence.images[nextIndex];
76480           if (!nextImage) return;
76481           context.map().centerEase(nextImage.loc);
76482           that.selectImage(context, nextImage.key);
76483         };
76484       }
76485       _loadViewerPromise2 = Promise.resolve();
76486       return _loadViewerPromise2;
76487     },
76488     showViewer: function(context) {
76489       var viewer = context.container().select(".photoviewer").classed("hide", false);
76490       var isHidden = viewer.selectAll(".photo-wrapper.kartaview-wrapper.hide").size();
76491       if (isHidden) {
76492         viewer.selectAll(".photo-wrapper:not(.kartaview-wrapper)").classed("hide", true);
76493         viewer.selectAll(".photo-wrapper.kartaview-wrapper").classed("hide", false);
76494       }
76495       return this;
76496     },
76497     hideViewer: function(context) {
76498       _oscSelectedImage = null;
76499       this.updateUrlImage(null);
76500       var viewer = context.container().select(".photoviewer");
76501       if (!viewer.empty()) viewer.datum(null);
76502       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
76503       context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
76504       return this.setStyles(context, null, true);
76505     },
76506     selectImage: function(context, imageKey) {
76507       var d2 = this.cachedImage(imageKey);
76508       _oscSelectedImage = d2;
76509       this.updateUrlImage(imageKey);
76510       var viewer = context.container().select(".photoviewer");
76511       if (!viewer.empty()) viewer.datum(d2);
76512       this.setStyles(context, null, true);
76513       context.container().selectAll(".icon-sign").classed("currentView", false);
76514       if (!d2) return this;
76515       var wrap2 = context.container().select(".photoviewer .kartaview-wrapper");
76516       var imageWrap = wrap2.selectAll(".kartaview-image-wrap");
76517       var attribution = wrap2.selectAll(".photo-attribution").text("");
76518       wrap2.transition().duration(100).call(imgZoom2.transform, identity2);
76519       imageWrap.selectAll(".kartaview-image").remove();
76520       if (d2) {
76521         var sequence = _oscCache.sequences[d2.sequence_id];
76522         var r2 = sequence && sequence.rotation || 0;
76523         imageWrap.append("img").attr("class", "kartaview-image").attr("src", apibase2 + "/" + d2.imagePath).style("transform", "rotate(" + r2 + "deg)");
76524         if (d2.captured_by) {
76525           attribution.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://kartaview.org/user/" + encodeURIComponent(d2.captured_by)).text("@" + d2.captured_by);
76526           attribution.append("span").text("|");
76527         }
76528         if (d2.captured_at) {
76529           attribution.append("span").attr("class", "captured_at").text(localeDateString2(d2.captured_at));
76530           attribution.append("span").text("|");
76531         }
76532         attribution.append("a").attr("class", "image-link").attr("target", "_blank").attr("href", "https://kartaview.org/details/" + d2.sequence_id + "/" + d2.sequence_index).text("kartaview.org");
76533       }
76534       return this;
76535       function localeDateString2(s2) {
76536         if (!s2) return null;
76537         var options2 = { day: "numeric", month: "short", year: "numeric" };
76538         var d4 = new Date(s2);
76539         if (isNaN(d4.getTime())) return null;
76540         return d4.toLocaleDateString(_mainLocalizer.localeCode(), options2);
76541       }
76542     },
76543     getSelectedImage: function() {
76544       return _oscSelectedImage;
76545     },
76546     getSequenceKeyForImage: function(d2) {
76547       return d2 && d2.sequence_id;
76548     },
76549     // Updates the currently highlighted sequence and selected bubble.
76550     // Reset is only necessary when interacting with the viewport because
76551     // this implicitly changes the currently selected bubble/sequence
76552     setStyles: function(context, hovered, reset) {
76553       if (reset) {
76554         context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
76555         context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
76556       }
76557       var hoveredImageKey = hovered && hovered.key;
76558       var hoveredSequenceKey = this.getSequenceKeyForImage(hovered);
76559       var hoveredSequence = hoveredSequenceKey && _oscCache.sequences[hoveredSequenceKey];
76560       var hoveredImageKeys = hoveredSequence && hoveredSequence.images.map(function(d2) {
76561         return d2.key;
76562       }) || [];
76563       var viewer = context.container().select(".photoviewer");
76564       var selected = viewer.empty() ? void 0 : viewer.datum();
76565       var selectedImageKey = selected && selected.key;
76566       var selectedSequenceKey = this.getSequenceKeyForImage(selected);
76567       var selectedSequence = selectedSequenceKey && _oscCache.sequences[selectedSequenceKey];
76568       var selectedImageKeys = selectedSequence && selectedSequence.images.map(function(d2) {
76569         return d2.key;
76570       }) || [];
76571       var highlightedImageKeys = utilArrayUnion(hoveredImageKeys, selectedImageKeys);
76572       context.container().selectAll(".layer-kartaview .viewfield-group").classed("highlighted", function(d2) {
76573         return highlightedImageKeys.indexOf(d2.key) !== -1;
76574       }).classed("hovered", function(d2) {
76575         return d2.key === hoveredImageKey;
76576       }).classed("currentView", function(d2) {
76577         return d2.key === selectedImageKey;
76578       });
76579       context.container().selectAll(".layer-kartaview .sequence").classed("highlighted", function(d2) {
76580         return d2.properties.key === hoveredSequenceKey;
76581       }).classed("currentView", function(d2) {
76582         return d2.properties.key === selectedSequenceKey;
76583       });
76584       context.container().selectAll(".layer-kartaview .viewfield-group .viewfield").attr("d", viewfieldPath);
76585       function viewfieldPath() {
76586         var d2 = this.parentNode.__data__;
76587         if (d2.pano && d2.key !== selectedImageKey) {
76588           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
76589         } else {
76590           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
76591         }
76592       }
76593       return this;
76594     },
76595     updateUrlImage: function(imageKey) {
76596       if (!window.mocha) {
76597         var hash = utilStringQs(window.location.hash);
76598         if (imageKey) {
76599           hash.photo = "kartaview/" + imageKey;
76600         } else {
76601           delete hash.photo;
76602         }
76603         window.location.replace("#" + utilQsString(hash, true));
76604       }
76605     },
76606     cache: function() {
76607       return _oscCache;
76608     }
76609   };
76610
76611   // modules/services/pannellum_photo.js
76612   var pannellumViewerCSS = "pannellum/pannellum.css";
76613   var pannellumViewerJS = "pannellum/pannellum.js";
76614   var dispatch7 = dispatch_default("viewerChanged");
76615   var _currScenes = [];
76616   var _pannellumViewer;
76617   var pannellum_photo_default = {
76618     init: async function(context, selection2) {
76619       selection2.append("div").attr("class", "photo-frame pannellum-frame").attr("id", "ideditor-pannellum-viewer").classed("hide", true).on("keydown", function(e3) {
76620         e3.stopPropagation();
76621       });
76622       if (!window.pannellum) {
76623         await this.loadPannellum(context);
76624       }
76625       const options2 = {
76626         "default": { firstScene: "" },
76627         scenes: {},
76628         minHfov: 20
76629       };
76630       _pannellumViewer = window.pannellum.viewer("ideditor-pannellum-viewer", options2);
76631       _pannellumViewer.on("mousedown", () => {
76632         select_default2(window).on("pointermove.pannellum mousemove.pannellum", () => {
76633           dispatch7.call("viewerChanged");
76634         });
76635       }).on("mouseup", () => {
76636         select_default2(window).on("pointermove.pannellum mousemove.pannellum", null);
76637       }).on("animatefinished", () => {
76638         dispatch7.call("viewerChanged");
76639       });
76640       context.ui().photoviewer.on("resize.pannellum", () => {
76641         _pannellumViewer.resize();
76642       });
76643       this.event = utilRebind(this, dispatch7, "on");
76644       return this;
76645     },
76646     loadPannellum: function(context) {
76647       const head = select_default2("head");
76648       return Promise.all([
76649         new Promise((resolve, reject) => {
76650           head.selectAll("#ideditor-pannellum-viewercss").data([0]).enter().append("link").attr("id", "ideditor-pannellum-viewercss").attr("rel", "stylesheet").attr("crossorigin", "anonymous").attr("href", context.asset(pannellumViewerCSS)).on("load.pannellum", resolve).on("error.pannellum", reject);
76651         }),
76652         new Promise((resolve, reject) => {
76653           head.selectAll("#ideditor-pannellum-viewerjs").data([0]).enter().append("script").attr("id", "ideditor-pannellum-viewerjs").attr("crossorigin", "anonymous").attr("src", context.asset(pannellumViewerJS)).on("load.pannellum", resolve).on("error.pannellum", reject);
76654         })
76655       ]);
76656     },
76657     showPhotoFrame: function(context) {
76658       const isHidden = context.selectAll(".photo-frame.pannellum-frame.hide").size();
76659       if (isHidden) {
76660         context.selectAll(".photo-frame:not(.pannellum-frame)").classed("hide", true);
76661         context.selectAll(".photo-frame.pannellum-frame").classed("hide", false);
76662       }
76663       return this;
76664     },
76665     hidePhotoFrame: function(viewerContext) {
76666       viewerContext.select("photo-frame.pannellum-frame").classed("hide", false);
76667       return this;
76668     },
76669     selectPhoto: function(data, keepOrientation) {
76670       const { key } = data;
76671       if (!(key in _currScenes)) {
76672         let newSceneOptions = {
76673           showFullscreenCtrl: false,
76674           autoLoad: false,
76675           compass: false,
76676           yaw: 0,
76677           type: "equirectangular",
76678           preview: data.preview_path,
76679           panorama: data.image_path,
76680           northOffset: data.ca
76681         };
76682         _currScenes.push(key);
76683         _pannellumViewer.addScene(key, newSceneOptions);
76684       }
76685       let yaw = 0;
76686       let pitch = 0;
76687       if (keepOrientation) {
76688         yaw = this.getYaw();
76689         pitch = _pannellumViewer.getPitch();
76690       }
76691       _pannellumViewer.loadScene(key, pitch, yaw);
76692       dispatch7.call("viewerChanged");
76693       if (_currScenes.length > 3) {
76694         const old_key = _currScenes.shift();
76695         _pannellumViewer.removeScene(old_key);
76696       }
76697       _pannellumViewer.resize();
76698       return this;
76699     },
76700     getYaw: function() {
76701       return _pannellumViewer.getYaw();
76702     }
76703   };
76704
76705   // modules/services/vegbilder.js
76706   var owsEndpoint = "https://www.vegvesen.no/kart/ogc/vegbilder_1_0/ows?";
76707   var tileZoom2 = 14;
76708   var tiler4 = utilTiler().zoomExtent([tileZoom2, tileZoom2]).skipNullIsland(true);
76709   var dispatch8 = dispatch_default("loadedImages", "viewerChanged");
76710   var directionEnum = Object.freeze({
76711     forward: Symbol(0),
76712     backward: Symbol(1)
76713   });
76714   var _planeFrame;
76715   var _pannellumFrame;
76716   var _currentFrame;
76717   var _loadViewerPromise3;
76718   var _vegbilderCache;
76719   async function fetchAvailableLayers() {
76720     var _a3, _b3, _c;
76721     const params = {
76722       service: "WFS",
76723       request: "GetCapabilities",
76724       version: "2.0.0"
76725     };
76726     const urlForRequest = owsEndpoint + utilQsString(params);
76727     const response = await xml_default(urlForRequest);
76728     const xPathSelector = "/wfs:WFS_Capabilities/wfs:FeatureTypeList/wfs:FeatureType/wfs:Name";
76729     const regexMatcher = /^vegbilder_1_0:Vegbilder(?<image_type>_360)?_(?<year>\d{4})$/;
76730     const NSResolver = response.createNSResolver(response);
76731     const l2 = response.evaluate(
76732       xPathSelector,
76733       response,
76734       NSResolver,
76735       XPathResult.ANY_TYPE
76736     );
76737     let node;
76738     const availableLayers = [];
76739     while ((node = l2.iterateNext()) !== null) {
76740       const match = (_a3 = node.textContent) == null ? void 0 : _a3.match(regexMatcher);
76741       if (match) {
76742         availableLayers.push({
76743           name: match[0],
76744           is_sphere: !!((_b3 = match.groups) == null ? void 0 : _b3.image_type),
76745           year: parseInt((_c = match.groups) == null ? void 0 : _c.year, 10)
76746         });
76747       }
76748     }
76749     return availableLayers;
76750   }
76751   function filterAvailableLayers(photoContex) {
76752     const fromDateString = photoContex.fromDate();
76753     const toDateString = photoContex.toDate();
76754     const fromYear = fromDateString ? new Date(fromDateString).getFullYear() : 2016;
76755     const toYear = toDateString ? new Date(toDateString).getFullYear() : null;
76756     const showsFlat = photoContex.showsFlat();
76757     const showsPano = photoContex.showsPanoramic();
76758     return Array.from(_vegbilderCache.wfslayers.values()).filter(({ layerInfo }) => layerInfo.year >= fromYear && (!toYear || layerInfo.year <= toYear) && (!layerInfo.is_sphere && showsFlat || layerInfo.is_sphere && showsPano));
76759   }
76760   function loadWFSLayers(projection2, margin, wfslayers) {
76761     const tiles = tiler4.margin(margin).getTiles(projection2);
76762     for (const cache of wfslayers) {
76763       loadWFSLayer(projection2, cache, tiles);
76764     }
76765   }
76766   function loadWFSLayer(projection2, cache, tiles) {
76767     for (const [key, controller] of cache.inflight.entries()) {
76768       const wanted = tiles.some((tile) => key === tile.id);
76769       if (!wanted) {
76770         controller.abort();
76771         cache.inflight.delete(key);
76772       }
76773     }
76774     Promise.all(tiles.map(
76775       (tile) => loadTile2(cache, cache.layerInfo.name, tile)
76776     )).then(() => orderSequences(projection2, cache));
76777   }
76778   async function loadTile2(cache, typename, tile) {
76779     const bbox2 = tile.extent.bbox();
76780     const tileid = tile.id;
76781     if (cache.loaded.get(tileid) === true || cache.inflight.has(tileid)) return;
76782     const params = {
76783       service: "WFS",
76784       request: "GetFeature",
76785       version: "2.0.0",
76786       typenames: typename,
76787       bbox: [bbox2.minY, bbox2.minX, bbox2.maxY, bbox2.maxX].join(","),
76788       outputFormat: "json"
76789     };
76790     const controller = new AbortController();
76791     cache.inflight.set(tileid, controller);
76792     const options2 = {
76793       method: "GET",
76794       signal: controller.signal
76795     };
76796     const urlForRequest = owsEndpoint + utilQsString(params);
76797     let featureCollection;
76798     try {
76799       featureCollection = await json_default(urlForRequest, options2);
76800     } catch {
76801       cache.loaded.set(tileid, false);
76802       return;
76803     } finally {
76804       cache.inflight.delete(tileid);
76805     }
76806     cache.loaded.set(tileid, true);
76807     if (featureCollection.features.length === 0) {
76808       return;
76809     }
76810     const features = featureCollection.features.map((feature3) => {
76811       const loc = feature3.geometry.coordinates;
76812       const key = feature3.id;
76813       const properties = feature3.properties;
76814       const {
76815         RETNING: ca,
76816         TIDSPUNKT: captured_at,
76817         URL: image_path,
76818         URLPREVIEW: preview_path,
76819         BILDETYPE: image_type,
76820         METER: metering,
76821         FELTKODE: lane_code
76822       } = properties;
76823       const lane_number = parseInt(lane_code.match(/^[0-9]+/)[0], 10);
76824       const direction = lane_number % 2 === 0 ? directionEnum.backward : directionEnum.forward;
76825       const data = {
76826         loc,
76827         key,
76828         ca,
76829         image_path,
76830         preview_path,
76831         road_reference: roadReference(properties),
76832         metering,
76833         lane_code,
76834         direction,
76835         captured_at: new Date(captured_at),
76836         is_sphere: image_type === "360"
76837       };
76838       cache.points.set(key, data);
76839       return {
76840         minX: loc[0],
76841         minY: loc[1],
76842         maxX: loc[0],
76843         maxY: loc[1],
76844         data
76845       };
76846     });
76847     _vegbilderCache.rtree.load(features);
76848     dispatch8.call("loadedImages");
76849   }
76850   function orderSequences(projection2, cache) {
76851     const { points } = cache;
76852     const grouped = Array.from(points.values()).reduce((grouped2, image) => {
76853       const key = image.road_reference;
76854       if (grouped2.has(key)) {
76855         grouped2.get(key).push(image);
76856       } else {
76857         grouped2.set(key, [image]);
76858       }
76859       return grouped2;
76860     }, /* @__PURE__ */ new Map());
76861     const imageSequences = Array.from(grouped.values()).reduce((imageSequences2, imageGroup) => {
76862       imageGroup.sort((a2, b2) => {
76863         if (a2.captured_at.valueOf() > b2.captured_at.valueOf()) {
76864           return 1;
76865         } else if (a2.captured_at.valueOf() < b2.captured_at.valueOf()) {
76866           return -1;
76867         } else {
76868           const { direction } = a2;
76869           if (direction === directionEnum.forward) {
76870             return a2.metering - b2.metering;
76871           } else {
76872             return b2.metering - a2.metering;
76873           }
76874         }
76875       });
76876       let imageSequence = [imageGroup[0]];
76877       let angle2 = null;
76878       for (const [lastImage, image] of pairs(imageGroup)) {
76879         if (lastImage.ca === null) {
76880           const b2 = projection2(lastImage.loc);
76881           const a2 = projection2(image.loc);
76882           if (!geoVecEqual(a2, b2)) {
76883             angle2 = geoVecAngle(a2, b2);
76884             angle2 *= 180 / Math.PI;
76885             angle2 -= 90;
76886             angle2 = angle2 >= 0 ? angle2 : angle2 + 360;
76887           }
76888           lastImage.ca = angle2;
76889         }
76890         if (image.direction === lastImage.direction && image.captured_at.valueOf() - lastImage.captured_at.valueOf() <= 2e4) {
76891           imageSequence.push(image);
76892         } else {
76893           imageSequences2.push(imageSequence);
76894           imageSequence = [image];
76895         }
76896       }
76897       imageSequences2.push(imageSequence);
76898       return imageSequences2;
76899     }, []);
76900     cache.sequences = imageSequences.map((images) => {
76901       const sequence = {
76902         images,
76903         key: images[0].key,
76904         geometry: {
76905           type: "LineString",
76906           coordinates: images.map((image) => image.loc)
76907         }
76908       };
76909       for (const image of images) {
76910         _vegbilderCache.image2sequence_map.set(image.key, sequence);
76911       }
76912       return sequence;
76913     });
76914   }
76915   function roadReference(properties) {
76916     const {
76917       FYLKENUMMER: county_number,
76918       VEGKATEGORI: road_class,
76919       VEGSTATUS: road_status,
76920       VEGNUMMER: road_number,
76921       STREKNING: section,
76922       DELSTREKNING: subsection,
76923       HP: parcel,
76924       KRYSSDEL: junction_part,
76925       SIDEANLEGGSDEL: services_part,
76926       ANKERPUNKT: anker_point,
76927       AAR: year
76928     } = properties;
76929     let reference;
76930     if (year >= 2020) {
76931       reference = "".concat(road_class).concat(road_status).concat(road_number, " S").concat(section, "D").concat(subsection);
76932       if (junction_part) {
76933         reference = "".concat(reference, " M").concat(anker_point, " KD").concat(junction_part);
76934       } else if (services_part) {
76935         reference = "".concat(reference, " M").concat(anker_point, " SD").concat(services_part);
76936       }
76937     } else {
76938       reference = "".concat(county_number).concat(road_class).concat(road_status).concat(road_number, " HP").concat(parcel);
76939     }
76940     return reference;
76941   }
76942   function localeTimestamp(date) {
76943     const options2 = {
76944       day: "2-digit",
76945       month: "2-digit",
76946       year: "numeric",
76947       hour: "numeric",
76948       minute: "numeric",
76949       second: "numeric"
76950     };
76951     return date.toLocaleString(_mainLocalizer.localeCode(), options2);
76952   }
76953   function partitionViewport3(projection2) {
76954     const zoom = geoScaleToZoom(projection2.scale());
76955     const roundZoom = Math.ceil(zoom * 2) / 2 + 2.5;
76956     const tiler8 = utilTiler().zoomExtent([roundZoom, roundZoom]);
76957     return tiler8.getTiles(projection2).map((tile) => tile.extent);
76958   }
76959   function searchLimited3(limit, projection2, rtree) {
76960     limit != null ? limit : limit = 5;
76961     return partitionViewport3(projection2).reduce((result, extent) => {
76962       const found = rtree.search(extent.bbox()).slice(0, limit).map((d2) => d2.data);
76963       return result.concat(found);
76964     }, []);
76965   }
76966   var vegbilder_default = {
76967     init: function() {
76968       this.event = utilRebind(this, dispatch8, "on");
76969     },
76970     reset: async function() {
76971       if (_vegbilderCache) {
76972         for (const layer of _vegbilderCache.wfslayers.values()) {
76973           for (const controller of layer.inflight.values()) {
76974             controller.abort();
76975           }
76976         }
76977       }
76978       _vegbilderCache = {
76979         wfslayers: /* @__PURE__ */ new Map(),
76980         rtree: new RBush(),
76981         image2sequence_map: /* @__PURE__ */ new Map()
76982       };
76983       const availableLayers = await fetchAvailableLayers();
76984       const { wfslayers } = _vegbilderCache;
76985       for (const layerInfo of availableLayers) {
76986         const cache = {
76987           layerInfo,
76988           loaded: /* @__PURE__ */ new Map(),
76989           inflight: /* @__PURE__ */ new Map(),
76990           points: /* @__PURE__ */ new Map(),
76991           sequences: []
76992         };
76993         wfslayers.set(layerInfo.name, cache);
76994       }
76995     },
76996     images: function(projection2) {
76997       const limit = 5;
76998       return searchLimited3(limit, projection2, _vegbilderCache.rtree);
76999     },
77000     sequences: function(projection2) {
77001       const viewport = projection2.clipExtent();
77002       const min3 = [viewport[0][0], viewport[1][1]];
77003       const max3 = [viewport[1][0], viewport[0][1]];
77004       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
77005       const seen = /* @__PURE__ */ new Set();
77006       const line_strings = [];
77007       for (const { data } of _vegbilderCache.rtree.search(bbox2)) {
77008         const sequence = _vegbilderCache.image2sequence_map.get(data.key);
77009         if (!sequence) continue;
77010         const { key, geometry, images } = sequence;
77011         if (seen.has(key)) continue;
77012         seen.add(key);
77013         const line = {
77014           type: "LineString",
77015           coordinates: geometry.coordinates,
77016           key,
77017           images
77018         };
77019         line_strings.push(line);
77020       }
77021       return line_strings;
77022     },
77023     cachedImage: function(key) {
77024       for (const { points } of _vegbilderCache.wfslayers.values()) {
77025         if (points.has(key)) return points.get(key);
77026       }
77027     },
77028     getSequenceForImage: function(image) {
77029       return _vegbilderCache == null ? void 0 : _vegbilderCache.image2sequence_map.get(image == null ? void 0 : image.key);
77030     },
77031     loadImages: async function(context, margin) {
77032       if (!_vegbilderCache) {
77033         await this.reset();
77034       }
77035       margin != null ? margin : margin = 1;
77036       const wfslayers = filterAvailableLayers(context.photos());
77037       loadWFSLayers(context.projection, margin, wfslayers);
77038     },
77039     photoFrame: function() {
77040       return _currentFrame;
77041     },
77042     ensureViewerLoaded: function(context) {
77043       if (_loadViewerPromise3) return _loadViewerPromise3;
77044       const step = (stepBy) => () => {
77045         const viewer = context.container().select(".photoviewer");
77046         const selected = viewer.empty() ? void 0 : viewer.datum();
77047         if (!selected) return;
77048         const sequence = this.getSequenceForImage(selected);
77049         const nextIndex = sequence.images.indexOf(selected) + stepBy;
77050         const nextImage = sequence.images[nextIndex];
77051         if (!nextImage) return;
77052         context.map().centerEase(nextImage.loc);
77053         this.selectImage(context, nextImage.key, true);
77054       };
77055       const wrap2 = context.container().select(".photoviewer").selectAll(".vegbilder-wrapper").data([0]);
77056       const wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper vegbilder-wrapper").classed("hide", true);
77057       wrapEnter.append("div").attr("class", "photo-attribution fillD");
77058       const controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
77059       controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
77060       controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
77061       _loadViewerPromise3 = Promise.all([
77062         pannellum_photo_default.init(context, wrapEnter),
77063         plane_photo_default.init(context, wrapEnter)
77064       ]).then(([pannellumPhotoFrame, planePhotoFrame]) => {
77065         _pannellumFrame = pannellumPhotoFrame;
77066         _pannellumFrame.event.on("viewerChanged", () => dispatch8.call("viewerChanged"));
77067         _planeFrame = planePhotoFrame;
77068         _planeFrame.event.on("viewerChanged", () => dispatch8.call("viewerChanged"));
77069       });
77070       return _loadViewerPromise3;
77071     },
77072     selectImage: function(context, key, keepOrientation) {
77073       const d2 = this.cachedImage(key);
77074       this.updateUrlImage(key);
77075       const viewer = context.container().select(".photoviewer");
77076       if (!viewer.empty()) {
77077         viewer.datum(d2);
77078       }
77079       this.setStyles(context, null, true);
77080       if (!d2) return this;
77081       const wrap2 = context.container().select(".photoviewer .vegbilder-wrapper");
77082       const attribution = wrap2.selectAll(".photo-attribution").text("");
77083       if (d2.captured_at) {
77084         attribution.append("span").attr("class", "captured_at").text(localeTimestamp(d2.captured_at));
77085       }
77086       attribution.append("a").attr("target", "_blank").attr("href", "https://vegvesen.no").call(_t.append("vegbilder.publisher"));
77087       attribution.append("a").attr("target", "_blank").attr("href", "https://vegbilder.atlas.vegvesen.no/?year=".concat(d2.captured_at.getFullYear(), "&lat=").concat(d2.loc[1], "&lng=").concat(d2.loc[0], "&view=image&imageId=").concat(d2.key)).call(_t.append("vegbilder.view_on"));
77088       _currentFrame = d2.is_sphere ? _pannellumFrame : _planeFrame;
77089       _currentFrame.selectPhoto(d2, keepOrientation).showPhotoFrame(wrap2);
77090       return this;
77091     },
77092     showViewer: function(context) {
77093       const viewer = context.container().select(".photoviewer").classed("hide", false);
77094       const isHidden = viewer.selectAll(".photo-wrapper.vegbilder-wrapper.hide").size();
77095       if (isHidden) {
77096         viewer.selectAll(".photo-wrapper:not(.vegbilder-wrapper)").classed("hide", true);
77097         viewer.selectAll(".photo-wrapper.vegbilder-wrapper").classed("hide", false);
77098       }
77099       return this;
77100     },
77101     hideViewer: function(context) {
77102       this.updateUrlImage(null);
77103       const viewer = context.container().select(".photoviewer");
77104       if (!viewer.empty()) viewer.datum(null);
77105       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
77106       context.container().selectAll(".viewfield-group, .sequence").classed("currentView", false);
77107       return this.setStyles(context, null, true);
77108     },
77109     // Updates the currently highlighted sequence and selected bubble.
77110     // Reset is only necessary when interacting with the viewport because
77111     // this implicitly changes the currently selected bubble/sequence
77112     setStyles: function(context, hovered, reset) {
77113       var _a3, _b3;
77114       if (reset) {
77115         context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
77116         context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
77117       }
77118       const hoveredImageKey = hovered == null ? void 0 : hovered.key;
77119       const hoveredSequence = this.getSequenceForImage(hovered);
77120       const hoveredSequenceKey = hoveredSequence == null ? void 0 : hoveredSequence.key;
77121       const hoveredImageKeys = (_a3 = hoveredSequence == null ? void 0 : hoveredSequence.images.map((d2) => d2.key)) != null ? _a3 : [];
77122       const viewer = context.container().select(".photoviewer");
77123       const selected = viewer.empty() ? void 0 : viewer.datum();
77124       const selectedImageKey = selected == null ? void 0 : selected.key;
77125       const selectedSequence = this.getSequenceForImage(selected);
77126       const selectedSequenceKey = selectedSequence == null ? void 0 : selectedSequence.key;
77127       const selectedImageKeys = (_b3 = selectedSequence == null ? void 0 : selectedSequence.images.map((d2) => d2.key)) != null ? _b3 : [];
77128       const highlightedImageKeys = utilArrayUnion(hoveredImageKeys, selectedImageKeys);
77129       context.container().selectAll(".layer-vegbilder .viewfield-group").classed("highlighted", (d2) => highlightedImageKeys.indexOf(d2.key) !== -1).classed("hovered", (d2) => d2.key === hoveredImageKey).classed("currentView", (d2) => d2.key === selectedImageKey);
77130       context.container().selectAll(".layer-vegbilder .sequence").classed("highlighted", (d2) => d2.key === hoveredSequenceKey).classed("currentView", (d2) => d2.key === selectedSequenceKey);
77131       context.container().selectAll(".layer-vegbilder .viewfield-group .viewfield").attr("d", viewfieldPath);
77132       function viewfieldPath() {
77133         const d2 = this.parentNode.__data__;
77134         if (d2.is_sphere && d2.key !== selectedImageKey) {
77135           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
77136         } else {
77137           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
77138         }
77139       }
77140       return this;
77141     },
77142     updateUrlImage: function(key) {
77143       if (!window.mocha) {
77144         const hash = utilStringQs(window.location.hash);
77145         if (key) {
77146           hash.photo = "vegbilder/" + key;
77147         } else {
77148           delete hash.photo;
77149         }
77150         window.location.replace("#" + utilQsString(hash, true));
77151       }
77152     },
77153     validHere: function(extent) {
77154       const bbox2 = Object.values(extent.bbox());
77155       return iso1A2Codes(bbox2).includes("NO");
77156     },
77157     cache: function() {
77158       return _vegbilderCache;
77159     }
77160   };
77161
77162   // node_modules/osm-auth/src/osm-auth.mjs
77163   function osmAuth(o2) {
77164     var oauth2 = {};
77165     var _store = null;
77166     try {
77167       _store = window.localStorage;
77168     } catch (e3) {
77169       var _mock = /* @__PURE__ */ new Map();
77170       _store = {
77171         isMocked: true,
77172         hasItem: (k2) => _mock.has(k2),
77173         getItem: (k2) => _mock.get(k2),
77174         setItem: (k2, v2) => _mock.set(k2, v2),
77175         removeItem: (k2) => _mock.delete(k2),
77176         clear: () => _mock.clear()
77177       };
77178     }
77179     function token(k2, v2) {
77180       var key = o2.url + k2;
77181       if (arguments.length === 1) {
77182         var val = _store.getItem(key) || "";
77183         return val.replace(/"/g, "");
77184       } else if (arguments.length === 2) {
77185         if (v2) {
77186           return _store.setItem(key, v2);
77187         } else {
77188           return _store.removeItem(key);
77189         }
77190       }
77191     }
77192     oauth2.authenticated = function() {
77193       return !!token("oauth2_access_token");
77194     };
77195     oauth2.logout = function() {
77196       token("oauth2_access_token", "");
77197       token("oauth_token", "");
77198       token("oauth_token_secret", "");
77199       token("oauth_request_token_secret", "");
77200       return oauth2;
77201     };
77202     oauth2.authenticate = function(callback) {
77203       if (oauth2.authenticated()) {
77204         callback(null, oauth2);
77205         return;
77206       }
77207       oauth2.logout();
77208       _preopenPopup(function(error, popup) {
77209         if (error) {
77210           callback(error);
77211         } else {
77212           _generatePkceChallenge(function(pkce) {
77213             _authenticate(pkce, popup, callback);
77214           });
77215         }
77216       });
77217     };
77218     oauth2.authenticateAsync = function() {
77219       if (oauth2.authenticated()) {
77220         return Promise.resolve(oauth2);
77221       }
77222       oauth2.logout();
77223       return new Promise((resolve, reject) => {
77224         var errback = (err, result) => {
77225           if (err) {
77226             reject(err);
77227           } else {
77228             resolve(result);
77229           }
77230         };
77231         _preopenPopup((error, popup) => {
77232           if (error) {
77233             errback(error);
77234           } else {
77235             _generatePkceChallenge((pkce) => _authenticate(pkce, popup, errback));
77236           }
77237         });
77238       });
77239     };
77240     function _preopenPopup(callback) {
77241       if (o2.singlepage) {
77242         callback(null, void 0);
77243         return;
77244       }
77245       var w2 = 550;
77246       var h2 = 610;
77247       var settings = [
77248         ["width", w2],
77249         ["height", h2],
77250         ["left", window.screen.width / 2 - w2 / 2],
77251         ["top", window.screen.height / 2 - h2 / 2]
77252       ].map(function(x2) {
77253         return x2.join("=");
77254       }).join(",");
77255       var popup = window.open("about:blank", "oauth_window", settings);
77256       if (popup) {
77257         callback(null, popup);
77258       } else {
77259         var error = new Error("Popup was blocked");
77260         error.status = "popup-blocked";
77261         callback(error);
77262       }
77263     }
77264     function _authenticate(pkce, popup, callback) {
77265       var state = generateState();
77266       var url = o2.url + "/oauth2/authorize?" + utilQsString2({
77267         client_id: o2.client_id,
77268         redirect_uri: o2.redirect_uri,
77269         response_type: "code",
77270         scope: o2.scope,
77271         state,
77272         code_challenge: pkce.code_challenge,
77273         code_challenge_method: pkce.code_challenge_method,
77274         locale: o2.locale || ""
77275       });
77276       if (o2.singlepage) {
77277         if (_store.isMocked) {
77278           var error = new Error("localStorage unavailable, but required in singlepage mode");
77279           error.status = "pkce-localstorage-unavailable";
77280           callback(error);
77281           return;
77282         }
77283         var params = utilStringQs2(window.location.search.slice(1));
77284         if (params.code) {
77285           oauth2.bootstrapToken(params.code, callback);
77286         } else {
77287           token("oauth2_state", state);
77288           token("oauth2_pkce_code_verifier", pkce.code_verifier);
77289           window.location = url;
77290         }
77291       } else {
77292         oauth2.popupWindow = popup;
77293         popup.location = url;
77294       }
77295       window.authComplete = function(url2) {
77296         var params2 = utilStringQs2(url2.split("?")[1]);
77297         if (params2.state !== state) {
77298           var error2 = new Error("Invalid state");
77299           error2.status = "invalid-state";
77300           callback(error2);
77301           return;
77302         }
77303         _getAccessToken(params2.code, pkce.code_verifier, accessTokenDone);
77304         delete window.authComplete;
77305       };
77306       function accessTokenDone(err, xhr) {
77307         o2.done();
77308         if (err) {
77309           callback(err);
77310           return;
77311         }
77312         var access_token = JSON.parse(xhr.response);
77313         token("oauth2_access_token", access_token.access_token);
77314         callback(null, oauth2);
77315       }
77316     }
77317     function _getAccessToken(auth_code, code_verifier, accessTokenDone) {
77318       var url = o2.url + "/oauth2/token?" + utilQsString2({
77319         client_id: o2.client_id,
77320         redirect_uri: o2.redirect_uri,
77321         grant_type: "authorization_code",
77322         code: auth_code,
77323         code_verifier
77324       });
77325       oauth2.rawxhr("POST", url, null, null, null, accessTokenDone);
77326       o2.loading();
77327     }
77328     oauth2.bringPopupWindowToFront = function() {
77329       var broughtPopupToFront = false;
77330       try {
77331         if (oauth2.popupWindow && !oauth2.popupWindow.closed) {
77332           oauth2.popupWindow.focus();
77333           broughtPopupToFront = true;
77334         }
77335       } catch (err) {
77336       }
77337       return broughtPopupToFront;
77338     };
77339     oauth2.bootstrapToken = function(auth_code, callback) {
77340       var state = token("oauth2_state");
77341       token("oauth2_state", "");
77342       var params = utilStringQs2(window.location.search.slice(1));
77343       if (params.state !== state) {
77344         var error = new Error("Invalid state");
77345         error.status = "invalid-state";
77346         callback(error);
77347         return;
77348       }
77349       var code_verifier = token("oauth2_pkce_code_verifier");
77350       token("oauth2_pkce_code_verifier", "");
77351       _getAccessToken(auth_code, code_verifier, accessTokenDone);
77352       function accessTokenDone(err, xhr) {
77353         o2.done();
77354         if (err) {
77355           callback(err);
77356           return;
77357         }
77358         var access_token = JSON.parse(xhr.response);
77359         token("oauth2_access_token", access_token.access_token);
77360         callback(null, oauth2);
77361       }
77362     };
77363     oauth2.fetch = function(resource, options2) {
77364       if (oauth2.authenticated()) {
77365         return _doFetch();
77366       } else {
77367         if (o2.auto) {
77368           return oauth2.authenticateAsync().then(_doFetch);
77369         } else {
77370           return Promise.reject(new Error("not authenticated"));
77371         }
77372       }
77373       function _doFetch() {
77374         options2 = options2 || {};
77375         if (!options2.headers) {
77376           options2.headers = { "Content-Type": "application/x-www-form-urlencoded" };
77377         }
77378         options2.headers.Authorization = "Bearer " + token("oauth2_access_token");
77379         return fetch(resource, options2);
77380       }
77381     };
77382     oauth2.xhr = function(options2, callback) {
77383       if (oauth2.authenticated()) {
77384         return _doXHR();
77385       } else {
77386         if (o2.auto) {
77387           oauth2.authenticate(_doXHR);
77388           return;
77389         } else {
77390           callback("not authenticated", null);
77391           return;
77392         }
77393       }
77394       function _doXHR() {
77395         var url = options2.prefix !== false ? o2.apiUrl + options2.path : options2.path;
77396         return oauth2.rawxhr(
77397           options2.method,
77398           url,
77399           token("oauth2_access_token"),
77400           options2.content,
77401           options2.headers,
77402           done
77403         );
77404       }
77405       function done(err, xhr) {
77406         if (err) {
77407           callback(err);
77408         } else if (xhr.responseXML) {
77409           callback(err, xhr.responseXML);
77410         } else {
77411           callback(err, xhr.response);
77412         }
77413       }
77414     };
77415     oauth2.rawxhr = function(method, url, access_token, data, headers, callback) {
77416       headers = headers || { "Content-Type": "application/x-www-form-urlencoded" };
77417       if (access_token) {
77418         headers.Authorization = "Bearer " + access_token;
77419       }
77420       var xhr = new XMLHttpRequest();
77421       xhr.onreadystatechange = function() {
77422         if (4 === xhr.readyState && 0 !== xhr.status) {
77423           if (/^20\d$/.test(xhr.status)) {
77424             callback(null, xhr);
77425           } else {
77426             callback(xhr, null);
77427           }
77428         }
77429       };
77430       xhr.onerror = function(e3) {
77431         callback(e3, null);
77432       };
77433       xhr.open(method, url, true);
77434       for (var h2 in headers) xhr.setRequestHeader(h2, headers[h2]);
77435       xhr.send(data);
77436       return xhr;
77437     };
77438     oauth2.preauth = function(val) {
77439       if (val && val.access_token) {
77440         token("oauth2_access_token", val.access_token);
77441       }
77442       return oauth2;
77443     };
77444     oauth2.options = function(val) {
77445       if (!arguments.length) return o2;
77446       o2 = val;
77447       o2.apiUrl = o2.apiUrl || "https://api.openstreetmap.org";
77448       o2.url = o2.url || "https://www.openstreetmap.org";
77449       o2.auto = o2.auto || false;
77450       o2.singlepage = o2.singlepage || false;
77451       o2.loading = o2.loading || function() {
77452       };
77453       o2.done = o2.done || function() {
77454       };
77455       return oauth2.preauth(o2);
77456     };
77457     oauth2.options(o2);
77458     return oauth2;
77459   }
77460   function utilQsString2(obj) {
77461     return Object.keys(obj).filter(function(key) {
77462       return obj[key] !== void 0;
77463     }).sort().map(function(key) {
77464       return encodeURIComponent(key) + "=" + encodeURIComponent(obj[key]);
77465     }).join("&");
77466   }
77467   function utilStringQs2(str) {
77468     var i3 = 0;
77469     while (i3 < str.length && (str[i3] === "?" || str[i3] === "#")) i3++;
77470     str = str.slice(i3);
77471     return str.split("&").reduce(function(obj, pair3) {
77472       var parts = pair3.split("=");
77473       if (parts.length === 2) {
77474         obj[parts[0]] = decodeURIComponent(parts[1]);
77475       }
77476       return obj;
77477     }, {});
77478   }
77479   function supportsWebCryptoAPI() {
77480     return window && window.crypto && window.crypto.getRandomValues && window.crypto.subtle && window.crypto.subtle.digest;
77481   }
77482   function _generatePkceChallenge(callback) {
77483     var code_verifier;
77484     if (supportsWebCryptoAPI()) {
77485       var random = window.crypto.getRandomValues(new Uint8Array(32));
77486       code_verifier = base64(random.buffer);
77487       var verifier = Uint8Array.from(Array.from(code_verifier).map(function(char) {
77488         return char.charCodeAt(0);
77489       }));
77490       window.crypto.subtle.digest("SHA-256", verifier).then(function(hash) {
77491         var code_challenge = base64(hash);
77492         callback({
77493           code_challenge,
77494           code_verifier,
77495           code_challenge_method: "S256"
77496         });
77497       });
77498     } else {
77499       var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
77500       code_verifier = "";
77501       for (var i3 = 0; i3 < 64; i3++) {
77502         code_verifier += chars[Math.floor(Math.random() * chars.length)];
77503       }
77504       callback({
77505         code_verifier,
77506         code_challenge: code_verifier,
77507         code_challenge_method: "plain"
77508       });
77509     }
77510   }
77511   function generateState() {
77512     var state;
77513     if (supportsWebCryptoAPI()) {
77514       var random = window.crypto.getRandomValues(new Uint8Array(32));
77515       state = base64(random.buffer);
77516     } else {
77517       var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
77518       state = "";
77519       for (var i3 = 0; i3 < 64; i3++) {
77520         state += chars[Math.floor(Math.random() * chars.length)];
77521       }
77522     }
77523     return state;
77524   }
77525   function base64(buffer) {
77526     return btoa(String.fromCharCode.apply(null, new Uint8Array(buffer))).replace(/\//g, "_").replace(/\+/g, "-").replace(/[=]/g, "");
77527   }
77528
77529   // modules/services/osm.js
77530   var tiler5 = utilTiler();
77531   var dispatch9 = dispatch_default("apiStatusChange", "authLoading", "authDone", "change", "loading", "loaded", "loadedNotes");
77532   var urlroot = osmApiConnections[0].url;
77533   var apiUrlroot = osmApiConnections[0].apiUrl || urlroot;
77534   var redirectPath = window.location.origin + window.location.pathname;
77535   var oauth = osmAuth({
77536     url: urlroot,
77537     apiUrl: apiUrlroot,
77538     client_id: osmApiConnections[0].client_id,
77539     scope: "read_prefs write_prefs write_api read_gpx write_notes",
77540     redirect_uri: redirectPath + "land.html",
77541     loading: authLoading,
77542     done: authDone
77543   });
77544   var _apiConnections = osmApiConnections;
77545   var _imageryBlocklists = [/.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/];
77546   var _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new RBush() };
77547   var _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new RBush() };
77548   var _userCache = { toLoad: {}, user: {} };
77549   var _cachedApiStatus;
77550   var _changeset = {};
77551   var _deferred = /* @__PURE__ */ new Set();
77552   var _connectionID = 1;
77553   var _tileZoom3 = 16;
77554   var _noteZoom = 12;
77555   var _rateLimitError;
77556   var _userChangesets;
77557   var _userDetails;
77558   var _off;
77559   var _maxWayNodes = 2e3;
77560   function authLoading() {
77561     dispatch9.call("authLoading");
77562   }
77563   function authDone() {
77564     dispatch9.call("authDone");
77565   }
77566   function abortRequest4(controllerOrXHR) {
77567     if (controllerOrXHR) {
77568       controllerOrXHR.abort();
77569     }
77570   }
77571   function hasInflightRequests(cache) {
77572     return Object.keys(cache.inflight).length;
77573   }
77574   function abortUnwantedRequests3(cache, visibleTiles) {
77575     Object.keys(cache.inflight).forEach(function(k2) {
77576       if (cache.toLoad[k2]) return;
77577       if (visibleTiles.find(function(tile) {
77578         return k2 === tile.id;
77579       })) return;
77580       abortRequest4(cache.inflight[k2]);
77581       delete cache.inflight[k2];
77582     });
77583   }
77584   function getLoc(attrs) {
77585     var lon = attrs.lon && attrs.lon.value;
77586     var lat = attrs.lat && attrs.lat.value;
77587     return [Number(lon), Number(lat)];
77588   }
77589   function getNodes(obj) {
77590     var elems = obj.getElementsByTagName("nd");
77591     var nodes = new Array(elems.length);
77592     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
77593       nodes[i3] = "n" + elems[i3].attributes.ref.value;
77594     }
77595     return nodes;
77596   }
77597   function getNodesJSON(obj) {
77598     var elems = obj.nodes;
77599     var nodes = new Array(elems.length);
77600     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
77601       nodes[i3] = "n" + elems[i3];
77602     }
77603     return nodes;
77604   }
77605   function getTags(obj) {
77606     var elems = obj.getElementsByTagName("tag");
77607     var tags = {};
77608     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
77609       var attrs = elems[i3].attributes;
77610       tags[attrs.k.value] = attrs.v.value;
77611     }
77612     return tags;
77613   }
77614   function getMembers(obj) {
77615     var elems = obj.getElementsByTagName("member");
77616     var members = new Array(elems.length);
77617     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
77618       var attrs = elems[i3].attributes;
77619       members[i3] = {
77620         id: attrs.type.value[0] + attrs.ref.value,
77621         type: attrs.type.value,
77622         role: attrs.role.value
77623       };
77624     }
77625     return members;
77626   }
77627   function getMembersJSON(obj) {
77628     var elems = obj.members;
77629     var members = new Array(elems.length);
77630     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
77631       var attrs = elems[i3];
77632       members[i3] = {
77633         id: attrs.type[0] + attrs.ref,
77634         type: attrs.type,
77635         role: attrs.role
77636       };
77637     }
77638     return members;
77639   }
77640   function getVisible(attrs) {
77641     return !attrs.visible || attrs.visible.value !== "false";
77642   }
77643   function parseComments(comments) {
77644     var parsedComments = [];
77645     for (var i3 = 0; i3 < comments.length; i3++) {
77646       var comment = comments[i3];
77647       if (comment.nodeName === "comment") {
77648         var childNodes = comment.childNodes;
77649         var parsedComment = {};
77650         for (var j2 = 0; j2 < childNodes.length; j2++) {
77651           var node = childNodes[j2];
77652           var nodeName = node.nodeName;
77653           if (nodeName === "#text") continue;
77654           parsedComment[nodeName] = node.textContent;
77655           if (nodeName === "uid") {
77656             var uid = node.textContent;
77657             if (uid && !_userCache.user[uid]) {
77658               _userCache.toLoad[uid] = true;
77659             }
77660           }
77661         }
77662         if (parsedComment) {
77663           parsedComments.push(parsedComment);
77664         }
77665       }
77666     }
77667     return parsedComments;
77668   }
77669   function encodeNoteRtree(note) {
77670     return {
77671       minX: note.loc[0],
77672       minY: note.loc[1],
77673       maxX: note.loc[0],
77674       maxY: note.loc[1],
77675       data: note
77676     };
77677   }
77678   var jsonparsers = {
77679     node: function nodeData(obj, uid) {
77680       return new osmNode({
77681         id: uid,
77682         visible: typeof obj.visible === "boolean" ? obj.visible : true,
77683         version: obj.version && obj.version.toString(),
77684         changeset: obj.changeset && obj.changeset.toString(),
77685         timestamp: obj.timestamp,
77686         user: obj.user,
77687         uid: obj.uid && obj.uid.toString(),
77688         loc: [Number(obj.lon), Number(obj.lat)],
77689         tags: obj.tags
77690       });
77691     },
77692     way: function wayData(obj, uid) {
77693       return new osmWay({
77694         id: uid,
77695         visible: typeof obj.visible === "boolean" ? obj.visible : true,
77696         version: obj.version && obj.version.toString(),
77697         changeset: obj.changeset && obj.changeset.toString(),
77698         timestamp: obj.timestamp,
77699         user: obj.user,
77700         uid: obj.uid && obj.uid.toString(),
77701         tags: obj.tags,
77702         nodes: getNodesJSON(obj)
77703       });
77704     },
77705     relation: function relationData(obj, uid) {
77706       return new osmRelation({
77707         id: uid,
77708         visible: typeof obj.visible === "boolean" ? obj.visible : true,
77709         version: obj.version && obj.version.toString(),
77710         changeset: obj.changeset && obj.changeset.toString(),
77711         timestamp: obj.timestamp,
77712         user: obj.user,
77713         uid: obj.uid && obj.uid.toString(),
77714         tags: obj.tags,
77715         members: getMembersJSON(obj)
77716       });
77717     },
77718     user: function parseUser(obj, uid) {
77719       return {
77720         id: uid,
77721         display_name: obj.display_name,
77722         account_created: obj.account_created,
77723         image_url: obj.img && obj.img.href,
77724         changesets_count: obj.changesets && obj.changesets.count && obj.changesets.count.toString() || "0",
77725         active_blocks: obj.blocks && obj.blocks.received && obj.blocks.received.active && obj.blocks.received.active.toString() || "0"
77726       };
77727     }
77728   };
77729   function parseJSON(payload, callback, options2) {
77730     options2 = Object.assign({ skipSeen: true }, options2);
77731     if (!payload) {
77732       return callback({ message: "No JSON", status: -1 });
77733     }
77734     var json = payload;
77735     if (typeof json !== "object") json = JSON.parse(payload);
77736     if (!json.elements) return callback({ message: "No JSON", status: -1 });
77737     var children2 = json.elements;
77738     var handle = window.requestIdleCallback(function() {
77739       _deferred.delete(handle);
77740       var results = [];
77741       var result;
77742       for (var i3 = 0; i3 < children2.length; i3++) {
77743         result = parseChild(children2[i3]);
77744         if (result) results.push(result);
77745       }
77746       callback(null, results);
77747     });
77748     _deferred.add(handle);
77749     function parseChild(child) {
77750       var parser3 = jsonparsers[child.type];
77751       if (!parser3) return null;
77752       var uid;
77753       uid = osmEntity.id.fromOSM(child.type, child.id);
77754       if (options2.skipSeen) {
77755         if (_tileCache.seen[uid]) return null;
77756         _tileCache.seen[uid] = true;
77757       }
77758       return parser3(child, uid);
77759     }
77760   }
77761   function parseUserJSON(payload, callback, options2) {
77762     options2 = Object.assign({ skipSeen: true }, options2);
77763     if (!payload) {
77764       return callback({ message: "No JSON", status: -1 });
77765     }
77766     var json = payload;
77767     if (typeof json !== "object") json = JSON.parse(payload);
77768     if (!json.users && !json.user) return callback({ message: "No JSON", status: -1 });
77769     var objs = json.users || [json];
77770     var handle = window.requestIdleCallback(function() {
77771       _deferred.delete(handle);
77772       var results = [];
77773       var result;
77774       for (var i3 = 0; i3 < objs.length; i3++) {
77775         result = parseObj(objs[i3]);
77776         if (result) results.push(result);
77777       }
77778       callback(null, results);
77779     });
77780     _deferred.add(handle);
77781     function parseObj(obj) {
77782       var uid = obj.user.id && obj.user.id.toString();
77783       if (options2.skipSeen && _userCache.user[uid]) {
77784         delete _userCache.toLoad[uid];
77785         return null;
77786       }
77787       var user = jsonparsers.user(obj.user, uid);
77788       _userCache.user[uid] = user;
77789       delete _userCache.toLoad[uid];
77790       return user;
77791     }
77792   }
77793   var parsers = {
77794     node: function nodeData2(obj, uid) {
77795       var attrs = obj.attributes;
77796       return new osmNode({
77797         id: uid,
77798         visible: getVisible(attrs),
77799         version: attrs.version.value,
77800         changeset: attrs.changeset && attrs.changeset.value,
77801         timestamp: attrs.timestamp && attrs.timestamp.value,
77802         user: attrs.user && attrs.user.value,
77803         uid: attrs.uid && attrs.uid.value,
77804         loc: getLoc(attrs),
77805         tags: getTags(obj)
77806       });
77807     },
77808     way: function wayData2(obj, uid) {
77809       var attrs = obj.attributes;
77810       return new osmWay({
77811         id: uid,
77812         visible: getVisible(attrs),
77813         version: attrs.version.value,
77814         changeset: attrs.changeset && attrs.changeset.value,
77815         timestamp: attrs.timestamp && attrs.timestamp.value,
77816         user: attrs.user && attrs.user.value,
77817         uid: attrs.uid && attrs.uid.value,
77818         tags: getTags(obj),
77819         nodes: getNodes(obj)
77820       });
77821     },
77822     relation: function relationData2(obj, uid) {
77823       var attrs = obj.attributes;
77824       return new osmRelation({
77825         id: uid,
77826         visible: getVisible(attrs),
77827         version: attrs.version.value,
77828         changeset: attrs.changeset && attrs.changeset.value,
77829         timestamp: attrs.timestamp && attrs.timestamp.value,
77830         user: attrs.user && attrs.user.value,
77831         uid: attrs.uid && attrs.uid.value,
77832         tags: getTags(obj),
77833         members: getMembers(obj)
77834       });
77835     },
77836     note: function parseNote(obj, uid) {
77837       var attrs = obj.attributes;
77838       var childNodes = obj.childNodes;
77839       var props = {};
77840       props.id = uid;
77841       props.loc = getLoc(attrs);
77842       if (!_noteCache.note[uid]) {
77843         let coincident = false;
77844         const epsilon3 = 1e-5;
77845         do {
77846           if (coincident) {
77847             props.loc = geoVecAdd(props.loc, [epsilon3, epsilon3]);
77848           }
77849           const bbox2 = geoExtent(props.loc).bbox();
77850           coincident = _noteCache.rtree.search(bbox2).length;
77851         } while (coincident);
77852       } else {
77853         props.loc = _noteCache.note[uid].loc;
77854       }
77855       for (var i3 = 0; i3 < childNodes.length; i3++) {
77856         var node = childNodes[i3];
77857         var nodeName = node.nodeName;
77858         if (nodeName === "#text") continue;
77859         if (nodeName === "comments") {
77860           props[nodeName] = parseComments(node.childNodes);
77861         } else {
77862           props[nodeName] = node.textContent;
77863         }
77864       }
77865       var note = new osmNote(props);
77866       var item = encodeNoteRtree(note);
77867       _noteCache.note[note.id] = note;
77868       updateRtree3(item, true);
77869       return note;
77870     },
77871     user: function parseUser2(obj, uid) {
77872       var attrs = obj.attributes;
77873       var user = {
77874         id: uid,
77875         display_name: attrs.display_name && attrs.display_name.value,
77876         account_created: attrs.account_created && attrs.account_created.value,
77877         changesets_count: "0",
77878         active_blocks: "0"
77879       };
77880       var img = obj.getElementsByTagName("img");
77881       if (img && img[0] && img[0].getAttribute("href")) {
77882         user.image_url = img[0].getAttribute("href");
77883       }
77884       var changesets = obj.getElementsByTagName("changesets");
77885       if (changesets && changesets[0] && changesets[0].getAttribute("count")) {
77886         user.changesets_count = changesets[0].getAttribute("count");
77887       }
77888       var blocks = obj.getElementsByTagName("blocks");
77889       if (blocks && blocks[0]) {
77890         var received = blocks[0].getElementsByTagName("received");
77891         if (received && received[0] && received[0].getAttribute("active")) {
77892           user.active_blocks = received[0].getAttribute("active");
77893         }
77894       }
77895       _userCache.user[uid] = user;
77896       delete _userCache.toLoad[uid];
77897       return user;
77898     }
77899   };
77900   function parseXML(xml, callback, options2) {
77901     options2 = Object.assign({ skipSeen: true }, options2);
77902     if (!xml || !xml.childNodes) {
77903       return callback({ message: "No XML", status: -1 });
77904     }
77905     var root3 = xml.childNodes[0];
77906     var children2 = root3.childNodes;
77907     var handle = window.requestIdleCallback(function() {
77908       _deferred.delete(handle);
77909       var results = [];
77910       var result;
77911       for (var i3 = 0; i3 < children2.length; i3++) {
77912         result = parseChild(children2[i3]);
77913         if (result) results.push(result);
77914       }
77915       callback(null, results);
77916     });
77917     _deferred.add(handle);
77918     function parseChild(child) {
77919       var parser3 = parsers[child.nodeName];
77920       if (!parser3) return null;
77921       var uid;
77922       if (child.nodeName === "user") {
77923         uid = child.attributes.id.value;
77924         if (options2.skipSeen && _userCache.user[uid]) {
77925           delete _userCache.toLoad[uid];
77926           return null;
77927         }
77928       } else if (child.nodeName === "note") {
77929         uid = child.getElementsByTagName("id")[0].textContent;
77930       } else {
77931         uid = osmEntity.id.fromOSM(child.nodeName, child.attributes.id.value);
77932         if (options2.skipSeen) {
77933           if (_tileCache.seen[uid]) return null;
77934           _tileCache.seen[uid] = true;
77935         }
77936       }
77937       return parser3(child, uid);
77938     }
77939   }
77940   function updateRtree3(item, replace) {
77941     _noteCache.rtree.remove(item, function isEql(a2, b2) {
77942       return a2.data.id === b2.data.id;
77943     });
77944     if (replace) {
77945       _noteCache.rtree.insert(item);
77946     }
77947   }
77948   function wrapcb(thisArg, callback, cid) {
77949     return function(err, result) {
77950       if (err) {
77951         if (err.status === 400 || err.status === 401 || err.status === 403) {
77952           thisArg.logout();
77953         }
77954         return callback.call(thisArg, err);
77955       } else if (thisArg.getConnectionId() !== cid) {
77956         return callback.call(thisArg, { message: "Connection Switched", status: -1 });
77957       } else {
77958         return callback.call(thisArg, err, result);
77959       }
77960     };
77961   }
77962   var osm_default = {
77963     init: function() {
77964       utilRebind(this, dispatch9, "on");
77965     },
77966     reset: function() {
77967       Array.from(_deferred).forEach(function(handle) {
77968         window.cancelIdleCallback(handle);
77969         _deferred.delete(handle);
77970       });
77971       _connectionID++;
77972       _userChangesets = void 0;
77973       _userDetails = void 0;
77974       _rateLimitError = void 0;
77975       Object.values(_tileCache.inflight).forEach(abortRequest4);
77976       Object.values(_noteCache.inflight).forEach(abortRequest4);
77977       Object.values(_noteCache.inflightPost).forEach(abortRequest4);
77978       if (_changeset.inflight) abortRequest4(_changeset.inflight);
77979       _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new RBush() };
77980       _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new RBush() };
77981       _userCache = { toLoad: {}, user: {} };
77982       _cachedApiStatus = void 0;
77983       _changeset = {};
77984       return this;
77985     },
77986     getConnectionId: function() {
77987       return _connectionID;
77988     },
77989     getUrlRoot: function() {
77990       return urlroot;
77991     },
77992     getApiUrlRoot: function() {
77993       return apiUrlroot;
77994     },
77995     changesetURL: function(changesetID) {
77996       return urlroot + "/changeset/" + changesetID;
77997     },
77998     changesetsURL: function(center, zoom) {
77999       var precision3 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
78000       return urlroot + "/history#map=" + Math.floor(zoom) + "/" + center[1].toFixed(precision3) + "/" + center[0].toFixed(precision3);
78001     },
78002     entityURL: function(entity) {
78003       return urlroot + "/" + entity.type + "/" + entity.osmId();
78004     },
78005     historyURL: function(entity) {
78006       return urlroot + "/" + entity.type + "/" + entity.osmId() + "/history";
78007     },
78008     userURL: function(username) {
78009       return urlroot + "/user/" + encodeURIComponent(username);
78010     },
78011     noteURL: function(note) {
78012       return urlroot + "/note/" + note.id;
78013     },
78014     noteReportURL: function(note) {
78015       return urlroot + "/reports/new?reportable_type=Note&reportable_id=" + note.id;
78016     },
78017     // Generic method to load data from the OSM API
78018     // Can handle either auth or unauth calls.
78019     loadFromAPI: function(path, callback, options2) {
78020       options2 = Object.assign({ skipSeen: true }, options2);
78021       var that = this;
78022       var cid = _connectionID;
78023       function done(err, payload) {
78024         if (that.getConnectionId() !== cid) {
78025           if (callback) callback({ message: "Connection Switched", status: -1 });
78026           return;
78027         }
78028         var isAuthenticated = that.authenticated();
78029         if (isAuthenticated && err && err.status && (err.status === 400 || err.status === 401 || err.status === 403)) {
78030           that.logout();
78031           that.loadFromAPI(path, callback, options2);
78032         } else {
78033           if (!isAuthenticated && !_rateLimitError && err && err.status && (err.status === 509 || err.status === 429)) {
78034             _rateLimitError = err;
78035             dispatch9.call("change");
78036             that.reloadApiStatus();
78037           } else if (err && _cachedApiStatus === "online" || !err && _cachedApiStatus !== "online") {
78038             that.reloadApiStatus();
78039           }
78040           if (callback) {
78041             if (err) {
78042               return callback(err);
78043             } else {
78044               if (path.indexOf(".json") !== -1) {
78045                 return parseJSON(payload, callback, options2);
78046               } else {
78047                 return parseXML(payload, callback, options2);
78048               }
78049             }
78050           }
78051         }
78052       }
78053       if (this.authenticated()) {
78054         return oauth.xhr({
78055           method: "GET",
78056           path
78057         }, done);
78058       } else {
78059         var url = apiUrlroot + path;
78060         var controller = new AbortController();
78061         var fn;
78062         if (path.indexOf(".json") !== -1) {
78063           fn = json_default;
78064         } else {
78065           fn = xml_default;
78066         }
78067         fn(url, { signal: controller.signal }).then(function(data) {
78068           done(null, data);
78069         }).catch(function(err) {
78070           if (err.name === "AbortError") return;
78071           var match = err.message.match(/^\d{3}/);
78072           if (match) {
78073             done({ status: +match[0], statusText: err.message });
78074           } else {
78075             done(err.message);
78076           }
78077         });
78078         return controller;
78079       }
78080     },
78081     // Load a single entity by id (ways and relations use the `/full` call to include
78082     // nodes and members). Parent relations are not included, see `loadEntityRelations`.
78083     // GET /api/0.6/node/#id
78084     // GET /api/0.6/[way|relation]/#id/full
78085     loadEntity: function(id2, callback) {
78086       var type2 = osmEntity.id.type(id2);
78087       var osmID = osmEntity.id.toOSM(id2);
78088       var options2 = { skipSeen: false };
78089       this.loadFromAPI(
78090         "/api/0.6/" + type2 + "/" + osmID + (type2 !== "node" ? "/full" : "") + ".json",
78091         function(err, entities) {
78092           if (callback) callback(err, { data: entities });
78093         },
78094         options2
78095       );
78096     },
78097     // Load a single note by id , XML format
78098     // GET /api/0.6/notes/#id
78099     loadEntityNote: function(id2, callback) {
78100       var options2 = { skipSeen: false };
78101       this.loadFromAPI(
78102         "/api/0.6/notes/" + id2,
78103         function(err, entities) {
78104           if (callback) callback(err, { data: entities });
78105         },
78106         options2
78107       );
78108     },
78109     // Load a single entity with a specific version
78110     // GET /api/0.6/[node|way|relation]/#id/#version
78111     loadEntityVersion: function(id2, version, callback) {
78112       var type2 = osmEntity.id.type(id2);
78113       var osmID = osmEntity.id.toOSM(id2);
78114       var options2 = { skipSeen: false };
78115       this.loadFromAPI(
78116         "/api/0.6/" + type2 + "/" + osmID + "/" + version + ".json",
78117         function(err, entities) {
78118           if (callback) callback(err, { data: entities });
78119         },
78120         options2
78121       );
78122     },
78123     // Load the relations of a single entity with the given.
78124     // GET /api/0.6/[node|way|relation]/#id/relations
78125     loadEntityRelations: function(id2, callback) {
78126       var type2 = osmEntity.id.type(id2);
78127       var osmID = osmEntity.id.toOSM(id2);
78128       var options2 = { skipSeen: false };
78129       this.loadFromAPI(
78130         "/api/0.6/" + type2 + "/" + osmID + "/relations.json",
78131         function(err, entities) {
78132           if (callback) callback(err, { data: entities });
78133         },
78134         options2
78135       );
78136     },
78137     // Load multiple entities in chunks
78138     // (note: callback may be called multiple times)
78139     // Unlike `loadEntity`, child nodes and members are not fetched
78140     // GET /api/0.6/[nodes|ways|relations]?#parameters
78141     loadMultiple: function(ids, callback) {
78142       var that = this;
78143       var groups = utilArrayGroupBy(utilArrayUniq(ids), osmEntity.id.type);
78144       Object.keys(groups).forEach(function(k2) {
78145         var type2 = k2 + "s";
78146         var osmIDs = groups[k2].map(function(id2) {
78147           return osmEntity.id.toOSM(id2);
78148         });
78149         var options2 = { skipSeen: false };
78150         utilArrayChunk(osmIDs, 150).forEach(function(arr) {
78151           that.loadFromAPI(
78152             "/api/0.6/" + type2 + ".json?" + type2 + "=" + arr.join(),
78153             function(err, entities) {
78154               if (callback) callback(err, { data: entities });
78155             },
78156             options2
78157           );
78158         });
78159       });
78160     },
78161     // Create, upload, and close a changeset
78162     // PUT /api/0.6/changeset/create
78163     // POST /api/0.6/changeset/#id/upload
78164     // PUT /api/0.6/changeset/#id/close
78165     putChangeset: function(changeset, changes, callback) {
78166       var cid = _connectionID;
78167       if (_changeset.inflight) {
78168         return callback({ message: "Changeset already inflight", status: -2 }, changeset);
78169       } else if (_changeset.open) {
78170         return createdChangeset.call(this, null, _changeset.open);
78171       } else {
78172         var options2 = {
78173           method: "PUT",
78174           path: "/api/0.6/changeset/create",
78175           headers: { "Content-Type": "text/xml" },
78176           content: JXON.stringify(changeset.asJXON())
78177         };
78178         _changeset.inflight = oauth.xhr(
78179           options2,
78180           wrapcb(this, createdChangeset, cid)
78181         );
78182       }
78183       function createdChangeset(err, changesetID) {
78184         _changeset.inflight = null;
78185         if (err) {
78186           return callback(err, changeset);
78187         }
78188         _changeset.open = changesetID;
78189         changeset = changeset.update({ id: changesetID });
78190         var options3 = {
78191           method: "POST",
78192           path: "/api/0.6/changeset/" + changesetID + "/upload",
78193           headers: { "Content-Type": "text/xml" },
78194           content: JXON.stringify(changeset.osmChangeJXON(changes))
78195         };
78196         _changeset.inflight = oauth.xhr(
78197           options3,
78198           wrapcb(this, uploadedChangeset, cid)
78199         );
78200       }
78201       function uploadedChangeset(err) {
78202         _changeset.inflight = null;
78203         if (err) return callback(err, changeset);
78204         window.setTimeout(function() {
78205           callback(null, changeset);
78206         }, 2500);
78207         _changeset.open = null;
78208         if (this.getConnectionId() === cid) {
78209           oauth.xhr({
78210             method: "PUT",
78211             path: "/api/0.6/changeset/" + changeset.id + "/close",
78212             headers: { "Content-Type": "text/xml" }
78213           }, function() {
78214             return true;
78215           });
78216         }
78217       }
78218     },
78219     // Load multiple users in chunks
78220     // (note: callback may be called multiple times)
78221     // GET /api/0.6/users?users=#id1,#id2,...,#idn
78222     loadUsers: function(uids, callback) {
78223       var toLoad = [];
78224       var cached = [];
78225       utilArrayUniq(uids).forEach(function(uid) {
78226         if (_userCache.user[uid]) {
78227           delete _userCache.toLoad[uid];
78228           cached.push(_userCache.user[uid]);
78229         } else {
78230           toLoad.push(uid);
78231         }
78232       });
78233       if (cached.length || !this.authenticated()) {
78234         callback(void 0, cached);
78235         if (!this.authenticated()) return;
78236       }
78237       utilArrayChunk(toLoad, 150).forEach((function(arr) {
78238         oauth.xhr({
78239           method: "GET",
78240           path: "/api/0.6/users.json?users=" + arr.join()
78241         }, wrapcb(this, done, _connectionID));
78242       }).bind(this));
78243       function done(err, payload) {
78244         if (err) return callback(err);
78245         var options2 = { skipSeen: true };
78246         return parseUserJSON(payload, function(err2, results) {
78247           if (err2) return callback(err2);
78248           return callback(void 0, results);
78249         }, options2);
78250       }
78251     },
78252     // Load a given user by id
78253     // GET /api/0.6/user/#id
78254     loadUser: function(uid, callback) {
78255       if (_userCache.user[uid] || !this.authenticated()) {
78256         delete _userCache.toLoad[uid];
78257         return callback(void 0, _userCache.user[uid]);
78258       }
78259       oauth.xhr({
78260         method: "GET",
78261         path: "/api/0.6/user/" + uid + ".json"
78262       }, wrapcb(this, done, _connectionID));
78263       function done(err, payload) {
78264         if (err) return callback(err);
78265         var options2 = { skipSeen: true };
78266         return parseUserJSON(payload, function(err2, results) {
78267           if (err2) return callback(err2);
78268           return callback(void 0, results[0]);
78269         }, options2);
78270       }
78271     },
78272     // Load the details of the logged-in user
78273     // GET /api/0.6/user/details
78274     userDetails: function(callback) {
78275       if (_userDetails) {
78276         return callback(void 0, _userDetails);
78277       }
78278       oauth.xhr({
78279         method: "GET",
78280         path: "/api/0.6/user/details.json"
78281       }, wrapcb(this, done, _connectionID));
78282       function done(err, payload) {
78283         if (err) return callback(err);
78284         var options2 = { skipSeen: false };
78285         return parseUserJSON(payload, function(err2, results) {
78286           if (err2) return callback(err2);
78287           _userDetails = results[0];
78288           return callback(void 0, _userDetails);
78289         }, options2);
78290       }
78291     },
78292     // Load previous changesets for the logged in user
78293     // GET /api/0.6/changesets?user=#id
78294     userChangesets: function(callback) {
78295       if (_userChangesets) {
78296         return callback(void 0, _userChangesets);
78297       }
78298       this.userDetails(
78299         wrapcb(this, gotDetails, _connectionID)
78300       );
78301       function gotDetails(err, user) {
78302         if (err) {
78303           return callback(err);
78304         }
78305         oauth.xhr({
78306           method: "GET",
78307           path: "/api/0.6/changesets?user=" + user.id
78308         }, wrapcb(this, done, _connectionID));
78309       }
78310       function done(err, xml) {
78311         if (err) {
78312           return callback(err);
78313         }
78314         _userChangesets = Array.prototype.map.call(
78315           xml.getElementsByTagName("changeset"),
78316           function(changeset) {
78317             return { tags: getTags(changeset) };
78318           }
78319         ).filter(function(changeset) {
78320           var comment = changeset.tags.comment;
78321           return comment && comment !== "";
78322         });
78323         return callback(void 0, _userChangesets);
78324       }
78325     },
78326     // Fetch the status of the OSM API
78327     // GET /api/capabilities
78328     status: function(callback) {
78329       var url = apiUrlroot + "/api/capabilities";
78330       var errback = wrapcb(this, done, _connectionID);
78331       xml_default(url).then(function(data) {
78332         errback(null, data);
78333       }).catch(function(err) {
78334         errback(err.message);
78335       });
78336       function done(err, xml) {
78337         if (err) {
78338           return callback(err, null);
78339         }
78340         var elements = xml.getElementsByTagName("blacklist");
78341         var regexes = [];
78342         for (var i3 = 0; i3 < elements.length; i3++) {
78343           var regexString = elements[i3].getAttribute("regex");
78344           if (regexString) {
78345             try {
78346               var regex = new RegExp(regexString);
78347               regexes.push(regex);
78348             } catch {
78349             }
78350           }
78351         }
78352         if (regexes.length) {
78353           _imageryBlocklists = regexes;
78354         }
78355         if (_rateLimitError) {
78356           return callback(_rateLimitError, "rateLimited");
78357         } else {
78358           var waynodes = xml.getElementsByTagName("waynodes");
78359           var maxWayNodes = waynodes.length && parseInt(waynodes[0].getAttribute("maximum"), 10);
78360           if (maxWayNodes && isFinite(maxWayNodes)) _maxWayNodes = maxWayNodes;
78361           var apiStatus = xml.getElementsByTagName("status");
78362           var val = apiStatus[0].getAttribute("api");
78363           return callback(void 0, val);
78364         }
78365       }
78366     },
78367     // Calls `status` and dispatches an `apiStatusChange` event if the returned
78368     // status differs from the cached status.
78369     reloadApiStatus: function() {
78370       if (!this.throttledReloadApiStatus) {
78371         var that = this;
78372         this.throttledReloadApiStatus = throttle_default(function() {
78373           that.status(function(err, status) {
78374             if (status !== _cachedApiStatus) {
78375               _cachedApiStatus = status;
78376               dispatch9.call("apiStatusChange", that, err, status);
78377             }
78378           });
78379         }, 500);
78380       }
78381       this.throttledReloadApiStatus();
78382     },
78383     // Returns the maximum number of nodes a single way can have
78384     maxWayNodes: function() {
78385       return _maxWayNodes;
78386     },
78387     // Load data (entities) from the API in tiles
78388     // GET /api/0.6/map?bbox=
78389     loadTiles: function(projection2, callback) {
78390       if (_off) return;
78391       var tiles = tiler5.zoomExtent([_tileZoom3, _tileZoom3]).getTiles(projection2);
78392       var hadRequests = hasInflightRequests(_tileCache);
78393       abortUnwantedRequests3(_tileCache, tiles);
78394       if (hadRequests && !hasInflightRequests(_tileCache)) {
78395         dispatch9.call("loaded");
78396       }
78397       tiles.forEach(function(tile) {
78398         this.loadTile(tile, callback);
78399       }, this);
78400     },
78401     // Load a single data tile
78402     // GET /api/0.6/map?bbox=
78403     loadTile: function(tile, callback) {
78404       if (_off) return;
78405       if (_tileCache.loaded[tile.id] || _tileCache.inflight[tile.id]) return;
78406       if (!hasInflightRequests(_tileCache)) {
78407         dispatch9.call("loading");
78408       }
78409       var path = "/api/0.6/map.json?bbox=";
78410       var options2 = { skipSeen: true };
78411       _tileCache.inflight[tile.id] = this.loadFromAPI(
78412         path + tile.extent.toParam(),
78413         tileCallback,
78414         options2
78415       );
78416       function tileCallback(err, parsed) {
78417         delete _tileCache.inflight[tile.id];
78418         if (!err) {
78419           delete _tileCache.toLoad[tile.id];
78420           _tileCache.loaded[tile.id] = true;
78421           var bbox2 = tile.extent.bbox();
78422           bbox2.id = tile.id;
78423           _tileCache.rtree.insert(bbox2);
78424         }
78425         if (callback) {
78426           callback(err, Object.assign({ data: parsed }, tile));
78427         }
78428         if (!hasInflightRequests(_tileCache)) {
78429           dispatch9.call("loaded");
78430         }
78431       }
78432     },
78433     isDataLoaded: function(loc) {
78434       var bbox2 = { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] };
78435       return _tileCache.rtree.collides(bbox2);
78436     },
78437     // load the tile that covers the given `loc`
78438     loadTileAtLoc: function(loc, callback) {
78439       if (Object.keys(_tileCache.toLoad).length > 50) return;
78440       var k2 = geoZoomToScale(_tileZoom3 + 1);
78441       var offset = geoRawMercator().scale(k2)(loc);
78442       var projection2 = geoRawMercator().transform({ k: k2, x: -offset[0], y: -offset[1] });
78443       var tiles = tiler5.zoomExtent([_tileZoom3, _tileZoom3]).getTiles(projection2);
78444       tiles.forEach(function(tile) {
78445         if (_tileCache.toLoad[tile.id] || _tileCache.loaded[tile.id] || _tileCache.inflight[tile.id]) return;
78446         _tileCache.toLoad[tile.id] = true;
78447         this.loadTile(tile, callback);
78448       }, this);
78449     },
78450     // Load notes from the API in tiles
78451     // GET /api/0.6/notes?bbox=
78452     loadNotes: function(projection2, noteOptions) {
78453       noteOptions = Object.assign({ limit: 1e4, closed: 7 }, noteOptions);
78454       if (_off) return;
78455       var that = this;
78456       var path = "/api/0.6/notes?limit=" + noteOptions.limit + "&closed=" + noteOptions.closed + "&bbox=";
78457       var throttleLoadUsers = throttle_default(function() {
78458         var uids = Object.keys(_userCache.toLoad);
78459         if (!uids.length) return;
78460         that.loadUsers(uids, function() {
78461         });
78462       }, 750);
78463       var tiles = tiler5.zoomExtent([_noteZoom, _noteZoom]).getTiles(projection2);
78464       abortUnwantedRequests3(_noteCache, tiles);
78465       tiles.forEach(function(tile) {
78466         if (_noteCache.loaded[tile.id] || _noteCache.inflight[tile.id]) return;
78467         var options2 = { skipSeen: false };
78468         _noteCache.inflight[tile.id] = that.loadFromAPI(
78469           path + tile.extent.toParam(),
78470           function(err) {
78471             delete _noteCache.inflight[tile.id];
78472             if (!err) {
78473               _noteCache.loaded[tile.id] = true;
78474             }
78475             throttleLoadUsers();
78476             dispatch9.call("loadedNotes");
78477           },
78478           options2
78479         );
78480       });
78481     },
78482     // Create a note
78483     // POST /api/0.6/notes?params
78484     postNoteCreate: function(note, callback) {
78485       if (!this.authenticated()) {
78486         return callback({ message: "Not Authenticated", status: -3 }, note);
78487       }
78488       if (_noteCache.inflightPost[note.id]) {
78489         return callback({ message: "Note update already inflight", status: -2 }, note);
78490       }
78491       if (!note.loc[0] || !note.loc[1] || !note.newComment) return;
78492       var comment = note.newComment;
78493       if (note.newCategory && note.newCategory !== "None") {
78494         comment += " #" + note.newCategory;
78495       }
78496       var path = "/api/0.6/notes?" + utilQsString({ lon: note.loc[0], lat: note.loc[1], text: comment });
78497       _noteCache.inflightPost[note.id] = oauth.xhr({
78498         method: "POST",
78499         path
78500       }, wrapcb(this, done, _connectionID));
78501       function done(err, xml) {
78502         delete _noteCache.inflightPost[note.id];
78503         if (err) {
78504           return callback(err);
78505         }
78506         this.removeNote(note);
78507         var options2 = { skipSeen: false };
78508         return parseXML(xml, function(err2, results) {
78509           if (err2) {
78510             return callback(err2);
78511           } else {
78512             return callback(void 0, results[0]);
78513           }
78514         }, options2);
78515       }
78516     },
78517     // Update a note
78518     // POST /api/0.6/notes/#id/comment?text=comment
78519     // POST /api/0.6/notes/#id/close?text=comment
78520     // POST /api/0.6/notes/#id/reopen?text=comment
78521     postNoteUpdate: function(note, newStatus, callback) {
78522       if (!this.authenticated()) {
78523         return callback({ message: "Not Authenticated", status: -3 }, note);
78524       }
78525       if (_noteCache.inflightPost[note.id]) {
78526         return callback({ message: "Note update already inflight", status: -2 }, note);
78527       }
78528       var action;
78529       if (note.status !== "closed" && newStatus === "closed") {
78530         action = "close";
78531       } else if (note.status !== "open" && newStatus === "open") {
78532         action = "reopen";
78533       } else {
78534         action = "comment";
78535         if (!note.newComment) return;
78536       }
78537       var path = "/api/0.6/notes/" + note.id + "/" + action;
78538       if (note.newComment) {
78539         path += "?" + utilQsString({ text: note.newComment });
78540       }
78541       _noteCache.inflightPost[note.id] = oauth.xhr({
78542         method: "POST",
78543         path
78544       }, wrapcb(this, done, _connectionID));
78545       function done(err, xml) {
78546         delete _noteCache.inflightPost[note.id];
78547         if (err) {
78548           return callback(err);
78549         }
78550         this.removeNote(note);
78551         if (action === "close") {
78552           _noteCache.closed[note.id] = true;
78553         } else if (action === "reopen") {
78554           delete _noteCache.closed[note.id];
78555         }
78556         var options2 = { skipSeen: false };
78557         return parseXML(xml, function(err2, results) {
78558           if (err2) {
78559             return callback(err2);
78560           } else {
78561             return callback(void 0, results[0]);
78562           }
78563         }, options2);
78564       }
78565     },
78566     /* connection options for source switcher (optional) */
78567     apiConnections: function(val) {
78568       if (!arguments.length) return _apiConnections;
78569       _apiConnections = val;
78570       return this;
78571     },
78572     switch: function(newOptions) {
78573       urlroot = newOptions.url;
78574       apiUrlroot = newOptions.apiUrl || urlroot;
78575       if (newOptions.url && !newOptions.apiUrl) {
78576         newOptions = {
78577           ...newOptions,
78578           apiUrl: newOptions.url
78579         };
78580       }
78581       const oldOptions = utilObjectOmit(oauth.options(), "access_token");
78582       oauth.options({ ...oldOptions, ...newOptions });
78583       this.reset();
78584       this.userChangesets(function() {
78585       });
78586       dispatch9.call("change");
78587       return this;
78588     },
78589     toggle: function(val) {
78590       _off = !val;
78591       return this;
78592     },
78593     isChangesetInflight: function() {
78594       return !!_changeset.inflight;
78595     },
78596     // get/set cached data
78597     // This is used to save/restore the state when entering/exiting the walkthrough
78598     // Also used for testing purposes.
78599     caches: function(obj) {
78600       function cloneCache(source) {
78601         var target = {};
78602         Object.keys(source).forEach(function(k2) {
78603           if (k2 === "rtree") {
78604             target.rtree = new RBush().fromJSON(source.rtree.toJSON());
78605           } else if (k2 === "note") {
78606             target.note = {};
78607             Object.keys(source.note).forEach(function(id2) {
78608               target.note[id2] = osmNote(source.note[id2]);
78609             });
78610           } else {
78611             target[k2] = JSON.parse(JSON.stringify(source[k2]));
78612           }
78613         });
78614         return target;
78615       }
78616       if (!arguments.length) {
78617         return {
78618           tile: cloneCache(_tileCache),
78619           note: cloneCache(_noteCache),
78620           user: cloneCache(_userCache)
78621         };
78622       }
78623       if (obj === "get") {
78624         return {
78625           tile: _tileCache,
78626           note: _noteCache,
78627           user: _userCache
78628         };
78629       }
78630       if (obj.tile) {
78631         _tileCache = obj.tile;
78632         _tileCache.inflight = {};
78633       }
78634       if (obj.note) {
78635         _noteCache = obj.note;
78636         _noteCache.inflight = {};
78637         _noteCache.inflightPost = {};
78638       }
78639       if (obj.user) {
78640         _userCache = obj.user;
78641       }
78642       return this;
78643     },
78644     logout: function() {
78645       _userChangesets = void 0;
78646       _userDetails = void 0;
78647       oauth.logout();
78648       dispatch9.call("change");
78649       return this;
78650     },
78651     authenticated: function() {
78652       return oauth.authenticated();
78653     },
78654     authenticate: function(callback) {
78655       var that = this;
78656       var cid = _connectionID;
78657       _userChangesets = void 0;
78658       _userDetails = void 0;
78659       function done(err, res) {
78660         if (err) {
78661           if (callback) callback(err);
78662           return;
78663         }
78664         if (that.getConnectionId() !== cid) {
78665           if (callback) callback({ message: "Connection Switched", status: -1 });
78666           return;
78667         }
78668         _rateLimitError = void 0;
78669         dispatch9.call("change");
78670         if (callback) callback(err, res);
78671         that.userChangesets(function() {
78672         });
78673       }
78674       oauth.options({
78675         ...oauth.options(),
78676         locale: _mainLocalizer.localeCode()
78677       });
78678       oauth.authenticate(done);
78679     },
78680     imageryBlocklists: function() {
78681       return _imageryBlocklists;
78682     },
78683     tileZoom: function(val) {
78684       if (!arguments.length) return _tileZoom3;
78685       _tileZoom3 = val;
78686       return this;
78687     },
78688     // get all cached notes covering the viewport
78689     notes: function(projection2) {
78690       var viewport = projection2.clipExtent();
78691       var min3 = [viewport[0][0], viewport[1][1]];
78692       var max3 = [viewport[1][0], viewport[0][1]];
78693       var bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
78694       return _noteCache.rtree.search(bbox2).map(function(d2) {
78695         return d2.data;
78696       });
78697     },
78698     // get a single note from the cache
78699     getNote: function(id2) {
78700       return _noteCache.note[id2];
78701     },
78702     // remove a single note from the cache
78703     removeNote: function(note) {
78704       if (!(note instanceof osmNote) || !note.id) return;
78705       delete _noteCache.note[note.id];
78706       updateRtree3(encodeNoteRtree(note), false);
78707     },
78708     // replace a single note in the cache
78709     replaceNote: function(note) {
78710       if (!(note instanceof osmNote) || !note.id) return;
78711       _noteCache.note[note.id] = note;
78712       updateRtree3(encodeNoteRtree(note), true);
78713       return note;
78714     },
78715     // Get an array of note IDs closed during this session.
78716     // Used to populate `closed:note` changeset tag
78717     getClosedIDs: function() {
78718       return Object.keys(_noteCache.closed).sort();
78719     }
78720   };
78721
78722   // modules/services/osm_wikibase.js
78723   var apibase3 = "https://wiki.openstreetmap.org/w/api.php";
78724   var _inflight2 = {};
78725   var _wikibaseCache = {};
78726   var _localeIDs = { en: false };
78727   var debouncedRequest = debounce_default(request, 500, { leading: false });
78728   function request(url, callback) {
78729     if (_inflight2[url]) return;
78730     var controller = new AbortController();
78731     _inflight2[url] = controller;
78732     json_default(url, { signal: controller.signal }).then(function(result) {
78733       delete _inflight2[url];
78734       if (callback) callback(null, result);
78735     }).catch(function(err) {
78736       delete _inflight2[url];
78737       if (err.name === "AbortError") return;
78738       if (callback) callback(err.message);
78739     });
78740   }
78741   var osm_wikibase_default = {
78742     init: function() {
78743       _inflight2 = {};
78744       _wikibaseCache = {};
78745       _localeIDs = {};
78746     },
78747     reset: function() {
78748       Object.values(_inflight2).forEach(function(controller) {
78749         controller.abort();
78750       });
78751       _inflight2 = {};
78752     },
78753     /**
78754      * Get the best value for the property, or undefined if not found
78755      * @param entity object from wikibase
78756      * @param property string e.g. 'P4' for image
78757      * @param langCode string e.g. 'fr' for French
78758      */
78759     claimToValue: function(entity, property, langCode) {
78760       if (!entity.claims[property]) return void 0;
78761       var locale2 = _localeIDs[langCode];
78762       var preferredPick, localePick;
78763       entity.claims[property].forEach(function(stmt) {
78764         if (!preferredPick && stmt.rank === "preferred") {
78765           preferredPick = stmt;
78766         }
78767         if (locale2 && stmt.qualifiers && stmt.qualifiers.P26 && stmt.qualifiers.P26[0].datavalue.value.id === locale2) {
78768           localePick = stmt;
78769         }
78770       });
78771       var result = localePick || preferredPick;
78772       if (result) {
78773         var datavalue = result.mainsnak.datavalue;
78774         return datavalue.type === "wikibase-entityid" ? datavalue.value.id : datavalue.value;
78775       } else {
78776         return void 0;
78777       }
78778     },
78779     /**
78780      * Convert monolingual property into a key-value object (language -> value)
78781      * @param entity object from wikibase
78782      * @param property string e.g. 'P31' for monolingual wiki page title
78783      */
78784     monolingualClaimToValueObj: function(entity, property) {
78785       if (!entity || !entity.claims[property]) return void 0;
78786       return entity.claims[property].reduce(function(acc, obj) {
78787         var value = obj.mainsnak.datavalue.value;
78788         acc[value.language] = value.text;
78789         return acc;
78790       }, {});
78791     },
78792     toSitelink: function(key, value) {
78793       var result = value ? "Tag:" + key + "=" + value : "Key:" + key;
78794       return result.replace(/_/g, " ").trim();
78795     },
78796     //
78797     // Pass params object of the form:
78798     // {
78799     //   key: 'string',
78800     //   value: 'string',
78801     //   langCode: 'string'
78802     // }
78803     //
78804     getEntity: function(params, callback) {
78805       var doRequest = params.debounce ? debouncedRequest : request;
78806       var that = this;
78807       var titles = [];
78808       var result = {};
78809       var rtypeSitelink = params.key === "type" && params.value ? ("Relation:" + params.value).replace(/_/g, " ").trim() : false;
78810       var keySitelink = params.key ? this.toSitelink(params.key) : false;
78811       var tagSitelink = params.key && params.value ? this.toSitelink(params.key, params.value) : false;
78812       var localeSitelink;
78813       if (params.langCodes) {
78814         params.langCodes.forEach(function(langCode) {
78815           if (_localeIDs[langCode] === void 0) {
78816             localeSitelink = ("Locale:" + langCode).replace(/_/g, " ").trim();
78817             titles.push(localeSitelink);
78818           }
78819         });
78820       }
78821       if (rtypeSitelink) {
78822         if (_wikibaseCache[rtypeSitelink]) {
78823           result.rtype = _wikibaseCache[rtypeSitelink];
78824         } else {
78825           titles.push(rtypeSitelink);
78826         }
78827       }
78828       if (keySitelink) {
78829         if (_wikibaseCache[keySitelink]) {
78830           result.key = _wikibaseCache[keySitelink];
78831         } else {
78832           titles.push(keySitelink);
78833         }
78834       }
78835       if (tagSitelink) {
78836         if (_wikibaseCache[tagSitelink]) {
78837           result.tag = _wikibaseCache[tagSitelink];
78838         } else {
78839           titles.push(tagSitelink);
78840         }
78841       }
78842       if (!titles.length) {
78843         return callback(null, result);
78844       }
78845       var obj = {
78846         action: "wbgetentities",
78847         sites: "wiki",
78848         titles: titles.join("|"),
78849         languages: params.langCodes.join("|"),
78850         languagefallback: 1,
78851         origin: "*",
78852         format: "json"
78853         // There is an MW Wikibase API bug https://phabricator.wikimedia.org/T212069
78854         // We shouldn't use v1 until it gets fixed, but should switch to it afterwards
78855         // formatversion: 2,
78856       };
78857       var url = apibase3 + "?" + utilQsString(obj);
78858       doRequest(url, function(err, d2) {
78859         if (err) {
78860           callback(err);
78861         } else if (!d2.success || d2.error) {
78862           callback(d2.error.messages.map(function(v2) {
78863             return v2.html["*"];
78864           }).join("<br>"));
78865         } else {
78866           var localeID = false;
78867           Object.values(d2.entities).forEach(function(res) {
78868             if (res.missing !== "") {
78869               var title = res.sitelinks.wiki.title;
78870               if (title === rtypeSitelink) {
78871                 _wikibaseCache[rtypeSitelink] = res;
78872                 result.rtype = res;
78873               } else if (title === keySitelink) {
78874                 _wikibaseCache[keySitelink] = res;
78875                 result.key = res;
78876               } else if (title === tagSitelink) {
78877                 _wikibaseCache[tagSitelink] = res;
78878                 result.tag = res;
78879               } else if (title === localeSitelink) {
78880                 localeID = res.id;
78881               } else {
78882                 console.log("Unexpected title " + title);
78883               }
78884             }
78885           });
78886           if (localeSitelink) {
78887             that.addLocale(params.langCodes[0], localeID);
78888           }
78889           callback(null, result);
78890         }
78891       });
78892     },
78893     //
78894     // Pass params object of the form:
78895     // {
78896     //   key: 'string',     // required
78897     //   value: 'string'    // optional
78898     // }
78899     //
78900     // Get an result object used to display tag documentation
78901     // {
78902     //   title:        'string',
78903     //   description:  'string',
78904     //   editURL:      'string',
78905     //   imageURL:     'string',
78906     //   wiki:         { title: 'string', text: 'string', url: 'string' }
78907     // }
78908     //
78909     getDocs: function(params, callback) {
78910       var that = this;
78911       var langCodes = _mainLocalizer.localeCodes().map(function(code) {
78912         return code.toLowerCase();
78913       });
78914       params.langCodes = langCodes;
78915       this.getEntity(params, function(err, data) {
78916         if (err) {
78917           callback(err);
78918           return;
78919         }
78920         var entity = data.rtype || data.tag || data.key;
78921         if (!entity) {
78922           callback("No entity");
78923           return;
78924         }
78925         var i3;
78926         var description;
78927         for (i3 in langCodes) {
78928           let code2 = langCodes[i3];
78929           if (entity.descriptions[code2] && entity.descriptions[code2].language === code2) {
78930             description = entity.descriptions[code2];
78931             break;
78932           }
78933         }
78934         if (!description && Object.values(entity.descriptions).length) description = Object.values(entity.descriptions)[0];
78935         var result = {
78936           title: entity.title,
78937           description: description ? description.value : "",
78938           descriptionLocaleCode: description ? description.language : "",
78939           editURL: "https://wiki.openstreetmap.org/wiki/" + entity.title
78940         };
78941         if (entity.claims) {
78942           var imageroot;
78943           var image = that.claimToValue(entity, "P4", langCodes[0]);
78944           if (image) {
78945             imageroot = "https://commons.wikimedia.org/w/index.php";
78946           } else {
78947             image = that.claimToValue(entity, "P28", langCodes[0]);
78948             if (image) {
78949               imageroot = "https://wiki.openstreetmap.org/w/index.php";
78950             }
78951           }
78952           if (imageroot && image) {
78953             result.imageURL = imageroot + "?" + utilQsString({
78954               title: "Special:Redirect/file/" + image,
78955               width: 400
78956             });
78957           }
78958         }
78959         var rtypeWiki = that.monolingualClaimToValueObj(data.rtype, "P31");
78960         var tagWiki = that.monolingualClaimToValueObj(data.tag, "P31");
78961         var keyWiki = that.monolingualClaimToValueObj(data.key, "P31");
78962         var wikis = [rtypeWiki, tagWiki, keyWiki];
78963         for (i3 in wikis) {
78964           var wiki = wikis[i3];
78965           for (var j2 in langCodes) {
78966             var code = langCodes[j2];
78967             var referenceId = langCodes[0].split("-")[0] !== "en" && code.split("-")[0] === "en" ? "inspector.wiki_en_reference" : "inspector.wiki_reference";
78968             var info = getWikiInfo(wiki, code, referenceId);
78969             if (info) {
78970               result.wiki = info;
78971               break;
78972             }
78973           }
78974           if (result.wiki) break;
78975         }
78976         callback(null, result);
78977         function getWikiInfo(wiki2, langCode, tKey) {
78978           if (wiki2 && wiki2[langCode]) {
78979             return {
78980               title: wiki2[langCode],
78981               text: tKey,
78982               url: "https://wiki.openstreetmap.org/wiki/" + wiki2[langCode]
78983             };
78984           }
78985         }
78986       });
78987     },
78988     addLocale: function(langCode, qid) {
78989       _localeIDs[langCode] = qid;
78990     },
78991     apibase: function(val) {
78992       if (!arguments.length) return apibase3;
78993       apibase3 = val;
78994       return this;
78995     }
78996   };
78997
78998   // modules/services/streetside.js
78999   var streetsideApi = "https://dev.virtualearth.net/REST/v1/Imagery/MetaData/Streetside?mapArea={bbox}&key={key}&count={count}";
79000   var maxResults2 = 500;
79001   var bubbleAppKey = utilAesDecrypt("5c875730b09c6b422433e807e1ff060b6536c791dbfffcffc4c6b18a1bdba1f14593d151adb50e19e1be1ab19aef813bf135d0f103475e5c724dec94389e45d0");
79002   var pannellumViewerCSS2 = "pannellum/pannellum.css";
79003   var pannellumViewerJS2 = "pannellum/pannellum.js";
79004   var tileZoom3 = 16.5;
79005   var tiler6 = utilTiler().zoomExtent([tileZoom3, tileZoom3]).skipNullIsland(true);
79006   var dispatch10 = dispatch_default("loadedImages", "viewerChanged");
79007   var minHfov = 10;
79008   var maxHfov = 90;
79009   var defaultHfov = 45;
79010   var _hires = false;
79011   var _resolution = 512;
79012   var _currScene = 0;
79013   var _ssCache;
79014   var _pannellumViewer2;
79015   var _sceneOptions = {
79016     showFullscreenCtrl: false,
79017     autoLoad: true,
79018     compass: true,
79019     yaw: 0,
79020     minHfov,
79021     maxHfov,
79022     hfov: defaultHfov,
79023     type: "cubemap",
79024     cubeMap: []
79025   };
79026   var _loadViewerPromise4;
79027   function abortRequest5(i3) {
79028     i3.abort();
79029   }
79030   function localeTimestamp2(s2) {
79031     if (!s2) return null;
79032     const options2 = { day: "numeric", month: "short", year: "numeric" };
79033     const d2 = new Date(s2);
79034     if (isNaN(d2.getTime())) return null;
79035     return d2.toLocaleString(_mainLocalizer.localeCode(), options2);
79036   }
79037   function loadTiles3(which, url, projection2, margin) {
79038     const tiles = tiler6.margin(margin).getTiles(projection2);
79039     const cache = _ssCache[which];
79040     Object.keys(cache.inflight).forEach((k2) => {
79041       const wanted = tiles.find((tile) => k2.indexOf(tile.id + ",") === 0);
79042       if (!wanted) {
79043         abortRequest5(cache.inflight[k2]);
79044         delete cache.inflight[k2];
79045       }
79046     });
79047     tiles.forEach((tile) => loadNextTilePage2(which, url, tile));
79048   }
79049   function loadNextTilePage2(which, url, tile) {
79050     const cache = _ssCache[which];
79051     const nextPage = cache.nextPage[tile.id] || 0;
79052     const id2 = tile.id + "," + String(nextPage);
79053     if (cache.loaded[id2] || cache.inflight[id2]) return;
79054     cache.inflight[id2] = getBubbles(url, tile, (response) => {
79055       cache.loaded[id2] = true;
79056       delete cache.inflight[id2];
79057       if (!response) return;
79058       if (response.resourceSets[0].resources.length === maxResults2) {
79059         const split = tile.extent.split();
79060         loadNextTilePage2(which, url, { id: tile.id + ",a", extent: split[0] });
79061         loadNextTilePage2(which, url, { id: tile.id + ",b", extent: split[1] });
79062         loadNextTilePage2(which, url, { id: tile.id + ",c", extent: split[2] });
79063         loadNextTilePage2(which, url, { id: tile.id + ",d", extent: split[3] });
79064       }
79065       const features = response.resourceSets[0].resources.map((bubble) => {
79066         const bubbleId = bubble.imageUrl;
79067         if (cache.points[bubbleId]) return null;
79068         const loc = [
79069           bubble.lon || bubble.longitude,
79070           bubble.lat || bubble.latitude
79071         ];
79072         const d2 = {
79073           loc,
79074           key: bubbleId,
79075           imageUrl: bubble.imageUrl.replace(
79076             "{subdomain}",
79077             bubble.imageUrlSubdomains[0]
79078           ),
79079           ca: bubble.he || bubble.heading,
79080           captured_at: bubble.vintageEnd,
79081           captured_by: "microsoft",
79082           pano: true,
79083           sequenceKey: null
79084         };
79085         cache.points[bubbleId] = d2;
79086         return {
79087           minX: loc[0],
79088           minY: loc[1],
79089           maxX: loc[0],
79090           maxY: loc[1],
79091           data: d2
79092         };
79093       }).filter(Boolean);
79094       cache.rtree.load(features);
79095       if (which === "bubbles") {
79096         dispatch10.call("loadedImages");
79097       }
79098     });
79099   }
79100   function getBubbles(url, tile, callback) {
79101     let rect = tile.extent.rectangle();
79102     let urlForRequest = url.replace("{key}", bubbleAppKey).replace("{bbox}", [rect[1], rect[0], rect[3], rect[2]].join(",")).replace("{count}", maxResults2);
79103     const controller = new AbortController();
79104     fetch(urlForRequest, { signal: controller.signal }).then(function(response) {
79105       if (!response.ok) {
79106         throw new Error(response.status + " " + response.statusText);
79107       }
79108       return response.json();
79109     }).then(function(result) {
79110       if (!result) {
79111         callback(null);
79112       }
79113       return callback(result || []);
79114     }).catch(function(err) {
79115       if (err.name === "AbortError") {
79116       } else {
79117         throw new Error(err);
79118       }
79119     });
79120     return controller;
79121   }
79122   function partitionViewport4(projection2) {
79123     let z2 = geoScaleToZoom(projection2.scale());
79124     let z22 = Math.ceil(z2 * 2) / 2 + 2.5;
79125     let tiler8 = utilTiler().zoomExtent([z22, z22]);
79126     return tiler8.getTiles(projection2).map((tile) => tile.extent);
79127   }
79128   function searchLimited4(limit, projection2, rtree) {
79129     limit = limit || 5;
79130     return partitionViewport4(projection2).reduce((result, extent) => {
79131       let found = rtree.search(extent.bbox()).slice(0, limit).map((d2) => d2.data);
79132       return found.length ? result.concat(found) : result;
79133     }, []);
79134   }
79135   function loadImage2(imgInfo) {
79136     return new Promise((resolve) => {
79137       let img = new Image();
79138       img.onload = () => {
79139         let canvas = document.getElementById("ideditor-canvas" + imgInfo.face);
79140         let ctx = canvas.getContext("2d");
79141         ctx.drawImage(img, imgInfo.x, imgInfo.y);
79142         resolve({ imgInfo, status: "ok" });
79143       };
79144       img.onerror = () => {
79145         resolve({ data: imgInfo, status: "error" });
79146       };
79147       img.setAttribute("crossorigin", "");
79148       img.src = imgInfo.url;
79149     });
79150   }
79151   function loadCanvas(imageGroup) {
79152     return Promise.all(imageGroup.map(loadImage2)).then((data) => {
79153       let canvas = document.getElementById("ideditor-canvas" + data[0].imgInfo.face);
79154       const which = { "01": 0, "02": 1, "03": 2, "10": 3, "11": 4, "12": 5 };
79155       let face = data[0].imgInfo.face;
79156       _sceneOptions.cubeMap[which[face]] = canvas.toDataURL("image/jpeg", 1);
79157       return { status: "loadCanvas for face " + data[0].imgInfo.face + "ok" };
79158     });
79159   }
79160   function loadFaces(faceGroup) {
79161     return Promise.all(faceGroup.map(loadCanvas)).then(() => {
79162       return { status: "loadFaces done" };
79163     });
79164   }
79165   function setupCanvas(selection2, reset) {
79166     if (reset) {
79167       selection2.selectAll("#ideditor-stitcher-canvases").remove();
79168     }
79169     selection2.selectAll("#ideditor-stitcher-canvases").data([0]).enter().append("div").attr("id", "ideditor-stitcher-canvases").attr("display", "none").selectAll("canvas").data(["canvas01", "canvas02", "canvas03", "canvas10", "canvas11", "canvas12"]).enter().append("canvas").attr("id", (d2) => "ideditor-" + d2).attr("width", _resolution).attr("height", _resolution);
79170   }
79171   function qkToXY(qk) {
79172     let x2 = 0;
79173     let y2 = 0;
79174     let scale = 256;
79175     for (let i3 = qk.length; i3 > 0; i3--) {
79176       const key = qk[i3 - 1];
79177       x2 += +(key === "1" || key === "3") * scale;
79178       y2 += +(key === "2" || key === "3") * scale;
79179       scale *= 2;
79180     }
79181     return [x2, y2];
79182   }
79183   function getQuadKeys() {
79184     let dim = _resolution / 256;
79185     let quadKeys;
79186     if (dim === 16) {
79187       quadKeys = [
79188         "0000",
79189         "0001",
79190         "0010",
79191         "0011",
79192         "0100",
79193         "0101",
79194         "0110",
79195         "0111",
79196         "1000",
79197         "1001",
79198         "1010",
79199         "1011",
79200         "1100",
79201         "1101",
79202         "1110",
79203         "1111",
79204         "0002",
79205         "0003",
79206         "0012",
79207         "0013",
79208         "0102",
79209         "0103",
79210         "0112",
79211         "0113",
79212         "1002",
79213         "1003",
79214         "1012",
79215         "1013",
79216         "1102",
79217         "1103",
79218         "1112",
79219         "1113",
79220         "0020",
79221         "0021",
79222         "0030",
79223         "0031",
79224         "0120",
79225         "0121",
79226         "0130",
79227         "0131",
79228         "1020",
79229         "1021",
79230         "1030",
79231         "1031",
79232         "1120",
79233         "1121",
79234         "1130",
79235         "1131",
79236         "0022",
79237         "0023",
79238         "0032",
79239         "0033",
79240         "0122",
79241         "0123",
79242         "0132",
79243         "0133",
79244         "1022",
79245         "1023",
79246         "1032",
79247         "1033",
79248         "1122",
79249         "1123",
79250         "1132",
79251         "1133",
79252         "0200",
79253         "0201",
79254         "0210",
79255         "0211",
79256         "0300",
79257         "0301",
79258         "0310",
79259         "0311",
79260         "1200",
79261         "1201",
79262         "1210",
79263         "1211",
79264         "1300",
79265         "1301",
79266         "1310",
79267         "1311",
79268         "0202",
79269         "0203",
79270         "0212",
79271         "0213",
79272         "0302",
79273         "0303",
79274         "0312",
79275         "0313",
79276         "1202",
79277         "1203",
79278         "1212",
79279         "1213",
79280         "1302",
79281         "1303",
79282         "1312",
79283         "1313",
79284         "0220",
79285         "0221",
79286         "0230",
79287         "0231",
79288         "0320",
79289         "0321",
79290         "0330",
79291         "0331",
79292         "1220",
79293         "1221",
79294         "1230",
79295         "1231",
79296         "1320",
79297         "1321",
79298         "1330",
79299         "1331",
79300         "0222",
79301         "0223",
79302         "0232",
79303         "0233",
79304         "0322",
79305         "0323",
79306         "0332",
79307         "0333",
79308         "1222",
79309         "1223",
79310         "1232",
79311         "1233",
79312         "1322",
79313         "1323",
79314         "1332",
79315         "1333",
79316         "2000",
79317         "2001",
79318         "2010",
79319         "2011",
79320         "2100",
79321         "2101",
79322         "2110",
79323         "2111",
79324         "3000",
79325         "3001",
79326         "3010",
79327         "3011",
79328         "3100",
79329         "3101",
79330         "3110",
79331         "3111",
79332         "2002",
79333         "2003",
79334         "2012",
79335         "2013",
79336         "2102",
79337         "2103",
79338         "2112",
79339         "2113",
79340         "3002",
79341         "3003",
79342         "3012",
79343         "3013",
79344         "3102",
79345         "3103",
79346         "3112",
79347         "3113",
79348         "2020",
79349         "2021",
79350         "2030",
79351         "2031",
79352         "2120",
79353         "2121",
79354         "2130",
79355         "2131",
79356         "3020",
79357         "3021",
79358         "3030",
79359         "3031",
79360         "3120",
79361         "3121",
79362         "3130",
79363         "3131",
79364         "2022",
79365         "2023",
79366         "2032",
79367         "2033",
79368         "2122",
79369         "2123",
79370         "2132",
79371         "2133",
79372         "3022",
79373         "3023",
79374         "3032",
79375         "3033",
79376         "3122",
79377         "3123",
79378         "3132",
79379         "3133",
79380         "2200",
79381         "2201",
79382         "2210",
79383         "2211",
79384         "2300",
79385         "2301",
79386         "2310",
79387         "2311",
79388         "3200",
79389         "3201",
79390         "3210",
79391         "3211",
79392         "3300",
79393         "3301",
79394         "3310",
79395         "3311",
79396         "2202",
79397         "2203",
79398         "2212",
79399         "2213",
79400         "2302",
79401         "2303",
79402         "2312",
79403         "2313",
79404         "3202",
79405         "3203",
79406         "3212",
79407         "3213",
79408         "3302",
79409         "3303",
79410         "3312",
79411         "3313",
79412         "2220",
79413         "2221",
79414         "2230",
79415         "2231",
79416         "2320",
79417         "2321",
79418         "2330",
79419         "2331",
79420         "3220",
79421         "3221",
79422         "3230",
79423         "3231",
79424         "3320",
79425         "3321",
79426         "3330",
79427         "3331",
79428         "2222",
79429         "2223",
79430         "2232",
79431         "2233",
79432         "2322",
79433         "2323",
79434         "2332",
79435         "2333",
79436         "3222",
79437         "3223",
79438         "3232",
79439         "3233",
79440         "3322",
79441         "3323",
79442         "3332",
79443         "3333"
79444       ];
79445     } else if (dim === 8) {
79446       quadKeys = [
79447         "000",
79448         "001",
79449         "010",
79450         "011",
79451         "100",
79452         "101",
79453         "110",
79454         "111",
79455         "002",
79456         "003",
79457         "012",
79458         "013",
79459         "102",
79460         "103",
79461         "112",
79462         "113",
79463         "020",
79464         "021",
79465         "030",
79466         "031",
79467         "120",
79468         "121",
79469         "130",
79470         "131",
79471         "022",
79472         "023",
79473         "032",
79474         "033",
79475         "122",
79476         "123",
79477         "132",
79478         "133",
79479         "200",
79480         "201",
79481         "210",
79482         "211",
79483         "300",
79484         "301",
79485         "310",
79486         "311",
79487         "202",
79488         "203",
79489         "212",
79490         "213",
79491         "302",
79492         "303",
79493         "312",
79494         "313",
79495         "220",
79496         "221",
79497         "230",
79498         "231",
79499         "320",
79500         "321",
79501         "330",
79502         "331",
79503         "222",
79504         "223",
79505         "232",
79506         "233",
79507         "322",
79508         "323",
79509         "332",
79510         "333"
79511       ];
79512     } else if (dim === 4) {
79513       quadKeys = [
79514         "00",
79515         "01",
79516         "10",
79517         "11",
79518         "02",
79519         "03",
79520         "12",
79521         "13",
79522         "20",
79523         "21",
79524         "30",
79525         "31",
79526         "22",
79527         "23",
79528         "32",
79529         "33"
79530       ];
79531     } else {
79532       quadKeys = [
79533         "0",
79534         "1",
79535         "2",
79536         "3"
79537       ];
79538     }
79539     return quadKeys;
79540   }
79541   var streetside_default = {
79542     /**
79543      * init() initialize streetside.
79544      */
79545     init: function() {
79546       if (!_ssCache) {
79547         this.reset();
79548       }
79549       this.event = utilRebind(this, dispatch10, "on");
79550     },
79551     /**
79552      * reset() reset the cache.
79553      */
79554     reset: function() {
79555       if (_ssCache) {
79556         Object.values(_ssCache.bubbles.inflight).forEach(abortRequest5);
79557       }
79558       _ssCache = {
79559         bubbles: { inflight: {}, loaded: {}, nextPage: {}, rtree: new RBush(), points: {} },
79560         sequences: {}
79561       };
79562     },
79563     /**
79564      * bubbles()
79565      */
79566     bubbles: function(projection2) {
79567       const limit = 5;
79568       return searchLimited4(limit, projection2, _ssCache.bubbles.rtree);
79569     },
79570     cachedImage: function(imageKey) {
79571       return _ssCache.bubbles.points[imageKey];
79572     },
79573     sequences: function(projection2) {
79574       const viewport = projection2.clipExtent();
79575       const min3 = [viewport[0][0], viewport[1][1]];
79576       const max3 = [viewport[1][0], viewport[0][1]];
79577       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
79578       let seen = {};
79579       let results = [];
79580       _ssCache.bubbles.rtree.search(bbox2).forEach((d2) => {
79581         const key = d2.data.sequenceKey;
79582         if (key && !seen[key]) {
79583           seen[key] = true;
79584           results.push(_ssCache.sequences[key].geojson);
79585         }
79586       });
79587       return results;
79588     },
79589     /**
79590      * loadBubbles()
79591      */
79592     loadBubbles: function(projection2, margin) {
79593       if (margin === void 0) margin = 2;
79594       loadTiles3("bubbles", streetsideApi, projection2, margin);
79595     },
79596     viewer: function() {
79597       return _pannellumViewer2;
79598     },
79599     initViewer: function() {
79600       if (!window.pannellum) return;
79601       if (_pannellumViewer2) return;
79602       _currScene += 1;
79603       const sceneID = _currScene.toString();
79604       const options2 = {
79605         "default": { firstScene: sceneID },
79606         scenes: {}
79607       };
79608       options2.scenes[sceneID] = _sceneOptions;
79609       _pannellumViewer2 = window.pannellum.viewer("ideditor-viewer-streetside", options2);
79610     },
79611     ensureViewerLoaded: function(context) {
79612       if (_loadViewerPromise4) return _loadViewerPromise4;
79613       let wrap2 = context.container().select(".photoviewer").selectAll(".ms-wrapper").data([0]);
79614       let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper ms-wrapper").classed("hide", true);
79615       let that = this;
79616       let pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
79617       wrapEnter.append("div").attr("id", "ideditor-viewer-streetside").on(pointerPrefix + "down.streetside", () => {
79618         select_default2(window).on(pointerPrefix + "move.streetside", () => {
79619           dispatch10.call("viewerChanged");
79620         }, true);
79621       }).on(pointerPrefix + "up.streetside pointercancel.streetside", () => {
79622         select_default2(window).on(pointerPrefix + "move.streetside", null);
79623         let t2 = timer((elapsed) => {
79624           dispatch10.call("viewerChanged");
79625           if (elapsed > 2e3) {
79626             t2.stop();
79627           }
79628         });
79629       }).append("div").attr("class", "photo-attribution fillD");
79630       let controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
79631       controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
79632       controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
79633       wrap2 = wrap2.merge(wrapEnter).call(setupCanvas, true);
79634       context.ui().photoviewer.on("resize.streetside", () => {
79635         if (_pannellumViewer2) {
79636           _pannellumViewer2.resize();
79637         }
79638       });
79639       _loadViewerPromise4 = new Promise((resolve, reject) => {
79640         let loadedCount = 0;
79641         function loaded() {
79642           loadedCount += 1;
79643           if (loadedCount === 2) resolve();
79644         }
79645         const head = select_default2("head");
79646         head.selectAll("#ideditor-streetside-viewercss").data([0]).enter().append("link").attr("id", "ideditor-streetside-viewercss").attr("rel", "stylesheet").attr("crossorigin", "anonymous").attr("href", context.asset(pannellumViewerCSS2)).on("load.serviceStreetside", loaded).on("error.serviceStreetside", function() {
79647           reject();
79648         });
79649         head.selectAll("#ideditor-streetside-viewerjs").data([0]).enter().append("script").attr("id", "ideditor-streetside-viewerjs").attr("crossorigin", "anonymous").attr("src", context.asset(pannellumViewerJS2)).on("load.serviceStreetside", loaded).on("error.serviceStreetside", function() {
79650           reject();
79651         });
79652       }).catch(function() {
79653         _loadViewerPromise4 = null;
79654       });
79655       return _loadViewerPromise4;
79656       function step(stepBy) {
79657         return () => {
79658           let viewer = context.container().select(".photoviewer");
79659           let selected = viewer.empty() ? void 0 : viewer.datum();
79660           if (!selected) return;
79661           let nextID = stepBy === 1 ? selected.ne : selected.pr;
79662           let yaw = _pannellumViewer2.getYaw();
79663           let ca = selected.ca + yaw;
79664           let origin = selected.loc;
79665           const meters = 35;
79666           let p1 = [
79667             origin[0] + geoMetersToLon(meters / 5, origin[1]),
79668             origin[1]
79669           ];
79670           let p2 = [
79671             origin[0] + geoMetersToLon(meters / 2, origin[1]),
79672             origin[1] + geoMetersToLat(meters)
79673           ];
79674           let p3 = [
79675             origin[0] - geoMetersToLon(meters / 2, origin[1]),
79676             origin[1] + geoMetersToLat(meters)
79677           ];
79678           let p4 = [
79679             origin[0] - geoMetersToLon(meters / 5, origin[1]),
79680             origin[1]
79681           ];
79682           let poly = [p1, p2, p3, p4, p1];
79683           let angle2 = (stepBy === 1 ? ca : ca + 180) * (Math.PI / 180);
79684           poly = geoRotate(poly, -angle2, origin);
79685           let extent = poly.reduce((extent2, point) => {
79686             return extent2.extend(geoExtent(point));
79687           }, geoExtent());
79688           let minDist = Infinity;
79689           _ssCache.bubbles.rtree.search(extent.bbox()).forEach((d2) => {
79690             if (d2.data.key === selected.key) return;
79691             if (!geoPointInPolygon(d2.data.loc, poly)) return;
79692             let dist = geoVecLength(d2.data.loc, selected.loc);
79693             let theta = selected.ca - d2.data.ca;
79694             let minTheta = Math.min(Math.abs(theta), 360 - Math.abs(theta));
79695             if (minTheta > 20) {
79696               dist += 5;
79697             }
79698             if (dist < minDist) {
79699               nextID = d2.data.key;
79700               minDist = dist;
79701             }
79702           });
79703           let nextBubble = nextID && that.cachedImage(nextID);
79704           if (!nextBubble) return;
79705           context.map().centerEase(nextBubble.loc);
79706           that.selectImage(context, nextBubble.key).yaw(yaw).showViewer(context);
79707         };
79708       }
79709     },
79710     yaw: function(yaw) {
79711       if (typeof yaw !== "number") return yaw;
79712       _sceneOptions.yaw = yaw;
79713       return this;
79714     },
79715     /**
79716      * showViewer()
79717      */
79718     showViewer: function(context) {
79719       let wrap2 = context.container().select(".photoviewer").classed("hide", false);
79720       let isHidden = wrap2.selectAll(".photo-wrapper.ms-wrapper.hide").size();
79721       if (isHidden) {
79722         wrap2.selectAll(".photo-wrapper:not(.ms-wrapper)").classed("hide", true);
79723         wrap2.selectAll(".photo-wrapper.ms-wrapper").classed("hide", false);
79724       }
79725       return this;
79726     },
79727     /**
79728      * hideViewer()
79729      */
79730     hideViewer: function(context) {
79731       let viewer = context.container().select(".photoviewer");
79732       if (!viewer.empty()) viewer.datum(null);
79733       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
79734       context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
79735       this.updateUrlImage(null);
79736       return this.setStyles(context, null, true);
79737     },
79738     /**
79739      * selectImage().
79740      */
79741     selectImage: function(context, key) {
79742       let that = this;
79743       let d2 = this.cachedImage(key);
79744       let viewer = context.container().select(".photoviewer");
79745       if (!viewer.empty()) viewer.datum(d2);
79746       this.setStyles(context, null, true);
79747       let wrap2 = context.container().select(".photoviewer .ms-wrapper");
79748       let attribution = wrap2.selectAll(".photo-attribution").html("");
79749       wrap2.selectAll(".pnlm-load-box").style("display", "block");
79750       if (!d2) return this;
79751       this.updateUrlImage(key);
79752       _sceneOptions.northOffset = d2.ca;
79753       let line1 = attribution.append("div").attr("class", "attribution-row");
79754       const hiresDomId = utilUniqueDomId("streetside-hires");
79755       let label = line1.append("label").attr("for", hiresDomId).attr("class", "streetside-hires");
79756       label.append("input").attr("type", "checkbox").attr("id", hiresDomId).property("checked", _hires).on("click", (d3_event) => {
79757         d3_event.stopPropagation();
79758         _hires = !_hires;
79759         _resolution = _hires ? 1024 : 512;
79760         wrap2.call(setupCanvas, true);
79761         let viewstate = {
79762           yaw: _pannellumViewer2.getYaw(),
79763           pitch: _pannellumViewer2.getPitch(),
79764           hfov: _pannellumViewer2.getHfov()
79765         };
79766         _sceneOptions = Object.assign(_sceneOptions, viewstate);
79767         that.selectImage(context, d2.key).showViewer(context);
79768       });
79769       label.append("span").call(_t.append("streetside.hires"));
79770       let captureInfo = line1.append("div").attr("class", "attribution-capture-info");
79771       if (d2.captured_by) {
79772         const yyyy = (/* @__PURE__ */ new Date()).getFullYear();
79773         captureInfo.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://www.microsoft.com/en-us/maps/streetside").text("\xA9" + yyyy + " Microsoft");
79774         captureInfo.append("span").text("|");
79775       }
79776       if (d2.captured_at) {
79777         captureInfo.append("span").attr("class", "captured_at").text(localeTimestamp2(d2.captured_at));
79778       }
79779       let line2 = attribution.append("div").attr("class", "attribution-row");
79780       line2.append("a").attr("class", "image-view-link").attr("target", "_blank").attr("href", "https://www.bing.com/maps?cp=" + d2.loc[1] + "~" + d2.loc[0] + "&lvl=17&dir=" + d2.ca + "&style=x&v=2&sV=1").call(_t.append("streetside.view_on_bing"));
79781       line2.append("a").attr("class", "image-report-link").attr("target", "_blank").attr("href", "https://www.bing.com/maps/privacyreport/streetsideprivacyreport?bubbleid=" + encodeURIComponent(d2.key) + "&focus=photo&lat=" + d2.loc[1] + "&lng=" + d2.loc[0] + "&z=17").call(_t.append("streetside.report"));
79782       const faceKeys = ["01", "02", "03", "10", "11", "12"];
79783       let quadKeys = getQuadKeys();
79784       let faces = faceKeys.map((faceKey) => {
79785         return quadKeys.map((quadKey) => {
79786           const xy = qkToXY(quadKey);
79787           return {
79788             face: faceKey,
79789             url: d2.imageUrl.replace("{faceId}", faceKey).replace("{tileId}", quadKey),
79790             x: xy[0],
79791             y: xy[1]
79792           };
79793         });
79794       });
79795       loadFaces(faces).then(function() {
79796         if (!_pannellumViewer2) {
79797           that.initViewer();
79798         } else {
79799           _currScene += 1;
79800           let sceneID = _currScene.toString();
79801           _pannellumViewer2.addScene(sceneID, _sceneOptions).loadScene(sceneID);
79802           if (_currScene > 2) {
79803             sceneID = (_currScene - 1).toString();
79804             _pannellumViewer2.removeScene(sceneID);
79805           }
79806         }
79807       });
79808       return this;
79809     },
79810     getSequenceKeyForBubble: function(d2) {
79811       return d2 && d2.sequenceKey;
79812     },
79813     // Updates the currently highlighted sequence and selected bubble.
79814     // Reset is only necessary when interacting with the viewport because
79815     // this implicitly changes the currently selected bubble/sequence
79816     setStyles: function(context, hovered, reset) {
79817       if (reset) {
79818         context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
79819         context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
79820       }
79821       let hoveredBubbleKey = hovered && hovered.key;
79822       let hoveredSequenceKey = this.getSequenceKeyForBubble(hovered);
79823       let hoveredSequence = hoveredSequenceKey && _ssCache.sequences[hoveredSequenceKey];
79824       let hoveredBubbleKeys = hoveredSequence && hoveredSequence.bubbles.map((d2) => d2.key) || [];
79825       let viewer = context.container().select(".photoviewer");
79826       let selected = viewer.empty() ? void 0 : viewer.datum();
79827       let selectedBubbleKey = selected && selected.key;
79828       let selectedSequenceKey = this.getSequenceKeyForBubble(selected);
79829       let selectedSequence = selectedSequenceKey && _ssCache.sequences[selectedSequenceKey];
79830       let selectedBubbleKeys = selectedSequence && selectedSequence.bubbles.map((d2) => d2.key) || [];
79831       let highlightedBubbleKeys = utilArrayUnion(hoveredBubbleKeys, selectedBubbleKeys);
79832       context.container().selectAll(".layer-streetside-images .viewfield-group").classed("highlighted", (d2) => highlightedBubbleKeys.indexOf(d2.key) !== -1).classed("hovered", (d2) => d2.key === hoveredBubbleKey).classed("currentView", (d2) => d2.key === selectedBubbleKey);
79833       context.container().selectAll(".layer-streetside-images .sequence").classed("highlighted", (d2) => d2.properties.key === hoveredSequenceKey).classed("currentView", (d2) => d2.properties.key === selectedSequenceKey);
79834       context.container().selectAll(".layer-streetside-images .viewfield-group .viewfield").attr("d", viewfieldPath);
79835       function viewfieldPath() {
79836         let d2 = this.parentNode.__data__;
79837         if (d2.pano && d2.key !== selectedBubbleKey) {
79838           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
79839         } else {
79840           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
79841         }
79842       }
79843       return this;
79844     },
79845     updateUrlImage: function(imageKey) {
79846       if (!window.mocha) {
79847         var hash = utilStringQs(window.location.hash);
79848         if (imageKey) {
79849           hash.photo = "streetside/" + imageKey;
79850         } else {
79851           delete hash.photo;
79852         }
79853         window.location.replace("#" + utilQsString(hash, true));
79854       }
79855     },
79856     /**
79857      * cache().
79858      */
79859     cache: function() {
79860       return _ssCache;
79861     }
79862   };
79863
79864   // modules/services/taginfo.js
79865   var apibase4 = taginfoApiUrl;
79866   var _inflight3 = {};
79867   var _popularKeys = {};
79868   var _taginfoCache = {};
79869   var tag_sorts = {
79870     point: "count_nodes",
79871     vertex: "count_nodes",
79872     area: "count_ways",
79873     line: "count_ways"
79874   };
79875   var tag_sort_members = {
79876     point: "count_node_members",
79877     vertex: "count_node_members",
79878     area: "count_way_members",
79879     line: "count_way_members",
79880     relation: "count_relation_members"
79881   };
79882   var tag_filters = {
79883     point: "nodes",
79884     vertex: "nodes",
79885     area: "ways",
79886     line: "ways"
79887   };
79888   var tag_members_fractions = {
79889     point: "count_node_members_fraction",
79890     vertex: "count_node_members_fraction",
79891     area: "count_way_members_fraction",
79892     line: "count_way_members_fraction",
79893     relation: "count_relation_members_fraction"
79894   };
79895   function sets(params, n3, o2) {
79896     if (params.geometry && o2[params.geometry]) {
79897       params[n3] = o2[params.geometry];
79898     }
79899     return params;
79900   }
79901   function setFilter(params) {
79902     return sets(params, "filter", tag_filters);
79903   }
79904   function setSort(params) {
79905     return sets(params, "sortname", tag_sorts);
79906   }
79907   function setSortMembers(params) {
79908     return sets(params, "sortname", tag_sort_members);
79909   }
79910   function clean(params) {
79911     return utilObjectOmit(params, ["geometry", "debounce"]);
79912   }
79913   function filterKeys(type2) {
79914     var count_type = type2 ? "count_" + type2 : "count_all";
79915     return function(d2) {
79916       return Number(d2[count_type]) > 2500 || d2.in_wiki;
79917     };
79918   }
79919   function filterMultikeys(prefix) {
79920     return function(d2) {
79921       var re3 = new RegExp("^" + prefix + "(.*)$", "i");
79922       var matches = d2.key.match(re3) || [];
79923       return matches.length === 2 && matches[1].indexOf(":") === -1;
79924     };
79925   }
79926   function filterValues(allowUpperCase) {
79927     return function(d2) {
79928       if (d2.value.match(/[;,]/) !== null) return false;
79929       if (!allowUpperCase && d2.value.match(/[A-Z*]/) !== null) return false;
79930       return d2.count > 100 || d2.in_wiki;
79931     };
79932   }
79933   function filterRoles(geometry) {
79934     return function(d2) {
79935       if (d2.role === "") return false;
79936       if (d2.role.match(/[A-Z*;,]/) !== null) return false;
79937       return Number(d2[tag_members_fractions[geometry]]) > 0;
79938     };
79939   }
79940   function valKey(d2) {
79941     return {
79942       value: d2.key,
79943       title: d2.key
79944     };
79945   }
79946   function valKeyDescription(d2) {
79947     var obj = {
79948       value: d2.value,
79949       title: d2.description || d2.value
79950     };
79951     return obj;
79952   }
79953   function roleKey(d2) {
79954     return {
79955       value: d2.role,
79956       title: d2.role
79957     };
79958   }
79959   function sortKeys(a2, b2) {
79960     return a2.key.indexOf(":") === -1 && b2.key.indexOf(":") !== -1 ? -1 : a2.key.indexOf(":") !== -1 && b2.key.indexOf(":") === -1 ? 1 : 0;
79961   }
79962   var debouncedRequest2 = debounce_default(request2, 300, { leading: false });
79963   function request2(url, params, exactMatch, callback, loaded) {
79964     if (_inflight3[url]) return;
79965     if (checkCache(url, params, exactMatch, callback)) return;
79966     var controller = new AbortController();
79967     _inflight3[url] = controller;
79968     json_default(url, { signal: controller.signal }).then(function(result) {
79969       delete _inflight3[url];
79970       if (loaded) loaded(null, result);
79971     }).catch(function(err) {
79972       delete _inflight3[url];
79973       if (err.name === "AbortError") return;
79974       if (loaded) loaded(err.message);
79975     });
79976   }
79977   function checkCache(url, params, exactMatch, callback) {
79978     var rp = params.rp || 25;
79979     var testQuery = params.query || "";
79980     var testUrl = url;
79981     do {
79982       var hit = _taginfoCache[testUrl];
79983       if (hit && (url === testUrl || hit.length < rp)) {
79984         callback(null, hit);
79985         return true;
79986       }
79987       if (exactMatch || !testQuery.length) return false;
79988       testQuery = testQuery.slice(0, -1);
79989       testUrl = url.replace(/&query=(.*?)&/, "&query=" + testQuery + "&");
79990     } while (testQuery.length >= 0);
79991     return false;
79992   }
79993   var taginfo_default = {
79994     init: function() {
79995       _inflight3 = {};
79996       _taginfoCache = {};
79997       _popularKeys = {
79998         // manually exclude some keys – #5377, #7485
79999         postal_code: true,
80000         full_name: true,
80001         loc_name: true,
80002         reg_name: true,
80003         short_name: true,
80004         sorting_name: true,
80005         artist_name: true,
80006         nat_name: true,
80007         long_name: true,
80008         via: true,
80009         "bridge:name": true
80010       };
80011       var params = {
80012         rp: 100,
80013         sortname: "values_all",
80014         sortorder: "desc",
80015         page: 1,
80016         debounce: false,
80017         lang: _mainLocalizer.languageCode()
80018       };
80019       this.keys(params, function(err, data) {
80020         if (err) return;
80021         data.forEach(function(d2) {
80022           if (d2.value === "opening_hours") return;
80023           _popularKeys[d2.value] = true;
80024         });
80025       });
80026     },
80027     reset: function() {
80028       Object.values(_inflight3).forEach(function(controller) {
80029         controller.abort();
80030       });
80031       _inflight3 = {};
80032     },
80033     keys: function(params, callback) {
80034       var doRequest = params.debounce ? debouncedRequest2 : request2;
80035       params = clean(setSort(params));
80036       params = Object.assign({
80037         rp: 10,
80038         sortname: "count_all",
80039         sortorder: "desc",
80040         page: 1,
80041         lang: _mainLocalizer.languageCode()
80042       }, params);
80043       var url = apibase4 + "keys/all?" + utilQsString(params);
80044       doRequest(url, params, false, callback, function(err, d2) {
80045         if (err) {
80046           callback(err);
80047         } else {
80048           var f2 = filterKeys(params.filter);
80049           var result = d2.data.filter(f2).sort(sortKeys).map(valKey);
80050           _taginfoCache[url] = result;
80051           callback(null, result);
80052         }
80053       });
80054     },
80055     multikeys: function(params, callback) {
80056       var doRequest = params.debounce ? debouncedRequest2 : request2;
80057       params = clean(setSort(params));
80058       params = Object.assign({
80059         rp: 25,
80060         sortname: "count_all",
80061         sortorder: "desc",
80062         page: 1,
80063         lang: _mainLocalizer.languageCode()
80064       }, params);
80065       var prefix = params.query;
80066       var url = apibase4 + "keys/all?" + utilQsString(params);
80067       doRequest(url, params, true, callback, function(err, d2) {
80068         if (err) {
80069           callback(err);
80070         } else {
80071           var f2 = filterMultikeys(prefix);
80072           var result = d2.data.filter(f2).map(valKey);
80073           _taginfoCache[url] = result;
80074           callback(null, result);
80075         }
80076       });
80077     },
80078     values: function(params, callback) {
80079       var key = params.key;
80080       if (key && _popularKeys[key]) {
80081         callback(null, []);
80082         return;
80083       }
80084       var doRequest = params.debounce ? debouncedRequest2 : request2;
80085       params = clean(setSort(setFilter(params)));
80086       params = Object.assign({
80087         rp: 25,
80088         sortname: "count_all",
80089         sortorder: "desc",
80090         page: 1,
80091         lang: _mainLocalizer.languageCode()
80092       }, params);
80093       var url = apibase4 + "key/values?" + utilQsString(params);
80094       doRequest(url, params, false, callback, function(err, d2) {
80095         if (err) {
80096           callback(err);
80097         } else {
80098           var allowUpperCase = allowUpperCaseTagValues.test(params.key);
80099           var f2 = filterValues(allowUpperCase);
80100           var result = d2.data.filter(f2).map(valKeyDescription);
80101           _taginfoCache[url] = result;
80102           callback(null, result);
80103         }
80104       });
80105     },
80106     roles: function(params, callback) {
80107       var doRequest = params.debounce ? debouncedRequest2 : request2;
80108       var geometry = params.geometry;
80109       params = clean(setSortMembers(params));
80110       params = Object.assign({
80111         rp: 25,
80112         sortname: "count_all_members",
80113         sortorder: "desc",
80114         page: 1,
80115         lang: _mainLocalizer.languageCode()
80116       }, params);
80117       var url = apibase4 + "relation/roles?" + utilQsString(params);
80118       doRequest(url, params, true, callback, function(err, d2) {
80119         if (err) {
80120           callback(err);
80121         } else {
80122           var f2 = filterRoles(geometry);
80123           var result = d2.data.filter(f2).map(roleKey);
80124           _taginfoCache[url] = result;
80125           callback(null, result);
80126         }
80127       });
80128     },
80129     docs: function(params, callback) {
80130       var doRequest = params.debounce ? debouncedRequest2 : request2;
80131       params = clean(setSort(params));
80132       var path = "key/wiki_pages?";
80133       if (params.value) {
80134         path = "tag/wiki_pages?";
80135       } else if (params.rtype) {
80136         path = "relation/wiki_pages?";
80137       }
80138       var url = apibase4 + path + utilQsString(params);
80139       doRequest(url, params, true, callback, function(err, d2) {
80140         if (err) {
80141           callback(err);
80142         } else {
80143           _taginfoCache[url] = d2.data;
80144           callback(null, d2.data);
80145         }
80146       });
80147     },
80148     apibase: function(_2) {
80149       if (!arguments.length) return apibase4;
80150       apibase4 = _2;
80151       return this;
80152     }
80153   };
80154
80155   // modules/services/vector_tile.js
80156   var import_fast_deep_equal11 = __toESM(require_fast_deep_equal());
80157   var import_fast_json_stable_stringify2 = __toESM(require_fast_json_stable_stringify());
80158   var import_polygon_clipping = __toESM(require_polygon_clipping_umd());
80159   var tiler7 = utilTiler().tileSize(512).margin(1);
80160   var dispatch11 = dispatch_default("loadedData");
80161   var _vtCache;
80162   function abortRequest6(controller) {
80163     controller.abort();
80164   }
80165   function vtToGeoJSON(data, tile, mergeCache) {
80166     var vectorTile = new VectorTile(new Pbf(data));
80167     var layers = Object.keys(vectorTile.layers);
80168     if (!Array.isArray(layers)) {
80169       layers = [layers];
80170     }
80171     var features = [];
80172     layers.forEach(function(layerID) {
80173       var layer = vectorTile.layers[layerID];
80174       if (layer) {
80175         for (var i3 = 0; i3 < layer.length; i3++) {
80176           var feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
80177           var geometry = feature3.geometry;
80178           if (geometry.type === "Polygon") {
80179             geometry.type = "MultiPolygon";
80180             geometry.coordinates = [geometry.coordinates];
80181           }
80182           var isClipped = false;
80183           if (geometry.type === "MultiPolygon") {
80184             var featureClip = turf_bbox_clip_default(feature3, tile.extent.rectangle());
80185             if (!(0, import_fast_deep_equal11.default)(feature3.geometry, featureClip.geometry)) {
80186               isClipped = true;
80187             }
80188             if (!feature3.geometry.coordinates.length) continue;
80189             if (!feature3.geometry.coordinates[0].length) continue;
80190           }
80191           var featurehash = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3));
80192           var propertyhash = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3.properties || {}));
80193           feature3.__layerID__ = layerID.replace(/[^_a-zA-Z0-9\-]/g, "_");
80194           feature3.__featurehash__ = featurehash;
80195           feature3.__propertyhash__ = propertyhash;
80196           features.push(feature3);
80197           if (isClipped && geometry.type === "MultiPolygon") {
80198             var merged = mergeCache[propertyhash];
80199             if (merged && merged.length) {
80200               var other = merged[0];
80201               var coords = import_polygon_clipping.default.union(
80202                 feature3.geometry.coordinates,
80203                 other.geometry.coordinates
80204               );
80205               if (!coords || !coords.length) {
80206                 continue;
80207               }
80208               merged.push(feature3);
80209               for (var j2 = 0; j2 < merged.length; j2++) {
80210                 merged[j2].geometry.coordinates = coords;
80211                 merged[j2].__featurehash__ = featurehash;
80212               }
80213             } else {
80214               mergeCache[propertyhash] = [feature3];
80215             }
80216           }
80217         }
80218       }
80219     });
80220     return features;
80221   }
80222   function loadTile3(source, tile) {
80223     if (source.loaded[tile.id] || source.inflight[tile.id]) return;
80224     var url = source.template.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace(/\{[t-]y\}/, Math.pow(2, tile.xyz[2]) - tile.xyz[1] - 1).replace(/\{z(oom)?\}/, tile.xyz[2]).replace(/\{switch:([^}]+)\}/, function(s2, r2) {
80225       var subdomains = r2.split(",");
80226       return subdomains[(tile.xyz[0] + tile.xyz[1]) % subdomains.length];
80227     });
80228     var controller = new AbortController();
80229     source.inflight[tile.id] = controller;
80230     fetch(url, { signal: controller.signal }).then(function(response) {
80231       if (!response.ok) {
80232         throw new Error(response.status + " " + response.statusText);
80233       }
80234       source.loaded[tile.id] = [];
80235       delete source.inflight[tile.id];
80236       return response.arrayBuffer();
80237     }).then(function(data) {
80238       if (!data) {
80239         throw new Error("No Data");
80240       }
80241       var z2 = tile.xyz[2];
80242       if (!source.canMerge[z2]) {
80243         source.canMerge[z2] = {};
80244       }
80245       source.loaded[tile.id] = vtToGeoJSON(data, tile, source.canMerge[z2]);
80246       dispatch11.call("loadedData");
80247     }).catch(function() {
80248       source.loaded[tile.id] = [];
80249       delete source.inflight[tile.id];
80250     });
80251   }
80252   var vector_tile_default = {
80253     init: function() {
80254       if (!_vtCache) {
80255         this.reset();
80256       }
80257       this.event = utilRebind(this, dispatch11, "on");
80258     },
80259     reset: function() {
80260       for (var sourceID in _vtCache) {
80261         var source = _vtCache[sourceID];
80262         if (source && source.inflight) {
80263           Object.values(source.inflight).forEach(abortRequest6);
80264         }
80265       }
80266       _vtCache = {};
80267     },
80268     addSource: function(sourceID, template) {
80269       _vtCache[sourceID] = { template, inflight: {}, loaded: {}, canMerge: {} };
80270       return _vtCache[sourceID];
80271     },
80272     data: function(sourceID, projection2) {
80273       var source = _vtCache[sourceID];
80274       if (!source) return [];
80275       var tiles = tiler7.getTiles(projection2);
80276       var seen = {};
80277       var results = [];
80278       for (var i3 = 0; i3 < tiles.length; i3++) {
80279         var features = source.loaded[tiles[i3].id];
80280         if (!features || !features.length) continue;
80281         for (var j2 = 0; j2 < features.length; j2++) {
80282           var feature3 = features[j2];
80283           var hash = feature3.__featurehash__;
80284           if (seen[hash]) continue;
80285           seen[hash] = true;
80286           results.push(Object.assign({}, feature3));
80287         }
80288       }
80289       return results;
80290     },
80291     loadTiles: function(sourceID, template, projection2) {
80292       var source = _vtCache[sourceID];
80293       if (!source) {
80294         source = this.addSource(sourceID, template);
80295       }
80296       var tiles = tiler7.getTiles(projection2);
80297       Object.keys(source.inflight).forEach(function(k2) {
80298         var wanted = tiles.find(function(tile) {
80299           return k2 === tile.id;
80300         });
80301         if (!wanted) {
80302           abortRequest6(source.inflight[k2]);
80303           delete source.inflight[k2];
80304         }
80305       });
80306       tiles.forEach(function(tile) {
80307         loadTile3(source, tile);
80308       });
80309     },
80310     cache: function() {
80311       return _vtCache;
80312     }
80313   };
80314
80315   // modules/services/wikidata.js
80316   var apibase5 = "https://www.wikidata.org/w/api.php?";
80317   var _wikidataCache = {};
80318   var wikidata_default = {
80319     init: function() {
80320     },
80321     reset: function() {
80322       _wikidataCache = {};
80323     },
80324     // Search for Wikidata items matching the query
80325     itemsForSearchQuery: function(query, callback, language) {
80326       if (!query) {
80327         if (callback) callback("No query", {});
80328         return;
80329       }
80330       var lang = this.languagesToQuery()[0];
80331       var url = apibase5 + utilQsString({
80332         action: "wbsearchentities",
80333         format: "json",
80334         formatversion: 2,
80335         search: query,
80336         type: "item",
80337         // the language to search
80338         language: language || lang,
80339         // the language for the label and description in the result
80340         uselang: lang,
80341         limit: 10,
80342         origin: "*"
80343       });
80344       json_default(url).then((result) => {
80345         if (result && result.error) {
80346           if (result.error.code === "badvalue" && result.error.info.includes(lang) && !language && lang.includes("-")) {
80347             this.itemsForSearchQuery(query, callback, lang.split("-")[0]);
80348             return;
80349           } else {
80350             throw new Error(result.error);
80351           }
80352         }
80353         if (callback) callback(null, result.search || {});
80354       }).catch(function(err) {
80355         if (callback) callback(err.message, {});
80356       });
80357     },
80358     // Given a Wikipedia language and article title,
80359     // return an array of corresponding Wikidata entities.
80360     itemsByTitle: function(lang, title, callback) {
80361       if (!title) {
80362         if (callback) callback("No title", {});
80363         return;
80364       }
80365       lang = lang || "en";
80366       var url = apibase5 + utilQsString({
80367         action: "wbgetentities",
80368         format: "json",
80369         formatversion: 2,
80370         sites: lang.replace(/-/g, "_") + "wiki",
80371         titles: title,
80372         languages: "en",
80373         // shrink response by filtering to one language
80374         origin: "*"
80375       });
80376       json_default(url).then(function(result) {
80377         if (result && result.error) {
80378           throw new Error(result.error);
80379         }
80380         if (callback) callback(null, result.entities || {});
80381       }).catch(function(err) {
80382         if (callback) callback(err.message, {});
80383       });
80384     },
80385     languagesToQuery: function() {
80386       return _mainLocalizer.localeCodes().map(function(code) {
80387         return code.toLowerCase();
80388       }).filter(function(code) {
80389         return code !== "en-us";
80390       });
80391     },
80392     entityByQID: function(qid, callback) {
80393       if (!qid) {
80394         callback("No qid", {});
80395         return;
80396       }
80397       if (_wikidataCache[qid]) {
80398         if (callback) callback(null, _wikidataCache[qid]);
80399         return;
80400       }
80401       var langs = this.languagesToQuery();
80402       var url = apibase5 + utilQsString({
80403         action: "wbgetentities",
80404         format: "json",
80405         formatversion: 2,
80406         ids: qid,
80407         props: "labels|descriptions|claims|sitelinks",
80408         sitefilter: langs.map(function(d2) {
80409           return d2 + "wiki";
80410         }).join("|"),
80411         languages: langs.join("|"),
80412         languagefallback: 1,
80413         origin: "*"
80414       });
80415       json_default(url).then(function(result) {
80416         if (result && result.error) {
80417           throw new Error(result.error);
80418         }
80419         if (callback) callback(null, result.entities[qid] || {});
80420       }).catch(function(err) {
80421         if (callback) callback(err.message, {});
80422       });
80423     },
80424     // Pass `params` object of the form:
80425     // {
80426     //   qid: 'string'      // brand wikidata  (e.g. 'Q37158')
80427     // }
80428     //
80429     // Get an result object used to display tag documentation
80430     // {
80431     //   title:        'string',
80432     //   description:  'string',
80433     //   editURL:      'string',
80434     //   imageURL:     'string',
80435     //   wiki:         { title: 'string', text: 'string', url: 'string' }
80436     // }
80437     //
80438     getDocs: function(params, callback) {
80439       var langs = this.languagesToQuery();
80440       this.entityByQID(params.qid, function(err, entity) {
80441         if (err || !entity) {
80442           callback(err || "No entity");
80443           return;
80444         }
80445         var i3;
80446         var description;
80447         for (i3 in langs) {
80448           let code = langs[i3];
80449           if (entity.descriptions[code] && entity.descriptions[code].language === code) {
80450             description = entity.descriptions[code];
80451             break;
80452           }
80453         }
80454         if (!description && Object.values(entity.descriptions).length) description = Object.values(entity.descriptions)[0];
80455         var result = {
80456           title: entity.id,
80457           description: description ? description.value : "",
80458           descriptionLocaleCode: description ? description.language : "",
80459           editURL: "https://www.wikidata.org/wiki/" + entity.id
80460         };
80461         if (entity.claims) {
80462           var imageroot = "https://commons.wikimedia.org/w/index.php";
80463           var props = ["P154", "P18"];
80464           var prop, image;
80465           for (i3 = 0; i3 < props.length; i3++) {
80466             prop = entity.claims[props[i3]];
80467             if (prop && Object.keys(prop).length > 0) {
80468               image = prop[Object.keys(prop)[0]].mainsnak.datavalue.value;
80469               if (image) {
80470                 result.imageURL = imageroot + "?" + utilQsString({
80471                   title: "Special:Redirect/file/" + image,
80472                   width: 400
80473                 });
80474                 break;
80475               }
80476             }
80477           }
80478         }
80479         if (entity.sitelinks) {
80480           var englishLocale = _mainLocalizer.languageCode().toLowerCase() === "en";
80481           for (i3 = 0; i3 < langs.length; i3++) {
80482             var w2 = langs[i3] + "wiki";
80483             if (entity.sitelinks[w2]) {
80484               var title = entity.sitelinks[w2].title;
80485               var tKey = "inspector.wiki_reference";
80486               if (!englishLocale && langs[i3] === "en") {
80487                 tKey = "inspector.wiki_en_reference";
80488               }
80489               result.wiki = {
80490                 title,
80491                 text: tKey,
80492                 url: "https://" + langs[i3] + ".wikipedia.org/wiki/" + title.replace(/ /g, "_")
80493               };
80494               break;
80495             }
80496           }
80497         }
80498         callback(null, result);
80499       });
80500     }
80501   };
80502
80503   // modules/services/wikipedia.js
80504   var endpoint = "https://en.wikipedia.org/w/api.php?";
80505   var wikipedia_default = {
80506     init: function() {
80507     },
80508     reset: function() {
80509     },
80510     search: function(lang, query, callback) {
80511       if (!query) {
80512         if (callback) callback("No Query", []);
80513         return;
80514       }
80515       lang = lang || "en";
80516       var url = endpoint.replace("en", lang) + utilQsString({
80517         action: "query",
80518         list: "search",
80519         srlimit: "10",
80520         srinfo: "suggestion",
80521         format: "json",
80522         origin: "*",
80523         srsearch: query
80524       });
80525       json_default(url).then(function(result) {
80526         if (result && result.error) {
80527           throw new Error(result.error);
80528         } else if (!result || !result.query || !result.query.search) {
80529           throw new Error("No Results");
80530         }
80531         if (callback) {
80532           var titles = result.query.search.map(function(d2) {
80533             return d2.title;
80534           });
80535           callback(null, titles);
80536         }
80537       }).catch(function(err) {
80538         if (callback) callback(err, []);
80539       });
80540     },
80541     suggestions: function(lang, query, callback) {
80542       if (!query) {
80543         if (callback) callback("", []);
80544         return;
80545       }
80546       lang = lang || "en";
80547       var url = endpoint.replace("en", lang) + utilQsString({
80548         action: "opensearch",
80549         namespace: 0,
80550         suggest: "",
80551         format: "json",
80552         origin: "*",
80553         search: query
80554       });
80555       json_default(url).then(function(result) {
80556         if (result && result.error) {
80557           throw new Error(result.error);
80558         } else if (!result || result.length < 2) {
80559           throw new Error("No Results");
80560         }
80561         if (callback) callback(null, result[1] || []);
80562       }).catch(function(err) {
80563         if (callback) callback(err.message, []);
80564       });
80565     },
80566     translations: function(lang, title, callback) {
80567       if (!title) {
80568         if (callback) callback("No Title");
80569         return;
80570       }
80571       var url = endpoint.replace("en", lang) + utilQsString({
80572         action: "query",
80573         prop: "langlinks",
80574         format: "json",
80575         origin: "*",
80576         lllimit: 500,
80577         titles: title
80578       });
80579       json_default(url).then(function(result) {
80580         if (result && result.error) {
80581           throw new Error(result.error);
80582         } else if (!result || !result.query || !result.query.pages) {
80583           throw new Error("No Results");
80584         }
80585         if (callback) {
80586           var list2 = result.query.pages[Object.keys(result.query.pages)[0]];
80587           var translations = {};
80588           if (list2 && list2.langlinks) {
80589             list2.langlinks.forEach(function(d2) {
80590               translations[d2.lang] = d2["*"];
80591             });
80592           }
80593           callback(null, translations);
80594         }
80595       }).catch(function(err) {
80596         if (callback) callback(err.message);
80597       });
80598     }
80599   };
80600
80601   // modules/services/mapilio.js
80602   var apiUrl2 = "https://end.mapilio.com";
80603   var imageBaseUrl = "https://cdn.mapilio.com/im";
80604   var baseTileUrl2 = "https://geo.mapilio.com/geoserver/gwc/service/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&LAYER=mapilio:";
80605   var pointLayer = "map_points";
80606   var lineLayer = "map_roads_line";
80607   var tileStyle = "&STYLE=&TILEMATRIX=EPSG:900913:{z}&TILEMATRIXSET=EPSG:900913&FORMAT=application/vnd.mapbox-vector-tile&TILECOL={x}&TILEROW={y}";
80608   var minZoom3 = 14;
80609   var dispatch12 = dispatch_default("loadedImages", "loadedLines");
80610   var imgZoom3 = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
80611   var pannellumViewerCSS3 = "pannellum/pannellum.css";
80612   var pannellumViewerJS3 = "pannellum/pannellum.js";
80613   var resolution = 1080;
80614   var _activeImage;
80615   var _cache3;
80616   var _loadViewerPromise5;
80617   var _pannellumViewer3;
80618   var _sceneOptions2 = {
80619     showFullscreenCtrl: false,
80620     autoLoad: true,
80621     yaw: 0,
80622     minHfov: 10,
80623     maxHfov: 90,
80624     hfov: 60
80625   };
80626   var _currScene2 = 0;
80627   function partitionViewport5(projection2) {
80628     const z2 = geoScaleToZoom(projection2.scale());
80629     const z22 = Math.ceil(z2 * 2) / 2 + 2.5;
80630     const tiler8 = utilTiler().zoomExtent([z22, z22]);
80631     return tiler8.getTiles(projection2).map(function(tile) {
80632       return tile.extent;
80633     });
80634   }
80635   function searchLimited5(limit, projection2, rtree) {
80636     limit = limit || 5;
80637     return partitionViewport5(projection2).reduce(function(result, extent) {
80638       const found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
80639         return d2.data;
80640       });
80641       return found.length ? result.concat(found) : result;
80642     }, []);
80643   }
80644   function loadTiles4(which, url, maxZoom2, projection2) {
80645     const tiler8 = utilTiler().zoomExtent([minZoom3, maxZoom2]).skipNullIsland(true);
80646     const tiles = tiler8.getTiles(projection2);
80647     tiles.forEach(function(tile) {
80648       loadTile4(which, url, tile);
80649     });
80650   }
80651   function loadTile4(which, url, tile) {
80652     const cache = _cache3.requests;
80653     const tileId = "".concat(tile.id, "-").concat(which);
80654     if (cache.loaded[tileId] || cache.inflight[tileId]) return;
80655     const controller = new AbortController();
80656     cache.inflight[tileId] = controller;
80657     const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
80658     fetch(requestUrl, { signal: controller.signal }).then(function(response) {
80659       if (!response.ok) {
80660         throw new Error(response.status + " " + response.statusText);
80661       }
80662       cache.loaded[tileId] = true;
80663       delete cache.inflight[tileId];
80664       return response.arrayBuffer();
80665     }).then(function(data) {
80666       if (data.byteLength === 0) {
80667         throw new Error("No Data");
80668       }
80669       loadTileDataToCache2(data, tile, which);
80670       if (which === "images") {
80671         dispatch12.call("loadedImages");
80672       } else {
80673         dispatch12.call("loadedLines");
80674       }
80675     }).catch(function(e3) {
80676       if (e3.message === "No Data") {
80677         cache.loaded[tileId] = true;
80678       } else {
80679         console.error(e3);
80680       }
80681     });
80682   }
80683   function loadTileDataToCache2(data, tile) {
80684     const vectorTile = new VectorTile(new Pbf(data));
80685     let features, cache, layer, i3, feature3, loc, d2;
80686     if (vectorTile.layers.hasOwnProperty(pointLayer)) {
80687       features = [];
80688       cache = _cache3.images;
80689       layer = vectorTile.layers[pointLayer];
80690       for (i3 = 0; i3 < layer.length; i3++) {
80691         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
80692         loc = feature3.geometry.coordinates;
80693         let resolutionArr = feature3.properties.resolution.split("x");
80694         let sourceWidth = Math.max(resolutionArr[0], resolutionArr[1]);
80695         let sourceHeight = Math.min(resolutionArr[0], resolutionArr[1]);
80696         let isPano = sourceWidth % sourceHeight === 0;
80697         d2 = {
80698           loc,
80699           capture_time: feature3.properties.capture_time,
80700           id: feature3.properties.id,
80701           sequence_id: feature3.properties.sequence_uuid,
80702           heading: feature3.properties.heading,
80703           resolution: feature3.properties.resolution,
80704           isPano
80705         };
80706         cache.forImageId[d2.id] = d2;
80707         features.push({
80708           minX: loc[0],
80709           minY: loc[1],
80710           maxX: loc[0],
80711           maxY: loc[1],
80712           data: d2
80713         });
80714       }
80715       if (cache.rtree) {
80716         cache.rtree.load(features);
80717       }
80718     }
80719     if (vectorTile.layers.hasOwnProperty(lineLayer)) {
80720       cache = _cache3.sequences;
80721       layer = vectorTile.layers[lineLayer];
80722       for (i3 = 0; i3 < layer.length; i3++) {
80723         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
80724         if (cache.lineString[feature3.properties.sequence_uuid]) {
80725           cache.lineString[feature3.properties.sequence_uuid].push(feature3);
80726         } else {
80727           cache.lineString[feature3.properties.sequence_uuid] = [feature3];
80728         }
80729       }
80730     }
80731   }
80732   function getImageData(imageId, sequenceId) {
80733     return fetch(apiUrl2 + "/api/sequence-detail?sequence_uuid=".concat(sequenceId), { method: "GET" }).then(function(response) {
80734       if (!response.ok) {
80735         throw new Error(response.status + " " + response.statusText);
80736       }
80737       return response.json();
80738     }).then(function(data) {
80739       let index = data.data.findIndex((feature3) => feature3.id === imageId);
80740       const { filename, uploaded_hash } = data.data[index];
80741       _sceneOptions2.panorama = imageBaseUrl + "/" + uploaded_hash + "/" + filename + "/" + resolution;
80742     });
80743   }
80744   var mapilio_default = {
80745     // Initialize Mapilio
80746     init: function() {
80747       if (!_cache3) {
80748         this.reset();
80749       }
80750       this.event = utilRebind(this, dispatch12, "on");
80751     },
80752     // Reset cache and state
80753     reset: function() {
80754       if (_cache3) {
80755         Object.values(_cache3.requests.inflight).forEach(function(request3) {
80756           request3.abort();
80757         });
80758       }
80759       _cache3 = {
80760         images: { rtree: new RBush(), forImageId: {} },
80761         sequences: { rtree: new RBush(), lineString: {} },
80762         requests: { loaded: {}, inflight: {} }
80763       };
80764       _activeImage = null;
80765     },
80766     // Get visible images
80767     images: function(projection2) {
80768       const limit = 5;
80769       return searchLimited5(limit, projection2, _cache3.images.rtree);
80770     },
80771     cachedImage: function(imageKey) {
80772       return _cache3.images.forImageId[imageKey];
80773     },
80774     // Load images in the visible area
80775     loadImages: function(projection2) {
80776       let url = baseTileUrl2 + pointLayer + tileStyle;
80777       loadTiles4("images", url, 14, projection2);
80778     },
80779     // Load line in the visible area
80780     loadLines: function(projection2) {
80781       let url = baseTileUrl2 + lineLayer + tileStyle;
80782       loadTiles4("line", url, 14, projection2);
80783     },
80784     // Get visible sequences
80785     sequences: function(projection2) {
80786       const viewport = projection2.clipExtent();
80787       const min3 = [viewport[0][0], viewport[1][1]];
80788       const max3 = [viewport[1][0], viewport[0][1]];
80789       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
80790       const sequenceIds = {};
80791       let lineStrings = [];
80792       _cache3.images.rtree.search(bbox2).forEach(function(d2) {
80793         if (d2.data.sequence_id) {
80794           sequenceIds[d2.data.sequence_id] = true;
80795         }
80796       });
80797       Object.keys(sequenceIds).forEach(function(sequenceId) {
80798         if (_cache3.sequences.lineString[sequenceId]) {
80799           lineStrings = lineStrings.concat(_cache3.sequences.lineString[sequenceId]);
80800         }
80801       });
80802       return lineStrings;
80803     },
80804     // Set the currently visible image
80805     setActiveImage: function(image) {
80806       if (image) {
80807         _activeImage = {
80808           id: image.id,
80809           sequence_id: image.sequence_id
80810         };
80811       } else {
80812         _activeImage = null;
80813       }
80814     },
80815     // Update the currently highlighted sequence and selected bubble.
80816     setStyles: function(context, hovered) {
80817       const hoveredImageId = hovered && hovered.id;
80818       const hoveredSequenceId = hovered && hovered.sequence_id;
80819       const selectedSequenceId = _activeImage && _activeImage.sequence_id;
80820       const selectedImageId = _activeImage && _activeImage.id;
80821       const markers = context.container().selectAll(".layer-mapilio .viewfield-group");
80822       const sequences = context.container().selectAll(".layer-mapilio .sequence");
80823       markers.classed("highlighted", function(d2) {
80824         return d2.id === hoveredImageId;
80825       }).classed("hovered", function(d2) {
80826         return d2.id === hoveredImageId;
80827       }).classed("currentView", function(d2) {
80828         return d2.id === selectedImageId;
80829       });
80830       sequences.classed("highlighted", function(d2) {
80831         return d2.properties.sequence_uuid === hoveredSequenceId;
80832       }).classed("currentView", function(d2) {
80833         return d2.properties.sequence_uuid === selectedSequenceId;
80834       });
80835       return this;
80836     },
80837     updateUrlImage: function(imageKey) {
80838       if (!window.mocha) {
80839         var hash = utilStringQs(window.location.hash);
80840         if (imageKey) {
80841           hash.photo = "mapilio/" + imageKey;
80842         } else {
80843           delete hash.photo;
80844         }
80845         window.location.replace("#" + utilQsString(hash, true));
80846       }
80847     },
80848     initViewer: function() {
80849       if (!window.pannellum) return;
80850       if (_pannellumViewer3) return;
80851       _currScene2 += 1;
80852       const sceneID = _currScene2.toString();
80853       const options2 = {
80854         "default": { firstScene: sceneID },
80855         scenes: {}
80856       };
80857       options2.scenes[sceneID] = _sceneOptions2;
80858       _pannellumViewer3 = window.pannellum.viewer("ideditor-viewer-mapilio-pnlm", options2);
80859     },
80860     selectImage: function(context, id2) {
80861       let that = this;
80862       let d2 = this.cachedImage(id2);
80863       this.setActiveImage(d2);
80864       this.updateUrlImage(d2.id);
80865       let viewer = context.container().select(".photoviewer");
80866       if (!viewer.empty()) viewer.datum(d2);
80867       this.setStyles(context, null);
80868       if (!d2) return this;
80869       let wrap2 = context.container().select(".photoviewer .mapilio-wrapper");
80870       let attribution = wrap2.selectAll(".photo-attribution").text("");
80871       if (d2.capture_time) {
80872         attribution.append("span").attr("class", "captured_at").text(localeDateString2(d2.capture_time));
80873         attribution.append("span").text("|");
80874       }
80875       attribution.append("a").attr("class", "image-link").attr("target", "_blank").attr("href", "https://mapilio.com/app?lat=".concat(d2.loc[1], "&lng=").concat(d2.loc[0], "&zoom=17&pId=").concat(d2.id)).text("mapilio.com");
80876       wrap2.transition().duration(100).call(imgZoom3.transform, identity2);
80877       wrap2.selectAll("img").remove();
80878       wrap2.selectAll("button.back").classed("hide", !_cache3.images.forImageId.hasOwnProperty(+id2 - 1));
80879       wrap2.selectAll("button.forward").classed("hide", !_cache3.images.forImageId.hasOwnProperty(+id2 + 1));
80880       getImageData(d2.id, d2.sequence_id).then(function() {
80881         if (d2.isPano) {
80882           if (!_pannellumViewer3) {
80883             that.initViewer();
80884           } else {
80885             _currScene2 += 1;
80886             let sceneID = _currScene2.toString();
80887             _pannellumViewer3.addScene(sceneID, _sceneOptions2).loadScene(sceneID);
80888             if (_currScene2 > 2) {
80889               sceneID = (_currScene2 - 1).toString();
80890               _pannellumViewer3.removeScene(sceneID);
80891             }
80892           }
80893         } else {
80894           that.initOnlyPhoto(context);
80895         }
80896       });
80897       function localeDateString2(s2) {
80898         if (!s2) return null;
80899         var options2 = { day: "numeric", month: "short", year: "numeric" };
80900         var d4 = new Date(s2);
80901         if (isNaN(d4.getTime())) return null;
80902         return d4.toLocaleDateString(_mainLocalizer.localeCode(), options2);
80903       }
80904       return this;
80905     },
80906     initOnlyPhoto: function(context) {
80907       if (_pannellumViewer3) {
80908         _pannellumViewer3.destroy();
80909         _pannellumViewer3 = null;
80910       }
80911       let wrap2 = context.container().select("#ideditor-viewer-mapilio-simple");
80912       let imgWrap = wrap2.select("img");
80913       if (!imgWrap.empty()) {
80914         imgWrap.attr("src", _sceneOptions2.panorama);
80915       } else {
80916         wrap2.append("img").attr("src", _sceneOptions2.panorama);
80917       }
80918     },
80919     ensureViewerLoaded: function(context) {
80920       let that = this;
80921       let imgWrap = context.container().select("#ideditor-viewer-mapilio-simple > img");
80922       if (!imgWrap.empty()) {
80923         imgWrap.remove();
80924       }
80925       if (_loadViewerPromise5) return _loadViewerPromise5;
80926       let wrap2 = context.container().select(".photoviewer").selectAll(".mapilio-wrapper").data([0]);
80927       let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper mapilio-wrapper").classed("hide", true).on("dblclick.zoom", null);
80928       wrapEnter.append("div").attr("class", "photo-attribution fillD");
80929       const controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls-mapilio");
80930       controlsEnter.append("button").classed("back", true).on("click.back", step(-1)).text("\u25C4");
80931       controlsEnter.append("button").classed("forward", true).on("click.forward", step(1)).text("\u25BA");
80932       wrapEnter.append("div").attr("id", "ideditor-viewer-mapilio-pnlm");
80933       wrapEnter.append("div").attr("id", "ideditor-viewer-mapilio-simple-wrap").call(imgZoom3.on("zoom", zoomPan2)).append("div").attr("id", "ideditor-viewer-mapilio-simple");
80934       context.ui().photoviewer.on("resize.mapilio", () => {
80935         if (_pannellumViewer3) {
80936           _pannellumViewer3.resize();
80937         }
80938       });
80939       _loadViewerPromise5 = new Promise((resolve, reject) => {
80940         let loadedCount = 0;
80941         function loaded() {
80942           loadedCount += 1;
80943           if (loadedCount === 2) resolve();
80944         }
80945         const head = select_default2("head");
80946         head.selectAll("#ideditor-mapilio-viewercss").data([0]).enter().append("link").attr("id", "ideditor-mapilio-viewercss").attr("rel", "stylesheet").attr("crossorigin", "anonymous").attr("href", context.asset(pannellumViewerCSS3)).on("load.serviceMapilio", loaded).on("error.serviceMapilio", function() {
80947           reject();
80948         });
80949         head.selectAll("#ideditor-mapilio-viewerjs").data([0]).enter().append("script").attr("id", "ideditor-mapilio-viewerjs").attr("crossorigin", "anonymous").attr("src", context.asset(pannellumViewerJS3)).on("load.serviceMapilio", loaded).on("error.serviceMapilio", function() {
80950           reject();
80951         });
80952       }).catch(function() {
80953         _loadViewerPromise5 = null;
80954       });
80955       function step(stepBy) {
80956         return function() {
80957           if (!_activeImage) return;
80958           const imageId = _activeImage.id;
80959           const nextIndex = imageId + stepBy;
80960           if (!nextIndex) return;
80961           const nextImage = _cache3.images.forImageId[nextIndex];
80962           context.map().centerEase(nextImage.loc);
80963           that.selectImage(context, nextImage.id);
80964         };
80965       }
80966       function zoomPan2(d3_event) {
80967         var t2 = d3_event.transform;
80968         context.container().select(".photoviewer #ideditor-viewer-mapilio-simple").call(utilSetTransform, t2.x, t2.y, t2.k);
80969       }
80970       return _loadViewerPromise5;
80971     },
80972     showViewer: function(context) {
80973       let wrap2 = context.container().select(".photoviewer").classed("hide", false);
80974       let isHidden = wrap2.selectAll(".photo-wrapper.mapilio-wrapper.hide").size();
80975       if (isHidden) {
80976         wrap2.selectAll(".photo-wrapper:not(.mapilio-wrapper)").classed("hide", true);
80977         wrap2.selectAll(".photo-wrapper.mapilio-wrapper").classed("hide", false);
80978       }
80979       return this;
80980     },
80981     /**
80982      * hideViewer()
80983      */
80984     hideViewer: function(context) {
80985       let viewer = context.container().select(".photoviewer");
80986       if (!viewer.empty()) viewer.datum(null);
80987       this.updateUrlImage(null);
80988       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
80989       context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
80990       this.setActiveImage();
80991       return this.setStyles(context, null);
80992     },
80993     // Return the current cache
80994     cache: function() {
80995       return _cache3;
80996     }
80997   };
80998
80999   // modules/services/panoramax.js
81000   var apiUrl3 = "https://api.panoramax.xyz/";
81001   var tileUrl2 = apiUrl3 + "api/map/{z}/{x}/{y}.mvt";
81002   var imageDataUrl = apiUrl3 + "api/collections/{collectionId}/items/{itemId}";
81003   var userIdUrl = apiUrl3 + "api/users/search?q={username}";
81004   var usernameURL = apiUrl3 + "api/users/{userId}";
81005   var viewerUrl = apiUrl3;
81006   var highDefinition = "hd";
81007   var standardDefinition = "sd";
81008   var pictureLayer = "pictures";
81009   var sequenceLayer = "sequences";
81010   var minZoom4 = 10;
81011   var imageMinZoom = 15;
81012   var lineMinZoom = 10;
81013   var dispatch13 = dispatch_default("loadedImages", "loadedLines", "viewerChanged");
81014   var _cache4;
81015   var _loadViewerPromise6;
81016   var _definition = standardDefinition;
81017   var _isHD = false;
81018   var _planeFrame2;
81019   var _pannellumFrame2;
81020   var _currentFrame2;
81021   var _oldestDate;
81022   var _currentScene = {
81023     currentImage: null,
81024     nextImage: null,
81025     prevImage: null
81026   };
81027   var _activeImage2;
81028   function partitionViewport6(projection2) {
81029     const z2 = geoScaleToZoom(projection2.scale());
81030     const z22 = Math.ceil(z2 * 2) / 2 + 2.5;
81031     const tiler8 = utilTiler().zoomExtent([z22, z22]);
81032     return tiler8.getTiles(projection2).map(function(tile) {
81033       return tile.extent;
81034     });
81035   }
81036   function searchLimited6(limit, projection2, rtree) {
81037     limit = limit || 5;
81038     return partitionViewport6(projection2).reduce(function(result, extent) {
81039       let found = rtree.search(extent.bbox());
81040       const spacing = Math.max(1, Math.floor(found.length / limit));
81041       found = found.filter((d2, idx) => idx % spacing === 0 || d2.data.id === (_activeImage2 == null ? void 0 : _activeImage2.id)).sort((a2, b2) => {
81042         if (a2.data.id === (_activeImage2 == null ? void 0 : _activeImage2.id)) return -1;
81043         if (b2.data.id === (_activeImage2 == null ? void 0 : _activeImage2.id)) return 1;
81044         return 0;
81045       }).slice(0, limit).map((d2) => d2.data);
81046       return found.length ? result.concat(found) : result;
81047     }, []);
81048   }
81049   function loadTiles5(which, url, maxZoom2, projection2, zoom) {
81050     const tiler8 = utilTiler().zoomExtent([minZoom4, maxZoom2]).skipNullIsland(true);
81051     const tiles = tiler8.getTiles(projection2);
81052     tiles.forEach(function(tile) {
81053       loadTile5(which, url, tile, zoom);
81054     });
81055   }
81056   function loadTile5(which, url, tile, zoom) {
81057     const cache = _cache4.requests;
81058     const tileId = "".concat(tile.id, "-").concat(which);
81059     if (cache.loaded[tileId] || cache.inflight[tileId]) return;
81060     const controller = new AbortController();
81061     cache.inflight[tileId] = controller;
81062     const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
81063     fetch(requestUrl, { signal: controller.signal }).then(function(response) {
81064       if (!response.ok) {
81065         throw new Error(response.status + " " + response.statusText);
81066       }
81067       cache.loaded[tileId] = true;
81068       delete cache.inflight[tileId];
81069       return response.arrayBuffer();
81070     }).then(function(data) {
81071       if (data.byteLength === 0) {
81072         throw new Error("No Data");
81073       }
81074       loadTileDataToCache3(data, tile, zoom);
81075       if (which === "images") {
81076         dispatch13.call("loadedImages");
81077       } else {
81078         dispatch13.call("loadedLines");
81079       }
81080     }).catch(function(e3) {
81081       if (e3.message === "No Data") {
81082         cache.loaded[tileId] = true;
81083       } else {
81084         console.error(e3);
81085       }
81086     });
81087   }
81088   function loadTileDataToCache3(data, tile, zoom) {
81089     const vectorTile = new VectorTile(new Pbf(data));
81090     let features, cache, layer, i3, feature3, loc, d2;
81091     if (vectorTile.layers.hasOwnProperty(pictureLayer)) {
81092       features = [];
81093       cache = _cache4.images;
81094       layer = vectorTile.layers[pictureLayer];
81095       for (i3 = 0; i3 < layer.length; i3++) {
81096         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
81097         loc = feature3.geometry.coordinates;
81098         d2 = {
81099           loc,
81100           capture_time: feature3.properties.ts,
81101           capture_time_parsed: new Date(feature3.properties.ts),
81102           id: feature3.properties.id,
81103           account_id: feature3.properties.account_id,
81104           sequence_id: feature3.properties.sequences.split('"')[1],
81105           heading: parseInt(feature3.properties.heading, 10),
81106           image_path: "",
81107           resolution: feature3.properties.resolution,
81108           isPano: feature3.properties.type === "equirectangular",
81109           model: feature3.properties.model
81110         };
81111         cache.forImageId[d2.id] = d2;
81112         features.push({
81113           minX: loc[0],
81114           minY: loc[1],
81115           maxX: loc[0],
81116           maxY: loc[1],
81117           data: d2
81118         });
81119         if (_oldestDate) {
81120           if (d2.capture_time < _oldestDate) {
81121             _oldestDate = d2.capture_time;
81122           }
81123         } else {
81124           _oldestDate = d2.capture_time;
81125         }
81126       }
81127       if (cache.rtree) {
81128         cache.rtree.load(features);
81129       }
81130     }
81131     if (vectorTile.layers.hasOwnProperty(sequenceLayer)) {
81132       cache = _cache4.sequences;
81133       if (zoom >= lineMinZoom && zoom < imageMinZoom) cache = _cache4.mockSequences;
81134       layer = vectorTile.layers[sequenceLayer];
81135       for (i3 = 0; i3 < layer.length; i3++) {
81136         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
81137         if (cache.lineString[feature3.properties.id]) {
81138           cache.lineString[feature3.properties.id].push(feature3);
81139         } else {
81140           cache.lineString[feature3.properties.id] = [feature3];
81141         }
81142         if (_oldestDate) {
81143           if (feature3.properties.date < _oldestDate) {
81144             _oldestDate = feature3.properties.date;
81145           }
81146         } else {
81147           _oldestDate = feature3.properties.date;
81148         }
81149       }
81150     }
81151   }
81152   async function getImageData2(collection_id, image_id) {
81153     const requestUrl = imageDataUrl.replace("{collectionId}", collection_id).replace("{itemId}", image_id);
81154     const response = await fetch(requestUrl, { method: "GET" });
81155     if (!response.ok) {
81156       throw new Error(response.status + " " + response.statusText);
81157     }
81158     const data = await response.json();
81159     return data;
81160   }
81161   async function getUsername(user_id) {
81162     const requestUrl = usernameURL.replace("{userId}", user_id);
81163     const response = await fetch(requestUrl, { method: "GET" });
81164     if (!response.ok) {
81165       throw new Error(response.status + " " + response.statusText);
81166     }
81167     const data = await response.json();
81168     return data.name;
81169   }
81170   var panoramax_default = {
81171     init: function() {
81172       if (!_cache4) {
81173         this.reset();
81174       }
81175       this.event = utilRebind(this, dispatch13, "on");
81176     },
81177     reset: function() {
81178       if (_cache4) {
81179         Object.values(_cache4.requests.inflight).forEach(function(request3) {
81180           request3.abort();
81181         });
81182       }
81183       _cache4 = {
81184         images: { rtree: new RBush(), forImageId: {} },
81185         sequences: { rtree: new RBush(), lineString: {} },
81186         mockSequences: { rtree: new RBush(), lineString: {} },
81187         requests: { loaded: {}, inflight: {} }
81188       };
81189       _currentScene.currentImage = null;
81190       _activeImage2 = null;
81191     },
81192     // Get visible images
81193     images: function(projection2) {
81194       const limit = 5;
81195       return searchLimited6(limit, projection2, _cache4.images.rtree);
81196     },
81197     cachedImage: function(imageKey) {
81198       return _cache4.images.forImageId[imageKey];
81199     },
81200     // Load images in the visible area
81201     loadImages: function(projection2) {
81202       loadTiles5("images", tileUrl2, imageMinZoom, projection2);
81203     },
81204     // Load line in the visible area
81205     loadLines: function(projection2, zoom) {
81206       loadTiles5("line", tileUrl2, lineMinZoom, projection2, zoom);
81207     },
81208     getUserIds: async function(usernames) {
81209       const requestUrls = usernames.map((username) => userIdUrl.replace("{username}", username));
81210       const responses = await Promise.all(requestUrls.map((requestUrl) => fetch(requestUrl, { method: "GET" })));
81211       if (responses.some((response) => !response.ok)) {
81212         const response = responses.find((response2) => !response2.ok);
81213         throw new Error(response.status + " " + response.statusText);
81214       }
81215       const data = await Promise.all(responses.map((response) => response.json()));
81216       return data.flatMap((d2, i3) => d2.features.filter((f2) => f2.name === usernames[i3]).map((f2) => f2.id));
81217     },
81218     getOldestDate: function() {
81219       return _oldestDate;
81220     },
81221     // Get visible sequences
81222     sequences: function(projection2, zoom) {
81223       const viewport = projection2.clipExtent();
81224       const min3 = [viewport[0][0], viewport[1][1]];
81225       const max3 = [viewport[1][0], viewport[0][1]];
81226       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
81227       const sequenceIds = {};
81228       let lineStrings = [];
81229       if (zoom >= imageMinZoom) {
81230         _cache4.images.rtree.search(bbox2).forEach(function(d2) {
81231           if (d2.data.sequence_id) {
81232             sequenceIds[d2.data.sequence_id] = true;
81233           }
81234         });
81235         Object.keys(sequenceIds).forEach(function(sequenceId) {
81236           if (_cache4.sequences.lineString[sequenceId]) {
81237             lineStrings = lineStrings.concat(_cache4.sequences.lineString[sequenceId]);
81238           }
81239         });
81240         return lineStrings;
81241       }
81242       if (zoom >= lineMinZoom) {
81243         Object.keys(_cache4.mockSequences.lineString).forEach(function(sequenceId) {
81244           lineStrings = lineStrings.concat(_cache4.mockSequences.lineString[sequenceId]);
81245         });
81246       }
81247       return lineStrings;
81248     },
81249     // Set the currently visible image
81250     setActiveImage: function(image) {
81251       if (image) {
81252         _activeImage2 = {
81253           id: image.id,
81254           sequence_id: image.sequence_id
81255         };
81256       } else {
81257         _activeImage2 = null;
81258       }
81259     },
81260     getActiveImage: function() {
81261       return _activeImage2;
81262     },
81263     // Update the currently highlighted sequence and selected bubble.
81264     setStyles: function(context, hovered) {
81265       const hoveredImageId = hovered && hovered.id;
81266       const hoveredSequenceId = hovered && hovered.sequence_id;
81267       const selectedSequenceId = _activeImage2 && _activeImage2.sequence_id;
81268       const selectedImageId = _activeImage2 && _activeImage2.id;
81269       const markers = context.container().selectAll(".layer-panoramax .viewfield-group");
81270       const sequences = context.container().selectAll(".layer-panoramax .sequence");
81271       markers.classed("highlighted", function(d2) {
81272         return d2.sequence_id === selectedSequenceId || d2.id === hoveredImageId;
81273       }).classed("hovered", function(d2) {
81274         return d2.id === hoveredImageId;
81275       }).classed("currentView", function(d2) {
81276         return d2.id === selectedImageId;
81277       });
81278       sequences.classed("highlighted", function(d2) {
81279         return d2.properties.id === hoveredSequenceId;
81280       }).classed("currentView", function(d2) {
81281         return d2.properties.id === selectedSequenceId;
81282       });
81283       context.container().selectAll(".layer-panoramax .viewfield-group .viewfield").attr("d", viewfieldPath);
81284       function viewfieldPath() {
81285         let d2 = this.parentNode.__data__;
81286         if (d2.isPano && d2.id !== selectedImageId) {
81287           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
81288         } else {
81289           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
81290         }
81291       }
81292       return this;
81293     },
81294     updateUrlImage: function(imageKey) {
81295       if (!window.mocha) {
81296         var hash = utilStringQs(window.location.hash);
81297         if (imageKey) {
81298           hash.photo = "panoramax/" + imageKey;
81299         } else {
81300           delete hash.photo;
81301         }
81302         window.location.replace("#" + utilQsString(hash, true));
81303       }
81304     },
81305     selectImage: function(context, id2) {
81306       let that = this;
81307       let d2 = that.cachedImage(id2);
81308       that.setActiveImage(d2);
81309       that.updateUrlImage(d2.id);
81310       const viewerLink = "".concat(viewerUrl, "#pic=").concat(d2.id, "&focus=pic");
81311       let viewer = context.container().select(".photoviewer");
81312       if (!viewer.empty()) viewer.datum(d2);
81313       this.setStyles(context, null);
81314       if (!d2) return this;
81315       let wrap2 = context.container().select(".photoviewer .panoramax-wrapper");
81316       let attribution = wrap2.selectAll(".photo-attribution").text("");
81317       let line1 = attribution.append("div").attr("class", "attribution-row");
81318       const hdDomId = utilUniqueDomId("panoramax-hd");
81319       let label = line1.append("label").attr("for", hdDomId).attr("class", "panoramax-hd");
81320       label.append("input").attr("type", "checkbox").attr("id", hdDomId).property("checked", _isHD).on("click", (d3_event) => {
81321         d3_event.stopPropagation();
81322         _isHD = !_isHD;
81323         _definition = _isHD ? highDefinition : standardDefinition;
81324         that.selectImage(context, d2.id).showViewer(context);
81325       });
81326       label.append("span").call(_t.append("panoramax.hd"));
81327       if (d2.capture_time) {
81328         attribution.append("span").attr("class", "captured_at").text(localeDateString2(d2.capture_time));
81329         attribution.append("span").text("|");
81330       }
81331       attribution.append("a").attr("class", "report-photo").attr("href", "mailto:signalement.ign@panoramax.fr").call(_t.append("panoramax.report"));
81332       attribution.append("span").text("|");
81333       attribution.append("a").attr("class", "image-link").attr("target", "_blank").attr("href", viewerLink).text("panoramax.xyz");
81334       getImageData2(d2.sequence_id, d2.id).then(function(data) {
81335         _currentScene = {
81336           currentImage: null,
81337           nextImage: null,
81338           prevImage: null
81339         };
81340         _currentScene.currentImage = data.assets[_definition];
81341         const nextIndex = data.links.findIndex((x2) => x2.rel === "next");
81342         const prevIndex = data.links.findIndex((x2) => x2.rel === "prev");
81343         if (nextIndex !== -1) {
81344           _currentScene.nextImage = data.links[nextIndex];
81345         }
81346         if (prevIndex !== -1) {
81347           _currentScene.prevImage = data.links[prevIndex];
81348         }
81349         d2.image_path = _currentScene.currentImage.href;
81350         wrap2.selectAll("button.back").classed("hide", _currentScene.prevImage === null);
81351         wrap2.selectAll("button.forward").classed("hide", _currentScene.nextImage === null);
81352         _currentFrame2 = d2.isPano ? _pannellumFrame2 : _planeFrame2;
81353         _currentFrame2.showPhotoFrame(wrap2).selectPhoto(d2, true);
81354       });
81355       function localeDateString2(s2) {
81356         if (!s2) return null;
81357         var options2 = { day: "numeric", month: "short", year: "numeric" };
81358         var d4 = new Date(s2);
81359         if (isNaN(d4.getTime())) return null;
81360         return d4.toLocaleDateString(_mainLocalizer.localeCode(), options2);
81361       }
81362       if (d2.account_id) {
81363         attribution.append("span").text("|");
81364         let line2 = attribution.append("span").attr("class", "attribution-row");
81365         getUsername(d2.account_id).then(function(username) {
81366           line2.append("span").attr("class", "captured_by").text(_t("panoramax.captured_by", { username }));
81367         });
81368       }
81369       return this;
81370     },
81371     photoFrame: function() {
81372       return _currentFrame2;
81373     },
81374     ensureViewerLoaded: function(context) {
81375       let that = this;
81376       let imgWrap = context.container().select("#ideditor-viewer-panoramax-simple > img");
81377       if (!imgWrap.empty()) {
81378         imgWrap.remove();
81379       }
81380       if (_loadViewerPromise6) return _loadViewerPromise6;
81381       let wrap2 = context.container().select(".photoviewer").selectAll(".panoramax-wrapper").data([0]);
81382       let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper panoramax-wrapper").classed("hide", true).on("dblclick.zoom", null);
81383       wrapEnter.append("div").attr("class", "photo-attribution fillD");
81384       const controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls-panoramax");
81385       controlsEnter.append("button").classed("back", true).on("click.back", step(-1)).text("\u25C4");
81386       controlsEnter.append("button").classed("forward", true).on("click.forward", step(1)).text("\u25BA");
81387       _loadViewerPromise6 = Promise.all([
81388         pannellum_photo_default.init(context, wrapEnter),
81389         plane_photo_default.init(context, wrapEnter)
81390       ]).then(([pannellumPhotoFrame, planePhotoFrame]) => {
81391         _pannellumFrame2 = pannellumPhotoFrame;
81392         _pannellumFrame2.event.on("viewerChanged", () => dispatch13.call("viewerChanged"));
81393         _planeFrame2 = planePhotoFrame;
81394         _planeFrame2.event.on("viewerChanged", () => dispatch13.call("viewerChanged"));
81395       });
81396       function step(stepBy) {
81397         return function() {
81398           if (!_currentScene.currentImage) return;
81399           let nextId;
81400           if (stepBy === 1) nextId = _currentScene.nextImage.id;
81401           else nextId = _currentScene.prevImage.id;
81402           if (!nextId) return;
81403           const nextImage = _cache4.images.forImageId[nextId];
81404           if (nextImage) {
81405             context.map().centerEase(nextImage.loc);
81406             that.selectImage(context, nextImage.id);
81407           }
81408         };
81409       }
81410       return _loadViewerPromise6;
81411     },
81412     showViewer: function(context) {
81413       let wrap2 = context.container().select(".photoviewer").classed("hide", false);
81414       let isHidden = wrap2.selectAll(".photo-wrapper.panoramax-wrapper.hide").size();
81415       if (isHidden) {
81416         wrap2.selectAll(".photo-wrapper:not(.panoramax-wrapper)").classed("hide", true);
81417         wrap2.selectAll(".photo-wrapper.panoramax-wrapper").classed("hide", false);
81418       }
81419       return this;
81420     },
81421     hideViewer: function(context) {
81422       let viewer = context.container().select(".photoviewer");
81423       if (!viewer.empty()) viewer.datum(null);
81424       this.updateUrlImage(null);
81425       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
81426       context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
81427       this.setActiveImage();
81428       return this.setStyles(context, null);
81429     },
81430     cache: function() {
81431       return _cache4;
81432     }
81433   };
81434
81435   // modules/services/index.js
81436   var services = {
81437     geocoder: nominatim_default,
81438     keepRight: keepRight_default,
81439     osmose: osmose_default,
81440     mapillary: mapillary_default,
81441     nsi: nsi_default,
81442     kartaview: kartaview_default,
81443     vegbilder: vegbilder_default,
81444     osm: osm_default,
81445     osmWikibase: osm_wikibase_default,
81446     maprules: maprules_default,
81447     streetside: streetside_default,
81448     taginfo: taginfo_default,
81449     vectorTile: vector_tile_default,
81450     wikidata: wikidata_default,
81451     wikipedia: wikipedia_default,
81452     mapilio: mapilio_default,
81453     panoramax: panoramax_default
81454   };
81455
81456   // modules/modes/drag_note.js
81457   function modeDragNote(context) {
81458     var mode = {
81459       id: "drag-note",
81460       button: "browse"
81461     };
81462     var edit2 = behaviorEdit(context);
81463     var _nudgeInterval;
81464     var _lastLoc;
81465     var _note;
81466     function startNudge(d3_event, nudge) {
81467       if (_nudgeInterval) window.clearInterval(_nudgeInterval);
81468       _nudgeInterval = window.setInterval(function() {
81469         context.map().pan(nudge);
81470         doMove(d3_event, nudge);
81471       }, 50);
81472     }
81473     function stopNudge() {
81474       if (_nudgeInterval) {
81475         window.clearInterval(_nudgeInterval);
81476         _nudgeInterval = null;
81477       }
81478     }
81479     function origin(note) {
81480       return context.projection(note.loc);
81481     }
81482     function start2(d3_event, note) {
81483       _note = note;
81484       var osm = services.osm;
81485       if (osm) {
81486         _note = osm.getNote(_note.id);
81487       }
81488       context.surface().selectAll(".note-" + _note.id).classed("active", true);
81489       context.perform(actionNoop());
81490       context.enter(mode);
81491       context.selectedNoteID(_note.id);
81492     }
81493     function move(d3_event, entity, point) {
81494       d3_event.stopPropagation();
81495       _lastLoc = context.projection.invert(point);
81496       doMove(d3_event);
81497       var nudge = geoViewportEdge(point, context.map().dimensions());
81498       if (nudge) {
81499         startNudge(d3_event, nudge);
81500       } else {
81501         stopNudge();
81502       }
81503     }
81504     function doMove(d3_event, nudge) {
81505       nudge = nudge || [0, 0];
81506       var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
81507       var currMouse = geoVecSubtract(currPoint, nudge);
81508       var loc = context.projection.invert(currMouse);
81509       _note = _note.move(loc);
81510       var osm = services.osm;
81511       if (osm) {
81512         osm.replaceNote(_note);
81513       }
81514       context.replace(actionNoop());
81515     }
81516     function end() {
81517       context.replace(actionNoop());
81518       context.selectedNoteID(_note.id).enter(modeSelectNote(context, _note.id));
81519     }
81520     var drag = behaviorDrag().selector(".layer-touch.markers .target.note.new").surface(context.container().select(".main-map").node()).origin(origin).on("start", start2).on("move", move).on("end", end);
81521     mode.enter = function() {
81522       context.install(edit2);
81523     };
81524     mode.exit = function() {
81525       context.ui().sidebar.hover.cancel();
81526       context.uninstall(edit2);
81527       context.surface().selectAll(".active").classed("active", false);
81528       stopNudge();
81529     };
81530     mode.behavior = drag;
81531     return mode;
81532   }
81533
81534   // modules/modes/select_data.js
81535   function modeSelectData(context, selectedDatum) {
81536     var mode = {
81537       id: "select-data",
81538       button: "browse"
81539     };
81540     var keybinding = utilKeybinding("select-data");
81541     var dataEditor = uiDataEditor(context);
81542     var behaviors = [
81543       behaviorBreathe(context),
81544       behaviorHover(context),
81545       behaviorSelect(context),
81546       behaviorLasso(context),
81547       modeDragNode(context).behavior,
81548       modeDragNote(context).behavior
81549     ];
81550     function selectData(d3_event, drawn) {
81551       var selection2 = context.surface().selectAll(".layer-mapdata .data" + selectedDatum.__featurehash__);
81552       if (selection2.empty()) {
81553         var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
81554         if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
81555           context.enter(modeBrowse(context));
81556         }
81557       } else {
81558         selection2.classed("selected", true);
81559       }
81560     }
81561     function esc() {
81562       if (context.container().select(".combobox").size()) return;
81563       context.enter(modeBrowse(context));
81564     }
81565     mode.zoomToSelected = function() {
81566       var extent = geoExtent(bounds_default(selectedDatum));
81567       context.map().centerZoomEase(extent.center(), context.map().trimmedExtentZoom(extent));
81568     };
81569     mode.enter = function() {
81570       behaviors.forEach(context.install);
81571       keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
81572       select_default2(document).call(keybinding);
81573       selectData();
81574       var sidebar = context.ui().sidebar;
81575       sidebar.show(dataEditor.datum(selectedDatum));
81576       var extent = geoExtent(bounds_default(selectedDatum));
81577       sidebar.expand(sidebar.intersects(extent));
81578       context.map().on("drawn.select-data", selectData);
81579     };
81580     mode.exit = function() {
81581       behaviors.forEach(context.uninstall);
81582       select_default2(document).call(keybinding.unbind);
81583       context.surface().selectAll(".layer-mapdata .selected").classed("selected hover", false);
81584       context.map().on("drawn.select-data", null);
81585       context.ui().sidebar.hide();
81586     };
81587     return mode;
81588   }
81589
81590   // modules/behavior/select.js
81591   function behaviorSelect(context) {
81592     var _tolerancePx = 4;
81593     var _lastMouseEvent = null;
81594     var _showMenu = false;
81595     var _downPointers = {};
81596     var _longPressTimeout = null;
81597     var _lastInteractionType = null;
81598     var _multiselectionPointerId = null;
81599     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
81600     function keydown(d3_event) {
81601       if (d3_event.keyCode === 32) {
81602         var activeNode = document.activeElement;
81603         if (activeNode && (/* @__PURE__ */ new Set(["INPUT", "TEXTAREA"])).has(activeNode.nodeName)) return;
81604       }
81605       if (d3_event.keyCode === 93 || // context menu key
81606       d3_event.keyCode === 32) {
81607         d3_event.preventDefault();
81608       }
81609       if (d3_event.repeat) return;
81610       cancelLongPress();
81611       if (d3_event.shiftKey) {
81612         context.surface().classed("behavior-multiselect", true);
81613       }
81614       if (d3_event.keyCode === 32) {
81615         if (!_downPointers.spacebar && _lastMouseEvent) {
81616           cancelLongPress();
81617           _longPressTimeout = window.setTimeout(didLongPress, 500, "spacebar", "spacebar");
81618           _downPointers.spacebar = {
81619             firstEvent: _lastMouseEvent,
81620             lastEvent: _lastMouseEvent
81621           };
81622         }
81623       }
81624     }
81625     function keyup(d3_event) {
81626       cancelLongPress();
81627       if (!d3_event.shiftKey) {
81628         context.surface().classed("behavior-multiselect", false);
81629       }
81630       if (d3_event.keyCode === 93) {
81631         d3_event.preventDefault();
81632         _lastInteractionType = "menukey";
81633         contextmenu(d3_event);
81634       } else if (d3_event.keyCode === 32) {
81635         var pointer = _downPointers.spacebar;
81636         if (pointer) {
81637           delete _downPointers.spacebar;
81638           if (pointer.done) return;
81639           d3_event.preventDefault();
81640           _lastInteractionType = "spacebar";
81641           click(pointer.firstEvent, pointer.lastEvent, "spacebar");
81642         }
81643       }
81644     }
81645     function pointerdown(d3_event) {
81646       var id2 = (d3_event.pointerId || "mouse").toString();
81647       cancelLongPress();
81648       if (d3_event.buttons && d3_event.buttons !== 1) return;
81649       context.ui().closeEditMenu();
81650       if (d3_event.pointerType !== "mouse") {
81651         _longPressTimeout = window.setTimeout(didLongPress, 500, id2, "longdown-" + (d3_event.pointerType || "mouse"));
81652       }
81653       _downPointers[id2] = {
81654         firstEvent: d3_event,
81655         lastEvent: d3_event
81656       };
81657     }
81658     function didLongPress(id2, interactionType) {
81659       var pointer = _downPointers[id2];
81660       if (!pointer) return;
81661       for (var i3 in _downPointers) {
81662         _downPointers[i3].done = true;
81663       }
81664       _longPressTimeout = null;
81665       _lastInteractionType = interactionType;
81666       _showMenu = true;
81667       click(pointer.firstEvent, pointer.lastEvent, id2);
81668     }
81669     function pointermove(d3_event) {
81670       var id2 = (d3_event.pointerId || "mouse").toString();
81671       if (_downPointers[id2]) {
81672         _downPointers[id2].lastEvent = d3_event;
81673       }
81674       if (!d3_event.pointerType || d3_event.pointerType === "mouse") {
81675         _lastMouseEvent = d3_event;
81676         if (_downPointers.spacebar) {
81677           _downPointers.spacebar.lastEvent = d3_event;
81678         }
81679       }
81680     }
81681     function pointerup(d3_event) {
81682       var id2 = (d3_event.pointerId || "mouse").toString();
81683       var pointer = _downPointers[id2];
81684       if (!pointer) return;
81685       delete _downPointers[id2];
81686       if (_multiselectionPointerId === id2) {
81687         _multiselectionPointerId = null;
81688       }
81689       if (pointer.done) return;
81690       click(pointer.firstEvent, d3_event, id2);
81691     }
81692     function pointercancel(d3_event) {
81693       var id2 = (d3_event.pointerId || "mouse").toString();
81694       if (!_downPointers[id2]) return;
81695       delete _downPointers[id2];
81696       if (_multiselectionPointerId === id2) {
81697         _multiselectionPointerId = null;
81698       }
81699     }
81700     function contextmenu(d3_event) {
81701       d3_event.preventDefault();
81702       if (!+d3_event.clientX && !+d3_event.clientY) {
81703         if (_lastMouseEvent) {
81704           d3_event = _lastMouseEvent;
81705         } else {
81706           return;
81707         }
81708       } else {
81709         _lastMouseEvent = d3_event;
81710         if (d3_event.pointerType === "touch" || d3_event.pointerType === "pen" || d3_event.mozInputSource && // firefox doesn't give a pointerType on contextmenu events
81711         (d3_event.mozInputSource === MouseEvent.MOZ_SOURCE_TOUCH || d3_event.mozInputSource === MouseEvent.MOZ_SOURCE_PEN)) {
81712           _lastInteractionType = "touch";
81713         } else {
81714           _lastInteractionType = "rightclick";
81715         }
81716       }
81717       _showMenu = true;
81718       click(d3_event, d3_event);
81719     }
81720     function click(firstEvent, lastEvent, pointerId) {
81721       cancelLongPress();
81722       var mapNode = context.container().select(".main-map").node();
81723       var pointGetter = utilFastMouse(mapNode);
81724       var p1 = pointGetter(firstEvent);
81725       var p2 = pointGetter(lastEvent);
81726       var dist = geoVecLength(p1, p2);
81727       if (dist > _tolerancePx || !mapContains(lastEvent)) {
81728         resetProperties();
81729         return;
81730       }
81731       var targetDatum = lastEvent.target.__data__;
81732       var multiselectEntityId;
81733       if (!_multiselectionPointerId) {
81734         var selectPointerInfo = pointerDownOnSelection(pointerId);
81735         if (selectPointerInfo) {
81736           _multiselectionPointerId = selectPointerInfo.pointerId;
81737           multiselectEntityId = !selectPointerInfo.selected && selectPointerInfo.entityId;
81738           _downPointers[selectPointerInfo.pointerId].done = true;
81739         }
81740       }
81741       var isMultiselect = context.mode().id === "select" && // and shift key is down
81742       (lastEvent && lastEvent.shiftKey || // or we're lasso-selecting
81743       context.surface().select(".lasso").node() || // or a pointer is down over a selected feature
81744       _multiselectionPointerId && !multiselectEntityId);
81745       processClick(targetDatum, isMultiselect, p2, multiselectEntityId);
81746       function mapContains(event) {
81747         var rect = mapNode.getBoundingClientRect();
81748         return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
81749       }
81750       function pointerDownOnSelection(skipPointerId) {
81751         var mode = context.mode();
81752         var selectedIDs = mode.id === "select" ? mode.selectedIDs() : [];
81753         for (var pointerId2 in _downPointers) {
81754           if (pointerId2 === "spacebar" || pointerId2 === skipPointerId) continue;
81755           var pointerInfo = _downPointers[pointerId2];
81756           var p12 = pointGetter(pointerInfo.firstEvent);
81757           var p22 = pointGetter(pointerInfo.lastEvent);
81758           if (geoVecLength(p12, p22) > _tolerancePx) continue;
81759           var datum2 = pointerInfo.firstEvent.target.__data__;
81760           var entity = datum2 && datum2.properties && datum2.properties.entity || datum2;
81761           if (context.graph().hasEntity(entity.id)) {
81762             return {
81763               pointerId: pointerId2,
81764               entityId: entity.id,
81765               selected: selectedIDs.indexOf(entity.id) !== -1
81766             };
81767           }
81768         }
81769         return null;
81770       }
81771     }
81772     function processClick(datum2, isMultiselect, point, alsoSelectId) {
81773       var mode = context.mode();
81774       var showMenu = _showMenu;
81775       var interactionType = _lastInteractionType;
81776       var entity = datum2 && datum2.properties && datum2.properties.entity;
81777       if (entity) datum2 = entity;
81778       if (datum2 && datum2.type === "midpoint") {
81779         datum2 = datum2.parents[0];
81780       }
81781       var newMode;
81782       if (datum2 instanceof osmEntity) {
81783         var selectedIDs = context.selectedIDs();
81784         context.selectedNoteID(null);
81785         context.selectedErrorID(null);
81786         if (!isMultiselect) {
81787           if (!showMenu || selectedIDs.length <= 1 || selectedIDs.indexOf(datum2.id) === -1) {
81788             if (alsoSelectId === datum2.id) alsoSelectId = null;
81789             selectedIDs = (alsoSelectId ? [alsoSelectId] : []).concat([datum2.id]);
81790             newMode = mode.id === "select" ? mode.selectedIDs(selectedIDs) : modeSelect(context, selectedIDs).selectBehavior(behavior);
81791             context.enter(newMode);
81792           }
81793         } else {
81794           if (selectedIDs.indexOf(datum2.id) !== -1) {
81795             if (!showMenu) {
81796               selectedIDs = selectedIDs.filter(function(id2) {
81797                 return id2 !== datum2.id;
81798               });
81799               newMode = selectedIDs.length ? mode.selectedIDs(selectedIDs) : modeBrowse(context).selectBehavior(behavior);
81800               context.enter(newMode);
81801             }
81802           } else {
81803             selectedIDs = selectedIDs.concat([datum2.id]);
81804             newMode = mode.selectedIDs(selectedIDs);
81805             context.enter(newMode);
81806           }
81807         }
81808       } else if (datum2 && datum2.__featurehash__ && !isMultiselect) {
81809         context.selectedNoteID(null).enter(modeSelectData(context, datum2));
81810       } else if (datum2 instanceof osmNote && !isMultiselect) {
81811         context.selectedNoteID(datum2.id).enter(modeSelectNote(context, datum2.id));
81812       } else if (datum2 instanceof QAItem && !isMultiselect) {
81813         context.selectedErrorID(datum2.id).enter(modeSelectError(context, datum2.id, datum2.service));
81814       } else {
81815         context.selectedNoteID(null);
81816         context.selectedErrorID(null);
81817         if (!isMultiselect && mode.id !== "browse") {
81818           context.enter(modeBrowse(context));
81819         }
81820       }
81821       context.ui().closeEditMenu();
81822       if (showMenu) context.ui().showEditMenu(point, interactionType);
81823       resetProperties();
81824     }
81825     function cancelLongPress() {
81826       if (_longPressTimeout) window.clearTimeout(_longPressTimeout);
81827       _longPressTimeout = null;
81828     }
81829     function resetProperties() {
81830       cancelLongPress();
81831       _showMenu = false;
81832       _lastInteractionType = null;
81833     }
81834     function behavior(selection2) {
81835       resetProperties();
81836       _lastMouseEvent = context.map().lastPointerEvent();
81837       select_default2(window).on("keydown.select", keydown).on("keyup.select", keyup).on(_pointerPrefix + "move.select", pointermove, true).on(_pointerPrefix + "up.select", pointerup, true).on("pointercancel.select", pointercancel, true).on("contextmenu.select-window", function(d3_event) {
81838         var e3 = d3_event;
81839         if (+e3.clientX === 0 && +e3.clientY === 0) {
81840           d3_event.preventDefault();
81841         }
81842       });
81843       selection2.on(_pointerPrefix + "down.select", pointerdown).on("contextmenu.select", contextmenu);
81844     }
81845     behavior.off = function(selection2) {
81846       cancelLongPress();
81847       select_default2(window).on("keydown.select", null).on("keyup.select", null).on("contextmenu.select-window", null).on(_pointerPrefix + "move.select", null, true).on(_pointerPrefix + "up.select", null, true).on("pointercancel.select", null, true);
81848       selection2.on(_pointerPrefix + "down.select", null).on("contextmenu.select", null);
81849       context.surface().classed("behavior-multiselect", false);
81850     };
81851     return behavior;
81852   }
81853
81854   // modules/operations/index.js
81855   var operations_exports = {};
81856   __export(operations_exports, {
81857     operationCircularize: () => operationCircularize,
81858     operationContinue: () => operationContinue,
81859     operationCopy: () => operationCopy,
81860     operationDelete: () => operationDelete,
81861     operationDisconnect: () => operationDisconnect,
81862     operationDowngrade: () => operationDowngrade,
81863     operationExtract: () => operationExtract,
81864     operationMerge: () => operationMerge,
81865     operationMove: () => operationMove,
81866     operationOrthogonalize: () => operationOrthogonalize,
81867     operationPaste: () => operationPaste,
81868     operationReflectLong: () => operationReflectLong,
81869     operationReflectShort: () => operationReflectShort,
81870     operationReverse: () => operationReverse,
81871     operationRotate: () => operationRotate,
81872     operationSplit: () => operationSplit,
81873     operationStraighten: () => operationStraighten
81874   });
81875
81876   // modules/operations/continue.js
81877   function operationContinue(context, selectedIDs) {
81878     var _entities = selectedIDs.map(function(id2) {
81879       return context.graph().entity(id2);
81880     });
81881     var _geometries = Object.assign(
81882       { line: [], vertex: [] },
81883       utilArrayGroupBy(_entities, function(entity) {
81884         return entity.geometry(context.graph());
81885       })
81886     );
81887     var _vertex = _geometries.vertex.length && _geometries.vertex[0];
81888     function candidateWays() {
81889       return _vertex ? context.graph().parentWays(_vertex).filter(function(parent) {
81890         return parent.geometry(context.graph()) === "line" && !parent.isClosed() && parent.affix(_vertex.id) && (_geometries.line.length === 0 || _geometries.line[0] === parent);
81891       }) : [];
81892     }
81893     var _candidates = candidateWays();
81894     var operation2 = function() {
81895       var candidate = _candidates[0];
81896       context.enter(
81897         modeDrawLine(context, candidate.id, context.graph(), "line", candidate.affix(_vertex.id), true)
81898       );
81899     };
81900     operation2.relatedEntityIds = function() {
81901       return _candidates.length ? [_candidates[0].id] : [];
81902     };
81903     operation2.available = function() {
81904       return _geometries.vertex.length === 1 && _geometries.line.length <= 1 && !context.features().hasHiddenConnections(_vertex, context.graph());
81905     };
81906     operation2.disabled = function() {
81907       if (_candidates.length === 0) {
81908         return "not_eligible";
81909       } else if (_candidates.length > 1) {
81910         return "multiple";
81911       }
81912       return false;
81913     };
81914     operation2.tooltip = function() {
81915       var disable = operation2.disabled();
81916       return disable ? _t.append("operations.continue." + disable) : _t.append("operations.continue.description");
81917     };
81918     operation2.annotation = function() {
81919       return _t("operations.continue.annotation.line");
81920     };
81921     operation2.id = "continue";
81922     operation2.keys = [_t("operations.continue.key")];
81923     operation2.title = _t.append("operations.continue.title");
81924     operation2.behavior = behaviorOperation(context).which(operation2);
81925     return operation2;
81926   }
81927
81928   // modules/operations/copy.js
81929   function operationCopy(context, selectedIDs) {
81930     function getFilteredIdsToCopy() {
81931       return selectedIDs.filter(function(selectedID) {
81932         var entity = context.graph().hasEntity(selectedID);
81933         return entity.hasInterestingTags() || entity.geometry(context.graph()) !== "vertex";
81934       });
81935     }
81936     var operation2 = function() {
81937       var graph = context.graph();
81938       var selected = groupEntities(getFilteredIdsToCopy(), graph);
81939       var canCopy = [];
81940       var skip = {};
81941       var entity;
81942       var i3;
81943       for (i3 = 0; i3 < selected.relation.length; i3++) {
81944         entity = selected.relation[i3];
81945         if (!skip[entity.id] && entity.isComplete(graph)) {
81946           canCopy.push(entity.id);
81947           skip = getDescendants(entity.id, graph, skip);
81948         }
81949       }
81950       for (i3 = 0; i3 < selected.way.length; i3++) {
81951         entity = selected.way[i3];
81952         if (!skip[entity.id]) {
81953           canCopy.push(entity.id);
81954           skip = getDescendants(entity.id, graph, skip);
81955         }
81956       }
81957       for (i3 = 0; i3 < selected.node.length; i3++) {
81958         entity = selected.node[i3];
81959         if (!skip[entity.id]) {
81960           canCopy.push(entity.id);
81961         }
81962       }
81963       context.copyIDs(canCopy);
81964       if (_point && (canCopy.length !== 1 || graph.entity(canCopy[0]).type !== "node")) {
81965         context.copyLonLat(context.projection.invert(_point));
81966       } else {
81967         context.copyLonLat(null);
81968       }
81969     };
81970     function groupEntities(ids, graph) {
81971       var entities = ids.map(function(id2) {
81972         return graph.entity(id2);
81973       });
81974       return Object.assign(
81975         { relation: [], way: [], node: [] },
81976         utilArrayGroupBy(entities, "type")
81977       );
81978     }
81979     function getDescendants(id2, graph, descendants) {
81980       var entity = graph.entity(id2);
81981       var children2;
81982       descendants = descendants || {};
81983       if (entity.type === "relation") {
81984         children2 = entity.members.map(function(m2) {
81985           return m2.id;
81986         });
81987       } else if (entity.type === "way") {
81988         children2 = entity.nodes;
81989       } else {
81990         children2 = [];
81991       }
81992       for (var i3 = 0; i3 < children2.length; i3++) {
81993         if (!descendants[children2[i3]]) {
81994           descendants[children2[i3]] = true;
81995           descendants = getDescendants(children2[i3], graph, descendants);
81996         }
81997       }
81998       return descendants;
81999     }
82000     operation2.available = function() {
82001       return getFilteredIdsToCopy().length > 0;
82002     };
82003     operation2.disabled = function() {
82004       var extent = utilTotalExtent(getFilteredIdsToCopy(), context.graph());
82005       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
82006         return "too_large";
82007       }
82008       return false;
82009     };
82010     operation2.availableForKeypress = function() {
82011       var selection2 = window.getSelection && window.getSelection();
82012       return !selection2 || !selection2.toString();
82013     };
82014     operation2.tooltip = function() {
82015       var disable = operation2.disabled();
82016       return disable ? _t.append("operations.copy." + disable, { n: selectedIDs.length }) : _t.append("operations.copy.description", { n: selectedIDs.length });
82017     };
82018     operation2.annotation = function() {
82019       return _t("operations.copy.annotation", { n: selectedIDs.length });
82020     };
82021     var _point;
82022     operation2.point = function(val) {
82023       _point = val;
82024       return operation2;
82025     };
82026     operation2.id = "copy";
82027     operation2.keys = [uiCmd("\u2318C")];
82028     operation2.title = _t.append("operations.copy.title");
82029     operation2.behavior = behaviorOperation(context).which(operation2);
82030     return operation2;
82031   }
82032
82033   // modules/operations/disconnect.js
82034   function operationDisconnect(context, selectedIDs) {
82035     var _vertexIDs = [];
82036     var _wayIDs = [];
82037     var _otherIDs = [];
82038     var _actions = [];
82039     selectedIDs.forEach(function(id2) {
82040       var entity = context.entity(id2);
82041       if (entity.type === "way") {
82042         _wayIDs.push(id2);
82043       } else if (entity.geometry(context.graph()) === "vertex") {
82044         _vertexIDs.push(id2);
82045       } else {
82046         _otherIDs.push(id2);
82047       }
82048     });
82049     var _coords, _descriptionID = "", _annotationID = "features";
82050     var _disconnectingVertexIds = [];
82051     var _disconnectingWayIds = [];
82052     if (_vertexIDs.length > 0) {
82053       _disconnectingVertexIds = _vertexIDs;
82054       _vertexIDs.forEach(function(vertexID) {
82055         var action = actionDisconnect(vertexID);
82056         if (_wayIDs.length > 0) {
82057           var waysIDsForVertex = _wayIDs.filter(function(wayID) {
82058             var way = context.entity(wayID);
82059             return way.nodes.indexOf(vertexID) !== -1;
82060           });
82061           action.limitWays(waysIDsForVertex);
82062         }
82063         _actions.push(action);
82064         _disconnectingWayIds = _disconnectingWayIds.concat(context.graph().parentWays(context.graph().entity(vertexID)).map((d2) => d2.id));
82065       });
82066       _disconnectingWayIds = utilArrayUniq(_disconnectingWayIds).filter(function(id2) {
82067         return _wayIDs.indexOf(id2) === -1;
82068       });
82069       _descriptionID += _actions.length === 1 ? "single_point." : "multiple_points.";
82070       if (_wayIDs.length === 1) {
82071         _descriptionID += "single_way." + context.graph().geometry(_wayIDs[0]);
82072       } else {
82073         _descriptionID += _wayIDs.length === 0 ? "no_ways" : "multiple_ways";
82074       }
82075     } else if (_wayIDs.length > 0) {
82076       var ways = _wayIDs.map(function(id2) {
82077         return context.entity(id2);
82078       });
82079       var nodes = utilGetAllNodes(_wayIDs, context.graph());
82080       _coords = nodes.map(function(n3) {
82081         return n3.loc;
82082       });
82083       var sharedActions = [];
82084       var sharedNodes = [];
82085       var unsharedActions = [];
82086       var unsharedNodes = [];
82087       nodes.forEach(function(node) {
82088         var action = actionDisconnect(node.id).limitWays(_wayIDs);
82089         if (action.disabled(context.graph()) !== "not_connected") {
82090           var count = 0;
82091           for (var i3 in ways) {
82092             var way = ways[i3];
82093             if (way.nodes.indexOf(node.id) !== -1) {
82094               count += 1;
82095             }
82096             if (count > 1) break;
82097           }
82098           if (count > 1) {
82099             sharedActions.push(action);
82100             sharedNodes.push(node);
82101           } else {
82102             unsharedActions.push(action);
82103             unsharedNodes.push(node);
82104           }
82105         }
82106       });
82107       _descriptionID += "no_points.";
82108       _descriptionID += _wayIDs.length === 1 ? "single_way." : "multiple_ways.";
82109       if (sharedActions.length) {
82110         _actions = sharedActions;
82111         _disconnectingVertexIds = sharedNodes.map((node) => node.id);
82112         _descriptionID += "conjoined";
82113         _annotationID = "from_each_other";
82114       } else {
82115         _actions = unsharedActions;
82116         _disconnectingVertexIds = unsharedNodes.map((node) => node.id);
82117         if (_wayIDs.length === 1) {
82118           _descriptionID += context.graph().geometry(_wayIDs[0]);
82119         } else {
82120           _descriptionID += "separate";
82121         }
82122       }
82123     }
82124     var _extent = utilTotalExtent(_disconnectingVertexIds, context.graph());
82125     var operation2 = function() {
82126       context.perform(function(graph) {
82127         return _actions.reduce(function(graph2, action) {
82128           return action(graph2);
82129         }, graph);
82130       }, operation2.annotation());
82131       context.validator().validate();
82132     };
82133     operation2.relatedEntityIds = function() {
82134       if (_vertexIDs.length) {
82135         return _disconnectingWayIds;
82136       }
82137       return _disconnectingVertexIds;
82138     };
82139     operation2.available = function() {
82140       if (_actions.length === 0) return false;
82141       if (_otherIDs.length !== 0) return false;
82142       if (_vertexIDs.length !== 0 && _wayIDs.length !== 0 && !_wayIDs.every(function(wayID) {
82143         return _vertexIDs.some(function(vertexID) {
82144           var way = context.entity(wayID);
82145           return way.nodes.indexOf(vertexID) !== -1;
82146         });
82147       })) return false;
82148       return true;
82149     };
82150     operation2.disabled = function() {
82151       var reason;
82152       for (var actionIndex in _actions) {
82153         reason = _actions[actionIndex].disabled(context.graph());
82154         if (reason) return reason;
82155       }
82156       if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
82157         return "too_large." + ((_vertexIDs.length ? _vertexIDs : _wayIDs).length === 1 ? "single" : "multiple");
82158       } else if (_coords && someMissing()) {
82159         return "not_downloaded";
82160       } else if (selectedIDs.some(context.hasHiddenConnections)) {
82161         return "connected_to_hidden";
82162       }
82163       return false;
82164       function someMissing() {
82165         if (context.inIntro()) return false;
82166         var osm = context.connection();
82167         if (osm) {
82168           var missing = _coords.filter(function(loc) {
82169             return !osm.isDataLoaded(loc);
82170           });
82171           if (missing.length) {
82172             missing.forEach(function(loc) {
82173               context.loadTileAtLoc(loc);
82174             });
82175             return true;
82176           }
82177         }
82178         return false;
82179       }
82180     };
82181     operation2.tooltip = function() {
82182       var disable = operation2.disabled();
82183       return disable ? _t.append("operations.disconnect." + disable) : _t.append("operations.disconnect.description." + _descriptionID);
82184     };
82185     operation2.annotation = function() {
82186       return _t("operations.disconnect.annotation." + _annotationID);
82187     };
82188     operation2.id = "disconnect";
82189     operation2.keys = [_t("operations.disconnect.key")];
82190     operation2.title = _t.append("operations.disconnect.title");
82191     operation2.behavior = behaviorOperation(context).which(operation2);
82192     return operation2;
82193   }
82194
82195   // modules/operations/downgrade.js
82196   function operationDowngrade(context, selectedIDs) {
82197     var _affectedFeatureCount = 0;
82198     var _downgradeType = downgradeTypeForEntityIDs(selectedIDs);
82199     var _multi = _affectedFeatureCount === 1 ? "single" : "multiple";
82200     function downgradeTypeForEntityIDs(entityIds) {
82201       var downgradeType;
82202       _affectedFeatureCount = 0;
82203       for (var i3 in entityIds) {
82204         var entityID = entityIds[i3];
82205         var type2 = downgradeTypeForEntityID(entityID);
82206         if (type2) {
82207           _affectedFeatureCount += 1;
82208           if (downgradeType && type2 !== downgradeType) {
82209             if (downgradeType !== "generic" && type2 !== "generic") {
82210               downgradeType = "building_address";
82211             } else {
82212               downgradeType = "generic";
82213             }
82214           } else {
82215             downgradeType = type2;
82216           }
82217         }
82218       }
82219       return downgradeType;
82220     }
82221     function downgradeTypeForEntityID(entityID) {
82222       var graph = context.graph();
82223       var entity = graph.entity(entityID);
82224       var preset = _mainPresetIndex.match(entity, graph);
82225       if (!preset || preset.isFallback()) return null;
82226       if (entity.type === "node" && preset.id !== "address" && Object.keys(entity.tags).some(function(key) {
82227         return key.match(/^addr:.{1,}/);
82228       })) {
82229         return "address";
82230       }
82231       var geometry = entity.geometry(graph);
82232       if (geometry === "area" && entity.tags.building && !preset.tags.building) {
82233         return "building";
82234       }
82235       if (geometry === "vertex" && Object.keys(entity.tags).length) {
82236         return "generic";
82237       }
82238       return null;
82239     }
82240     var buildingKeysToKeep = ["architect", "building", "height", "layer", "nycdoitt:bin", "source", "type", "wheelchair"];
82241     var addressKeysToKeep = ["source"];
82242     var operation2 = function() {
82243       context.perform(function(graph) {
82244         for (var i3 in selectedIDs) {
82245           var entityID = selectedIDs[i3];
82246           var type2 = downgradeTypeForEntityID(entityID);
82247           if (!type2) continue;
82248           var tags = Object.assign({}, graph.entity(entityID).tags);
82249           for (var key in tags) {
82250             if (type2 === "address" && addressKeysToKeep.indexOf(key) !== -1) continue;
82251             if (type2 === "building") {
82252               if (buildingKeysToKeep.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/)) continue;
82253             }
82254             if (type2 !== "generic") {
82255               if (key.match(/^addr:.{1,}/) || key.match(/^source:.{1,}/)) continue;
82256             }
82257             delete tags[key];
82258           }
82259           graph = actionChangeTags(entityID, tags)(graph);
82260         }
82261         return graph;
82262       }, operation2.annotation());
82263       context.validator().validate();
82264       context.enter(modeSelect(context, selectedIDs));
82265     };
82266     operation2.available = function() {
82267       return _downgradeType;
82268     };
82269     operation2.disabled = function() {
82270       if (selectedIDs.some(hasWikidataTag)) {
82271         return "has_wikidata_tag";
82272       }
82273       return false;
82274       function hasWikidataTag(id2) {
82275         var entity = context.entity(id2);
82276         return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
82277       }
82278     };
82279     operation2.tooltip = function() {
82280       var disable = operation2.disabled();
82281       return disable ? _t.append("operations.downgrade." + disable + "." + _multi) : _t.append("operations.downgrade.description." + _downgradeType);
82282     };
82283     operation2.annotation = function() {
82284       var suffix;
82285       if (_downgradeType === "building_address") {
82286         suffix = "generic";
82287       } else {
82288         suffix = _downgradeType;
82289       }
82290       return _t("operations.downgrade.annotation." + suffix, { n: _affectedFeatureCount });
82291     };
82292     operation2.id = "downgrade";
82293     operation2.keys = [uiCmd("\u232B")];
82294     operation2.title = _t.append("operations.downgrade.title");
82295     operation2.behavior = behaviorOperation(context).which(operation2);
82296     return operation2;
82297   }
82298
82299   // modules/operations/extract.js
82300   function operationExtract(context, selectedIDs) {
82301     var _amount = selectedIDs.length === 1 ? "single" : "multiple";
82302     var _geometries = utilArrayUniq(selectedIDs.map(function(entityID) {
82303       return context.graph().hasEntity(entityID) && context.graph().geometry(entityID);
82304     }).filter(Boolean));
82305     var _geometryID = _geometries.length === 1 ? _geometries[0] : "feature";
82306     var _extent;
82307     var _actions = selectedIDs.map(function(entityID) {
82308       var graph = context.graph();
82309       var entity = graph.hasEntity(entityID);
82310       if (!entity || !entity.hasInterestingTags()) return null;
82311       if (entity.type === "node" && graph.parentWays(entity).length === 0) return null;
82312       if (entity.type !== "node") {
82313         var preset = _mainPresetIndex.match(entity, graph);
82314         if (preset.geometry.indexOf("point") === -1) return null;
82315       }
82316       _extent = _extent ? _extent.extend(entity.extent(graph)) : entity.extent(graph);
82317       return actionExtract(entityID, context.projection);
82318     }).filter(Boolean);
82319     var operation2 = function() {
82320       var combinedAction = function(graph) {
82321         _actions.forEach(function(action) {
82322           graph = action(graph);
82323         });
82324         return graph;
82325       };
82326       context.perform(combinedAction, operation2.annotation());
82327       var extractedNodeIDs = _actions.map(function(action) {
82328         return action.getExtractedNodeID();
82329       });
82330       context.enter(modeSelect(context, extractedNodeIDs));
82331     };
82332     operation2.available = function() {
82333       return _actions.length && selectedIDs.length === _actions.length;
82334     };
82335     operation2.disabled = function() {
82336       if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
82337         return "too_large";
82338       } else if (selectedIDs.some(function(entityID) {
82339         return context.graph().geometry(entityID) === "vertex" && context.hasHiddenConnections(entityID);
82340       })) {
82341         return "connected_to_hidden";
82342       }
82343       return false;
82344     };
82345     operation2.tooltip = function() {
82346       var disableReason = operation2.disabled();
82347       if (disableReason) {
82348         return _t.append("operations.extract." + disableReason + "." + _amount);
82349       } else {
82350         return _t.append("operations.extract.description." + _geometryID + "." + _amount);
82351       }
82352     };
82353     operation2.annotation = function() {
82354       return _t("operations.extract.annotation", { n: selectedIDs.length });
82355     };
82356     operation2.id = "extract";
82357     operation2.keys = [_t("operations.extract.key")];
82358     operation2.title = _t.append("operations.extract.title");
82359     operation2.behavior = behaviorOperation(context).which(operation2);
82360     return operation2;
82361   }
82362
82363   // modules/operations/merge.js
82364   function operationMerge(context, selectedIDs) {
82365     var _action = getAction();
82366     function getAction() {
82367       var join = actionJoin(selectedIDs);
82368       if (!join.disabled(context.graph())) return join;
82369       var merge2 = actionMerge(selectedIDs);
82370       if (!merge2.disabled(context.graph())) return merge2;
82371       var mergePolygon = actionMergePolygon(selectedIDs);
82372       if (!mergePolygon.disabled(context.graph())) return mergePolygon;
82373       var mergeNodes = actionMergeNodes(selectedIDs);
82374       if (!mergeNodes.disabled(context.graph())) return mergeNodes;
82375       if (join.disabled(context.graph()) !== "not_eligible") return join;
82376       if (merge2.disabled(context.graph()) !== "not_eligible") return merge2;
82377       if (mergePolygon.disabled(context.graph()) !== "not_eligible") return mergePolygon;
82378       return mergeNodes;
82379     }
82380     var operation2 = function() {
82381       if (operation2.disabled()) return;
82382       context.perform(_action, operation2.annotation());
82383       context.validator().validate();
82384       var resultIDs = selectedIDs.filter(context.hasEntity);
82385       if (resultIDs.length > 1) {
82386         var interestingIDs = resultIDs.filter(function(id2) {
82387           return context.entity(id2).hasInterestingTags();
82388         });
82389         if (interestingIDs.length) resultIDs = interestingIDs;
82390       }
82391       context.enter(modeSelect(context, resultIDs));
82392     };
82393     operation2.available = function() {
82394       return selectedIDs.length >= 2;
82395     };
82396     operation2.disabled = function() {
82397       var actionDisabled = _action.disabled(context.graph());
82398       if (actionDisabled) return actionDisabled;
82399       var osm = context.connection();
82400       if (osm && _action.resultingWayNodesLength && _action.resultingWayNodesLength(context.graph()) > osm.maxWayNodes()) {
82401         return "too_many_vertices";
82402       }
82403       return false;
82404     };
82405     operation2.tooltip = function() {
82406       var disabled = operation2.disabled();
82407       if (disabled) {
82408         if (disabled === "conflicting_relations") {
82409           return _t.append("operations.merge.conflicting_relations");
82410         }
82411         if (disabled === "restriction" || disabled === "connectivity") {
82412           return _t.append(
82413             "operations.merge.damage_relation",
82414             { relation: _mainPresetIndex.item("type/" + disabled).name() }
82415           );
82416         }
82417         return _t.append("operations.merge." + disabled);
82418       }
82419       return _t.append("operations.merge.description");
82420     };
82421     operation2.annotation = function() {
82422       return _t("operations.merge.annotation", { n: selectedIDs.length });
82423     };
82424     operation2.id = "merge";
82425     operation2.keys = [_t("operations.merge.key")];
82426     operation2.title = _t.append("operations.merge.title");
82427     operation2.behavior = behaviorOperation(context).which(operation2);
82428     return operation2;
82429   }
82430
82431   // modules/operations/paste.js
82432   function operationPaste(context) {
82433     var _pastePoint;
82434     var operation2 = function() {
82435       if (!_pastePoint) return;
82436       var oldIDs = context.copyIDs();
82437       if (!oldIDs.length) return;
82438       var projection2 = context.projection;
82439       var extent = geoExtent();
82440       var oldGraph = context.copyGraph();
82441       var newIDs = [];
82442       var action = actionCopyEntities(oldIDs, oldGraph);
82443       context.perform(action);
82444       var copies = action.copies();
82445       var originals = /* @__PURE__ */ new Set();
82446       Object.values(copies).forEach(function(entity) {
82447         originals.add(entity.id);
82448       });
82449       for (var id2 in copies) {
82450         var oldEntity = oldGraph.entity(id2);
82451         var newEntity = copies[id2];
82452         extent._extend(oldEntity.extent(oldGraph));
82453         var parents = context.graph().parentWays(newEntity);
82454         var parentCopied = parents.some(function(parent) {
82455           return originals.has(parent.id);
82456         });
82457         if (!parentCopied) {
82458           newIDs.push(newEntity.id);
82459         }
82460       }
82461       var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
82462       var delta = geoVecSubtract(_pastePoint, copyPoint);
82463       context.replace(actionMove(newIDs, delta, projection2), operation2.annotation());
82464       context.enter(modeSelect(context, newIDs));
82465     };
82466     operation2.point = function(val) {
82467       _pastePoint = val;
82468       return operation2;
82469     };
82470     operation2.available = function() {
82471       return context.mode().id === "browse";
82472     };
82473     operation2.disabled = function() {
82474       return !context.copyIDs().length;
82475     };
82476     operation2.tooltip = function() {
82477       var oldGraph = context.copyGraph();
82478       var ids = context.copyIDs();
82479       if (!ids.length) {
82480         return _t.append("operations.paste.nothing_copied");
82481       }
82482       return _t.append("operations.paste.description", { feature: utilDisplayLabel(oldGraph.entity(ids[0]), oldGraph), n: ids.length });
82483     };
82484     operation2.annotation = function() {
82485       var ids = context.copyIDs();
82486       return _t("operations.paste.annotation", { n: ids.length });
82487     };
82488     operation2.id = "paste";
82489     operation2.keys = [uiCmd("\u2318V")];
82490     operation2.title = _t.append("operations.paste.title");
82491     return operation2;
82492   }
82493
82494   // modules/operations/reverse.js
82495   function operationReverse(context, selectedIDs) {
82496     var operation2 = function() {
82497       context.perform(function combinedReverseAction(graph) {
82498         actions().forEach(function(action) {
82499           graph = action(graph);
82500         });
82501         return graph;
82502       }, operation2.annotation());
82503       context.validator().validate();
82504     };
82505     function actions(situation) {
82506       return selectedIDs.map(function(entityID) {
82507         var entity = context.hasEntity(entityID);
82508         if (!entity) return null;
82509         if (situation === "toolbar") {
82510           if (entity.type === "way" && (!entity.isOneWay() && !entity.isSided())) return null;
82511         }
82512         var geometry = entity.geometry(context.graph());
82513         if (entity.type !== "node" && geometry !== "line") return null;
82514         var action = actionReverse(entityID);
82515         if (action.disabled(context.graph())) return null;
82516         return action;
82517       }).filter(Boolean);
82518     }
82519     function reverseTypeID() {
82520       var acts = actions();
82521       var nodeActionCount = acts.filter(function(act) {
82522         var entity = context.hasEntity(act.entityID());
82523         return entity && entity.type === "node";
82524       }).length;
82525       if (nodeActionCount === 0) return "line";
82526       if (nodeActionCount === acts.length) return "point";
82527       return "feature";
82528     }
82529     operation2.available = function(situation) {
82530       return actions(situation).length > 0;
82531     };
82532     operation2.disabled = function() {
82533       return false;
82534     };
82535     operation2.tooltip = function() {
82536       return _t.append("operations.reverse.description." + reverseTypeID());
82537     };
82538     operation2.annotation = function() {
82539       var acts = actions();
82540       return _t("operations.reverse.annotation." + reverseTypeID(), { n: acts.length });
82541     };
82542     operation2.id = "reverse";
82543     operation2.keys = [_t("operations.reverse.key")];
82544     operation2.title = _t.append("operations.reverse.title");
82545     operation2.behavior = behaviorOperation(context).which(operation2);
82546     return operation2;
82547   }
82548
82549   // modules/operations/split.js
82550   function operationSplit(context, selectedIDs) {
82551     var _vertexIds = selectedIDs.filter(function(id2) {
82552       return context.graph().geometry(id2) === "vertex";
82553     });
82554     var _selectedWayIds = selectedIDs.filter(function(id2) {
82555       var entity = context.graph().hasEntity(id2);
82556       return entity && entity.type === "way";
82557     });
82558     var _isAvailable = _vertexIds.length > 0 && _vertexIds.length + _selectedWayIds.length === selectedIDs.length;
82559     var _action = actionSplit(_vertexIds);
82560     var _ways = [];
82561     var _geometry = "feature";
82562     var _waysAmount = "single";
82563     var _nodesAmount = _vertexIds.length === 1 ? "single" : "multiple";
82564     if (_isAvailable) {
82565       if (_selectedWayIds.length) _action.limitWays(_selectedWayIds);
82566       _ways = _action.ways(context.graph());
82567       var geometries = {};
82568       _ways.forEach(function(way) {
82569         geometries[way.geometry(context.graph())] = true;
82570       });
82571       if (Object.keys(geometries).length === 1) {
82572         _geometry = Object.keys(geometries)[0];
82573       }
82574       _waysAmount = _ways.length === 1 ? "single" : "multiple";
82575     }
82576     var operation2 = function() {
82577       var difference2 = context.perform(_action, operation2.annotation());
82578       var idsToSelect = _vertexIds.concat(difference2.extantIDs().filter(function(id2) {
82579         return context.entity(id2).type === "way";
82580       }));
82581       context.enter(modeSelect(context, idsToSelect));
82582     };
82583     operation2.relatedEntityIds = function() {
82584       return _selectedWayIds.length ? [] : _ways.map((way) => way.id);
82585     };
82586     operation2.available = function() {
82587       return _isAvailable;
82588     };
82589     operation2.disabled = function() {
82590       var reason = _action.disabled(context.graph());
82591       if (reason) {
82592         return reason;
82593       } else if (selectedIDs.some(context.hasHiddenConnections)) {
82594         return "connected_to_hidden";
82595       }
82596       return false;
82597     };
82598     operation2.tooltip = function() {
82599       var disable = operation2.disabled();
82600       return disable ? _t.append("operations.split." + disable) : _t.append("operations.split.description." + _geometry + "." + _waysAmount + "." + _nodesAmount + "_node");
82601     };
82602     operation2.annotation = function() {
82603       return _t("operations.split.annotation." + _geometry, { n: _ways.length });
82604     };
82605     operation2.icon = function() {
82606       if (_waysAmount === "multiple") {
82607         return "#iD-operation-split-multiple";
82608       } else {
82609         return "#iD-operation-split";
82610       }
82611     };
82612     operation2.id = "split";
82613     operation2.keys = [_t("operations.split.key")];
82614     operation2.title = _t.append("operations.split.title");
82615     operation2.behavior = behaviorOperation(context).which(operation2);
82616     return operation2;
82617   }
82618
82619   // modules/operations/straighten.js
82620   function operationStraighten(context, selectedIDs) {
82621     var _wayIDs = selectedIDs.filter(function(id2) {
82622       return id2.charAt(0) === "w";
82623     });
82624     var _nodeIDs = selectedIDs.filter(function(id2) {
82625       return id2.charAt(0) === "n";
82626     });
82627     var _amount = (_wayIDs.length ? _wayIDs : _nodeIDs).length === 1 ? "single" : "multiple";
82628     var _nodes = utilGetAllNodes(selectedIDs, context.graph());
82629     var _coords = _nodes.map(function(n3) {
82630       return n3.loc;
82631     });
82632     var _extent = utilTotalExtent(selectedIDs, context.graph());
82633     var _action = chooseAction();
82634     var _geometry;
82635     function chooseAction() {
82636       if (_wayIDs.length === 0 && _nodeIDs.length > 2) {
82637         _geometry = "point";
82638         return actionStraightenNodes(_nodeIDs, context.projection);
82639       } else if (_wayIDs.length > 0 && (_nodeIDs.length === 0 || _nodeIDs.length === 2)) {
82640         var startNodeIDs = [];
82641         var endNodeIDs = [];
82642         for (var i3 = 0; i3 < selectedIDs.length; i3++) {
82643           var entity = context.entity(selectedIDs[i3]);
82644           if (entity.type === "node") {
82645             continue;
82646           } else if (entity.type !== "way" || entity.isClosed()) {
82647             return null;
82648           }
82649           startNodeIDs.push(entity.first());
82650           endNodeIDs.push(entity.last());
82651         }
82652         startNodeIDs = startNodeIDs.filter(function(n3) {
82653           return startNodeIDs.indexOf(n3) === startNodeIDs.lastIndexOf(n3);
82654         });
82655         endNodeIDs = endNodeIDs.filter(function(n3) {
82656           return endNodeIDs.indexOf(n3) === endNodeIDs.lastIndexOf(n3);
82657         });
82658         if (utilArrayDifference(startNodeIDs, endNodeIDs).length + utilArrayDifference(endNodeIDs, startNodeIDs).length !== 2) return null;
82659         var wayNodeIDs = utilGetAllNodes(_wayIDs, context.graph()).map(function(node) {
82660           return node.id;
82661         });
82662         if (wayNodeIDs.length <= 2) return null;
82663         if (_nodeIDs.length === 2 && (wayNodeIDs.indexOf(_nodeIDs[0]) === -1 || wayNodeIDs.indexOf(_nodeIDs[1]) === -1)) return null;
82664         if (_nodeIDs.length) {
82665           _extent = utilTotalExtent(_nodeIDs, context.graph());
82666         }
82667         _geometry = "line";
82668         return actionStraightenWay(selectedIDs, context.projection);
82669       }
82670       return null;
82671     }
82672     function operation2() {
82673       if (!_action) return;
82674       context.perform(_action, operation2.annotation());
82675       window.setTimeout(function() {
82676         context.validator().validate();
82677       }, 300);
82678     }
82679     operation2.available = function() {
82680       return Boolean(_action);
82681     };
82682     operation2.disabled = function() {
82683       var reason = _action.disabled(context.graph());
82684       if (reason) {
82685         return reason;
82686       } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
82687         return "too_large";
82688       } else if (someMissing()) {
82689         return "not_downloaded";
82690       } else if (selectedIDs.some(context.hasHiddenConnections)) {
82691         return "connected_to_hidden";
82692       }
82693       return false;
82694       function someMissing() {
82695         if (context.inIntro()) return false;
82696         var osm = context.connection();
82697         if (osm) {
82698           var missing = _coords.filter(function(loc) {
82699             return !osm.isDataLoaded(loc);
82700           });
82701           if (missing.length) {
82702             missing.forEach(function(loc) {
82703               context.loadTileAtLoc(loc);
82704             });
82705             return true;
82706           }
82707         }
82708         return false;
82709       }
82710     };
82711     operation2.tooltip = function() {
82712       var disable = operation2.disabled();
82713       return disable ? _t.append("operations.straighten." + disable + "." + _amount) : _t.append("operations.straighten.description." + _geometry + (_wayIDs.length === 1 ? "" : "s"));
82714     };
82715     operation2.annotation = function() {
82716       return _t("operations.straighten.annotation." + _geometry, { n: _wayIDs.length ? _wayIDs.length : _nodeIDs.length });
82717     };
82718     operation2.id = "straighten";
82719     operation2.keys = [_t("operations.straighten.key")];
82720     operation2.title = _t.append("operations.straighten.title");
82721     operation2.behavior = behaviorOperation(context).which(operation2);
82722     return operation2;
82723   }
82724
82725   // modules/modes/select.js
82726   function modeSelect(context, selectedIDs) {
82727     var mode = {
82728       id: "select",
82729       button: "browse"
82730     };
82731     var keybinding = utilKeybinding("select");
82732     var _breatheBehavior = behaviorBreathe(context);
82733     var _modeDragNode = modeDragNode(context);
82734     var _selectBehavior;
82735     var _behaviors = [];
82736     var _operations = [];
82737     var _newFeature = false;
82738     var _follow = false;
82739     var _focusedParentWayId;
82740     var _focusedVertexIds;
82741     function singular() {
82742       if (selectedIDs && selectedIDs.length === 1) {
82743         return context.hasEntity(selectedIDs[0]);
82744       }
82745     }
82746     function selectedEntities() {
82747       return selectedIDs.map(function(id2) {
82748         return context.hasEntity(id2);
82749       }).filter(Boolean);
82750     }
82751     function checkSelectedIDs() {
82752       var ids = [];
82753       if (Array.isArray(selectedIDs)) {
82754         ids = selectedIDs.filter(function(id2) {
82755           return context.hasEntity(id2);
82756         });
82757       }
82758       if (!ids.length) {
82759         context.enter(modeBrowse(context));
82760         return false;
82761       } else if (selectedIDs.length > 1 && ids.length === 1 || selectedIDs.length === 1 && ids.length > 1) {
82762         context.enter(modeSelect(context, ids));
82763         return false;
82764       }
82765       selectedIDs = ids;
82766       return true;
82767     }
82768     function parentWaysIdsOfSelection(onlyCommonParents) {
82769       var graph = context.graph();
82770       var parents = [];
82771       for (var i3 = 0; i3 < selectedIDs.length; i3++) {
82772         var entity = context.hasEntity(selectedIDs[i3]);
82773         if (!entity || entity.geometry(graph) !== "vertex") {
82774           return [];
82775         }
82776         var currParents = graph.parentWays(entity).map(function(w2) {
82777           return w2.id;
82778         });
82779         if (!parents.length) {
82780           parents = currParents;
82781           continue;
82782         }
82783         parents = (onlyCommonParents ? utilArrayIntersection : utilArrayUnion)(parents, currParents);
82784         if (!parents.length) {
82785           return [];
82786         }
82787       }
82788       return parents;
82789     }
82790     function childNodeIdsOfSelection(onlyCommon) {
82791       var graph = context.graph();
82792       var childs = [];
82793       for (var i3 = 0; i3 < selectedIDs.length; i3++) {
82794         var entity = context.hasEntity(selectedIDs[i3]);
82795         if (!entity || !["area", "line"].includes(entity.geometry(graph))) {
82796           return [];
82797         }
82798         var currChilds = graph.childNodes(entity).map(function(node) {
82799           return node.id;
82800         });
82801         if (!childs.length) {
82802           childs = currChilds;
82803           continue;
82804         }
82805         childs = (onlyCommon ? utilArrayIntersection : utilArrayUnion)(childs, currChilds);
82806         if (!childs.length) {
82807           return [];
82808         }
82809       }
82810       return childs;
82811     }
82812     function checkFocusedParent() {
82813       if (_focusedParentWayId) {
82814         var parents = parentWaysIdsOfSelection(true);
82815         if (parents.indexOf(_focusedParentWayId) === -1) _focusedParentWayId = null;
82816       }
82817     }
82818     function parentWayIdForVertexNavigation() {
82819       var parentIds = parentWaysIdsOfSelection(true);
82820       if (_focusedParentWayId && parentIds.indexOf(_focusedParentWayId) !== -1) {
82821         return _focusedParentWayId;
82822       }
82823       return parentIds.length ? parentIds[0] : null;
82824     }
82825     mode.selectedIDs = function(val) {
82826       if (!arguments.length) return selectedIDs;
82827       selectedIDs = val;
82828       return mode;
82829     };
82830     mode.zoomToSelected = function() {
82831       context.map().zoomToEase(selectedEntities());
82832     };
82833     mode.newFeature = function(val) {
82834       if (!arguments.length) return _newFeature;
82835       _newFeature = val;
82836       return mode;
82837     };
82838     mode.selectBehavior = function(val) {
82839       if (!arguments.length) return _selectBehavior;
82840       _selectBehavior = val;
82841       return mode;
82842     };
82843     mode.follow = function(val) {
82844       if (!arguments.length) return _follow;
82845       _follow = val;
82846       return mode;
82847     };
82848     function loadOperations() {
82849       _operations.forEach(function(operation2) {
82850         if (operation2.behavior) {
82851           context.uninstall(operation2.behavior);
82852         }
82853       });
82854       _operations = Object.values(operations_exports).map(function(o2) {
82855         return o2(context, selectedIDs);
82856       }).filter(function(o2) {
82857         return o2.id !== "delete" && o2.id !== "downgrade" && o2.id !== "copy";
82858       }).concat([
82859         // group copy/downgrade/delete operation together at the end of the list
82860         operationCopy(context, selectedIDs),
82861         operationDowngrade(context, selectedIDs),
82862         operationDelete(context, selectedIDs)
82863       ]).filter(function(operation2) {
82864         return operation2.available();
82865       });
82866       _operations.forEach(function(operation2) {
82867         if (operation2.behavior) {
82868           context.install(operation2.behavior);
82869         }
82870       });
82871       context.ui().closeEditMenu();
82872     }
82873     mode.operations = function() {
82874       return _operations;
82875     };
82876     mode.enter = function() {
82877       if (!checkSelectedIDs()) return;
82878       context.features().forceVisible(selectedIDs);
82879       _modeDragNode.restoreSelectedIDs(selectedIDs);
82880       loadOperations();
82881       if (!_behaviors.length) {
82882         if (!_selectBehavior) _selectBehavior = behaviorSelect(context);
82883         _behaviors = [
82884           behaviorPaste(context),
82885           _breatheBehavior,
82886           behaviorHover(context).on("hover", context.ui().sidebar.hoverModeSelect),
82887           _selectBehavior,
82888           behaviorLasso(context),
82889           _modeDragNode.behavior,
82890           modeDragNote(context).behavior
82891         ];
82892       }
82893       _behaviors.forEach(context.install);
82894       keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on(["[", "pgup"], previousVertex).on(["]", "pgdown"], nextVertex).on(["{", uiCmd("\u2318["), "home"], firstVertex).on(["}", uiCmd("\u2318]"), "end"], lastVertex).on(uiCmd("\u21E7\u2190"), nudgeSelection([-10, 0])).on(uiCmd("\u21E7\u2191"), nudgeSelection([0, -10])).on(uiCmd("\u21E7\u2192"), nudgeSelection([10, 0])).on(uiCmd("\u21E7\u2193"), nudgeSelection([0, 10])).on(uiCmd("\u21E7\u2325\u2190"), nudgeSelection([-100, 0])).on(uiCmd("\u21E7\u2325\u2191"), nudgeSelection([0, -100])).on(uiCmd("\u21E7\u2325\u2192"), nudgeSelection([100, 0])).on(uiCmd("\u21E7\u2325\u2193"), nudgeSelection([0, 100])).on(utilKeybinding.plusKeys.map((key) => uiCmd("\u21E7" + key)), scaleSelection(1.05)).on(utilKeybinding.plusKeys.map((key) => uiCmd("\u21E7\u2325" + key)), scaleSelection(Math.pow(1.05, 5))).on(utilKeybinding.minusKeys.map((key) => uiCmd("\u21E7" + key)), scaleSelection(1 / 1.05)).on(utilKeybinding.minusKeys.map((key) => uiCmd("\u21E7\u2325" + key)), scaleSelection(1 / Math.pow(1.05, 5))).on(["\\", "pause"], focusNextParent).on(uiCmd("\u2318\u2191"), selectParent).on(uiCmd("\u2318\u2193"), selectChild).on("\u238B", esc, true);
82895       select_default2(document).call(keybinding);
82896       context.ui().sidebar.select(selectedIDs, _newFeature);
82897       context.history().on("change.select", function() {
82898         loadOperations();
82899         selectElements();
82900       }).on("undone.select", checkSelectedIDs).on("redone.select", checkSelectedIDs);
82901       context.map().on("drawn.select", selectElements).on("crossEditableZoom.select", function() {
82902         selectElements();
82903         _breatheBehavior.restartIfNeeded(context.surface());
82904       });
82905       context.map().doubleUpHandler().on("doubleUp.modeSelect", didDoubleUp);
82906       selectElements();
82907       if (_follow) {
82908         var extent = geoExtent();
82909         var graph = context.graph();
82910         selectedIDs.forEach(function(id2) {
82911           var entity = context.entity(id2);
82912           extent._extend(entity.extent(graph));
82913         });
82914         var loc = extent.center();
82915         context.map().centerEase(loc);
82916         _follow = false;
82917       }
82918       function nudgeSelection(delta) {
82919         return function() {
82920           if (!context.map().withinEditableZoom()) return;
82921           var moveOp = operationMove(context, selectedIDs);
82922           if (moveOp.disabled()) {
82923             context.ui().flash.duration(4e3).iconName("#iD-operation-" + moveOp.id).iconClass("operation disabled").label(moveOp.tooltip())();
82924           } else {
82925             context.perform(actionMove(selectedIDs, delta, context.projection), moveOp.annotation());
82926             context.validator().validate();
82927           }
82928         };
82929       }
82930       function scaleSelection(factor) {
82931         return function() {
82932           if (!context.map().withinEditableZoom()) return;
82933           let nodes = utilGetAllNodes(selectedIDs, context.graph());
82934           let isUp = factor > 1;
82935           if (nodes.length <= 1) return;
82936           let extent2 = utilTotalExtent(selectedIDs, context.graph());
82937           function scalingDisabled() {
82938             if (tooSmall()) {
82939               return "too_small";
82940             } else if (extent2.percentContainedIn(context.map().extent()) < 0.8) {
82941               return "too_large";
82942             } else if (someMissing() || selectedIDs.some(incompleteRelation)) {
82943               return "not_downloaded";
82944             } else if (selectedIDs.some(context.hasHiddenConnections)) {
82945               return "connected_to_hidden";
82946             }
82947             return false;
82948             function tooSmall() {
82949               if (isUp) return false;
82950               let dLon = Math.abs(extent2[1][0] - extent2[0][0]);
82951               let dLat = Math.abs(extent2[1][1] - extent2[0][1]);
82952               return dLon < geoMetersToLon(1, extent2[1][1]) && dLat < geoMetersToLat(1);
82953             }
82954             function someMissing() {
82955               if (context.inIntro()) return false;
82956               let osm = context.connection();
82957               if (osm) {
82958                 let missing = nodes.filter(function(n3) {
82959                   return !osm.isDataLoaded(n3.loc);
82960                 });
82961                 if (missing.length) {
82962                   missing.forEach(function(loc2) {
82963                     context.loadTileAtLoc(loc2);
82964                   });
82965                   return true;
82966                 }
82967               }
82968               return false;
82969             }
82970             function incompleteRelation(id2) {
82971               let entity = context.entity(id2);
82972               return entity.type === "relation" && !entity.isComplete(context.graph());
82973             }
82974           }
82975           const disabled = scalingDisabled();
82976           if (disabled) {
82977             let multi = selectedIDs.length === 1 ? "single" : "multiple";
82978             context.ui().flash.duration(4e3).iconName("#iD-icon-no").iconClass("operation disabled").label(_t.append("operations.scale." + disabled + "." + multi))();
82979           } else {
82980             const pivot = context.projection(extent2.center());
82981             const annotation = _t("operations.scale.annotation." + (isUp ? "up" : "down") + ".feature", { n: selectedIDs.length });
82982             context.perform(actionScale(selectedIDs, pivot, factor, context.projection), annotation);
82983             context.validator().validate();
82984           }
82985         };
82986       }
82987       function didDoubleUp(d3_event, loc2) {
82988         if (!context.map().withinEditableZoom()) return;
82989         var target = select_default2(d3_event.target);
82990         var datum2 = target.datum();
82991         var entity = datum2 && datum2.properties && datum2.properties.entity;
82992         if (!entity) return;
82993         if (entity instanceof osmWay && target.classed("target")) {
82994           var choice = geoChooseEdge(context.graph().childNodes(entity), loc2, context.projection);
82995           var prev = entity.nodes[choice.index - 1];
82996           var next = entity.nodes[choice.index];
82997           context.perform(
82998             actionAddMidpoint({ loc: choice.loc, edge: [prev, next] }, osmNode()),
82999             _t("operations.add.annotation.vertex")
83000           );
83001           context.validator().validate();
83002         } else if (entity.type === "midpoint") {
83003           context.perform(
83004             actionAddMidpoint({ loc: entity.loc, edge: entity.edge }, osmNode()),
83005             _t("operations.add.annotation.vertex")
83006           );
83007           context.validator().validate();
83008         }
83009       }
83010       function selectElements() {
83011         if (!checkSelectedIDs()) return;
83012         var surface = context.surface();
83013         surface.selectAll(".selected-member").classed("selected-member", false);
83014         surface.selectAll(".selected").classed("selected", false);
83015         surface.selectAll(".related").classed("related", false);
83016         checkFocusedParent();
83017         if (_focusedParentWayId) {
83018           surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
83019         }
83020         if (context.map().withinEditableZoom()) {
83021           surface.selectAll(utilDeepMemberSelector(
83022             selectedIDs,
83023             context.graph(),
83024             true
83025             /* skipMultipolgonMembers */
83026           )).classed("selected-member", true);
83027           surface.selectAll(utilEntityOrDeepMemberSelector(selectedIDs, context.graph())).classed("selected", true);
83028         }
83029       }
83030       function esc() {
83031         if (context.container().select(".combobox").size()) return;
83032         context.enter(modeBrowse(context));
83033       }
83034       function firstVertex(d3_event) {
83035         d3_event.preventDefault();
83036         var entity = singular();
83037         var parentId = parentWayIdForVertexNavigation();
83038         var way;
83039         if (entity && entity.type === "way") {
83040           way = entity;
83041         } else if (parentId) {
83042           way = context.entity(parentId);
83043         }
83044         _focusedParentWayId = way && way.id;
83045         if (way) {
83046           context.enter(
83047             mode.selectedIDs([way.first()]).follow(true)
83048           );
83049         }
83050       }
83051       function lastVertex(d3_event) {
83052         d3_event.preventDefault();
83053         var entity = singular();
83054         var parentId = parentWayIdForVertexNavigation();
83055         var way;
83056         if (entity && entity.type === "way") {
83057           way = entity;
83058         } else if (parentId) {
83059           way = context.entity(parentId);
83060         }
83061         _focusedParentWayId = way && way.id;
83062         if (way) {
83063           context.enter(
83064             mode.selectedIDs([way.last()]).follow(true)
83065           );
83066         }
83067       }
83068       function previousVertex(d3_event) {
83069         d3_event.preventDefault();
83070         var parentId = parentWayIdForVertexNavigation();
83071         _focusedParentWayId = parentId;
83072         if (!parentId) return;
83073         var way = context.entity(parentId);
83074         var length2 = way.nodes.length;
83075         var curr = way.nodes.indexOf(selectedIDs[0]);
83076         var index = -1;
83077         if (curr > 0) {
83078           index = curr - 1;
83079         } else if (way.isClosed()) {
83080           index = length2 - 2;
83081         }
83082         if (index !== -1) {
83083           context.enter(
83084             mode.selectedIDs([way.nodes[index]]).follow(true)
83085           );
83086         }
83087       }
83088       function nextVertex(d3_event) {
83089         d3_event.preventDefault();
83090         var parentId = parentWayIdForVertexNavigation();
83091         _focusedParentWayId = parentId;
83092         if (!parentId) return;
83093         var way = context.entity(parentId);
83094         var length2 = way.nodes.length;
83095         var curr = way.nodes.indexOf(selectedIDs[0]);
83096         var index = -1;
83097         if (curr < length2 - 1) {
83098           index = curr + 1;
83099         } else if (way.isClosed()) {
83100           index = 0;
83101         }
83102         if (index !== -1) {
83103           context.enter(
83104             mode.selectedIDs([way.nodes[index]]).follow(true)
83105           );
83106         }
83107       }
83108       function focusNextParent(d3_event) {
83109         d3_event.preventDefault();
83110         var parents = parentWaysIdsOfSelection(true);
83111         if (!parents || parents.length < 2) return;
83112         var index = parents.indexOf(_focusedParentWayId);
83113         if (index < 0 || index > parents.length - 2) {
83114           _focusedParentWayId = parents[0];
83115         } else {
83116           _focusedParentWayId = parents[index + 1];
83117         }
83118         var surface = context.surface();
83119         surface.selectAll(".related").classed("related", false);
83120         if (_focusedParentWayId) {
83121           surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
83122         }
83123       }
83124       function selectParent(d3_event) {
83125         d3_event.preventDefault();
83126         var currentSelectedIds = mode.selectedIDs();
83127         var parentIds = _focusedParentWayId ? [_focusedParentWayId] : parentWaysIdsOfSelection(false);
83128         if (!parentIds.length) return;
83129         context.enter(
83130           mode.selectedIDs(parentIds)
83131         );
83132         _focusedVertexIds = currentSelectedIds;
83133       }
83134       function selectChild(d3_event) {
83135         d3_event.preventDefault();
83136         var currentSelectedIds = mode.selectedIDs();
83137         var childIds = _focusedVertexIds ? _focusedVertexIds.filter((id2) => context.hasEntity(id2)) : childNodeIdsOfSelection(true);
83138         if (!childIds || !childIds.length) return;
83139         if (currentSelectedIds.length === 1) _focusedParentWayId = currentSelectedIds[0];
83140         context.enter(
83141           mode.selectedIDs(childIds)
83142         );
83143       }
83144     };
83145     mode.exit = function() {
83146       _newFeature = false;
83147       _focusedVertexIds = null;
83148       _operations.forEach(function(operation2) {
83149         if (operation2.behavior) {
83150           context.uninstall(operation2.behavior);
83151         }
83152       });
83153       _operations = [];
83154       _behaviors.forEach(context.uninstall);
83155       select_default2(document).call(keybinding.unbind);
83156       context.ui().closeEditMenu();
83157       context.history().on("change.select", null).on("undone.select", null).on("redone.select", null);
83158       var surface = context.surface();
83159       surface.selectAll(".selected-member").classed("selected-member", false);
83160       surface.selectAll(".selected").classed("selected", false);
83161       surface.selectAll(".highlighted").classed("highlighted", false);
83162       surface.selectAll(".related").classed("related", false);
83163       context.map().on("drawn.select", null);
83164       context.ui().sidebar.hide();
83165       context.features().forceVisible([]);
83166       var entity = singular();
83167       if (_newFeature && entity && entity.type === "relation" && // no tags
83168       Object.keys(entity.tags).length === 0 && // no parent relations
83169       context.graph().parentRelations(entity).length === 0 && // no members or one member with no role
83170       (entity.members.length === 0 || entity.members.length === 1 && !entity.members[0].role)) {
83171         var deleteAction = actionDeleteRelation(
83172           entity.id,
83173           true
83174           /* don't delete untagged members */
83175         );
83176         context.perform(deleteAction, _t("operations.delete.annotation.relation"));
83177         context.validator().validate();
83178       }
83179     };
83180     return mode;
83181   }
83182
83183   // modules/behavior/lasso.js
83184   function behaviorLasso(context) {
83185     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
83186     var behavior = function(selection2) {
83187       var lasso;
83188       function pointerdown(d3_event) {
83189         var button = 0;
83190         if (d3_event.button === button && d3_event.shiftKey === true) {
83191           lasso = null;
83192           select_default2(window).on(_pointerPrefix + "move.lasso", pointermove).on(_pointerPrefix + "up.lasso", pointerup);
83193           d3_event.stopPropagation();
83194         }
83195       }
83196       function pointermove() {
83197         if (!lasso) {
83198           lasso = uiLasso(context);
83199           context.surface().call(lasso);
83200         }
83201         lasso.p(context.map().mouse());
83202       }
83203       function normalize2(a2, b2) {
83204         return [
83205           [Math.min(a2[0], b2[0]), Math.min(a2[1], b2[1])],
83206           [Math.max(a2[0], b2[0]), Math.max(a2[1], b2[1])]
83207         ];
83208       }
83209       function lassoed() {
83210         if (!lasso) return [];
83211         var graph = context.graph();
83212         var limitToNodes;
83213         if (context.map().editableDataEnabled(
83214           true
83215           /* skipZoomCheck */
83216         ) && context.map().isInWideSelection()) {
83217           limitToNodes = new Set(utilGetAllNodes(context.selectedIDs(), graph));
83218         } else if (!context.map().editableDataEnabled()) {
83219           return [];
83220         }
83221         var bounds = lasso.extent().map(context.projection.invert);
83222         var extent = geoExtent(normalize2(bounds[0], bounds[1]));
83223         var intersects2 = context.history().intersects(extent).filter(function(entity) {
83224           return entity.type === "node" && (!limitToNodes || limitToNodes.has(entity)) && geoPointInPolygon(context.projection(entity.loc), lasso.coordinates) && !context.features().isHidden(entity, graph, entity.geometry(graph));
83225         });
83226         intersects2.sort(function(node1, node2) {
83227           var parents1 = graph.parentWays(node1);
83228           var parents2 = graph.parentWays(node2);
83229           if (parents1.length && parents2.length) {
83230             var sharedParents = utilArrayIntersection(parents1, parents2);
83231             if (sharedParents.length) {
83232               var sharedParentNodes = sharedParents[0].nodes;
83233               return sharedParentNodes.indexOf(node1.id) - sharedParentNodes.indexOf(node2.id);
83234             } else {
83235               return Number(parents1[0].id.slice(1)) - Number(parents2[0].id.slice(1));
83236             }
83237           } else if (parents1.length || parents2.length) {
83238             return parents1.length - parents2.length;
83239           }
83240           return node1.loc[0] - node2.loc[0];
83241         });
83242         return intersects2.map(function(entity) {
83243           return entity.id;
83244         });
83245       }
83246       function pointerup() {
83247         select_default2(window).on(_pointerPrefix + "move.lasso", null).on(_pointerPrefix + "up.lasso", null);
83248         if (!lasso) return;
83249         var ids = lassoed();
83250         lasso.close();
83251         if (ids.length) {
83252           context.enter(modeSelect(context, ids));
83253         }
83254       }
83255       selection2.on(_pointerPrefix + "down.lasso", pointerdown);
83256     };
83257     behavior.off = function(selection2) {
83258       selection2.on(_pointerPrefix + "down.lasso", null);
83259     };
83260     return behavior;
83261   }
83262
83263   // modules/modes/browse.js
83264   function modeBrowse(context) {
83265     var mode = {
83266       button: "browse",
83267       id: "browse",
83268       title: _t.append("modes.browse.title"),
83269       description: _t.append("modes.browse.description")
83270     };
83271     var sidebar;
83272     var _selectBehavior;
83273     var _behaviors = [];
83274     mode.selectBehavior = function(val) {
83275       if (!arguments.length) return _selectBehavior;
83276       _selectBehavior = val;
83277       return mode;
83278     };
83279     mode.enter = function() {
83280       if (!_behaviors.length) {
83281         if (!_selectBehavior) _selectBehavior = behaviorSelect(context);
83282         _behaviors = [
83283           behaviorPaste(context),
83284           behaviorHover(context).on("hover", context.ui().sidebar.hover),
83285           _selectBehavior,
83286           behaviorLasso(context),
83287           modeDragNode(context).behavior,
83288           modeDragNote(context).behavior
83289         ];
83290       }
83291       _behaviors.forEach(context.install);
83292       if (document.activeElement && document.activeElement.blur) {
83293         document.activeElement.blur();
83294       }
83295       if (sidebar) {
83296         context.ui().sidebar.show(sidebar);
83297       } else {
83298         context.ui().sidebar.select(null);
83299       }
83300     };
83301     mode.exit = function() {
83302       context.ui().sidebar.hover.cancel();
83303       _behaviors.forEach(context.uninstall);
83304       if (sidebar) {
83305         context.ui().sidebar.hide();
83306       }
83307     };
83308     mode.sidebar = function(_2) {
83309       if (!arguments.length) return sidebar;
83310       sidebar = _2;
83311       return mode;
83312     };
83313     mode.operations = function() {
83314       return [operationPaste(context)];
83315     };
83316     return mode;
83317   }
83318
83319   // modules/behavior/add_way.js
83320   function behaviorAddWay(context) {
83321     var dispatch14 = dispatch_default("start", "startFromWay", "startFromNode");
83322     var draw = behaviorDraw(context);
83323     function behavior(surface) {
83324       draw.on("click", function() {
83325         dispatch14.apply("start", this, arguments);
83326       }).on("clickWay", function() {
83327         dispatch14.apply("startFromWay", this, arguments);
83328       }).on("clickNode", function() {
83329         dispatch14.apply("startFromNode", this, arguments);
83330       }).on("cancel", behavior.cancel).on("finish", behavior.cancel);
83331       context.map().dblclickZoomEnable(false);
83332       surface.call(draw);
83333     }
83334     behavior.off = function(surface) {
83335       surface.call(draw.off);
83336     };
83337     behavior.cancel = function() {
83338       window.setTimeout(function() {
83339         context.map().dblclickZoomEnable(true);
83340       }, 1e3);
83341       context.enter(modeBrowse(context));
83342     };
83343     return utilRebind(behavior, dispatch14, "on");
83344   }
83345
83346   // modules/behavior/hash.js
83347   function behaviorHash(context) {
83348     var _cachedHash = null;
83349     var _latitudeLimit = 90 - 1e-8;
83350     function computedHashParameters() {
83351       var map2 = context.map();
83352       var center = map2.center();
83353       var zoom = map2.zoom();
83354       var precision3 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
83355       var oldParams = utilObjectOmit(
83356         utilStringQs(window.location.hash),
83357         ["comment", "source", "hashtags", "walkthrough"]
83358       );
83359       var newParams = {};
83360       delete oldParams.id;
83361       var selected = context.selectedIDs().filter(function(id2) {
83362         return context.hasEntity(id2);
83363       });
83364       if (selected.length) {
83365         newParams.id = selected.join(",");
83366       } else if (context.selectedNoteID()) {
83367         newParams.id = "note/".concat(context.selectedNoteID());
83368       }
83369       newParams.map = zoom.toFixed(2) + "/" + center[1].toFixed(precision3) + "/" + center[0].toFixed(precision3);
83370       return Object.assign(oldParams, newParams);
83371     }
83372     function computedHash() {
83373       return "#" + utilQsString(computedHashParameters(), true);
83374     }
83375     function computedTitle(includeChangeCount) {
83376       var baseTitle = context.documentTitleBase() || "iD";
83377       var contextual;
83378       var changeCount;
83379       var titleID;
83380       var selected = context.selectedIDs().filter(function(id2) {
83381         return context.hasEntity(id2);
83382       });
83383       if (selected.length) {
83384         var firstLabel = utilDisplayLabel(context.entity(selected[0]), context.graph());
83385         if (selected.length > 1) {
83386           contextual = _t("title.labeled_and_more", {
83387             labeled: firstLabel,
83388             count: selected.length - 1
83389           });
83390         } else {
83391           contextual = firstLabel;
83392         }
83393         titleID = "context";
83394       }
83395       if (includeChangeCount) {
83396         changeCount = context.history().difference().summary().length;
83397         if (changeCount > 0) {
83398           titleID = contextual ? "changes_context" : "changes";
83399         }
83400       }
83401       if (titleID) {
83402         return _t("title.format." + titleID, {
83403           changes: changeCount,
83404           base: baseTitle,
83405           context: contextual
83406         });
83407       }
83408       return baseTitle;
83409     }
83410     function updateTitle(includeChangeCount) {
83411       if (!context.setsDocumentTitle()) return;
83412       var newTitle = computedTitle(includeChangeCount);
83413       if (document.title !== newTitle) {
83414         document.title = newTitle;
83415       }
83416     }
83417     function updateHashIfNeeded() {
83418       if (context.inIntro()) return;
83419       var latestHash = computedHash();
83420       if (_cachedHash !== latestHash) {
83421         _cachedHash = latestHash;
83422         window.history.replaceState(null, computedTitle(
83423           false
83424           /* includeChangeCount */
83425         ), latestHash);
83426         updateTitle(
83427           true
83428           /* includeChangeCount */
83429         );
83430         const q2 = utilStringQs(latestHash);
83431         if (q2.map) {
83432           corePreferences("map-location", q2.map);
83433         }
83434       }
83435     }
83436     var _throttledUpdate = throttle_default(updateHashIfNeeded, 500);
83437     var _throttledUpdateTitle = throttle_default(function() {
83438       updateTitle(
83439         true
83440         /* includeChangeCount */
83441       );
83442     }, 500);
83443     function hashchange() {
83444       if (window.location.hash === _cachedHash) return;
83445       _cachedHash = window.location.hash;
83446       var q2 = utilStringQs(_cachedHash);
83447       var mapArgs = (q2.map || "").split("/").map(Number);
83448       if (mapArgs.length < 3 || mapArgs.some(isNaN)) {
83449         updateHashIfNeeded();
83450       } else {
83451         if (_cachedHash === computedHash()) return;
83452         var mode = context.mode();
83453         context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
83454         if (q2.id && mode) {
83455           var ids = q2.id.split(",").filter(function(id2) {
83456             return context.hasEntity(id2) || id2.startsWith("note/");
83457           });
83458           if (ids.length && ["browse", "select-note", "select"].includes(mode.id)) {
83459             if (ids.length === 1 && ids[0].startsWith("note/")) {
83460               context.enter(modeSelectNote(context, ids[0]));
83461             } else if (!utilArrayIdentical(mode.selectedIDs(), ids)) {
83462               context.enter(modeSelect(context, ids));
83463             }
83464             return;
83465           }
83466         }
83467         var center = context.map().center();
83468         var dist = geoSphericalDistance(center, [mapArgs[2], mapArgs[1]]);
83469         var maxdist = 500;
83470         if (mode && mode.id.match(/^draw/) !== null && dist > maxdist) {
83471           context.enter(modeBrowse(context));
83472           return;
83473         }
83474       }
83475     }
83476     function behavior() {
83477       context.map().on("move.behaviorHash", _throttledUpdate);
83478       context.history().on("change.behaviorHash", _throttledUpdateTitle);
83479       context.on("enter.behaviorHash", _throttledUpdate);
83480       select_default2(window).on("hashchange.behaviorHash", hashchange);
83481       var q2 = utilStringQs(window.location.hash);
83482       if (q2.id) {
83483         const selectIds = q2.id.split(",");
83484         if (selectIds.length === 1 && selectIds[0].startsWith("note/")) {
83485           const noteId = selectIds[0].split("/")[1];
83486           context.zoomToNote(noteId, !q2.map);
83487         } else {
83488           context.zoomToEntities(
83489             // convert ids to short form id: node/123 -> n123
83490             selectIds.map((id2) => id2.replace(/([nwr])[^/]*\//, "$1")),
83491             !q2.map
83492           );
83493         }
83494       }
83495       if (q2.walkthrough === "true") {
83496         behavior.startWalkthrough = true;
83497       }
83498       if (q2.map) {
83499         behavior.hadLocation = true;
83500       } else if (!q2.id && corePreferences("map-location")) {
83501         const mapArgs = corePreferences("map-location").split("/").map(Number);
83502         context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
83503         updateHashIfNeeded();
83504         behavior.hadLocation = true;
83505       }
83506       hashchange();
83507       updateTitle(false);
83508     }
83509     behavior.off = function() {
83510       _throttledUpdate.cancel();
83511       _throttledUpdateTitle.cancel();
83512       context.map().on("move.behaviorHash", null);
83513       context.on("enter.behaviorHash", null);
83514       select_default2(window).on("hashchange.behaviorHash", null);
83515       window.location.hash = "";
83516     };
83517     return behavior;
83518   }
83519
83520   // node_modules/d3-brush/src/brush.js
83521   var { abs: abs2, max: max2, min: min2 } = Math;
83522   function number1(e3) {
83523     return [+e3[0], +e3[1]];
83524   }
83525   function number22(e3) {
83526     return [number1(e3[0]), number1(e3[1])];
83527   }
83528   var X3 = {
83529     name: "x",
83530     handles: ["w", "e"].map(type),
83531     input: function(x2, e3) {
83532       return x2 == null ? null : [[+x2[0], e3[0][1]], [+x2[1], e3[1][1]]];
83533     },
83534     output: function(xy) {
83535       return xy && [xy[0][0], xy[1][0]];
83536     }
83537   };
83538   var Y3 = {
83539     name: "y",
83540     handles: ["n", "s"].map(type),
83541     input: function(y2, e3) {
83542       return y2 == null ? null : [[e3[0][0], +y2[0]], [e3[1][0], +y2[1]]];
83543     },
83544     output: function(xy) {
83545       return xy && [xy[0][1], xy[1][1]];
83546     }
83547   };
83548   var XY = {
83549     name: "xy",
83550     handles: ["n", "w", "e", "s", "nw", "ne", "sw", "se"].map(type),
83551     input: function(xy) {
83552       return xy == null ? null : number22(xy);
83553     },
83554     output: function(xy) {
83555       return xy;
83556     }
83557   };
83558   function type(t2) {
83559     return { type: t2 };
83560   }
83561
83562   // modules/index.js
83563   var debug = false;
83564   var d3 = {
83565     dispatch: dispatch_default,
83566     geoMercator: mercator_default,
83567     geoProjection: projection,
83568     polygonArea: area_default3,
83569     polygonCentroid: centroid_default2,
83570     select: select_default2,
83571     selectAll: selectAll_default2,
83572     timerFlush
83573   };
83574
83575   // modules/id.js
83576   window.requestIdleCallback = window.requestIdleCallback || function(cb) {
83577     var start2 = Date.now();
83578     return window.requestAnimationFrame(function() {
83579       cb({
83580         didTimeout: false,
83581         timeRemaining: function() {
83582           return Math.max(0, 50 - (Date.now() - start2));
83583         }
83584       });
83585     });
83586   };
83587   window.cancelIdleCallback = window.cancelIdleCallback || function(id2) {
83588     window.cancelAnimationFrame(id2);
83589   };
83590   window.iD = modules_exports;
83591 })();
83592 //# sourceMappingURL=iD.js.map